mirror of
https://github.com/jdhao/nvim-config.git
synced 2025-06-08 14:14:33 +02:00
change vim script style from 4-space indent to 2-space
This commit is contained in:
parent
c248ab02d4
commit
b65c7c6d70
@ -2,6 +2,6 @@ set concealcursor=c
|
|||||||
set synmaxcol=3000 " For long Chinese paragraphs
|
set synmaxcol=3000 " For long Chinese paragraphs
|
||||||
|
|
||||||
if exists(':FootnoteNumber')
|
if exists(':FootnoteNumber')
|
||||||
nnoremap <buffer> <Plug>AddVimFootnote :<c-u>call markdownfootnotes#VimFootnotes('i')<CR>
|
nnoremap <buffer> <Plug>AddVimFootnote :<c-u>call markdownfootnotes#VimFootnotes('i')<CR>
|
||||||
inoremap <buffer> <Plug>AddVimFootnote <C-O>:<c-u>call markdownfootnotes#VimFootnotes('i')<CR>
|
inoremap <buffer> <Plug>AddVimFootnote <C-O>:<c-u>call markdownfootnotes#VimFootnotes('i')<CR>
|
||||||
endif
|
endif
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
if exists(':AsyncRun')
|
if exists(':AsyncRun')
|
||||||
nnoremap <silent> <F9> :AsyncRun python -u "%"<CR>
|
nnoremap <silent> <F9> :AsyncRun python -u "%"<CR>
|
||||||
endif
|
endif
|
||||||
|
|
||||||
" Do not wrap Python source code.
|
" Do not wrap Python source code.
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
" Only use the following character pairs for tex file
|
" Only use the following character pairs for tex file
|
||||||
if &runtimepath =~? 'auto-pairs'
|
if &runtimepath =~? 'auto-pairs'
|
||||||
let b:AutoPairs = AutoPairsDefine({'<' : '>'})
|
let b:AutoPairs = AutoPairsDefine({'<' : '>'})
|
||||||
let b:AutoPairs = {'(':')', '[':']', '{':'}', '<':'>'}
|
let b:AutoPairs = {'(':')', '[':']', '{':'}', '<':'>'}
|
||||||
endif
|
endif
|
||||||
set textwidth=79
|
set textwidth=79
|
||||||
|
|||||||
@ -9,16 +9,21 @@ set formatoptions-=r
|
|||||||
" focus is lost (see
|
" focus is lost (see
|
||||||
" https://github.com/tmux-plugins/vim-tmux-focus-events/issues/14)
|
" https://github.com/tmux-plugins/vim-tmux-focus-events/issues/14)
|
||||||
set foldmethod=expr foldlevel=0 foldlevelstart=-1
|
set foldmethod=expr foldlevel=0 foldlevelstart=-1
|
||||||
\ foldexpr=utils#VimFolds(v:lnum) foldtext=utils#MyFoldText()
|
\ foldexpr=utils#VimFolds(v:lnum) foldtext=utils#MyFoldText()
|
||||||
|
|
||||||
" Use :help command for keyword when pressing `K` in vim file,
|
" Use :help command for keyword when pressing `K` in vim file,
|
||||||
" see `:h K` and https://stackoverflow.com/q/15867323/6064933
|
" see `:h K` and https://stackoverflow.com/q/15867323/6064933
|
||||||
set keywordprg=:help
|
set keywordprg=:help
|
||||||
|
|
||||||
|
set tabstop=2 " number of visual spaces per TAB
|
||||||
|
set softtabstop=2 " number of spaces in tab when editing
|
||||||
|
set shiftwidth=2 " number of spaces to use for autoindent
|
||||||
|
set expandtab " expand tab to spaces so that tabs are spaces
|
||||||
|
|
||||||
" Only define following variable if Auto-pairs plugin is used
|
" Only define following variable if Auto-pairs plugin is used
|
||||||
if &runtimepath =~? 'auto-pairs'
|
if &runtimepath =~? 'auto-pairs'
|
||||||
let b:AutoPairs = AutoPairsDefine({'<' : '>'})
|
let b:AutoPairs = AutoPairsDefine({'<' : '>'})
|
||||||
|
|
||||||
" Do not use `"` for vim script since `"` is also used for comment
|
" Do not use `"` for vim script since `"` is also used for comment
|
||||||
let b:AutoPairs = {'(':')', '[':']', '{':'}', "'":"'", '`':'`', '<':'>'}
|
let b:AutoPairs = {'(':')', '[':']', '{':'}', "'":"'", '`':'`', '<':'>'}
|
||||||
endif
|
endif
|
||||||
|
|||||||
@ -1,41 +1,38 @@
|
|||||||
"{ Auto commands
|
"{ Auto commands
|
||||||
" Do not use smart case in command line mode, extracted from https://vi.stackexchange.com/a/16511/15292.
|
" Do not use smart case in command line mode, extracted from https://vi.stackexchange.com/a/16511/15292.
|
||||||
augroup dynamic_smartcase
|
augroup dynamic_smartcase
|
||||||
autocmd!
|
autocmd!
|
||||||
autocmd CmdLineEnter : set nosmartcase
|
autocmd CmdLineEnter : set nosmartcase
|
||||||
autocmd CmdLineLeave : set smartcase
|
autocmd CmdLineLeave : set smartcase
|
||||||
augroup END
|
augroup END
|
||||||
|
|
||||||
augroup term_settings
|
augroup term_settings
|
||||||
autocmd!
|
autocmd!
|
||||||
" Do not use number and relative number for terminal inside nvim
|
" Do not use number and relative number for terminal inside nvim
|
||||||
autocmd TermOpen * setlocal norelativenumber nonumber
|
autocmd TermOpen * setlocal norelativenumber nonumber
|
||||||
" Go to insert mode by default to start typing command
|
" Go to insert mode by default to start typing command
|
||||||
autocmd TermOpen * startinsert
|
autocmd TermOpen * startinsert
|
||||||
augroup END
|
augroup END
|
||||||
|
|
||||||
" More accurate syntax highlighting? (see `:h syn-sync`)
|
" More accurate syntax highlighting? (see `:h syn-sync`)
|
||||||
augroup accurate_syn_highlight
|
augroup accurate_syn_highlight
|
||||||
autocmd!
|
autocmd!
|
||||||
autocmd BufEnter * :syntax sync fromstart
|
autocmd BufEnter * :syntax sync fromstart
|
||||||
augroup END
|
augroup END
|
||||||
|
|
||||||
" Return to last edit position when opening a file
|
" Return to last edit position when opening a file
|
||||||
augroup resume_edit_position
|
augroup resume_edit_position
|
||||||
autocmd!
|
autocmd!
|
||||||
autocmd BufReadPost *
|
autocmd BufReadPost *
|
||||||
\ if line("'\"") > 1 && line("'\"") <= line("$") && &ft !~# 'commit'
|
\ if line("'\"") > 1 && line("'\"") <= line("$") && &ft !~# 'commit' | execute "normal! g`\"zvzz" | endif
|
||||||
\ | execute "normal! g`\"zvzz"
|
|
||||||
\ | endif
|
|
||||||
augroup END
|
augroup END
|
||||||
|
|
||||||
" Display a message when the current file is not in utf-8 format.
|
" Display a message when the current file is not in utf-8 format.
|
||||||
" Note that we need to use `unsilent` command here because of this issue:
|
" Note that we need to use `unsilent` command here because of this issue:
|
||||||
" https://github.com/vim/vim/issues/4379
|
" https://github.com/vim/vim/issues/4379
|
||||||
augroup non_utf8_file_warn
|
augroup non_utf8_file_warn
|
||||||
autocmd!
|
autocmd!
|
||||||
autocmd BufRead * if &fileencoding != 'utf-8'
|
autocmd BufRead * if &fileencoding != 'utf-8' | unsilent echomsg 'File not in UTF-8 format!' | endif
|
||||||
\ | unsilent echomsg 'File not in UTF-8 format!' | endif
|
|
||||||
augroup END
|
augroup END
|
||||||
|
|
||||||
" Automatically reload the file if it is changed outside of Nvim, see
|
" Automatically reload the file if it is changed outside of Nvim, see
|
||||||
@ -44,11 +41,11 @@ augroup END
|
|||||||
" line before executing this command. See also
|
" line before executing this command. See also
|
||||||
" https://vi.stackexchange.com/a/20397/15292.
|
" https://vi.stackexchange.com/a/20397/15292.
|
||||||
augroup auto_read
|
augroup auto_read
|
||||||
autocmd!
|
autocmd!
|
||||||
autocmd FocusGained,BufEnter,CursorHold,CursorHoldI *
|
autocmd FocusGained,BufEnter,CursorHold,CursorHoldI *
|
||||||
\ if mode() == 'n' && getcmdwintype() == '' | checktime | endif
|
\ if mode() == 'n' && getcmdwintype() == '' | checktime | endif
|
||||||
autocmd FileChangedShellPost * echohl WarningMsg
|
autocmd FileChangedShellPost * echohl WarningMsg
|
||||||
\ | echo "File changed on disk. Buffer reloaded!" | echohl None
|
\ | echo "File changed on disk. Buffer reloaded!" | echohl None
|
||||||
augroup END
|
augroup END
|
||||||
|
|
||||||
augroup numbertoggle
|
augroup numbertoggle
|
||||||
@ -59,12 +56,12 @@ augroup END
|
|||||||
|
|
||||||
" highlight yanked region, see `:h lua-highlight`
|
" highlight yanked region, see `:h lua-highlight`
|
||||||
augroup custom_highlight
|
augroup custom_highlight
|
||||||
autocmd!
|
autocmd!
|
||||||
autocmd ColorScheme * highlight YankColor ctermfg=59 ctermbg=41 guifg=#34495E guibg=#2ECC71
|
autocmd ColorScheme * highlight YankColor ctermfg=59 ctermbg=41 guifg=#34495E guibg=#2ECC71
|
||||||
augroup END
|
augroup END
|
||||||
|
|
||||||
augroup highlight_yank
|
augroup highlight_yank
|
||||||
autocmd!
|
autocmd!
|
||||||
au TextYankPost * silent! lua vim.highlight.on_yank{higroup="YankColor", timeout=700}
|
au TextYankPost * silent! lua vim.highlight.on_yank{higroup="YankColor", timeout=700}
|
||||||
augroup END
|
augroup END
|
||||||
"}
|
"}
|
||||||
|
|||||||
@ -1,87 +1,87 @@
|
|||||||
" Remove trailing white space, see https://vi.stackexchange.com/a/456/15292
|
" Remove trailing white space, see https://vi.stackexchange.com/a/456/15292
|
||||||
function utils#StripTrailingWhitespaces() abort
|
function utils#StripTrailingWhitespaces() abort
|
||||||
let l:save = winsaveview()
|
let l:save = winsaveview()
|
||||||
" vint: next-line -ProhibitCommandRelyOnUser -ProhibitCommandWithUnintendedSideEffect
|
" vint: next-line -ProhibitCommandRelyOnUser -ProhibitCommandWithUnintendedSideEffect
|
||||||
keeppatterns %s/\v\s+$//e
|
keeppatterns %s/\v\s+$//e
|
||||||
call winrestview(l:save)
|
call winrestview(l:save)
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
" Create command alias safely, see https://stackoverflow.com/q/3878692/6064933
|
" Create command alias safely, see https://stackoverflow.com/q/3878692/6064933
|
||||||
" The following two functions are taken from answer below on SO:
|
" The following two functions are taken from answer below on SO:
|
||||||
" https://stackoverflow.com/a/10708687/6064933
|
" https://stackoverflow.com/a/10708687/6064933
|
||||||
function! utils#Cabbrev(key, value) abort
|
function! utils#Cabbrev(key, value) abort
|
||||||
execute printf('cabbrev <expr> %s (getcmdtype() == ":" && getcmdpos() <= %d) ? %s : %s',
|
execute printf('cabbrev <expr> %s (getcmdtype() == ":" && getcmdpos() <= %d) ? %s : %s',
|
||||||
\ a:key, 1+len(a:key), <SID>Single_quote(a:value), <SID>Single_quote(a:key))
|
\ a:key, 1+len(a:key), <SID>Single_quote(a:value), <SID>Single_quote(a:key))
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
function! s:Single_quote(str) abort
|
function! s:Single_quote(str) abort
|
||||||
return "'" . substitute(copy(a:str), "'", "''", 'g') . "'"
|
return "'" . substitute(copy(a:str), "'", "''", 'g') . "'"
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
" Check the syntax group in the current cursor position, see
|
" Check the syntax group in the current cursor position, see
|
||||||
" https://stackoverflow.com/q/9464844/6064933 and
|
" https://stackoverflow.com/q/9464844/6064933 and
|
||||||
" https://jordanelver.co.uk/blog/2015/05/27/working-with-vim-colorschemes/
|
" https://jordanelver.co.uk/blog/2015/05/27/working-with-vim-colorschemes/
|
||||||
function! utils#SynGroup() abort
|
function! utils#SynGroup() abort
|
||||||
if !exists('*synstack')
|
if !exists('*synstack')
|
||||||
return
|
return
|
||||||
endif
|
endif
|
||||||
echo map(synstack(line('.'), col('.')), 'synIDattr(v:val, "name")')
|
echo map(synstack(line('.'), col('.')), 'synIDattr(v:val, "name")')
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
" Check if a colorscheme exists in runtimepath.
|
" Check if a colorscheme exists in runtimepath.
|
||||||
" The following two functions are inspired by https://stackoverflow.com/a/5703164/6064933.
|
" The following two functions are inspired by https://stackoverflow.com/a/5703164/6064933.
|
||||||
function! utils#HasColorscheme(name) abort
|
function! utils#HasColorscheme(name) abort
|
||||||
let l:pat = 'colors/' . a:name . '.vim'
|
let l:pat = 'colors/' . a:name . '.vim'
|
||||||
return !empty(globpath(&runtimepath, l:pat))
|
return !empty(globpath(&runtimepath, l:pat))
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
" Check if an Airline theme exists in runtimepath.
|
" Check if an Airline theme exists in runtimepath.
|
||||||
function! utils#HasAirlinetheme(name) abort
|
function! utils#HasAirlinetheme(name) abort
|
||||||
let l:pat = 'autoload/airline/themes/' . a:name . '.vim'
|
let l:pat = 'autoload/airline/themes/' . a:name . '.vim'
|
||||||
return !empty(globpath(&runtimepath, l:pat))
|
return !empty(globpath(&runtimepath, l:pat))
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
" Generate random integers in the range [Low, High] in pure vimscrpt,
|
" Generate random integers in the range [Low, High] in pure vimscrpt,
|
||||||
" adapted from https://stackoverflow.com/a/12739441/6064933
|
" adapted from https://stackoverflow.com/a/12739441/6064933
|
||||||
function! utils#RandInt(Low, High) abort
|
function! utils#RandInt(Low, High) abort
|
||||||
let l:milisec = str2nr(matchstr(reltimestr(reltime()), '\v\.\zs\d+'), 10)
|
let l:milisec = str2nr(matchstr(reltimestr(reltime()), '\v\.\zs\d+'), 10)
|
||||||
return l:milisec % (a:High - a:Low + 1) + a:Low
|
return l:milisec % (a:High - a:Low + 1) + a:Low
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
" Custom fold expr, adapted from https://vi.stackexchange.com/a/9094/15292
|
" Custom fold expr, adapted from https://vi.stackexchange.com/a/9094/15292
|
||||||
function! utils#VimFolds(lnum) abort
|
function! utils#VimFolds(lnum) abort
|
||||||
" get content of current line and the line below
|
" get content of current line and the line below
|
||||||
let l:cur_line = getline(a:lnum)
|
let l:cur_line = getline(a:lnum)
|
||||||
let l:next_line = getline(a:lnum+1)
|
let l:next_line = getline(a:lnum+1)
|
||||||
|
|
||||||
if l:cur_line =~# '^"{'
|
if l:cur_line =~# '^"{'
|
||||||
return '>' . (matchend(l:cur_line, '"{*') - 1)
|
return '>' . (matchend(l:cur_line, '"{*') - 1)
|
||||||
|
else
|
||||||
|
if l:cur_line ==# '' && (matchend(l:next_line, '"{*') - 1) == 1
|
||||||
|
return 0
|
||||||
else
|
else
|
||||||
if l:cur_line ==# '' && (matchend(l:next_line, '"{*') - 1) == 1
|
return '='
|
||||||
return 0
|
|
||||||
else
|
|
||||||
return '='
|
|
||||||
endif
|
|
||||||
endif
|
endif
|
||||||
|
endif
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
" Custom fold text, adapted from https://vi.stackexchange.com/a/3818/15292
|
" Custom fold text, adapted from https://vi.stackexchange.com/a/3818/15292
|
||||||
" and https://vi.stackexchange.com/a/6608/15292
|
" and https://vi.stackexchange.com/a/6608/15292
|
||||||
function! utils#MyFoldText() abort
|
function! utils#MyFoldText() abort
|
||||||
let line = getline(v:foldstart)
|
let line = getline(v:foldstart)
|
||||||
let folded_line_num = v:foldend - v:foldstart
|
let folded_line_num = v:foldend - v:foldstart
|
||||||
let line_text = substitute(line, '^"{\+', '', 'g')
|
let line_text = substitute(line, '^"{\+', '', 'g')
|
||||||
let fillcharcount = &textwidth - len(line_text) - len(folded_line_num) - 10
|
let fillcharcount = &textwidth - len(line_text) - len(folded_line_num) - 10
|
||||||
return '+'. repeat('-', 4) . line_text . repeat('.', fillcharcount) . ' (' . folded_line_num . ' L)'
|
return '+'. repeat('-', 4) . line_text . repeat('.', fillcharcount) . ' (' . folded_line_num . ' L)'
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
" Toggle cursor column
|
" Toggle cursor column
|
||||||
function! utils#ToggleCursorCol() abort
|
function! utils#ToggleCursorCol() abort
|
||||||
if &cursorcolumn
|
if &cursorcolumn
|
||||||
set nocursorcolumn
|
set nocursorcolumn
|
||||||
echo 'cursorcolumn: OFF'
|
echo 'cursorcolumn: OFF'
|
||||||
else
|
else
|
||||||
set cursorcolumn
|
set cursorcolumn
|
||||||
echo 'cursorcolumn: ON'
|
echo 'cursorcolumn: ON'
|
||||||
endif
|
endif
|
||||||
endfunction
|
endfunction
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
augroup det_md
|
augroup det_md
|
||||||
autocmd!
|
autocmd!
|
||||||
autocmd BufRead,BufNewFile *.pdc set filetype=markdown
|
autocmd BufRead,BufNewFile *.pdc set filetype=markdown
|
||||||
augroup END
|
augroup END
|
||||||
|
|||||||
72
ginit.vim
72
ginit.vim
@ -6,50 +6,50 @@ nnoremap <silent> <C-6> <C-^>
|
|||||||
" To check if neovim-qt is running, use `exists('g:GuiLoaded')`,
|
" To check if neovim-qt is running, use `exists('g:GuiLoaded')`,
|
||||||
" see https://github.com/equalsraf/neovim-qt/issues/219
|
" see https://github.com/equalsraf/neovim-qt/issues/219
|
||||||
if exists('g:GuiLoaded')
|
if exists('g:GuiLoaded')
|
||||||
" call GuiWindowMaximized(1)
|
" call GuiWindowMaximized(1)
|
||||||
GuiTabline 0
|
GuiTabline 0
|
||||||
GuiPopupmenu 0
|
GuiPopupmenu 0
|
||||||
GuiLinespace 2
|
GuiLinespace 2
|
||||||
GuiFont! Hack:h10:l
|
GuiFont! Hack:h10:l
|
||||||
endif
|
endif
|
||||||
|
|
||||||
if exists('g:fvim_loaded')
|
if exists('g:fvim_loaded')
|
||||||
set termguicolors
|
set termguicolors
|
||||||
colorscheme gruvbox8_hard
|
colorscheme gruvbox8_hard
|
||||||
set guifont=Hack:h13
|
set guifont=Hack:h13
|
||||||
" Cursor tweaks
|
" Cursor tweaks
|
||||||
FVimCursorSmoothMove v:true
|
FVimCursorSmoothMove v:true
|
||||||
FVimCursorSmoothBlink v:true
|
FVimCursorSmoothBlink v:true
|
||||||
|
|
||||||
" Background composition, can be 'none', 'blur' or 'acrylic'
|
" Background composition, can be 'none', 'blur' or 'acrylic'
|
||||||
FVimBackgroundComposition 'blur'
|
FVimBackgroundComposition 'blur'
|
||||||
FVimBackgroundOpacity 0.9
|
FVimBackgroundOpacity 0.9
|
||||||
FVimBackgroundAltOpacity 0.9
|
FVimBackgroundAltOpacity 0.9
|
||||||
|
|
||||||
" Title bar tweaks (themed with colorscheme)
|
" Title bar tweaks (themed with colorscheme)
|
||||||
FVimCustomTitleBar v:true
|
FVimCustomTitleBar v:true
|
||||||
|
|
||||||
" Debug UI overlay
|
" Debug UI overlay
|
||||||
FVimDrawFPS v:false
|
FVimDrawFPS v:false
|
||||||
" Font debugging -- draw bounds around each glyph
|
" Font debugging -- draw bounds around each glyph
|
||||||
FVimFontDrawBounds v:false
|
FVimFontDrawBounds v:false
|
||||||
|
|
||||||
" Font tweaks
|
" Font tweaks
|
||||||
FVimFontAntialias v:true
|
FVimFontAntialias v:true
|
||||||
FVimFontAutohint v:true
|
FVimFontAutohint v:true
|
||||||
FVimFontHintLevel 'full'
|
FVimFontHintLevel 'full'
|
||||||
FVimFontSubpixel v:true
|
FVimFontSubpixel v:true
|
||||||
FVimFontLigature v:true
|
FVimFontLigature v:true
|
||||||
" can be 'default', '14.0', '-1.0' etc.
|
" can be 'default', '14.0', '-1.0' etc.
|
||||||
FVimFontLineHeight 'default'
|
FVimFontLineHeight 'default'
|
||||||
|
|
||||||
" Try to snap the fonts to the pixels, reduces blur
|
" Try to snap the fonts to the pixels, reduces blur
|
||||||
" in some situations (e.g. 100% DPI).
|
" in some situations (e.g. 100% DPI).
|
||||||
FVimFontAutoSnap v:true
|
FVimFontAutoSnap v:true
|
||||||
|
|
||||||
" Font weight tuning, possible values are 100..900
|
" Font weight tuning, possible values are 100..900
|
||||||
FVimFontNormalWeight 100
|
FVimFontNormalWeight 100
|
||||||
FVimFontBoldWeight 700
|
FVimFontBoldWeight 700
|
||||||
|
|
||||||
FVimUIPopupMenu v:false
|
FVimUIPopupMenu v:false
|
||||||
endif
|
endif
|
||||||
|
|||||||
14
init.vim
14
init.vim
@ -57,15 +57,15 @@ let g:is_mac = has('macunix')
|
|||||||
let g:nvim_config_root = expand('<sfile>:p:h')
|
let g:nvim_config_root = expand('<sfile>:p:h')
|
||||||
|
|
||||||
let g:config_file_list = ['variables.vim',
|
let g:config_file_list = ['variables.vim',
|
||||||
\ 'options.vim',
|
\ 'options.vim',
|
||||||
\ 'autocommands.vim',
|
\ 'autocommands.vim',
|
||||||
\ 'mappings.vim',
|
\ 'mappings.vim',
|
||||||
\ 'plugins.vim',
|
\ 'plugins.vim',
|
||||||
\ 'ui.vim'
|
\ 'ui.vim'
|
||||||
\ ]
|
\ ]
|
||||||
|
|
||||||
for s:fname in g:config_file_list
|
for s:fname in g:config_file_list
|
||||||
execute 'source ' . g:nvim_config_root . '/' . s:fname
|
execute 'source ' . g:nvim_config_root . '/' . s:fname
|
||||||
endfor
|
endfor
|
||||||
"}
|
"}
|
||||||
|
|
||||||
|
|||||||
@ -118,7 +118,7 @@ inoremap <expr> <esc> ((pumvisible())?("\<C-e>"):("\<esc>"))
|
|||||||
" Edit and reload init.vim quickly
|
" Edit and reload init.vim quickly
|
||||||
nnoremap <silent> <leader>ev :tabnew $MYVIMRC <bar> tcd %:h<cr>
|
nnoremap <silent> <leader>ev :tabnew $MYVIMRC <bar> tcd %:h<cr>
|
||||||
nnoremap <silent> <leader>sv :silent update $MYVIMRC <bar> source $MYVIMRC <bar>
|
nnoremap <silent> <leader>sv :silent update $MYVIMRC <bar> source $MYVIMRC <bar>
|
||||||
\ echomsg "Nvim config successfully reloaded!"<cr>
|
\ echomsg "Nvim config successfully reloaded!"<cr>
|
||||||
|
|
||||||
" Reselect the text that has just been pasted
|
" Reselect the text that has just been pasted
|
||||||
nnoremap <leader>v `[V`]
|
nnoremap <leader>v `[V`]
|
||||||
|
|||||||
14
options.vim
14
options.vim
@ -21,7 +21,7 @@ set updatetime=2000
|
|||||||
" Clipboard settings, always use clipboard for all delete, yank, change, put
|
" Clipboard settings, always use clipboard for all delete, yank, change, put
|
||||||
" operation, see https://stackoverflow.com/q/30691466/6064933
|
" operation, see https://stackoverflow.com/q/30691466/6064933
|
||||||
if !empty(provider#clipboard#Executable())
|
if !empty(provider#clipboard#Executable())
|
||||||
set clipboard+=unnamedplus
|
set clipboard+=unnamedplus
|
||||||
endif
|
endif
|
||||||
|
|
||||||
" Disable creating swapfiles, see https://stackoverflow.com/q/821902/6064933
|
" Disable creating swapfiles, see https://stackoverflow.com/q/821902/6064933
|
||||||
@ -114,7 +114,7 @@ set autowrite
|
|||||||
set title
|
set title
|
||||||
set titlestring=
|
set titlestring=
|
||||||
if g:is_linux
|
if g:is_linux
|
||||||
set titlestring+=%(%{hostname()}\ \ %)
|
set titlestring+=%(%{hostname()}\ \ %)
|
||||||
endif
|
endif
|
||||||
set titlestring+=%(%{expand('%:p:~')}\ \ %)
|
set titlestring+=%(%{expand('%:p:~')}\ \ %)
|
||||||
set titlestring+=%{strftime('%Y-%m-%d\ %H:%M',getftime(expand('%')))}
|
set titlestring+=%{strftime('%Y-%m-%d\ %H:%M',getftime(expand('%')))}
|
||||||
@ -164,15 +164,15 @@ set nostartofline
|
|||||||
|
|
||||||
" External program to use for grep command
|
" External program to use for grep command
|
||||||
if executable('rg')
|
if executable('rg')
|
||||||
set grepprg=rg\ --vimgrep\ --no-heading\ --smart-case
|
set grepprg=rg\ --vimgrep\ --no-heading\ --smart-case
|
||||||
set grepformat=%f:%l:%c:%m
|
set grepformat=%f:%l:%c:%m
|
||||||
endif
|
endif
|
||||||
|
|
||||||
" Highlight groups for cursor color
|
" Highlight groups for cursor color
|
||||||
augroup cursor_color
|
augroup cursor_color
|
||||||
autocmd!
|
autocmd!
|
||||||
autocmd ColorScheme * highlight Cursor cterm=bold gui=bold guibg=cyan guifg=black
|
autocmd ColorScheme * highlight Cursor cterm=bold gui=bold guibg=cyan guifg=black
|
||||||
autocmd ColorScheme * highlight Cursor2 guifg=red guibg=red
|
autocmd ColorScheme * highlight Cursor2 guifg=red guibg=red
|
||||||
augroup END
|
augroup END
|
||||||
|
|
||||||
" Set up cursor color and shape in various mode, ref:
|
" Set up cursor color and shape in various mode, ref:
|
||||||
|
|||||||
401
plugins.vim
401
plugins.vim
@ -10,22 +10,20 @@ scriptencoding utf-8
|
|||||||
" wiki: https://github.com/junegunn/vim-plug/wiki/tips#tips
|
" wiki: https://github.com/junegunn/vim-plug/wiki/tips#tips
|
||||||
let g:VIM_PLUG_PATH = expand(g:nvim_config_root . '/autoload/plug.vim')
|
let g:VIM_PLUG_PATH = expand(g:nvim_config_root . '/autoload/plug.vim')
|
||||||
if g:is_win || g:is_mac
|
if g:is_win || g:is_mac
|
||||||
if empty(glob(g:VIM_PLUG_PATH))
|
if empty(glob(g:VIM_PLUG_PATH))
|
||||||
if executable('curl')
|
if executable('curl')
|
||||||
echomsg 'Installing Vim-plug on your system'
|
echomsg 'Installing Vim-plug on your system'
|
||||||
silent execute '!curl -fLo ' . g:VIM_PLUG_PATH . ' --create-dirs '
|
silent execute '!curl -fLo ' . g:VIM_PLUG_PATH . ' --create-dirs '
|
||||||
\ . 'https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim'
|
\ . 'https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim'
|
||||||
|
augroup plug_init
|
||||||
augroup plug_init
|
autocmd!
|
||||||
autocmd!
|
autocmd VimEnter * PlugInstall --sync | quit |source $MYVIMRC
|
||||||
autocmd VimEnter * PlugInstall --sync | quit |source $MYVIMRC
|
augroup END
|
||||||
augroup END
|
else
|
||||||
else
|
echoerr 'Curl not available on your system, you may install vim-plug by yourself.'
|
||||||
echoerr 'Curl must be available to install vim-plug, or you may install '
|
finish
|
||||||
\ . 'vim-plug by yourself.'
|
|
||||||
finish
|
|
||||||
endif
|
|
||||||
endif
|
endif
|
||||||
|
endif
|
||||||
endif
|
endif
|
||||||
|
|
||||||
" The directory to install plugins.
|
" The directory to install plugins.
|
||||||
@ -38,7 +36,7 @@ call plug#begin(g:PLUGIN_HOME)
|
|||||||
Plug 'Shougo/deoplete.nvim', { 'do': ':UpdateRemotePlugins' }
|
Plug 'Shougo/deoplete.nvim', { 'do': ':UpdateRemotePlugins' }
|
||||||
|
|
||||||
if executable('clang') && (g:is_mac || g:is_linux)
|
if executable('clang') && (g:is_mac || g:is_linux)
|
||||||
Plug 'deoplete-plugins/deoplete-clang'
|
Plug 'deoplete-plugins/deoplete-clang'
|
||||||
endif
|
endif
|
||||||
|
|
||||||
" Python source for deoplete
|
" Python source for deoplete
|
||||||
@ -54,7 +52,7 @@ Plug 'davidhalter/jedi-vim', { 'for': 'python' }
|
|||||||
|
|
||||||
" Python syntax highlighting and more
|
" Python syntax highlighting and more
|
||||||
if g:is_mac || g:is_win
|
if g:is_mac || g:is_win
|
||||||
Plug 'numirias/semshi', { 'do': ':UpdateRemotePlugins' }
|
Plug 'numirias/semshi', { 'do': ':UpdateRemotePlugins' }
|
||||||
endif
|
endif
|
||||||
|
|
||||||
" Python indent (follows the PEP8 style)
|
" Python indent (follows the PEP8 style)
|
||||||
@ -80,9 +78,9 @@ Plug 'haya14busa/vim-asterisk'
|
|||||||
|
|
||||||
" File search, tag search and more
|
" File search, tag search and more
|
||||||
if g:is_win
|
if g:is_win
|
||||||
Plug 'Yggdroot/LeaderF'
|
Plug 'Yggdroot/LeaderF'
|
||||||
else
|
else
|
||||||
Plug 'Yggdroot/LeaderF', { 'do': './install.sh' }
|
Plug 'Yggdroot/LeaderF', { 'do': './install.sh' }
|
||||||
endif
|
endif
|
||||||
|
|
||||||
" Another similar plugin is command-t
|
" Another similar plugin is command-t
|
||||||
@ -110,10 +108,10 @@ Plug 'srcery-colors/srcery-vim'
|
|||||||
" Plug 'kaicataldo/material.vim'
|
" Plug 'kaicataldo/material.vim'
|
||||||
|
|
||||||
if !exists('g:started_by_firenvim')
|
if !exists('g:started_by_firenvim')
|
||||||
" colorful status line and theme
|
" colorful status line and theme
|
||||||
Plug 'vim-airline/vim-airline'
|
Plug 'vim-airline/vim-airline'
|
||||||
Plug 'vim-airline/vim-airline-themes'
|
Plug 'vim-airline/vim-airline-themes'
|
||||||
Plug 'mhinz/vim-startify'
|
Plug 'mhinz/vim-startify'
|
||||||
endif
|
endif
|
||||||
"}}
|
"}}
|
||||||
|
|
||||||
@ -124,8 +122,8 @@ Plug 'itchyny/vim-highlighturl'
|
|||||||
" For Windows and Mac, we can open an URL in the browser. For Linux, it may
|
" For Windows and Mac, we can open an URL in the browser. For Linux, it may
|
||||||
" not be possible since we maybe in a server which disables GUI.
|
" not be possible since we maybe in a server which disables GUI.
|
||||||
if g:is_win || g:is_mac
|
if g:is_win || g:is_mac
|
||||||
" open URL in browser
|
" open URL in browser
|
||||||
Plug 'tyru/open-browser.vim'
|
Plug 'tyru/open-browser.vim'
|
||||||
endif
|
endif
|
||||||
"}}
|
"}}
|
||||||
|
|
||||||
@ -135,10 +133,10 @@ Plug 'preservim/nerdtree', { 'on': ['NERDTreeToggle', 'NERDTreeFind'] }
|
|||||||
|
|
||||||
" Only install these plugins if ctags are installed on the system
|
" Only install these plugins if ctags are installed on the system
|
||||||
if executable('ctags')
|
if executable('ctags')
|
||||||
" plugin to manage your tags
|
" plugin to manage your tags
|
||||||
Plug 'ludovicchabant/vim-gutentags'
|
Plug 'ludovicchabant/vim-gutentags'
|
||||||
" show file tags in vim window
|
" show file tags in vim window
|
||||||
Plug 'majutsushi/tagbar', { 'on': ['TagbarToggle', 'TagbarOpen'] }
|
Plug 'majutsushi/tagbar', { 'on': ['TagbarToggle', 'TagbarOpen'] }
|
||||||
endif
|
endif
|
||||||
"}}
|
"}}
|
||||||
|
|
||||||
@ -170,7 +168,7 @@ Plug 'mbbill/undotree'
|
|||||||
|
|
||||||
" Manage your yank history
|
" Manage your yank history
|
||||||
if g:is_win || g:is_mac
|
if g:is_win || g:is_mac
|
||||||
Plug 'svermeulen/vim-yoink'
|
Plug 'svermeulen/vim-yoink'
|
||||||
endif
|
endif
|
||||||
|
|
||||||
" Handy unix command inside Vim (Rename, Move etc.)
|
" Handy unix command inside Vim (Rename, Move etc.)
|
||||||
@ -232,7 +230,7 @@ Plug 'elzr/vim-json', { 'for': ['json', 'markdown'] }
|
|||||||
|
|
||||||
" Markdown previewing (only for Mac and Windows)
|
" Markdown previewing (only for Mac and Windows)
|
||||||
if g:is_win || g:is_mac
|
if g:is_win || g:is_mac
|
||||||
Plug 'iamcco/markdown-preview.nvim', { 'do': { -> mkdp#util#install() }, 'for': ['markdown', 'vim-plug'] }
|
Plug 'iamcco/markdown-preview.nvim', { 'do': { -> mkdp#util#install() }, 'for': ['markdown', 'vim-plug'] }
|
||||||
endif
|
endif
|
||||||
|
|
||||||
" emoji
|
" emoji
|
||||||
@ -240,7 +238,7 @@ endif
|
|||||||
Plug 'fszymanski/deoplete-emoji', {'for': 'markdown'}
|
Plug 'fszymanski/deoplete-emoji', {'for': 'markdown'}
|
||||||
|
|
||||||
if g:is_mac
|
if g:is_mac
|
||||||
Plug 'rhysd/vim-grammarous'
|
Plug 'rhysd/vim-grammarous'
|
||||||
endif
|
endif
|
||||||
"}}
|
"}}
|
||||||
|
|
||||||
@ -259,13 +257,13 @@ Plug 'michaeljsmith/vim-indent-object'
|
|||||||
"{{ LaTeX editting and previewing plugin
|
"{{ LaTeX editting and previewing plugin
|
||||||
" Only use these plugin on Windows and Mac and when LaTeX is installed
|
" Only use these plugin on Windows and Mac and when LaTeX is installed
|
||||||
if ( g:is_win || g:is_mac ) && executable('latex')
|
if ( g:is_win || g:is_mac ) && executable('latex')
|
||||||
" vimtex use autoload feature of Vim, so it is not necessary to use `for`
|
" vimtex use autoload feature of Vim, so it is not necessary to use `for`
|
||||||
" keyword of vim-plug to try to lazy-load it,
|
" keyword of vim-plug to try to lazy-load it,
|
||||||
" see https://github.com/junegunn/vim-plug/issues/785
|
" see https://github.com/junegunn/vim-plug/issues/785
|
||||||
Plug 'lervag/vimtex'
|
Plug 'lervag/vimtex'
|
||||||
|
|
||||||
" Plug 'matze/vim-tex-fold', {'for': 'tex'}
|
" Plug 'matze/vim-tex-fold', {'for': 'tex'}
|
||||||
" Plug 'Konfekt/FastFold'
|
" Plug 'Konfekt/FastFold'
|
||||||
endif
|
endif
|
||||||
"}}
|
"}}
|
||||||
|
|
||||||
@ -273,13 +271,13 @@ endif
|
|||||||
" Since tmux is only available on Linux and Mac, we only enable these plugins
|
" Since tmux is only available on Linux and Mac, we only enable these plugins
|
||||||
" for Linux and Mac
|
" for Linux and Mac
|
||||||
if (g:is_linux || g:is_mac) && executable('tmux')
|
if (g:is_linux || g:is_mac) && executable('tmux')
|
||||||
" Let vim detect tmux focus event correctly, see
|
" Let vim detect tmux focus event correctly, see
|
||||||
" https://github.com/neovim/neovim/issues/9486 and
|
" https://github.com/neovim/neovim/issues/9486 and
|
||||||
" https://vi.stackexchange.com/q/18515/15292
|
" https://vi.stackexchange.com/q/18515/15292
|
||||||
Plug 'tmux-plugins/vim-tmux-focus-events'
|
Plug 'tmux-plugins/vim-tmux-focus-events'
|
||||||
|
|
||||||
" .tmux.conf syntax highlighting and setting check
|
" .tmux.conf syntax highlighting and setting check
|
||||||
Plug 'tmux-plugins/vim-tmux', { 'for': 'tmux' }
|
Plug 'tmux-plugins/vim-tmux', { 'for': 'tmux' }
|
||||||
endif
|
endif
|
||||||
"}}
|
"}}
|
||||||
|
|
||||||
@ -304,12 +302,12 @@ Plug 'cespare/vim-toml'
|
|||||||
|
|
||||||
" Edit text area in browser using nvim
|
" Edit text area in browser using nvim
|
||||||
if g:is_mac || g:is_win
|
if g:is_mac || g:is_win
|
||||||
Plug 'glacambre/firenvim', { 'do': { _ -> firenvim#install(0) } }
|
Plug 'glacambre/firenvim', { 'do': { _ -> firenvim#install(0) } }
|
||||||
endif
|
endif
|
||||||
|
|
||||||
" Debugger plugin
|
" Debugger plugin
|
||||||
if g:is_mac || g:is_linux
|
if g:is_mac || g:is_linux
|
||||||
Plug 'sakhnik/nvim-gdb', { 'do': ':!./install.sh \| UpdateRemotePlugins' }
|
Plug 'sakhnik/nvim-gdb', { 'do': ':!./install.sh \| UpdateRemotePlugins' }
|
||||||
endif
|
endif
|
||||||
call plug#end()
|
call plug#end()
|
||||||
"}}
|
"}}
|
||||||
@ -345,9 +343,9 @@ call deoplete#custom#source('_', 'min_pattern_length', 1)
|
|||||||
" \ 'disabled_syntaxes': ['String']
|
" \ 'disabled_syntaxes': ['String']
|
||||||
" \ })
|
" \ })
|
||||||
call deoplete#custom#source('_', {
|
call deoplete#custom#source('_', {
|
||||||
\ 'filetype': ['python'],
|
\ 'filetype': ['python'],
|
||||||
\ 'disabled_syntaxes': ['Comment']
|
\ 'disabled_syntaxes': ['Comment']
|
||||||
\ })
|
\ })
|
||||||
|
|
||||||
" Ignore certain sources, because they only cause nosie most of the time
|
" Ignore certain sources, because they only cause nosie most of the time
|
||||||
call deoplete#custom#option('ignore_sources', {
|
call deoplete#custom#option('ignore_sources', {
|
||||||
@ -455,16 +453,16 @@ let g:Lf_UseCache = 0
|
|||||||
|
|
||||||
" Ignore certain files and directories when searching files
|
" Ignore certain files and directories when searching files
|
||||||
let g:Lf_WildIgnore = {
|
let g:Lf_WildIgnore = {
|
||||||
\ 'dir': ['.git', '__pycache__', '.DS_Store'],
|
\ 'dir': ['.git', '__pycache__', '.DS_Store'],
|
||||||
\ 'file': ['*.exe', '*.dll', '*.so', '*.o', '*.pyc', '*.jpg', '*.png',
|
\ 'file': ['*.exe', '*.dll', '*.so', '*.o', '*.pyc', '*.jpg', '*.png',
|
||||||
\ '*.gif', '*.db', '*.tgz', '*.tar.gz', '*.gz', '*.zip', '*.bin', '*.pptx',
|
\ '*.gif', '*.db', '*.tgz', '*.tar.gz', '*.gz', '*.zip', '*.bin', '*.pptx',
|
||||||
\ '*.xlsx', '*.docx', '*.pdf', '*.tmp', '*.wmv', '*.mkv', '*.mp4',
|
\ '*.xlsx', '*.docx', '*.pdf', '*.tmp', '*.wmv', '*.mkv', '*.mp4',
|
||||||
\ '*.rmvb']
|
\ '*.rmvb']
|
||||||
\}
|
\}
|
||||||
|
|
||||||
" Do not show fancy icons for Linux server.
|
" Do not show fancy icons for Linux server.
|
||||||
if g:is_linux
|
if g:is_linux
|
||||||
let g:Lf_ShowDevIcons = 0
|
let g:Lf_ShowDevIcons = 0
|
||||||
endif
|
endif
|
||||||
|
|
||||||
" Only fuzzy-search files names
|
" Only fuzzy-search files names
|
||||||
@ -493,12 +491,12 @@ nnoremap <silent> <leader>h :Leaderf help --popup<CR>
|
|||||||
"{{ URL related
|
"{{ URL related
|
||||||
""""""""""""""""""""""""""""open-browser.vim settings"""""""""""""""""""
|
""""""""""""""""""""""""""""open-browser.vim settings"""""""""""""""""""
|
||||||
if g:is_win || g:is_mac
|
if g:is_win || g:is_mac
|
||||||
" Disable netrw's gx mapping.
|
" Disable netrw's gx mapping.
|
||||||
let g:netrw_nogx = 1
|
let g:netrw_nogx = 1
|
||||||
|
|
||||||
" Use another mapping for the open URL method
|
" Use another mapping for the open URL method
|
||||||
nmap ob <Plug>(openbrowser-smart-search)
|
nmap ob <Plug>(openbrowser-smart-search)
|
||||||
vmap ob <Plug>(openbrowser-smart-search)
|
vmap ob <Plug>(openbrowser-smart-search)
|
||||||
endif
|
endif
|
||||||
"}}
|
"}}
|
||||||
|
|
||||||
@ -537,25 +535,25 @@ nnoremap <silent> <Space>t :TagbarToggle<CR>
|
|||||||
|
|
||||||
" Add support for markdown files in tagbar.
|
" Add support for markdown files in tagbar.
|
||||||
if g:is_win
|
if g:is_win
|
||||||
let g:md_ctags_bin=fnamemodify(g:nvim_config_root."\\tools\\markdown2ctags.exe", ':p')
|
let g:md_ctags_bin=fnamemodify(g:nvim_config_root."\\tools\\markdown2ctags.exe", ':p')
|
||||||
else
|
else
|
||||||
let g:md_ctags_bin=fnamemodify(g:nvim_config_root.'/tools/markdown2ctags.py', ':p')
|
let g:md_ctags_bin=fnamemodify(g:nvim_config_root.'/tools/markdown2ctags.py', ':p')
|
||||||
endif
|
endif
|
||||||
|
|
||||||
let g:tagbar_type_markdown = {
|
let g:tagbar_type_markdown = {
|
||||||
\ 'ctagstype': 'markdown.pandoc',
|
\ 'ctagstype': 'markdown.pandoc',
|
||||||
\ 'ctagsbin' : g:md_ctags_bin,
|
\ 'ctagsbin' : g:md_ctags_bin,
|
||||||
\ 'ctagsargs' : '-f - --sort=yes',
|
\ 'ctagsargs' : '-f - --sort=yes',
|
||||||
\ 'kinds' : [
|
\ 'kinds' : [
|
||||||
\ 's:sections',
|
\ 's:sections',
|
||||||
\ 'i:images'
|
\ 'i:images'
|
||||||
\ ],
|
\ ],
|
||||||
\ 'sro' : '|',
|
\ 'sro' : '|',
|
||||||
\ 'kind2scope' : {
|
\ 'kind2scope' : {
|
||||||
\ 's' : 'section',
|
\ 's' : 'section',
|
||||||
\ },
|
\ },
|
||||||
\ 'sort': 0,
|
\ 'sort': 0,
|
||||||
\ }
|
\ }
|
||||||
"}}
|
"}}
|
||||||
|
|
||||||
"{{ File editting
|
"{{ File editting
|
||||||
@ -580,37 +578,37 @@ let g:auto_save_silent = 0
|
|||||||
|
|
||||||
""""""""""""""""""""""""""""vim-yoink settings"""""""""""""""""""""""""
|
""""""""""""""""""""""""""""vim-yoink settings"""""""""""""""""""""""""
|
||||||
if g:is_win || g:is_mac
|
if g:is_win || g:is_mac
|
||||||
" ctrl-n and ctrl-p will not work if you add the TextChanged event to
|
" ctrl-n and ctrl-p will not work if you add the TextChanged event to
|
||||||
" vim-auto-save events
|
" vim-auto-save events
|
||||||
" nmap <c-n> <plug>(YoinkPostPasteSwapBack)
|
" nmap <c-n> <plug>(YoinkPostPasteSwapBack)
|
||||||
" nmap <c-p> <plug>(YoinkPostPasteSwapForward)
|
" nmap <c-p> <plug>(YoinkPostPasteSwapForward)
|
||||||
|
|
||||||
nmap p <plug>(YoinkPaste_p)
|
nmap p <plug>(YoinkPaste_p)
|
||||||
nmap P <plug>(YoinkPaste_P)
|
nmap P <plug>(YoinkPaste_P)
|
||||||
|
|
||||||
" Cycle the yank stack with the following mappings
|
" Cycle the yank stack with the following mappings
|
||||||
nmap [y <plug>(YoinkRotateBack)
|
nmap [y <plug>(YoinkRotateBack)
|
||||||
nmap ]y <plug>(YoinkRotateForward)
|
nmap ]y <plug>(YoinkRotateForward)
|
||||||
|
|
||||||
" Do not change the cursor position
|
" Do not change the cursor position
|
||||||
nmap y <plug>(YoinkYankPreserveCursorPosition)
|
nmap y <plug>(YoinkYankPreserveCursorPosition)
|
||||||
xmap y <plug>(YoinkYankPreserveCursorPosition)
|
xmap y <plug>(YoinkYankPreserveCursorPosition)
|
||||||
|
|
||||||
" Move cursor to end of paste after multiline paste
|
" Move cursor to end of paste after multiline paste
|
||||||
let g:yoinkMoveCursorToEndOfPaste = 0
|
let g:yoinkMoveCursorToEndOfPaste = 0
|
||||||
|
|
||||||
" Record yanks in system clipboard
|
" Record yanks in system clipboard
|
||||||
let g:yoinkSyncSystemClipboardOnFocus = 1
|
let g:yoinkSyncSystemClipboardOnFocus = 1
|
||||||
endif
|
endif
|
||||||
|
|
||||||
"{{ Linting and formating
|
"{{ Linting and formating
|
||||||
"""""""""""""""""""""""""""""" ale settings """""""""""""""""""""""
|
"""""""""""""""""""""""""""""" ale settings """""""""""""""""""""""
|
||||||
" linters for different filetypes
|
" linters for different filetypes
|
||||||
let g:ale_linters = {
|
let g:ale_linters = {
|
||||||
\ 'python': ['pylint'],
|
\ 'python': ['pylint'],
|
||||||
\ 'vim': ['vint'],
|
\ 'vim': ['vint'],
|
||||||
\ 'cpp': ['clang'],
|
\ 'cpp': ['clang'],
|
||||||
\ 'c': ['clang']
|
\ 'c': ['clang']
|
||||||
\}
|
\}
|
||||||
|
|
||||||
" Only run linters in the g:ale_linters dictionary
|
" Only run linters in the g:ale_linters dictionary
|
||||||
@ -623,12 +621,12 @@ let g:ale_sign_warning = '!'
|
|||||||
"""""""""""""""""""""""""""""" neoformat settings """""""""""""""""""""""
|
"""""""""""""""""""""""""""""" neoformat settings """""""""""""""""""""""
|
||||||
let g:neoformat_enabled_python = ['black', 'yapf']
|
let g:neoformat_enabled_python = ['black', 'yapf']
|
||||||
let g:neoformat_cpp_clangformat = {
|
let g:neoformat_cpp_clangformat = {
|
||||||
\ 'exe': 'clang-format',
|
\ 'exe': 'clang-format',
|
||||||
\ 'args': ['--style="{IndentWidth: 4}"']
|
\ 'args': ['--style="{IndentWidth: 4}"']
|
||||||
\}
|
\}
|
||||||
let g:neoformat_c_clangformat = {
|
let g:neoformat_c_clangformat = {
|
||||||
\ 'exe': 'clang-format',
|
\ 'exe': 'clang-format',
|
||||||
\ 'args': ['--style="{IndentWidth: 4}"']
|
\ 'args': ['--style="{IndentWidth: 4}"']
|
||||||
\}
|
\}
|
||||||
|
|
||||||
let g:neoformat_enabled_cpp = ['clangformat']
|
let g:neoformat_enabled_cpp = ['clangformat']
|
||||||
@ -648,9 +646,9 @@ let g:signify_sign_change = '~'
|
|||||||
"""""""""""""""""""""""""goyo.vim settings""""""""""""""""""""""""""""""
|
"""""""""""""""""""""""""goyo.vim settings""""""""""""""""""""""""""""""
|
||||||
" Make goyo and limelight work together automatically
|
" Make goyo and limelight work together automatically
|
||||||
augroup goyo_work_with_limelight
|
augroup goyo_work_with_limelight
|
||||||
autocmd!
|
autocmd!
|
||||||
autocmd! User GoyoEnter Limelight
|
autocmd! User GoyoEnter Limelight
|
||||||
autocmd! User GoyoLeave Limelight!
|
autocmd! User GoyoLeave Limelight!
|
||||||
augroup END
|
augroup END
|
||||||
|
|
||||||
"""""""""""""""""""""""""vim-pandoc-syntax settings"""""""""""""""""""""""""
|
"""""""""""""""""""""""""vim-pandoc-syntax settings"""""""""""""""""""""""""
|
||||||
@ -685,12 +683,12 @@ let g:vim_markdown_toc_autofit = 1
|
|||||||
"""""""""""""""""""""""""markdown-preview settings"""""""""""""""""""
|
"""""""""""""""""""""""""markdown-preview settings"""""""""""""""""""
|
||||||
" Only setting this for suitable platforms
|
" Only setting this for suitable platforms
|
||||||
if g:is_win || g:is_mac
|
if g:is_win || g:is_mac
|
||||||
" Do not close the preview tab when switching to other buffers
|
" Do not close the preview tab when switching to other buffers
|
||||||
let g:mkdp_auto_close = 0
|
let g:mkdp_auto_close = 0
|
||||||
|
|
||||||
" Shortcuts to start and stop markdown previewing
|
" Shortcuts to start and stop markdown previewing
|
||||||
nnoremap <silent> <M-m> :MarkdownPreview<CR>
|
nnoremap <silent> <M-m> :MarkdownPreview<CR>
|
||||||
nnoremap <silent> <M-S-m> :MarkdownPreviewStop<CR>
|
nnoremap <silent> <M-S-m> :MarkdownPreviewStop<CR>
|
||||||
endif
|
endif
|
||||||
|
|
||||||
""""""""""""""""""""""""vim-markdownfootnotes settings""""""""""""""""""""""""
|
""""""""""""""""""""""""vim-markdownfootnotes settings""""""""""""""""""""""""
|
||||||
@ -702,20 +700,20 @@ nmap @@ <Plug>ReturnFromFootnote
|
|||||||
|
|
||||||
""""""""""""""""""""""""vim-grammarous settings""""""""""""""""""""""""""""""
|
""""""""""""""""""""""""vim-grammarous settings""""""""""""""""""""""""""""""
|
||||||
if g:is_mac
|
if g:is_mac
|
||||||
let g:grammarous#languagetool_cmd = 'languagetool'
|
let g:grammarous#languagetool_cmd = 'languagetool'
|
||||||
nmap <leader>x <Plug>(grammarous-close-info-window)
|
nmap <leader>x <Plug>(grammarous-close-info-window)
|
||||||
nmap <c-n> <Plug>(grammarous-move-to-next-error)
|
nmap <c-n> <Plug>(grammarous-move-to-next-error)
|
||||||
nmap <c-p> <Plug>(grammarous-move-to-previous-error)
|
nmap <c-p> <Plug>(grammarous-move-to-previous-error)
|
||||||
let g:grammarous#disabled_rules = {
|
let g:grammarous#disabled_rules = {
|
||||||
\ '*' : ['WHITESPACE_RULE', 'EN_QUOTES', 'ARROWS', 'SENTENCE_WHITESPACE',
|
\ '*' : ['WHITESPACE_RULE', 'EN_QUOTES', 'ARROWS', 'SENTENCE_WHITESPACE',
|
||||||
\ 'WORD_CONTAINS_UNDERSCORE', 'COMMA_PARENTHESIS_WHITESPACE',
|
\ 'WORD_CONTAINS_UNDERSCORE', 'COMMA_PARENTHESIS_WHITESPACE',
|
||||||
\ 'EN_UNPAIRED_BRACKETS', 'UPPERCASE_SENTENCE_START',
|
\ 'EN_UNPAIRED_BRACKETS', 'UPPERCASE_SENTENCE_START',
|
||||||
\ 'ENGLISH_WORD_REPEAT_BEGINNING_RULE', 'DASH_RULE', 'PLUS_MINUS',
|
\ 'ENGLISH_WORD_REPEAT_BEGINNING_RULE', 'DASH_RULE', 'PLUS_MINUS',
|
||||||
\ 'PUNCTUATION_PARAGRAPH_END', 'MULTIPLICATION_SIGN', 'PRP_CHECKOUT',
|
\ 'PUNCTUATION_PARAGRAPH_END', 'MULTIPLICATION_SIGN', 'PRP_CHECKOUT',
|
||||||
\ 'CAN_CHECKOUT', 'SOME_OF_THE', 'DOUBLE_PUNCTUATION', 'HELL',
|
\ 'CAN_CHECKOUT', 'SOME_OF_THE', 'DOUBLE_PUNCTUATION', 'HELL',
|
||||||
\ 'CURRENCY', 'POSSESSIVE_APOSTROPHE', 'ENGLISH_WORD_REPEAT_RULE',
|
\ 'CURRENCY', 'POSSESSIVE_APOSTROPHE', 'ENGLISH_WORD_REPEAT_RULE',
|
||||||
\ 'NON_STANDARD_WORD', 'AU'],
|
\ 'NON_STANDARD_WORD', 'AU'],
|
||||||
\ }
|
\ }
|
||||||
endif
|
endif
|
||||||
|
|
||||||
""""""""""""""""""""""""deoplete-emoji settings""""""""""""""""""""""""""""
|
""""""""""""""""""""""""deoplete-emoji settings""""""""""""""""""""""""""""
|
||||||
@ -725,67 +723,66 @@ call deoplete#custom#source('emoji', 'converters', ['converter_emoji'])
|
|||||||
"{{ LaTeX editting
|
"{{ LaTeX editting
|
||||||
""""""""""""""""""""""""""""vimtex settings"""""""""""""""""""""""""""""
|
""""""""""""""""""""""""""""vimtex settings"""""""""""""""""""""""""""""
|
||||||
if ( g:is_win || g:is_mac ) && executable('latex')
|
if ( g:is_win || g:is_mac ) && executable('latex')
|
||||||
" Set up LaTeX flavor
|
" Set up LaTeX flavor
|
||||||
let g:tex_flavor = 'latex'
|
let g:tex_flavor = 'latex'
|
||||||
|
|
||||||
" Deoplete configurations for autocompletion to work
|
" Deoplete configurations for autocompletion to work
|
||||||
call deoplete#custom#var('omni', 'input_patterns', {
|
call deoplete#custom#var('omni', 'input_patterns', {
|
||||||
\ 'tex': g:vimtex#re#deoplete
|
\ 'tex': g:vimtex#re#deoplete
|
||||||
\})
|
\})
|
||||||
|
|
||||||
let g:vimtex_compiler_latexmk = {
|
let g:vimtex_compiler_latexmk = {
|
||||||
\ 'build_dir' : 'build',
|
\ 'build_dir' : 'build',
|
||||||
\}
|
\}
|
||||||
|
|
||||||
" TOC settings
|
" TOC settings
|
||||||
let g:vimtex_toc_config = {
|
let g:vimtex_toc_config = {
|
||||||
\ 'name' : 'TOC',
|
\ 'name' : 'TOC',
|
||||||
\ 'layers' : ['content', 'todo', 'include'],
|
\ 'layers' : ['content', 'todo', 'include'],
|
||||||
\ 'resize' : 1,
|
\ 'resize' : 1,
|
||||||
\ 'split_width' : 30,
|
\ 'split_width' : 30,
|
||||||
\ 'todo_sorted' : 0,
|
\ 'todo_sorted' : 0,
|
||||||
\ 'show_help' : 1,
|
\ 'show_help' : 1,
|
||||||
\ 'show_numbers' : 1,
|
\ 'show_numbers' : 1,
|
||||||
\ 'mode' : 2,
|
\ 'mode' : 2,
|
||||||
\}
|
\}
|
||||||
|
|
||||||
" Viewer settings for different platforms
|
" Viewer settings for different platforms
|
||||||
if g:is_win
|
if g:is_win
|
||||||
let g:vimtex_view_general_viewer = 'SumatraPDF'
|
let g:vimtex_view_general_viewer = 'SumatraPDF'
|
||||||
let g:vimtex_view_general_options_latexmk = '-reuse-instance'
|
let g:vimtex_view_general_options_latexmk = '-reuse-instance'
|
||||||
let g:vimtex_view_general_options
|
let g:vimtex_view_general_options = '-reuse-instance -forward-search @tex @line @pdf'
|
||||||
\ = '-reuse-instance -forward-search @tex @line @pdf'
|
endif
|
||||||
endif
|
|
||||||
|
|
||||||
if g:is_mac
|
if g:is_mac
|
||||||
" let g:vimtex_view_method = "skim"
|
" let g:vimtex_view_method = "skim"
|
||||||
let g:vimtex_view_general_viewer
|
let g:vimtex_view_general_viewer
|
||||||
\ = '/Applications/Skim.app/Contents/SharedSupport/displayline'
|
\ = '/Applications/Skim.app/Contents/SharedSupport/displayline'
|
||||||
let g:vimtex_view_general_options = '-r @line @pdf @tex'
|
let g:vimtex_view_general_options = '-r @line @pdf @tex'
|
||||||
|
|
||||||
" This adds a callback hook that updates Skim after compilation
|
" This adds a callback hook that updates Skim after compilation
|
||||||
let g:vimtex_compiler_callback_hooks = ['UpdateSkim']
|
let g:vimtex_compiler_callback_hooks = ['UpdateSkim']
|
||||||
|
|
||||||
function! UpdateSkim(status)
|
function! UpdateSkim(status)
|
||||||
if !a:status | return | endif
|
if !a:status | return | endif
|
||||||
|
|
||||||
let l:out = b:vimtex.out()
|
let l:out = b:vimtex.out()
|
||||||
let l:tex = expand('%:p')
|
let l:tex = expand('%:p')
|
||||||
let l:cmd = [g:vimtex_view_general_viewer, '-r']
|
let l:cmd = [g:vimtex_view_general_viewer, '-r']
|
||||||
|
|
||||||
if !empty(system('pgrep Skim'))
|
if !empty(system('pgrep Skim'))
|
||||||
call extend(l:cmd, ['-g'])
|
call extend(l:cmd, ['-g'])
|
||||||
endif
|
endif
|
||||||
|
|
||||||
if has('nvim')
|
if has('nvim')
|
||||||
call jobstart(l:cmd + [line('.'), l:out, l:tex])
|
call jobstart(l:cmd + [line('.'), l:out, l:tex])
|
||||||
elseif has('job')
|
elseif has('job')
|
||||||
call job_start(l:cmd + [line('.'), l:out, l:tex])
|
call job_start(l:cmd + [line('.'), l:out, l:tex])
|
||||||
else
|
else
|
||||||
call system(join(l:cmd + [line('.'), shellescape(l:out), shellescape(l:tex)], ' '))
|
call system(join(l:cmd + [line('.'), shellescape(l:out), shellescape(l:tex)], ' '))
|
||||||
endif
|
endif
|
||||||
endfunction
|
endfunction
|
||||||
endif
|
endif
|
||||||
endif
|
endif
|
||||||
"}}
|
"}}
|
||||||
|
|
||||||
@ -793,14 +790,14 @@ endif
|
|||||||
"""""""""""""""""""""""""""vim-airline setting""""""""""""""""""""""""""""""
|
"""""""""""""""""""""""""""vim-airline setting""""""""""""""""""""""""""""""
|
||||||
" Set airline theme to a random one if it exists
|
" Set airline theme to a random one if it exists
|
||||||
let s:candidate_airlinetheme = ['ayu_mirage', 'base16_flat',
|
let s:candidate_airlinetheme = ['ayu_mirage', 'base16_flat',
|
||||||
\ 'lucius', 'ayu_dark', 'base16_bright',
|
\ 'lucius', 'ayu_dark', 'base16_bright',
|
||||||
\ 'base16_adwaita', 'jellybeans', 'base16_isotope',
|
\ 'base16_adwaita', 'jellybeans', 'base16_isotope',
|
||||||
\ 'luna', 'raven', 'term', 'base16_summerfruit']
|
\ 'luna', 'raven', 'term', 'base16_summerfruit']
|
||||||
let s:idx = utils#RandInt(0, len(s:candidate_airlinetheme)-1)
|
let s:idx = utils#RandInt(0, len(s:candidate_airlinetheme)-1)
|
||||||
let s:theme = s:candidate_airlinetheme[s:idx]
|
let s:theme = s:candidate_airlinetheme[s:idx]
|
||||||
|
|
||||||
if utils#HasAirlinetheme(s:theme)
|
if utils#HasAirlinetheme(s:theme)
|
||||||
let g:airline_theme=s:theme
|
let g:airline_theme=s:theme
|
||||||
endif
|
endif
|
||||||
|
|
||||||
" Tabline settings
|
" Tabline settings
|
||||||
@ -825,7 +822,7 @@ let g:airline_skip_empty_sections = 1
|
|||||||
let g:airline_powerline_fonts = 0
|
let g:airline_powerline_fonts = 0
|
||||||
|
|
||||||
if !exists('g:airline_symbols')
|
if !exists('g:airline_symbols')
|
||||||
let g:airline_symbols = {}
|
let g:airline_symbols = {}
|
||||||
endif
|
endif
|
||||||
let g:airline_symbols.branch = '⎇'
|
let g:airline_symbols.branch = '⎇'
|
||||||
let g:airline_symbols.paste = 'ρ'
|
let g:airline_symbols.paste = 'ρ'
|
||||||
@ -862,8 +859,8 @@ augroup END
|
|||||||
|
|
||||||
" Show matching keyword as underlined text to reduce color clutter
|
" Show matching keyword as underlined text to reduce color clutter
|
||||||
augroup matchup_matchword_highlight
|
augroup matchup_matchword_highlight
|
||||||
autocmd!
|
autocmd!
|
||||||
autocmd ColorScheme * hi MatchWord cterm=underline gui=underline
|
autocmd ColorScheme * hi MatchWord cterm=underline gui=underline
|
||||||
augroup END
|
augroup END
|
||||||
|
|
||||||
""""""""""""""""""""""""comfortable-motion settings """"""""""""""""""""""
|
""""""""""""""""""""""""comfortable-motion settings """"""""""""""""""""""
|
||||||
@ -885,34 +882,34 @@ noremap <silent> <ScrollWheelUp> :call comfortable_motion#flick(-20)<CR>
|
|||||||
" Automatically open quickfix window of 6 line tall after asyncrun starts
|
" Automatically open quickfix window of 6 line tall after asyncrun starts
|
||||||
let g:asyncrun_open = 6
|
let g:asyncrun_open = 6
|
||||||
if has('win32')
|
if has('win32')
|
||||||
" Command output encoding for Windows
|
" Command output encoding for Windows
|
||||||
let g:asyncrun_encs = 'gbk'
|
let g:asyncrun_encs = 'gbk'
|
||||||
endif
|
endif
|
||||||
|
|
||||||
""""""""""""""""""""""""""""""firenvim settings""""""""""""""""""""""""""""""
|
""""""""""""""""""""""""""""""firenvim settings""""""""""""""""""""""""""""""
|
||||||
if exists('g:started_by_firenvim') && g:started_by_firenvim
|
if exists('g:started_by_firenvim') && g:started_by_firenvim
|
||||||
" general options
|
" general options
|
||||||
set laststatus=0 nonumber noruler noshowcmd
|
set laststatus=0 nonumber noruler noshowcmd
|
||||||
|
|
||||||
" general config for firenvim
|
" general config for firenvim
|
||||||
let g:firenvim_config = {
|
let g:firenvim_config = {
|
||||||
\ 'globalSettings': {
|
\ 'globalSettings': {
|
||||||
\ 'alt': 'all',
|
\ 'alt': 'all',
|
||||||
\ },
|
\ },
|
||||||
\ 'localSettings': {
|
\ 'localSettings': {
|
||||||
\ '.*': {
|
\ '.*': {
|
||||||
\ 'cmdline': 'neovim',
|
\ 'cmdline': 'neovim',
|
||||||
\ 'priority': 0,
|
\ 'priority': 0,
|
||||||
\ 'selector': 'textarea',
|
\ 'selector': 'textarea',
|
||||||
\ 'takeover': 'never',
|
\ 'takeover': 'never',
|
||||||
\ },
|
\ },
|
||||||
\ }
|
\ }
|
||||||
\ }
|
\ }
|
||||||
|
|
||||||
augroup firenvim
|
augroup firenvim
|
||||||
autocmd!
|
autocmd!
|
||||||
autocmd BufEnter *.txt setlocal filetype=markdown.pandoc
|
autocmd BufEnter *.txt setlocal filetype=markdown.pandoc
|
||||||
augroup END
|
augroup END
|
||||||
endif
|
endif
|
||||||
|
|
||||||
""""""""""""""""""""""""""""""nvim-gdb settings""""""""""""""""""""""""""""""
|
""""""""""""""""""""""""""""""nvim-gdb settings""""""""""""""""""""""""""""""
|
||||||
|
|||||||
18
ui.vim
18
ui.vim
@ -5,7 +5,7 @@
|
|||||||
" colors, see https://github.com/termstandard/colors and
|
" colors, see https://github.com/termstandard/colors and
|
||||||
" https://gist.github.com/XVilka/8346728.
|
" https://gist.github.com/XVilka/8346728.
|
||||||
if $TERM ==# 'xterm-256color' || exists('g:started_by_firenvim')
|
if $TERM ==# 'xterm-256color' || exists('g:started_by_firenvim')
|
||||||
set termguicolors
|
set termguicolors
|
||||||
endif
|
endif
|
||||||
" Use dark background
|
" Use dark background
|
||||||
set background=dark
|
set background=dark
|
||||||
@ -16,15 +16,15 @@ set background=dark
|
|||||||
" We should check if theme exists before using it, otherwise you will get
|
" We should check if theme exists before using it, otherwise you will get
|
||||||
" error message when starting Nvim
|
" error message when starting Nvim
|
||||||
if utils#HasColorscheme('gruvbox8')
|
if utils#HasColorscheme('gruvbox8')
|
||||||
" Italic options should be put before colorscheme setting,
|
" Italic options should be put before colorscheme setting,
|
||||||
" see https://github.com/morhetz/gruvbox/wiki/Terminal-specific#1-italics-is-disabled
|
" see https://github.com/morhetz/gruvbox/wiki/Terminal-specific#1-italics-is-disabled
|
||||||
let g:gruvbox_italics=1
|
let g:gruvbox_italics=1
|
||||||
let g:gruvbox_italicize_strings=1
|
let g:gruvbox_italicize_strings=1
|
||||||
let g:gruvbox_filetype_hi_groups = 0
|
let g:gruvbox_filetype_hi_groups = 0
|
||||||
let g:gruvbox_plugin_hi_groups = 0
|
let g:gruvbox_plugin_hi_groups = 0
|
||||||
colorscheme gruvbox8_hard
|
colorscheme gruvbox8_hard
|
||||||
else
|
else
|
||||||
colorscheme desert
|
colorscheme desert
|
||||||
endif
|
endif
|
||||||
|
|
||||||
""""""""""""""""""""""""""" deus settings"""""""""""""""""""""""""""""""""
|
""""""""""""""""""""""""""" deus settings"""""""""""""""""""""""""""""""""
|
||||||
|
|||||||
@ -7,12 +7,12 @@ let g:loaded_python_provider=0
|
|||||||
" faster. See https://neovim.io/doc/user/provider.html.
|
" faster. See https://neovim.io/doc/user/provider.html.
|
||||||
if executable('python')
|
if executable('python')
|
||||||
if g:is_win
|
if g:is_win
|
||||||
let g:python3_host_prog=substitute(exepath('python'), '.exe$', '', 'g')
|
let g:python3_host_prog=substitute(exepath('python'), '.exe$', '', 'g')
|
||||||
elseif g:is_linux || g:is_mac
|
elseif g:is_linux || g:is_mac
|
||||||
let g:python3_host_prog=exepath('python')
|
let g:python3_host_prog=exepath('python')
|
||||||
endif
|
endif
|
||||||
else
|
else
|
||||||
echoerr 'Python 3 executable not found! You must install Python 3 and set its PATH correctly!'
|
echoerr 'Python 3 executable not found! You must install Python 3 and set its PATH correctly!'
|
||||||
endif
|
endif
|
||||||
|
|
||||||
" Custom mapping <leader> (see `:h mapleader` for more info)
|
" Custom mapping <leader> (see `:h mapleader` for more info)
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user