Skip to content

Instantly share code, notes, and snippets.

@ChrisWellsWood
Created December 9, 2019 09:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ChrisWellsWood/88531dcf5c878b3329cd977677c9933d to your computer and use it in GitHub Desktop.
Save ChrisWellsWood/88531dcf5c878b3329cd977677c9933d to your computer and use it in GitHub Desktop.
My Current .vimrc (09/12/19)
" Behaviour
set expandtab
set hidden
set path+=**
set shiftwidth=4
set spell
set spelllang=en_gb
set t_vb=
set tabstop=4
set visualbell
set wildmenu
filetype plugin indent on
" Mappings
nnoremap <Esc><Esc><Esc> :w<CR>
nnoremap Y y$
nnoremap <tab> :bprevious<CR>
nnoremap <S-tab> :bnext<CR>
nnoremap <C-q> :bd<CR>
nnoremap ` za
:nnoremap <expr> ¬ &foldlevel ? 'zM' :'zR'
" Appearance Options
set number
set relativenumber
set textwidth=88
set colorcolumn=+1
highlight ColorColumn guibg=Grey15
let g:netrw_liststyle=3
" Status Line
set statusline=%f " Path to the file
set statusline+=%m " File modified
set statusline+=%= " Switch to the right side
set statusline+=%l " Current line
set statusline+=/ " Separator
set statusline+=%L " Total lines
" Folding
set foldmethod=marker
" Plug
call plug#begin()
Plug 'alx741/vim-hindent'
Plug 'christoomey/vim-sort-motion'
Plug 'dag/vim-fish'
Plug 'easymotion/vim-easymotion'
Plug 'elmcast/elm-vim'
Plug 'francoiscabrol/ranger.vim'
Plug 'lifepillar/vim-solarized8'
Plug 'lilydjwg/colorizer'
Plug 'neovimhaskell/haskell-vim'
Plug 'rust-lang/rust.vim'
Plug 'tpope/vim-commentary'
Plug 'tpope/vim-fugitive'
Plug 'tpope/vim-repeat'
Plug 'tpope/vim-sensible'
Plug 'tpope/vim-surround'
Plug 'wincent/terminus'
Plug 'w0rp/ale'
Plug 'zah/nim.vim'
call plug#end()
" vim hardcodes background color erase even if the terminfo file does
" not contain bce (not to mention that libvte based terminals
" incorrectly contain bce in their terminfo files). This causes
" incorrect background rendering when using a color theme with a
" background color.
let &t_ut=''
" Set format for spellchecking
hi clear SpellBad
hi SpellBad cterm=underline
hi clear SpellLocal
hi SpellLocal cterm=underline
hi clear SpellRare
hi SpellRare cterm=underline
hi clear SpellCap
hi SpellCap cterm=underline
" Jump to tag
nn <M-g> :call JumpToDef()<cr>
ino <M-g> <esc>:call JumpToDef()<cr>i
" Set the type for the file type but do NOT override if file type
" already has detected
au BufRead,BufNewFile *.jsm set filetype=js
" Snippets
source ~/.vim/snippets/snippet_cmds.vim
" PLUGINS
" ---- ALE ----
let g:ale_linters = {
\ 'rust': ['rls'],
\ 'python': ['mypy', 'pyflakes', 'pydocstyle']
\}
let g:ale_rust_rls_toolchain = 'stable'
let g:ale_fixers = {
\ 'rust': ['rustfmt'],
\ 'javascript': ['prettier'],
\ 'python': ['black'],
\}
let g:ale_fix_on_save = 1
nmap <silent> <leader>j :ALENext<cr>
nmap <silent> <leader>k :ALEPrevious<cr>
nmap <silent> <leader>l :ALEDetail<cr>
nmap <silent> <leader>J :ALENext<cr>:ALEDetail<cr>
nmap <silent> <leader>K :ALEPrevious<cr>:ALEDetail<cr>
" ---- easymotion ----
map W <Plug>(easymotion-prefix)w
map E <Plug>(easymotion-prefix)e
map B <Plug>(easymotion-prefix)b
" ---- Elm ----
let g:elm_setup_keybindings = 0
" ---- FISH ----
au BufNewFile,BufRead fish_funced set filetype=fish
" ---- Javascript ----
autocmd FileType javascript setlocal shiftwidth=2 softtabstop=2 expandtab
" ---- Nim ----
fun! JumpToDef()
if exists("*GotoDefinition_" . &filetype)
call GotoDefinition_{&filetype}()
else
exe "norm! \<C-]>"
endif
endf
" ---- Ranger ----
let g:ranger_map_keys = 0
map - :Ranger<CR>
" ---- Rust ----
let g:rustfmt_autosave = 1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment