Switch to GNU stow
This commit is contained in:
parent
a2605c4254
commit
d34cecb27e
137 changed files with 39244 additions and 141 deletions
1
nvim/.config/nvim/colo.vim
Normal file
1
nvim/.config/nvim/colo.vim
Normal file
|
|
@ -0,0 +1 @@
|
|||
colo nord
|
||||
118
nvim/.config/nvim/init.vim
Normal file
118
nvim/.config/nvim/init.vim
Normal file
|
|
@ -0,0 +1,118 @@
|
|||
" vim: set foldmethod=marker foldlevel=0 nomodeline:
|
||||
" ================================================================================
|
||||
" .init.vim / .vimrc of Marty Oehme {{{
|
||||
" ================================================================================
|
||||
"
|
||||
" - stolen from many different sources including
|
||||
" Steve Losh
|
||||
" Junegunn Choi
|
||||
" Tim Pope
|
||||
|
||||
" }}}
|
||||
" PLUGIN INSTALLATION - handled by VIM-PLUG {{{
|
||||
" ================================================================================
|
||||
"
|
||||
" automatically install vim-plug if it does not exist
|
||||
" Note: this installs it in the neovim folder, not the vim folder
|
||||
if empty(glob('~/.local/share/nvim/site/autoload/plug.vim'))
|
||||
silent !curl -fLo ~/.local/share/nvim/site/autoload/plug.vim --create-dirs
|
||||
\ https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim
|
||||
autocmd VimEnter * PlugInstall --sync | source $MYVIMRC | q
|
||||
endif
|
||||
|
||||
" automatically install any missing plugins
|
||||
autocmd VimEnter *
|
||||
\ if len(filter(values(g:plugs), '!isdirectory(v:val.dir)'))
|
||||
\| PlugInstall --sync | q
|
||||
\| endif
|
||||
|
||||
" defines plugin directory
|
||||
" Install plugins from vim with :PlugInstall
|
||||
silent! if plug#begin('~/.local/share/nvim/plugged')
|
||||
|
||||
" ultimately the only thing left here should be a
|
||||
runtime! pluglist/**/*.vim
|
||||
|
||||
" Plug 'liuchengxu/vim-which-key', { 'on': ['WhichKey', 'WhichKey!'] } ->
|
||||
" instructions: http://liuchengxu.org/vim-which-key/, needs setup tp become
|
||||
" useful. TODO enable when setup is more settled down
|
||||
|
||||
call plug#end()
|
||||
endif
|
||||
|
||||
colo gruvbox
|
||||
|
||||
" }}}
|
||||
" VIM SETTINGS {{{
|
||||
" ================================================================================
|
||||
"
|
||||
" set truecolor (neovim)
|
||||
set termguicolors
|
||||
|
||||
" sets tabs to be 2 characters, expanded into spaces, but still removable with
|
||||
" one press of backspace.
|
||||
" great explanation: http://vimcasts.org/transcripts/2/en/
|
||||
set tabstop=2
|
||||
set shiftwidth=2
|
||||
set softtabstop=2
|
||||
set expandtab
|
||||
|
||||
" set cursor line highlighting, esp useful when using with bracket
|
||||
" highlighting and you don't know which side of the brace the cursor is on
|
||||
set cursorline
|
||||
|
||||
" shows linenumbers relative to the one you are on, for easy movement and
|
||||
" dNUMBERd deletions
|
||||
set number relativenumber
|
||||
|
||||
" keeps an undofile next to files so that you can even undo if vim is closed
|
||||
" in between
|
||||
set undofile
|
||||
|
||||
" ignores case by default but will use case when search is specifically not
|
||||
" all lowercased
|
||||
set ignorecase
|
||||
set smartcase
|
||||
|
||||
" whenever vim loses focus, save
|
||||
au FocusLost * :wa
|
||||
|
||||
" disables showing us the current mode in the command line since airline takes
|
||||
" care of it
|
||||
set noshowmode
|
||||
|
||||
" highlight everything that goes over 80 columns
|
||||
highlight ColorColumn ctermbg=magenta
|
||||
call matchadd('ColorColumn', '\%81v', 100)
|
||||
|
||||
" Special setting for editing gopass files - make sure nothing leaks outside
|
||||
" the directories it is supposed to
|
||||
au BufNewFile,BufRead /dev/shm/gopass.* setlocal noswapfile nobackup noundofile
|
||||
|
||||
" }}}
|
||||
" KEYBINDINGS {{{
|
||||
" ================================================================================
|
||||
"
|
||||
|
||||
" Begin mapping definitions
|
||||
runtime! **/maps.vim
|
||||
|
||||
" }}}
|
||||
" ABBREVIATIONS {{{
|
||||
|
||||
" Typos
|
||||
iabbrev adn and
|
||||
iabbrev waht what
|
||||
iabbrev tehn then
|
||||
iabbrev whit with
|
||||
iabbrev whith with
|
||||
|
||||
" Text expansion
|
||||
iabbrev mo@ marty.oehme@gmail.com
|
||||
iabbrev mo.me@ <https://martyoeh.me/>
|
||||
iabbrev mcc@ Copyright 2019 Marty Oehme, all rights reserved.
|
||||
|
||||
"
|
||||
" }}}
|
||||
" END
|
||||
" ================================================================================
|
||||
238
nvim/.config/nvim/maps.vim
Normal file
238
nvim/.config/nvim/maps.vim
Normal file
|
|
@ -0,0 +1,238 @@
|
|||
" The general ideas behind these mappings:
|
||||
"
|
||||
" * Leader prefix is the generally preferred way to map new things, however
|
||||
" only for those that affect all of vim
|
||||
"
|
||||
" * Localleader prefix is used for mappings which only affect single buffers,
|
||||
" in other words mostly filetype specific mappings
|
||||
"
|
||||
" many of these mapping ideas come from Tom Ryder who has them nicely
|
||||
" documented
|
||||
|
||||
" backspace to switch to alternate (last) buffer
|
||||
nnoremap <BS> <C-^>
|
||||
|
||||
" since u undoes, would it not make sense that U redoes?
|
||||
nnoremap U <C-r>
|
||||
|
||||
" stronger versions of left,right - move all the way to beginning/end of line
|
||||
nnoremap H ^
|
||||
nnoremap L $
|
||||
|
||||
" move around between matching brackets with tab
|
||||
nnoremap <tab> %
|
||||
nnoremap <tab> %
|
||||
|
||||
" when in insertion mode, C-u uppercases the current word, C-l lowercases it,
|
||||
inoremap <C-U> <esc>gUiw`]a
|
||||
inoremap <C-u> <esc>guiw`]a
|
||||
|
||||
" let me save stuff as sudo when I forget to call vim with it
|
||||
cnoremap w!! execute 'silent! write !sudo tee % >/dev/null' <bar> edit!
|
||||
|
||||
" yank filename to f buffer
|
||||
nnoremap yf :let @f = expand("%")<cr>
|
||||
|
||||
" repeat the last substitute command with all its flags preserved
|
||||
noremap &
|
||||
\ :&&<CR>
|
||||
ounmap &
|
||||
sunmap &
|
||||
|
||||
" bracket pairings to go to the next/previous of:
|
||||
" (works with count prefixes)
|
||||
"
|
||||
" Argument list
|
||||
nnoremap [a
|
||||
\ :previous<CR>
|
||||
nnoremap ]a
|
||||
\ :next<CR>
|
||||
" Buffers
|
||||
nnoremap [b
|
||||
\ :bprevious<CR>
|
||||
nnoremap ]b
|
||||
\ :bnext<CR>
|
||||
" Quickfix list
|
||||
nnoremap [c
|
||||
\ :cprevious<CR>
|
||||
nnoremap ]c
|
||||
\ :cnext<CR>
|
||||
" Location list
|
||||
nnoremap [l
|
||||
\ :lprevious<CR>
|
||||
nnoremap ]l
|
||||
\ :lnext<CR>
|
||||
|
||||
" set our leader key to space since with hjkl, space is largely useless
|
||||
let mapleader = "\<Space>"
|
||||
" maps the leader for buffer local mappings
|
||||
" since we are (atm) using sneak to go fwd/bwd in fFtT searches, comma does
|
||||
" not do too many useful things and can be taken up as localleader
|
||||
let maplocalleader = ","
|
||||
|
||||
" If we mapped localleader to comma, we can still get to its original function
|
||||
" by douple-tapping it.
|
||||
if maplocalleader ==# ','
|
||||
noremap ,, ,
|
||||
sunmap ,,
|
||||
endif
|
||||
|
||||
" remove search highlights by pressing space+/ - the key for searching the
|
||||
" first place
|
||||
nnoremap <leader>/ :noh<cr>
|
||||
|
||||
" split buffers vertically/horizontally with the leader \ or - (mirrors my
|
||||
" tmux setup)
|
||||
nnoremap <leader>- :sp<cr>
|
||||
nnoremap <leader>\ :vsp<cr>
|
||||
" 'open new buffer' with leader-t (opens new buffer containing current dir and switches to it)
|
||||
nnoremap <leader>t :vsp .<cr>
|
||||
" open actual new tab with leader-T
|
||||
nnoremap <leader>T :tabedit .<cr>
|
||||
|
||||
" select the whole buffer with <leader>-a
|
||||
nnoremap <leader>a ggVG
|
||||
|
||||
" CONFIG EDITING
|
||||
" quickly edit vimrc with leader+V
|
||||
nnoremap <leader>V :vsp $MYVIMRC<cr>
|
||||
" automatically source the vimrc file whenever it is saved (causes slowdown
|
||||
" when done in MANY successions)
|
||||
" au BufWritePost init.vim so ~/.config/nvim/init.vim
|
||||
" source vimrc with keystroke combination
|
||||
nnoremap <leader>VV :source $MYVIMRC<cr>
|
||||
|
||||
" PLUGIN: vim-sneak
|
||||
map f <Plug>Sneak_f
|
||||
map F <Plug>Sneak_F
|
||||
map t <Plug>Sneak_t
|
||||
map T <Plug>Sneak_T
|
||||
|
||||
" SPELL CHECKING
|
||||
" Spell check set to <leader>O, 'o' for 'orthography':
|
||||
" Move to the prev/next spelling error with [S ]S
|
||||
" Move to the prev/next spelling error or suggestion with [s ]s
|
||||
noremap <leader>O :setlocal spell! spelllang=en_us<CR>
|
||||
noremap <leader>OE :setlocal spell! spelllang=en_us<CR>
|
||||
noremap <leader>OG :setlocal spell! spelllang=de_de<CR>
|
||||
noremap <leader>o z=
|
||||
|
||||
" PLUGIN: NERDTree
|
||||
" open/close NERDtree with leader-e
|
||||
" whatever method tree has been opened by, leader-e closes it again
|
||||
nnoremap <leader>e :NERDTreeToggle<CR>
|
||||
" open root of current VCS project in tree
|
||||
nnoremap <leader><C-e> :NERDTreeVCS<CR>
|
||||
" open current nerdtree with current file highlighted
|
||||
nnoremap <leader>E :NERDTreeFind<CR>
|
||||
|
||||
" PLUGIN: FZF GLOBAL FUZZY FINDING
|
||||
" FZF buffers and files in current workdir
|
||||
noremap <leader>s :FzfBuffers<cr>
|
||||
" FZF most recently used / MRU, bound to S since it is essentially a larger
|
||||
" go-back intention than just buffers
|
||||
noremap <leader>S :FzfHistory<cr>
|
||||
" fuzzy find files in cwd
|
||||
noremap <leader>f :FzfFiles<cr>
|
||||
|
||||
" FZF general full-text search in cwd with rg
|
||||
noremap <leader>F :FzfRg<cr>
|
||||
" FZF git diff
|
||||
noremap <leader>gd :FzfGFiles?<cr>
|
||||
|
||||
" FZF colorschemes
|
||||
nnoremap <leader><F8> :FzfColors<cr>
|
||||
" Toggle background light/dark
|
||||
call togglebg#map("<F8>")
|
||||
|
||||
" Note Searching
|
||||
" PLUGIN: Notational-FZF
|
||||
" set notational-fzf-vim keys for the NV window itself
|
||||
let g:nv_fzf_binds = [
|
||||
\ 'alt-a:select-all',
|
||||
\ 'alt-q:deselect-all',
|
||||
\ 'alt-p:toggle-preview',
|
||||
\ 'alt-u:page-up',
|
||||
\ 'alt-d:page-down',
|
||||
\ 'ctrl-w:backward-kill-word',
|
||||
\ ]
|
||||
" FZF note full-text search with notational-velocity like functions (in wiki
|
||||
" directory)
|
||||
noremap <leader>n :NV<cr>
|
||||
noremap <leader>N :NV!<cr>
|
||||
" PLUGIN: CtrlSF
|
||||
" (non-fuzzy) search in wiki with ctrlsf, in fullscreen window
|
||||
nnoremap <leader>wf :execute(":call SearchNotes()")<cr>
|
||||
|
||||
" PLUGIN: vim-go
|
||||
" vim-go mappings - will only activate in go files
|
||||
" most of this credit to https://hackernoon.com/my-neovim-setup-for-go-7f7b6e805876
|
||||
" switch between test file and function
|
||||
au Filetype go nnoremap <localleader>ga <Plug>(go-alternate-edit)
|
||||
" switch between test file and function - in a horizontal/vertical split
|
||||
au Filetype go nnoremap <localleader>gah <Plug>(go-alternate-split)
|
||||
au Filetype go nnoremap <localleader>gav <Plug>(go-alternate-vertical)
|
||||
" run a test (but run it as short version, in case tests are tagged
|
||||
" accordingly)
|
||||
au FileType go nnoremap <F10> :GoTest -short<cr>
|
||||
" show/hide code coverage of go file
|
||||
au FileType go nnoremap <F9> :GoCoverageToggle -short<cr>
|
||||
" To get the documentation of whatever you are hovering over press K (to go
|
||||
" back C-t) -- this is enabled by default and needs no bind
|
||||
" go to the definition of whatever you hover over
|
||||
au FileType go nnoremap <F12> <Plug>(go-def)
|
||||
|
||||
" PLUGIN: wiki.vim
|
||||
" use wiki.vim to look through document outlines in fzf (only for note
|
||||
" directory atm)
|
||||
nnoremap <localleader>l :WikiFzfToc<cr>
|
||||
" overwrites some default mappings I don't use, or that interfere with my own
|
||||
" mappings TODO: currently this just assigns bogus shortcuts, since the plugin grumbles
|
||||
" when setting to an empty string
|
||||
let g:wiki_mappings_global = {
|
||||
\ '<plug>(wiki-journal)' : '<leader>===',
|
||||
\ '<plug>(wiki-code-run)' : '<leader>====',
|
||||
\ '<plug>(wiki-graph-in)' : '<leader>====',
|
||||
\ '<plug>(wiki-graph-out)' : '<leader>=====',
|
||||
\ '<plug>(wiki-link-toggle)' : '<leader>=======',
|
||||
\ '<plug>(wiki-page-toc)' : '<leader>=========',
|
||||
\ '<plug>(wiki-page-toc-local)' : '<leader>=============',
|
||||
\ '<plug>(wiki-export)' : '<leader>==============',
|
||||
\ '<plug>(wiki-list-uniq)' : '<leader>===============',
|
||||
\ '<plug>(wiki-list-uniq-local)' : '<leader>================',
|
||||
\ '<plug>(wiki-tag-list)' : '<leader>=================',
|
||||
\ '<plug>(wiki-tag-reload)' : '<leader>==================',
|
||||
\ '<plug>(wiki-tag-search)' : '<leader>=====================',
|
||||
\ '<plug>(wiki-link-toggle-operator)' : '<leader>======================',
|
||||
\}
|
||||
|
||||
" TODO The following should be put into a prose / compiled mapping module
|
||||
|
||||
" Mostly dealing with Prose writing from here on out
|
||||
" Format current Paragraph (esp useful in prose writing)
|
||||
nnoremap <silent> <localleader>q gqap
|
||||
xnoremap <silent> <localleader>q gq
|
||||
nnoremap <silent> <localleader>Q vapJgqap
|
||||
|
||||
" PLUGIN: GOYO
|
||||
" Enter distraction free prose mode with F11
|
||||
noremap <F11> :Goyo<CR>
|
||||
|
||||
" PLUGIN: fzf-bibtex
|
||||
" map @@ to automatically insert citation reference at cursor
|
||||
inoremap <silent> @@ <c-g>u<c-o>:call fzf#run(fzf#wrap({
|
||||
\ 'source': <sid>bibtex_ls(),
|
||||
\ 'sink*': function('<sid>bibtex_cite_sink_insert'),
|
||||
\ 'up': '25%',
|
||||
\ 'options': '--ansi --multi --prompt "Cite> "'}))<CR>
|
||||
" map <leader>cc to insert a complete citation at cursor
|
||||
nnoremap <silent> <localleader>cc :CiteRef<cr>
|
||||
" map <leader>cm to insert markdown prettified citation
|
||||
nnoremap <silent> <localleader>cm :CiteMarkdown<cr>
|
||||
|
||||
" p to comPile a document (or file, works for some languages like go/python/c)
|
||||
" o to open the resulting document (mostly for pdfs)
|
||||
" P to comPile *and* open a doc
|
||||
nnoremap <localleader>po :CompileOpen<cr>
|
||||
nnoremap <localleader>pp :CompileDoc<cr>
|
||||
nnoremap <localleader>PP :CompileDocAndOpen<cr>
|
||||
201
nvim/.config/nvim/modules_experimental/academia_fzf.vim
Normal file
201
nvim/.config/nvim/modules_experimental/academia_fzf.vim
Normal file
|
|
@ -0,0 +1,201 @@
|
|||
" vim: set foldmethod=marker foldlevel=1 nomodeline:
|
||||
" ================================================================================
|
||||
" .init.vim / .vimrc of Marty Oehme {{{
|
||||
" ================================================================================
|
||||
"
|
||||
" - stolen from many different sources including
|
||||
" Steve Losh
|
||||
" Junegunn Choi
|
||||
" Tim Pope
|
||||
|
||||
" this config does not set nocompatible - neovim does this automatically
|
||||
" this config does not set filetype plugin - vim-sensible does this
|
||||
" }}}
|
||||
" PLUGIN INSTALLATION - handled by VIM-PLUG {{{
|
||||
" ================================================================================
|
||||
"
|
||||
" automatically install vim-plug if it does not exist
|
||||
" Note: this installs it in the neovim folder, not the vim folder
|
||||
if empty(glob('~/.local/share/nvim/site/autoload/plug.vim'))
|
||||
silent !curl -fLo ~/.local/share/nvim/site/autoload/plug.vim --create-dirs
|
||||
\ https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim
|
||||
autocmd VimEnter * PlugInstall --sync | source academia_fzf.vim | q
|
||||
endif
|
||||
|
||||
" automatically install any missing plugins
|
||||
autocmd VimEnter *
|
||||
\ if len(filter(values(g:plugs), '!isdirectory(v:val.dir)'))
|
||||
\| PlugInstall --sync | q
|
||||
\| endif
|
||||
"
|
||||
" set truecolor (neovim)
|
||||
set termguicolors
|
||||
|
||||
" sets tabs to be 2 characters, expanded into spaces, but still removable with
|
||||
" one press of backspace.
|
||||
" great explanation: http://vimcasts.org/transcripts/2/en/
|
||||
set tabstop=2
|
||||
set shiftwidth=2
|
||||
set softtabstop=2
|
||||
set expandtab
|
||||
|
||||
" set cursor line highlighting, esp useful when using with bracket
|
||||
" highlighting and you don't know which side of the brace the cursor is on
|
||||
set cursorline
|
||||
|
||||
" shows linenumbers relative to the one you are on, for easy movement and
|
||||
" dNUMBERd deletions
|
||||
set number relativenumber
|
||||
|
||||
" keeps an undofile next to files so that you can even undo if vim is closed
|
||||
" in between
|
||||
set undofile
|
||||
|
||||
" ignores case by default but will use case when search is specifically not
|
||||
" all lowercased
|
||||
set ignorecase
|
||||
set smartcase
|
||||
|
||||
" whenever vim loses focus, save
|
||||
au FocusLost * :wa
|
||||
|
||||
" disables showing us the current mode in the command line since airline takes
|
||||
" care of it
|
||||
set noshowmode
|
||||
|
||||
" highlight everything that goes over 80 columns
|
||||
highlight ColorColumn ctermbg=magenta
|
||||
call matchadd('ColorColumn', '\%81v', 100)
|
||||
|
||||
" set our leader key to space since with hjkl, space is largely useless
|
||||
let mapleader = "\<Space>"
|
||||
" maps the leader for buffer local mappings (e.g. vim-waikiki for files under
|
||||
" the root dir to the same key -- might lead to incompatibilities, will have
|
||||
" to test)
|
||||
let maplocalleader = "\<Space>"
|
||||
" set jk to escape, in case capslock is not mapped to escape on the system
|
||||
inoremap jk <ESC>
|
||||
|
||||
" remove search highlights by pressing space+/ - the key for searching the
|
||||
" first place
|
||||
nnoremap <leader>/ :noh<cr>
|
||||
|
||||
" quickly edit vimrc with leader+V
|
||||
nnoremap <leader>V :vsp academia_fzf.vim<cr>
|
||||
" automatically source the vimrc file whenever it is saved (causes slowdown
|
||||
" when done in MANY successions)
|
||||
" au BufWritePost init.vim so ~/.config/nvim/init.vim
|
||||
" source vimrc with keystroke combination
|
||||
nnoremap <leader>VV :source academia_fzf.vim<cr>
|
||||
|
||||
|
||||
" 'open new buffer' with leader-t (opens new buffer and switches to it)
|
||||
" open actual new tab with leader-T
|
||||
nnoremap <leader>t :vsp .<cr>
|
||||
nnoremap <leader>T :tabedit .<cr>
|
||||
|
||||
" stronger versions of left,right - move all the way
|
||||
nnoremap H ^
|
||||
nnoremap L $
|
||||
|
||||
" }}}
|
||||
" CUSTOMIZATION {{{
|
||||
|
||||
" defines plugin directory
|
||||
" Install plugins from vim with :PlugInstall
|
||||
silent! if plug#begin('~/.local/share/nvim/plugged')
|
||||
Plug 'christoomey/vim-tmux-navigator'
|
||||
" automatically switch between relative and absolute numbers as buffers move
|
||||
" into / out of focus (requires number & relativenumber to be set)
|
||||
Plug 'jeffkreeftmeijer/vim-numbertoggle'
|
||||
Plug 'rakr/vim-one'
|
||||
|
||||
Plug 'junegunn/fzf', { 'dir': '~/.fzf', 'do': './install --bin' }
|
||||
|
||||
call plug#end()
|
||||
endif
|
||||
|
||||
" FZF Fuzzy Finding
|
||||
" set some fzf defaults
|
||||
let g:fzf_layout = { 'up': '~40%' }
|
||||
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'] }
|
||||
let g:fzf_action = {
|
||||
\ 'ctrl-t': 'tab split',
|
||||
\ 'ctrl-x': 'split',
|
||||
\ 'ctrl-v': 'vsplit' }
|
||||
|
||||
" set up fzf-bibtex
|
||||
let g:fzf_bibtex_cache = '~/.cache/'
|
||||
let g:fzf_bibtex_sources = 'academia.bib'
|
||||
|
||||
" prepare bibtex_ls function to look for bib files in cwd/parent/subdirs,
|
||||
" attach the standard bibtex source file
|
||||
" return the command with standard cache directory filled
|
||||
function! s:bibtex_ls(...)
|
||||
let bibfiles = (
|
||||
\ globpath('.', '*.bib', v:true, v:true) +
|
||||
\ globpath('..', '*.bib', v:true, v:true) +
|
||||
\ globpath('*/', '*.bib', v:true, v:true)
|
||||
\ )
|
||||
let bibfiles = join(bibfiles, ' ')
|
||||
let source_cmd = 'bibtex-ls -cache ' . g:fzf_bibtex_cache . ' ' .bibfiles . ' ' . g:fzf_bibtex_sources
|
||||
return source_cmd
|
||||
endfunction
|
||||
|
||||
" insert citation from normal mode at cursor (with brackets)
|
||||
function! s:bibtex_cite_sink(lines)
|
||||
let r=system("bibtex-cite ", a:lines)
|
||||
execute ':normal! i[' . r . ']'
|
||||
endfunction
|
||||
command! -bang -nargs=* CiteRef call fzf#run(fzf#wrap({
|
||||
\ 'source': <sid>bibtex_ls(<q-args>),
|
||||
\ 'sink*': function('<sid>bibtex_cite_sink'),
|
||||
\ 'up': '25%',
|
||||
\ 'options': '--ansi --multi --prompt "Cite> "'
|
||||
\ }))
|
||||
" insert citation from insert mode at cursor (no brackets inserted)
|
||||
function! s:bibtex_cite_sink_insert(lines)
|
||||
let r=system("bibtex-cite ", a:lines)
|
||||
execute ':normal! i' . r
|
||||
call feedkeys('a', 'n')
|
||||
endfunction
|
||||
" insert markdown formatted reference
|
||||
function! s:bibtex_markdown_sink(lines)
|
||||
let r=system("bibtex-markdown -cache " . g:fzf_bibtex_cache . ' ' . g:fzf_bibtex_sources, a:lines)
|
||||
echo join(a:lines, '; ')
|
||||
execute ':normal! i' . r
|
||||
endfunction
|
||||
command! -bang -nargs=* CiteMarkdown call fzf#run(fzf#wrap({
|
||||
\ 'source': <sid>bibtex_ls(),
|
||||
\ 'sink*': function('<sid>bibtex_markdown_sink'),
|
||||
\ 'up': '25%',
|
||||
\ 'options': '--ansi --multi --prompt "Markdown> "'
|
||||
\ }))
|
||||
|
||||
" map @@ to automatically insert citation reference at cursor
|
||||
inoremap <silent> @@ <c-g>u<c-o>:call fzf#run(fzf#wrap({
|
||||
\ 'source': <sid>bibtex_ls(),
|
||||
\ 'sink*': function('<sid>bibtex_cite_sink_insert'),
|
||||
\ 'up': '25%',
|
||||
\ 'options': '--ansi --multi --prompt "Cite> "'}))<CR>
|
||||
" map <leader>cc to insert a complete citation at cursor
|
||||
nnoremap <silent> <leader>cc :CiteRef<cr>
|
||||
" map <leader>cm to insert markdown prettified citation
|
||||
nnoremap <silent> <leader>cm :CiteMarkdown<cr>
|
||||
|
||||
" }}}
|
||||
|
||||
colo one
|
||||
163
nvim/.config/nvim/modules_experimental/academia_pandoc.vim
Normal file
163
nvim/.config/nvim/modules_experimental/academia_pandoc.vim
Normal file
|
|
@ -0,0 +1,163 @@
|
|||
" vim: set foldmethod=marker foldlevel=1 nomodeline:
|
||||
" ================================================================================
|
||||
" .init.vim / .vimrc of Marty Oehme {{{
|
||||
" ================================================================================
|
||||
"
|
||||
" - stolen from many different sources including
|
||||
" Steve Losh
|
||||
" Junegunn Choi
|
||||
" Tim Pope
|
||||
|
||||
" this config does not set nocompatible - neovim does this automatically
|
||||
" this config does not set filetype plugin - vim-sensible does this
|
||||
" }}}
|
||||
" PLUGIN INSTALLATION - handled by VIM-PLUG {{{
|
||||
" ================================================================================
|
||||
"
|
||||
" automatically install vim-plug if it does not exist
|
||||
" Note: this installs it in the neovim folder, not the vim folder
|
||||
if empty(glob('~/.local/share/nvim/site/autoload/plug.vim'))
|
||||
silent !curl -fLo ~/.local/share/nvim/site/autoload/plug.vim --create-dirs
|
||||
\ https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim
|
||||
autocmd VimEnter * PlugInstall --sync | source academia_pandoc.vim | q
|
||||
endif
|
||||
|
||||
" automatically install any missing plugins
|
||||
autocmd VimEnter *
|
||||
\ if len(filter(values(g:plugs), '!isdirectory(v:val.dir)'))
|
||||
\| PlugInstall --sync | q
|
||||
\| endif
|
||||
"
|
||||
" set truecolor (neovim)
|
||||
set termguicolors
|
||||
|
||||
" sets tabs to be 2 characters, expanded into spaces, but still removable with
|
||||
" one press of backspace.
|
||||
" great explanation: http://vimcasts.org/transcripts/2/en/
|
||||
set tabstop=2
|
||||
set shiftwidth=2
|
||||
set softtabstop=2
|
||||
set expandtab
|
||||
|
||||
" set cursor line highlighting, esp useful when using with bracket
|
||||
" highlighting and you don't know which side of the brace the cursor is on
|
||||
set cursorline
|
||||
|
||||
" shows linenumbers relative to the one you are on, for easy movement and
|
||||
" dNUMBERd deletions
|
||||
set number relativenumber
|
||||
|
||||
" keeps an undofile next to files so that you can even undo if vim is closed
|
||||
" in between
|
||||
set undofile
|
||||
|
||||
" ignores case by default but will use case when search is specifically not
|
||||
" all lowercased
|
||||
set ignorecase
|
||||
set smartcase
|
||||
|
||||
" whenever vim loses focus, save
|
||||
au FocusLost * :wa
|
||||
|
||||
" disables showing us the current mode in the command line since airline takes
|
||||
" care of it
|
||||
set noshowmode
|
||||
|
||||
" highlight everything that goes over 80 columns
|
||||
highlight ColorColumn ctermbg=magenta
|
||||
call matchadd('ColorColumn', '\%81v', 100)
|
||||
|
||||
" set our leader key to space since with hjkl, space is largely useless
|
||||
let mapleader = "\<Space>"
|
||||
" maps the leader for buffer local mappings (e.g. vim-waikiki for files under
|
||||
" the root dir to the same key -- might lead to incompatibilities, will have
|
||||
" to test)
|
||||
let maplocalleader = "\<Space>"
|
||||
" set jk to escape, in case capslock is not mapped to escape on the system
|
||||
inoremap jk <ESC>
|
||||
|
||||
" remove search highlights by pressing space+/ - the key for searching the
|
||||
" first place
|
||||
nnoremap <leader>/ :noh<cr>
|
||||
|
||||
" quickly edit vimrc with leader+V
|
||||
nnoremap <leader>V :vsp academia_pandoc.vim<cr>
|
||||
" automatically source the vimrc file whenever it is saved (causes slowdown
|
||||
" when done in MANY successions)
|
||||
" au BufWritePost init.vim so ~/.config/nvim/init.vim
|
||||
" source vimrc with keystroke combination
|
||||
nnoremap <leader>VV :source academia_pandoc.vim<cr>
|
||||
|
||||
|
||||
" 'open new buffer' with leader-t (opens new buffer and switches to it)
|
||||
" open actual new tab with leader-T
|
||||
nnoremap <leader>t :vsp .<cr>
|
||||
nnoremap <leader>T :tabedit .<cr>
|
||||
|
||||
" stronger versions of left,right - move all the way
|
||||
nnoremap H ^
|
||||
nnoremap L $
|
||||
|
||||
" }}}
|
||||
" CUSTOMIZATION {{{
|
||||
|
||||
" defines plugin directory
|
||||
" Install plugins from vim with :PlugInstall
|
||||
silent! if plug#begin('~/.local/share/nvim/plugged')
|
||||
Plug 'christoomey/vim-tmux-navigator'
|
||||
" automatically switch between relative and absolute numbers as buffers move
|
||||
" into / out of focus (requires number & relativenumber to be set)
|
||||
Plug 'jeffkreeftmeijer/vim-numbertoggle'
|
||||
Plug 'rakr/vim-one'
|
||||
|
||||
Plug 'vim-pandoc/vim-pandoc'
|
||||
Plug 'vim-pandoc/vim-pandoc-syntax'
|
||||
|
||||
call plug#end()
|
||||
endif
|
||||
|
||||
set foldlevel=2
|
||||
|
||||
" PLUGIN: vim-pandoc
|
||||
" handle markdown files with pandoc (and pandoc syntax!)
|
||||
let g:pandoc#filetypes#pandoc_markdown = 1
|
||||
" disable all default keymaps
|
||||
let g:pandoc#keyboard#use_default_mappings=0
|
||||
let g:pandoc#hypertext#use_default_mappings=0
|
||||
" if there's a pdf and an html or similar, open the pdf
|
||||
let g:pandoc#command#prefer_pdf=1
|
||||
" look for bibtex files w/ same name as edited one, then .bib in current dir, yaml frontmatter, and finally the globally set bibs file
|
||||
let g:pandoc#biblio#sources="bcyg"
|
||||
" the globally set bibs file
|
||||
let g:pandoc#biblio#bibs=["academia.bib"]
|
||||
let g:pandoc#biblio#use_bibtool=1
|
||||
let g:pandoc#biblio#use_preview=1
|
||||
let g:pandoc#completion#bib#mode='citeproc'
|
||||
let g:pandoc#folding#fold_yaml=1
|
||||
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
|
||||
|
||||
" follow and open links with pandoc
|
||||
" open a file with either local means, or let the system decide
|
||||
nnoremap <silent> gX :<C-u>call pandoc#hypertext#OpenSystem()<cr>
|
||||
nnoremap <silent> gx :<C-u>call pandoc#hypertext#OpenLocal()<cr>
|
||||
" open a link in the editor (this buffer, or split)
|
||||
nnoremap <silent> gf :<C-u>call pandoc#hypertext#OpenLink( g:pandoc#hypertext#edit_open_cmd )<cr>
|
||||
nnoremap <silent> <CR> :<C-u>call pandoc#hypertext#OpenLink( g:pandoc#hypertext#edit_open_cmd )<cr>
|
||||
nnoremap <silent> gF :<C-u>call pandoc#hypertext#OpenLink( g:pandoc#hypertext#split_open_cmd )<cr>
|
||||
nnoremap <silent> gF :<C-u>call pandoc#hypertext#OpenLink( g:pandoc#hypertext#split_open_cmd )<cr>
|
||||
" go back a link
|
||||
nnoremap <silent> gb :<C-u>call pandoc#hypertext#BackFromLink()<cr>
|
||||
nnoremap <silent> <BS> :<C-u>call pandoc#hypertext#BackFromLink()<cr>
|
||||
|
||||
" Add pandoc citations to deoplete automatic completions
|
||||
"call deoplete#custom#var('omni', 'input_patterns', {
|
||||
" \ 'pandoc': '@'
|
||||
" \})
|
||||
|
||||
" }}}
|
||||
colo one
|
||||
|
|
@ -0,0 +1,153 @@
|
|||
" vim: set foldmethod=marker foldlevel=1 nomodeline:
|
||||
" ================================================================================
|
||||
" .init.vim / .vimrc of Marty Oehme {{{
|
||||
" ================================================================================
|
||||
"
|
||||
" - stolen from many different sources including
|
||||
" Steve Losh
|
||||
" Junegunn Choi
|
||||
" Tim Pope
|
||||
|
||||
" this config does not set nocompatible - neovim does this automatically
|
||||
" this config does not set filetype plugin - vim-sensible does this
|
||||
" }}}
|
||||
" PLUGIN INSTALLATION - handled by VIM-PLUG {{{
|
||||
" ================================================================================
|
||||
"
|
||||
" automatically install vim-plug if it does not exist
|
||||
" Note: this installs it in the neovim folder, not the vim folder
|
||||
if empty(glob('~/.local/share/nvim/site/autoload/plug.vim'))
|
||||
silent !curl -fLo ~/.local/share/nvim/site/autoload/plug.vim --create-dirs
|
||||
\ https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim
|
||||
autocmd VimEnter * PlugInstall --sync | source academia.vim | q
|
||||
endif
|
||||
|
||||
" automatically install any missing plugins
|
||||
autocmd VimEnter *
|
||||
\ if len(filter(values(g:plugs), '!isdirectory(v:val.dir)'))
|
||||
\| PlugInstall --sync | q
|
||||
\| endif
|
||||
"
|
||||
" set truecolor (neovim)
|
||||
set termguicolors
|
||||
|
||||
" sets tabs to be 2 characters, expanded into spaces, but still removable with
|
||||
" one press of backspace.
|
||||
" great explanation: http://vimcasts.org/transcripts/2/en/
|
||||
set tabstop=2
|
||||
set shiftwidth=2
|
||||
set softtabstop=2
|
||||
set expandtab
|
||||
|
||||
" set cursor line highlighting, esp useful when using with bracket
|
||||
" highlighting and you don't know which side of the brace the cursor is on
|
||||
set cursorline
|
||||
|
||||
" shows linenumbers relative to the one you are on, for easy movement and
|
||||
" dNUMBERd deletions
|
||||
set number relativenumber
|
||||
|
||||
" keeps an undofile next to files so that you can even undo if vim is closed
|
||||
" in between
|
||||
set undofile
|
||||
|
||||
" ignores case by default but will use case when search is specifically not
|
||||
" all lowercased
|
||||
set ignorecase
|
||||
set smartcase
|
||||
|
||||
" whenever vim loses focus, save
|
||||
au FocusLost * :wa
|
||||
|
||||
" disables showing us the current mode in the command line since airline takes
|
||||
" care of it
|
||||
set noshowmode
|
||||
|
||||
" highlight everything that goes over 80 columns
|
||||
highlight ColorColumn ctermbg=magenta
|
||||
call matchadd('ColorColumn', '\%81v', 100)
|
||||
|
||||
" set our leader key to space since with hjkl, space is largely useless
|
||||
let mapleader = "\<Space>"
|
||||
" maps the leader for buffer local mappings (e.g. vim-waikiki for files under
|
||||
" the root dir to the same key -- might lead to incompatibilities, will have
|
||||
" to test)
|
||||
let maplocalleader = "\<Space>"
|
||||
" set jk to escape, in case capslock is not mapped to escape on the system
|
||||
inoremap jk <ESC>
|
||||
|
||||
" remove search highlights by pressing space+/ - the key for searching the
|
||||
" first place
|
||||
nnoremap <leader>/ :noh<cr>
|
||||
|
||||
" quickly edit vimrc with leader+V
|
||||
nnoremap <leader>V :vsp academia.vim<cr>
|
||||
" automatically source the vimrc file whenever it is saved (causes slowdown
|
||||
" when done in MANY successions)
|
||||
" au BufWritePost init.vim so ~/.config/nvim/init.vim
|
||||
" source vimrc with keystroke combination
|
||||
nnoremap <leader>VV :source academia.vim<cr>
|
||||
|
||||
|
||||
" 'open new buffer' with leader-t (opens new buffer and switches to it)
|
||||
" open actual new tab with leader-T
|
||||
nnoremap <leader>t :vsp .<cr>
|
||||
nnoremap <leader>T :tabedit .<cr>
|
||||
|
||||
" stronger versions of left,right - move all the way
|
||||
nnoremap H ^
|
||||
nnoremap L $
|
||||
|
||||
" }}}
|
||||
" CUSTOMIZATION {{{
|
||||
|
||||
" defines plugin directory
|
||||
" Install plugins from vim with :PlugInstall
|
||||
silent! if plug#begin('~/.local/share/nvim/plugged')
|
||||
Plug 'christoomey/vim-tmux-navigator'
|
||||
" automatically switch between relative and absolute numbers as buffers move
|
||||
" into / out of focus (requires number & relativenumber to be set)
|
||||
Plug 'jeffkreeftmeijer/vim-numbertoggle'
|
||||
Plug 'rakr/vim-one'
|
||||
|
||||
" CUSTOM STUFF BEGINS HERE
|
||||
Plug 'Shougo/unite.vim'
|
||||
Plug 'rafaqz/citation.vim'
|
||||
|
||||
|
||||
call plug#end()
|
||||
endif
|
||||
|
||||
call unite#filters#matcher_default#use(['matcher_fuzzy'])
|
||||
let g:unite_source_grep_command = "rg"
|
||||
|
||||
" Custom mappings for the unite buffer
|
||||
autocmd FileType unite call s:unite_settings()
|
||||
function! s:unite_settings()
|
||||
" Enable navigation with control-j and control-k in insert mode
|
||||
imap <buffer> <C-j> <Plug>(unite_select_next_line)
|
||||
imap <buffer> <C-k> <Plug>(unite_select_previous_line)
|
||||
" control s to split into new buf
|
||||
imap <silent><buffer><expr> <C-s> unite#do_action('split')
|
||||
" simple esc to exit when in insert mode
|
||||
"imap <buffer> <esc> <Plug>(unite_exit)
|
||||
" also esc to exit in normal mode
|
||||
nmap <buffer> <esc> <Plug>(unite_exit)
|
||||
|
||||
nnoremap <silent><buffer><expr> <C-o> unite#do_action('start')
|
||||
imap <silent><buffer><expr> <C-o> unite#do_action('start')
|
||||
nnoremap <silent><buffer><expr> <C-i> unite#do_action('preview')
|
||||
imap <silent><buffer><expr> <C-i> unite#do_action('preview')
|
||||
endfunction
|
||||
|
||||
" citation.vim bibtex citations
|
||||
let g:citation_vim_bibtex_file="academia.bib"
|
||||
let g:citation_vim_mode="bibtex"
|
||||
let g:citation_vim_cache_path='~/.cache/'
|
||||
" insert a citation under cursor (using bibref)
|
||||
nnoremap <silent><leader>cc :<C-u>Unite -buffer-name=citation-start-insert -default-action=append -auto-resize -smartcase -start-insert citation/key<cr>
|
||||
" show info for citation that cursor is currently on
|
||||
nnoremap <silent><leader>ci :<C-u>Unite -input=<C-R><C-W> -default-action=preview -force-immediately citation/combined<cr>
|
||||
|
||||
" }}}
|
||||
colo one
|
||||
117
nvim/.config/nvim/modules_experimental/base_no_plugins.vim
Normal file
117
nvim/.config/nvim/modules_experimental/base_no_plugins.vim
Normal file
|
|
@ -0,0 +1,117 @@
|
|||
" vim: set foldmethod=marker foldlevel=1 nomodeline:
|
||||
" ================================================================================
|
||||
" .init.vim / .vimrc of Marty Oehme {{{
|
||||
" ================================================================================
|
||||
"
|
||||
" - stolen from many different sources including
|
||||
" Steve Losh
|
||||
" Junegunn Choi
|
||||
" Tim Pope
|
||||
|
||||
" this config does not set nocompatible - neovim does this automatically
|
||||
" this config does not set filetype plugin - vim-sensible does this
|
||||
" }}}
|
||||
" PLUGIN INSTALLATION - handled by VIM-PLUG {{{
|
||||
" ================================================================================
|
||||
"
|
||||
" automatically install vim-plug if it does not exist
|
||||
" Note: this installs it in the neovim folder, not the vim folder
|
||||
if empty(glob('~/.local/share/nvim/site/autoload/plug.vim'))
|
||||
silent !curl -fLo ~/.local/share/nvim/site/autoload/plug.vim --create-dirs
|
||||
\ https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim
|
||||
autocmd VimEnter * PlugInstall --sync | source academia.vim | q
|
||||
endif
|
||||
|
||||
" automatically install any missing plugins
|
||||
autocmd VimEnter *
|
||||
\ if len(filter(values(g:plugs), '!isdirectory(v:val.dir)'))
|
||||
\| PlugInstall --sync | q
|
||||
\| endif
|
||||
"
|
||||
" set truecolor (neovim)
|
||||
set termguicolors
|
||||
|
||||
" sets tabs to be 2 characters, expanded into spaces, but still removable with
|
||||
" one press of backspace.
|
||||
" great explanation: http://vimcasts.org/transcripts/2/en/
|
||||
set tabstop=2
|
||||
set shiftwidth=2
|
||||
set softtabstop=2
|
||||
set expandtab
|
||||
|
||||
" set cursor line highlighting, esp useful when using with bracket
|
||||
" highlighting and you don't know which side of the brace the cursor is on
|
||||
set cursorline
|
||||
|
||||
" shows linenumbers relative to the one you are on, for easy movement and
|
||||
" dNUMBERd deletions
|
||||
set number relativenumber
|
||||
|
||||
" keeps an undofile next to files so that you can even undo if vim is closed
|
||||
" in between
|
||||
set undofile
|
||||
|
||||
" ignores case by default but will use case when search is specifically not
|
||||
" all lowercased
|
||||
set ignorecase
|
||||
set smartcase
|
||||
|
||||
" whenever vim loses focus, save
|
||||
au FocusLost * :wa
|
||||
|
||||
" disables showing us the current mode in the command line since airline takes
|
||||
" care of it
|
||||
set noshowmode
|
||||
|
||||
" highlight everything that goes over 80 columns
|
||||
highlight ColorColumn ctermbg=magenta
|
||||
call matchadd('ColorColumn', '\%81v', 100)
|
||||
|
||||
" set our leader key to space since with hjkl, space is largely useless
|
||||
let mapleader = "\<Space>"
|
||||
" maps the leader for buffer local mappings (e.g. vim-waikiki for files under
|
||||
" the root dir to the same key -- might lead to incompatibilities, will have
|
||||
" to test)
|
||||
let maplocalleader = "\<Space>"
|
||||
" set jk to escape, in case capslock is not mapped to escape on the system
|
||||
inoremap jk <ESC>
|
||||
|
||||
" remove search highlights by pressing space+/ - the key for searching the
|
||||
" first place
|
||||
nnoremap <leader>/ :noh<cr>
|
||||
|
||||
" quickly edit vimrc with leader+V
|
||||
nnoremap <leader>V :vsp academia.vim<cr>
|
||||
" automatically source the vimrc file whenever it is saved (causes slowdown
|
||||
" when done in MANY successions)
|
||||
" au BufWritePost init.vim so ~/.config/nvim/init.vim
|
||||
" source vimrc with keystroke combination
|
||||
nnoremap <leader>VV :source academia.vim<cr>
|
||||
|
||||
|
||||
" 'open new buffer' with leader-t (opens new buffer and switches to it)
|
||||
" open actual new tab with leader-T
|
||||
nnoremap <leader>t :vsp .<cr>
|
||||
nnoremap <leader>T :tabedit .<cr>
|
||||
|
||||
" stronger versions of left,right - move all the way
|
||||
nnoremap H ^
|
||||
nnoremap L $
|
||||
|
||||
" }}}
|
||||
" CUSTOMIZATION {{{
|
||||
|
||||
" defines plugin directory
|
||||
" Install plugins from vim with :PlugInstall
|
||||
silent! if plug#begin('~/.local/share/nvim/plugged')
|
||||
Plug 'christoomey/vim-tmux-navigator'
|
||||
" automatically switch between relative and absolute numbers as buffers move
|
||||
" into / out of focus (requires number & relativenumber to be set)
|
||||
Plug 'jeffkreeftmeijer/vim-numbertoggle'
|
||||
Plug 'rakr/vim-one'
|
||||
|
||||
call plug#end()
|
||||
endif
|
||||
|
||||
" }}}
|
||||
colo one
|
||||
106
nvim/.config/nvim/modules_experimental/coc-completion.vim
Normal file
106
nvim/.config/nvim/modules_experimental/coc-completion.vim
Normal file
|
|
@ -0,0 +1,106 @@
|
|||
" some things do not work perfectly yet
|
||||
" I have to take a look at the bindings
|
||||
" MOSTLY, it works
|
||||
" but startup takes ages (>1s)
|
||||
|
||||
" one more thing needs to be done for clever coc linting/fixing:
|
||||
" create a file called coc-settings.json in nvim config dir with the
|
||||
" following content:
|
||||
"
|
||||
"{
|
||||
" // Require .prettierrc
|
||||
" "prettier.requireConfig": true,
|
||||
" // Tslint on save
|
||||
" "tslint.enable": true,
|
||||
" "tslint.autoFixOnSave": true,
|
||||
" // Run prettier (and others)
|
||||
" "coc.preferences.formatOnSaveFiletypes": [
|
||||
" "css",
|
||||
" "markdown",
|
||||
" "Markdown",
|
||||
" "javascript",
|
||||
" "javascriptreact",
|
||||
" "typescript",
|
||||
" "typescriptreact"
|
||||
" ]
|
||||
"}
|
||||
|
||||
Plug 'neoclide/coc.nvim', {'do': { -> coc#util#install()}, 'on': [], 'for': []}
|
||||
Plug 'neoclide/coc-snippets', {'do': 'yarn install --frozen-lockfile'}
|
||||
Plug 'neoclide/coc-tsserver', {'do': 'yarn install --frozen-lockfile'}
|
||||
Plug 'neoclide/coc-prettier', {'do': 'yarn install --frozen-lockfile'}
|
||||
Plug 'neoclide/coc-eslint', {'do': 'yarn install --frozen-lockfile'}
|
||||
Plug 'neoclide/coc-tslint', {'do': 'yarn install --frozen-lockfile'}
|
||||
Plug 'neoclide/coc-html', {'do': 'yarn install --frozen-lockfile'}
|
||||
Plug 'neoclide/coc-css', {'do': 'yarn install --frozen-lockfile'}
|
||||
" Plug 'neoclide/coc-highlight', {'do': 'yarn install --frozen-lockfile'} " color highlighting
|
||||
Plug 'neoclide/coc-json', {'do': 'yarn install --frozen-lockfile'}
|
||||
Plug 'neoclide/coc-yaml', {'do': 'yarn install --frozen-lockfile'}
|
||||
Plug 'neoclide/coc-rls', {'do': 'yarn install --frozen-lockfile'}
|
||||
Plug 'neoclide/coc-git', {'do': 'yarn install --frozen-lockfile'}
|
||||
Plug 'fannheyward/coc-rust-analyzer', {'do': 'yarn install --frozen-lockfile'}
|
||||
Plug 'fannheyward/coc-markdownlint', {'do': 'yarn install --frozen-lockfile'}
|
||||
Plug 'fannheyward/coc-texlab', {'do': 'yarn install --frozen-lockfile'}
|
||||
Plug 'iamcco/coc-vimlsp', {'do': 'yarn install --frozen-lockfile'}
|
||||
|
||||
" lazy loading since they require a lot of startup time
|
||||
augroup load_ide_features
|
||||
autocmd!
|
||||
autocmd InsertEnter * call plug#load('coc.nvim')
|
||||
\| autocmd! load_ide_features
|
||||
augroup end
|
||||
|
||||
" https://github.com/neoclide/coc.nvim#example-vim-configuration
|
||||
inoremap <silent><expr> <c-space> coc#refresh()
|
||||
|
||||
" gd - go to definition of word under cursor
|
||||
nmap <silent> gd <Plug>(coc-definition)
|
||||
nmap <silent> gy <Plug>(coc-type-definition)
|
||||
|
||||
" gi - go to implementation
|
||||
nmap <silent> gi <Plug>(coc-implementation)
|
||||
|
||||
" gr - find references
|
||||
nmap <silent> gr <Plug>(coc-references)
|
||||
|
||||
" gh - get hint on whatever's under the cursor
|
||||
nnoremap <silent> K :call <SID>show_documentation()<CR>
|
||||
nnoremap <silent> gh :call <SID>show_documentation()<CR>
|
||||
|
||||
function! s:show_documentation()
|
||||
if &filetype == 'vim'
|
||||
execute 'h '.expand('<cword>')
|
||||
else
|
||||
call CocAction('doHover')
|
||||
endif
|
||||
endfunction
|
||||
|
||||
" " Highlight symbol under cursor on CursorHold
|
||||
" autocmd CursorHold * silent call CocActionAsync('highlight')
|
||||
|
||||
nnoremap <silent> <leader>co :<C-u>CocList outline<cr>
|
||||
nnoremap <silent> <leader>cs :<C-u>CocList -I symbols<cr>
|
||||
|
||||
" List errors
|
||||
nnoremap <silent> <leader>cl :<C-u>CocList locationlist<cr>
|
||||
|
||||
" list commands available in tsserver (and others)
|
||||
nnoremap <silent> <leader>cc :<C-u>CocList commands<cr>
|
||||
|
||||
" restart when tsserver gets wonky
|
||||
nnoremap <silent> <leader>cR :<C-u>CocRestart<CR>
|
||||
|
||||
" view all errors
|
||||
nnoremap <silent> <leader>cl :<C-u>CocList locationlist<CR>
|
||||
|
||||
" manage extensions
|
||||
nnoremap <silent> <leader>cx :<C-u>CocList extensions<cr>
|
||||
|
||||
" rename the current word in the cursor
|
||||
nmap <leader>cr <Plug>(coc-rename)
|
||||
nmap <leader>cf <Plug>(coc-format-selected)
|
||||
vmap <leader>cf <Plug>(coc-format-selected)
|
||||
|
||||
" run code actions
|
||||
vmap <leader>ca <Plug>(coc-codeaction-selected)
|
||||
nmap <leader>ca <Plug>(coc-codeaction-selected)
|
||||
47
nvim/.config/nvim/plugin/bibcite.vim
Normal file
47
nvim/.config/nvim/plugin/bibcite.vim
Normal file
|
|
@ -0,0 +1,47 @@
|
|||
" set up fzf-bibtex
|
||||
let g:fzf_bibtex_cache = '~/.cache/'
|
||||
let g:fzf_bibtex_sources = g:pandoc#biblio#bibs
|
||||
|
||||
" prepare bibtex_ls function to look for bib files in cwd/parent/subdirs,
|
||||
" attach the standard bibtex source file
|
||||
" return the command with standard cache directory filled
|
||||
function! s:bibtex_ls(...)
|
||||
let bibfiles = (
|
||||
\ globpath('.', '*.bib', v:true, v:true) +
|
||||
\ globpath('..', '*.bib', v:true, v:true) +
|
||||
\ globpath('*/', '*.bib', v:true, v:true)
|
||||
\ )
|
||||
let bibfiles = join(bibfiles, ' ')
|
||||
let source_cmd = 'bibtex-ls -cache ' . g:fzf_bibtex_cache . ' ' .bibfiles . ' ' . join(g:fzf_bibtex_sources)
|
||||
return source_cmd
|
||||
endfunction
|
||||
|
||||
" insert citation from normal mode at cursor (with brackets)
|
||||
function! s:bibtex_cite_sink(lines)
|
||||
let r=system("bibtex-cite ", a:lines)
|
||||
execute ':normal! i[' . r . ']'
|
||||
endfunction
|
||||
command! -bang -nargs=* CiteRef call fzf#run(fzf#wrap({
|
||||
\ 'source': <sid>bibtex_ls(<q-args>),
|
||||
\ 'sink*': function('<sid>bibtex_cite_sink'),
|
||||
\ 'up': '25%',
|
||||
\ 'options': '--ansi --multi --prompt "Cite> "'
|
||||
\ }))
|
||||
" insert citation from insert mode at cursor (no brackets inserted)
|
||||
function! s:bibtex_cite_sink_insert(lines)
|
||||
let r=system("bibtex-cite ", a:lines)
|
||||
execute ':normal! i' . r
|
||||
call feedkeys('a', 'n')
|
||||
endfunction
|
||||
" insert markdown formatted reference
|
||||
function! s:bibtex_markdown_sink(lines)
|
||||
let r=system("bibtex-markdown -cache " . g:fzf_bibtex_cache . ' ' . join(g:fzf_bibtex_sources), a:lines)
|
||||
echo join(a:lines, '; ')
|
||||
execute ':normal! i' . r
|
||||
endfunction
|
||||
command! -bang -nargs=* CiteMarkdown call fzf#run(fzf#wrap({
|
||||
\ 'source': <sid>bibtex_ls(),
|
||||
\ 'sink*': function('<sid>bibtex_markdown_sink'),
|
||||
\ 'up': '25%',
|
||||
\ 'options': '--ansi --multi --prompt "Markdown> "'
|
||||
\ }))
|
||||
22
nvim/.config/nvim/plugin/compiledoc.vim
Normal file
22
nvim/.config/nvim/plugin/compiledoc.vim
Normal file
|
|
@ -0,0 +1,22 @@
|
|||
function CompileDoc()
|
||||
:execute(":w!")
|
||||
:execute(":!compile \"%\"")
|
||||
endfunction
|
||||
|
||||
function CompileDocNoOutput()
|
||||
:execute(":w!")
|
||||
:execute(":silent !compile \"%\"")
|
||||
endfunction
|
||||
|
||||
function CompiledOpen()
|
||||
:execute(":silent !open-compiled \"%\"")
|
||||
endfunction
|
||||
|
||||
function CompileDocAndOpen()
|
||||
call CompileDocNoOutput()
|
||||
call CompiledOpen()
|
||||
endfunction
|
||||
|
||||
command CompileDoc call CompileDoc()
|
||||
command CompileOpen call CompiledOpen()
|
||||
command CompileDocAndOpen call CompileDocAndOpen()
|
||||
8
nvim/.config/nvim/plugin/searchnotes.vim
Normal file
8
nvim/.config/nvim/plugin/searchnotes.vim
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
function! SearchNotes()
|
||||
let l:curpath=getcwd()
|
||||
:execute(":cd " . g:wiki_root)
|
||||
let l:texttofind=input("Search in Notes: ")
|
||||
:execute(":CtrlSF " . l:texttofind)
|
||||
:CtrlSFFocus
|
||||
:execute(":cd " . l:curpath)
|
||||
endfunction
|
||||
19
nvim/.config/nvim/plugin/showmappings.vim
Normal file
19
nvim/.config/nvim/plugin/showmappings.vim
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
" Show all mapped keys in a list - from https://stackoverflow.com/questions/13990136/display-a-ordered-vim-keyboard-mapping
|
||||
function! s:ShowMaps()
|
||||
let old_reg = getreg("a") " save the current content of register a
|
||||
let old_reg_type = getregtype("a") " save the type of the register as well
|
||||
try
|
||||
redir @a " redirect output to register a
|
||||
" Get the list of all key mappings silently, satisfy "Press ENTER to continue"
|
||||
silent map | call feedkeys("\<CR>")
|
||||
redir END " end output redirection
|
||||
vnew " new buffer in vertical window
|
||||
put a " put content of register
|
||||
" Sort on 4th character column which is the key(s)
|
||||
%!sort -k1.4,1.4
|
||||
finally " Execute even if exception is raised
|
||||
call setreg("a", old_reg, old_reg_type) " restore register a
|
||||
endtry
|
||||
endfunction
|
||||
" use :ShowMaps to call the function
|
||||
command! ShowMappings call s:ShowMaps() " Enable :ShowMaps to call the function
|
||||
80
nvim/.config/nvim/pluglist/base.vim
Normal file
80
nvim/.config/nvim/pluglist/base.vim
Normal file
|
|
@ -0,0 +1,80 @@
|
|||
" 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('<amatch>'))
|
||||
\| 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' }
|
||||
61
nvim/.config/nvim/pluglist/completion.vim
Normal file
61
nvim/.config/nvim/pluglist/completion.vim
Normal file
|
|
@ -0,0 +1,61 @@
|
|||
" 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
|
||||
36
nvim/.config/nvim/pluglist/design.vim
Normal file
36
nvim/.config/nvim/pluglist/design.vim
Normal file
|
|
@ -0,0 +1,36 @@
|
|||
" 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 'rafi/awesome-vim-colorschemes'
|
||||
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 gruvbox
|
||||
34
nvim/.config/nvim/pluglist/latex.vim
Normal file
34
nvim/.config/nvim/pluglist/latex.vim
Normal file
|
|
@ -0,0 +1,34 @@
|
|||
" 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#filetypes#pandoc_markdown = 1
|
||||
let g:pandoc#filetypes#handled = [ "extra", "latex", "markdown", "pandoc", "rst", "textile" ]
|
||||
" disable all default keymaps
|
||||
let g:pandoc#keyboard#use_default_mappings=0
|
||||
let g:pandoc#hypertext#use_default_mappings=0
|
||||
" if there's a pdf and an html or similar, open the pdf
|
||||
let g:pandoc#command#prefer_pdf=1
|
||||
" look for bibtex files w/ same name as edited one, then .bib in current dir, yaml frontmatter, and finally the globally set bibs file
|
||||
let g:pandoc#biblio#sources="bcyg"
|
||||
" the globally set bibs file
|
||||
if $BIBFILE ==? ""
|
||||
let g:pandoc#biblio#bibs=[expand("~/documents/library/academia/academia.bib")]
|
||||
else
|
||||
let g:pandoc#biblio#bibs=[expand($BIBFILE)]
|
||||
endif
|
||||
let g:pandoc#biblio#use_bibtool=1
|
||||
let g:pandoc#biblio#use_preview=1
|
||||
let g:pandoc#completion#bib#mode='citeproc'
|
||||
let g:pandoc#folding#fold_yaml=1
|
||||
let g:pandoc#folding#fastfolds=1
|
||||
" let g:pandoc#folding#level=2
|
||||
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'
|
||||
20
nvim/.config/nvim/pluglist/notes.vim
Normal file
20
nvim/.config/nvim/pluglist/notes.vim
Normal file
|
|
@ -0,0 +1,20 @@
|
|||
Plug 'dyng/ctrlsf.vim'
|
||||
|
||||
Plug 'lervag/wiki.vim'
|
||||
" PLUGIN: wiki.vim
|
||||
if $WIKIROOT ==? ""
|
||||
let g:wiki_root = '~/Nextcloud/Notes/'
|
||||
else
|
||||
let g:wiki_root = $WIKIROOT
|
||||
endif
|
||||
" filetypes to automatically enable the plugin for, seems to take file endings
|
||||
" rather than vim ft
|
||||
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
|
||||
57
nvim/.config/nvim/pluglist/prose.vim
Normal file
57
nvim/.config/nvim/pluglist/prose.vim
Normal file
|
|
@ -0,0 +1,57 @@
|
|||
" 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 <g)> or last <g(> 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 <SID>goyo_enter()
|
||||
autocmd! User GoyoLeave nested call <SID>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()
|
||||
33
nvim/.config/nvim/pluglist/syntaxes.vim
Normal file
33
nvim/.config/nvim/pluglist/syntaxes.vim
Normal file
|
|
@ -0,0 +1,33 @@
|
|||
" 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
|
||||
au FileType go set noexpandtab
|
||||
au FileType go set shiftwidth=4
|
||||
au FileType go set softtabstop=4
|
||||
au FileType go set tabstop=4
|
||||
" enable all sorts of highlighting options for
|
||||
" variables/functions/arguments...
|
||||
let g:go_highlight_build_constraints = 1
|
||||
let g:go_highlight_extra_types = 1
|
||||
let g:go_highlight_fields = 1
|
||||
let g:go_highlight_functions = 1
|
||||
let g:go_highlight_methods = 1
|
||||
let g:go_highlight_operators = 1
|
||||
let g:go_highlight_structs = 1
|
||||
let g:go_highlight_types = 1
|
||||
" enable highlighting of other uses of the same variable
|
||||
let g:go_auto_sameids = 1
|
||||
" automatically import needed dependencies
|
||||
" TODO do I need this? not doing it automatically does lead to more conscious
|
||||
" decision making on imports
|
||||
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'
|
||||
6
nvim/.config/nvim/pluglist/vim.vim
Normal file
6
nvim/.config/nvim/pluglist/vim.vim
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
if has('nvim')
|
||||
finish
|
||||
endif
|
||||
|
||||
" a minimal definition of variables TODO still necessary for nvim?
|
||||
Plug 'tpope/vim-sensible'
|
||||
16
nvim/.config/nvim/watch.lua
Normal file
16
nvim/.config/nvim/watch.lua
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
local w = vim.loop.new_fs_event()
|
||||
local function on_change(err, fname, status)
|
||||
-- Do work...
|
||||
vim.api.nvim_command('checktime')
|
||||
-- Debounce: stop/start.
|
||||
w:stop()
|
||||
watch_file(fname)
|
||||
end
|
||||
function watch_file(fname)
|
||||
local fullpath = vim.api.nvim_call_function(
|
||||
'fnamemodify', {fname, ':p'})
|
||||
w:start(fullpath, {}, vim.schedule_wrap(function(...)
|
||||
on_change(...) end))
|
||||
end
|
||||
vim.api.nvim_command(
|
||||
"command! -nargs=1 Watch call luaeval('watch_file(_A)', expand('<args>'))")
|
||||
Loading…
Add table
Add a link
Reference in a new issue