Sync Knyf-inatorV2
This commit is contained in:
parent
13bfac82df
commit
1619646611
109
init.vim
109
init.vim
@ -44,6 +44,12 @@
|
||||
endif
|
||||
endif
|
||||
|
||||
" if empty(glob(stdpath('data') . '/site/autoload/let-modeline.vim'))
|
||||
" silent execute '!curl -fLo ' . stdpath('data') . '/site/autoload/let-modeline.vim' . ' --create-dirs ' .
|
||||
" \ 'https://raw.githubusercontent.com/LucHermitte/lh-misc/master/plugin/let-modeline.vim'
|
||||
" endif
|
||||
" call let-modeline#hello()
|
||||
|
||||
if has('win32') || has('win64')
|
||||
let g:plugged_home = stdpath('data') . '\plugged' " neovim path
|
||||
else
|
||||
@ -53,10 +59,12 @@
|
||||
|
||||
call plug#begin(g:plugged_home)
|
||||
" vim-plug bundles {{{
|
||||
|
||||
" VimScript Library
|
||||
Plug 'inkarkat/vim-ingo-library'
|
||||
|
||||
" Enable 'let' in modelines (replace the modeline with VIM:)
|
||||
Plug 'vim-scripts/let-modeline.vim'
|
||||
|
||||
" UI related
|
||||
Plug 'chriskempson/base16-vim'
|
||||
Plug 'itchyny/lightline.vim'
|
||||
@ -122,7 +130,11 @@
|
||||
Plug 'lervag/vimtex'
|
||||
|
||||
" vim-instant-markdown
|
||||
Plug 'suan/vim-instant-markdown', {'for': 'markdown'}
|
||||
" Plug 'suan/vim-instant-markdown', {'for': 'markdown'}
|
||||
Plug 'instant-markdown/vim-instant-markdown', {'for': 'markdown'}
|
||||
|
||||
" SageMath
|
||||
Plug 'petRUShka/vim-sage'
|
||||
|
||||
" Git {{{
|
||||
|
||||
@ -214,6 +226,8 @@ tnoremap <Esc> <C-\><C-n>
|
||||
augroup END
|
||||
augroup DontItalicMarkdownLatexUnderscore
|
||||
autocmd filetype markdown syntax match markdownIgnore "\$.*_.*\$" containedin=markdown
|
||||
" autocmd filetype markdown syntax match markdownIgnore \M(\\begin\{)?(\$|gather\*?|align\*?|).*_.*(\\end\{)?\2" containedin=markdown
|
||||
" autocmd filetype markdown syntax match markdownIgnore "\\begin{\(\$\|gather\*\?\|align\*\?\)}.*_.*\\end{\1}" containedin=markdown
|
||||
augroup END
|
||||
|
||||
" " Colorscheme
|
||||
@ -237,6 +251,8 @@ tnoremap <Esc> <C-\><C-n>
|
||||
|
||||
" dichromatic
|
||||
colorscheme dichromatic
|
||||
" Recolor selected line in QuickFix window
|
||||
hi QuickFixLine ctermbg=15 ctermfg=240 cterm=NONE guibg=#585858 guifg=#FFFFFF gui=NONE
|
||||
|
||||
" Lightline
|
||||
"\ 'colorscheme': 'solarized',
|
||||
@ -313,7 +329,8 @@ set smartcase
|
||||
set tabstop=4
|
||||
|
||||
" set to the same as tabstop
|
||||
set shiftwidth=4
|
||||
" 0 automatically defaults to the current value of tabstop
|
||||
set shiftwidth=0
|
||||
|
||||
" if it looks like a tab, we can delete it like a tab
|
||||
set softtabstop=4
|
||||
@ -325,18 +342,31 @@ set smartcase
|
||||
set shiftround
|
||||
"}}}
|
||||
|
||||
" highlight tabs and trailing whitespace {{{
|
||||
" Highlight tabs and trailing whitespace {{{
|
||||
set listchars=tab:>-,trail:·,nbsp:¬,extends:…,precedes:…
|
||||
set list
|
||||
" }}}
|
||||
|
||||
" TODO: jry: disable this in favor of vim-stay
|
||||
" save folds in files {{{
|
||||
" Save folds in files {{{
|
||||
fun! LoadFoldsOnEnter()
|
||||
" Filetypes to skip in favor of other types folding
|
||||
if &ft =~ 'markdown'
|
||||
return
|
||||
endif
|
||||
|
||||
silent! loadview
|
||||
endfun
|
||||
|
||||
augroup autofolding
|
||||
autocmd!
|
||||
autocmd BufWinLeave,BufLeave,BufWritePost * nested if filereadable(expand('%')) | silent mkview!
|
||||
autocmd BufWinEnter,BufEnter,BufReadPost * silent! loadview
|
||||
" autocmd BufWinEnter,BufEnter,BufReadPost * silent! loadview
|
||||
autocmd BufWinEnter,BufEnter,BufReadPost * call LoadFoldsOnEnter()
|
||||
augroup END
|
||||
|
||||
" Enable automatic markdown folding
|
||||
let g:markdown_folding = 1
|
||||
" }}}
|
||||
|
||||
" Retain undo-history between sessions
|
||||
@ -460,8 +490,34 @@ endif
|
||||
" normal mode (after 1s; no delay when writing).
|
||||
call neomake#configure#automake('nrwi', 2000)
|
||||
|
||||
" Autoopen error list
|
||||
let g:neomake_open_list = 2 " 0: show hints, 1: show list and move cursor to list, 2: show list, but don't move cursor
|
||||
" " Autoopen error list
|
||||
" let g:neomake_open_list = 2 " 0: show hints, 1: show list and move cursor to list, 2: show list, but don't move cursor
|
||||
|
||||
" Autoopen error list {{{
|
||||
let g:neomake_open_list = 0 " Don't let Neomake do it!
|
||||
|
||||
" Preserve view (don't automatically scroll) when moving back to
|
||||
" previous buffer {{
|
||||
function! SaveWinID()
|
||||
let t:curWinID = win_getid()
|
||||
endfunction
|
||||
|
||||
function! LoadWinID()
|
||||
call win_gotoid( t:curWinID )
|
||||
endfunction
|
||||
|
||||
" When switching buffers, open location window, but preserve
|
||||
" cursor location and view
|
||||
augroup NeomakeJumpBackHooks
|
||||
au!
|
||||
" autocmd User NeomakeJobInit nested lexpr [] | call AutoSaveWinView() | call SaveWinID()
|
||||
" autocmd User NeomakeFinished nested lwindow | call LoadWinID() | call AutoRestoreWinView()
|
||||
autocmd User NeomakeJobInit lexpr [] | call SaveWinID()
|
||||
autocmd User NeomakeFinished lwindow | call LoadWinID()
|
||||
augroup END
|
||||
" autocmd BufLeave * call AutoSaveWinView()
|
||||
" }}}
|
||||
" }}}
|
||||
|
||||
" Configure for C
|
||||
let g:c_syntax_for_h=1
|
||||
@ -484,7 +540,7 @@ endif
|
||||
\ '-Wall',
|
||||
\ '-Wextra',
|
||||
\ '-Wfloat-equal',
|
||||
\ '-std=c++17',
|
||||
\ '-std=c++20',
|
||||
\ '-I.',
|
||||
\ '-fopenmp'
|
||||
\ ]
|
||||
@ -521,6 +577,12 @@ endif
|
||||
|
||||
" \ || (expand('%:t') =~# 'Test.pm')
|
||||
|
||||
" Configure for SageMath
|
||||
augroup NeomakeSageMath
|
||||
autocmd!
|
||||
autocmd BufReadPre,BufEnter *sage.python let b:neomake_python_enabled_makers = []
|
||||
augroup END
|
||||
|
||||
" Configure for latex
|
||||
let g:neomake_tex_enabled_makers = ['chktex']
|
||||
augroup NeomakeTex
|
||||
@ -548,6 +610,25 @@ endif
|
||||
endfor
|
||||
endfunction
|
||||
|
||||
" Configure for Keymapper (https://github.com/houmain/keymapper) config
|
||||
" file
|
||||
let g:neomake_keymapper_enabled_makers = ['keymapper']
|
||||
let g:neomake_keymapper_maker = {
|
||||
\ 'exe': 'keymapper',
|
||||
\ 'args': ['--check', '--no-color'],
|
||||
\ 'output_stream': 'both',
|
||||
\ 'append_file': 0,
|
||||
\ 'errorformat':
|
||||
\ "%m in line %l",
|
||||
\ }
|
||||
|
||||
" augroup NeomakeKeymapper
|
||||
" au!
|
||||
" autocmd BufNewFile,BufRead *.keymapper.conf set syntax=conf
|
||||
" " autocmd BufReadPre keymapper.conf let b:neomake_conf_enabled_makers = ['keymapper']
|
||||
" " autocmd BufEnter keymapper.conf let b:neomake_keymapper_enabled_makers = ['keymapper']
|
||||
" augroup END
|
||||
|
||||
" augroup perlcritic_config
|
||||
" au!
|
||||
" au FileType perl call Configure_perlcritic_for_test(expand("<afile>:p"))
|
||||
@ -566,6 +647,12 @@ endif
|
||||
|
||||
" Goto previous linting error
|
||||
nnoremap [d :lprev<cr>
|
||||
|
||||
" Fit the QuickFix window to the number of errors
|
||||
au FileType qf call AdjustWindowHeight(3, 10)
|
||||
function! AdjustWindowHeight(minheight, maxheight)
|
||||
exe max([min([line("$"), a:maxheight]), a:minheight]) . "wincmd _"
|
||||
endfunction
|
||||
" }}}
|
||||
|
||||
" add a proper delete line command {{{
|
||||
@ -889,11 +976,15 @@ endfunction
|
||||
function! GenerateMarkdownTOC()
|
||||
" We need remove the anchors before we run doctoc. Otherwise it would
|
||||
" include the anchors in the link, and the anchors would become incorrect
|
||||
" Doctoc also doesn't like folds, so disable them beforehand
|
||||
set nofoldenable
|
||||
call RemoveMarkdownHeaderAnchors()
|
||||
exec ":w"
|
||||
silent exec "!doctoc " . bufname()
|
||||
exec ":e"
|
||||
call GenerateMarkdownHeaderAnchors()
|
||||
set foldenable
|
||||
exec ":w"
|
||||
endfunction
|
||||
|
||||
augroup MarkdownKeyBinds
|
||||
|
Loading…
Reference in New Issue
Block a user