From 756e45e0373cfd3857a3462b7e3e12a44cdf0eac Mon Sep 17 00:00:00 2001 From: Marty Oehme Date: Mon, 3 Feb 2020 22:16:23 +0100 Subject: [PATCH] Reorganize vim plugin settings Setting everything during PlugLoad function caused some plugins to misbehave. Plugins are now loaded by Plug and their settings can be either set with a file in the plugin directory (this mimicks the old way of setting plugin up during load) or in after/ directory, which sets options *after* everything has loaded. --- nvim/.config/nvim/init.vim | 55 +++++++++++- .../modules_experimental/academia_pandoc.vim | 39 ++++++++- nvim/.config/nvim/plugin/after/deoplete.vim | 15 ++++ nvim/.config/nvim/plugin/after/echodoc.vim | 6 ++ .../after/lazyload_ale_deoplete_echodoc.vim | 21 +++++ nvim/.config/nvim/plugin/after/prose.vim | 20 +++++ .../nvim/plugin/after/vim-pandoc-syntax.vim | 3 + .../latex.vim => plugin/after/vim-pandoc.vim} | 10 +-- nvim/.config/nvim/plugin/airline.vim | 7 ++ nvim/.config/nvim/plugin/ale.vim | 26 ++++++ .../.config/nvim/plugin/colorschemes-font.vim | 4 + nvim/.config/nvim/plugin/fzf.vim | 34 ++++++++ nvim/.config/nvim/plugin/goyo.vim | 21 +++++ nvim/.config/nvim/plugin/nerdtree.vim | 19 ++++ .../nvim/plugin/notational-fzf-vim.vim | 8 ++ .../nvim/plugin/{ => personal}/bibcite.vim | 0 .../plugin/{ => personal}/searchnotes.vim | 0 .../plugin/{ => personal}/showmappings.vim | 0 nvim/.config/nvim/plugin/tmuxline.vim | 12 +++ .../syntaxes.vim => plugin/vim-go.vim} | 8 -- nvim/.config/nvim/plugin/vim-pencil.vim | 4 + nvim/.config/nvim/plugin/vim-sneak.vim | 7 ++ .../nvim/plugin/vim-tmux-navigator.vim | 4 + .../{pluglist/notes.vim => plugin/wiki.vim} | 10 +-- nvim/.config/nvim/pluglist/base.vim | 86 ------------------- nvim/.config/nvim/pluglist/completion.vim | 61 ------------- nvim/.config/nvim/pluglist/design.vim | 36 -------- nvim/.config/nvim/pluglist/prose.vim | 57 ------------ nvim/.config/nvim/pluglist/vim.vim | 6 -- 29 files changed, 305 insertions(+), 274 deletions(-) create mode 100644 nvim/.config/nvim/plugin/after/deoplete.vim create mode 100644 nvim/.config/nvim/plugin/after/echodoc.vim create mode 100644 nvim/.config/nvim/plugin/after/lazyload_ale_deoplete_echodoc.vim create mode 100644 nvim/.config/nvim/plugin/after/prose.vim create mode 100644 nvim/.config/nvim/plugin/after/vim-pandoc-syntax.vim rename nvim/.config/nvim/{pluglist/latex.vim => plugin/after/vim-pandoc.vim} (82%) create mode 100644 nvim/.config/nvim/plugin/airline.vim create mode 100644 nvim/.config/nvim/plugin/ale.vim create mode 100644 nvim/.config/nvim/plugin/colorschemes-font.vim create mode 100644 nvim/.config/nvim/plugin/fzf.vim create mode 100644 nvim/.config/nvim/plugin/goyo.vim create mode 100644 nvim/.config/nvim/plugin/nerdtree.vim create mode 100644 nvim/.config/nvim/plugin/notational-fzf-vim.vim rename nvim/.config/nvim/plugin/{ => personal}/bibcite.vim (100%) rename nvim/.config/nvim/plugin/{ => personal}/searchnotes.vim (100%) rename nvim/.config/nvim/plugin/{ => personal}/showmappings.vim (100%) create mode 100644 nvim/.config/nvim/plugin/tmuxline.vim rename nvim/.config/nvim/{pluglist/syntaxes.vim => plugin/vim-go.vim} (77%) create mode 100644 nvim/.config/nvim/plugin/vim-pencil.vim create mode 100644 nvim/.config/nvim/plugin/vim-sneak.vim create mode 100644 nvim/.config/nvim/plugin/vim-tmux-navigator.vim rename nvim/.config/nvim/{pluglist/notes.vim => plugin/wiki.vim} (60%) delete mode 100644 nvim/.config/nvim/pluglist/base.vim delete mode 100644 nvim/.config/nvim/pluglist/completion.vim delete mode 100644 nvim/.config/nvim/pluglist/design.vim delete mode 100644 nvim/.config/nvim/pluglist/prose.vim delete mode 100644 nvim/.config/nvim/pluglist/vim.vim diff --git a/nvim/.config/nvim/init.vim b/nvim/.config/nvim/init.vim index 224c670..cbc5d98 100644 --- a/nvim/.config/nvim/init.vim +++ b/nvim/.config/nvim/init.vim @@ -30,8 +30,61 @@ autocmd VimEnter * " Install plugins from vim with :PlugInstall silent! if plug#begin('~/.local/share/nvim/plugged') +" base +Plug 'christoomey/vim-tmux-navigator' +Plug 'jeffkreeftmeijer/vim-numbertoggle' +Plug 'justinmk/vim-sneak' +Plug 'RRethy/vim-illuminate' +" editing +Plug 'tpope/vim-commentary' " easily toggle comments for lines, paragraphs etc with gc +Plug 'tpope/vim-surround' " lets you change surrounding things with cs (or ds to del, ys to add) +Plug 'tommcdo/vim-exchange' " adds exchange operator with cx. common use: cxiw . on 2 words to switch +Plug 'jiangmiao/auto-pairs' " Auto close brackets and '' + +Plug 'scrooloose/nerdtree', { 'on': ['NERDTreeToggle', 'NERDTreeFind'] } " show a directory listing within vim +Plug 'Xuyuanp/nerdtree-git-plugin', { 'on': ['NERDTreeToggle', 'NERDTreeFind'] } " show git status in nerdtree for files and dirs +" Fuzzy matching +Plug 'junegunn/fzf', { 'dir': '~/.fzf', 'do': './install --bin' } +Plug 'junegunn/fzf.vim' + " ultimately the only thing left here should be a -runtime! pluglist/**/*.vim +Plug 'Shougo/deoplete.nvim' " automatic suggestions, can also perhaps be changed for newer plugs +Plug 'deoplete-plugins/deoplete-go', { 'do': 'make'} +Plug 'Shougo/echodoc.vim', { 'on': [] } +Plug 'w0rp/ale', { 'on': [] } " asynchronous linting - might be superseded by lsp or coc.nvim at some point +" statusline +Plug 'vim-airline/vim-airline' +Plug 'vim-airline/vim-airline-themes' +Plug 'edkolev/tmuxline.vim' +" Colorschemes +Plug 'chriskempson/base16-vim' +Plug 'reedes/vim-colors-pencil' +Plug 'rakr/vim-togglebg' +" RMarkdown & LaTeX workflow +Plug 'vim-pandoc/vim-pandoc-syntax' +Plug 'vim-pandoc/vim-pandoc' +" Notes and Wiki +Plug 'dyng/ctrlsf.vim' +Plug 'lervag/wiki.vim' +Plug 'alok/notational-fzf-vim' +" Prose Workflow +Plug 'kana/vim-textobj-user' " dependency for most other textobj plugins +Plug 'reedes/vim-textobj-sentence' " extends the capabilities of sentence detection +" and allows you to jump to the *end* of this or last sentence. +Plug 'reedes/vim-pencil', { 'for': ['markdown', 'txt'], 'on': 'Goyo' } " provide md convenience functions like hard/softwrap +Plug 'junegunn/goyo.vim', { 'for': ['markdown', 'txt'], 'on': 'Goyo' } " provide distraction free writing +Plug 'junegunn/limelight.vim', { 'for': ['markdown', 'txt'], 'on': 'Goyo' } " provide even distraction free-er writing (lowlight paragraphs) +" Language Integration +Plug 'sheerun/vim-polyglot' " syntax plugins for almost every language +Plug 'stephpy/vim-yaml' +Plug 'mhartington/nvim-typescript', {'for': 'typescript','do': './install.sh'} + +Plug 'fatih/vim-go', { 'do': ':GoUpdateBinaries' } +Plug 'aliou/bats.vim' + +if !has('nvim') + Plug 'tpope/vim-sensible' +endif " Plug 'liuchengxu/vim-which-key', { 'on': ['WhichKey', 'WhichKey!'] } -> " instructions: http://liuchengxu.org/vim-which-key/, needs setup tp become diff --git a/nvim/.config/nvim/modules_experimental/academia_pandoc.vim b/nvim/.config/nvim/modules_experimental/academia_pandoc.vim index f410700..670a8f1 100644 --- a/nvim/.config/nvim/modules_experimental/academia_pandoc.vim +++ b/nvim/.config/nvim/modules_experimental/academia_pandoc.vim @@ -113,9 +113,44 @@ Plug 'rakr/vim-one' Plug 'vim-pandoc/vim-pandoc' Plug 'vim-pandoc/vim-pandoc-syntax' +Plug 'Shougo/deoplete.nvim' " automatic suggestions, can also perhaps be changed for newer plugs + call plug#end() endif +" PLUGIN: DEOPLETE +" enable deoplete at startup +let g:deoplete#enable_at_startup = 1 +let g:deoplete#enable_ignore_case = 1 +let g:deoplete#enable_smart_case = 1 +let g:deoplete#enable_camel_case = 1 +let g:deoplete#enable_refresh_always = 1 +let g:deoplete#max_abbr_width = 0 +let g:deoplete#max_menu_width = 0 +" call deoplete#custom#var('omni', 'input_patterns', { +" \ 'pandoc': '@', +" \}) +" call deoplete#enable() +" lazy loading since they require a lot of startup time +let s:ide_features_loaded=0 +function! Autocomplete_linting_init() abort + if s:ide_features_loaded || !has('nvim') + return + endif + let s:ide_features_loaded=1 + call plug#load('ale', 'deoplete.nvim', 'echodoc.vim') + call echodoc#enable() + call deoplete#custom#var('omni', 'input_patterns', { + \ 'pandoc': '@', + \}) + call deoplete#enable() +endfunction + +augroup load_ide_features + autocmd! + autocmd InsertEnter * call Autocomplete_linting_init() +augroup END + set foldlevel=2 " PLUGIN: vim-pandoc @@ -141,8 +176,8 @@ let g:pandoc#hypertext#create_if_no_alternates_exists=1 let g:pandoc#syntax#conceal#use = 1 let g:pandoc#syntax#conceal#urls = 1 -" follow and open links with pandoc -" open a file with either local means, or let the system decide +" follow and open links with pandoc +" open a file with either local means, or let the system decide nnoremap gX :call pandoc#hypertext#OpenSystem() nnoremap gx :call pandoc#hypertext#OpenLocal() " open a link in the editor (this buffer, or split) diff --git a/nvim/.config/nvim/plugin/after/deoplete.vim b/nvim/.config/nvim/plugin/after/deoplete.vim new file mode 100644 index 0000000..daea336 --- /dev/null +++ b/nvim/.config/nvim/plugin/after/deoplete.vim @@ -0,0 +1,15 @@ +" PLUGIN: DEOPLETE +" For async completion +" enable deoplete at startup +let g:deoplete#enable_at_startup = 1 +let g:deoplete#enable_ignore_case = 1 +let g:deoplete#enable_smart_case = 1 +let g:deoplete#enable_camel_case = 1 +let g:deoplete#enable_refresh_always = 1 +let g:deoplete#max_abbr_width = 0 +let g:deoplete#max_menu_width = 0 + +call deoplete#custom#var('omni', 'input_patterns', { + \ 'pandoc': '@', + \}) +call deoplete#enable() diff --git a/nvim/.config/nvim/plugin/after/echodoc.vim b/nvim/.config/nvim/plugin/after/echodoc.vim new file mode 100644 index 0000000..1863bc2 --- /dev/null +++ b/nvim/.config/nvim/plugin/after/echodoc.vim @@ -0,0 +1,6 @@ +" PLUGIN: ECHODOC +let g:echodoc#type="virtual" +set splitbelow +set completeopt+=menuone,noinsert,noselect +set completeopt-=preview +autocmd CompleteDone * pclose diff --git a/nvim/.config/nvim/plugin/after/lazyload_ale_deoplete_echodoc.vim b/nvim/.config/nvim/plugin/after/lazyload_ale_deoplete_echodoc.vim new file mode 100644 index 0000000..16b811d --- /dev/null +++ b/nvim/.config/nvim/plugin/after/lazyload_ale_deoplete_echodoc.vim @@ -0,0 +1,21 @@ +" lazy loading since they require a lot of startup time +let s:ide_features_loaded=0 +function! Autocomplete_linting_init() abort + if s:ide_features_loaded || !has('nvim') + return + endif + let s:ide_features_loaded=1 + + call plug#load('ale', 'deoplete.nvim', 'echodoc.vim') + call echodoc#enable() + call deoplete#custom#var('omni', 'input_patterns', { + \ 'pandoc': '@', + \}) + call deoplete#enable() + +endfunction + +" augroup load_ide_features +" autocmd! +" autocmd InsertEnter * call Autocomplete_linting_init() +" augroup END diff --git a/nvim/.config/nvim/plugin/after/prose.vim b/nvim/.config/nvim/plugin/after/prose.vim new file mode 100644 index 0000000..80eb5b5 --- /dev/null +++ b/nvim/.config/nvim/plugin/after/prose.vim @@ -0,0 +1,20 @@ +" PROSE: function to automatically enables markdown plugins for md & txt files +function! Prose() + call plug#load('vim-pencil') + call plug#load('goyo.vim') + call plug#load('limelight.vim') + call pencil#init() + " PLUGIN: vim-textobj-sentence + " enable extended sentence textobject use on md and plaintext files + call textobj#sentence#init() + " hide the markdown cruft + setlocal conceallevel=2 + setlocal foldlevel=2 +endfunction +" enable syntax highlighting for codeblocks WITHIN markdown +let g:markdown_fenced_languages = ['html', 'python', 'bash=sh', 'javascipt', 'go'] + +" call the prose function defined above for any md files +au FileType pandoc,markdown,md,mkd call Prose() +" or invoke it manually by writing :Prose +command! -nargs=0 Prose call Prose() diff --git a/nvim/.config/nvim/plugin/after/vim-pandoc-syntax.vim b/nvim/.config/nvim/plugin/after/vim-pandoc-syntax.vim new file mode 100644 index 0000000..cd38201 --- /dev/null +++ b/nvim/.config/nvim/plugin/after/vim-pandoc-syntax.vim @@ -0,0 +1,3 @@ +" PLUGIN: vim-pandoc-syntax +let g:pandoc#syntax#conceal#use = 1 +let g:pandoc#syntax#conceal#urls = 1 diff --git a/nvim/.config/nvim/pluglist/latex.vim b/nvim/.config/nvim/plugin/after/vim-pandoc.vim similarity index 82% rename from nvim/.config/nvim/pluglist/latex.vim rename to nvim/.config/nvim/plugin/after/vim-pandoc.vim index 21623b3..236544f 100644 --- a/nvim/.config/nvim/pluglist/latex.vim +++ b/nvim/.config/nvim/plugin/after/vim-pandoc.vim @@ -1,9 +1,7 @@ -" RMarkdown & LaTeX workflow -Plug 'vim-pandoc/vim-pandoc-syntax' -Plug 'vim-pandoc/vim-pandoc' " PLUGIN: vim-pandoc " handle markdown files with pandoc (and pandoc syntax!) -let g:pandoc#modules#disabled = ["folding"] +let g:pandoc#modules#disabled = ["folding", "keyboard"] +let g:pandoc#modules#enabled = ["formatting", "bibliographies", "completion", "metadata", "menu", "spell", "hypertext"] let g:pandoc#filetypes#pandoc_markdown = 1 let g:pandoc#filetypes#handled = [ "extra", "latex", "markdown", "pandoc", "rst", "textile" ] " disable all default keymaps @@ -28,7 +26,3 @@ let g:pandoc#folding#fastfolds=1 let g:pandoc#spell#default_langs=["en_us", "de_de"] let g:pandoc#hypertext#ausosave_on_edit_open_link=1 let g:pandoc#hypertext#create_if_no_alternates_exists=1 -let g:pandoc#syntax#conceal#use = 1 -let g:pandoc#syntax#conceal#urls = 1 - -" Plug 'vim-pandoc/vim-rmarkdown' diff --git a/nvim/.config/nvim/plugin/airline.vim b/nvim/.config/nvim/plugin/airline.vim new file mode 100644 index 0000000..549645a --- /dev/null +++ b/nvim/.config/nvim/plugin/airline.vim @@ -0,0 +1,7 @@ +" Design +" PLUGIN: AIRLINE +let g:airline_powerline_fonts=1 +" disable automatically refreshing the mux statusbar since it breaks tmux +" prefix highlighting. Instead, when changing vim statusbar just create +" snapshot with :TmuxlineSnapshot file and stick it into tmux config manually +let g:airline#extensions#tmuxline#enabled = 1 diff --git a/nvim/.config/nvim/plugin/ale.vim b/nvim/.config/nvim/plugin/ale.vim new file mode 100644 index 0000000..2e64507 --- /dev/null +++ b/nvim/.config/nvim/plugin/ale.vim @@ -0,0 +1,26 @@ +" PLUGIN: ALE +" clearer Error and warning signs for the gutter +let g:ale_sign_error = '' +let g:ale_sign_warning = '' + +let g:ale_fix_on_save = 1 +let g:ale_fixers = { + \'javascipt': ['eslint', 'prettier'], + \'html': ['tidy','prettier'], + \'typescript': ['prettier','tslint'], + \'*': ['remove_trailing_lines', 'trim_whitespace'], + \'go': ['gofmt'], + \'sh': ['shfmt'], + \'zsh': ['shfmt'], + \} +let g:ale_linters = { + \ 'go': ['gopls'], + \ 'sh': ['language_server','shellcheck'], + \ 'zsh': ['language_server','shellcheck'], + \} + + +" Enable integration with airline. +if exists("g:airline_theme") + let g:airline#extensions#ale#enabled = 1 +endif diff --git a/nvim/.config/nvim/plugin/colorschemes-font.vim b/nvim/.config/nvim/plugin/colorschemes-font.vim new file mode 100644 index 0000000..b482874 --- /dev/null +++ b/nvim/.config/nvim/plugin/colorschemes-font.vim @@ -0,0 +1,4 @@ +" Enable italics for colorschemes that support them +let g:gruvbox_italic=1 +let g:one_allow_italics=1 +let g:pencil_terminal_italics=1 diff --git a/nvim/.config/nvim/plugin/fzf.vim b/nvim/.config/nvim/plugin/fzf.vim new file mode 100644 index 0000000..77eb58a --- /dev/null +++ b/nvim/.config/nvim/plugin/fzf.vim @@ -0,0 +1,34 @@ +" PLUGIN: fzf.vim +" set some fzf defaults +" windows drops down from above, 40% of the screen +let g:fzf_layout = { 'up': '~40%' } +" any Fzf command is prefixed with Fzf +" this groups them nicely together, and avoids confusion when suddenly :Buffer +" or :Files would appear as a command otherwise +let g:fzf_command_prefix = 'Fzf' +" let the colors come from our colorscheme +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'], + \ 'border': ['fg', 'Ignore'], + \ 'prompt': ['fg', 'Conditional'], + \ 'pointer': ['fg', 'Exception'], + \ 'marker': ['fg', 'Keyword'], + \ 'spinner': ['fg', 'Label'], + \ 'header': ['fg', 'Comment'] } +" add some additional actions TODO perhaps unify with NerdTree mappings +let g:fzf_action = { + \ 'ctrl-t': 'tab split', + \ 'ctrl-x': 'split', + \ 'ctrl-v': 'vsplit' } + +" FzfRg but also search through hidden files +command! -bang -nargs=* FzfRgHidden + \ call fzf#vim#grep( + \ 'rg --column --line-number --no-heading --color=always --smart-case --hidden '.shellescape(), 1, + \ fzf#vim#with_preview(), 0) diff --git a/nvim/.config/nvim/plugin/goyo.vim b/nvim/.config/nvim/plugin/goyo.vim new file mode 100644 index 0000000..d8ac0ac --- /dev/null +++ b/nvim/.config/nvim/plugin/goyo.vim @@ -0,0 +1,21 @@ +" PLUGIN: goyo.vim +" set up functions for entering/exiting distraction free mode, or leaving it +function! s:goyo_enter() + " remove the tmux status bar for actual distraction free environment + silent !tmux set status off + " maximize the tmux pane that vim is in if any (usually I have vim open as the only pane) + silent !tmux list-panes -F '\#F' | grep -q Z || tmux resize-pane -Z + " disable line highlighting, we really don't need it for prose + set nocursorline + " enable limelight which highlights whatever paragraph you are in and lowlights the rest + Limelight +endfunction +function! s:goyo_leave() + silent !tmux set status on + silent !tmux list-panes -F '\#F' | grep -q Z && tmux resize-pane -Z + set cursorline + Limelight! +endfunction +" actually call the functions on entering/leaving goyo +autocmd! User GoyoEnter nested call goyo_enter() +autocmd! User GoyoLeave nested call goyo_leave() diff --git a/nvim/.config/nvim/plugin/nerdtree.vim b/nvim/.config/nvim/plugin/nerdtree.vim new file mode 100644 index 0000000..a66938d --- /dev/null +++ b/nvim/.config/nvim/plugin/nerdtree.vim @@ -0,0 +1,19 @@ +" PLUGIN: NERDTree +" " Ecosystem +" " Plug 'tpope/vim-fugitive' - Will have to take a closer look some other time +" highlight the line the cursor is on +let NERDTreeHighlightCursorline = 1 +" remove Press ? for help +let NERDTreeMinimalUI=1 +" loads nerdtree plugin when starting vim with a directory +" this is necessary when we lazyload nerdtree with vimplug above +" since it would only get loaded with nttoggle otherwise, and run netrw +augroup nerd_loader + autocmd! + autocmd VimEnter * silent! autocmd! FileExplorer + autocmd BufEnter,BufNew * + \ if isdirectory(expand('')) + \| call plug#load('nerdtree') + \| execute 'autocmd! nerd_loader' + \| endif +augroup END diff --git a/nvim/.config/nvim/plugin/notational-fzf-vim.vim b/nvim/.config/nvim/plugin/notational-fzf-vim.vim new file mode 100644 index 0000000..14ea40b --- /dev/null +++ b/nvim/.config/nvim/plugin/notational-fzf-vim.vim @@ -0,0 +1,8 @@ +" PLUGIN: notational-fzf-vim +" Configure notational-fzf-vim +if $WIKIROOT ==? "" + let g:nv_search_paths = [ expand('~/documents/notes') ] +else + let g:nv_search_paths = [ $WIKIROOT ] +endif +let g:nv_wrap_preview_text=1 diff --git a/nvim/.config/nvim/plugin/bibcite.vim b/nvim/.config/nvim/plugin/personal/bibcite.vim similarity index 100% rename from nvim/.config/nvim/plugin/bibcite.vim rename to nvim/.config/nvim/plugin/personal/bibcite.vim diff --git a/nvim/.config/nvim/plugin/searchnotes.vim b/nvim/.config/nvim/plugin/personal/searchnotes.vim similarity index 100% rename from nvim/.config/nvim/plugin/searchnotes.vim rename to nvim/.config/nvim/plugin/personal/searchnotes.vim diff --git a/nvim/.config/nvim/plugin/showmappings.vim b/nvim/.config/nvim/plugin/personal/showmappings.vim similarity index 100% rename from nvim/.config/nvim/plugin/showmappings.vim rename to nvim/.config/nvim/plugin/personal/showmappings.vim diff --git a/nvim/.config/nvim/plugin/tmuxline.vim b/nvim/.config/nvim/plugin/tmuxline.vim new file mode 100644 index 0000000..157188c --- /dev/null +++ b/nvim/.config/nvim/plugin/tmuxline.vim @@ -0,0 +1,12 @@ +" custom preset with left-justified window list +" PLUGIN: TMUXLINE +let g:tmuxline_preset = { + \'a' : '#S', + \'b' : '#(whoami)', + \'c' : '#I:#P', + \'win' : '#I #W', + \'cwin' : [' ', '#I #W'], + \'x' : '#{?client_prefix,#[fg=colour232]#[bg=brightblue],} %H:%M:%S', + \'y' : '%d-%b-%y', + \'z' : '#H', + \'options' : {}} diff --git a/nvim/.config/nvim/pluglist/syntaxes.vim b/nvim/.config/nvim/plugin/vim-go.vim similarity index 77% rename from nvim/.config/nvim/pluglist/syntaxes.vim rename to nvim/.config/nvim/plugin/vim-go.vim index d8856b1..2b77537 100644 --- a/nvim/.config/nvim/pluglist/syntaxes.vim +++ b/nvim/.config/nvim/plugin/vim-go.vim @@ -1,9 +1,3 @@ -" Language Integration -Plug 'sheerun/vim-polyglot' " syntax plugins for almost every language -Plug 'stephpy/vim-yaml' -Plug 'mhartington/nvim-typescript', {'for': 'typescript','do': './install.sh'} - -Plug 'fatih/vim-go', { 'do': ':GoUpdateBinaries' } " PLUGIN: vim-go " change the tabstops for go to use tabs and a width of 4 " this conforms with the gofmt expectations @@ -29,5 +23,3 @@ let g:go_auto_sameids = 1 let g:go_fmt_command = "goimports" " show type information for variables in the status line let g:go_auto_type_info = 1 - -Plug 'aliou/bats.vim' diff --git a/nvim/.config/nvim/plugin/vim-pencil.vim b/nvim/.config/nvim/plugin/vim-pencil.vim new file mode 100644 index 0000000..097427e --- /dev/null +++ b/nvim/.config/nvim/plugin/vim-pencil.vim @@ -0,0 +1,4 @@ +" PLUGIN: vim-pencil +" set default wrap mode to hard - TODO test which mode works better for +" me, it seems hardmode has trouble with markdown lists (see issue #31) +let g:pencil#wrapModeDefault = 'soft' " default is 'hard' diff --git a/nvim/.config/nvim/plugin/vim-sneak.vim b/nvim/.config/nvim/plugin/vim-sneak.vim new file mode 100644 index 0000000..1844906 --- /dev/null +++ b/nvim/.config/nvim/plugin/vim-sneak.vim @@ -0,0 +1,7 @@ +" PLUGIN: vim-sneak +" sneak around your files using +" repeatedly pressing fFtTsS will advance the search instead of starting a new +" one. To start a new one, press any other key, then fFtTsS +let g:sneak#s_next = 1 +" use ignorecase/smartcase, depending on vim setting +let g:sneak#use_ic_scs = 1 diff --git a/nvim/.config/nvim/plugin/vim-tmux-navigator.vim b/nvim/.config/nvim/plugin/vim-tmux-navigator.vim new file mode 100644 index 0000000..7b6ba2e --- /dev/null +++ b/nvim/.config/nvim/plugin/vim-tmux-navigator.vim @@ -0,0 +1,4 @@ +" PLUGIN: tmux-navigator +" add seamless movement between vim and tmux, switch windows with C-hjkl +" automatically save the current buffer when navigating away from vim +let g:tmux_navigator_save_on_switch = 1 diff --git a/nvim/.config/nvim/pluglist/notes.vim b/nvim/.config/nvim/plugin/wiki.vim similarity index 60% rename from nvim/.config/nvim/pluglist/notes.vim rename to nvim/.config/nvim/plugin/wiki.vim index 9d1a62b..bdbcbc4 100644 --- a/nvim/.config/nvim/pluglist/notes.vim +++ b/nvim/.config/nvim/plugin/wiki.vim @@ -1,9 +1,6 @@ -Plug 'dyng/ctrlsf.vim' - -Plug 'lervag/wiki.vim' " PLUGIN: wiki.vim if $WIKIROOT ==? "" - let g:wiki_root = '~/Nextcloud/Notes/' + let g:wiki_root = expand('~/documents/notes') else let g:wiki_root = $WIKIROOT endif @@ -13,8 +10,3 @@ let g:wiki_filetypes = ['md', 'mkd', 'markdown', 'wiki'] let g:wiki_link_extension = '.md' let g:wiki_link_target_type = 'md' let g:wiki_mappings_use_defaults = 1 - -Plug 'alok/notational-fzf-vim' -" Configure notational-fzf-vim -let g:nv_search_paths = [ g:wiki_root ] -let g:nv_wrap_preview_text=1 diff --git a/nvim/.config/nvim/pluglist/base.vim b/nvim/.config/nvim/pluglist/base.vim deleted file mode 100644 index 7f17479..0000000 --- a/nvim/.config/nvim/pluglist/base.vim +++ /dev/null @@ -1,86 +0,0 @@ -" Base Plugins - shared by vim & nvim - -" add seamless movement between vim and tmux, switch windows with C-hjkl -Plug 'christoomey/vim-tmux-navigator' -" automatically save the current buffer when navigating away from vim -let g:tmux_navigator_save_on_switch = 1 - -" automatically switch between relative and absolute numbers as buffers move -" into / out of focus (requires number & relativenumber to be set) -Plug 'jeffkreeftmeijer/vim-numbertoggle' - -" sneak around your files using -Plug 'justinmk/vim-sneak' -" repeatedly pressing fFtTsS will advance the search instead of starting a new -" one. To start a new one, press any other key, then fFtTsS -let g:sneak#s_next = 1 -" use ignorecase/smartcase, depending on vim setting -let g:sneak#use_ic_scs = 1 - -" highlight all occurences of the current word under the cursor (after 250ms -" delay) -Plug 'RRethy/vim-illuminate' - -" editing Workflow -Plug 'tpope/vim-commentary' " easily toggle comments for lines, paragraphs etc with gc -Plug 'tpope/vim-surround' " lets you change surrounding things with cs (or ds to del, ys to add) -Plug 'tommcdo/vim-exchange' " adds exchange operator with cx. common use: cxiw . on 2 words to switch -Plug 'jiangmiao/auto-pairs' " Auto close brackets and '' - -" " Ecosystem -" " Plug 'tpope/vim-fugitive' - Will have to take a closer look some other time -Plug 'scrooloose/nerdtree', { 'on': ['NERDTreeToggle', 'NERDTreeFind'] } " show a directory listing within vim -Plug 'Xuyuanp/nerdtree-git-plugin', { 'on': ['NERDTreeToggle', 'NERDTreeFind'] } " show git status in nerdtree for files and dirs -" highlight the line the cursor is on -let NERDTreeHighlightCursorline = 1 -" remove Press ? for help -let NERDTreeMinimalUI=1 -" loads nerdtree plugin when starting vim with a directory -" this is necessary when we lazyload nerdtree with vimplug above -" since it would only get loaded with nttoggle otherwise, and run netrw -augroup nerd_loader - autocmd! - autocmd VimEnter * silent! autocmd! FileExplorer - autocmd BufEnter,BufNew * - \ if isdirectory(expand('')) - \| call plug#load('nerdtree') - \| execute 'autocmd! nerd_loader' - \| endif -augroup END - -" Fuzzy matching -Plug 'junegunn/fzf', { 'dir': '~/.fzf', 'do': './install --bin' } -Plug 'junegunn/fzf.vim' -" set some fzf defaults -" windows drops down from above, 40% of the screen -let g:fzf_layout = { 'up': '~40%' } -" any Fzf command is prefixed with Fzf -" this groups them nicely together, and avoids confusion when suddenly :Buffer -" or :Files would appear as a command otherwise -let g:fzf_command_prefix = 'Fzf' -" let the colors come from our colorscheme -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'], - \ 'border': ['fg', 'Ignore'], - \ 'prompt': ['fg', 'Conditional'], - \ 'pointer': ['fg', 'Exception'], - \ 'marker': ['fg', 'Keyword'], - \ 'spinner': ['fg', 'Label'], - \ 'header': ['fg', 'Comment'] } -" add some additional actions TODO perhaps unify with NerdTree mappings -let g:fzf_action = { - \ 'ctrl-t': 'tab split', - \ 'ctrl-x': 'split', - \ 'ctrl-v': 'vsplit' } - -" FzfRg but also search through hidden files -command! -bang -nargs=* FzfRgHidden - \ call fzf#vim#grep( - \ 'rg --column --line-number --no-heading --color=always --smart-case --hidden '.shellescape(), 1, - \ fzf#vim#with_preview(), 0) diff --git a/nvim/.config/nvim/pluglist/completion.vim b/nvim/.config/nvim/pluglist/completion.vim deleted file mode 100644 index dfee04c..0000000 --- a/nvim/.config/nvim/pluglist/completion.vim +++ /dev/null @@ -1,61 +0,0 @@ -" For async completion -Plug 'Shougo/deoplete.nvim', { 'on': [] } " automatic suggestions, can also perhaps be changed for newer plugs -" PLUGIN: DEOPLETE -" enable deoplete at startup -let g:deoplete#enable_at_startup = 0 -let g:deoplete#enable_ignore_case = 1 -let g:deoplete#enable_smart_case = 1 -let g:deoplete#enable_camel_case = 1 -let g:deoplete#enable_refresh_always = 1 -let g:deoplete#max_abbr_width = 0 -let g:deoplete#max_menu_width = 0 -let g:deoplete#omni#input_patterns = get(g:,'deoplete#omni#input_patterns',{}) - -Plug 'deoplete-plugins/deoplete-go', { 'do': 'make'} - -Plug 'Shougo/echodoc.vim', { 'on': [] } -" PLUGIN: ECHODOC -let g:echodoc#type="virtual" -set splitbelow -set completeopt+=menuone,noinsert,noselect -set completeopt-=preview -autocmd CompleteDone * pclose - -Plug 'w0rp/ale', { 'on': [] } " asynchronous linting - might be superseded by lsp or coc.nvim at some point -" PLUGIN: ALE -" clearer Error and warning signs for the gutter -let g:ale_sign_error = '⤫' -let g:ale_sign_warning = '⚠' -" Enable integration with airline. -let g:airline#extensions#ale#enabled = 1 -let g:ale_fix_on_save = 1 -let g:ale_fixers = { - \'javascipt': ['eslint', 'prettier'], - \'html': ['tidy','prettier'], - \'typescript': ['prettier','tslint'], - \'*': ['remove_trailing_lines', 'trim_whitespace'], - \'go': ['gofmt'], - \'sh': ['shfmt'], - \'zsh': ['shfmt'], - \} -let g:ale_linters = { - \ 'go': ['gopls'], - \ 'sh': ['language_server','shellcheck'], - \ 'zsh': ['language_server','shellcheck'], - \} - -" lazy loading since they require a lot of startup time -augroup load_ide_features - autocmd! - autocmd InsertEnter * call plug#load('ale', 'deoplete.nvim', 'echodoc.vim') - \| autocmd! load_ide_features - autocmd InsertEnter * call deoplete#enable() - autocmd InsertEnter * call echodoc#enable() - - -augroup PandocCompletion - " Add pandoc citations to deoplete automatic completions - autocmd InsertEnter * call deoplete#custom#var('omni', 'input_patterns', { - \ 'pandoc': '@' - \}) -augroup END diff --git a/nvim/.config/nvim/pluglist/design.vim b/nvim/.config/nvim/pluglist/design.vim deleted file mode 100644 index 6e5e8e6..0000000 --- a/nvim/.config/nvim/pluglist/design.vim +++ /dev/null @@ -1,36 +0,0 @@ -" Design -Plug 'vim-airline/vim-airline' -" PLUGIN: AIRLINE -let g:airline_powerline_fonts=1 -" disable automatically refreshing the mux statusbar since it breaks tmux -" prefix highlighting. Instead, when changing vim statusbar just create -" snapshot with :TmuxlineSnapshot file and stick it into tmux config manually -let g:airline#extensions#tmuxline#enabled = 1 -" custom preset with left-justified window list -Plug 'vim-airline/vim-airline-themes' - -Plug 'edkolev/tmuxline.vim' -" PLUGIN: TMUXLINE -let g:tmuxline_preset = { - \'a' : '#S', - \'b' : '#(whoami)', - \'c' : '#I:#P', - \'win' : '#I #W', - \'cwin' : [' ', '#I #W'], - \'x' : '#{?client_prefix,#[fg=colour232]#[bg=brightblue],} %H:%M:%S', - \'y' : '%d-%b-%y', - \'z' : '#H', - \'options' : {}} - -" Colorschemes -Plug 'chriskempson/base16-vim' -Plug 'reedes/vim-colors-pencil' -Plug 'rakr/vim-togglebg' - -" Enable italics for colorschemes that support them -let g:gruvbox_italic=1 -let g:one_allow_italics=1 -let g:pencil_terminal_italics=1 - -" per this discussion: https://github.com/junegunn/vim-plug/issues/300 -autocmd VimEnter * colorscheme base16-gruvbox-dark-medium diff --git a/nvim/.config/nvim/pluglist/prose.vim b/nvim/.config/nvim/pluglist/prose.vim deleted file mode 100644 index 16cc276..0000000 --- a/nvim/.config/nvim/pluglist/prose.vim +++ /dev/null @@ -1,57 +0,0 @@ -" Prose Workflow -Plug 'kana/vim-textobj-user' " dependency for most other textobj plugins -Plug 'reedes/vim-textobj-sentence' " extends the capabilities of sentence detection -" and allows you to jump to the *end* of this or last sentence. - -Plug 'reedes/vim-pencil', { 'for': ['markdown', 'txt'], 'on': 'Goyo' } " provide md convenience functions like hard/softwrap -" PLUGIN: vim-pencil -" set default wrap mode to hard - TODO test which mode works better for -" me, it seems hardmode has trouble with markdown lists (see issue #31) -let g:pencil#wrapModeDefault = 'soft' " default is 'hard' - -Plug 'junegunn/goyo.vim', { 'for': ['markdown', 'txt'], 'on': 'Goyo' } " provide distraction free writing -" PLUGIN: goyo -" set up functions for entering/exiting distraction free mode, or leaving it -function! s:goyo_enter() - " remove the tmux status bar for actual distraction free environment - silent !tmux set status off - " maximize the tmux pane that vim is in if any (usually I have vim open as the only pane) - silent !tmux list-panes -F '\#F' | grep -q Z || tmux resize-pane -Z - " disable line highlighting, we really don't need it for prose - set nocursorline - " enable limelight which highlights whatever paragraph you are in and lowlights the rest - Limelight -endfunction -function! s:goyo_leave() - silent !tmux set status on - silent !tmux list-panes -F '\#F' | grep -q Z && tmux resize-pane -Z - set cursorline - Limelight! -endfunction -" actually call the functions on entering/leaving goyo -autocmd! User GoyoEnter nested call goyo_enter() -autocmd! User GoyoLeave nested call goyo_leave() - - -Plug 'junegunn/limelight.vim', { 'for': ['markdown', 'txt'], 'on': 'Goyo' } " provide even distraction free-er writing (lowlight paragraphs) - -" PROSE: function to automatically enables markdown plugins for md & txt files -function! Prose() - call plug#load('vim-pencil') - call plug#load('goyo.vim') - call plug#load('limelight.vim') - call pencil#init() - " PLUGIN: vim-textobj-sentence - " enable extended sentence textobject use on md and plaintext files - call textobj#sentence#init() - " hide the markdown cruft - setlocal conceallevel=2 - setlocal foldlevel=2 -endfunction -" enable syntax highlighting for codeblocks WITHIN markdown -let g:markdown_fenced_languages = ['html', 'python', 'bash=sh', 'javascipt', 'go'] - -" call the prose function defined above for any md files -au FileType pandoc,markdown,md,mkd call Prose() -" or invoke it manually by writing :Prose -command! -nargs=0 Prose call Prose() diff --git a/nvim/.config/nvim/pluglist/vim.vim b/nvim/.config/nvim/pluglist/vim.vim deleted file mode 100644 index bbea4cd..0000000 --- a/nvim/.config/nvim/pluglist/vim.vim +++ /dev/null @@ -1,6 +0,0 @@ -if has('nvim') - finish -endif - -" a minimal definition of variables TODO still necessary for nvim? -Plug 'tpope/vim-sensible'