My very personal Vim configuration. I do Python and Go development at work on a daily basis. Also I need to read (more than writing) Javascript code (mostly ReactJS). My personal interests at the moment includes Clojure, Haskell, Rust and Scala programming languages to play on my free time. So this configuration supports these 7 languages. Except Clojure, all other language supports comes from corresponding Language Server. Some more details below.
- Compatible with both Vim >=8 and Neovim.
- Some plugins might not support vanilla Vim without compiled python3.
- Recommended environment includes iTerm nightly and tmux.
- Plugins managed by vim-plug.
- Primary programming languages supported:
Python,Clojure,Haskell,Rust,Go,JavascriptandScala. - Language support is available via corresponding Language
Servers
except for
Clojure. - Mnemonic keyboard shortcuts. E.g. file based actions under
<Leader>fand buffer based shortcuts are under<Leader>b. - Leader key is
space. - Local leader is
\. - I am using
LanguageClient-neovim as
autocompletion
and language client engine. Except Clojure all completion and
language server capabilities comes from
LanguageClient.
Notable custom key bindings;
- File based operations (starts with
<leader>f)<leader>ffFind files. Fuzzy search UI populated with ripgrep. It simulteanously shows files, open buffers. You can switch between these withC-nandC-p.<leader>fjFuzzy find junkfiles.<leader>ftToggle tagbar.<leader>fsWrite buffer to disk. Equivalent to:w<cr>.<leader>fWRemove trailing whitespace from whole buffer.
- Buffer based operations (starts with
<leader>b)<leader>bbList open buffers and prompt with fuzzy search to jump.<leader>bdDelete current buffer. Equivalent to:bd<cr>.<leader><tab>Switch to previous buffer. Equivalent to:b#<cr>.
- Search based operations
nmapped tonzzzvto keep matching line in the middle of the screen.<leader>/uses:grep!command to prompt and load results into quickfix list.<leader>*uses:grep!command with word under cursor and load results into quickfix list.<BS>executes:nohlsearch<cr>.<leader>ssPopulates (on the fly) all tags (outline) in the file. Plus all lines in the buffer will be in the list to narrow with fuzzy search. (ctags) into fuzzy search UI.
- Other
<leader>Vselects just pasted text.
- Programming support bindings.
gdjump to definition of the symbol under cursor using language server or specific plugin.Kshows hover information using language server or specific plugin.[cjump to next language server diagnostic message.]cjump to previous language server diagnostic message.gyshow type definition from language server.gishow implementations from language server.grshow references from language server.<leader>rnuse rename function from language server.
Check
keybindings.vim
for all custom keybindings. Filetype based keybindings (for haskell, python
etc.) and configurations can be found in corresponding files under
nvim/after/ftplugin directory.
Check plugins.vim for all plugins.
-
Install
Neovim(I prefer HEAD).$ brew install neovim --HEAD -
For Neovim it is recommended to use separated virtual python environments for editor's own needs (I use Fish shell and virtualfish). For any shell, these virtual environments must be located under
~/.virtualenvs/.$ vf new neovim2 $ vf new --python=python3 neovim3 -
Clone repository to any place you prefer.
$ git clone https://github.com/zekzekus/dotfiles.git -
Create symbolic links.
$ cd $HOME $ cd .config $ ln -s /path/to/dotfiles/nvim . -
Create necessary directories.
$ cd $HOME $ mkdir .nvimtmp -
First run will give errors. Ignore them.
$ nvim -
For each editor execute
:PlugInstallcommand. -
Install necessary OS packages.
$ brew install ctags ripgrep the_silver_searcher fzf brew install tavianator/tap/bfs -
Install Language Servers for the languages you want work on.
-
First install Homebrew
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)" -
Next, install the
tmuxandreattach-to-user-namespacepackages using Homebrewbrew install tmux brew install reattach-to-user-namespace -
Create a symbolic link to
dotfiles/tmux/tmux.confln -s /path/to/repo/dotfiles/tmux/tmux.conf ~/.tmux.conf -
-
Open
~/.tmux.confin your favorite editor and edit theMYSHELLandMYSHELL_PATHvariables in the file which defaults tofish... 3 # SHELL choice (zsh | fish) 4 MYSHELL=zsh 5 MYSHELL_PATH=/usr/local/bin/zsh ...
-
-
Run tmux
~$ tmux
-
Install the
xselandtmuxpackagessudo apt-get install xsel tmux -
Create a symbolic link to
dotfiles/tmux/tmux.ubuntu.confln -s /path/to/repo/dotfiles/tmux/tmux.ubuntu.conf ~/.tmux.conf -
-
Open
~/.tmux.confin your favorite editor and edit theMYSHELLandMYSHELL_PATHvariables in the file which defaults tofish... 3 # SHELL choice (zsh | fish) 4 MYSHELL=zsh 5 MYSHELL_PATH=/usr/bin/zsh ...
-
-
Run tmux
~$ tmux -
-
If you get an error regarding
ambiguous option: mouseedit your~/.tmux.confand change theset -g mouse onto this# set -g mouse on
-