GitHub - apemost/vimrc: A simple but powerful vim configuration
source link: https://github.com/apemost/vimrc
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
README.md
Andrew's vimrc
A simple but powerful vim configuration, continually used and tweaked since 2017.
Installation
You can clone this repository wherever you want. To install, run command:
git clone https://github.com/apemost/vimrc.git && cd vimrc && source bootstrap.sh
To update, cd
into your local vimrc
repository and then:
source bootstrap.sh
Changing themes and adding your own customization
To change themes, create a file ~/.vimrc.preload
, which looks like this:
let g:custom_background = 'light' let g:custom_colorscheme = 'solarized'
To conveniently add your own customization, copy vimrc.preload
to ~/.vimrc.preload
,
and vimrc.afterload
to ~/.vimrc.afterlaod
.
Add your custom plugin as builtin
Create your_custom_plugin.vim
under ~/.vim/plugins
.
Add plugin and customize like:
Plug 'gitrepo/your_custom_plugin' let g:custom_settings = 'custom_value'
Then add custom plugin file name at ~/.vim/plugins/init.vim
, see below:
let s:builtin_plugins = [ \ 'your_custom_plugin', \ ... \ ]
Finally source your vimrc and run :PlugInstall
.
Consistent experience for IdeaVim
Link the ideavimrc to ~/.ideavimrc
:
ln -s "$PWD/ideavimrc" ~/.ideavimrc
Or:
cp ideavimrc ~/.ideavimrc
Normal mode leader key mappings
Key
Command
Comment
<Leader>1
<Plug>AirlineSelectTab1
Select tab 1
<Leader>2
<Plug>AirlineSelectTab2
Select tab 2
<Leader>3
<Plug>AirlineSelectTab3
Select tab 3
<Leader>4
<Plug>AirlineSelectTab4
Select tab 4
<Leader>5
<Plug>AirlineSelectTab5
Select tab 5
<Leader>6
<Plug>AirlineSelectTab6
Select tab 6
<Leader>7
<Plug>AirlineSelectTab7
Select tab 7
<Leader>8
<Plug>AirlineSelectTab8
Select tab 8
<Leader>9
<Plug>AirlineSelectTab9
Select tab 9
<Leader>:
:AsyncRun<Space>
Run async shell commands
<Leader><Tab>
:Maps<CR>
Normal mode mappings
<Leader>=
:Neoformat<CR>
Neoformat
<Leader>W
:w !sudo tee % > /dev/null<CR>
Save as superuser
<Leader>a:
:Tabularize /:\zs<CR>
Text align at :
<Leader>a=
:Tabularize /=<CR>
Text align at =
<Leader>ac
:Pangu<CR>
Add space between Chinese characters and English letters/numbers/marks
<Leader>at
:TableFormat<CR>
Table format
<Leader>bb
:Buffers<CR>
Open buffers
<Leader>bd
:Bdelete<CR>
Unload current buffer and delete it from the buffer list
<Leader>bh
:BCommits<CR>
Git commits for the current buffer
<Leader>bo
:BufOnly<CR>
Delete all the buffers except the current buffer
<Leader>bw
:Bwipeout<CR>
Like :Bdelete
, but really delete the buffer
<Leader>c$
<Plug>NERDCommenterToEOL
Comment the current line from the cursor to the end of line
<Leader>c<Space>
<Plug>NERDCommenterToggle
Toggle the comment state of the selected line(s)
<Leader>cA
<Plug>NERDCommenterAppend
Add comment delimiters to the end of line and goes into insert mode between them
<Leader>ca
<Plug>NERDCommenterAltDelims
Switch to the alternative set of delimiters
<Leader>cb
<Plug>NERDCommenterAlignBoth
Same as <Leader>cc
except that the delimiters are aligned down the both side
<Leader>cc
<Plug>NERDCommenterComment
Comment out the current line or text selected in visual mode
<Leader>ci
<Plug>NERDCommenterInvert
Toggle the comment state of the selected line(s) individually
<Leader>cl
<Plug>NERDCommenterAlignLeft
Same as <Leader>cc
except that the delimiters are aligned down the left side
<Leader>cm
<Plug>NERDCommenterMinimal
Comment the given lines using only one set of multipart delimiters
<Leader>cn
<Plug>NERDCommenterNested
Same as <Leader>cc
but forces nesting
<Leader>cs
<Plug>NERDCommenterSexy
Comment out the selected lines sexily
<Leader>cu
<Plug>NERDCommenterUncomment
Uncomment the selected line(s)
<Leader>cy
<Plug>NERDCommenterYank
Same as <Leader>cc
except that the commented line(s) are yanked first
<Leader>f/
:History/<CR>
Search history
<Leader>f:
:History:<CR>
Command history
<Leader>fa
:Ag<Space><C-r><C-w><CR>
ag
search result at current word
<Leader>fc
:Commands<CR>
List commands
<Leader>ff
:GFiles<CR>
Git files (git ls-files
)
<Leader>fg
:Gg<Space><C-r><C-w><CR>
git grep
search result at current word
<Leader>fh
:History<CR>
v:oldfiles
and open buffers
<Leader>fm
:Marks<CR>
List marks
<Leader>fr
:Rg<Space><C-r><C-w><CR>
rg
search result at current word
<Leader>fs
:GFiles?<CR>
Git files (git status
)
<Leader>fu
:Snippets<CR>
List snippets (UltiSnips)
<Leader>fw
:Windows<CR>
List windows
<Leader>fz
:FZF<Space>
fzf
<Leader>gb
:Gblame<CR>
git blame
<Leader>gc
:Gcommit<Space>
git commit
<Leader>gD
:Gdiff<Space>
git diff
<Leader>gd
:Gdiff<CR>
git diff
<Leader>ge
:Gedit<Space>
:edit
a fugitive-object
<Leader>gf
:Gfetch<Space>
git fetch
<Leader>gg
:GFiles<CR>
Git files (git ls-files
)
<Leader>gh
:Commits<CR>
Git commits (requires fugitive.vim)
<Leader>gl
:Gpull<Space>
git pull
<Leader>gm
:Gmerge<Space>
git merge
<Leader>gp
:Gpush<Space>
git push
<Leader>gr
:Gread<Space>
Empty the buffer and :read
a fugitive-object
<Leader>gs
:Gstatus<CR>
git status
<Leader>gV
:GV<Space>
Open commit browser
<Leader>gv
:GV!<CR>
List commits that affected the current file
<Leader>gw
:Gwrite
Write to the current file's path and stage the results
<Leader>jd
:YcmCompleter GoToDeclaration<CR>
Looks up the symbol under the cursor and jumps to its declaration
<Leader>ji
:YcmCompleter GoToInclude<CR>
Looks up the current line for a header and jumps to it
<Leader>jj
:YcmCompleter GoToDefinition<CR>
Looks up the symbol under the cursor and jumps to its definition
<Leader>jr
:YcmCompleter GoToReferences<CR>
Reference finding
<Leader>nj
:NERDTreeFind<CR>
Find and reveal the file in the NERD tree
<Leader>nn
:NERDTreeFocus<CR>
Focus NERD tree
<Leader>qr
<Plug>(quickrun)
Execute whole/part of editing file
<Leader>sG
:GG<Space>
git grep
search result
<Leader>sR
:RG<Space>
rg
search result
<Leader>sa
:Ag<Space>
ag
search result
<Leader>se
Search engine result
<Leader>sg
:Gg<Space>
git grep
search result
<Leader>sr
:Rg<Space>
rg
search result
<Leader>td
:DockerToolsToggle<CR>
Toggle docker tools
<Leader>tn
:NERDTreeToggle<CR>
Toggle NERD tree
<Leader>tt
:TagbarToggle<CR>
Toggle tagbar
<Leader>tu
:UndotreeToggle<CR>
Toggle undotree
<Leader>yf
:let @+ = expand("%:p")<CR>
Yank full path of current buffer
<Leader>yn
:let @+ = expand("%")<CR>
Yank relative path of current buffer
Built-in plugins:
- Dockerfile.vim
- Vim-Jinja2-Syntax
- YouCompleteMe
- ale
- asyncrun.vim
- auto-pairs
- editorconfig-vim
- emmet-vim
- fzf.vim
- fzf
- gruvbox
- gv.vim
- is.vim
- jump.vim
- kotlin-vim
- kronos.vim
- neoformat
- nerdcommenter
- nerdtree
- nginx.vim
- pangu.vim
- plantuml-syntax
- rename.vim
- swift.vim
- tabular
- tagbar
- tmuxline.vim
- typescript-vim
- ultisnips
- undotree
- vim-airline-themes
- vim-airline
- vim-auto-save
- vim-bbye
- vim-bufonly
- vim-cpp-enhanced-highlight
- vim-docker-tools
- vim-emacscommandline
- vim-endwise
- vim-fugitive
- vim-gitgutter
- vim-gnupg
- vim-go
- vim-illuminate
- vim-javascript
- vim-jsdoc
- vim-json
- vim-jsx
- vim-markdown-preview
- vim-markdown
- vim-pydocstring
- vim-quickrun
- vim-repeat
- vim-sneak
- vim-snippets
- vim-surround
- vim-toml
- vim-vue
- vimtex
Uninstallation
Run rm ~/.vimrc
.
Contributing
All contributions are welcome! If you would like to hack on this work, please follow these steps:
- Fork this repository
- Make your changes
- Submit a pull request
License
Recommend
About Joyk
Aggregate valuable and interesting links.
Joyk means Joy of geeK