Commit ca1ca3ac authored by Tim van Deurzen's avatar Tim van Deurzen

Initial commit. Includes working, vimlang based neovim settings.

parents
[neovim.files.neovim]
target = "~/.config/nvim/"
type = "symbolic"
.dotter/local.toml
.dotter/cache
.dotter/cache.toml
" vimrc {{{
augroup vimrc
au BufReadPre * setlocal foldmethod=syntax
au BufWinEnter * if &fdm == 'syntax' | setlocal foldmethod=marker | endif
augroup END
" }}}
{
"languageserver": {
"dummy_golang": {
"command": "bingo",
"args": ["--diagnostics-style=instant"],
"rootPatterns": ["go.mod", ".vim/", ".git/", ".hg/"],
"filetypes": ["dummy_go"]
},
"golang": {
"command": "gopls",
"rootPatterns": ["go.mod", ".git/"],
"filetypes": ["go"],
"initializationOptions": {
"usePlaceholders": true
}
},
"ccls": {
"command": "ccls",
"filetypes": ["c", "cpp", "objc", "objcpp"],
"rootPatterns": [".ccls", "compile_commands.json", ".vim/", ".git/", ".hg/"],
"initializationOptions": {
"cache": {
"directory": "/tmp/ccls",
"highlight": { "lsRanges" : true }
},
"clang": {
"resourceDir": "/usr/lib/clang/9.0.1/"
}
}
}
}
}
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" NeoVim Config
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" Package Management {{{
if &compatible
set nocompatible
endif
set runtimepath+=/home/tim/.local/share/dein//repos/github.com/Shougo/dein.vim
" Required:
if dein#load_state('/home/tim/.local/share/dein/')
call dein#begin('/home/tim/.local/share/dein/')
" UI
call dein#add('morhetz/gruvbox')
call dein#add('mkarmona/colorsbox')
call dein#add('vim-airline/vim-airline')
call dein#add('ntpeters/vim-better-whitespace')
call dein#add('ryanoasis/vim-devicons')
call dein#add('Yggdroot/indentLine')
call dein#add('haya14busa/incsearch.vim')
call dein#add('icymind/NeoSolarized')
call dein#add('Shougo/echodoc.vim')
call dein#add('junegunn/fzf.vim')
call dein#add('zanglg/nova.vim')
call dein#add('vim-scripts/Fruidle')
call dein#add('nightsense/vimspectr')
call dein#add('romgrk/doom-one.vim')
call dein#add('mbbill/undotree')
"Plug 'ervandew/supertab'
" Completion
call dein#add('neoclide/coc.nvim', {'merge':0, 'build': 'yarn install --frozen-lockfile'})
" Language Support
call dein#add('Marwes/rust.vim', {'on_ft': 'rust'})
call dein#add('octol/vim-cpp-enhanced-highlight', {'on_ft': 'cpp'})
call dein#add('tsandall/vim-rego')
call dein#add('tomlion/vim-solidity')
call dein#add('dart-lang/dart-vim-plugin')
" VimLang
call dein#add('Shougo/neco-vim', {'on_ft': 'vim'})
call dein#add('ujihisa/neco-look', {'on_ft': 'vim'})
call dein#add('Shougo/neco-syntax', {'on_ft': 'vim'})
" Utilities
call dein#add('majutsushi/tagbar')
call dein#add('liuchengxu/vista.vim')
call dein#add('tpope/vim-fugitive')
call dein#add('Raimondi/delimitMate')
call dein#add('tpope/vim-commentary')
call dein#add('scrooloose/nerdtree')
call dein#add('Xuyuanp/nerdtree-git-plugin')
call dein#add('Chiel92/vim-autoformat')
call dein#add('Shougo/unite.vim')
call dein#add('Shougo/Denite.nvim')
call dein#add('Shougo/vimproc.vim', {'do' : 'make'})
call dein#add('editorconfig/editorconfig-vim')
call dein#add('direnv/direnv.vim')
call dein#add('lambdalisue/gina.vim', {'on_cmd': 'Gita'})
call dein#end()
call dein#save_state()
endif
if dein#check_install()
call dein#install()
endif
filetype plugin indent on
" }}}
" General {{{
set hidden
set fileformats=unix,mac,dos
set modeline
set modelines=5
set whichwrap+=<,>,h,l
set mouse=a
" When joining lines, join the spaces too
set joinspaces
" Search options
set incsearch
set hlsearch
set ignorecase
set smartcase
let g:python_host_prog="/usr/bin/python2"
let g:python3_host_prog="/usr/bin/python3"
" }}}
" History {{{
set history=1000
set undofile
set undodir=$HOME/.config/nvim/undo
set undolevels=1000
" }}}
" Formatting {{{
set comments=s1:/*,mb:*,ex:*/,://,b:#,:%,s1:{-,mb:-,ex:-},:--
set formatoptions=qroctn
" }}}
" Indentation {{{
set shiftwidth=4
set tabstop=4
set shiftround
set expandtab
set autoindent
set copyindent
set smarttab
set softtabstop=4
" }}}
" Folding {{{
"autocmd InsertEnter * if !exists('w:last_fdm') | let w:last_fdm=&foldmethod | setlocal foldmethod=manual | endif
"autocmd InsertLeave,WinLeave * if exists('w:last_fdm') | let &l:foldmethod=w:last_fdm | unlet w:last_fdm | endif
set foldmethod=syntax
set foldlevel=0
" }}}
" Includes {{{
source $HOME/.config/nvim/keyboard.vimrc
source $HOME/.config/nvim/ui.vimrc
source $HOME/.config/nvim/plugin-config.vimrc
source $HOME/.config/nvim/autogroups.vimrc
" }}}
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" Keyboard Settings
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
let mapleader="\<space>"
set backspace=indent,eol,start
set winaltkeys=no
" Make the keyboard layout appear as QWERTY though set-up as Colemak
set langmap=rs,RS,gt,GT,fe,FE,pr,PR,jy,JY,lu,LU,ui,UI,yo,YO,sd,SD,dg,DG,nj,NJ,ek,EK,il,IL,kn,KN,o\\;,O\:,\\;p
set langnoremap
map gr :tabp<cr>
" Disable EX mode.
nnoremap Q <nop>
" Plugin specific keyboard settings {{{
nmap <F8> :TagbarToggle<CR>
map / <Plug>(incsearch-forward)
map ? <Plug>(incsearch-backward)
map g/ <Plug>(incsearch-stay)
" }}}
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
""" Plugin configuration
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" Vim-Airline {{{
let g:airline_powerline_fonts=0
let g:airline#extensions#ale#enabled = 1
let g:airline#extensions#ycm#enabled = 0
let g:airline_section_error = '%{airline#util#wrap(airline#extensions#coc#get_error(),0)}'
let g:airline_section_warning = '%{airline#util#wrap(airline#extensions#coc#get_warning(),0)}'
" }}}
" Tagbar {{{
let g:tagbar_type_php={
\ 'kinds' : [
\ 'i:interfaces',
\ 'c:classes',
\ 'd:constant definitions:0:0',
\ 'f:functions',
\ 'j:javascript functions',
\ ],
\ }
" }}}
" deoplete {{{
" let g:deoplete#enable_at_startup = 1
" let g:deoplete#enable_refresh_always = 1
" let g:deoplete#auto_complete_delay = 10
" }}}
" vim-go {{{
" let g:go_highlight_build_constraints = 1
" let g:go_highlight_extra_types = 1
" let g:go_highlight_fields = 1
" let g:go_highlight_functions = 1
" let g:go_highlight_methods = 1
" let g:go_highlight_operators = 1
" let g:go_highlight_structs = 1
" let g:go_highlight_types = 1
"
" let g:go_auto_sameids = 1
" let g:go_fmt_command = "gofmt"
" let g:go_auto_type_info = 1
" au FileType go nmap <F3> <Plug>(go-def)
" }}}
" deoplete-go {{{
let g:deoplete#enable_at_startup = 1
let g:deoplete#sources#go#gocode_binary = '/home/tim/src/golang/bin/gocode'
" }}}
" AG {{{
let g:ackprg = 'ag --nogroup --nocolor --column'
" }}}
" Ale {{{
" call ale#linter#Define('go', {
" \ 'name': 'revive',
" \ 'output_stream': 'both',
" \ 'executable': 'revive',
" \ 'read_buffer': 0,
" \ 'command': 'revive %t',
" \ 'callback': 'ale#handlers#unix#HandleAsWarning',
" \})
"
" let g:ale_linters = {'go': ['gometalinter', 'gofmt', 'revive']}
" }}}
" languageClient {{{
" let g:LanguageClient_serverCommands = {
" \ 'cpp': ['clangd', '-index', '-j=2'],
" \ 'python': ['pyls'],
" \ 'rust': ['rls'],
\ }
" let g:LanguageClient_serverCommands = {
" \ 'cpp': ['ccls', '--log-file=/tmp/ccls.log', '-threads=1', '-v=2'],
" \ 'cpp': ['cquery', '--language-server', '--log-stdin-stdout-to-stderr', '--log-file=/tmp/cquery.log'],
" \ 'rust': ['rls'],
" \ 'scala': ['~/.local/bin/scalameta_lsp']
" \ }
"
" let g:LanguageClient_autoStart = 1
" let g:LanguageClient_loadSettings = 1
" let g:LanguageClient_settingsPath = "/home/tim/.config/nvim/settings.ccls.json"
" let g:LanguageClient_loggingFile = "/tmp/languageclient"
" let g:LanguageClient_loggingLevel = 'INFO'
"
" let g:LanguageClient_changeThrottle = 2.0
" let g:LanguageClient_selectionUI = "fzf"
" nnoremap <silent> K :call LanguageClient_textDocument_hover()<CR>
" nnoremap <silent> <F2> :call LanguageClient_textDocument_definition({'gotoCmd': 'split'})<CR>
" nnoremap <silent> <F3> :call LanguageClient_textDocument_references({'gotoCmd': 'split'})<CR>
" nnoremap <silent> <F4> :call LanguageClient_textDocument_rename()<CR>
" nnoremap <F5> :call LanguageClient_contextMenu()<CR>
"
" augroup LanguageClient_config
" au!
" au BufEnter * let b:Plugin_LanguageClient_started = 0
" au User LanguageClientStarted setl signcolumn=yes
" au User LanguageClientStarted let b:Plugin_LanguageClient_started = 1
" au User LanguageClientStopped setl signcolumn=auto
" au User LanguageClientStopped let b:Plugin_LanguageClient_stopped = 0
" au CursorMoved * if b:Plugin_LanguageClient_started | sil call LanguageClient#textDocument_documentHighlight() | endif
" augroup END
" }}}
" vim-lsp {{{
"if executable('ccls')
" au User lsp_setup call lsp#register_server({
" \ 'name': 'ccls',
" \ 'cmd': {server_info->['ccls']},
" \ 'root_uri': {server_info->lsp#utils#path_to_uri(lsp#utils#find_nearest_parent_file_directory(lsp#utils#get_buffer_path(), 'compile_commands.json'))},
" \ 'initialization_options': { 'cacheDirectory': '.ccls-cache' },
" \ 'whitelist': ['c', 'cpp', 'objc', 'objcpp', 'cc'],
" \ })
"endif
" Clangd
" if executable('clangd')
" augroup lsp_clangd
" autocmd!
" autocmd User lsp_setup call lsp#register_server({
" \ 'name': 'clangd',
" \ 'cmd': {server_info->['clangd']},
" \ 'whitelist': ['c', 'cpp', 'objc', 'objcpp'],
" \ })
" autocmd FileType c setlocal omnifunc=lsp#complete
" autocmd FileType cpp setlocal omnifunc=lsp#complete
" autocmd FileType objc setlocal omnifunc=lsp#complete
" autocmd FileType objcpp setlocal omnifunc=lsp#complete
" augroup end
" endif
"if executable('rls')
" au User lsp_setup call lsp#register_server({
" \ 'name': 'rls',
" \ 'cmd': {server_info->['rustup', 'run', 'nightly', 'rls']},
" \ 'whitelist': ['rust'],
" \ })
"endif
"
"if executable('docker-langserver')
" au User lsp_setup call lsp#register_server({
" \ 'name': 'docker-langserver',
" \ 'cmd': {server_info->[&shell, &shellcmdflag, 'docker-langserver --stdio']},
" \ 'whitelist': ['dockerfile'],
" \ })
"endif
"
"au User asyncomplete_setup call asyncomplete#register_source(asyncomplete#sources#file#get_source_options({
" \ 'name': 'file',
" \ 'whitelist': ['*'],
" \ 'priority': 10,
" \ 'completor': function('asyncomplete#sources#file#completor')
" \ }))
"
"
"call asyncomplete#register_source(asyncomplete#sources#gocode#get_source_options({
" \ 'name': 'gocode',
" \ 'whitelist': ['go'],
" \ 'completor': function('asyncomplete#sources#gocode#completor'),
" \ 'config': {
" \ 'gocode_path': expand('~/go/bin/gocode')
" \ },
" \ }))
" }}}
" asyncomplete {{{
" let g:asyncomplete_remove_duplicates = 1
" let g:asyncomplete_smart_completion = 1
" " let g:asyncomplete_auto_popup = 0
"
" inoremap <expr> <Tab> pumvisible() ? "\<C-n>" : "\<Tab>"
" inoremap <expr> <S-Tab> pumvisible() ? "\<C-p>" : "\<S-Tab>"
" inoremap <expr> <cr> pumvisible() ? "\<C-y>" : "\<cr>"
"
" imap <c-space> <Plug>(asyncomplete_force_refresh)
"
" function! s:check_back_space() abort
" let col = col('.') - 1
" return !col || getline('.')[col - 1] =~ '\s'
" endfunction
"
" inoremap <silent><expr> <TAB>
" \ pumvisible() ? "\<C-n>" :
" \ <SID>check_back_space() ? "\<TAB>" :
" \ asyncomplete#force_refresh()
" inoremap <expr><S-TAB> pumvisible() ? "\<C-p>" : "\<C-h>"
" }}}
" IndentLine {{{
let g:indentLine_char = '┊'
" }}}
" NERDTree {{{
" Deals with Colemak incompatility.
let g:NERDTreeMapOpenExpl = "E"
" }}}
" Rust.vim {{{
let g:rustfmt_autosave = 1
" }}}
" EchoDoc {{{
let g:echodoc#enable_at_startup = 1
" }}}
" Ale {{{
" let g:ale_fixers = {
" \ '*': ['remove_trailing_lines', 'trim_whitespace']
" \}
" let g:ale_linters = {
" \ 'cpp': ['clangd']
" \}
"let g:ale_fix_on_save = 1
let g:ale_linters_explicit = 1
let g:ale_completion_enabled = 0
" }}}
" CoC {{{
" 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.
inoremap <silent><expr> <TAB>
\ pumvisible() ? "\<C-n>" :
\ <SID>check_back_space() ? "\<TAB>" :
\ coc#refresh()
inoremap <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
inoremap <silent><expr> <c-space> coc#refresh()
inoremap <expr> <cr> pumvisible() ? "\<C-y>" : "\<C-g>u\<CR>"
nmap <silent> <F2> <Plug>(coc-definition)
nmap <silent> <F3> <Plug>(coc-implementation)
nmap <silent> <F4> <Plug>(coc-type-definition)
nmap <silent> <F5> <Plug>(coc-references)
nnoremap <silent> K :call <SID>show_documentation()<CR>
function! s:show_documentation()
if &filetype == 'vim'
execute 'h '.expand('<cword>')
else
call CocAction('doHover')
endif
endfunction
autocmd CursorHold * silent call CocActionAsync('highlight')
" Remap for rename current word
nmap <silent> <F1> <Plug>(coc-rename)
command! -nargs=? Fold :call CocAction('fold', <f-args>)
" Using CocList
" Show all diagnostics
nnoremap <silent> <F12> :<C-u>CocList diagnostics<cr>
" Manage extensions
"nnoremap <silent> <leader>e :<C-u>CocList extensions<cr>
" Show commands
"nnoremap <silent> <leader>c :<C-u>CocList commands<cr>
" Find symbol of current document
nnoremap <silent> <F9> :<C-u>CocList outline<cr>
" Search workleader symbols
nnoremap <silent> <F10> :<C-u>CocList -I symbols<cr>
" Do default action for next item.
"nnoremap <silent> <leader>j :<C-u>CocNext<CR>
" Do default action for previous item.
"nnoremap <silent> <leader>k :<C-u>CocPrev<CR>
" Resume latest coc list
"nnoremap <silent> <leader>p :<C-u>CocListResume<CR>
" }}}
{
"initializationOptions": {
"cacheDirectory": ".ccls-cache",
"index.comments": 1,
"clang": {
"resourceDir": "/usr/lib/clang/9.0.0"
}
}
}
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
""" UI configuration
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
syntax on
set fillchars=vert:│
" Truecolor support in the terminal
set termguicolors
set background=dark
let g:gruvbox_contrast_dark="hard"
colorscheme gruvbox
"colorscheme nova
set ttyfast
set lazyredraw
set listchars=tab:>-
set nolist
set showcmd
set number
set relativenumber
set cursorline
set nowrap
set ruler
set rulerformat=%l/%L:%c
set textwidth=79
set equalalways
set splitbelow
set splitright
set wildmenu
set wildignore=*.o,*.class,*.hi,*.pdf,*.git,*.blg,*.bbl,*.aux,*.gcno,*.gcda
set shortmess+=c
set noshowmode
set laststatus=2
set scrolloff=7
set cmdheight=2
set tabpagemax=100
" Ensure better behaviour within tmux and for neovim.
set timeout
set timeoutlen=0
set ttimeout
set ttimeoutlen=0
set completeopt=menuone
set completeopt-=preview
" Git from Unite {{{
let g:unite_source_menu_menus = {} " Useful when building interfaces at appropriate places
let g:unite_source_menu_menus.git = {
\ 'description' : 'Fugitive interface',
\}
let g:unite_source_menu_menus.git.command_candidates = [
\[' git status', 'Gstatus'],
\[' git diff', 'Gvdiff'],
\[' git commit', 'Gcommit'],
\[' git stage/add', 'Gwrite'],
\[' git checkout', 'Gread'],
\[' git rm', 'Gremove'],
\[' git cd', 'Gcd'],
\[' git push', 'exe "Git! push " input("remote/branch: ")'],
\[' git pull', 'exe "Git! pull " input("remote/branch: ")'],
\[' git pull rebase', 'exe "Git! pull --rebase " input("branch: ")'],
\[' git checkout branch', 'exe "Git! checkout " input("branch: ")'],
\[' git fetch', 'Gfetch'],
\[' git merge', 'Gmerge'],
\[' git browse', 'Gbrowse'],
\[' git head', 'Gedit HEAD^'],
\[' git parent', 'edit %:h'],
\[' git log commit buffers', 'Glog --'],
\[' git log current file', 'Glog -- %'],
\[' git log last n commits', 'exe "Glog -" input("num: ")'],
\[' git log first n commits', 'exe "Glog --reverse -" input("num: ")'],
\[' git log until date', 'exe "Glog --until=" input("day: ")'],
\[' git log grep commits', 'exe "Glog --grep= " input("string: ")'],
\[' git log pickaxe', 'exe "Glog -S" input("string: ")'],
\[' git index', 'exe "Gedit " input("branchname\:filename: ")'],
\[' git mv', 'exe "Gmove " input("destination: ")'],
\[' git grep', 'exe "Ggrep " input("string: ")'],
\[' git prompt', 'exe "Git! " input("command: ")'],
\] " Append ' --' after log to get commit info commit buffers
"}}}
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment