syntax on filetype plugin indent on " Make comma the leader key let mapleader="," " file browser let g:netrw_banner = 0 set shiftwidth=2 set shiftround set tabstop=2 set expandtab set smarttab set encoding=utf-8 set nocompatible set t_Co=256 set hidden set history=100 set nowrap set smartindent set copyindent set autoindent set hlsearch set showmatch set wildignore+=*.log,*.sql,*.cache set wildmode=longest,list,full set wildmenu set number set relativenumber 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 set pastetoggle= set ttymouse=sgr set mouse=a set mousemodel=popup_setpos set lazyredraw set completeopt=menu,menuone,popup,noselect,noinsert set timeoutlen=600 set ballooneval set balloonevalterm set scrolloff=5 " Colour scheme: colorscheme PaperColor set background=dark " Key mappings: nnoremap j gj nnoremap k gk nmap ,/ :nohlsearch map map map map map n :Ntree " Select just-pasted text: nnoremap p `[v`] nnoremap Q @@ " vim-markdown configuration: let g:vim_markdown_conceal = 3 " Command-T configuration: map T :CommandTFlush let g:CommandTFileScanner="git" let g:CommandTGitScanSubmodules=1 let g:CommandTGitIncludeUntracked=1 let g:CommandTMatchWindowAtTop=0 let g:CommandTMaxHeight=30 " Lightline configuration: set laststatus=2 " Vim-Go configuration: let g:go_fmt_autosave = 0 " 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', \ } autocmd BufNewFile,BufRead *.gohtml set syntax=gohtmltmpl " 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' " Vim-Rust configuration: let g:rustfmt_autosave = 1 " ALE configuration: 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 af :ALEFirst nmap al :ALELast nmap an :ALENextWrap nmap ap :ALEPreviousWrap nmap aN :ALENext -error nmap aP :ALEPrevious -error nmap ad :ALEDetail map ss :call SymbolSearch() map g :ALEGoToDefinition map gt :ALEGoToTypeDefinition map f :ALEFindReferences map fv :ALEFindReferences -vsplit map fh :ALEFindReferences -split map ft :ALEFindReferences -tab map r :ALERename let g:ale_sign_column_always = 1 let g:ale_fix_on_save = 1 let g:ale_lint_on_text_changed = 1 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 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 }, \ 'procMacro': { 'enable': v:false }, \ 'checkOnSave': { 'command': 'clippy', 'enable': v:true }, \ } let g:ale_go_goimports_options = '-local github.com/sensiblecodeio/cantabular' let g:ale_command_wrapper = 'nice -n5' let g:ale_completion_enabled = 1 let g:ale_close_preview_on_insert = 1 let g:ale_hover_to_preview = 1 let g:ale_sign_column_always = 1 let g:ale_history_log_output = 1 let g:ale_linters = { \ 'javascript': ['eslint'], \ 'go': ['gopls'], \ 'rust': ['analyzer'] \ } let g:ale_fixers = { \ '*': ['remove_trailing_lines', 'trim_whitespace'], \ 'javascript': ['prettier'], \ 'rust': [], \ 'go': [] \ } " load ALE only after configured: packadd! ale runtime macros/matchit.vim