1
0
mirror of https://github.com/jdhao/nvim-config.git synced 2025-06-08 14:14:33 +02:00

Simplify init.vim and move settings to autoload and after directory

This commit is contained in:
jdhao
2019-09-12 21:29:00 +08:00
parent c0d82c312c
commit 6428422cbd
6 changed files with 175 additions and 226 deletions

1
after/ftplugin/cpp.vim Normal file
View File

@@ -0,0 +1 @@
nnoremap <F9> :w <CR> :!g++ -Wall -std=c++11 % -o %<&&./%<<CR>

View File

@@ -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>

6
after/ftplugin/tex.vim Normal file
View File

@@ -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

23
after/ftplugin/vim.vim Normal file
View File

@@ -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