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
|
.python-version
|
||||||
.DS_Store
|
.DS_Store
|
||||||
plugin/
|
plugin/
|
||||||
|
|
||||||
|
venv
|
40
README.md
40
README.md
|
@ -5,19 +5,21 @@ Personal configuration and plugins for Vim
|
||||||
```bash
|
```bash
|
||||||
curl -LO https://github.com/neovim/neovim/releases/latest/download/nvim.appimage
|
curl -LO https://github.com/neovim/neovim/releases/latest/download/nvim.appimage
|
||||||
chmod u+x nvim.appimage
|
chmod u+x nvim.appimage
|
||||||
mv nvim.appimage "$HOME/bin/."
|
mv nvim.appimage "$HOME/bin/nvim"
|
||||||
ln -s "$HOME/bin/nvim.appimage" "$HOME/bin/nvim" # Optional to avoid extension in commands
|
|
||||||
# ./nvim.appimage
|
|
||||||
```
|
```
|
||||||
|
|
||||||
## Installing configuration
|
## Installing configuration
|
||||||
```bash
|
```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
|
# or using symlink
|
||||||
git clone git@github.com:elitherl/vim-config.git /path/to/directory
|
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
|
### Installing `Packer` plugin manager
|
||||||
```bash
|
```bash
|
||||||
git clone --depth 1 https://github.com/wbthomason/packer.nvim\
|
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
|
Plugin definitions are in `plugins.lua`, inside `vim` run `:PackerSync` to install plugins
|
||||||
|
|
||||||
## Enabling python support
|
## Enabling python support
|
||||||
|
Set up neovim specific virtual environment to install `pynvim` package:
|
||||||
```bash
|
```bash
|
||||||
pyenv virtualenv neovim3 # Assumes working pyenv
|
python3 -m venv "${XDG_CONFIG_HOME:-$HOME/.config}/nvim/venv"
|
||||||
pyenv activate neovim3
|
source "${XDG_CONFIG_HOME:-$HOME/.config}/nvim/venv/bin/activate"
|
||||||
pip install -U pip setuptools wheel
|
pip install -U pip setuptools wheel && pip install -U pynvim
|
||||||
pip install -U pynvim pyright fortl # If pyright not available, fallback to: "python-lsp-server[all]" pylsp-mypy
|
source deactivate
|
||||||
pyenv 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
|
## Add LUA language server
|
||||||
Follow instructions from [sumneko/lua-language-server GitHub](https://github.com/sumneko/lua-language-server/wiki/Getting-Started#command-line).
|
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
|
if [ ! -d $PACKER_DIR ]; then
|
||||||
git clone --depth 1 https://github.com/wbthomason/packer.nvim $PACKER_DIR
|
git clone --depth 1 https://github.com/wbthomason/packer.nvim $PACKER_DIR
|
||||||
fi
|
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.
|
-- Setup lspconfig.
|
||||||
local capabilities = require('cmp_nvim_lsp').default_capabilities(vim.lsp.protocol.make_client_capabilities())
|
local capabilities = require('cmp_nvim_lsp').default_capabilities(vim.lsp.protocol.make_client_capabilities())
|
||||||
|
|
||||||
local function file_exists(name)
|
require('lspconfig')['pyright'].setup {
|
||||||
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,
|
on_attach = on_attach,
|
||||||
flags = lsp_flags,
|
flags = lsp_flags,
|
||||||
capabilities = capabilities,
|
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')['efm'].setup {
|
require('lspconfig')['efm'].setup {
|
||||||
init_options = { documentFormatting = true },
|
init_options = { documentFormatting = true },
|
||||||
|
@ -171,7 +145,6 @@ require('lspconfig')['efm'].setup {
|
||||||
}
|
}
|
||||||
|
|
||||||
require('lspconfig')['fortls'].setup {
|
require('lspconfig')['fortls'].setup {
|
||||||
cmd = { os.getenv("HOME") .. "/.pyenv/versions/neovim3/bin/fortls" },
|
|
||||||
on_attach = on_attach,
|
on_attach = on_attach,
|
||||||
flags = lsp_flags,
|
flags = lsp_flags,
|
||||||
capabilities = capabilities
|
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 = {
|
vim.g.python_indent = {
|
||||||
open_paren = 'shiftwidth()',
|
open_paren = 'shiftwidth()',
|
||||||
nested_paren = 'shiftwidth()',
|
nested_paren = 'shiftwidth()',
|
||||||
|
|
26
tmux.conf
26
tmux.conf
|
@ -17,10 +17,19 @@ set-option -sg escape-time 10
|
||||||
# Enable focus events
|
# Enable focus events
|
||||||
set-option -g focus-events on
|
set-option -g focus-events on
|
||||||
|
|
||||||
# Stop automatic window renaming
|
|
||||||
# set -g set-titles off
|
# Status bar styling
|
||||||
# set-window-option -g automatic-rename off
|
set -g status-interval 60
|
||||||
# set-option -g allow-rename off
|
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.
|
# Smart pane switching with awareness of Vim splits.
|
||||||
# See: https://github.com/christoomey/vim-tmux-navigator
|
# 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
|
bind-key -T copy-mode-vi 'C-\' select-pane -l
|
||||||
|
|
||||||
setw -g mode-keys vi
|
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