theme | class | backgroundColor |
---|---|---|
default |
invert |
black |
Raoul Millais
- This is not a flamewar :) It is a pitch for the virtues of using these tools
- An attempt to showcase how you can make your vim experience like the best IDE you (I!) ever used.
- Coding at "the speed of thought" - Feedback with vim (if it is configured well) should always be instantaneous or so quick as to seem instantaneous.
- Form your own opinions about how your development experience works
- This takes time. Quite a lot of time but your investment is paid off manifold if you are prepared to do it.
- Unix is the ultimate development environment, vim and tmux and zsh embrace and extend that idea
- IDEs have lots of opinions, often very good ones, but you must learn them and you might not like all of them. There is always a limit to the configurability. There is virtually no limit to configurability of vim, but it will reward you for configuration that is sympathetic with the vim philosophy of doing things.
- Almost all IDEs will get in the way of you typing at some point. Vim will never do that unless you configure it to do so.
- Avoid remapping any of the defaults - I have some exceptions below
- Try to create a neat mnemonic structure to under your leader key for mappings.
- 2 philosophoes, chording for really common shortcuts or all under leader key. Chording makes you prone to RSI so I favour leader mappings
jk
to so you don't move off the home row- , , for moving round splits to avoid chording and one less keypress Use both line number and relative numbering. You will see what line you are on as well as how far other lines are relative to the current line.
set number
set relativenumber
- Lots of options, I started using pathogen but you have to manage cloning
all the plugins yourself and pulling when you want to update which is a bit
tiresome. I now use vundle which is much nicer. I just do
:PluginUpdate
or:PluginInstall
- Vim 8 now has it's own rudimentary "package management!" (not quite true, but close) - I haven't tried it.
Asynchronous linting engine. Does linting and style checking for uncompiled files.
- shellcheck
- hadolint
- standard (for JavaScript)
- etc etc
Very fast. Shows errors in the error pane so you can navigate through them
Multiple options here: I used to use YouCompleteMe which was very powerful but it was a bit of a kitchen sink and sometimes a bit laggy. I've since switched to deoplete which is much faster and doesnt have a manual compile step after installing and gives me 90% of the functionality
Useful as a project browser but I don't use it much. I prefer to rely on fzf. It's almost always fewer keypreses to open the file I'm interested in.
Pro-tip map :NERDTreeToggle
to a hotkey to pop it open and closed
noremap <f2> :NERDTreeToggle<cr>
- Fugitive
- Git commits
- Git config
- make pane / split navigation work seamlessly by binding navigation to crtl-{h,j,k,l} in both vim and tmux:
- Make vim control tmux pane navigation
Plugin 'christoomey/vim-tmux-navigator'
- Remap ctrl-{h,j,k,l} for less chording
cnoremap <C-j> <t_kd>
cnoremap <C-k> <t_ku>
cnoremap <C-a> <Home>
cnoremap <C-e> <End>
- Move seamlessly between tmux panes and vim - to not clober the bindings of ctrl-j and ctrl-k for fzf panes we check that the focussed is vim first
is_vim="ps -o state= -o comm= -t '#{pane_tty}' \
| grep -iqE '^[^TXZ ]+ +(\\S+\\/)?g?(view|n?vim?x?)(diff)?$'"
bind-key -n C-h if-shell "$is_vim" "send-keys C-h" "select-pane -L"
bind-key -n C-j if-shell "$is_vim" "send-keys C-j" "select-pane -D"
bind-key -n C-k if-shell "$is_vim" "send-keys C-k" "select-pane -U"
bind-key -n C-l if-shell "$is_vim" "send-keys C-l" "select-pane -R"
bind-key -n C-\ if-shell "$is_vim" "send-keys C-\\" "select-pane -l"
# Vi mode line editing
bindkey -v
bindkey jk vi-cmd-mode
- Display "mode" on right hand side of prompt
function zle-line-init zle-keymap-select {
VIM_PROMPT="%{$fg_bold[yellow]%} [% NORMAL]% %{$reset_color%}"
RPS1="${${KEYMAP/vicmd/$VIM_PROMPT}/(main|viins)/} $EPS1"
zle reset-prompt
}
- Don't use oh-my-zsh it is very slow
- It includes a bloated dynamic plugin loading framework that is often activated on every keypres
- You probably don't use 90% of it
- You can walk through the source code and pull out the bits you actually need and use and you will end up with a much faster (instantaneous setup)
- You will learn a lot about zsh