Skip to content

Instantly share code, notes, and snippets.

@dtoebe
Last active January 11, 2019 08:20
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 dtoebe/45de32272bac5ef3c4902bb9b9023e45 to your computer and use it in GitHub Desktop.
Save dtoebe/45de32272bac5ef3c4902bb9b9023e45 to your computer and use it in GitHub Desktop.
Lean mean vim
set nu rnu
set hidden
set mouse=a
set tabstop=4 softtabstop=0 expandtab shiftwidth=4 smarttab
set hidden
set noswapfile
set nowrap
set noerrorbells
set novisualbell
set ruler
set title
set go-=r
set go-=L
set updatetime=100
set noshowmode
set guioptions-=m
set guioptions-=T
set guioptions-=r
set guioptions-=L
set splitbelow
set splitright
if !has('gui_running')
set t_Co=256
endif
call plug#begin('~/.vim/plugged')
Plug 'autozimu/LanguageClient-neovim', {
\ 'branch': 'next',
\ 'do': 'bash install.sh',
\ }
Plug 'junegunn/fzf', { 'dir': '~/.fzf', 'do': './install --all' }
Plug 'junegunn/fzf.vim'
if has('nvim')
Plug 'Shougo/deoplete.nvim', { 'do': ':UpdateRemotePlugins' }
else
Plug 'Shougo/deoplete.nvim'
Plug 'roxma/nvim-yarp'
Plug 'roxma/vim-hug-neovim-rpc'
endif
Plug 'zchee/deoplete-go', { 'do': 'make'}
Plug 'w0rp/ale'
Plug 'itchyny/lightline.vim'
Plug 'maximbaz/lightline-ale'
Plug 'fatih/vim-go', { 'do': ':GoUpdateBinaries' }
Plug 'rust-lang/rust.vim'
Plug 'farmergreg/vim-lastplace'
Plug 'jiangmiao/auto-pairs'
Plug 'dracula/vim', { 'as': 'dracula' }
Plug 'tpope/vim-commentary'
Plug 'tell-k/vim-autopep8'
Plug 'majutsushi/tagbar'
Plug 'tpope/vim-fugitive'
Plug 'airblade/vim-gitgutter'
Plug 'godlygeek/tabular'
Plug 'plasticboy/vim-markdown'
Plug 'cespare/vim-toml'
Plug 'elzr/vim-json'
Plug 'junegunn/goyo.vim'
Plug 'xolox/vim-misc'
Plug 'xolox/vim-session'
call plug#end()
" Colors
syntax on
color dracula
" General keybindings
let mapleader = "\<Space>"
nmap <silent> <leader><Up> :wincmd k<CR>
nmap <silent> <leader><Down> :wincmd j<CR>
nmap <silent> <leader><Left> :wincmd h<CR>
nmap <silent> <leader><Right> :wincmd l<CR>
" Vim-Session
let g:session_autosave = 'no'
" Vim-JSON
let g:vim_json_syntax_conceal = 0
" Vim-Markdown
let g:vim_markdown_folding_disabled = 1
let g:vim_markdown_emphasis_multiline = 0
let g:vim_markdown_follow_anchor = 1
let g:vim_markdown_toml_frontmatter = 1
let g:vim_markdown_json_frontmatter = 1
let g:vim_markdown_new_list_item_indent = 4
let g:vim_markdown_autowrite = 1
" GitGutter
let g:gitgutter_sign_added = '+'
let g:gitgutter_sign_modified = '~'
let g:gitgutter_sign_removed = '_'
let g:gitgutter_sign_removed_first_line = '‾'
let g:gitgutter_sign_modified_removed = '~_'
let g:gitgutter_enabled = 1
" TagBar
nmap <leader>t :TagbarToggle<CR>
" INSTALL: go get -u github.com/jstemmer/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'
\ }
let g:tagbar_type_rust = {
\ 'ctagstype' : 'rust',
\ 'kinds' : [
\'T:types,type definitions',
\'f:functions,function definitions',
\'g:enum,enumeration names',
\'s:structure names',
\'m:modules,module names',
\'c:consts,static constants',
\'t:traits',
\'i:impls,trait implementations',
\]
\}
" AutoPEP8
let g:autopep8_max_line_length=79
let g:autopep8_on_save = 1
let g:autopep8_disable_show_diff=1
" FZF
let g:fzf_layout = { 'down': '~40%' }
nmap <silent> <leader>bb :Buffers<CR>
nmap <silent> <leader>gf :GFiles<CR>
nmap <silent> <leader>gs :GFiles?<CR>
" LanguageClient
" INSTALL: go get -u -v github.com/saibing/bingo
let g:LanguageClient_rootMarkers = {
\ 'go': ['.git', 'go.mod'],
\ }
" INSTALL: https://github.com/saibing/bingo/wiki/Install
" 'go': [ 'go-languageserver', '-gocodecompletion' ]
" INSTALL: pip3 install --user 'python-language-server[all]' pyls-mypy pyls-isort pyls-black
let g:LanguageClient_serverCommands = {
\ 'go': ['bingo', '--mode', 'stdio', '--logfile', '/tmp/lspserver.log','--trace', '--pprof', ':6060', '--format-style', 'goimports', '--disable-func-snippet', '--format-style', 'goimports'],
\ 'rust': ['~/.cargo/bin/rustup', 'run', 'nightly', 'rls'],
\ 'python': ['/home/dtoebe/.local/bin/pyls'],
\ }
let g:LanguageClient_autoStart = 1
let g:LanguageClient_hoverPreview = 'Auto'
let g:LanguageClient_fzfContextMenu = 1
let g:LanguageClient_selectionUI = 'fzf'
let g:LanguageClient_hasSnippetSupport = 0
" let g:LanguageClient_completionPreferTextEdit = 1
nnoremap <leader>lcs :LanguageClientStart<CR>
nnoremap <leader>c :call LanguageClient_contextMenu()<CR>
nnoremap <silent> K :call LanguageClient#textDocument_hover()<CR>
nnoremap <silent> gd :call LanguageClient#textDocument_definition()<CR>
nnoremap <silent> <F2> :call LanguageClient#textDocument_rename()<CR>
" Rust.Vim
" let g:autofmt_autosave = 1
" Lastplace
let g:lastplace_ignore = "gitcommit,gitrebase,svn,hgcommit"
let g:lastplace_ignore_buftype = "quickfix,nofile,help"
" Deoplete-Go
let g:deoplete#sources#go#gocode_binary = '/home/dtoebe/go/bin/gocode'
let g:deoplete#sources#go#package_dot = 1
let g:deoplete#sources#go#sort_class = ['package', 'func', 'type', 'var', 'const']
let g:deoplete#sources#go#pointer = 1
" let g:deoplete#sources#go#cgo = 1
let g:deoplete#sources#go#source_importer = 1
let g:deoplete#sources#go#builtin_objects = 1
let g:deoplete#sources#go#unimported_packages = 1
" Vim-Go
let g:go_list_type = "quickfix"
let g:go_fmt_command = "goimports"
let g:go_fmt_fail_silently = 1
let g:go_addtags_transform = "camelcase"
let g:go_highlight_types = 1
let g:go_highlight_fields = 1
let g:go_highlight_functions = 1
let g:go_highlight_function_calls = 1
let g:go_metalinter_enabled = ['vet', 'golint', 'errcheck', 'goimports', 'deadcode']
let g:go_metalinter_autosave = 1
let g:go_metalinter_autosave_enabled = ['vet', 'golint', 'goimports' ]
let g:go_metalinter_deadline = "2s"
let g:go_def_mode = 'godef'
let g:go_auto_type_info = 1
let g:go_auto_sameids = 1
" Deoplete
"
" Setup
" INSTALL: pip3 install --user pynvim
let g:deoplete#enable_at_startup = 1
" Ale
let g:ale_linters = {
\ 'python': [ 'flake8' ],
\ 'rust': [ 'rls', 'cargo' ]
\}
" 'python': [ 'isort', 'ale#fixers#generic_python#BreakUpLongLines', 'yapf' ],
let g:ale_fixers = {
\ '*': ['remove_trailing_lines', 'trim_whitespace'],
\ 'rust': [ 'rustfmt' ]
\}
let g:ale_fix_on_save = 1
let g:ale_completion_enabled = 1
let g:ale_sign_column_always = 1
let g:ale_list_window_size = 5
let g:ale_rust_cargo_check_all_targets = 1
let g:ale_rust_cargo_avoid_whole_workspace = 0
let g:ale_rust_cargo_use_clippy = executable('cargo-clippy')
let g:ale_rust_cargo_default_feature_behavior = 'all'
" Lightline
let g:lightline = {}
let g:lightline = {
\ 'colorscheme': 'wombat',
\ }
let g:lightline.component_expand = {
\ 'linter_checking': 'lightline#ale#checking',
\ 'linter_warnings': 'lightline#ale#warnings',
\ 'linter_errors': 'lightline#ale#errors',
\ 'linter_ok': 'lightline#ale#ok',
\ }
let g:lightline.component_type = {
\ 'linter_checking': 'left',
\ 'linter_warnings': 'warning',
\ 'linter_errors': 'error',
\ 'linter_ok': 'left',
\ }
let g:lightline.active = {
\ 'right': [
\ [ 'filetype', 'lineinfo' ],
\ [ 'linter_checking', 'linter_errors', 'linter_warnings', 'linter_ok' ]
\ ]
\ }
let g:lightline#ale#indicator_checking = "\uf110"
let g:lightline#ale#indicator_warnings = "\uf071"
let g:lightline#ale#indicator_errors = "\uf05e"
let g:lightline#ale#indicator_ok = "\uf00c"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment