Skip to content

Latest commit

 

History

History
217 lines (161 loc) · 4.5 KB

README.md

File metadata and controls

217 lines (161 loc) · 4.5 KB

vim setup

requirements

  • neovim
  • Homebrew or Linuxbrew

install vim-plug

use vim-plug for installing plugins and runtime files.

mkdir -p ~/.vim/autoload ~/.vim/backup ~/.vim/bundle ~/.vim/colors
cp -r ./vim/ ~/.vim/
cp -r ./config/ ~/.config/

install dotfiles

cp .vimrc ~
cp .ctags ~

reattach-to-user-namespace

for system clipboard access on macos

brew install reattach-to-user-namespace

install vim plugins

Open nvim and run :PlugInstall

ale linting support

Ale is an asynchronous linting engine.

Install eslint in your local project (or globally) and setup a default eslint config for ale to use

npm install eslint --save-dev
eslint --init

it also supports prettier!

Install prettier-eslint in your project (or globally)

npm install prettier-eslint --save-dev

For ruby linting, make sure rubocop is on your path.

For yaml linting, you need to install yamlint

brew install yamllint

fzf

fzf is a command-line fuzzy finder. It is a replacement for ctrl+p.

git clone --depth 1 https://github.com/junegunn/fzf.git ~/.fzf
~/.fzf/install

use ripgrep for searching since it supports ignoring directories like 'node_modules'

brew install ripgrep

or see ripgrep installation

then add the following to ~/.fzf.bash or ~/.fzf.zsh

# set fzf source to ripgrep and ignore some dirs
# see https://github.com/junegunn/fzf#respecting-gitignore
export FZF_DEFAULT_COMMAND='rg --files --no-ignore --hidden --follow -g "!{.git,node_modules,coverage}/*" 2> /dev/null'

ctags

#macos
brew install universal-ctags

#linux
sudo apt install universal-ctags

go

brew install go

In vim, type

:GoInstallBinaries

remap capslock

To map capslock to ctrl, add this to .bashrc

#linux
setxkbmap -layout us -option ctrl:nocaps

key mappings

'jj'      leave insert mode (same as esc)
'v'       leave visual mode
'esc+esc' no highlight
'\s'      save
'ctrl+d'  scroll down
'ctrl+u'  scroll up
\rtw      remove trailing whitespace
\rts      remove trailing whitespace
\cp       copy the file path of the current buffer to the clipboard

bufexplorer key mappings

'\be'     open buffer explorer (normal)
'\bs'     open buffer explorer (horiz split)
'\bv'     open buffer explorer (vert split)
'\bf'     buffer forward
'\bb'     buffer backwards
'\bc'     buffer close

nerdtree key mappings

'\n'      toggle nerdtree

fzf key mappings

'\ff'     fuzzy find files
'\fc'     fuzzy find git commits

ripgrep commands

':Rg'     <string|pattern>
':RgRoot' show root search dir

vim bookmarks commands

'mm'   Add/remove bookmark at current line
'mi'   Add/edit/remove annotation at current line
'mn'   Jump to next bookmark in buffer
'mp'   Jump to previous bookmark in buffer
'ma'   Show all bookmarks (toggle)
'mc'   Clear bookmarks in current buffer only
'mx'   Clear bookmarks in all buffers

vim session commands

'\ss'  Start a session
'\sr'  Restore a session
'\sp'  Pause a session
'\sx'  Destroy a session

JSON Tools

:PrettyPrintJSON  Prettify JSON
:PrettyJSON       Alias to above
:PrettyJson       Alias to above
:FormatJSON       Alias to above
:FormatJson       Alias to above

resources