2020-06-26 12:19:50 +00:00
|
|
|
syntax on
|
|
|
|
filetype plugin indent on
|
|
|
|
|
2020-12-29 07:02:41 +00:00
|
|
|
let mapleader=","
|
|
|
|
|
2021-01-06 13:34:33 +00:00
|
|
|
" netrw
|
2020-12-29 07:02:41 +00:00
|
|
|
let g:netrw_banner = 0
|
2020-12-31 19:42:18 +00:00
|
|
|
let g:netrw_liststyle = 1
|
|
|
|
let g:netrw_list_hide = '^\.'
|
2021-01-06 13:34:33 +00:00
|
|
|
let g:netrw_winsize=25
|
|
|
|
map <leader>n <esc>:Lexplore<cr>
|
2020-06-26 12:19:50 +00:00
|
|
|
|
|
|
|
set shiftwidth=2
|
|
|
|
set shiftround
|
|
|
|
set tabstop=2
|
|
|
|
set expandtab
|
|
|
|
set smarttab
|
|
|
|
set encoding=utf-8
|
|
|
|
set nocompatible
|
|
|
|
set t_Co=256
|
|
|
|
set hidden
|
2021-01-06 13:34:33 +00:00
|
|
|
set history=1000
|
2020-06-26 12:19:50 +00:00
|
|
|
set nowrap
|
|
|
|
set smartindent
|
|
|
|
set copyindent
|
|
|
|
set autoindent
|
|
|
|
set hlsearch
|
|
|
|
set showmatch
|
|
|
|
set wildignore+=*.log,*.sql,*.cache
|
2020-12-18 12:49:36 +00:00
|
|
|
set wildmode=longest,list,full
|
|
|
|
set wildmenu
|
2020-06-26 12:19:50 +00:00
|
|
|
set number
|
2020-12-31 19:42:18 +00:00
|
|
|
set norelativenumber
|
2020-06-26 12:19:50 +00:00
|
|
|
set ruler
|
|
|
|
set backspace=indent,eol,start
|
|
|
|
set ignorecase
|
|
|
|
set smartcase
|
|
|
|
set incsearch
|
|
|
|
set history=1000
|
|
|
|
set undolevels=1000
|
|
|
|
set title
|
|
|
|
set novisualbell
|
|
|
|
set noerrorbells
|
|
|
|
set nobackup
|
|
|
|
set noswapfile
|
|
|
|
set clipboard=unnamed
|
2020-12-29 07:02:41 +00:00
|
|
|
set ttymouse=sgr
|
2020-06-26 12:19:50 +00:00
|
|
|
set mouse=a
|
2020-12-29 07:02:41 +00:00
|
|
|
set mousemodel=popup_setpos
|
2020-06-26 12:19:50 +00:00
|
|
|
set lazyredraw
|
2020-12-29 07:02:41 +00:00
|
|
|
set completeopt=menu,menuone,popup,noselect,noinsert
|
|
|
|
set timeoutlen=600
|
|
|
|
set ballooneval
|
|
|
|
set balloonevalterm
|
|
|
|
set scrolloff=5
|
2021-01-06 13:34:33 +00:00
|
|
|
set dict=/usr/share/dict/words
|
|
|
|
set shortmess+=I
|
|
|
|
" See :help thesaurus
|
|
|
|
set thesaurus=$HOME/Documents/thesaurus/thesaurus_pkg/thesaurus.txt
|
2020-06-26 12:19:50 +00:00
|
|
|
|
|
|
|
" Colour scheme:
|
2021-01-06 13:34:33 +00:00
|
|
|
colorscheme iceberg
|
2020-12-18 08:00:19 +00:00
|
|
|
set background=dark
|
2020-06-26 12:19:50 +00:00
|
|
|
|
|
|
|
" Key mappings:
|
|
|
|
nnoremap j gj
|
|
|
|
nnoremap k gk
|
|
|
|
nmap <silent> ,/ :nohlsearch<CR>
|
|
|
|
map <up> <nop>
|
|
|
|
map <down> <nop>
|
|
|
|
map <left> <nop>
|
|
|
|
map <right> <nop>
|
2020-12-31 08:32:56 +00:00
|
|
|
map <c-t> <esc>:tabnew<cr>
|
2020-06-26 12:19:50 +00:00
|
|
|
" Select just-pasted text:
|
2021-01-06 13:34:33 +00:00
|
|
|
nnoremap <Leader>0 `[v`]
|
2020-06-26 12:19:50 +00:00
|
|
|
nnoremap Q @@
|
2021-01-06 13:34:33 +00:00
|
|
|
map <silent> <leader>p <esc>:set paste<cr>a
|
|
|
|
map <silent> <leader>P <esc>:set nopaste<cr>
|
|
|
|
|
|
|
|
|
|
|
|
function! ToggleQuickFix()
|
|
|
|
if empty(filter(getwininfo(), 'v:val.quickfix'))
|
|
|
|
copen
|
|
|
|
else
|
|
|
|
cclose
|
|
|
|
endif
|
|
|
|
endfunction
|
|
|
|
map <silent> <leader>q <esc>:call ToggleQuickFix()<cr>
|
2020-06-26 12:19:50 +00:00
|
|
|
|
2020-12-30 08:47:55 +00:00
|
|
|
" vim-markdown configuration:
|
|
|
|
let g:vim_markdown_conceal = 3
|
2020-06-26 12:19:50 +00:00
|
|
|
|
|
|
|
" Command-T configuration:
|
2021-01-06 13:34:33 +00:00
|
|
|
let switchbuf="usetab"
|
2020-12-30 08:47:55 +00:00
|
|
|
map <leader>T :CommandTFlush<CR>
|
2021-01-06 13:34:33 +00:00
|
|
|
map <Leader>r :CommandTMRU<CR>
|
|
|
|
map <Leader>H :CommandTHelp<CR>
|
|
|
|
map <Leader>c :CommandTCommand<CR>
|
|
|
|
map <leader>m :marks<cr>
|
|
|
|
map <leader>R :registers<cr>
|
|
|
|
map <leader>v :vsplit<cr>
|
|
|
|
map <leader>h :split<cr>file browser
|
|
|
|
map <leader>! <esc>:only<cr>
|
2020-06-26 12:19:50 +00:00
|
|
|
let g:CommandTFileScanner="git"
|
|
|
|
let g:CommandTGitScanSubmodules=1
|
|
|
|
let g:CommandTGitIncludeUntracked=1
|
|
|
|
let g:CommandTMatchWindowAtTop=0
|
2021-01-06 13:34:33 +00:00
|
|
|
let g:CommandTMaxHeight=20
|
|
|
|
" See :h command-t-faq
|
|
|
|
if &term =~ "xterm" || &term =~ "screen"
|
|
|
|
let g:CommandTCancelMap = ['<ESC>', '<C-c>']
|
|
|
|
end
|
2020-06-26 12:19:50 +00:00
|
|
|
|
|
|
|
" Lightline configuration:
|
|
|
|
set laststatus=2
|
|
|
|
|
2020-12-18 08:00:19 +00:00
|
|
|
" Vim-Go configuration:
|
|
|
|
let g:go_fmt_autosave = 0
|
2020-12-18 12:49:36 +00:00
|
|
|
" Vim-Go seems to handle fix-on-save better than ALE:
|
|
|
|
let g:go_imports_autosave = 1
|
|
|
|
let g:go_fmt_options = {
|
|
|
|
\ 'goimports': '-local github.com/sensiblecode.com/cantabular',
|
|
|
|
\ }
|
2020-10-19 07:18:09 +00:00
|
|
|
autocmd BufNewFile,BufRead *.gohtml set syntax=gohtmltmpl
|
2020-12-18 08:46:30 +00:00
|
|
|
" https://github.com/golang/tools/blob/master/gopls/doc/vim.md#vim-go
|
|
|
|
let g:go_def_mode='gopls'
|
|
|
|
let g:go_info_mode='gopls'
|
2020-07-12 16:01:02 +00:00
|
|
|
|
2020-12-18 08:00:19 +00:00
|
|
|
" Vim-Rust configuration:
|
2020-12-29 07:02:41 +00:00
|
|
|
let g:rustfmt_autosave = 1
|
2020-12-18 08:00:19 +00:00
|
|
|
|
|
|
|
" ALE configuration:
|
2020-12-29 07:02:41 +00:00
|
|
|
set omnifunc=ale#completion#OmniFunc
|
|
|
|
function SymbolSearch()
|
|
|
|
call inputsave()
|
|
|
|
let s:pattern = trim(input("symbol search: "))
|
|
|
|
call inputrestore()
|
|
|
|
if len(s:pattern) > 0
|
|
|
|
execute 'ALESymbolSearch' s:pattern
|
|
|
|
endif
|
|
|
|
endfunction
|
|
|
|
nmap <silent> <leader>af :ALEFirst<cr>
|
|
|
|
nmap <silent> <leader>al :ALELast<cr>
|
|
|
|
nmap <silent> <leader>an :ALENextWrap<cr>
|
|
|
|
nmap <silent> <leader>ap :ALEPreviousWrap<cr>
|
|
|
|
nmap <silent> <leader>aN :ALENext -error<cr>
|
|
|
|
nmap <silent> <leader>aP :ALEPrevious -error<cr>
|
|
|
|
nmap <leader>ad :ALEDetail<cr>
|
|
|
|
map <Leader>ss :call SymbolSearch()<CR>
|
|
|
|
map <Leader>g :ALEGoToDefinition<CR>
|
|
|
|
map <Leader>gt :ALEGoToTypeDefinition<CR>
|
|
|
|
map <Leader>f :ALEFindReferences<CR>
|
|
|
|
map <Leader>fv :ALEFindReferences -vsplit<CR>
|
|
|
|
map <Leader>fh :ALEFindReferences -split<CR>
|
|
|
|
map <Leader>ft :ALEFindReferences -tab<CR>
|
2021-01-06 13:34:33 +00:00
|
|
|
command GoToDefinition ALEGoToDefinition
|
|
|
|
command GoToTypeDefinition ALEGoToTypeDefinition
|
|
|
|
command FindReferences ALEFindReferences
|
|
|
|
command Rename ALERename
|
2020-12-29 07:02:41 +00:00
|
|
|
|
|
|
|
let g:ale_sign_column_always = 1
|
2020-12-18 08:00:19 +00:00
|
|
|
let g:ale_fix_on_save = 1
|
2020-12-29 07:02:41 +00:00
|
|
|
let g:ale_lint_on_text_changed = 1
|
2020-12-18 08:00:19 +00:00
|
|
|
let g:ale_lint_on_enter = 1
|
|
|
|
let g:ale_lint_on_insert_leave = 1
|
|
|
|
let g:ale_lint_on_save = 1
|
|
|
|
let g:ale_echo_cursor = 1
|
2020-12-29 07:02:41 +00:00
|
|
|
let g:ale_lint_delay = 50
|
|
|
|
let g:ale_set_balloons = 1
|
|
|
|
" NOTE: Needs https://github.com/dense-analysis/ale/issues/3350
|
|
|
|
let g:ale_rust_analyzer_config = {
|
|
|
|
\ 'diagnostics': { 'disabled': ['unresolved-import'] },
|
|
|
|
\ 'cargo': { 'loadOutDirsFromCheck': v:true },
|
2021-01-06 13:34:33 +00:00
|
|
|
\ 'procMacro': { 'enable': v:true },
|
2020-12-30 15:50:33 +00:00
|
|
|
\ 'checkOnSave': { 'command': 'clippy', 'enable': v:true },
|
2020-12-29 07:02:41 +00:00
|
|
|
\ }
|
2020-12-18 08:46:30 +00:00
|
|
|
let g:ale_go_goimports_options = '-local github.com/sensiblecodeio/cantabular'
|
|
|
|
let g:ale_command_wrapper = 'nice -n5'
|
|
|
|
let g:ale_completion_enabled = 1
|
2020-12-18 09:10:57 +00:00
|
|
|
let g:ale_close_preview_on_insert = 1
|
|
|
|
let g:ale_hover_to_preview = 1
|
|
|
|
let g:ale_sign_column_always = 1
|
2020-12-29 07:02:41 +00:00
|
|
|
let g:ale_history_log_output = 1
|
|
|
|
let g:ale_linters = {
|
|
|
|
\ 'javascript': ['eslint'],
|
|
|
|
\ 'go': ['gopls'],
|
2021-01-06 13:34:33 +00:00
|
|
|
\ 'rust': ['analyzer'],
|
|
|
|
\ 'css': ['stylelint'],
|
2020-12-29 07:02:41 +00:00
|
|
|
\ }
|
|
|
|
let g:ale_fixers = {
|
|
|
|
\ '*': ['remove_trailing_lines', 'trim_whitespace'],
|
|
|
|
\ 'javascript': ['prettier'],
|
2020-12-30 15:50:33 +00:00
|
|
|
\ 'rust': [],
|
2021-01-06 13:34:33 +00:00
|
|
|
\ 'go': [],
|
|
|
|
\ 'css': ['stylelint'],
|
2020-12-29 07:02:41 +00:00
|
|
|
\ }
|
|
|
|
|
|
|
|
" load ALE only after configured:
|
|
|
|
packadd! ale
|
|
|
|
|
|
|
|
runtime macros/matchit.vim
|