dotfiles/vimrc

124 lines
2.8 KiB
VimL
Raw Normal View History

2020-06-26 12:19:50 +00:00
syntax on
filetype plugin indent on
" Make comma the leader key
:let mapleader=","
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
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
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=<F2>
set mouse=a
set lazyredraw
" Colour scheme:
colorscheme PaperColor
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>
" Select just-pasted text:
nnoremap <Leader>p `[v`]
nnoremap Q @@
2020-12-18 08:00:19 +00:00
" Skip to next linter problems:
2020-12-18 09:10:57 +00:00
nmap <silent> <leader>an :ALENextWrap<cr>
nmap <silent> <leader>ap :ALEPreviousWrap<cr>
nmap <silent> <leader>ad :ALEDetail<cr>
2020-12-18 12:49:36 +00:00
inoremap <silent><expr> <Tab>
\ pumvisible() ? "\<C-n>" : "\<TAB>"
2020-06-26 12:19:50 +00:00
" Markdown configuration:
autocmd FileType markdown setlocal wrap linebreak
" Nerdtree configuration:
map <Leader>n :NERDTreeToggle<CR>
" Command-T configuration:
map <leader>f :CommandTFlush<CR>
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
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',
\ }
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:
let g:rustfmt_autosave = 0
" ALE configuration:
let g:ale_linters = {
\ 'javascript': ['eslint'],
2020-12-18 08:46:30 +00:00
\ 'go': ['gopls'],
2020-12-18 08:00:19 +00:00
\ 'rust': ['cargo']
\ }
let g:ale_fixers = {
\ '*': ['remove_trailing_lines', 'trim_whitespace'],
\ 'javascript': ['prettier'],
2020-12-18 12:49:36 +00:00
\ 'go': [],
2020-12-18 08:00:19 +00:00
\ 'rust': ['rustfmt']
\ }
let g:ale_fix_on_save = 1
let g:ale_lint_on_text_changed = 0
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_rust_cargo_use_clippy = 0
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