"LEMON'S VIMRC - 16 NOVEMBER 2014 " Preamble {{{... set t_Co=256 set background=dark set path+=** "}}} " " set syntax on syntax on " vertical diff please set diffopt=vertical " twdft colouring and syntaxing autocmd BufNewFile,BufRead *.twdft set syntax=markdown " macro to create and delete a 'check a box' "nmap 1 0f[lrx nmap 1 0f rx nmap 2 0fxr  " " Remap the leader key {{{... let mapleader = "," "...}}} " " map ESCAPE to exit to Normal mode in neovim terminal {{{... tnoremap " ...}}} " " Signify mapping & config nnoremap R :SignifyRefresh let g:signify_realtime = 1 " " Basic options {{{... set cmdheight=1 set termguicolors set inccommand=split set foldmethod=manual set encoding=utf-8 set modelines=0 set relativenumber set autoindent set showmode set cursorline set ttyfast set ttimeout set notimeout set nottimeout set backspace=indent,eol,start set ruler set laststatus=2 set history=1000 " remember more commands and search history set undolevels=1000 " use many muchos levels of undo set wildignore=*.swp,*.bak,*.pyc,*.class set title " change the terminal's title set visualbell " don't beep set noerrorbells " don't beep set number set fillchars=diff:⣿,vert:\| set noswapfile set ruler " show the cursor position all the time set showcmd " display incomplete commands set vb "set list set listchars=tab:▸\ ,eol:¬,extends:❯,precedes:❮ set lazyredraw set matchtime=3 set showbreak=↪ set shell=/usr/local/bin/fish set splitbelow set splitright set autowrite set autoread set linebreak set hidden "set colorcolumn=80 "...}}} " Wildmenu completion {{{ set wildmenu " set wildmode=list:longest " don't like this set wildignore+=.hg,.git,.svn " Version control set wildignore+=*.aux,*.out,*.toc " LaTeX intermediate files set wildignore+=*.jpg,*.bmp,*.gif,*.png,*.jpeg " binary images set wildignore+=*.o,*.obj,*.exe,*.dll,*.manifest " compiled object files set wildignore+=*.spl " compiled spelling word lists set wildignore+=*.sw? " Vim swap files set wildignore+=*.DS_Store " OSX bullshit set wildignore+=*.luac " Lua byte code set wildignore+=migrations " Django migrations set wildignore+=*.pyc " Python byte code set wildignore+=*.orig " Merge resolution files " Clojure/Leiningen set wildignore+=classes set wildignore+=lib " }}} " Make Vim able to edit crontab files ... {{{ set backupskip=/tmp/*,/private/tmp/*" "...}}} " Remaps ...{{{ "NERDTree! nmap \e :NERDTreeToggle let NERDTreeIgnore=['\.pyc$', '\~$'] "ignore files in NERDTree " targbar handler nmap :TagbarToggle " Don't use Ex mode, use Q for formatting "map Q gq " easier formatting of paragraphs " from https://github.com/thesheff17/youtube/blob/master/vim/vimrc vmap Q gq nmap Q gqap " set trailing whitespace to be visible with using special chars with ,s "set listchars=tab:>-,trail:*,eol:$ "nmap s :set nolist! " some misc settings :nmap \l :setlocal number! :nmap \o :set paste! " map sort function to a key " from https://github.com/thesheff17/youtube/blob/master/vim/vimrc vnoremap s :sort " Plug Plugs...{{{ call plug#begin('~/.config/nvim/plugged') Plug 'Shougo/deoplete.nvim', { 'do': ':UpdateRemotePlugins' } "Plug 'lervag/vimtex' " does not work with Latex Box in vim-polyglot Plug 'google/yapf', { 'rtp': 'plugins/vim', 'for': 'python' } Plug 'hdima/python-syntax' Plug 'deoplete-plugins/deoplete-go', {'do': 'make'} Plug 'junegunn/rainbow_parentheses.vim' Plug 'rust-lang/rust.vim' Plug 'reewr/vim-monokai-phoenix' Plug 'junegunn/fzf' Plug 'junegunn/fzf.vim' Plug 'zchee/deoplete-jedi' Plug 'mhinz/vim-signify' " marking changes in repo Plug 'anekos/hledger-vim' Plug 'fatih/vim-go', {'do': ':GoUpdateBinaries'} Plug 'buoto/gotests-vim' Plug 'bitc/vim-hdevtools' Plug 'NLKNguyen/papercolor-theme' Plug 'neovimhaskell/haskell-vim' Plug 'ledger/vim-ledger' Plug 'sophacles/vim-bundle-mako' "Plug 'zchee/deoplete-clang' Plug 'chriskempson/vim-tomorrow-theme' Plug 'sbdchd/neoformat' Plug 'w0rp/ale' Plug 'tpope/vim-fugitive' Plug 'tpope/vim-unimpaired' "Plug 'rking/ag.vim' Plug 'tmhedberg/SimpylFold' Plug 'tpope/vim-surround' Plug 'plasticboy/vim-markdown' Plug 'scrooloose/nerdtree' Plug 'scrooloose/nerdcommenter' Plug 'dag/vim-fish' Plug 'majutsushi/tagbar' Plug 'SirVer/ultisnips' Plug 'honza/vim-snippets' Plug 'jlanzarotta/bufexplorer' Plug 'jmcantrell/vim-virtualenv' Plug 'sukima/xmledit' Plug 'mileszs/ack.vim' Plug 'klen/python-mode' Plug 'Shougo/neosnippet' Plug 'Shougo/neosnippet-snippets' Plug 'itchyny/lightline.vim' Plug 'mhinz/vim-grepper' Plug 'sickill/vim-pasta' Plug 'sheerun/vim-polyglot' Plug 'tommcdo/vim-fubitive' Plug 'janko-m/vim-test' Plug 'tpope/vim-dispatch' Plug 'radenling/vim-dispatch-neovim' Plug 'sunaku/vim-dasht' Plug 'Shougo/neoinclude.vim' Plug 'sebdah/vim-delve' Plug 'ambv/black' Plug 'drewtempelmeyer/palenight.vim' Plug 'bitc/vim-hdevtools' Plug 'tweekmonster/django-plus.vim' Plug 'morhetz/gruvbox' Plug 'junegunn/limelight.vim' Plug 'nathangrigg/vim-beancount' Plug 'junegunn/vim-peekaboo' Plug 'cormacrelf/vim-colors-github' "Plug 'neoclide/coc.nvim', {'branch': 'release'} "Plug 'autozimu/LanguageClient-neovim', { " \ 'branch': 'next', " \ 'do': 'bash install.sh', " \ } call plug#end() " point neovim to virtualenv specific to neovim (using 3.7) let g:python3_host_prog = "/home/lemon/.virtualenvs/neovim3.7/bin/python3" "..{{{ rainbow_parentheses "activation based on file type augroup rainbow_lisp autocmd! autocmd FileType lisp,clojure,scheme,python RainbowParentheses augroup END "..}}} ""..{{{ lightline and coc " "function! StatusDiagnostic() abort " let info = get(b:, 'coc_diagnostic_info', {}) " if empty(info) | return '' | endif " let msgs = [] " if get(info, 'error', 0) " call add(msgs, 'E' . info['error']) " endif " if get(info, 'warning', 0) " call add(msgs, 'W' . info['warning']) " endif " return join(msgs, ' ') . ' ' . get(g:, 'coc_status', '') "endfunction " "let g:lightline = { " \ 'colorscheme': 'monokai-phoenix', " \ 'active': { " \ 'left': [ [ 'mode', 'paste' ], " \ [ 'cocstatus', 'readonly', 'filename', 'modified' ] ] " \}, " \ 'component_function': { " \ 'cocstatus': 'StatusDiagnostic' " \ }, " \} "autocmd User CocStatusChange,CocDiagnosticsChange call lightline#update() ""..}}} " "" ..{{{ coc.vim "let g:coc_node_path = "/usr/bin/nodejs" "" ..}}} " "" Some servers have issues with backup files, see #649 "set nobackup "set nowritebackup " "" Better display for messages "set cmdheight=2 " "" You will have bad experience for diagnostic messages when it's default 4000. "set updatetime=300 " "" don't give |ins-completion-menu| messages. "set shortmess+=c " "" always show signcolumns "set signcolumn=yes " "" Use tab for trigger completion with characters ahead and navigate. "" Use command ':verbose imap ' to make sure tab is not mapped by other plugin. "inoremap " \ pumvisible() ? "\" : " \ check_back_space() ? "\" : " \ coc#refresh() "inoremap pumvisible() ? "\" : "\" " "function! s:check_back_space() abort " let col = col('.') - 1 " return !col || getline('.')[col - 1] =~# '\s' "endfunction " "" Use to trigger completion. "inoremap coc#refresh() " "" Use to confirm completion, `u` means break undo chain at current position. "" Coc only does snippet and additional edit on confirm. "inoremap pumvisible() ? "\" : "\u\" " "" Use `[c` and `]c` to navigate diagnostics "nmap [c (coc-diagnostic-prev) "nmap ]c (coc-diagnostic-next) " "" Remap keys for gotos "nmap gd (coc-definition) "nmap gy (coc-type-definition) "nmap gi (coc-implementation) "nmap gr (coc-references) " "" Use K to show documentation in preview window "nnoremap K :call show_documentation() " "function! s:show_documentation() " if (index(['vim','help'], &filetype) >= 0) " execute 'h '.expand('') " else " call CocAction('doHover') " endif "endfunction " "" Highlight symbol under cursor on CursorHold "autocmd CursorHold * silent call CocActionAsync('highlight') " "" Remap for rename current word "nmap rn (coc-rename) " "" Remap for format selected region "xmap f (coc-format-selected) "nmap f (coc-format-selected) " "augroup mygroup " autocmd! " " Setup formatexpr specified filetype(s). " autocmd FileType typescript,json setl formatexpr=CocAction('formatSelected') " " Update signature help on jump placeholder " autocmd User CocJumpPlaceholder call CocActionAsync('showSignatureHelp') "augroup end " "" Remap for do codeAction of selected region, ex: `aap` for current paragraph "xmap a (coc-codeaction-selected) "nmap a (coc-codeaction-selected) " "" Remap for do codeAction of current line "nmap ac (coc-codeaction) "" Fix autofix problem of current line "nmap qf (coc-fix-current) " "" Use for select selections ranges, needs server support, like: coc-tsserver, coc-python "nmap (coc-range-select) "xmap (coc-range-select) "xmap (coc-range-select-backword) " "" Use `:Format` to format current buffer "command! -nargs=0 Format :call CocAction('format') " "" Use `:Fold` to fold current buffer "command! -nargs=? Fold :call CocAction('fold', ) " "" use `:OR` for organize import of current buffer "command! -nargs=0 OR :call CocAction('runCommand', 'editor.action.organizeImport') " " "" Add status line support, for integration with other plugin, checkout `:h coc-status` ""set statusline^=%{coc#status()}%{get(b:,'coc_current_function','')} " "" Using CocList "" Show all diagnostics "nnoremap a :CocList diagnostics "" Manage extensions "nnoremap e :CocList extensions "" Show commands "nnoremap c :CocList commands "" Find symbol of current document "nnoremap o :CocList outline "" Search workspace symbols "nnoremap s :CocList -I symbols "" Do default action for next item. "nnoremap j :CocNext "" Do default action for previous item. "nnoremap k :CocPrev "" Resume latest coc list "nnoremap p :CocListResume " " " " ..{{{ LanguageClient config (base from github " " Required for operations modifying multiple buffers like rename. "set hidden "let g:LanguageClient_serverCommands = { " \ 'rust': ['~/.cargo/bin/rustup', 'run', 'stable', 'rls'], " \ 'javascript': ['/usr/local/bin/javascript-typescript-stdio'], " \ 'javascript.jsx': ['tcp://127.0.0.1:2089'], " \ 'python': ['/usr/local/bin/pyls' '-vv', '--log-file', '~/pyls.log'], " \ 'ruby': ['~/.rbenv/shims/solargraph', 'stdio'], " \ } " Instuctions for clangd here: https://clang.llvm.org/extra/clangd/Installation.html "let g:LanguageClient_serverCommands = { " \ 'rust': ['~/.cargo/bin/rustup', 'run', 'stable', 'rls'], " \ 'python': ['/usr/local/bin/pyls'], " \ 'cpp': ['clangd'], " \ 'c': ['clangd'], " \ } "let g:LanguageClient_settingsPath = 'ls-settings.json' " NOT REQUIRED WITH COC "let g:LanguageClient_useVirtualText = 1 "let g:LanguageClient_diagnosticsEnable = 0 "let g:LanguageClient_settingsPath=expand('~/.local/share/nvim/settings.json') " "nnoremap :call LanguageClient_contextMenu() "" Or map each action separately "nnoremap K :call LanguageClient#textDocument_hover() "nnoremap gd :call LanguageClient#textDocument_definition() "nnoremap :call LanguageClient#textDocument_rename() "nnoremap :call LanguageClient#textDocument_typeDefinition() "nnoremap :call LanguageClient#textDocument_documentSymbol() "nnoremap :call LanguageClient#textDocument_references() "nnoremap :call LanguageClient#workspace_symbol() "autocmd FileType * call LC_maps() " ..}}} " ..{{{ Rust let g:autofmt_autosave = 1 " ...}}} " ..{{{ gruvbox config let g:gruvbox_contrast_dark = "hard" let g:gruvbox_invert_signs = 1 let g:gruvbox_italic = 1 let g:gruvbox_invert_indent_guides = 1 "let g:gruvbox_italicize_strings = 1 " ...}}} " vim-hdevtools for Haskell ..{{ au FileType haskell nnoremap :HdevtoolsType au FileType haskell nnoremap :HdevtoolsClear " }} " vim-test config ..{{{ " use vim-dispatch to run tests in the quickfix window " from Modern Vim Ch.4 " the mappings below are from vim-test " https://github.com/janko/vim-test " dispatch opens send test output to quickfix window "let test#strategy = "dispatch" " neovim strategy runs the test in the neovim terminal let test#strategy = "neovim" let test#neovim#term_position = "topleft" let test#python#pytest#options = '-vvv --tb=short' " To run mypy using vim-dispath -with Dispatch autocmd FileType python let b:dispatch = 'mypy --ignore-missing-imports' nmap t :TestNearest nmap t :TestFile nmap t :TestSuite "nmap t :TestLast nmap :TestLast nmap t :TestVisit " }}} " " " " clang support ... for Debian Stretch only!{{{ "let g:deoplete#sources#clang#libclang_path = '/usr/lib/llvm-3.8/lib/libclang.so.1' "let g:deoplete#sources#clang#clang_header = '/usr/lib/llvm-3.8/lib/clang/3.8.1/include' " works on Debian Buster anyway let g:deoplete#sources#clang#clang_header = '/usr/lib/llvm-6.0/lib/clang/6.0.1/include/' let g:deoplete#sources#clang#libclang_path = '/usr/lib/llvm-6.0/lib/libclang.so.1' "}}} " " deoplete omnifuc {{{ let g:deoplete#enable_at_startup = 1 let g:deoplete#disable_auto_complete = 0 "call deoplete#custom#option('auto_complete', 0) "call deoplete#custom#source('jedi', 'debug_enabled', 1) "call deoplete#enable_logging('DEBUG', '/tmp/deoplete.log') "inoremap deoplete#mappings#manual_complete() "}}} " " golang stuff {{{ let g:go_term_mode = "split" let g:go_term_height = 10 "autocmd FileType go nmap r :w:split terminal go run % autocmd FileType go nmap r :GoRun " highlights the variable in the file for you.. "let g:go_auto_sameids = 1 " auto import... let g:go_fmt_command = "goimports" " automatic type info on cursor let g:go_auto_type_info = 1 let g:go_snippet_engine = "neosnippet" au Filetype go nmap ga (go-alternate-edit) au Filetype go nmap gah (go-alternate-split) au Filetype go nmap gav (go-alternate-vertical) au FileType go nmap :GoTest -short " }}} " " NEOSNIPPET " Plugin key-mappings. " Note: It must be "imap" and "smap". It uses mappings. imap (neosnippet_expand_or_jump) smap (neosnippet_expand_or_jump) xmap (neosnippet_expand_target) " SuperTab like snippets behavior. " Note: It must be "imap" and "smap". It uses mappings. "imap " \ pumvisible() ? "\" : " \ neosnippet#expandable_or_jumpable() ? " \ "\(neosnippet_expand_or_jump)" : "\" smap neosnippet#expandable_or_jumpable() ? \ "\(neosnippet_expand_or_jump)" : "\" " For conceal markers. if has('conceal') set conceallevel=2 concealcursor=niv endif "END OF NEOSNIPPET " " ultisnips... {{{ "inoremap pumvisible() ? "\" : "\" "let g:UltiSnipsExpandTrigger="" "let g:UltiSnipsSnippetsDir = "/home/lemon/dotfiles/Ultisnips" "let g:UltiSnipsSnippetDirectories=["/home/lemon/dotfiles/Ultisnips"] "" let g:UltiSnipsJumpForwardTrigger="" "" let g:UltiSnipsJumpBackwardTrigger="" "let g:UltiSnipsJumpForwardTrigger="" "let g:UltiSnipsJumpBackwardTrigger="" " }}} " " yapf - format python code (https://github.com/google/yapf)...{{{ map y :call yapf#YAPF() imap y :call yapf#YAPF() "autocmd FileType python nnoremap yy :0,$!yapf " ...}}} " " isort - sort python imports (https://github.com/timothycrosley/isort) ...{{{ let maplocalleader = "\\" autocmd FileType python nnoremap j :!isort % " ...}}} " " Tabs, spaces, wrapping ...{{{ set tabstop=4 set shiftwidth=4 set shiftround set softtabstop=4 set expandtab set tw=79 " width of document(used by gd) set nowrap "don't automatically wrap on load set formatoptions=qrn1j set fo-=t " don't automatically wrap text when typing "set colorcolumn=+1 " ...}}} " " Enable folding ...{{{ set foldmethod=manual set foldlevel=99 "...}}} " " Pymode stuff ...{{{ let g:pymode = 1 let g:pymode_options_colorcolumn = 0 " Python 3 syntax let g:pymode_python = 'python3' let g:pymode_rope = 1 let g:pymode_rope_completion = 0 let g:pymode_rope_complete_on_dot = 0 let g:pymode_rope_organize_imports_bind = 'ro' let g:pymode_rope_enable_autoimport = 0 " Set quickfix window let g:pymode_quickfix_minheight = 3 let g:pymode_quickfix_maxheight = 3 " Sort indentation let g:pymode_indent = 1 " Documentation let g:pymode_doc = 0 "let g:pymode_doc_key = 'K' "Linting let g:pymode_lint = 0 let g:pymode_lint_checker = "flake8" " Auto check on save let g:pymode_lint_write = 0 " Support virtualenv let g:pymode_virtualenv = 1 let g:pymode_virtualenv_path = $VIRTUAL_ENV "Enable breakpoints plugin let g:pymode_breakpoint = 1 let g:pymode_breakpoint_bind = 'b' let g:pymode_breakpoint_cmd = 'breakpoint()' "let g:pymode_breakpoint_cmd = 'from pdb import set_trace; set_trace()' " more debug - this probably does pudb if you have that instead of ipdb " map b Oimport ipdb; ipdb.set_trace() # BREAKPOINT " syntax highlighting let g:pymode_syntax = 0 let g:pymode_syntax_all = 1 let g:pymode_syntax_indent_errors = g:pymode_syntax_all let g:pymode_syntax_space_errors = g:pymode_syntax_all " Don't autofold code let g:pymode_folding = 0 " Rope rename let g:pymode_rope_rename_bind = 'rr' " Rope extract variable/method let g:pymode_rope_extract_method_bind = 'rm' let g:pymode_rope_extract_variable_bind = 'rl' " SimplyFold config let g:SimpylFold_docstring_preview=1 " docstrings for folded code let python_highlight_all=1 " ...}}} " " Line return (make sure Vim goes where you left it ...{{{ " Make sure Vim returns to the same line when you reopen a file. augroup line_return au! au BufReadPost * \ if line("'\"") > 0 && line("'\"") <= line("$") | \ execute 'normal! g`"zvzz' | \ endif augroup END "}}} " " " Backups ...{{{ set undodir=~/.nvim-tmp/tmp/undo// "undo files set backupdir=~/.nvim-tmp/tmp/backup// " backups set directory=~/.nvim-tmp/tmp/swap// " swap files set backup " enable backups "}}} " " Highlight VCS conflict markers ...{{{ match ErrorMsg '^\(<\|=\|>\)\{7\}\([^=].\+\)\?$' "}}} " " Searching and movement ...{{{ nnoremap / /\v vnoremap / /\v set ignorecase set smartcase set incsearch set showmatch set hlsearch set gdefault set scrolloff=3 set sidescroll=1 set sidescrolloff=10 set virtualedit+=block nnoremap :noh:call clearmatches() " search for the word you're looking at nmap :Ack! "\b\b" "nmap k :Ack! "\b\b" nmap :Ggrep! "\b\b" "nmap K :Ggrep! "\b\b" nmap \x :cclose " Don't move on * nnoremap * * " Easier to type move extreme left and right noremap H ^ noremap L g_ " Use ctrl-e and ctrl-a inoremap I inoremap A " open a Quickfix window for the last search nnoremap / :execute 'vimgrep /'.@/.'/g %':copen "}}} " " Ag! ... {{{ nnoremap a :Ack! let g:ackprg = 'ag --smart-case --nogroup --nocolor --column' " }}} " " Folding ... {{{ " Enable folding with the spacebar nnoremap za nnoremap fm :set foldmethod=manual " Make zO recursively open whatever fold we're in, even if it's partially open. nnoremap zO zczO " Use ,z to "focus" the current fold nnoremap z zMzvzz " }}} " "" Quick Editing ...{{{ nnoremap ev sjL:e $MYVIMRC " }}} " " Convenience mappings ... {{{ " No more help key. noremap :checktime inoremap :checktime " Kill window "nnoremap K :q " Wrap nnoremap W :set wrap! " Change case noremap gUiw inoremap gUiwea " Substitute nnoremap su :%s// nnoremap s :%s///g " " Emacs bindings in command line mode cnoremap cnoremap " Turn off vimdiff nnoremap D :diffoff! " Formatting, like Textmate nnoremap Q gqip " Easier linewise reselection nnoremap V V`] " Split line (colleague of Join lines) nnoremap S i " Source the current line vnoremap S y:execute @@:echo 'Sourced selection.' nnoremap S ^vg_y:execute @@:echo 'Sourced line.' " Select (charwise) the contents of the current line, excluding indentation. " Great for pasting Python lines into REPLs. nnoremap vv ^vg_ " }}} " " Ack motions ... {{{ " Motions to Ack for things. Works with pretty much everything, including: " " w, W, e, E, b, B, t*, f*, i*, a*, and custom text objects " " Awesome. " " Note: If the text covered by a motion contains a newline it won't work. Ack " searches line-by-line. nnoremap B :set opfunc=AckMotiong@ xnoremap B :call AckMotion(visualmode()) "nnoremap :Ack! '\b\b' xnoremap :call AckMotion(visualmode()) function! s:CopyMotionForType(type) if a:type ==# 'v' silent execute "normal! `<" . a:type . "`>y" elseif a:type ==# 'char' silent execute "normal! `[v`]y" endif endfunction function! s:AckMotion(type) abort let reg_save = @@ call s:CopyMotionForType(a:type) execute "normal! :Ack! --literal " . shellescape(@@) . "\" let @@ = reg_save endfunction " }}} " " Mutt ... {{{ augroup ft_muttrc au! au BufRead,BufNewFile *.muttrc set ft=muttrc au FileType muttrc setlocal foldmethod=marker foldmarker={{{,}}} augroup END " }}} " " perldoc ... {{{ let g:perldoc_split_modifier = '10v' "}}} " " vim-fugitive ... {{{ " prevent buffer build-up autocmd BufReadPost fugitive://* set bufhidden=delete "}}} " " ALE statusline ...{{{ "set statusline+=%{ALEGetStatusLine()} "let g:ale_statusline_format = ['⨉ %d', '⚠ %d', '• ok'] "let g:ale_linters = {'python': ['flake8'],} "...}}} " " ale setting..{{{ "let g:ale_lint_on_text_changed = 'never' " black config ...{{{ "let g:black_virtualenv = "/home/lemon/.virtualenvs/black-for-vim/" "nmap l :Black " LET'S RUN VIRTUALENV BLACK ON SAVE! "autocmd BufWritePre *.py execute ':Black' "let g:black_virtualenv = $VIRTUAL_ENV " }}} let g:ale_enabled = 1 let g:ale_sign_column_always = 1 let g:ale_open_list = 0 let g:ale_set_highlights = 1 let g:ale_set_signs = 1 let g:ale_set_loclist = 0 let g:ale_set_quickfix = 1 let g:ale_echo_cursor = 1 let g:ale_echo_msg_error_str = 'Error' let g:ale_echo_msg_format = '%linter% - %code: %%s' let g:ale_loclist_msg_format = '%linter% - %code: %%s' let g:ale_echo_msg_warning_str = 'Warning' "let g:ale_linters = {'python': ['flake8', 'mypy', 'pyls', 'pylint'], "\ 'ocaml': ['merlin'], " \} let g:ale_linters = {'python': ['flake8', 'mypy'], \ 'ocaml': ['merlin'], \ 'cpp': ['clang'], \ 'go': ['gometalinter', 'gofmt'], \} "let g:ale_linters_ignore = {'python': ['pyls']} let g:ale_fixers = {'python': ['isort']} " we want to run black manually let g:ale_python_mypy_ignore_invalid_syntax = 1 let g:ale_python_mypy_executable = 'mypy' let g:ale_python_mypy_options = '--config-file mypy.ini' " let g:ale_sign_error = '>>' let g:ale_sign_warning = '--' let g:ale_fix_on_save = 1 let g:ale_linters_explicit = 0 " Mappings in the style of unimpaired-next nmap [W (ale_first) nmap [w (ale_previous) nmap ]w (ale_next) nmap ]W (ale_last) " }}} " " More Haskell stuff - May 2017 ...{{{ let g:haskell_enable_quantification = 1 " to enable highlighting of `forall` let g:haskell_enable_recursivedo = 1 " to enable highlighting of `mdo` and `rec` let g:haskell_enable_arrowsyntax = 1 " to enable highlighting of `proc` let g:haskell_enable_pattern_synonyms = 1 " to enable highlighting of `pattern` let g:haskell_enable_typeroles = 1 " to enable highlighting of type roles let g:haskell_enable_static_pointers = 1 " to enable highlighting of `static` let g:haskell_backpack = 1 " to enable highlighting of backpack keywords} let g:haskell_indent_if = 3 let g:haskell_indent_case = 2 let g:haskell_indent_let = 4 let g:haskell_indent_where = 6 let g:haskell_indent_before_where = 2 let g:haskell_indent_after_bare_where = 2 let g:haskell_indent_do = 3 let g:haskell_indent_in = 1 let g:haskell_indent_guard = 2 "}}} " " Bufexplorer config ... {{{ let g:bufExplorerDefaultHelp=1 " Show default help. let g:bufExplorerShowNoName=1 " Show "No Name" buffers. let g:bufExplorerShowUnlisted=1 " Show unlisted buffers. "}}} " " Django ... {{{ augroup ft_django au! au BufNewFile,BufRead urls.py setlocal nowrap au BufNewFile,BufRead urls.py normal! zR au BufNewFile,BufRead dashboard.py normal! zR au BufNewFile,BufRead local_settings.py normal! zR au BufNewFile,BufRead admin.py setlocal filetype=python.django au BufNewFile,BufRead urls.py setlocal filetype=python.django au BufNewFile,BufRead models.py setlocal filetype=python.django au BufNewFile,BufRead views.py setlocal filetype=python.django au BufNewFile,BufRead settings.py setlocal filetype=python.django au BufNewFile,BufRead settings.py setlocal foldmethod=marker au BufNewFile,BufRead forms.py setlocal filetype=python.django au BufNewFile,BufRead common_settings.py setlocal filetype=python.django au BufNewFile,BufRead common_settings.py setlocal foldmethod=marker augroup END " vim-markdown ...{{{ let g:vim_markdown_folding_disabled=1 set foldenable let g:vim_markdown_initial_foldlevel=1 let g:vim_markdown_no_default_key_mappings=1 let g:vim_markdown_math=1 let g:vim_markdown_frontmatter=1 "}}} " " get rid of annoying Press ENTER prompts etc ...{{{ "set shortmess=atI "}}} " " Remap movement in windows ...{{{ map j map k map l map h "}}} " nnoremap c :set cursorline! ":nnoremap c :set cursorline! cursorcolumn! "}}} " " General python properness ...{{{ autocmd FileType python set sw=4 autocmd FileType python set ts=4 autocmd FileType python set sts=4 "}}} " " Escape sudo heck ...{{{ cmap w!! %!sudo tee > /dev/null % "}}} " " Colorscheme ...{{{ "let g:github_colors_soft = "1 " from https://github.com/thesheff17/youtube/blob/master/vim/vimrc "color wombat256mod "color Tomorrow-Night-Bright "color monokai-phoenix "colorscheme github "colorscheme gruvbox "color afterglow colorscheme PaperColor " " if we are using default colorscheme, you want to switch off horrid " grey gutter colour highlight clear SignColumn " " Cursor and column highlighting ...{{{ " hi CursorLine cterm=NONE ctermbg=darkred ctermfg=white guibg=#4b5260 guifg=white " use guibg and guifg because I have set termguicolors switched on in this file " The pythonSelf is a pymode thing... "hi pythonSelf ctermfg=68 guifg=#5f87d7 cterm=bold gui=bold "hi pythonSelf ctermfg=16 guifg=#5f87d7 cterm=bold gui=bold "hi pythonNumber ctermfg=16 guifg=#aa4aef cterm=bold gui=bold "hi pythonFloat ctermfg=16 guifg=#aa4aef cterm=bold gui=bold "hi pythonHexNumber ctermfg=16 guifg=#aa4aef cterm=bold gui=bold " " my todo.todo... {{ autocmd BufNewFile,BufRead *.todo set syntax=markdown "autocmd BufWritePost *.todo !todo-push nmap a=strftime("%c") "let @d=':r! date _kb-I ikb ($a)0"+dd:!xlcipkbkbkbkbclip -o >> /home/lemon/todo/done.todo ' let @d='0$a(k2a)0"+dd:!xlcipkbkbkbkbclip -o >> /home/lemon/todo/done.todo ' " ...}} " Grepper ...{{{ nmap gs (GrepperOperator) xmap gs (GrepperOperator) " ...}}} " " FZF ...{{{ " This is the default extra key bindings let g:fzf_action = { \ 'ctrl-t': 'tab split', \ 'ctrl-x': 'split', \ 'ctrl-v': 'vsplit' } " Default fzf layout " - down / up / left / right let g:fzf_layout = { 'down': '~40%' } " Customize fzf colors to match your color scheme let g:fzf_colors = \ { 'fg': ['fg', 'Normal'], \ 'bg': ['bg', 'Normal'], \ 'hl': ['fg', 'Comment'], \ 'fg+': ['fg', 'CursorLine', 'CursorColumn', 'Normal'], \ 'bg+': ['bg', 'CursorLine', 'CursorColumn'], \ 'hl+': ['fg', 'Statement'], \ 'info': ['fg', 'PreProc'], \ 'prompt': ['fg', 'Conditional'], \ 'pointer': ['fg', 'Exception'], \ 'marker': ['fg', 'Keyword'], \ 'spinner': ['fg', 'Label'], \ 'header': ['fg', 'Comment'] } " {{{ More fzf settings " (https://github.com/zenbro/dotfiles/blob/master/.nvimrc#L151-L187) let g:fzf_nvim_statusline = 0 " disable statusline overwriting nnoremap :FZF nnoremap :FZF! nnoremap ; :Buffers nnoremap t :Files nnoremap o :Tags nnoremap h :History nnoremap 0 :Files nnoremap A :Windows nnoremap ; :BLines nnoremap l :Lines " nnoremap # :Lines nnoremap o :BTags " command history is :History: nnoremap ? :History: nnoremap / :execute 'Ag ' . input('Ag/') " nnoremap . :AgIn # " nnoremap a :Buffers " nnoremap O :Tags nnoremap P :call SearchWordWithAg() vnoremap P :call SearchVisualSelectionWithAg() " nnoremap gl :Commits " nnoremap ga :BCommits nnoremap ft :Filetypes imap (fzf-complete-file-ag) imap (fzf-complete-line) function! SearchWordWithAg() execute 'Ag' expand('') endfunction function! SearchVisualSelectionWithAg() range let old_reg = getreg('"') let old_regtype = getregtype('"') let old_clipboard = &clipboard set clipboard& normal! ""gvy let selection = getreg('"') call setreg('"', old_reg, old_regtype) let &clipboard = old_clipboard execute 'Ag' selection endfunction " function! SearchWithAgInDirectory(...) " call fzf#vim#ag(join(a:000[1:], ' '), extend({'dir': a:1}, g:fzf#vim#default_layout)) " endfunction " command! -nargs=+ -complete=dir AgIn call SearchWithAgInDirectory() " }}} " Enable per-command history. " CTRL-N and CTRL-P will be automatically bound to next-history and " previous-history instead of down and up. If you don't like the change, " explicitly bind the keys to down and up in your $FZF_DEFAULT_OPTS. let g:fzf_history_dir = '~/.local/share/fzf-history' " " Mapping selecting mappings nmap (fzf-maps-n) xmap (fzf-maps-x) omap (fzf-maps-o) " Insert mode completion imap (fzf-complete-word) imap (fzf-complete-path) imap (fzf-complete-file-ag) imap (fzf-complete-line) " Advanced customization using autoload functions inoremap fzf#vim#complete#word({'left': '15%'} " ...}}} " " Ocaml/merlin "let g:opamshare = substitute(system('opam config var share'),'\n$','','''') "execute "set rtp+=" . g:opamshare . "/merlin/vim" "set rtp^="/home/lemon/.opam/4.06.1/share/ocp-indent/vim" " " Search from git root via :Rag (Root Ag) " Thanks! https://github.com/fortes/dotfiles/blob/7ba6ea651edde8fbc24fdf9df52ba06f7e956efc/stowed-files/nvim/.vimrc " :Rag - hidden preview enabled with "?" key " :Rag! - fullscreen and preview window above " Change to git root of current file (if in a repo) function! FindGitRootCD() let root = systemlist('git -C ' . expand('%:p:h') . ' rev-parse --show-toplevel')[0] if v:shell_error return '' else return {'dir': root} endif endfunction function! GitRootCD() let result = FindGitRootCD() if type(result) == type({}) execute 'lcd' fnameescape(result['dir']) echo 'Now in '.result['dir'] else echo 'Not in git repo!' endif endfunction command! GitRootCD :call GitRootCD() command! -bang -nargs=* Rag \ call GitRootCD() | call fzf#vim#ag(, \ 0 ? fzf#vim#with_preview('up:60%', '?') \ : fzf#vim#with_preview('right:50%:hidden', '?'), \ 0) " Use fuzzy searching for K & Q, select items to go into quickfix nnoremap L :Rag! vnoremap L :norm! gv"sy:silent! Rag! s nnoremap Q :Rag! "highlight ColorColumn ctermbg=0 highlight NonText cterm=NONE