Skip to content

Latest commit

 

History

History
134 lines (83 loc) · 3.63 KB

vim-setup.md

File metadata and controls

134 lines (83 loc) · 3.63 KB

vim-setting

some note on setting vim on Mac terminal

Quick setup without plugins (using wget):

mkdir .vim
mkdir .vim/colors
wget -O .vimrc https://raw.githubusercontent.com/TSLsun/dotfiles/master/vim/plain.vimrc
wget -O .vim/colors/Tomorrow-Night-Bright.vim https://raw.githubusercontent.com/chriskempson/tomorrow-theme/master/vim/colors/Tomorrow-Night-Bright.vim

.vimrc

my vim dotfiles

.vim/colors/

Tomorrow-Night-Bright.vim

Plugins

1. vundle as plugin manger

Set up vundle:

git clone https://github.com/VundleVim/Vundle.vim.git ~/.vim/bundle/Vundle.vim

so % to source .vimrc after adding new plugins

run :PluginInstall to install plugins

2. YouCompleteMe for code autocompletion

Install CMake

Compiling YCM with semantic support for C-family languages:

cd ~/.vim/bundle/YouCompleteMe
/usr/local/Cellar/python/3.7.1/bin/python3 ./install.py --clang-completer

Setup in .vimrc:

" YouCompleteMe settings"
let g:ycm_server_keep_logfiles = 1
let g:ycm_server_log_level = 'debug'
let g:ycm_path_to_python_interpreter='/usr/local/Cellar/python/3.7.1/bin/python3'

" add anaconda3 envs, remember to `source activate envs`"
let g:ycm_python_binary_path = '/anaconda3/bin/python3'
let g:ycm_python_binary_path = '/anaconda3/envs/DataScience/bin/python3'
let g:ycm_global_ycm_extra_conf = "~/.ycm_extra_conf.py"
let g:ycm_autoclose_preview_window_after_completion = 1
map <leader>g  :YcmCompleter GoToDefinitionElseDeclaration<CR>

3. fzf look for files to open

:FZF look for files under current folder

:FZF ~ look for files under home directory

:FZF! starts fzf in fullscreen mode

Ctrl-T, Ctrl-X, Ctrl-V to open files in new tabs, horizontal splits or in vertical splits.

4. nerdtree a tree explorer plugin for vim

Setup in .vimrc:

"Open NERDTree with Ctrl-n"
map <C-n> :NERDTreeToggle<CR>

"close vim if NERDTree left open"
autocmd bufenter * if (winnr("$") == 1 && exists("b:NERDTree") && b:NERDTree.isTabTree()) | q | endif

"fix to show first letter"
let NERDTreeNodeDelimiter = "\t"

5. tagbar show tags

Install exuberant ctags brew install ctags-exuberant

" tagbar settings"
" need to installed ctags
let g:tagbar_ctags_bin = '/usr/local/Cellar/ctags/5.8_1/bin/ctags'
nmap <F8> :TagbarToggle<CR>

6. nerdcommenter make comments easier

[count]<leader>c<space> NERDComToggleComment

[count]<leader>ci NERDComInvertComment

<leader>cA Add comment at the end of the line

7. surround.vim to deal with surroundings

cs"' change surroundings from " to '

ysiw] add surroundings [] (iw is a text object)

ds{ delete surroundings {}

8. repeat.vim . works for surround.vim

9. indentLine . to show indentLine

10. Plugins for Markdown support and preview

markdown-preview


To try list

vim-multiple-cursors

fugitive