Merge branch 'main' of github.com:elitherl/vim-config into main
This commit is contained in:
commit
e6c76b7798
2
.gitignore
vendored
2
.gitignore
vendored
|
@ -3,3 +3,5 @@
|
|||
.python-version
|
||||
.DS_Store
|
||||
plugin/
|
||||
|
||||
venv
|
40
README.md
40
README.md
|
@ -5,19 +5,21 @@ Personal configuration and plugins for Vim
|
|||
```bash
|
||||
curl -LO https://github.com/neovim/neovim/releases/latest/download/nvim.appimage
|
||||
chmod u+x nvim.appimage
|
||||
mv nvim.appimage "$HOME/bin/."
|
||||
ln -s "$HOME/bin/nvim.appimage" "$HOME/bin/nvim" # Optional to avoid extension in commands
|
||||
# ./nvim.appimage
|
||||
mv nvim.appimage "$HOME/bin/nvim"
|
||||
```
|
||||
|
||||
## Installing configuration
|
||||
```bash
|
||||
git clone git@github.com:elitherl/vim-config.git $XDG_CONFIG_HOME/nvim
|
||||
git clone git@github.com:elitherl/vim-config.git ${XDG_CONFIG_HOME:-$HOME/.config}/nvim
|
||||
# or using symlink
|
||||
git clone git@github.com:elitherl/vim-config.git /path/to/directory
|
||||
ln -s /path/to/directory $XDG_CONFIG_HOME/nvim
|
||||
ln -s /path/to/directory ${XDG_CONFIG_HOME:-$HOME/.config}/nvim
|
||||
```
|
||||
|
||||
### Install script
|
||||
`install.sh` currently handles installing `Packer`, `pynvim`, `pipx` and currently configured language servers with formatters.
|
||||
Will also update existing installs if already present.
|
||||
|
||||
### Installing `Packer` plugin manager
|
||||
```bash
|
||||
git clone --depth 1 https://github.com/wbthomason/packer.nvim\
|
||||
|
@ -26,15 +28,31 @@ git clone --depth 1 https://github.com/wbthomason/packer.nvim\
|
|||
Plugin definitions are in `plugins.lua`, inside `vim` run `:PackerSync` to install plugins
|
||||
|
||||
## Enabling python support
|
||||
Set up neovim specific virtual environment to install `pynvim` package:
|
||||
```bash
|
||||
pyenv virtualenv neovim3 # Assumes working pyenv
|
||||
pyenv activate neovim3
|
||||
pip install -U pip setuptools wheel
|
||||
pip install -U pynvim pyright fortl # If pyright not available, fallback to: "python-lsp-server[all]" pylsp-mypy
|
||||
pyenv deactivate
|
||||
python3 -m venv "${XDG_CONFIG_HOME:-$HOME/.config}/nvim/venv"
|
||||
source "${XDG_CONFIG_HOME:-$HOME/.config}/nvim/venv/bin/activate"
|
||||
pip install -U pip setuptools wheel && pip install -U pynvim
|
||||
source deactivate
|
||||
```
|
||||
|
||||
From [vim documentation](https://neovim.io/doc/user/nvim.html#nvim-from-vim)
|
||||
### Installing language servers using `pipx`
|
||||
Install [pipx](https://pypa.github.io/pipx/) in chosen manner, e.g. as given in documentation:
|
||||
|
||||
```bash
|
||||
python3 -m pip install --user pipx
|
||||
python3 -m pipx ensurepath
|
||||
```
|
||||
|
||||
For currently configured language servers and formatters run:
|
||||
|
||||
```bash
|
||||
pipx install pyright
|
||||
pipx install fortls
|
||||
pipx install black
|
||||
pipx install isort
|
||||
pipx install zimports
|
||||
```
|
||||
|
||||
## Add LUA language server
|
||||
Follow instructions from [sumneko/lua-language-server GitHub](https://github.com/sumneko/lua-language-server/wiki/Getting-Started#command-line).
|
||||
|
|
13
install.sh
13
install.sh
|
@ -5,3 +5,16 @@ PACKER_DIR="$HOME/.local/share/nvim/site/pack/packer/start/packer.nvim"
|
|||
if [ ! -d $PACKER_DIR ]; then
|
||||
git clone --depth 1 https://github.com/wbthomason/packer.nvim $PACKER_DIR
|
||||
fi
|
||||
|
||||
NVIM_DIR=$(dirname $(readlink -f $0))
|
||||
python3 -m venv "$NVIM_DIR/venv"
|
||||
$NVIM_DIR/venv/bin/python -m pip install -U pip setuptools wheel || exit 1
|
||||
$NVIM_DIR/venv/bin/python -m pip install -U pynvim
|
||||
|
||||
python3 -m pip install -U --user pipx || exit 1
|
||||
python3 -m pipx ensurepath || exit 1
|
||||
python3 -m pipx install pyright
|
||||
python3 -m pipx install fortls
|
||||
python3 -m pipx install black
|
||||
python3 -m pipx install isort
|
||||
python3 -m pipx install zimports
|
||||
|
|
|
@ -121,37 +121,11 @@ cmp.setup.cmdline(':', {
|
|||
-- Setup lspconfig.
|
||||
local capabilities = require('cmp_nvim_lsp').default_capabilities(vim.lsp.protocol.make_client_capabilities())
|
||||
|
||||
local function file_exists(name)
|
||||
local f = io.open(name, "r")
|
||||
if f ~= nil then io.close(f) return true else return false end
|
||||
end
|
||||
|
||||
local pyright_file = os.getenv("HOME") .. "/.pyenv/versions/neovim3/bin/pyright-langserver"
|
||||
local pylsp_file = os.getenv("HOME") .. "/.pyenv/versions/neovim3/bin/pylsp"
|
||||
|
||||
if file_exists(pyright_file) then
|
||||
require('lspconfig')['pyright'].setup {
|
||||
cmd = { pyright_file, "--stdio" },
|
||||
on_attach = on_attach,
|
||||
flags = lsp_flags,
|
||||
capabilities = capabilities,
|
||||
}
|
||||
elseif file_exists(pylsp_file) then
|
||||
require('lspconfig')['pylsp'].setup {
|
||||
cmd = { pylsp_file },
|
||||
on_attach = on_attach,
|
||||
flags = lsp_flags,
|
||||
settings = {
|
||||
pylsp = {
|
||||
plugins = {
|
||||
pycodestyle = { maxLineLength = 88 },
|
||||
flake8 = { maxLineLength = 88 }
|
||||
}
|
||||
}
|
||||
},
|
||||
capabilities = capabilities
|
||||
}
|
||||
end
|
||||
require('lspconfig')['pyright'].setup {
|
||||
on_attach = on_attach,
|
||||
flags = lsp_flags,
|
||||
capabilities = capabilities,
|
||||
}
|
||||
|
||||
require('lspconfig')['efm'].setup {
|
||||
init_options = { documentFormatting = true },
|
||||
|
@ -171,7 +145,6 @@ require('lspconfig')['efm'].setup {
|
|||
}
|
||||
|
||||
require('lspconfig')['fortls'].setup {
|
||||
cmd = { os.getenv("HOME") .. "/.pyenv/versions/neovim3/bin/fortls" },
|
||||
on_attach = on_attach,
|
||||
flags = lsp_flags,
|
||||
capabilities = capabilities
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
vim.g.python3_host_prog = '~/.pyenv/versions/neovim3/bin/python'
|
||||
vim.g.python3_host_prog = '~/.config/nvim/venv/bin/python'
|
||||
vim.g.python_indent = {
|
||||
open_paren = 'shiftwidth()',
|
||||
nested_paren = 'shiftwidth()',
|
||||
|
|
26
tmux.conf
26
tmux.conf
|
@ -17,10 +17,19 @@ set-option -sg escape-time 10
|
|||
# Enable focus events
|
||||
set-option -g focus-events on
|
||||
|
||||
# Stop automatic window renaming
|
||||
# set -g set-titles off
|
||||
# set-window-option -g automatic-rename off
|
||||
# set-option -g allow-rename off
|
||||
|
||||
# Status bar styling
|
||||
set -g status-interval 60
|
||||
WEATHER='#(curl -s 'wttr.in/?format="%%C+%%t+%%p"')'
|
||||
set -g status-bg colour238
|
||||
set -g status-fg colour255
|
||||
set -g status-left "[#H] "
|
||||
set -g status-right "$WEATHER"
|
||||
|
||||
# set the pane border colors
|
||||
set -g pane-border-style 'fg=colour235,bg=colour238'
|
||||
set -g pane-active-border-style 'fg=colour75,bg=colour236'
|
||||
|
||||
|
||||
# Smart pane switching with awareness of Vim splits.
|
||||
# See: https://github.com/christoomey/vim-tmux-navigator
|
||||
|
@ -43,12 +52,3 @@ bind-key -T copy-mode-vi 'C-l' select-pane -R
|
|||
bind-key -T copy-mode-vi 'C-\' select-pane -l
|
||||
|
||||
setw -g mode-keys vi
|
||||
|
||||
# Status bar styling
|
||||
set -g status-bg colour238
|
||||
set -g status-fg colour255
|
||||
set -g status-left '[#S] '
|
||||
|
||||
# set the pane border colors
|
||||
set -g pane-border-style 'fg=colour235,bg=colour238'
|
||||
set -g pane-active-border-style 'fg=colour75,bg=colour236'
|
||||
|
|
Loading…
Reference in a new issue