diff --git a/.gitmodules b/.gitmodules index 89e133a..5473b5c 100644 --- a/.gitmodules +++ b/.gitmodules @@ -4,9 +4,6 @@ [submodule "pack/plugin/start/vim-fugitive"] path = pack/plugin/start/vim-fugitive url = https://github.com/tpope/vim-fugitive.git -[submodule "pack/plugin/opt/ale"] - path = pack/plugin/opt/ale - url = https://github.com/dense-analysis/ale.git [submodule "pack/plugin/opt/nerdtree"] path = pack/plugin/opt/nerdtree url = https://github.com/preservim/nerdtree.git @@ -16,3 +13,6 @@ [submodule "pack/plugin/start/vim-orgmode"] path = pack/plugin/start/vim-orgmode url = https://github.com/jceb/vim-orgmode.git +[submodule "pack/plugin/start/ale"] + path = pack/plugin/start/ale + url = https://github.com/dense-analysis/ale.git diff --git a/README.md b/README.md new file mode 100644 index 0000000..1f2cd8a --- /dev/null +++ b/README.md @@ -0,0 +1,11 @@ +# vimfiles + +This is wuniu's vim settings. This file describes wuniu's editing experience. + +## Load Sequence + +1. vimrc and scripts are triggered by vimrc +1. plugins under `plugins/` and scripts triggered by them +1. packs under `pack/plugin/start/` and etc. +1. plugins under `after/plugins/` and etc. + diff --git a/after/plugin/30-Easymotion.vim b/after/plugin/30-Easymotion.vim new file mode 100644 index 0000000..307e52d --- /dev/null +++ b/after/plugin/30-Easymotion.vim @@ -0,0 +1,41 @@ +" This is customized file for easymotion package. + +packadd vim-easymotion +let g:EasyNotion_do_mapping = 0 " Disable default mapping +map (easymotion-prefix) + +" f{char} to move to {char} +map f (easymotion-bd-f) +nmap f (easymotion-overwin-f) + +" s{char}{char} to move to {char}{char} +nmap s (easymotion-overwin-f2) + +" Move to line +map L (easymotion-bd-jk) +nmap L (easymotion-overwin-line) + +" Move to word +map w (easymotion-bd-w) +nmap w (easymotion-overwin-w) + +" Gif config +nmap s (easymotion-s2) +nmap t (easymotion-t2) +map / (easymotion-sn) +omap / (easymotion-tn) + +" These `n` & `N` mappings are options. You do not have to map `n` & `N` to EasyMotion. +" Without these mappings, `n` & `N` works fine. (These mappings just provide +" different highlight method and have some other features ) +map n (easymotion-next) +map N (easymotion-prev) + +" Gif config +map l (easymotion-lineforward) +map j (easymotion-j) +map k (easymotion-k) +map h (easymotion-linebackward) + +let g:EasyMotion_startofline = 0 " keep cursor column when JK motion +let g:Easymotion_smartcase = 1 diff --git a/after/plugin/31-NerdTree.vim b/after/plugin/31-NerdTree.vim new file mode 100644 index 0000000..e1c0a29 --- /dev/null +++ b/after/plugin/31-NerdTree.vim @@ -0,0 +1,3 @@ +" This is configurations for NerdTree +packadd nerdtree +nnoremap n :NERDTreeFocus diff --git a/pack/plugin/opt/ale b/pack/plugin/start/ale similarity index 100% rename from pack/plugin/opt/ale rename to pack/plugin/start/ale diff --git a/plugin/01-gui.vim b/plugin/01-gui.vim new file mode 100644 index 0000000..5ed99da --- /dev/null +++ b/plugin/01-gui.vim @@ -0,0 +1,15 @@ +" This is special settings for vim-gui. +" +if has("gui_running") + if has("gui_gtk2") + set guifont=Inconsolata\ 12 + elseif has("gui_macvim") + set guifont=Menlo\ Regular:h14 + elseif has("gui_win32") + set guifont=CaskaydiaMono\ NFM:h12 + endif + set go-=T + set go-=m + set go-=r + set go-=L +endif diff --git a/plugin/30-ale.vim b/plugin/30-ale.vim new file mode 100644 index 0000000..0be4c96 --- /dev/null +++ b/plugin/30-ale.vim @@ -0,0 +1,7 @@ +" Enable completion where available. +" This setting must be set before ALE is loaded. +" +" You should not turn this setting on if you wish to use ALE as a completion +" source for other completion plugins, like Deoplete. +let g:ale_completion_enabled = 1 +set omnifunc=ale#completion#OmniFunc diff --git a/vimrc b/vimrc index 308aa48..3571132 100644 --- a/vimrc +++ b/vimrc @@ -1,75 +1,17 @@ " This is vimrc file, using as the profile of vim. " After modify vimrc, use `:so $MYVIMRC` to reload new profile. -" This part is only for gvim {{{ - -if has("gui_running") - if has("gui_gtk2") - set guifont=Inconsolata\ 12 - elseif has("gui_macvim") - set guifont=Menlo\ Regular:h14 - elseif has("gui_win32") - set guifont=Consolas:h12 - endif - set go-=T - set go-=m - set go-=r - set go-=L +" env variables +if has('win32') || has('win64') + let g:CONFIGPATH = $USERPROFILE . '/vimfiles' +elseif has('unix') + let g:CONFIGPATH = $HOME . '/.vim' endif -" gvim part ends }}} - -" Easymotion {{{ -packadd! vim-easymotion -let g:EasyNotion_do_mapping = 0 " Disable default mapping -map (easymotion-prefix) - -" f{char} to move to {char} -map f (easymotion-bd-f) -nmap f (easymotion-overwin-f) - -" s{char}{char} to move to {char}{char} -nmap s (easymotion-overwin-f2) - -" Move to line -map L (easymotion-bd-jk) -nmap L (easymotion-overwin-line) - -" Move to word -map w (easymotion-bd-w) -nmap w (easymotion-overwin-w) - -" Gif config -nmap s (easymotion-s2) -nmap t (easymotion-t2) -map / (easymotion-sn) -omap / (easymotion-tn) - -" These `n` & `N` mappings are options. You do not have to map `n` & `N` to EasyMotion. -" Without these mappings, `n` & `N` works fine. (These mappings just provide -" different highlight method and have some other features ) -map n (easymotion-next) -map N (easymotion-prev) - -" Gif config -map l (easymotion-lineforward) -map j (easymotion-j) -map k (easymotion-k) -map h (easymotion-linebackward) - -let g:EasyMotion_startofline = 0 " keep cursor column when JK motion -let g:Easymotion_smartcase = 1 -" Easymotion }}} - " ale " packadd! ale " ale -" NerdTree {{{ -packadd! nerdtree -nnoremap n :NERDTreeFocus -" }}} - filetype plugin indent on " Load plugins according to detected filetype. syntax on " Enable syntax highlighting. @@ -124,18 +66,22 @@ endif " Put all temporary files under the same directory. " https://github.com/mhinz/vim-galore#temporary-files - set backup - set backupdir =$USERPROFILE/vimfiles/backup/ - set backupext =-vimbackup - set backupskip = - set directory =$USERPROFILE/vimfiles/swap/ - set updatecount =100 - set undofile - set undodir =$USERPROFILE/vimfiles/undo/ +set backup +set backupext =-vimbackup +set backupskip = +set updatecount =100 +set undofile + +if exists('g:CONFIGPATH') + execute 'set undodir=' . escape(g:CONFIGPATH, ' \') . '/undo/' + execute 'set directory=' . escape(g:CONFIGPATH, ' \') . '/swap/' + execute 'set backupdir=' . escape(g:CONFIGPATH, ' \') . '/backup/' +endif " set textwidth =80 set updatetime =300 set signcolumn =yes +set smartcase set foldmethod =manual