" ----------------------------------------------------------------------------- " Standard Vim settings " ----------------------------------------------------------------------------- " " General settings " ----------------------------------------------------------------------------- set nocompatible set ttyfast set lazyredraw " Write files on make/GoBuild etc set autowrite " Accept ^? as backspace char (allows remapping of C-h for moving to a left " split) - NOTE: Must set up terminal emulator to emit ^? when backspace is " pressed set t_kb= " vim-plug - handle required plugins call plug#begin('~/.config/nvim/plugged') " Ui & theming Plug 'altercation/vim-colors-solarized' Plug 'itchyny/lightline.vim' " Development Plug 'airblade/vim-gitgutter' Plug 'fatih/vim-go' Plug 'elzr/vim-json' Plug 'tpope/vim-fugitive' "Plug 'ekalinin/Dockerfile.vim' Plug 'majutsushi/tagbar' Plug 'tpope/vim-dispatch' Plug 'radenling/vim-dispatch-neovim' Plug 'w0rp/ale' " Filetypes Plug 'elzr/vim-json' " Misc Plug 'SirVer/ultisnips' Plug 'Shougo/deoplete.nvim', { 'do': ':UpdateRemotePlugins' } Plug 'zchee/deoplete-go', { 'do': 'make' } Plug 'ervandew/supertab' Plug 'junegunn/fzf', { 'dir': '~/.config/.fzf', 'do': './install --all' } Plug 'junegunn/fzf.vim' Plug 'jiangmiao/auto-pairs' call plug#end() " Speed up update interval set updatetime=100 " Set new leader let mapleader="," " Allow backspacing over everything in insert mode set backspace=indent,eol,start " Highlight searches & set incremental searching set hlsearch incsearch " Disable backups & swaps set nobackup set noswapfile " indent by multiples of tabstop set shiftround " Tree-style listing in netrw let g:netrw_liststyle=3 " " Key (re)mappings " ----------------------------------------------------------------------------- " Move up/down per terminal line, not file line (for wrapped lines) noremap j (v:count == 0 ? 'gj' : 'j') noremap k (v:count == 0 ? 'gk' : 'k') " Disable cursor keys in normal & insert mode "noremap "noremap "noremap "noremap "inoremap "inoremap "inoremap "inoremap " Change window movement keys slightly map map map map tnoremap h tnoremap j tnoremap k tnoremap l " Highlight terminal cursor differently to editing cursor highlight TermCursor ctermfg=red guifg=red set splitbelow set splitright " jj to ESC back to Normal mode; quicker than reaching for ESC inoremap jj " Alt-[jk] for move current line up/down (also in visual block mode) nnoremap :m+== nnoremap :m-2== vnoremap :m'>+gv=gv vnoremap :m-2gv=gv " Alt-[hl] for indenting in and back (also in visual block mode) nnoremap << nnoremap >> vnoremap >gv " " General UI settings " ----------------------------------------------------------------------------- set number "set relativenumber "autocmd InsertEnter * :set number "autocmd InsertLeave * :set relativenumber set laststatus=2 set ruler set tabstop=2 set shiftwidth=2 set expandtab set cursorline set fillchars+=vert:\ " Highlight all chars past col 100 to encourage line breaks; "Float" defaults " to red in neodark theme "call matchadd('Float', '\%101v.\+', 100) " " Theme settings " ----------------------------------------------------------------------------- "set background=dark colorscheme solarized syntax on " " Vim-go " ----------------------------------------------------------------------------- let g:go_highlight_functions=1 let g:go_highlight_methods=0 let g:go_highlight_structs=1 let g:go_highlight_operators=0 let g:go_highlight_interfaces=1 let g:go_highlight_build_constraints=1 let g:go_fmt_command="goimports" let g:go_auto_sameids=1 let g:go_metalinter_autosave=1 let g:go_auto_type_info=1 "let g:go_snippet_engine='neosnippet' let g:go_list_height=10 "let g:go_list_type="quickfix" "let g:go_fmt_fail_silently=1 " Map t to GoTest autocmd FileType go nmap t (go-test) " Map c to GoCoverageToggle autocmd FileType go nmap c (go-coverage-toggle) " Map a to GoAlternate autocmd FileType go nmap a (go-alternate) let g:go_metalinter_enabled = ['vet', 'golint', 'gosimple', 'errcheck'] " " lightline " ----------------------------------------------------------------------------- let g:lightline = { \ 'colorscheme': 'solarized', \ 'active': { \ 'left': [ ['mode', 'paste'], \ ['gitbranch', 'readonly', 'filename', 'modified'] ] \ }, \ 'component_function': { \ 'gitbranch': 'fugitive#head' \ }, \ } " Disable mode display, as it's part of the status bar in standard themes set noshowmode " " Tagbar " ----------------------------------------------------------------------------- "nmap b :TagbarToggle " General UI config let g:tagbar_left=1 let g:tagbar_width = 35 " Configuration for Golang, using gotags let g:tagbar_type_go = { \ 'ctagstype' : 'go', \ 'kinds' : [ \ 'p:package', \ 'i:imports:1', \ 'c:constants', \ 'v:variables', \ 't:types', \ 'n:interfaces', \ 'w:fields', \ 'e:embedded', \ 'm:methods', \ 'r:constructor', \ 'f:functions' \ ], \ 'sro' : '.', \ 'kind2scope' : { \ 't' : 'ctype', \ 'n' : 'ntype' \ }, \ 'scope2kind' : { \ 'ctype' : 't', \ 'ntype' : 'n' \ }, \ 'ctagsbin' : 'gotags', \ 'ctagsargs' : '-sort -silent' \ } autocmd VimEnter * nested :call tagbar#autoopen(1) autocmd FileType * nested :call tagbar#autoopen(0) " " Deoplete " ----------------------------------------------------------------------------- let g:deoplete#enable_at_startup = 1 let g:deoplete#max_list = 10 let g:deoplete#max_menu_width = 20 " Switch tab ordering, so from top of completion list down; map to tab/shift-tab " " Deoplete-go " ----------------------------------------------------------------------------- let g:deoplete#sources#go#gocode_binary=$GOPATH.'/bin/gocode' " " Neosnippets " ----------------------------------------------------------------------------- " Use Tab to jump between placehoders "imap (neosnippet_expand_or_jump) "smap (neosnippet_expand_or_jump) "xmap (neosnippet_expand_target) " " ale " ----------------------------------------------------------------------------- " Error and warning signs. let g:ale_sign_error = '▶▶' let g:ale_sign_warning = '▶▶' let g:ale_sign_column_always = 1 let g:ale_lint_on_text_changed = 'always' " " fzf-vim " ----------------------------------------------------------------------------- imap (fzf-complete-line) map b :Buffers map f :Files map g :GFiles "map t :Tags let g:fzf_layout = { 'down': '~20%' } " Customize fzf colors to match theme let g:fzf_colors = { \ 'bg': ['bg', 'CursorLine'], \ 'bg+': ['bg', 'CursorLine'], \ 'info': ['fg', 'Keyword'], \ 'prompt': ['fg', 'Function', 'Bold'], \ 'marker': ['fg', 'Float', 'Bold'], \ 'hl': ['fg', 'Float', 'Bold'], \ 'hl+': ['fg', 'Float', 'Bold'], \ 'header': ['bg', 'CursorLine'] \ } " " gitgutter " ----------------------------------------------------------------------------- let g:gitgutter_sign_added = '┃' let g:gitgutter_sign_modified = '┃' let g:gitgutter_sign_removed = '┃'