Update from personal

This commit is contained in:
Knyffen 2022-10-26 12:30:57 +02:00
parent 47ca074d4b
commit 5205b3f44c
2 changed files with 61 additions and 21 deletions

View File

@ -137,7 +137,7 @@
" vim-instant-markdown " 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'} Plug 'instant-markdown/vim-instant-markdown', {'for': 'markdown', 'do': 'yarn install'}
" SageMath " SageMath
Plug 'petRUShka/vim-sage' Plug 'petRUShka/vim-sage'
@ -198,6 +198,8 @@ filetype plugin indent on
au BufRead,BufNewFile *.html+itjdk.ep set filetype=html.epl au BufRead,BufNewFile *.html+itjdk.ep set filetype=html.epl
au BufRead,BufNewFile *.html+stedk.ep set filetype=html.epl au BufRead,BufNewFile *.html+stedk.ep set filetype=html.epl
au BufRead,BufNewFile *.html+isbdk.ep set filetype=html.epl au BufRead,BufNewFile *.html+isbdk.ep set filetype=html.epl
au BufRead,BufNewFile *.cpp.snip set filetype=cpp
" }}} " }}}
" escape terminal on <Esc> " escape terminal on <Esc>
tnoremap <Esc> <C-\><C-n> tnoremap <Esc> <C-\><C-n>
@ -517,10 +519,10 @@ endif
" cursor location and view " cursor location and view
augroup NeomakeJumpBackHooks augroup NeomakeJumpBackHooks
au! au!
" autocmd User NeomakeJobInit nested lexpr [] | call AutoSaveWinView() | call SaveWinID() " " autocmd User NeomakeJobInit nested lexpr [] | call AutoSaveWinView() | call SaveWinID()
" autocmd User NeomakeFinished nested lwindow | call LoadWinID() | call AutoRestoreWinView() " " autocmd User NeomakeFinished nested lwindow | call LoadWinID() | call AutoRestoreWinView()
autocmd User NeomakeJobInit lexpr [] | call SaveWinID() " autocmd User NeomakeJobInit lexpr [] | call SaveWinID()
autocmd User NeomakeFinished lwindow | call LoadWinID() " autocmd User NeomakeFinished lwindow | call LoadWinID()
augroup END augroup END
" autocmd BufLeave * call AutoSaveWinView() " autocmd BufLeave * call AutoSaveWinView()
" }}} " }}}
@ -541,19 +543,20 @@ endif
" Configure for C++ " Configure for C++
let g:cpp_syntax_for_h=1 let g:cpp_syntax_for_h=1
let g:neomake_cpp_enabled_makers = ['clang'] ", 'clangtidy', 'clangcheck'] - clangtidy and/or clangcheck requires a compilation database let g:neomake_cpp_enabled_makers = ['clang', 'gcc'] ", 'clangtidy', 'clangcheck'] - clangtidy and/or clangcheck requires a compilation database
let g:neomake_clang_args = [ let g:neomake_clang_args = [
\ '-fsyntax-only', \ '-fsyntax-only',
\ '-Wall', \ '-Wall',
\ '-Wextra', \ '-Wextra',
\ '-Wfloat-equal', \ '-Wfloat-equal',
\ '-std=c++20', \ '-std=c++17',
\ '-I.', \ '-I.',
\ '-fopenmp' \ '-fopenmp'
\ ] \ ]
" Configure for Rust " Configure for Rust
let g:neomake_rust_enabled_makers = ['rustc', 'cargo'] " let g:neomake_rust_enabled_makers = ['rustc', 'cargo']
let g:neomake_rust_enabled_makers = ['cargo']
" Configure for Haskell " Configure for Haskell
let g:neomake_haskell_enabled_makers = ['hlint'] let g:neomake_haskell_enabled_makers = ['hlint']
@ -718,8 +721,13 @@ endif
" }}} " }}}
" Configure Vim-Commentary " Configure Vim-Commentary
augroup CustomCommentDefinitions
autocmd!
autocmd FileType matlab setlocal commentstring=%\ %s autocmd FileType matlab setlocal commentstring=%\ %s
autocmd FileType julia setlocal commentstring=#\ %s autocmd FileType julia setlocal commentstring=#\ %s
autocmd FileType cpp setlocal commentstring=\/\/\ %s
augroup END
" NCM2 " NCM2
augroup NCM2 augroup NCM2
@ -753,14 +761,14 @@ augroup NCM2
\ }) \ })
" C/C++ " C/C++
let g:ncm2_pyclang#library_path = 'usr/lib' " let g:ncm2_pyclang#library_path = '/usr/lib'
" goto declaration (TODO: is the ¬ on purpose???) " goto declaration (TODO: is the ¬ on purpose???)
autocmd FileType c,cpp nnoremap <buffer> gd :<c-u>call ncm2_pyclang#goto_declaration()<cr>¬ autocmd FileType c,cpp nnoremap <buffer> gd :<c-u>call ncm2_pyclang#goto_declaration()<cr>¬
augroup END augroup END
" VimTex {{ " VimTex {{
let g:tex_flavor = 'latex' let g:tex_flavor = 'latex'
let g:vimtex_syntax_conceal_default = 0 let g:vimtex_syntax_conceal_disable = 1
let g:vimtex_fold_manual = 1 let g:vimtex_fold_manual = 1
let g:vimtex_compiler_enabled = 1 " continuous compilation let g:vimtex_compiler_enabled = 1 " continuous compilation
if has('nvim') if has('nvim')
@ -817,9 +825,18 @@ augroup END
" }} " }}
" Add spell checking to LaTeX documents {{ " Add spell checking to LaTeX documents {{
augroup LaTeXSpelling let g:spellfile_URL = 'http://ftp.vim.org/vim/runtime/spell'
function! SetLanguageSpecificSpellFile()
if &spelllang =~ '^en'
setlocal spellfile+=~/.config/nvim/spell/en.utf-8.add
endif
if &spelllang =~ '^da'
setlocal spellfile+=~/.config/nvim/spell/dk.utf-8.add
endif
endfunction
augroup spelling
au! au!
au FileType tex setlocal spell spelllang=en_gb au FileType tex,markdown setlocal spell spelllang=en_gb
" As a reminder: " As a reminder:
" ]s [s jumps between spelling mistakes " ]s [s jumps between spelling mistakes
" zg adds the word to the dictionary " zg adds the word to the dictionary
@ -827,26 +844,39 @@ augroup END
" in insert mode Ctrl-X s shows the suggestions " in insert mode Ctrl-X s shows the suggestions
" We only want the 10 best suggestions - not over 50 " We only want the 10 best suggestions - not over 50
au FileType tex setlocal spellsuggest+=10 au FileType tex,markdown setlocal spellsuggest+=10
" Add a file for custom suggestions " Add a file for custom suggestions
au FileType tex setlocal spellsuggest+=file:~/.config/nvim/spell/suggestions au FileType tex,markdown setlocal spellsuggest+=file:~/.config/nvim/spell/suggestions
" Add the default spelling file " Add the default spelling file
au FileType tex setlocal spellfile+=~/.config/nvim/spell/en.utf-8.add au FileType tex,markdown execute SetLanguageSpecificSpellFile()
" au FileType tex,markdown setlocal spellfile+=~/.config/nvim/spell/en.utf-8.add
" zg or 1zg adds a word to the dictionary " zg or 1zg adds a word to the dictionary
" Add a file specific wordlist for one-off words that shouldn't be part of " Add a file specific wordlist for one-off words that shouldn't be part of
" the dictionary " the dictionary
au FileType tex setlocal spellfile+=oneoff.utf-8.add au FileType tex,markdown setlocal spellfile+=oneoff.utf-8.add
" 2zg adds a word to the dictionary " 2zg adds a word to the dictionary
" Add a LaTeX specific wordlist for e.g. chktex " Add a LaTeX specific wordlist for e.g. chktex
au FileType tex setlocal spellfile+=~/.config/nvim/spell/LaTeX.utf-8.add au FileType tex setlocal spellfile+=~/.config/nvim/spell/LaTeX.utf-8.add
" 3zg adds a word to the dictionary " 3zg adds a word to the dictionary
" Add a Markdown specific wordlist
au FileType markdown setlocal spellfile+=~/.config/nvim/spell/Markdown.utf-8.add
" 3zg adds a word to the dictionary
augroup END augroup END
" }} " }}
" Add 80 character line limit {{
augroup textwrapping
au!
au FileType tex,markdown setlocal textwidth=80
augroup END
set colorcolumn=82
" }}
" Change window directory to the same as the open buffer " Change window directory to the same as the open buffer
command! LCDCurrDir lcd %:p:h command! LCDCurrDir lcd %:p:h
@ -909,10 +939,12 @@ nnoremap <Space> :nohl<CR>
function! InsertSnip(snip_name) function! InsertSnip(snip_name)
" Find the template " Find the template
if a:snip_name =~ '^JIX/' echo a:snip_name
let l:fname = stdpath('config') . '/snippets/' . a:snip_name . '.pm' if a:snip_name =~ '^/' || a:snip_name =~ '^\~/'
let l:fname = a:snip_name
echo l:fname
else else
let l:fname = stdpath('config') . '/snippets/' . a:snip_name . '.snip' let l:fname = stdpath('config') . '/snippets/' . a:snip_name . '.*'
endif endif
execute "r ". l:fname execute "r ". l:fname
@ -928,7 +960,12 @@ function! InsertSnip(snip_name)
endif endif
endfunction endfunction
function! FzySnip()
call picker#File('find -type f -name "*.snip"', 'R', {'cwd': stdpath('config') . '/snippets'})
endfunction
command! -nargs=1 R call InsertSnip(<f-args>) command! -nargs=1 R call InsertSnip(<f-args>)
command! -nargs=0 RR call FzySnip()
function! GenerateMarkdownHeaderAnchors() function! GenerateMarkdownHeaderAnchors()
let l:winview = winsaveview() " save cursor position let l:winview = winsaveview() " save cursor position

3
install_configfiles.sh Normal file
View File

@ -0,0 +1,3 @@
#!/bin/bash
mkdir -p ~/.config/nvim;
ln -s ~/Nextcloud/configfiles/vim/vimrc/init.vim ~/.config/nvim/init.vim;