1
0
Fork 0
nixos-config/home-manager/roles/neovim/vimrc
2022-01-30 12:05:50 +01:00

237 lines
6 KiB
VimL
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

set spell spelllang=de,en
let g:airline_powerline_fonts = 1
let g:airline_skip_empty_sections = 1
let g:airline#extensions#tabline#enabled = 1
let g:airline#extensions#nvimlsp#enabled = 0
let g:tex_flavor = 'latex'
function! MyExplorer()
if &filetype == 'coc-explorer'
wincmd w
else
CocCommand explorer --no-toggle
endif
endfunction
no <space>e :call MyExplorer()<CR>
no <space>v :Vista coc<CR>
set nofoldenable
set background=light
set autoindent
set nosmartindent
set listchars=tab:»\ ,trail:.,extends:#
set list
set ts=3
set number
set scrolloff=5
set sidescrolloff=5
set laststatus=2
set incsearch
set mouse=
set showcmd
set title
" Set this here so that nothing gets overriden later
filetype plugin indent on
syntax on
set undodir=~/.vimhist/
set undofile
set undolevels=100
set undoreload=1000
augroup focus
au!
au TabLeave * silent! wall
au FocusLost * silent! wall
au BufLeave * silent! wall
augroup END
no <silent><cr> :nohlsearch<CR>
vno < <gv
vno > >gv
no <c-down> <c-w><c-j>
no <c-up> <c-w><c-k>
no <c-right> <c-w><c-l>
no <c-left> <c-w><c-h>
let mapleader=","
set winaltkeys=no
set noai
set cursorline
set cursorcolumn
set si
set expandtab
set sw=3
set pt=<F4>
set ignorecase
set wildmenu
set hlsearch
no <buffer> <silent> <Up> gk
no <buffer> <silent> <Down> gj
no <buffer> <silent> <Home> g<Home>
no <buffer> <silent> <End> g<End>
let $NVIM_TUI_ENABLE_CURSOR_SHAPE=1
let g:haskell_enable_quantification = 1 " to enable highlighting of `forall`
let g:haskell_enable_recursivedo = 1 " to enable highlighting of `mdo` and `rec`
let g:haskell_enable_arrowsyntax = 1 " to enable highlighting of `proc`
let g:haskell_enable_pattern_synonyms = 1 " to enable highlighting of `pattern`
let g:haskell_enable_typeroles = 1 " to enable highlighting of type roles
let g:haskell_enable_static_pointers = 1 " to enable highlighting of `static`
let g:haskell_backpack = 1 " to enable highlighting of backpack keywords
let g:formatdef_my_cabal = '"cabal-fmt"'
let g:formatters_cabal = ['my_cabal']
let g:formatdef_my_nix = '"nixfmt"'
let g:formatters_nix = ['my_nix']
let g:formatdef_my_dhall = '"dhall format"'
let g:formatters_dhall = ['my_dhall']
let g:autoformat_autoindent = 0
let g:autoformat_retab = 0
let g:languagetool_server_command = "languagetool-http-server"
colorscheme PaperColor
highlight CursorColumn ctermbg=8
highlight CursorLine ctermbg=8
" if hidden is not set, TextEdit might fail.
set hidden
" Some servers have issues with backup files, see #649
set nobackup
set nowritebackup
" You will have bad experience for diagnostic messages when it's default 4000.
set updatetime=300
" don't give |ins-completion-menu| messages.
set shortmess+=c
" always show signcolumns
set signcolumn=yes
" Use tab for trigger completion with characters ahead and navigate.
" Use command ':verbose imap <tab>' to make sure tab is not mapped by other plugin.
ino <silent><expr> <TAB>
\ pumvisible() ? "\<C-n>" :
\ <SID>check_back_space() ? "\<TAB>" :
\ coc#refresh()
ino <expr><S-TAB> pumvisible() ? "\<C-p>" : "\<C-h>"
function! s:check_back_space() abort
let col = col('.') - 1
return !col || getline('.')[col - 1] =~# '\s'
endfunction
" Use <c-space> to trigger completion.
ino <silent><expr> <c-space> coc#refresh()
" Use <cr> to confirm completion, `<C-g>u` means break undo chain at current position.
" Coc only does snippet and additional edit on confirm.
ino <expr> <cr> pumvisible() ? "\<C-y>" : "\<C-g>u\<CR>"
no <silent> gp :call CocAction('diagnosticPrevious')<cr>
no <silent> gn :call CocAction('diagnosticNext')<cr>
" Remap keys for gotos
no <silent> gd :call CocAction('jumpDefinition')<cr>
no <silent> gt :call CocAction('jumpTypeDefinition')<cr>
no <silent> gr :call CocAction('jumpReferences')<cr>
no <silent> gs :Git status<CR>
no <silent> gu :CocCommand git.chunkUndo<CR>
no <silent> gi :CocCommand git.chunkInfo<CR>
no <silent> ga :CocCommand git.chunkStage<CR>
no <silent> gb :CocCommand git.showCommit<CR>
no <silent> gc :Git commit<CR>
function! s:show_documentation()
if (index(['vim','help'], &filetype) >= 0)
elseif (coc#rpc#ready())
call CocActionAsync('definitionHover')
else
execute '!' . &keywordprg . " " . expand('<cword>')
endif
endfunction
no <silent> <space>i :call <SID>show_documentation()<CR>
augroup mygroup
autocmd!
" Setup formatexpr specified filetype(s).
autocmd FileType typescript,json setl formatexpr=CocAction('formatSelected')
" Update signature help on jump placeholder
autocmd User CocJumpPlaceholder call CocActionAsync('showSignatureHelp')
augroup end
no <silent> <space>f :call CocAction('format')<cr>
no <silent> <space>l :call CocAction('codeLensAction')<cr>
" FZF ctrl-p style search
no <space>p :Files<CR>
no <space>g :Rg<CR>
no <space>h :History<CR>
no <space>b :Buffers<CR>
function MyClose()
if &readonly
quit
else
write
quit
endif
endfunction
function MyCloseAll()
if &readonly
quitall
else
wall
quitall
endif
endfunction
no <space>q :call MyClose()<CR>
no <space>k :call MyCloseAll()<CR>
no <space>s :w<CR>
no <a-left> :bp<CR>
no <a-right> :bn<CR>
ino <a-left> <ESC>:bp<CR>
ino <a-right> <ESC>:bn<CR>
" Use <tab> for select selections ranges, needs server support, like: coc-tsserver, coc-python
no <silent> <TAB> <Plug>(coc-range-select)
xno <silent> <TAB> <Plug>(coc-range-select)
xno <silent> <S-TAB> <Plug>(coc-range-select-backword)
" Use `:Fold` to fold current buffer
command! -nargs=? Fold :call CocAction('fold', <f-args>)
" use `:OR` for organize import of current buffer
command! -nargs=0 OR :call CocAction('runCommand', 'editor.action.organizeImport')
ino <ESC>[1~ <HOME>
ino <ESC>[4~ <End>
" Using CocList
" Show all diagnostics
no <silent> <space>d :<C-u>CocFzfList diagnostics<cr>
" Show commands
no <silent> <space>c :<C-u>CocFzfList commands<cr>
" Find symbol of current document
no <silent> <space>o :Vista finder coc<cr>
" Find symbol of current document
no <silent> <space>a :<C-u>CocAction<cr>
ino <Enter> <CR>
" Load this after theme
hi Normal ctermbg=NONE