- 中文介绍
- Introduction
- Requirements
- Install
- Update
- Upgrade plugins
- Delete
- How it works
- Main changes from spf13
- Some features
- Main shortcuts
- Plugins and their shortcuts
- .local file
- vim-plug
- ywvim中文输入法
- Markdown
- Themes Collentions
- vim-easy-align
- auto-pairs
- Complete Engines
- Complete Snippets, vim 7.4+ is also required
- Syntax Check
- Search/Replace tools
- RunTools
- language support
- tagbar and vim-gutentags
- undotree
- lightline
- fugitive
- bioSyntax-vim
- nerdcommenter
- fuzzy finder
- surround
- repeat
- vim-easy-align
- EasyMotion
- TODO
这里是我本人的vim配置,从spf13的spf13-vim:steve francia's vim distribution fork面来,作为几年前的作品,原配置已经不大适合这个vim8/neovim当道的时代。因此在近两年的使用时间里, 我不断调整,从其他人的配置中吸取经验,对参数进行微调,以适应在不同的系统环境条件下达到较好的使用体验。在OSX
windows
linx
下都可以安装使用
长期以来,这个README一直处于远远落后于配置改变的进度,细碎调整特别是快捷键的改动,实在是提不劲来修改。近日来随着最后几个补全插件的加入和配置调整,这个配置文件已经比较完整,因此可以好好坐下来,对使用方法和注意点作一介绍。(其实,在这写这个文档的时候还在不停地改快捷键)
PLEASE FORGIVE ME FOR MY POOR ENGLISH!!
This is leoatchina vim config forked from spf13-vim:steve francia's vim distribution. I sincerely thank him for great job. But in order to meet my furthers needs,I have changed lots of settings. And now it is suitable for vim/gvim/nvim for linux/mac/windows
You can find spf13's origin config at http://vim.spf13.com or https://github.com/spf13/spf13-vim.
Hereafter is spf13's introduction to his vim config
spf13-vim is a distribution of vim plugins and resources for Vim, Gvim and MacVim.It is a good starting point for anyone intending to use VIM for development running equally well on Windows, Linux, *nix and Mac.
Git 1.7
and Vim7.0
with any of +job
,+python
,+python3
,+lua
is at least required, Vim8
or neovim
and Git 2.0+
is prefered for advanced features
And I wish you have a basic understanding of vim, know how to read the config files to find what I have not mentioned here.
git clone https://github.com/leoatchina/leoatchina-vim.git
cd leoatchina-vim
./install.sh
git clone https://github.com/leoatchina/tools-leoatchina-vim.git
cd leoatchina-vim
click setup.cmd with administrator rights
open vim, do :PlugInstall
./install.sh ,chosse y|Y, the scipt will do git pull and do reinstall plugins
cd leoatchina-vim
git pull
open vim, do :PlugRe
cd leoatchina-vim
./updata.sh
OR
~/.vimrc.update
OR
open vim; do :PlugNew
open vim; do :PlugNew
cd leoatchina-vim
./uninstall.sh
click delete.cmd with administrator rights
After the installation, a .vimrc
symbol link in the ~
folder (for neovim, to its config file ~/.config/nvim/init.vim
in Linux ) which links to the .vimrc
file in the leoatchina-vim
folder.
- use
vim-plug
instead ofvundle
, faster and smarter, two ex cmdPlugRe
for uninstal/install plugins,PlugNew
for uninstall/update plugins simutanously. - totally simplified, delete
fork
,before
files ,delete lots of variables for feature settings - just as I have mentioned before, the link is from the cloned folder
- not support XP any more
- no backup
- no sound
- no scroll bars
- no menu, no tools when gui-running
- line number
- highlight search results
- smart indent
- In Visual, keep selection after indention change with
>
,<
<Leader>
to<Space>
, so the biggest key on keyboard is more usefull<LocalLeader>
to\
<Leader><cr>
: source~/.vimrc
. It is for config develop & debug<Cr>
for bracket jumpc-a
to the head of a line,c-e
to end in visual/insert mode, compatible with linux.c-f
,c-b
,c-h
,c-l
,g
work likeLeader
key in normal modec-f
to right andc-b
to left in insert modegf
to end of sentence,gb
to the beginning in normal/visual modec-e
to end of sentence,c-a
to the beginning in insert/command modec-k j
invoke browser toolsfzf
orLeaderF
orCtrlp
gc
for gcommit,gs
for git diff,g+Cr
for:Git
~
instead ofQ
, andQ
for quit current buffer at once.
for exit visual mode!
for:!
/
sent visual select part to command line;
sent visual select part aftter%s/
to command line<leader>TT
: tab help<leader>tw
: toggle wrap<leader>tf
: toggle folder<leader>tn
: number type toggle<M-R>
: run script (with plugin [vim-quickrun](https: //github.com/thinca/vim-quickrun))<M-Q>
: toggle quickrun windows<leader>th
: toggle search results highlight<leader>tr
: show register strings<leader>tp
: pastetoggle<leader>tn
: toggle number/relativenumbertab/buffer control
- set tabpagemax=10
- cmap Tabe tabe
- nnoremap
<silent><Tab>
: tabnext - nnoremap
<silent><S-Tab>
: tabprevious - nnoremap
<silent>-
: tabprevious - nnoremap
<Leader><Tab>
: tabm +1 - nnoremap
<Leader><S-Tab>
: tabm -1 - nnoremap
<Leader>-
: tabm -1 - nnoremap
<Leader>te
: tabe - nnoremap
<Leader>ts
: tab split - nnoremap
<Leader>tw
: tabs - nnoremap
<Leader>tm
: tabm - nnoremap
<LocalLeader><Backspace>
: buffers - nnoremap
<LocalLeader>]
: bn - nnoremap
<LocalLeader>[
: bp - nnoremap gq: tabclose
- and alt/cmd + 1,2,3,4.....0 for tabquickswitch
copy & paste
- vnoremap y "+y
- nnoremap y "+y
- nnoremap yy "+yy
- nnoremap Y "*y
- vnoremap Y "*y
- nnoremap Y y$
- vnoremap Y *y$
- nnoremap p "+p
- nnoremap P "*P
- vnoremap p "+p
- vnoremap P "*P
Some other shortcuts
- nnoremap w [I:let nr = input("Which one: ")exe "normal " . nr ."[\t"
- nnoremap fd :set nofoldenable! nofoldenable?
- nnoremap fw :set nowrap! nowrap?
- nnoremap w :w
- nnoremap W :wq!
- nnoremap WQ :wa:q
- nnoremap ` Q
- nnoremap Q :bd!
- nnoremap :q!
- nnoremap :qa!
- nnoremap \ :vsplit
- nnoremap \ :split
- nnoremap = =
- nnoremap :resize -3
- nnoremap :resize +3
- nnoremap :vertical resize -3
- nnoremap :vertical resize +3
- vnoremap < <gv
- vnoremap > >gv
Alt
key remap- according to skywind3000
- even mapped for macvim
- you should
map your alt key to Esc+
in youxshell
,securetcrt
,mobaxterm
,iterm2
,terminal
, etc. Alt
is different fromAlt+Shift
, so<M-a>
is different form<M-A>
, not likectrl
andctrl+shift
.
Hereafter are the plugins that I collected, if you want details for them, click it. At first I planned to detailly introduce every plugins, however, first it is easy for users to find the original repos of these plugins for details, second it is real a hard work to write work for each plugin. So , I simplly write something about the plugins, sometime only list the shortcut.
The .vimrc
or init.vim
sources ~/.vimrc.plug
for plugins definition, and ~/.vimrc.plug
sources ~/.vimrc.local
when the file exists.
This local
file contains an import variable called g:plug_groups
for the supported features for vim, the plugins will change.
The default contents of .vimrc.local
is:
let g:plug_groups=[] And you can also create
~/.gvimrc.local
forgvim
,~/.nvimrc.local
forneovim
,~/.mvimrc.local
formacvim
to intall diffent plugins for gvim and nvim. If these two local file not exist,.vimrc.local
works. The typical variables that could be add tog:plug_groups
arego
,YCM
,c
,coc
,rust
,bio
,wubi
, etc. Here is a trick that I set diffentPLUG_PATH
forvim/gvim/neovim
,~/.vim/plug
forvim
,~/.gvim/plug
forgvim
,~/.nvim/plug
forneovim
.
A smart and parallel plug manage plugin, instead of vundle which spf13 use.
It willed installed to ~/.vim-plug
after installation.
You can check how it is installed via install.sh
or setup.cmd
.
这个介绍我用中文写因为老外用不到。ywvim
中文输入法,在insert
模式下通过CTRL+\
开启,CTRL+^
进行配置。;
临时英文输入法;注意,默认只输入英文状态的标点;z
临时拼音;,.-=
上下翻页。开启办法: 要在 ~/.vimrc.local
里的g:plug_groups
加入wubi
(五笔)或者pinyin
(拼音).
Markdown syntastic hightlight by default, and if has gui with python support, markdown-preview.vim and relative plugins will be installed, then C-z
for preview in browser, C-s
for stop preview, C-q
for :Voom markdown
(with voom)
Forked from rafi's colorschemes collections, keeped 8 themes I prefer.
- wombat256 for vim befor 8.0
- gruvbox default vim8 theme
- jellybeans default neovim theme in *Unix
- hybrid default neovim theme in windows
- material default *Unix gvim theme
- codedark default windows gvim theme
nmap <localleader><Cr> <Plug>(EasyAlign)
vmap <Cr> <Plug>(EasyAlign)
let g:AutoPairs = {'(':')', '[':']', '{':'}','`':'`'}
let g:AutoPairsShortcutToggle = "<C-l>o"
let g:AutoPairsShortcutFastWrap = "<C-l>f"
let g:AutoPairsShortcutJump = "<C-l>j"
let g:AutoPairsShortcutBackInsert = "<C-l>i"
6 code-completion engines:ncm2
, coc
, asyncomplete
, neocomplete
, neocomplcache
and YouCompleteMe
.
There is variable "smartcomplete"
in "g:plug_groups"
contained in .vimrc.local
, it means .vimrc will choose the completion engine according to the vim enviroment if vim8/neovim
or old version
, python2/3
or no python
, windows
or linux
or mac
.
I strongly advice you updete to vim8.0+ or neovim for advanced engine with better performance.
By default, with '+python3' support, ncm
will be installed, otherwise asyncomplete
.
These engines have their semantic complete fuction with the help from other plugins relatively, which will be also installed, and will change with g:plug_groups
.
If you are install older vim7.4 (default installed by ubuntu , centos), has("lua")
will yank neocomplete
, and not
will be neocomplcache
. The two neo
engines has barely semantic completion funtions, their finishments are completed with snippets support.
You can also force to install the completion engine in g:plug_groups
, just replace smartcomplete
with it, but if the vim feature and enviroment not support the plug you choose, the engine will fall to neocomplcache
which is the one with the least requires.
youcompleteme
is the only complete engine that you must sepecially write into g:plug_groups
, which not be installed with smartcomplete
, and is the one with the best performance. Since it is hard to install, I advice you not to write it in .vimrc.local
untill you have a deep understanding to you system.
It is such a complex to make all the completion shortcuts compatible, finally I used a series of unroute shortcuts when completion menu popup: Tab
or C-j
for trigger, if not triggered , switch to the next. CR
for end completion(C-e
, C-y
still work). C-p
/C-n
or Up
/Down
for previous/next selection.
I have tried completor
, mucompletor
, supertab
but not keep them for some different reasons.
Needs neovim/vim
with +python
or +python3
, and g++
installed
Needs neovim/vim8
with node
and yarn
installed in system
Needs vim8/neovim
, +python3
is needed
Needs vim8/neovim
, no python support
is needed
Needs vim/neovim
with +lua
The last complete enginge
Works if with python support.
Works if without python support.
nnoremap <silent> <C-l><C-l> :ALELint<CR>
nmap <silent> <C-l><C-p> <Plug>(ale_previous_wrap)
nmap <silent> <C-l><C-n> <Plug>(ale_next_wrap)
nnoremap <silent> gad :ALEGoToDefinition<CR>
nnoremap <silent> gat :ALEGoToDefinitionInTab<CR>
nnoremap <silent> gar :ALEFindReferences<CR>
Works is not fits the need of ale
nnoremap <silent> <C-l><C-l> :call ToggleErrors()<cr>
nnoremap <silent> <C-l><C-p> :lprevious<cr>
nnoremap <silent> <C-l><C-n> :lnext<cr>
The main leader key is C-f
<C-f>g
to call the window
Needs ag
or rg
or ack
or
nmap <C-F>f <Plug>CtrlSFPrompt
vmap <C-F>f <Plug>CtrlSFVwordPath
vmap <C-F>F <Plug>CtrlSFVwordExec
nmap <C-F>n <Plug>CtrlSFCwordPath
nmap <C-F>N <Plug>CtrlSFCCwordPath
nmap <C-F>p <Plug>CtrlSFPwordPath
let g:multi_cursor_start_word_key = '<C-n>'
let g:multi_cursor_select_all_word_key = '<M-n>'
let g:multi_cursor_start_key = 'g<C-n>'
let g:multi_cursor_select_all_key = 'g<M-n>'
let g:multi_cursor_next_key = '<C-n>'
let g:multi_cursor_prev_key = '<C-_>'
let g:multi_cursor_skip_key = '<C-h>'
let g:multi_cursor_quit_key = '<ESC>'
Use M-r
to run scripts. M-s
to toggle quickrun window
A async run plugin for vim8/nvim
command! AsyncRunNow call s:ASYNC_RUN()
nmap <C-b>a :AsyncRunNow<CR>
nmap <C-b>s :AsyncStop<CR>
nmap <C-b>g :AsyncRun
au bufenter * if (winnr("$") == 1 && exists("AsyncRun!")) | q | endif
java: vim-eclim
You have to install eclipse, and eclim according to its instruction.
if b:eclim_available
au filetype java nnoremap <C-p>t :Pjt<Cr>
au filetype java nnoremap <C-p>l :ProjectList<Cr>
au filetype java nnoremap <C-p>b :ProjectBuild<Cr>
au filetype java nnoremap <C-p>f :ProjectRefresh<Cr>
au filetype java nnoremap <C-p>c :ProjectCD<Space>
au filetype java nnoremap <C-p>d :ProjectLCD<Space>
au filetype java nnoremap <C-p>n :ProjectCreate<Space>
au filetype java nnoremap <C-p>m :ProjectMove<Space>
au filetype java nnoremap <C-p>i :ProjectImport<Space>
au filetype java nnoremap <C-p>o :ProjectOpen<Space>
au filetype java nnoremap <C-p>r :ProjectRun
au filetype java nnoremap <C-p>j :Project
au filetype java nnoremap <C-p>I :ProjectInfo<Cr>
end
perl snippets and syntax
let g:phpcomplete_mappings = {
\ 'jump_to_def_split': '<C-]>',
\ 'jump_to_def_vsplit': '<C-\>',
\ 'jump_to_def': '<C-w><C-]>',
\ 'jump_to_def_tabnew': '<C-w><C-\>',
\}
tagbar and vim-gutentags
need has("ctags")
. Togglekey:<M-t>
Just as it name. Togglekey:<M-U>
Beautifull statusline for advanced information of workspace.
Git plugin. gc
for Gcommit
, and <leader><CR>
for :Git
As a bionformtion worker, this plug is use in view bam/sam/vcf. need add bio
in ~/.vimrc.local
Hackable plugin, the most import key is ** <Leader>c<Space>
|NERDComToggleComment|
You can get other shortcuts via the link.
C-k j
to invoke one of the following plugs, major keys are <C-k>l
, <C-k>m
, please see .vimrc
for details
This plugin is mainly used for locating files, buffers, mrus, tags in large project. Needs +python3
fzf runs asynchronously and can be orders of magnitude faster than similar Vim plugins.
works if no python
or python3
support
plugin to add bracket for string,here after is from <vim中的杀手级别的插件:surround>, * is for the cursor position
Old text Command New text
"Hello *world!" ds" Hello world!
[123+4*56]/2 cs]) (123+456)/2
"Look ma, I'm *HTML!" cs"<q> <q>Look ma, I'm HTML!</q>
if *x>3 { ysW( if ( x>3 ) {
my $str = *whee!; vlllls' my $str = 'whee!';
<div>Yo!*</div> dst Yo!
<div>Yo!*</div> cst<p> <p>Yo!</p>
command list
Normal mode
-----------
ds - delete a surrounding
cs - change a surrounding
ys - add a surrounding
yS - add a surrounding and place the surrounded text on a new line + indent it
yss - add a surrounding to the whole line
ySs - add a surrounding to the whole line, place it on a new line + indent it
ySS - same as ySs
Visual mode
-----------
s - in visual mode, add a surrounding
S - in visual mode, add a surrounding but place text on new line + indent it
Insert mode
-----------
<CTRL-g>s - in insert mode, add a surrounding
<CTRL-g>S - in insert mode, add a new line + surrounding + indent
if has surround
, use .
to repead
nmap <localleader><Cr> <Plug>(EasyAlign)
vmap <Cr> <Plug>(EasyAlign)
nmap <C-j><C-j> <Plug>(easymotion-w)
nmap <C-k><C-k> <Plug>(easymotion-b)
- debug