" 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' Plug 'jiangmiao/auto-pairs' " Tab completion Plug 'ervandew/supertab' " EasyMotion Plug 'easymotion/vim-easymotion' Plug 'haya14busa/incsearch.vim' Plug 'haya14busa/incsearch-easymotion.vim' " Fuzzy search Plug 'junegunn/fzf.vim' " Remove extraneous whitespace when edit mode is exited Plug 'thirtythreeforty/lessspace.vim' " Status bar mods Plug 'vim-airline/vim-airline' " Manage Project sessions Plug 'thaerkh/vim-workspace' " Commenter Plug 'tpope/vim-commentary' " Theme Plug 'sickill/vim-monokai' Plug 'justinmk/vim-syntax-extra' Plug 'octol/vim-cpp-enhanced-highlight' " 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' " For git support Plug 'airblade/vim-gitgutter' Plug 'tpope/vim-fugitive' Plug 'junegunn/gv.vim' Plug 'rhysd/git-messenger.vim' Plug 'christoomey/vim-conflicted' Plug 'rbong/vim-flog' " For tmux yank Plug 'vim-utils/vim-husk' " Tags Plug 'sk1418/QFGrep' Plug 'steffanc/cscopemaps.vim', { 'for': 'c' } Plug 'deoplete-plugins/deoplete-tag' " 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 'ekmett/haskell-vim', { 'for': [ 'haskell', 'cabal' ] } Plug 'ndmitchell/ghcid', { 'rtp': 'plugins/nvim' } Plug 'Twinside/vim-hoogle', { 'for': 'haskell' } Plug 'hspec/hspec.vim' Plug 'zenzike/vim-haskell-unicode', { 'for': 'haskell' } " For Nix Plug 'LnL7/vim-nix', { 'for': 'nix' } " For autocompletion Plug 'Shougo/deoplete.nvim', { 'do': ':UpdateRemotePlugins' } " For Python Plug 'davidhalter/jedi-vim', { 'for': 'python' } Plug 'zchee/deoplete-jedi', { 'for': 'python' } Plug 'numirias/semshi', { 'for': 'python', 'do': ':UpdateRemotePlugins' } " Autocomplete for Rust Plug 'sebastianmarkow/deoplete-rust', { 'for': 'rust' } Plug 'cespare/vim-toml', { 'for': 'rust' } Plug 'rust-lang/rust.vim', { 'for': 'rust' } Plug 'mhinz/vim-crates' " Snippets Plug 'SirVer/ultisnips' Plug 'honza/vim-snippets' " Erlang Support Plug 'vim-erlang/vim-erlang-tags', { 'for': 'erlang' } Plug 'vim-erlang/vim-erlang-runtime', { 'for': 'erlang' } Plug 'vim-erlang/vim-erlang-omnicomplete', { 'for': 'erlang' } Plug 'vim-erlang/vim-erlang-compiler', { 'for': 'erlang' } " Purescript Plug 'purescript-contrib/purescript-vim', { 'for': 'purescript' } Plug 'frigoeu/psc-ide-vim', { 'for': 'purescript' } " Neo/Async stuff Plug 'sbdchd/neoformat' Plug 'neomake/neomake' " Miscellaneous Plug 'tpope/vim-surround' Plug 'tpope/vim-repeat' Plug 'tpope/vim-eunuch' Plug 'tpope/vim-sleuth' Plug 'tpope/vim-vinegar' Plug 'editorconfig/editorconfig-vim' Plug 'igankevich/mesonic' Plug 'stefandtw/quickfix-reflector.vim' Plug 'psliwka/vim-smoothie' Plug 'lifecrisis/vim-difforig' Plug 'dag/vim-fish' Plug 'pbrisbin/vim-syntax-shakespeare' Plug 'lifepillar/pgsql.vim' Plug 'mbbill/undotree' Plug 'milkypostman/vim-togglelist' Plug 'jpalardy/vim-slime' Plug 'liuchengxu/vim-which-key' Plug 'jceb/vim-orgmode' Plug 'wellle/targets.vim' Plug 'godlygeek/tabular' Plug 'Yggdroot/indentLine' Plug 'HiPhish/awk-ward.nvim' " 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=500 " 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 number " Show the line numbers on the left side. 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 softtabstop=4 " Finetunes the amount of white space to be added. set tabstop=4 " Render TABs using this many spaces. set shiftwidth=4 " Indentation amount for < and > commands. set smarttab " Indent with tabs, align with spaces. set expandtab " When on, uses space instead of tabs. 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 " 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 colorscheme monokai set background=dark " --------------------------- 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 ; for commands. nnoremap ; : " Use Q to execute default register. nnoremap Q " Smooth scroll nmap (SmoothieDownwards) nmap (SmoothieUpwards) nmap (SmoothieForwards) nmap (SmoothieBackwards) " 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 fch :History: nnoremap fsh :History/ nnoremap fm :Commands nnoremap fo :Locate nnoremap fk :Maps nnoremap f/ :Rg nnoremap * :exe ':Rg ' . expand('') " Quick buffer switching nnoremap b :ls:b " Undo tree nnoremap u :UndotreeToggle " Save nnoremap w :w " Search and Replace nnoremap sr :%s//g " Manage window splitting nnoremap sh :sp nnoremap sv :vsp " Quit nnoremap x :x nnoremap q :q nnoremap Q :qa " Navigate buffers nnoremap [b :bprevious nnoremap ]b :bnext nnoremap [B :bfirst nnoremap ]B :blast " Terminal nnoremap te :vsp :terminal nnoremap tc :SlimeConfig xmap ts SlimeRegionSend nmap ts SlimeParagraphSend " 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 gf :exe ':Ggrep ' . expand('') nnoremap gF :Ggrep nnoremap gg :GGrep " For gitgutter nnoremap ]h :GitGutterNextHunk nnoremap [h :GitGutterPrevHunk nnoremap us :GitGutterStageHunk nnoremap ud :GitGutterUndoHunk nnoremap ur :GitGutterPreviewHunk nnoremap uq :GitGutterQuickFix nnoremap uf :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 " 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 map :vsp :exec("tag ".expand("")) map :sp :exec("tag ".expand("")) " Tabular helpers vmap a= :Tabularize /= vmap a; :Tabularize /:: vmap a- :Tabularize /-> vmap a: :Tabularize /:r1c1l0 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! au FileType haskell nmap t :NeomakeSh stack exec -- fast-tags -R . 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 setlocal keywordprg=:Hoogle augroup END augroup purescript_maps au! au FileType purescript nmap L :Plist au FileType purescript nmap l :Pload au FileType purescript nmap r :Prebuild au FileType purescript nmap f :PaddClause au FileType purescript nmap T :PaddType au FileType purescript nmap a :Papply au FileType purescript nmap c :Pcase au FileType purescript nmap i :Pimport au FileType purescript nmap q :PaddImportQualifications au FileType purescript nmap g :Pgoto au FileType purescript nmap p :Pursuit au FileType purescript nmap t :Ptype au FileType purescript au BufWritePost Prebuild au FileType purescript setlocal keywordprg=:Pursuit 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 :call Cscope('0', expand('')) au FileType c nmap g :call Cscope('1', expand('')) au FileType c nmap d :call Cscope('2', expand('')) au FileType c nmap c :call Cscope('3', expand('')) au FileType c nmap t :call Cscope('4', expand('')) au FileType c nmap e :call Cscope('6', expand('')) au FileType c nmap f :call Cscope('7', expand('')) au FileType c nmap i :call Cscope('8', expand('')) au FileType c nmap a :call Cscope('9', expand('')) au FileType c nmap s :call CscopeQuery('0') au FileType c nmap g :call CscopeQuery('1') au FileType c nmap d :call CscopeQuery('2') au FileType c nmap c :call CscopeQuery('3') au FileType c nmap t :call CscopeQuery('4') au FileType c nmap e :call CscopeQuery('6') au FileType c nmap f :call CscopeQuery('7') au FileType c nmap i :call CscopeQuery('8') au FileType c nmap a :call CscopeQuery('9') augroup END augroup rust_maps au! au FileType rust nmap gd DeopleteRustGoToDefinitionDefault au FileType rust nmap K DeopleteRustShowDocumentation au FileType rust nmap gv DeopleteRustGoToDefinitionVSplit au FileType rust nmap g- DeopleteRustGoToDefinitionSplit au FileType rust nmap gt DeopleteRustGoToDefinitionTab " 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 " Close QF window if it is last window augroup quickfix_close au! au WinEnter * if winnr('$') == 1 && &buftype == "quickfix"|q|endif augroup END augroup terminal_job au! au TermOpen * setlocal statusline=%{b:terminal_job_id} augroup END augroup indentation_defaults au! au BufRead,BufNewFile *.c set noexpandtab au BufRead,BufNewFile *.h set noexpandtab au BufRead,BufNewFile Makefile* set noexpandtab au BufNewFile,BufRead *.vim setlocal noet ts=4 sw=4 sts=4 au BufNewFile,BufRead *.txt setlocal noet ts=4 sw=4 au BufNewFile,BufRead *.lua setlocal noet ts=4 sw=4 sts=4 au BufNewFile,BufRead *.py setlocal tabstop=4 softtabstop=4 shiftwidth=4 textwidth=80 smarttab expandtab au BufRead,BufNewFile */gst-*/*.[ch] set et sw=2 au BufRead,BufNewFile */gstreamer-*/*.[ch] set et sw=2 au BufRead,BufNewFile */pulseaudio/*.[ch] set et sw=4 tw=128 au BufRead,BufNewFile *.purs set et sw=2 sts=2 si au FileType fstab,systemd set noexpandtab au FileType gitconfig,sh,toml set noexpandtab augroup END augroup spell_check au! autocmd FileType gitcommit setlocal spell textwidth=72 autocmd BufRead,BufNewFile *.md,*.txt setlocal spell augroup END " Automatically resize the window autocmd VimResized * wincmd = " --------------------------- 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 let g:ghcid_command = 'stack exec -- ghcid' let g:hoogle_search_bin = 'stack exec -- hoogle' let g:hoogle_search_count = 30 " Use deoplete let g:deoplete#enable_at_startup = 1 let g:deoplete#sources = {} call deoplete#custom#source('_', \ 'disabled_syntaxes', ['Comment', 'String']) call deoplete#custom#option('sources', { \ '_' : ['buffer', 'tag', 'around', 'file', 'member'], \ 'rust': ['racer'], \ 'purescript': ['buffer', 'omni'], \}) call deoplete#custom#source('omni', 'functions', { \ 'purescript': 'PSCIDEComplete', \}) call deoplete#custom#var('omni', 'input_patterns', { \ 'purescript': '\w*', \}) call deoplete#custom#option({ \ 'auto_complete_delay': 200, \ 'auto_complete': v:true, \ 'smart_case': v:true, \ }) let g:deoplete#sources#rust#disable_keymap = 1 let g:deoplete#sources#rust#racer_binary=expand('$HOME/.cargo/bin/racer') let g:deoplete#sources#rust#rust_source_path=expand('$HOME/GitSources/rust/src') let g:rustfmt_autosave = 1 " 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 " compile when I open a file, change text, leave insert mode, etc ... call neomake#configure#automake({ \ 'TextChanged': {}, \ 'InsertLeave': {}, \ 'BufWritePost': {}, \ }) " 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 " Additional trigger not required with deoplete let g:tmuxcomplete#trigger = '' " Required for vimtex let g:vimtex_compiler_progname = 'nvr' " Fix deoplete's tab behaviour 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 " Slime let g:slime_target = "neovim" let g:slime_no_mappings = 1 let g:slime_python_ipython = 1 let g:slime_dont_ask_default = 1 let g:slime_preserve_curpos = 0 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 let g:UltiSnipsExpandTrigger="" let g:UltiSnipsJumpForwardTrigger="" let g:UltiSnipsJumpBackwardTrigger="" let g:UltiSnipsEditSplit="vertical" let g:jedi#goto_command = "gt" let g:jedi#goto_assignments_command = "ga" let g:jedi#goto_definitions_command = "gd" let g:jedi#documentation_command = "K" let g:jedi#usages_command = "gu" let g:jedi#completions_command = "" let g:jedi#rename_command = "gr" let g:jedi#auto_initialization = 1 let g:jedi#auto_vim_configuration = 0 let g:jedi#use_tabs_not_buffers = 1 let g:jedi#popup_on_dot = 1 let g:jedi#popup_select_first = 0 let g:jedi#smart_auto_mappings = 0 let g:jedi#show_call_signatures = "1" let g:jedi#show_call_signatures_delay = 0 let g:jedi#show_call_signatures_modes = 'i' let g:jedi#enable_speed_debugging = 0 let g:jedi#completions_enabled = 0 " For SLIMV let g:lisp_rainbow=1 " For Purescript let g:psc_ide_auto_imports = 1 " For vim-smoothie. We want to Shift instead of Ctrl for scroll. let g:smoothie_no_default_mappings = 1 " ----------------------------- Functions ------------------------------------ function! Cscope(option, query) let color = '{ x = $1; $1 = ""; z = $3; $3 = ""; printf "\033[34m%s\033[0m:\033[31m%s\033[0m\011\033[37m%s\033[0m\n", x,z,$0; }' let opts = { \ 'source': "cscope -dL" . a:option . " " . a:query . " | awk '" . color . "'", \ 'options': ['--ansi', '--prompt', '> ', \ '--multi', '--bind', 'alt-a:select-all,alt-d:deselect-all', \ '--color', 'info:144,prompt:161,spinner:135,pointer:135,marker:118', \ '--color', 'fg:252,bg:233,hl:67,fg+:252,bg+:235,hl+:81'], \ 'down': '40%' \ } function! opts.sink(lines) let data = split(a:lines) let file = split(data[0], ":") execute 'e ' . '+' . file[1] . ' ' . file[0] endfunction call fzf#run(opts) endfunction function! CscopeQuery(option) call inputsave() if a:option == '0' let query = input('C Symbol: ') elseif a:option == '1' let query = input('Definition: ') elseif a:option == '2' let query = input('Functions called by: ') elseif a:option == '3' let query = input('Functions calling: ') elseif a:option == '4' let query = input('Text: ') elseif a:option == '6' let query = input('Egrep: ') elseif a:option == '7' let query = input('File: ') elseif a:option == '8' let query = input('Files #including: ') elseif a:option == '9' let query = input('Assignments to: ') else echo "Invalid option!" return endif call inputrestore() if query != "" call Cscope(a:option, query) else echom "Cancelled Search!" endif endfunction function! NvimGdbNoTKeymaps() tnoremap endfunction let $FZF_DEFAULT_OPTS='--layout=reverse' let g:fzf_layout = { 'window': 'call FloatingFZF()' } function! FloatingFZF() let buf = nvim_create_buf(v:false, v:true) let height = float2nr(&lines * 0.4) let width = float2nr(&columns * 0.8) let horizontal = float2nr((&columns - width) / 2) let vertical = float2nr((&columns - width) / 2) let opts = { \ 'relative': 'editor', \ 'row': vertical, \ 'col': horizontal, \ 'width': width, \ 'height': height \ } " open the new window, floating, and enter to it call nvim_open_win(buf, v:true, opts) 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