diff options
| author | jdhao <jdhao@hotmail.com> | 2019-09-12 21:29:00 +0800 |
|---|---|---|
| committer | jdhao <jdhao@hotmail.com> | 2019-09-12 21:29:00 +0800 |
| commit | 6428422cbd2c16a64981fd205395661f718c7a59 (patch) | |
| tree | 63b918dbd4e015c3e8934ba4fe1a73c98c605932 /after/ftplugin | |
| parent | c0d82c312ce0df8866fa9f1bcdaf626fdfb3e709 (diff) | |
Simplify init.vim and move settings to autoload and after directory
Diffstat (limited to 'after/ftplugin')
| -rw-r--r-- | after/ftplugin/cpp.vim | 1 | ||||
| -rw-r--r-- | after/ftplugin/python.vim | 3 | ||||
| -rw-r--r-- | after/ftplugin/tex.vim | 6 | ||||
| -rw-r--r-- | after/ftplugin/vim.vim | 23 |
4 files changed, 33 insertions, 0 deletions
diff --git a/after/ftplugin/cpp.vim b/after/ftplugin/cpp.vim new file mode 100644 index 0000000..7962700 --- /dev/null +++ b/after/ftplugin/cpp.vim @@ -0,0 +1 @@ +nnoremap <F9> :w <CR> :!g++ -Wall -std=c++11 % -o %<&&./%<<CR> diff --git a/after/ftplugin/python.vim b/after/ftplugin/python.vim new file mode 100644 index 0000000..951ff69 --- /dev/null +++ b/after/ftplugin/python.vim @@ -0,0 +1,3 @@ +" Automatically save current file and execute it when pressing the <F9> key +" it is useful for small script +nnoremap <buffer> <F9> :execute 'w !python' shellescape(@%, 1)<CR> diff --git a/after/ftplugin/tex.vim b/after/ftplugin/tex.vim new file mode 100644 index 0000000..1181e79 --- /dev/null +++ b/after/ftplugin/tex.vim @@ -0,0 +1,6 @@ +" Only use the following character pairs for tex file +if &runtimepath =~? 'auto-pairs' + let b:AutoPairs = AutoPairsDefine({'<' : '>'}) + let b:AutoPairs = {'(':')', '[':']', '{':'}', '<':'>'} +endif +set textwidth=79 diff --git a/after/ftplugin/vim.vim b/after/ftplugin/vim.vim new file mode 100644 index 0000000..c95b6af --- /dev/null +++ b/after/ftplugin/vim.vim @@ -0,0 +1,23 @@ +" Disable inserting comment leader after hitting o or O +set formatoptions-=o + +" Disable inserting comment leader after hitting <Enter> in insert mode +set formatoptions-=r + +" Set the folding related options for vim script. Setting folding option +" in modeline is annoying in that the modeline get executed each time the +" window focus is lost (see http://tinyurl.com/yyqyyhnc) +set foldmethod=expr foldlevel=0 foldlevelstart=-1 + \ foldexpr=utils#VimFolds(v:lnum) foldtext=utils#MyFoldText() + +" Use :help command for keyword when pressing `K` in vim file, +" see `:h K` and https://bre.is/wC3Ih-26u +set keywordprg=:help + +" Only define following variable if Auto-pairs plugin is used +if &runtimepath =~? 'auto-pairs' + let b:AutoPairs = AutoPairsDefine({'<' : '>'}) + + " Do not use `"` for vim script since `"` is also used for comment + let b:AutoPairs = {'(':')', '[':']', '{':'}', "'":"'", "`":"`", '<':'>'} +endif |
