Skip to content

Latest commit

 

History

History
250 lines (178 loc) · 5.49 KB

README.md

File metadata and controls

250 lines (178 loc) · 5.49 KB

This repository contains five configuration files:

  • vimrc
  • neovim
  • zshrc
  • tmux.conf
  • fzf-git.zsh

VIM & Neovim

  1. It works fine on Mac OSX with VIM 8.0+ and Neovim 0.3.7.
  2. It should be OK for Linux with same version.

Install & Upgrade

Pre-requirements

# fzf, bat, ripgrep, fd
brew install fzf
brew install bat
brew install ripgrep
brew install fd

Install

  1. Clone vim.d

     git clone https://github.com/feiyuw/vim.d.git ~/workspace/vim.d
    
  2. Create ~/.vimrc

     ln -s ~/workspace/vim.d/vimrc ~/.vimrc  # vim
     mkdir -p ~/.config/nvim; ln -s ~/workspace/vim.d/nvim/init.vim ~/.config/nvim/init.vim  # neovim
    
  3. Open nvim, execute :PlugInstall

  4. Patch powerline font

    mkdir ~/.fonts
    git clone https://github.com/powerline/fonts.git ~/.fonts/powerline-fonts
    cd ~/.fonts/powerline-fonts
    ./install.sh
  5. Install coc extensions like:

    :CocInstall coc-go 
    :CocInstall coc-rls 
    :CocInstall coc-python 
    :CocInstall coc-tsserver 
    :CocInstall coc-json 
  6. Create ~/.config/nvim/coc-settings.json

    ln -s ~/workspace/vim.d/coc-settings.json ~/.config/nvim/coc-settings.json
  7. Open nvim again, enjoy!

Upgrade

  1. Update vim.d
    cd ~/workspace/vim.d
    git pull
  1. Open nvim, execute :PlugClean
  2. Open nvim, execute :PlugUpdate

Plugins

The plugins I used are:

  • tomasr/molokai
  • scrooloose/nerdtree
  • vim-scripts/NERD_tree-Project
  • scrooloose/nerdcommenter
  • majutsushi/tagbar
  • vim-airline/vim-airline
  • vim-airline/vim-airline-themes
  • tpope/vim-fugitive
  • feiyuw/robotframework-vim
  • ntpeters/vim-better-whitespace
  • elzr/vim-json
  • pangloss/vim-javascript
  • mxw/vim-jsx
  • leafgarland/typescript-vim
  • peitalin/vim-jsx-typescript
  • othree/html5.vim
  • airblade/vim-gitgutter
  • jiangmiao/auto-pairs
  • ekalinin/Dockerfile.vim
  • christoomey/vim-tmux-navigator
  • rust-lang/rust.vim
  • neoclide/coc.nvim
  • tpope/vim-sleuth
  • /usr/local/opt/fzf
  • junegunn/fzf.vim
  • godlygeek/tabular
  • plasticboy/vim-markdown
  • mhinz/vim-startify
  • jjo/vim-cue

Shortcuts

  1. ,e

    open file

  2. ,s

    open file in split window

  3. ,vs

    open file in vertical split window

  4. ,m

    comment/uncomment code

  5. ,f

    open function list of current file, like Ctrl-R in sublime

  6. <F4>

    open/close tag bar on the right panel

  7. <F12>

    open/close project browser on the left panel

  8. <Ctrl-Tab>

    in normal mode, switch files in minibuffer; in insert mode, used to select code snippet

  9. <Ctrl-p>

    in insert mode, used to open specified file quickly

  10. <Ctrl-g>

    in insert mode, used to search content of current project

  11. <Ctrl-e>

    in insert mode, used to search content of buffers

  12. ,c

    copy to system clipboard

  13. ,v

    paste from system clipboard

Some Tips

Edit file in column

  1. in normal mode, <Ctrl-v> start to select column, <Shift-v> to select multiple lines
  2. after select several columns,
    • I used to add content before cursor column
    • A used to add content after cursor column
    • r used to modify content under cursor
    • x used to delete content under cursor

Quick Move

  1. <Ctrl-o> move to previous edit position
  2. <Ctrl-i> move to forward edit position
  3. b move to previous word, w move to next word
    • try B and W, and see what's the difference
  4. { move to previous block, } move to next block
  5. 0 move to start of the line, $ move to end of the line
    • ^ move to first char of the line
  6. gg move to the start of the file, G move to the end of the file
  7. <Ctrl-]> jump to the definition of content under cursor, while <Ctrl-t> jump back

Quick Edit

  1. u undo, <Ctrl-r> redo
  2. . report last step
  3. di' delete content in '
  4. dt' delete content from current position to '
  5. cw modify the current word
  6. caw modify the current word
  7. c0 modify from start to current position
  8. c$ modify from current position to end of this line
  9. R update the content until got ESC

Macro

  1. qa start to record macro a
  2. execute some steps
  3. q stop to record
  4. @a execute the macro
  5. @@ execute the last executed macro

VIM on Terminal

  1. Try tmux and zsh on iTerm2

Tmux

ln -s ~/workspace/vim.d/tmux.conf ~/.tmux.conf
# clone tmux plugin manager
git clone https://github.com/tmux-plugins/tpm ~/.tmux/plugins/tpm
# open tmux
tmux
# Execute <C-b>I
# wait until all plugins installed
# enjoy

zsh

# install zsh
brew install zsh
# install oh-my-zsh
sh -c "$(curl -fsSL https://raw.github.com/robbyrussell/oh-my-zsh/master/tools/install.sh)"
ln -s ~/workspace/vim.d/zshrc ~/.zshrc
git clone https://github.com/zsh-users/zsh-autosuggestions ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-autosuggestions
git clone https://github.com/zsh-users/zsh-syntax-highlighting.git ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-syntax-highlighting
ln -s ~/workspace/vim.d/fzf-git.zsh ~/.oh-my-zsh/custom/fzf-git.zsh

Reopen terminal, and enjoy!

Screenshot

asciicast

Reference

  1. Vim Awesome
  2. Vim Tips
  3. Vim scripts
  4. Practical Vim