332 lines
10 KiB
VimL
332 lines
10 KiB
VimL
set nocompatible
|
||
|
||
"https://github.com/tpope/vim-pathogen.git
|
||
execute pathogen#infect()
|
||
|
||
syntax enable
|
||
syntax sync fromstart
|
||
filetype plugin on
|
||
filetype indent on
|
||
|
||
colorscheme noctu_adapted
|
||
|
||
set encoding=utf-8
|
||
set colorcolumn=81
|
||
set mouse=a
|
||
set term=screen
|
||
set undofile
|
||
set shiftwidth=4
|
||
set tabstop=4
|
||
set softtabstop=4
|
||
set backspace=indent,eol,start
|
||
set cindent
|
||
set history=1000
|
||
set showcmd
|
||
set incsearch
|
||
set nowrap
|
||
set spell
|
||
set ruler
|
||
set wrap
|
||
set breakindent
|
||
set showbreak=----->
|
||
set linebreak
|
||
set listchars=eol:¬,tab:>·,trail:~,extends:>,precedes:<,space:␣
|
||
set textwidth=80
|
||
set tags=./tags,./TAGS,tags,TAGS
|
||
|
||
set nojoinspaces
|
||
|
||
autocmd FileType haskell set expandtab
|
||
autocmd FileType haskell set nospell
|
||
"autocmd FileType haskell set formatprg=brittany
|
||
|
||
"escape codes for italics
|
||
set t_ZH=[3m
|
||
set t_ZR=[23m
|
||
|
||
map cc :cc<cr>
|
||
map gn :bn<cr>
|
||
map gp :bp<cr>
|
||
"map <C-m> <Esc>"zyiw :tjump <C-r>z<cr>
|
||
nmap cp :let @" = "in".expand("%")<cr>
|
||
nnoremap <LeftMouse> <nop>
|
||
map <F5> :!cscope -Rb<CR>:cs reset<CR><CR>
|
||
|
||
"limit foldtext to 80 characters
|
||
fu! FoldText()
|
||
return strcharpart(foldtext(), 1, 80)
|
||
endf
|
||
set foldtext=FoldText()
|
||
set fillchars=fold:\
|
||
|
||
"check files for changes frequently
|
||
"set autoread
|
||
"set ut=1000
|
||
"au CursorHold * checktime
|
||
|
||
"highlight own types:
|
||
au BufRead,BufNewFile *.[ch] let fname = expand('<afile>:p:h') . '/types.vim'
|
||
au BufRead,BufNewFile *.[ch] if filereadable(fname)
|
||
au BufRead,BufNewFile *.[ch] exe 'so ' . fname
|
||
au BufRead,BufNewFile *.[ch] endif
|
||
|
||
"https://unix.stackexchange.com/questions/60189/how-to-search-the-current-word-in-all-opened-tabs-in-vim
|
||
" enables to search in all open buffers with :Search <pattern>
|
||
command! -nargs=1 Find call setqflist([]) | silent
|
||
\ execute "bufdo grepadd! '<args>' %" | redraw!
|
||
nnoremap <left> :cprev<cr>zvzz
|
||
nnoremap <right> :cnext<cr>zvzz
|
||
|
||
"https://stackoverflow.com/questions/9403098/is-it-possible-to-jump-to-the-next-closed-fold-in-vim
|
||
nnoremap <silent> <leader>zj :call NextClosedFold('j')<cr>
|
||
nnoremap <silent> <leader>zk :call NextClosedFold('k')<cr>
|
||
|
||
function! NextClosedFold(dir)
|
||
let cmd = 'norm!z' . a:dir
|
||
let view = winsaveview()
|
||
let [l0, l, open] = [0, view.lnum, 1]
|
||
while l != l0 && open
|
||
exe cmd
|
||
let [l0, l] = [l, line('.')]
|
||
let open = foldclosed(l) < 0
|
||
endwhile
|
||
if open
|
||
call winrestview(view)
|
||
endif
|
||
endfunction
|
||
|
||
"nnoremap <silent> <leader>zj :<c-u>call RepeatCmd('call NextClosedFold("j")')<cr>
|
||
"nnoremap <silent> <leader>zk :<c-u>call RepeatCmd('call NextClosedFold("k")')<cr>
|
||
|
||
"function! RepeatCmd(cmd) range abort
|
||
" let n = v:count < 1 ? 1 : v:count
|
||
" while n > 0
|
||
" exe a:cmd
|
||
" let n -= 1
|
||
" endwhile
|
||
"endfunction
|
||
|
||
"https://stackoverflow.com/questions/13634826/show-function-name-in-status-line
|
||
fun! ShowFuncName()
|
||
let lnum = line(".")
|
||
let col = col(".")
|
||
echohl ModeMsg
|
||
echo getline(search("^[^ \t#/]\\{2}.*[^:]\s*$", 'bW'))
|
||
echohl None
|
||
call search("\\%" . lnum . "l" . "\\%" . col . "c")
|
||
endfun
|
||
map <C-F> :call ShowFuncName() <CR>
|
||
|
||
"https://stackoverflow.com/questions/1054701/get-ctags-in-vim-to-go-to-definition-not-declaration
|
||
if has("cscope")
|
||
set csto=0
|
||
set cst
|
||
set nocsverb
|
||
" add any database in current directory
|
||
if filereadable("cscope.out")
|
||
cs add cscope.out
|
||
" else add database pointed to by environment
|
||
elseif $CSCOPE_DB != ""
|
||
cs add $CSCOPE_DB
|
||
endif
|
||
set csverb
|
||
endif
|
||
" jump to a function declaration
|
||
nmap <silent> <C-\> :cs find s <C-R>=expand("<cword>")<CR><CR>1<CR><CR>
|
||
" show a list of where function is called
|
||
nmap <silent> <C-_> :lcs find c <C-R>=expand("<cword>")<CR><CR>
|
||
set cscopequickfix=c+
|
||
|
||
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
|
||
"""""""""""""""""""""""""""""""" PLUGIN SPECIFIC """""""""""""""""""""""""""""""
|
||
runtime ftplugin/man.vim
|
||
|
||
""""""""""""""""""""""""""""""""""" AUTO-MKDIR """""""""""""""""""""""""""""""""
|
||
"https://github.com/arp242/auto_mkdir2.vim.git
|
||
|
||
"""""""""""""""""""""""""""""""""" VIM-BUFKILL """""""""""""""""""""""""""""""""
|
||
"https://github.com/qpkorr/vim-bufkill.git
|
||
|
||
""""""""""""""""""""""""""""""" MULTIPLE SEARCH """""""""""""""""""""""""""""""
|
||
"https://www.vim.org/scripts/script.php?script_id=479
|
||
|
||
""""""""""""""""""""""""""""""" MULTIPLE CURSORS """""""""""""""""""""""""""""""
|
||
"https://github.com/terryma/vim-multiple-cursors.git
|
||
|
||
""""""""""""""""""""""""""""""""""" SYNTASTIC """"""""""""""""""""""""""""""""""
|
||
"https://github.com/vim-syntastic/syntastic.git
|
||
|
||
let g:syntastic_mode_map = {"mode": "active"}
|
||
let g:syntastic_always_populate_loc_list = 1
|
||
let g:syntastic_auto_loc_list = 0
|
||
let g:syntastic_check_on_open = 0
|
||
let g:syntastic_check_on_wq = 0
|
||
let g:syntastic_auto_jump = 3
|
||
let g:syntastic_aggregate_errors = 1
|
||
let g:syntastic_enable_highlighting = 0
|
||
|
||
let g:syntastic_c_include_dirs = ["/usr/include/gtk-3.0"]
|
||
|
||
let g:syntastic_java_checkers = ['checkstyle', 'javac']
|
||
let g:syntastic_java_checkstyle_classpath =
|
||
\ '~/.checkstyle/checkstyle-8.16-all.jar'
|
||
let g:syntastic_java_checkstyle_conf_file = '~/.checkstyle/checkstyle.xml'
|
||
|
||
let g:syntastic_tex_chktex_args = "-l ~/.chktexrc"
|
||
|
||
let g:syntastic_tex_lacheck_quiet_messages = {"regex": ['.*unmatched.*',
|
||
\ 'bad character in label.*']}
|
||
let g:syntastic_tex_chktex_quiet_messages =
|
||
\ {"regex": ["`)' expected, found `}'",
|
||
\ "`}' expected, found `)'"]}
|
||
|
||
map <C-h><C-h> :lprev<CR>
|
||
map <C-j><C-j> :lnext<CR>
|
||
|
||
autocmd FileType c set formatprg=uncrustify\ -l\ c\ --frag\ -q
|
||
|
||
"https://vim.fandom.com/wiki/Highlight_current_line#Highlighting_that_stays_after_cursor_moves
|
||
nnoremap <silent> <Leader>h ml:execute 'match Search /\%'.line('.').'l/'<CR>
|
||
|
||
"""""""""""""""""""""""""""""""""""""" VIMUX """""""""""""""""""""""""""""""""""
|
||
"https://github.com/preservim/vimux.git
|
||
|
||
function! REPLsettings(cmd)
|
||
call VimuxOpenRunner()
|
||
call VimuxSendText(a:cmd."\n")
|
||
nmap <Space> "vyy:call VimuxSendText(@v)<CR>j^
|
||
endfunction
|
||
|
||
"autocmd FileType python call REPLsettings("python")
|
||
"autocmd FileType R call REPLsettings("R")
|
||
|
||
nmap <C-c><C-o> :call VimuxOpenRunner()<CR>
|
||
nmap <C-c><C-p> :call REPLsettings("")<CR>
|
||
|
||
"""""""""""""""""""""""""""""""""""" DIFFCHAR """"""""""""""""""""""""""""""""""
|
||
"https://github.com/rickhowe/diffchar.vim.git
|
||
|
||
let g:DiggUnit="Char"
|
||
|
||
"""""""""""""""""""""""""""""""""" LATEX SUITE """""""""""""""""""""""""""""""""
|
||
"https://github.com/vim-latex/vim-latex
|
||
|
||
set grepprg=grep\ -nH\ $*
|
||
|
||
set modelineexpr
|
||
|
||
let g:Tex_DefaultTargetFormat = "pdf"
|
||
let g:Tex_ViewRule_pdf = "qpdfview"
|
||
let g:Tex_CompileRule_pdf = "latexmk -pdf -shell-escape -synctex=1 $*"
|
||
"let g:Tex_ViewRule_pdf = "zathura"
|
||
|
||
let g:tex_flavor='latex'
|
||
let g:Tex_GotoError=0
|
||
let g:tex_comment_nospell=1
|
||
|
||
autocmd BufNewFile,BufRead *.tex syntax sync fromstart
|
||
autocmd BufNewFile,BufRead *.tex set spelllang=en_gb spell
|
||
autocmd BufNewFile,BufRead *.tex syntax match Comment "%.*"
|
||
autocmd BufNewFile,BufRead *.tex call TexNewMathZone("M", "align", 1)
|
||
autocmd BufNewFile,BufRead *.tex set foldtext=FoldText()
|
||
autocmd BufNewFile,BufRead *.tex set textwidth=80
|
||
autocmd BufNewFile,BufRead *.tex let g:syntastic_auto_jump = 0
|
||
autocmd BufNewFile,BufRead *.tex set expandtab
|
||
|
||
imap <C-l><C-o> :let b:Imap_FreezeImap = 1<CR>
|
||
imap <C-l><C-u> :let b:Imap_FreezeImap = 0<CR>
|
||
imap <C-l><C-m> <ESC>:w<CR>:!biber -E utf8 $(basename % .tex)<CR>
|
||
nmap <C-l><C-m> :w<CR>:!biber -E utf8 $(basename % .tex)<CR>
|
||
|
||
map <C-l><C-f> :execute escape(":!qpdfview --quiet --unique $(basename % .tex).pdf $(basename % .tex).pdf#src:%:" . line('.') . ":" . col('.') . " &", '#')<CR><CR>
|
||
|
||
imap <C-l><C-j> <F7>
|
||
imap <C-l><C-i> <Plug>Tex_InsertItemOnThisLine
|
||
imap <C-l><C-l> <Plug>Tex_LeftRight
|
||
imap <C-l><C-x> <Plug>Tex_MathCal
|
||
imap <C-l><C-v> <Plug>Tex_MathBF
|
||
|
||
""""""""""""""""""""""""""""""" RAINBOW BRACKETS """""""""""""""""""""""""""""""
|
||
"https://github.com/luochen1990/rainbow.git
|
||
"
|
||
"\ 'parentheses': ['start=/(/ end=/)/ fold', 'start=/\[/ end=/\]/ fold',
|
||
"\ 'start=/{/ end=/}/ fold'],
|
||
|
||
let g:rainbow_active = 1
|
||
let g:rainbow_conf = {
|
||
\ 'guifgs': ['royalblue3', 'darkorange3', 'seagreen3', 'firebrick'],
|
||
\ 'ctermfgs': ['lightblue', 'lightgreen', 'magenta', 'yellow'],
|
||
\ 'guis': [''],
|
||
\ 'cterms': [''],
|
||
\ 'operators': '_,_',
|
||
\ 'parentheses': ['start=/(/ end=/)/', 'start=/\[/ end=/\]/ fold',
|
||
\ 'start=/{/ end=/}/ fold'],
|
||
\ 'separately': {
|
||
\ '*': {},
|
||
\ 'markdown': {
|
||
\ 'parentheses_options': 'containedin=markdownCode contained',
|
||
\ },
|
||
\ 'lisp': {
|
||
\ 'guifgs': ['royalblue3', 'darkorange3', 'seagreen3', 'firebrick',
|
||
\ 'darkorchid3'],
|
||
\ },
|
||
\ 'haskell': {
|
||
\ 'parentheses': ['start=/(/ end=/)/ fold',
|
||
\ 'start=/\[/ end=/\]/ fold', 'start=/\v\{\ze[^-]/ end=/}/ fold'],
|
||
\ },
|
||
\ 'vim': {
|
||
\ 'parentheses_options': 'containedin=vimFuncBody',
|
||
\ },
|
||
\ 'perl': {
|
||
\ 'syn_name_prefix': 'perlBlockFoldRainbow',
|
||
\ },
|
||
\ 'stylus': {
|
||
\ 'parentheses': ['start=/{/ end=/}/ fold contains=@colorableGroup'],
|
||
\ },
|
||
\ 'css': 0,
|
||
\ }
|
||
\}
|
||
|
||
""""""""""""""""""""""""""""""""""" TINY MODE """"""""""""""""""""""""""""""""""
|
||
"https://www.vim.org/scripts/script.php?script_id=2223
|
||
|
||
nmap <C-W>+ <C-W>+<SID>ws
|
||
nmap <C-W>- <C-W>-<SID>ws
|
||
nmap <C-W>> <C-W>><SID>ws
|
||
nmap <C-W>< <C-W><<SID>ws
|
||
nn <script> <SID>ws+ <C-W>+<SID>ws
|
||
nn <script> <SID>ws- <C-W>-<SID>ws
|
||
nn <script> <SID>ws> <C-W>><SID>ws
|
||
nn <script> <SID>ws< <C-W><<SID>ws
|
||
"nmap <SID>ws <Nop>
|
||
|
||
"""""""""""""""""""""""""""""""" DOXYGEN TOOLKIT """""""""""""""""""""""""""""""
|
||
"https://www.vim.org/scripts/script.php?script_id=987
|
||
|
||
"fu! DoxyFoldText()
|
||
" if match(getline(v:foldstart+1), "\^/\[*]\[*]") == 0
|
||
" return strcharpart("++ " . (v:foldend-v:foldstart) . " lines: " .
|
||
" \matchstr(getline(v:foldstart+1, v:foldend),
|
||
" \"\^\[^ ]\[^\*]\.\*"), 0, 80)
|
||
" else
|
||
" return FoldText()
|
||
" endif
|
||
"endf
|
||
|
||
"map <C-D> ][a/*}}}*/<ESC>^%:call search("(", 'b')<cr>O/*{{{*/<ESC>j:Dox<cr>
|
||
map <C-D> <ESC>][%:call search("(", 'b')<cr>:Dox<cr>
|
||
|
||
autocmd FileType c set foldenable
|
||
autocmd FileType c set foldmethod=syntax
|
||
autocmd FileType c set foldnestmax=2
|
||
"autocmd FileType c set foldtext=DoxyFoldText()
|
||
autocmd FileType c set syntax=c.doxygen
|
||
|
||
autocmd FileType dart set shiftwidth=2
|
||
autocmd FileType dart set tabstop=2
|
||
autocmd FileType dart set softtabstop=2
|
||
autocmd FileType dart set expandtab
|
||
|
||
"""""""""""""""""""""""""""""""""""" VIM2HS """"""""""""""""""""""""""""""""""""
|
||
"https://github.com/dag/vim2hs
|
||
let g:haskell_conceal = 1
|