" Specify a directory for plugins (for Neovim: ~/.local/share/nvim/plugged) call plug#begin('~/.config/nvim/plugged') " ----------------------------- Plugins -------------------------------------- " Automatically match structures as you type Plug 'tpope/vim-endwise' " Tab completion Plug 'ervandew/supertab' " EasyMotion Plug 'easymotion/vim-easymotion' Plug 'haya14busa/incsearch.vim' Plug 'haya14busa/incsearch-easymotion.vim' Plug 'unblevable/quick-scope' " Fuzzy search Plug 'junegunn/fzf.vim' Plug 'pbogut/fzf-mru.vim' " Remove extraneous whitespace when edit mode is exited Plug 'axelf4/vim-strip-trailing-whitespace' " Status bar mods Plug 'vim-airline/vim-airline' " Manage Project sessions Plug 'thaerkh/vim-workspace' " Commenter Plug 'tpope/vim-commentary' " Theme Plug 'sainnhe/sonokai' " Syntax highlighting Plug 'sheerun/vim-polyglot' " Autoload and read from dish if file changes Plug 'tmux-plugins/vim-tmux-focus-events' Plug 'wellle/tmux-complete.vim' " For LaTeX support Plug 'lervag/vimtex' " Primary git support Plug 'tpope/vim-fugitive' " Manage git hunks Plug 'airblade/vim-gitgutter' " Git blame Plug 'rhysd/git-messenger.vim' " Git logs Plug 'rbong/vim-flog' " Handle merge conflicts Plug 'samoshkin/vim-mergetool' " For tmux yank Plug 'vim-utils/vim-husk' " GDB Plug 'sakhnik/nvim-gdb', { 'do': ':UpdateRemotePlugins' } " Lisp Plug 'guns/vim-sexp', { 'for': [ 'scheme', 'lisp', 'clojure' ] } Plug 'tpope/vim-sexp-mappings-for-regular-people', { 'for': [ 'scheme', 'lisp', 'clojure' ] } Plug 'junegunn/rainbow_parentheses.vim', { 'for': [ 'scheme', 'lisp', 'clojure' ] } Plug 'kovisoft/slimv', { 'for': [ 'scheme', 'lisp', 'clojure' ] } " Haskell Plug 'ndmitchell/ghcid', { 'rtp': 'plugins/nvim' } Plug 'Twinside/vim-hoogle', { 'for': 'haskell' } Plug 'hspec/hspec.vim' Plug 'pbrisbin/vim-syntax-shakespeare' Plug 'zenzike/vim-haskell-unicode', { 'for': 'haskell' } Plug 'godlygeek/tabular' " For autocompletion Plug 'prabirshrestha/asyncomplete.vim' Plug 'prabirshrestha/asyncomplete-buffer.vim' Plug 'prabirshrestha/asyncomplete-file.vim' Plug 'prabirshrestha/asyncomplete-tags.vim' " Rust Plug 'mhinz/vim-crates' " Erlang Support Plug 'vim-erlang/vim-erlang-tags', { 'for': 'erlang' } Plug 'vim-erlang/vim-erlang-omnicomplete', { 'for': 'erlang' } Plug 'vim-erlang/vim-erlang-compiler', { 'for': 'erlang' } " Neo/Async stuff Plug 'sbdchd/neoformat' Plug 'neomake/neomake' " Quickfix Plug 'sk1418/QFGrep' Plug 'ronakg/quickr-cscope.vim' Plug 'stefandtw/quickfix-reflector.vim' " Text Object plugins Plug 'kana/vim-textobj-user' Plug 'danidiaz/vim-textobj-do-block' Plug 'michaeljsmith/vim-indent-object' Plug 'wellle/targets.vim' Plug 'tpope/vim-surround' Plug 'junegunn/vim-easy-align' " Absolute essentials miscellaneous Plug 'tpope/vim-repeat' Plug 'tpope/vim-eunuch' Plug 'tpope/vim-sleuth' Plug 'tpope/vim-vinegar' Plug 'Yggdroot/indentLine' " LC related Plug 'liuchengxu/vista.vim' Plug 'prabirshrestha/async.vim' Plug 'prabirshrestha/vim-lsp' Plug 'prabirshrestha/asyncomplete-lsp.vim' " Miscellaneous Plug 'editorconfig/editorconfig-vim' Plug 'igankevich/mesonic' Plug 'psliwka/vim-smoothie' Plug 'simnalamburt/vim-mundo' Plug 'milkypostman/vim-togglelist' Plug 'liuchengxu/vim-which-key' Plug 'farmergreg/vim-lastplace' Plug 'voldikss/vim-floaterm' Plug 'pechorin/any-jump.nvim' Plug 'camspiers/animate.vim' Plug 'camspiers/lens.vim' " Initialize plugin system call plug#end() " ----------------------------- Settings ------------------------------------- " Set up leaders let mapleader="\" let maplocalleader="," set colorcolumn=80 " Highlight 80th column set laststatus=2 " Always show status bar set updatetime=300 " Let plugins show effects after 500ms set mouse-=a " Disable mouse click to go to position set encoding=utf-8 set exrc " Allow loading local .nvimrc files set secure " Disallow use of autocmd, shell and write in local rc set showcmd " Show (partial) command in status line. set showmatch " Show matching brackets. set ruler " Show the line and column numbers of the cursor. set formatoptions+=o " Continue comment marker in new lines. set formatoptions+=j " Delete comment character when joining commented lines set textwidth=78 " Hard-wrap long lines as you type them. set autoindent " Copy indent from current line when starting a new line set noerrorbells " No beeps. set modeline " Enable modeline. set linespace=0 " Set line-spacing to minimum. set nojoinspaces " Prevents inserting two spaces after punctuation on a join (J) set noshowmode " Because of neovim's cursor shape set splitbelow " Horizontal split below current. set splitright " Vertical split to right of current. set nobackup " no backup files set nowritebackup " only in case you don't want a backup file while editing set noswapfile " no swap files set foldmethod=syntax " Create folds based on files syntax set nofoldenable " Open folds by default set undofile " Enable undo persistence across sessions set hidden " Required by LC set noautochdir " Wild menu set wildmenu set wildmode=list:longest,full set wildoptions=pum set pumblend=30 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 " compiled object files set wildignore+=*.sw? " Vim swap files set wildignore+=*.luac " Lua byte code set wildignore+=*.pyc " Python byte code set wildignore+=*.orig " Merge resolution files if !&scrolloff set scrolloff=3 " Show next 3 lines while scrolling. endif if !&sidescrolloff set sidescrolloff=5 " Show next 5 columns while side-scrolling. endif set nostartofline " Do not jump to first character with page commands. set ignorecase " Make searching case insensitive set smartcase " ... unless the query has capital letters. set magic " Use 'magic' patterns (extended regular expressions). set autoread " Autoload file if it changes on disk set termguicolors " Enable colors for terminal set fileformat=unix set inccommand=split set clipboard^=unnamed,unnamedplus set backspace=indent,eol,start set completeopt=menu,noselect,preview,noinsert " Required for vim-workspace " See https://github.com/thaerkh/vim-workspace/issues/11 set sessionoptions-=blank " Theme let g:sonokai_style = 'atlantis' let g:sonokai_enable_italic = 1 let g:sonokai_disable_italic_comment = 1 colorscheme sonokai " --------------------------- Key Bindings ----------------------------------- " Use to clear the highlighting of :set hlsearch. if maparg('', 'n') ==# '' nnoremap :nohlsearch endif " Remap escape keys to something usable on home row inoremap jk cnoremap jk inoremap cnoremap " Use Q to execute default register. nnoremap Q " For Fuzzy nnoremap ff :GFiles nnoremap f? :GFiles? nnoremap fF :Files nnoremap fb :Buffers nnoremap fL :Lines nnoremap fl :BLines nnoremap ft :BTags nnoremap fT :Tags nnoremap fc :BCommits nnoremap fC :Commits nnoremap fh :History: nnoremap fH :History/ nnoremap fm :Commands nnoremap fo :Locate nnoremap fk :Maps nnoremap fr :FZFMru nnoremap f/ :Rg nnoremap fs :exe ':Rg ' . expand('') imap (fzf-complete-word) imap (fzf-complete-path) imap (fzf-complete-file) imap (fzf-complete-line) " Undo tree nnoremap u :MundoToggle " Save nnoremap w :w " Search and Replace nnoremap sr :%s//g nnoremap sr :%s/\<\>//g " Quit nnoremap x :x nnoremap q :q nnoremap Q :qa " Navigate buffers nnoremap [b :bprevious nnoremap ]b :bnext nnoremap [B :bfirst nnoremap ]B :blast " For floating terminal nnoremap se :FloatermNew nnoremap [s :FloatermPrev nnoremap ]s :FloatermNext nnoremap st :FloatermToggle " For git nnoremap gm :GitMessenger nnoremap gl :0Glog nnoremap gL :Glog nnoremap gd :Gdiff nnoremap gD :Gdiffsplit nnoremap gs :Gstatus nnoremap gc :Gcommit -v -q --signoff nnoremap gt :Gcommit -v -q --signoff %:p nnoremap gp :Git push nnoremap gu :Git push -u nnoremap gr :Git remote -v nnoremap gb :Git branch nnoremap go :Git checkout nnoremap g- :Git stash:e nnoremap g+ :Git stash pop:e nnoremap gG :exe ':Ggrep ' . expand('') nnoremap gF :Ggrep nnoremap gg :GGrep nnoremap ml :MergetoolDiffExchangeLeft nnoremap mr :MergetoolDiffExchangeRight nnoremap mu :MergetoolDiffExchangeUp nnoremap md :MergetoolDiffExchangeDown nnoremap mg :diffget nnoremap mp :diffput " For gitgutter nnoremap ]h :GitGutterNextHunk nnoremap [h :GitGutterPrevHunk nnoremap sh :GitGutterStageHunk nnoremap uh :GitGutterUndoHunk nnoremap ph :GitGutterPreviewHunk nnoremap qh :GitGutterQuickFix nnoremap gf :GitGutterFold " For Neomake/Neoformat nnoremap nm :Neomake nnoremap nc :NeomakeClean nnoremap ns :NeomakeSh nnoremap njl :NeomakeListJobs nnoremap nja :NeomakeCancelJobs nnoremap njc :NeomakeCancelJob nnoremap nf :Neoformat nnoremap ne :NeomakeEnable nnoremap nd :NeomakeDisable " For workspace nnoremap ws :ToggleWorkspace " Quickfix & Location list mappings nnoremap qo :copen nnoremap qc :cclose nnoremap [q :cprevious nnoremap ]q :cnext nnoremap [Q :cfirst nnoremap ]Q :clast nnoremap qs :vimgrep nnoremap qt :call ToggleQuickfixList() nnoremap Lo :lopen nnoremap Lc :lclose nnoremap [l :lprevious nnoremap ]l :lnext nnoremap [L :lfirst nnoremap ]L :llast nnoremap Ls :lvimgrep nnoremap Lt :call ToggleLocationList() " Key Bindings to help with terminal mode :tnoremap jk " Key bindings to move between window splits nnoremap gh h nnoremap gj j nnoremap gk k nnoremap gl l " Disable Arrow Keys inoremap inoremap inoremap inoremap noremap noremap noremap noremap " Whick key nnoremap :WhichKey '' nnoremap :WhichKey ',' " Bindings for easy motion " Character motions map c (easymotion-bd-f) nmap c (easymotion-overwin-f) " Line motions map L (easymotion-bd-jk) nmap L (easymotion-overwin-line) " Word motions map w (easymotion-bd-w) nmap w (easymotion-overwin-w) " Line motion jump map l (easymotion-lineforward) map j (easymotion-j) map k (easymotion-k) map h (easymotion-linebackward) " Incremental search + easymotion noremap / incsearch#go(incsearch_config()) noremap ? incsearch#go(incsearch_config({'command': '?'})) noremap g/ incsearch#go(incsearch_config({'is_stay': 1})) " Tag helpers nnoremap :vsp :exec("tag ".expand("")) nnoremap :sp :exec("tag ".expand("")) " Tabular helpers vnoremap = :Tabularize /= vnoremap - :Tabularize /-> vnoremap < :Tabularize /<- vnoremap , :Tabularize /, vnoremap # :Tabularize /#-} vnoremap : :Tabularize /:: vnoremap [ :Tabularize /[ " Any jump nnoremap aj :AnyJump nnoremap ab :AnyJumpBack nnoremap al :AnyJumpLastResults " Start interactive EasyAlign in visual mode (e.g. vipga) xmap ga (EasyAlign) " Start interactive EasyAlign for a motion/text object (e.g. gaip) nmap ga (EasyAlign) command! -bang -nargs=* GGrep \ call fzf#vim#grep( \ 'git grep --line-number '.shellescape(), 0, \ fzf#vim#with_preview({'dir': systemlist('git rev-parse --show-toplevel')[0]}), 0) " --------------------------- Autocmd groups --------------------------------- augroup vimplug_maps au! au FileType vim nmap pg :PlugUpgrade au FileType vim nmap pd :PlugUpdate au FileType vim nmap pc :PlugClean au FileType vim nmap pr :so % augroup END augroup haskell_maps au! " https://www.reddit.com/r/neovim/comments/es8wn7/haskell_makeprg_for_stack_build/ " https://github.com/maxigit/vimrc/tree/2020/compiler au FileType haskell compiler stack au FileType haskell setlocal makeprg=stack\ build au FileType haskell setlocal keywordprg=:Hoogle au FileType haskell nmap b :Neomake! au FileType haskell nmap t :NeomakeSh stack exec -- hasktags -x -c . au FileType haskell nmap g :Ghcid au FileType haskell nmap k :GhcidKill au FileType haskell nmap c :HoogleClose au FileType haskell nmap o :exe ':Hoogle ' . expand('') au FileType haskell nmap i :exe ':HoogleInfo ' . expand('') au FileType haskell nnoremap ]] :call JumpHaskellFunction(0) au FileType haskell nnoremap [[ :call JumpHaskellFunction(1) au FileType haskell inoremap ;; :call MakeArrow(1) au FileType haskell inoremap ;: :call MakeArrow(0) augroup END augroup c_maps au! au FileType c nmap ct :NeomakeSh ctags -R . au FileType c nmap cu :NeomakeSh cscope -bqR au FileType c nmap cr :cs reset au FileType c nmap s (quickr_cscope_symbols) au FileType c nmap g (quickr_cscope_global) au FileType c nmap h (quickr_cscope_global_split) au FileType c nmap v (quickr_cscope_global_vert_split) au FileType c nmap d (quickr_cscope_functions) au FileType c nmap c (quickr_cscope_callers) au FileType c nmap t (quickr_cscope_text) au FileType c nmap e (quickr_cscope_egrep) au FileType c nmap f (quickr_cscope_files) au FileType c nmap i (quickr_cscope_includes) au FileType c nmap a (quickr_cscope_assignments) augroup END augroup rust_maps au! " Taken from http://seenaburns.com/vim-setup-for-rust/ " Neomake " Gross hack to stop Neomake running when exitting because it creates a zombie cargo check process " which holds the lock and never exits. But then, if you only have QuitPre, closing one pane will " disable neomake, so BufEnter reenables when you enter another buffer. let s:quitting = 0 au FileType rust au QuitPre let s:quitting = 1 au FileType rust au BufEnter let s:quitting = 0 au FileType rust au BufWritePost if ! s:quitting | Neomake | else | echom "Neomake disabled" | endif augroup END augroup rainbow_lisp autocmd! autocmd FileType lisp,clojure,scheme RainbowParentheses augroup END " Toggles search highlighting off/on according to current mode. Source: http://blog.sanctum.geek.nz/vim-search-highlighting/ augroup toggle_search autocmd! autocmd InsertEnter * setlocal nohlsearch autocmd InsertLeave * setlocal hlsearch augroup END augroup quickfix au! " Close QF window if it is last window au WinEnter * if winnr('$') == 1 && &buftype == "quickfix"|q|endif " Existing bindings for QFGrep " g input pattern to do further filtering " v input pattern to do further inverted filtering " r restore the Quickfix/location list with original entries augroup END augroup terminal_job au! au TermOpen * startinsert au TermOpen * setlocal listchars= nonumber norelativenumber augroup END augroup spell_check au! autocmd FileType gitcommit setlocal spell textwidth=72 autocmd BufRead,BufNewFile *.md,*.txt setlocal spell augroup END augroup ResizeWindowsProportionally au! autocmd VimResized * :wincmd = augroup END augroup LSP au! nnoremap le :call lsp#enable() nnoremap ld :call lsp#disable() nnoremap lh :LspStopServer() nnoremap ls :LspStatus au User lsp_server_init call s:on_lsp_server_init() augroup END augroup VimLspSettings au! if executable('pyls') au User lsp_setup call lsp#register_server({ \ 'name': 'pyls', \ 'cmd': {server_info->['pyls']}, \ 'whitelist': ['python'], \ }) endif if executable('ra_lsp_server') au User lsp_setup call lsp#register_server({ \ 'name': 'ra_lsp_server', \ 'cmd': {server_info->['ra_lsp_server']}, \ 'whitelist': ['rust'], \ }) endif if executable('purescript-language-server') au User lsp_setup call lsp#register_server({ \ 'name': 'purescript-language-server', \ 'cmd': {server_info->['purescript-language-server', '--stdio']}, \ 'whitelist': ['purescript'], \ }) endif if executable('ghcide') au User lsp_setup call lsp#register_server({ \ 'name': 'ghcide', \ 'cmd': {server_info->['ghcide', '--lsp']}, \ 'whitelist': ['haskell'], \ }) endif augroup END augroup AsyncCompleteSetup au! au User asyncomplete_setup call asyncomplete#register_source(asyncomplete#sources#tags#get_source_options({ \ 'name': 'tags', \ 'whitelist': ['c', 'haskell'], \ 'completor': function('asyncomplete#sources#tags#completor'), \ })) au User asyncomplete_setup call asyncomplete#register_source(asyncomplete#sources#buffer#get_source_options({ \ 'name': 'buffer', \ 'whitelist': ['*'], \ 'blacklist': ['go'], \ 'completor': function('asyncomplete#sources#buffer#completor'), \ 'config': { \ 'max_buffer_size': 5000000, \ }, \ })) au User asyncomplete_setup call asyncomplete#register_source(asyncomplete#sources#file#get_source_options({ \ 'name': 'file', \ 'whitelist': ['*'], \ 'priority': 10, \ 'completor': function('asyncomplete#sources#file#completor') \ })) augroup END " --------------------------- Plugin settings -------------------------------- 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_classic_highlighting = 0 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 let g:haskell_indent_case_alternative = 1 let g:cabal_indent_section = 2 " Either check empty($IN_NIX_SHELL) for nix specific or executable('ghcid') if executable('ghcid') let g:ghcid_command = 'ghcid' else let g:ghcid_command = 'stack exec -- ghcid' endif if executable('hoogle') let g:hoogle_search_bin = 'hoogle' else let g:hoogle_search_bin = 'stack exec -- hoogle' endif let g:hoogle_search_count = 30 " Use airline let g:airline#extensions#tabline#enabled = 1 let g:airline#extensions#tabline#fnamemod = ':t' let g:airline#extensions#tabline#left_sep = ' ' let g:airline#extensions#tabline#left_alt_sep = '|' let g:airline#extensions#tabline#right_sep = ' ' let g:airline#extensions#tabline#right_alt_sep = '|' let g:airline#extensions#tabline#formatter = 'default' let g:airline_left_sep = ' ' let g:airline_left_alt_sep = '|' let g:airline_right_sep = ' ' let g:airline_right_alt_sep = '|' let g:airline#extensions#tabline#buffer_nr_show = 1 " Let vim-gitgutter do its thing on large files let g:gitgutter_max_signs=1000 let g:gitgutter_map_keys = 0 let g:gitgutter_highlight_linenrs = 1 let g:gitgutter_preview_win_floating = 1 let g:gitgutter_use_location_list = 1 let g:gitgutter_sign_added = '+a' let g:gitgutter_sign_modified = '+m' let g:gitgutter_sign_removed = '-r' let g:gitgutter_sign_removed_first_line = '^^' let g:gitgutter_sign_modified_removed = 'mr' " Neomake " When compilation is done, open the Location list or quickfix list " Value of 2 preserves cursor position let g:neomake_open_list = 2 let g:neomake_warning_sign = {'text': '?'} let g:neomake_c_enabled_makers = ['gcc'] let g:neomake_c_gcc_maker = { \ 'exe': 'gcc', \ 'args': ['-Wall', '-Iinclude', '-Wextra', '-Weverything', '-pedantic', '-Wno-sign-conversion'], \ } " Automatically detect style file and apply style to formatting let g:clang_format#detect_style_file = 1 " Fix tab behaviour while switching through completion options let g:SuperTabDefaultCompletionType = "" " For workspace let g:workspace_session_directory = $HOME . '/.vim/session/' let g:workspace_undodir = $HOME . '/.vim/undodir' let g:workspace_autosave = 0 let g:workspace_autosave_ignore = ['gitcommit', 'qf', 'tagbar'] let g:workspace_session_disable_on_args = 1 " Toggle quickfix/location list let g:toggle_list_no_mappings = 1 let g:nvimgdb_config_override = { \ 'key_next': 'n', \ 'key_step': 's', \ 'key_finish': 'f', \ 'key_continue': 'c', \ 'key_until': 'u', \ 'key_breakpoint': 'b', \ 'set_tkeymaps': "NvimGdbNoTKeymaps", \ } let g:mapleader = "\" let g:maplocalleader = ',' let g:which_key_use_floating_win = 1 let g:cpp_class_scope_highlight = 1 let g:cpp_member_variable_highlight = 1 let g:cpp_class_decl_highlight = 1 let g:cpp_posix_standard = 1 let g:cpp_concepts_highlight = 1 " For SLIMV let g:lisp_rainbow=1 " FZF let g:fzf_mru_no_sort = 1 let $FZF_DEFAULT_OPTS='--layout=reverse' let g:fzf_layout = { 'window': 'call CreateCentredFloatingWindow()' } " Quickr let g:quickr_cscope_keymaps = 0 " LSP let g:lsp_diagnostics_enabled = 1 let g:lsp_signs_enabled = 1 let g:lsp_diagnostics_echo_cursor = 1 let g:lsp_highlight_references_enabled = 1 let g:lsp_auto_enable = 0 " Vista let g:vista_executive_for = { \ 'c': 'ctags', \ 'haskell': 'vim_lsp', \ 'rust': 'vim_lsp', \ 'purescript': 'vim_lsp', \ 'python': 'vim_lsp', \ } let g:vista_ctags_cmd = { \ 'haskell': 'stack exec -- hasktags -x -o - -c .', \ } " Allow nightfly theme to set indentline colors let g:indentLine_setColors = 0 " Disable providers we do not give a shit about let g:loaded_python_provider = 0 let g:loaded_python3_provider = 0 let g:loaded_ruby_provider = 0 let g:loaded_perl_provider = 0 let g:loaded_node_provider = 0 " Mergetool let g:mergetool_layout = 'mr' let g:mergetool_prefer_revision = 'unmodified' " Floaterm let g:floaterm_open_in_root = 0 let g:floaterm_position = 'center' let g:floaterm_width = 0.8 let g:floaterm_height = 0.8 let g:floaterm_winblend = 0 let g:floaterm_borderchars = ['─', '│', '─', '│', '╭', '╮', '╯', '╰'] " Any jump let g:any_jump_disable_default_keybindings = v:true " Lens vim let g:lens#disabled_filetypes = ['nerdtree', 'fzf', 'qf'] " ----------------------------- Functions ------------------------------------ function! NvimGdbNoTKeymaps() tnoremap endfunction " Stolen from https://github.com/camspiers/dotfiles/blob/master/files/.config/nvim/init.vim function! CreateCentredFloatingWindow() let width = float2nr(&columns * 0.8) let height = float2nr(&lines * 0.4) let top = ((&lines - height) / 2) - 1 let left = (&columns - width) / 2 let opts = {'relative': 'editor', 'row': top, 'col': left, 'width': width, 'height': height, 'style': 'minimal'} let top = "╭" . repeat("─", width - 2) . "╮" let mid = "│" . repeat(" ", width - 2) . "│" let bot = "╰" . repeat("─", width - 2) . "╯" let lines = [top] + repeat([mid], height - 2) + [bot] let s:buf = nvim_create_buf(v:false, v:true) call nvim_buf_set_lines(s:buf, 0, -1, v:true, lines) call nvim_open_win(s:buf, v:true, opts) set winhl=Normal:Floating let opts.row += 1 let opts.height -= 2 let opts.col += 2 let opts.width -= 4 call nvim_open_win(nvim_create_buf(v:false, v:true), v:true, opts) au BufWipeout exe 'bw '.s:buf endfunction function! s:incsearch_config(...) abort return incsearch#util#deepextend(deepcopy({ \ 'modules': [incsearch#config#easymotion#module({'overwin': 1})], \ 'keymap': { \ "\": '(easymotion)' \ }, \ 'is_expr': 0 \ }), get(a:, 1, {})) endfunction function! JumpHaskellFunction(reverse) call search('\C[[:alnum:]]*\s*::', a:reverse ? 'bW' : 'W') endfunction function! MakeArrow(type) if a:type if (matchstr(getline('.'), '\%' . col('.') . 'c.') ==? ' ') exe "norm! a-> " else exe "norm! a -> " endif exe "startreplace" else if (matchstr(getline('.'), '\%' . col('.') . 'c.') ==? ' ') exe "norm! a=> " else exe "norm! a => " endif exe "startreplace" endif endfunction function! s:on_lsp_server_init() abort setlocal omnifunc=lsp#complete setlocal signcolumn=yes " Always expected to work nmap gd :LspDefinition nmap gpd :LspPeekDefinition nmap gk :LspHover " May or may not be available depending on language server nmap gx :LspReferences nmap gr :LspRename nmap ca :LspCodeAction nmap dd :LspDocumentDiagnostics nmap df :LspDocumentFormat nmap rf :LspDocumentRangeFormat nmap ds :LspDocumentSymbol nmap di :LspImplementation nmap nd :LspNextDiagnostic nmap pd :LspPreviousDiagnostic nmap ne :LspNextError nmap pe :LspPreviousError nmap nr :LspNextReference nmap pr :LspPreviousReference nmap nw :LspNextWarning nmap pw :LspPreviousWarning nmap dt :LspTypeDefinition nmap td :LspPeekTypeDefinition nmap pi :LspPeekImplementation endfunction