2019-03-20 13:27:54 +00:00
|
|
|
|
" 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
|
|
|
|
|
|
2019-03-20 17:37:04 +00:00
|
|
|
|
" this config does not set nocompatible - neovim does this automatically
|
|
|
|
|
" this config does not set filetype plugin - vim-sensible does this
|
2019-03-20 13:27:54 +00:00
|
|
|
|
" }}}
|
|
|
|
|
" PLUGIN INSTALLATION - handled by VIM-PLUG {{{
|
|
|
|
|
" ================================================================================
|
|
|
|
|
"
|
2019-03-20 13:06:46 +00:00
|
|
|
|
" automatically install vim-plug if it does not exist
|
|
|
|
|
" Note: this installs it in the neovim folder, not the vim folder
|
2019-05-15 08:28:12 +00:00
|
|
|
|
if empty(glob('~/.local/share/nvim/site/autoload/plug.vim'))
|
2019-03-20 13:06:46 +00:00
|
|
|
|
silent !curl -fLo ~/.local/share/nvim/site/autoload/plug.vim --create-dirs
|
|
|
|
|
\ https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim
|
2019-05-15 08:28:12 +00:00
|
|
|
|
autocmd VimEnter * PlugInstall --sync | source $MYVIMRC | q
|
2019-03-20 13:06:46 +00:00
|
|
|
|
endif
|
|
|
|
|
|
2019-03-20 15:09:48 +00:00
|
|
|
|
" automatically install any missing plugins
|
|
|
|
|
autocmd VimEnter *
|
|
|
|
|
\ if len(filter(values(g:plugs), '!isdirectory(v:val.dir)'))
|
|
|
|
|
\| PlugInstall --sync | q
|
|
|
|
|
\| endif
|
|
|
|
|
|
2019-03-13 14:08:39 +00:00
|
|
|
|
" defines plugin directory
|
2019-03-04 10:47:17 +00:00
|
|
|
|
" Install plugins from vim with :PlugInstall
|
2019-03-20 13:28:50 +00:00
|
|
|
|
silent! if plug#begin('~/.local/share/nvim/plugged')
|
2019-03-04 10:47:17 +00:00
|
|
|
|
|
2019-03-13 14:08:39 +00:00
|
|
|
|
" Base
|
2019-03-20 15:12:13 +00:00
|
|
|
|
" a minimal definition of variables TODO still necessary for nvim?
|
2019-03-04 10:47:17 +00:00
|
|
|
|
Plug 'tpope/vim-sensible'
|
2019-03-20 15:12:13 +00:00
|
|
|
|
" add seamless movement between vim and tmux, switch windows with C-hjkl
|
|
|
|
|
Plug 'christoomey/vim-tmux-navigator'
|
2019-03-20 21:46:24 +00:00
|
|
|
|
" automatically switch between relative and absolute numbers as buffers move
|
|
|
|
|
" into / out of focus (requires number & relativenumber to be set)
|
|
|
|
|
Plug 'jeffkreeftmeijer/vim-numbertoggle'
|
2019-03-13 14:08:39 +00:00
|
|
|
|
|
2019-03-20 23:06:40 +00:00
|
|
|
|
" " Workflow
|
2019-03-20 17:46:02 +00:00
|
|
|
|
Plug 'tpope/vim-commentary' " easily toggle comments for lines, paragraphs etc with gc
|
|
|
|
|
Plug 'tommcdo/vim-exchange' " adds exchange operator with cx. common use: cxiw . on 2 words to switch
|
|
|
|
|
Plug 'tpope/vim-surround' " lets you change surrounding things with cs (or ds to del, ys to add)
|
2019-03-20 18:41:22 +00:00
|
|
|
|
|
2019-03-20 23:06:40 +00:00
|
|
|
|
" " Ecosystem
|
|
|
|
|
" " Plug 'tpope/vim-fugitive' - Will have to take a closer look some other time
|
2019-03-20 15:13:18 +00:00
|
|
|
|
Plug 'scrooloose/nerdtree', { 'on': 'NERDTreeToggle' } " show a directory listing within vim
|
2019-03-20 23:06:40 +00:00
|
|
|
|
Plug 'Xuyuanp/nerdtree-git-plugin', { 'on': 'NERDTreeToggle' } " show git status in nerdtree for files and dirs
|
Add fuzzy tools to vim and shell
In vim:
Use <leader>c to insert a bibtex reference in your text. By default it
is a pandoc reference (@bibref), but it can be changed to latex style
(\cite(bibref)). <leader>CM inserts a pretty-printed reference to the
selected work, using markdown styling. If you want to insert a citation
while writing, use @@ from insertmode to insert the bibref instead.
The settings add two commands: :CiteRef and :CitePretty which call the
respective functions. You can pass any amount of .bibtex libraries to
the commands and they will be available to fuzzy search through.
:CiteEdit also added to fuzzy find a source and open it in vim for editing.
The function is not working yet, I have to find a way to go from the
fuzzy finder to papis, select the correct file and edit it in vim.
In Shell:
Can cd directories (d, D), open files (f, F), open most recently used
(ru), and edit bibtex references (ref). lowercase is a weighted view
over previously used directories/files, Uppercase is a search of the
whole file structure.
Still outstanding:
Needs the same comfort function additions as vim search, especially
reference search. (i.e., open corresponding document, yank path, open
editor,...)
2019-09-04 17:32:11 +00:00
|
|
|
|
|
|
|
|
|
" Fuzzy matching
|
|
|
|
|
Plug 'lotabout/skim.vim'
|
2019-10-17 16:55:32 +00:00
|
|
|
|
Plug 'marty-oehme/notational-fzf-vim', { 'branch': 'origin/switch-fzf-to-skim' }
|
2019-06-11 12:55:55 +00:00
|
|
|
|
Plug 'dyng/ctrlsf.vim'
|
2019-03-13 17:01:53 +00:00
|
|
|
|
|
2019-03-13 14:08:39 +00:00
|
|
|
|
" Language Integration
|
2019-03-17 18:45:29 +00:00
|
|
|
|
Plug 'sheerun/vim-polyglot' " syntax plugins for almost every language
|
2019-03-09 20:27:14 +00:00
|
|
|
|
Plug 'stephpy/vim-yaml'
|
2019-03-20 23:06:40 +00:00
|
|
|
|
Plug 'mhartington/nvim-typescript', {'for': 'typescript','do': './install.sh'}
|
2019-07-03 09:49:24 +00:00
|
|
|
|
Plug 'fatih/vim-go', { 'do': ':GoUpdateBinaries' }
|
|
|
|
|
Plug 'deoplete-plugins/deoplete-go', { 'do': 'make'}
|
2019-07-27 11:42:54 +00:00
|
|
|
|
Plug 'aliou/bats.vim'
|
2019-03-17 18:45:29 +00:00
|
|
|
|
|
|
|
|
|
" HTML Workflow
|
2019-03-20 23:06:40 +00:00
|
|
|
|
Plug 'valloric/matchtagalways', { 'on': [] }
|
|
|
|
|
Plug 'alvan/vim-closetag', { 'on': [] }
|
|
|
|
|
Plug 'jiangmiao/auto-pairs', { 'on': [] } " Auto close brackets and ''
|
|
|
|
|
augroup load_html_utils
|
|
|
|
|
autocmd!
|
|
|
|
|
autocmd InsertEnter * call plug#load('matchtagalways', 'vim-closetag', 'auto-pairs')
|
|
|
|
|
\| autocmd! load_html_utils
|
|
|
|
|
augroup END
|
2019-03-17 18:45:29 +00:00
|
|
|
|
|
2019-10-18 09:02:11 +00:00
|
|
|
|
" 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.
|
|
|
|
|
|
2019-05-20 15:13:38 +00:00
|
|
|
|
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)
|
|
|
|
|
Plug 'rhysd/vim-grammarous', { 'for': ['markdown', 'txt'], 'on': 'Goyo' } " integrate vim with languagetool for grammar checking (needs java8)
|
2019-03-20 17:37:04 +00:00
|
|
|
|
|
2019-09-02 20:45:24 +00:00
|
|
|
|
" RMarkdown & LaTeX workflow
|
|
|
|
|
Plug 'vim-pandoc/vim-pandoc-syntax'
|
|
|
|
|
Plug 'vim-pandoc/vim-pandoc'
|
2019-11-04 18:26:36 +00:00
|
|
|
|
" Plug 'vim-pandoc/vim-rmarkdown'
|
2019-09-02 20:45:24 +00:00
|
|
|
|
|
2019-05-20 11:07:10 +00:00
|
|
|
|
" Note-Taking Workflow
|
2019-05-20 16:18:48 +00:00
|
|
|
|
Plug 'lervag/wiki.vim'
|
2019-05-20 11:07:10 +00:00
|
|
|
|
|
2019-03-17 18:45:29 +00:00
|
|
|
|
" For async completion
|
2019-03-20 23:06:40 +00:00
|
|
|
|
Plug 'Shougo/deoplete.nvim', { 'on': [] } " automatic suggestions, can also perhaps be changed for newer plugs
|
2019-07-03 09:49:24 +00:00
|
|
|
|
Plug 'Shougo/echodoc.vim', { 'on': [] }
|
2019-03-20 23:06:40 +00:00
|
|
|
|
Plug 'w0rp/ale', { 'on': [] } " asynchronous linting - might be superseded by lsp or coc.nvim at some point
|
|
|
|
|
" lazy loading since they require a lot of startup time
|
|
|
|
|
augroup load_ide_features
|
|
|
|
|
autocmd!
|
2019-07-03 09:49:24 +00:00
|
|
|
|
autocmd InsertEnter * call plug#load('ale', 'deoplete.nvim', 'echodoc.vim')
|
2019-03-20 23:06:40 +00:00
|
|
|
|
\| autocmd! load_ide_features
|
|
|
|
|
autocmd InsertEnter * call deoplete#enable()
|
2019-07-03 09:49:24 +00:00
|
|
|
|
autocmd InsertEnter * call echodoc#enable()
|
2019-11-04 18:26:36 +00:00
|
|
|
|
|
|
|
|
|
" Add pandoc citations to deoplete automatic completions
|
|
|
|
|
autocmd InsertEnter * call deoplete#custom#var('omni', 'input_patterns', {
|
|
|
|
|
\ 'pandoc': '@'
|
|
|
|
|
\})
|
|
|
|
|
|
2019-03-20 23:06:40 +00:00
|
|
|
|
augroup END
|
2019-03-04 10:47:17 +00:00
|
|
|
|
|
2019-03-13 14:08:39 +00:00
|
|
|
|
" Design
|
|
|
|
|
Plug 'vim-airline/vim-airline'
|
|
|
|
|
Plug 'vim-airline/vim-airline-themes'
|
2019-03-13 16:18:47 +00:00
|
|
|
|
Plug 'edkolev/tmuxline.vim'
|
2019-03-13 14:08:39 +00:00
|
|
|
|
|
|
|
|
|
" Colorschemes
|
2019-03-20 15:12:46 +00:00
|
|
|
|
Plug 'morhetz/gruvbox'
|
2019-07-03 09:49:24 +00:00
|
|
|
|
Plug 'rakr/vim-one'
|
2019-09-02 21:21:56 +00:00
|
|
|
|
Plug 'reedes/vim-colors-pencil'
|
2019-03-13 14:08:39 +00:00
|
|
|
|
|
2019-03-04 10:47:17 +00:00
|
|
|
|
call plug#end()
|
2019-03-20 13:28:50 +00:00
|
|
|
|
endif
|
2019-03-09 20:27:14 +00:00
|
|
|
|
|
2019-03-20 13:27:54 +00:00
|
|
|
|
" }}}
|
|
|
|
|
" PLUGIN CONFIGURATION {{{
|
|
|
|
|
" ================================================================================
|
2019-03-20 15:13:18 +00:00
|
|
|
|
|
|
|
|
|
" PLUGIN: NERDTree
|
|
|
|
|
" 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
|
|
|
|
|
|
2019-03-20 17:37:04 +00:00
|
|
|
|
" PLUGIN: markdown-group
|
2019-05-20 15:13:38 +00:00
|
|
|
|
" unify markdown extensions to all use markdown filetype
|
|
|
|
|
au! BufRead,BufNewFile *.markdown set filetype=markdown
|
|
|
|
|
au! BufRead,BufNewFile *.md set filetype=markdown
|
|
|
|
|
au! BufRead,BufNewFile *.mkd set filetype=markdown
|
2019-10-24 15:06:30 +00:00
|
|
|
|
|
2019-05-20 15:13:38 +00:00
|
|
|
|
" automatically enables markdown plugins for md & txt files
|
|
|
|
|
function! Prose()
|
2019-09-02 20:45:24 +00:00
|
|
|
|
call plug#load('vim-pencil')
|
2019-05-20 15:13:38 +00:00
|
|
|
|
call pencil#init()
|
|
|
|
|
" PLUGIN: vim-textobj-sentence
|
|
|
|
|
" enable extended sentence textobject use on md and plaintext files
|
|
|
|
|
call textobj#sentence#init()
|
2019-05-20 16:18:48 +00:00
|
|
|
|
" hide the markdown cruft
|
2019-10-24 15:06:30 +00:00
|
|
|
|
set conceallevel=2
|
2019-05-20 15:13:38 +00:00
|
|
|
|
endfunction
|
2019-03-20 17:37:04 +00:00
|
|
|
|
" enable syntax highlighting for codeblocks WITHIN markdown
|
|
|
|
|
let g:markdown_fenced_languages = ['html', 'python', 'bash=sh', 'javascipt', 'go']
|
|
|
|
|
|
2019-05-20 15:13:38 +00:00
|
|
|
|
" call the prose function defined above for any md files
|
2019-11-04 18:26:36 +00:00
|
|
|
|
autocmd FileType pandoc,markdown,txt,rmarkdown call Prose()
|
2019-05-20 15:13:38 +00:00
|
|
|
|
" or invoke it manually by writing :Prose
|
|
|
|
|
command! -nargs=0 Prose call Prose()
|
2019-03-20 18:41:22 +00:00
|
|
|
|
|
2019-09-02 20:45:24 +00:00
|
|
|
|
" PLUGIN: vim-pandoc
|
2019-11-04 18:26:36 +00:00
|
|
|
|
" 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
|
2019-09-02 20:45:24 +00:00
|
|
|
|
let g:pandoc#command#prefer_pdf=1
|
2019-11-04 18:26:36 +00:00
|
|
|
|
" 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
|
2019-09-02 20:45:24 +00:00
|
|
|
|
let g:pandoc#biblio#bibs=["~/Nextcloud/Library/academia/academia.bib"]
|
2019-11-04 18:26:36 +00:00
|
|
|
|
let g:pandoc#biblio#use_bibtool=1
|
|
|
|
|
let g:pandoc#biblio#use_preview=1
|
2019-09-02 20:45:24 +00:00
|
|
|
|
let g:pandoc#completion#bib#mode='citeproc'
|
|
|
|
|
let g:pandoc#folding#fold_yaml=1
|
|
|
|
|
let g:pandoc#folding#fastfolds=1
|
2019-11-04 18:26:36 +00:00
|
|
|
|
let g:pandoc#folding#level=2
|
2019-09-02 20:45:24 +00:00
|
|
|
|
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
|
2019-10-18 09:02:11 +00:00
|
|
|
|
let g:pandoc#syntax#conceal#use = 1
|
2019-10-24 15:06:30 +00:00
|
|
|
|
let g:pandoc#syntax#conceal#urls = 1
|
2019-11-04 18:26:36 +00:00
|
|
|
|
"
|
|
|
|
|
" 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>
|
2019-09-02 20:45:24 +00:00
|
|
|
|
|
2019-05-20 16:18:48 +00:00
|
|
|
|
" PLUGIN: wiki.vim
|
2019-06-12 12:18:46 +00:00
|
|
|
|
if $WIKIROOT ==? ""
|
|
|
|
|
let g:wiki_root = '~/Nextcloud/Notes/'
|
|
|
|
|
else
|
|
|
|
|
let g:wiki_root = $WIKIROOT
|
|
|
|
|
endif
|
2019-05-20 16:18:48 +00:00
|
|
|
|
" 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'
|
2019-06-13 09:12:55 +00:00
|
|
|
|
let g:wiki_mappings_use_defaults = 1
|
|
|
|
|
" 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
|
2019-06-12 12:22:28 +00:00
|
|
|
|
let g:wiki_mappings_global = {
|
2019-06-13 09:12:55 +00:00
|
|
|
|
\ '<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>======================',
|
2019-06-12 12:22:28 +00:00
|
|
|
|
\}
|
2019-05-20 16:18:48 +00:00
|
|
|
|
|
2019-06-13 09:12:55 +00:00
|
|
|
|
|
2019-03-20 17:37:04 +00:00
|
|
|
|
" PLUGIN: vim-pencil
|
2019-03-20 21:25:21 +00:00
|
|
|
|
" 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'
|
2019-03-20 17:37:04 +00:00
|
|
|
|
|
|
|
|
|
" 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
|
2019-03-20 21:25:21 +00:00
|
|
|
|
" disable line highlighting, we really don't need it for prose
|
|
|
|
|
set nocursorline
|
2019-03-20 17:37:04 +00:00
|
|
|
|
" 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
|
2019-03-20 21:25:21 +00:00
|
|
|
|
set cursorline
|
2019-03-20 17:37:04 +00:00
|
|
|
|
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()
|
|
|
|
|
|
Add fuzzy tools to vim and shell
In vim:
Use <leader>c to insert a bibtex reference in your text. By default it
is a pandoc reference (@bibref), but it can be changed to latex style
(\cite(bibref)). <leader>CM inserts a pretty-printed reference to the
selected work, using markdown styling. If you want to insert a citation
while writing, use @@ from insertmode to insert the bibref instead.
The settings add two commands: :CiteRef and :CitePretty which call the
respective functions. You can pass any amount of .bibtex libraries to
the commands and they will be available to fuzzy search through.
:CiteEdit also added to fuzzy find a source and open it in vim for editing.
The function is not working yet, I have to find a way to go from the
fuzzy finder to papis, select the correct file and edit it in vim.
In Shell:
Can cd directories (d, D), open files (f, F), open most recently used
(ru), and edit bibtex references (ref). lowercase is a weighted view
over previously used directories/files, Uppercase is a search of the
whole file structure.
Still outstanding:
Needs the same comfort function additions as vim search, especially
reference search. (i.e., open corresponding document, yank path, open
editor,...)
2019-09-04 17:32:11 +00:00
|
|
|
|
" PLUGIN: fzf-bibtex
|
|
|
|
|
" Citation and Bibtex utilities
|
|
|
|
|
let g:bibtex_cache = '/home/marty/.cache/'
|
|
|
|
|
let g:bibtex_source = '/home/marty/Nextcloud/Library/academia/academia.bib'
|
|
|
|
|
|
|
|
|
|
function! Bibtex_ls(...)
|
|
|
|
|
return 'bibtex-ls -cache ' . g:bibtex_cache . ' ' . g:bibtex_source . ' ' . join(a:000, ' ')
|
|
|
|
|
endfunction
|
|
|
|
|
|
|
|
|
|
" insert citation from insert mode at cursor
|
|
|
|
|
function! s:bibtex_cite_sink_insert(lines)
|
|
|
|
|
let r=system("bibtex-cite ", a:lines)
|
|
|
|
|
execute ':normal! i' . r
|
|
|
|
|
call feedkeys('a', 'n')
|
|
|
|
|
endfunction
|
|
|
|
|
inoremap <silent> @@ <c-g>u<c-o>:call skim#run({
|
|
|
|
|
\ 'source': Bibtex_ls(),
|
|
|
|
|
\ 'sink*': function('<sid>bibtex_cite_sink_insert'),
|
|
|
|
|
\ 'up': '25%',
|
|
|
|
|
\ 'options': '--ansi --multi --prompt "Cite> "'})<CR>
|
|
|
|
|
|
|
|
|
|
" insert citation from normal mode at cursor
|
|
|
|
|
function! s:bibtex_cite_sink(lines)
|
|
|
|
|
let r=system("bibtex-cite ", a:lines)
|
|
|
|
|
execute ':normal! i' . r
|
|
|
|
|
endfunction
|
|
|
|
|
command! -bang -nargs=* CiteRef call skim#run({
|
|
|
|
|
\ 'source': Bibtex_ls(<q-args>),
|
|
|
|
|
\ 'sink*': function('<sid>bibtex_cite_sink'),
|
|
|
|
|
\ 'up': '25%',
|
|
|
|
|
\ 'options': '--ansi --multi --prompt "Cite> "'
|
|
|
|
|
\ })
|
|
|
|
|
|
|
|
|
|
" insert pretty formatted markdown reference
|
|
|
|
|
function! s:bibtex_markdown_sink(lines)
|
|
|
|
|
let r=system("bibtex-markdown " . g:bibtex_source, a:lines)
|
|
|
|
|
echo join(a:lines, '; ')
|
|
|
|
|
execute ':normal! i' . r
|
|
|
|
|
endfunction
|
|
|
|
|
command! -bang -nargs=* CitePretty call skim#run({
|
|
|
|
|
\ 'source': Bibtex_ls(<q-args>),
|
|
|
|
|
\ 'sink*': function('<sid>bibtex_markdown_sink'),
|
|
|
|
|
\ 'up': '25%',
|
|
|
|
|
\ 'options': '--ansi --multi --prompt "Markdown> "'
|
|
|
|
|
\ })
|
|
|
|
|
|
|
|
|
|
" edit the document info.yaml
|
|
|
|
|
" needs papis to function
|
|
|
|
|
" could be abstracted out to work with .bib file or the papis .yaml
|
|
|
|
|
" TODO THESE FUNCTIONS DO NOT WORK YET. NEED TO FIND A WAY TO GO FROM fzf ->
|
|
|
|
|
" papis -> editor
|
|
|
|
|
function! s:bibtex_edit_info_sink(lines)
|
|
|
|
|
echom "edit info sink: " . join(a:lines, ",")
|
|
|
|
|
let r=system("bibtex-cite ", a:lines)
|
|
|
|
|
let s=system("papis edit ref=\"" . join(a:lines,"") . "\"")
|
|
|
|
|
" execute ':e s'
|
|
|
|
|
echo s
|
|
|
|
|
endfunction
|
|
|
|
|
command! -bang -nargs=* CiteEdit call skim#run({
|
|
|
|
|
\ 'source': Bibtex_ls(<q-args>),
|
|
|
|
|
\ 'sink*': function('<sid>bibtex_edit_info_sink'),
|
|
|
|
|
\ 'up': '25%',
|
|
|
|
|
\ 'options': join([
|
|
|
|
|
\ '--ansi',
|
|
|
|
|
\ '--with-nth=..',
|
|
|
|
|
\ '--preview-window=:wrap',
|
|
|
|
|
\ '--prompt "Edit> "',
|
|
|
|
|
\ '--preview=''papis edit -e cat ref="echo {} | bibtex-cite" '' ',
|
|
|
|
|
\ ])
|
|
|
|
|
\})
|
|
|
|
|
|
2019-07-03 09:49:24 +00:00
|
|
|
|
" 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
|
|
|
|
|
|
|
|
|
|
|
2019-03-20 15:13:18 +00:00
|
|
|
|
" PLUGIN: DEOPLETE
|
|
|
|
|
" enable deoplete at startup
|
2019-03-20 23:06:40 +00:00
|
|
|
|
let g:deoplete#enable_at_startup = 0
|
2019-03-20 15:13:18 +00:00
|
|
|
|
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',{})
|
2019-07-03 09:49:24 +00:00
|
|
|
|
" PLUGIN: ECHODOC
|
|
|
|
|
let g:echodoc#type="virtual"
|
|
|
|
|
set splitbelow
|
|
|
|
|
set completeopt+=menuone,noinsert,noselect
|
|
|
|
|
set completeopt-=preview
|
|
|
|
|
autocmd CompleteDone * pclose
|
2019-03-20 15:13:18 +00:00
|
|
|
|
|
|
|
|
|
" PLUGIN: ALE
|
2019-07-03 09:49:24 +00:00
|
|
|
|
" 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
|
|
|
|
|
|
2019-03-20 15:13:18 +00:00
|
|
|
|
let g:ale_fix_on_save = 1
|
|
|
|
|
let g:ale_fixers = {
|
2019-07-03 09:49:24 +00:00
|
|
|
|
\'javascipt': ['eslint', 'prettier'],
|
|
|
|
|
\'html': ['tidy','prettier'],
|
|
|
|
|
\'typescript': ['prettier','tslint'],
|
|
|
|
|
\'*': ['remove_trailing_lines', 'trim_whitespace'],
|
2019-07-23 14:50:30 +00:00
|
|
|
|
\'go': ['gofmt'],
|
|
|
|
|
\'sh': ['shfmt'],
|
2019-07-24 08:58:46 +00:00
|
|
|
|
\'zsh': ['shfmt'],
|
2019-07-03 09:49:24 +00:00
|
|
|
|
\}
|
2019-07-08 20:06:25 +00:00
|
|
|
|
|
2019-07-11 07:01:00 +00:00
|
|
|
|
let g:ale_linters = {
|
2019-07-23 13:41:23 +00:00
|
|
|
|
\ 'go': ['gopls'],
|
2019-07-23 14:50:30 +00:00
|
|
|
|
\ 'sh': ['language_server','shellcheck'],
|
2019-07-24 08:58:46 +00:00
|
|
|
|
\ 'zsh': ['language_server','shellcheck'],
|
2019-07-11 07:01:00 +00:00
|
|
|
|
\}
|
2019-03-20 15:13:18 +00:00
|
|
|
|
|
|
|
|
|
" PLUGIN: AIRLINE
|
|
|
|
|
" PLUGIN: TMUXLINE
|
2019-03-13 14:08:39 +00:00
|
|
|
|
let g:airline_powerline_fonts=1
|
|
|
|
|
let g:airline_theme='raven'
|
2019-07-16 11:13:48 +00:00
|
|
|
|
|
2019-09-02 21:21:56 +00:00
|
|
|
|
" Enable italics for colorschemes that support them
|
2019-07-16 11:13:48 +00:00
|
|
|
|
let g:gruvbox_italic=1
|
2019-09-02 21:21:56 +00:00
|
|
|
|
let g:one_allow_italics=1
|
|
|
|
|
let g:pencil_terminal_italics=1
|
|
|
|
|
|
2019-10-24 15:06:30 +00:00
|
|
|
|
colorscheme one
|
2019-03-13 17:01:53 +00:00
|
|
|
|
|
2019-09-02 21:21:56 +00:00
|
|
|
|
|
2019-03-13 17:01:53 +00:00
|
|
|
|
" 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 = 0
|
2019-03-13 16:18:47 +00:00
|
|
|
|
" custom preset with left-justified window list
|
|
|
|
|
let g:tmuxline_preset = {
|
|
|
|
|
\'a' : '#S',
|
|
|
|
|
\'b' : '#(whoami)',
|
|
|
|
|
\'c' : '#I:#P',
|
|
|
|
|
\'win' : '#I #W',
|
|
|
|
|
\'cwin' : [' ', '#I #W'],
|
|
|
|
|
\'x' : '#{prefix_highlight} %H:%M:%S',
|
|
|
|
|
\'y' : '%d-%b-%y',
|
|
|
|
|
\'z' : '#H',
|
|
|
|
|
\'options' : {}}
|
2019-03-09 20:27:14 +00:00
|
|
|
|
|
2019-03-15 15:26:57 +00:00
|
|
|
|
" automatically save the current buffer when navigating away from vim
|
|
|
|
|
let g:tmux_navigator_save_on_switch = 1
|
|
|
|
|
|
2019-03-20 13:27:54 +00:00
|
|
|
|
" }}}
|
|
|
|
|
" VIM SETTINGS {{{
|
|
|
|
|
" ================================================================================
|
|
|
|
|
"
|
2019-03-13 14:08:39 +00:00
|
|
|
|
" set truecolor (neovim)
|
|
|
|
|
set termguicolors
|
|
|
|
|
|
2019-03-20 15:09:48 +00:00
|
|
|
|
" sets tabs to be 2 characters, expanded into spaces, but still removable with
|
2019-03-09 20:27:14 +00:00
|
|
|
|
" one press of backspace.
|
|
|
|
|
" great explanation: http://vimcasts.org/transcripts/2/en/
|
2019-03-17 18:45:29 +00:00
|
|
|
|
set tabstop=2
|
|
|
|
|
set shiftwidth=2
|
|
|
|
|
set softtabstop=2
|
2019-03-09 20:27:14 +00:00
|
|
|
|
set expandtab
|
|
|
|
|
|
2019-03-20 15:09:48 +00:00
|
|
|
|
" 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
|
|
|
|
|
|
2019-03-09 20:27:14 +00:00
|
|
|
|
" shows linenumbers relative to the one you are on, for easy movement and
|
|
|
|
|
" dNUMBERd deletions
|
2019-03-20 15:09:48 +00:00
|
|
|
|
set number relativenumber
|
2019-03-09 20:27:14 +00:00
|
|
|
|
|
|
|
|
|
" 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
|
|
|
|
|
|
2019-03-13 14:08:39 +00:00
|
|
|
|
" whenever vim loses focus, save
|
|
|
|
|
au FocusLost * :wa
|
|
|
|
|
|
2019-03-13 16:18:47 +00:00
|
|
|
|
" disables showing us the current mode in the command line since airline takes
|
|
|
|
|
" care of it
|
|
|
|
|
set noshowmode
|
|
|
|
|
|
2019-03-17 18:45:29 +00:00
|
|
|
|
" highlight everything that goes over 80 columns
|
|
|
|
|
highlight ColorColumn ctermbg=magenta
|
|
|
|
|
call matchadd('ColorColumn', '\%81v', 100)
|
|
|
|
|
|
2019-09-18 14:01:43 +00:00
|
|
|
|
" 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
|
|
|
|
|
|
2019-03-20 13:27:54 +00:00
|
|
|
|
" }}}
|
|
|
|
|
" KEYBINDINGS {{{
|
|
|
|
|
" ================================================================================
|
2019-03-13 14:08:39 +00:00
|
|
|
|
"
|
2019-09-02 19:44:54 +00:00
|
|
|
|
" 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
|
|
|
|
|
com! ShowMaps call s:ShowMaps() " Enable :ShowMaps to call the function
|
|
|
|
|
|
2019-03-13 14:08:39 +00:00
|
|
|
|
" set our leader key to space since with hjkl, space is largely useless
|
|
|
|
|
let mapleader = "\<Space>"
|
2019-05-20 15:02:32 +00:00
|
|
|
|
" 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>"
|
2019-03-13 14:08:39 +00:00
|
|
|
|
" 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>
|
2019-03-09 20:27:14 +00:00
|
|
|
|
|
2019-05-20 11:07:10 +00:00
|
|
|
|
" split buffers vertically/horizontally with the leader \ or - (mirrors my
|
|
|
|
|
" tmux setup)
|
|
|
|
|
nnoremap <leader>- :sp<cr>
|
|
|
|
|
nnoremap <leader>\ :vsp<cr>
|
|
|
|
|
|
2019-03-09 20:27:14 +00:00
|
|
|
|
" move around between matching brackets with tab
|
|
|
|
|
nnoremap <tab> %
|
|
|
|
|
nnoremap <tab> %
|
2019-03-13 14:08:39 +00:00
|
|
|
|
|
2019-09-02 17:15:14 +00:00
|
|
|
|
" Spell check set to <leader>O, 'o' for 'orthography':
|
2019-09-02 17:07:44 +00:00
|
|
|
|
noremap <leader>O :setlocal spell! spelllang=en_us<CR>
|
2019-09-02 17:15:14 +00:00
|
|
|
|
noremap <leader>OE :setlocal spell! spelllang=en_us<CR>
|
|
|
|
|
noremap <leader>OG :setlocal spell! spelllang=de_de<CR>
|
2019-09-02 17:07:44 +00:00
|
|
|
|
noremap <leader>o z=
|
|
|
|
|
|
2019-03-13 14:08:39 +00:00
|
|
|
|
" select the whole buffer with <leader>-a
|
2019-05-21 11:44:44 +00:00
|
|
|
|
nnoremap <leader>a ggVG
|
2019-03-13 14:08:39 +00:00
|
|
|
|
|
2019-03-20 13:30:36 +00:00
|
|
|
|
" quickly edit vimrc with leader+V
|
2019-05-21 11:44:44 +00:00
|
|
|
|
nnoremap <leader>V :vsp $MYVIMRC<cr>
|
2019-03-20 13:30:36 +00:00
|
|
|
|
" 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
|
2019-05-21 11:44:44 +00:00
|
|
|
|
" source vimrc with keystroke combination
|
|
|
|
|
nnoremap <leader>VV :source $MYVIMRC<cr>
|
2019-03-13 14:08:39 +00:00
|
|
|
|
|
2019-05-20 15:02:32 +00:00
|
|
|
|
" since u undoes, would it not make sense that U redoes?
|
|
|
|
|
nnoremap U <C-r>
|
|
|
|
|
|
2019-05-20 20:21:53 +00:00
|
|
|
|
" when in insertion mode, C-u uppercases the current word, C-l lowercases it,
|
|
|
|
|
inoremap <C-u> <esc>gUiw`]a
|
|
|
|
|
inoremap <C-l> <esc>guiw`]a
|
|
|
|
|
|
2019-03-13 14:08:39 +00:00
|
|
|
|
" get rid of the help message popping up when I miss esc and hit F1
|
|
|
|
|
nnoremap <F1> <ESC>
|
|
|
|
|
inoremap <F1> <ESC>
|
|
|
|
|
vnoremap <F1> <ESC>
|
|
|
|
|
|
2019-09-19 13:43:40 +00:00
|
|
|
|
" yank filename to f buffer
|
|
|
|
|
nnoremap yf :let @f = expand("%")<cr>
|
|
|
|
|
|
2019-03-13 14:08:39 +00:00
|
|
|
|
" remove all trailing whitespaces
|
2019-03-20 13:30:36 +00:00
|
|
|
|
" on pressing space+W
|
2019-03-13 14:08:39 +00:00
|
|
|
|
nnoremap <leader>W :%s/\s\+$//<cr>:let @/=''<CR>
|
2019-03-20 13:30:36 +00:00
|
|
|
|
" automatically on saving
|
|
|
|
|
" autocmd BufWritePre * :%s/\s\+$//e
|
|
|
|
|
|
2019-05-21 11:44:44 +00:00
|
|
|
|
" 'open new buffer' with leader-t (opens new buffer and switches to it)
|
2019-03-15 15:26:57 +00:00
|
|
|
|
" open actual new tab with leader-T
|
2019-03-17 18:45:29 +00:00
|
|
|
|
nnoremap <leader>t :vsp .<cr>
|
2019-03-15 15:26:57 +00:00
|
|
|
|
nnoremap <leader>T :tabedit .<cr>
|
|
|
|
|
|
2019-03-20 15:13:18 +00:00
|
|
|
|
" open/close NERDtree with leader-e
|
|
|
|
|
" whatever method tree has been opened by, leader-e closes it again
|
2019-03-13 17:01:53 +00:00
|
|
|
|
nnoremap <leader>e :NERDTreeToggle<CR>
|
2019-03-20 15:13:18 +00:00
|
|
|
|
" 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>
|
2019-03-20 13:27:54 +00:00
|
|
|
|
|
2019-07-03 09:49:24 +00:00
|
|
|
|
" 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 <leader>ga <Plug>(go-alternate-edit)
|
|
|
|
|
" switch between test file and function - in a horizontal/vertical split
|
|
|
|
|
au Filetype go nnoremap <leader>gah <Plug>(go-alternate-split)
|
|
|
|
|
au Filetype go nnoremap <leader>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)
|
|
|
|
|
|
Add fuzzy tools to vim and shell
In vim:
Use <leader>c to insert a bibtex reference in your text. By default it
is a pandoc reference (@bibref), but it can be changed to latex style
(\cite(bibref)). <leader>CM inserts a pretty-printed reference to the
selected work, using markdown styling. If you want to insert a citation
while writing, use @@ from insertmode to insert the bibref instead.
The settings add two commands: :CiteRef and :CitePretty which call the
respective functions. You can pass any amount of .bibtex libraries to
the commands and they will be available to fuzzy search through.
:CiteEdit also added to fuzzy find a source and open it in vim for editing.
The function is not working yet, I have to find a way to go from the
fuzzy finder to papis, select the correct file and edit it in vim.
In Shell:
Can cd directories (d, D), open files (f, F), open most recently used
(ru), and edit bibtex references (ref). lowercase is a weighted view
over previously used directories/files, Uppercase is a search of the
whole file structure.
Still outstanding:
Needs the same comfort function additions as vim search, especially
reference search. (i.e., open corresponding document, yank path, open
editor,...)
2019-09-04 17:32:11 +00:00
|
|
|
|
" skim.vim (fzf alternative) fuzzy finding configuration
|
|
|
|
|
" extra key bindings in skim window
|
|
|
|
|
let g:skim_action = {
|
|
|
|
|
\ 'ctrl-t': 'tab split',
|
|
|
|
|
\ 'ctrl-h': 'split',
|
|
|
|
|
\ 'ctrl-v': 'vsplit' }
|
|
|
|
|
|
|
|
|
|
command! -bang -nargs=* Rg call fzf#vim#rg_interactive(<q-args>, fzf#vim#with_preview('right:50%:hidden', 'alt-h'))
|
|
|
|
|
|
|
|
|
|
" Configure notational-fzf-vim
|
|
|
|
|
let g:nv_search_paths = [ g:wiki_root ]
|
|
|
|
|
let g:nv_wrap_preview_text=1
|
|
|
|
|
" Dictionary with string keys and values. Must be in the form 'ctrl-KEY':
|
|
|
|
|
" 'command' or 'alt-KEY' : 'command'. See examples below.
|
|
|
|
|
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',
|
|
|
|
|
\ ]
|
2019-05-20 11:07:10 +00:00
|
|
|
|
|
2019-10-18 09:01:14 +00:00
|
|
|
|
|
2019-09-02 20:45:24 +00:00
|
|
|
|
" Markdown & Pandoc compilation group
|
|
|
|
|
" the commented out command can be used if vim-rmarkdown plugin is not
|
|
|
|
|
" installed (it is a bit more brittle)
|
|
|
|
|
" autocmd FileType rmd noremap <F10> :!echo<space>"require(rmarkdown);<space>render('<c-r>%')"<space>\|<space>R<space>--vanilla<enter>
|
|
|
|
|
" Compile with rmarkdown
|
2019-11-04 18:26:36 +00:00
|
|
|
|
" autocmd FileType markdown,rmarkdown noremap <leader>c :RMarkdown pdf<cr>
|
|
|
|
|
" autocmd FileType markdown,rmarkdown noremap <leader>C :RMarkdown! pdf<cr>
|
2019-09-02 20:45:24 +00:00
|
|
|
|
|
2019-06-11 12:55:55 +00:00
|
|
|
|
function! SearchWiki()
|
|
|
|
|
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
|
|
|
|
|
|
2019-06-12 12:24:38 +00:00
|
|
|
|
" search in wiki with ctrlsf, in fullscreen window
|
2019-10-17 16:55:32 +00:00
|
|
|
|
nnoremap <leader>wf :execute(":call SearchWiki()")<cr>
|
|
|
|
|
|
|
|
|
|
" FUZZY FINDING
|
|
|
|
|
" FZF buffers and files in current workdir
|
|
|
|
|
noremap <leader>s :Buffers<cr>
|
|
|
|
|
" FZF most recently used / MRU, bound to S since it is essentially a larger
|
|
|
|
|
" go-back intention than just buffers
|
|
|
|
|
noremap <leader>S :History<cr>
|
|
|
|
|
noremap <leader>f :Files<cr>
|
|
|
|
|
|
|
|
|
|
" FZF general full-text search in cwd with rg
|
|
|
|
|
noremap <C-F> :Rg<cr>
|
|
|
|
|
" FZF note full-text search with notational-velocity like functions (in wiki
|
|
|
|
|
" directory)
|
|
|
|
|
noremap <leader>n :NV<cr>
|
|
|
|
|
noremap <leader>N :NV!<cr>
|
|
|
|
|
|
|
|
|
|
" FZF git diff
|
|
|
|
|
noremap <leader>gd :GFiles?<cr>
|
2019-06-11 12:55:55 +00:00
|
|
|
|
|
Add fuzzy tools to vim and shell
In vim:
Use <leader>c to insert a bibtex reference in your text. By default it
is a pandoc reference (@bibref), but it can be changed to latex style
(\cite(bibref)). <leader>CM inserts a pretty-printed reference to the
selected work, using markdown styling. If you want to insert a citation
while writing, use @@ from insertmode to insert the bibref instead.
The settings add two commands: :CiteRef and :CitePretty which call the
respective functions. You can pass any amount of .bibtex libraries to
the commands and they will be available to fuzzy search through.
:CiteEdit also added to fuzzy find a source and open it in vim for editing.
The function is not working yet, I have to find a way to go from the
fuzzy finder to papis, select the correct file and edit it in vim.
In Shell:
Can cd directories (d, D), open files (f, F), open most recently used
(ru), and edit bibtex references (ref). lowercase is a weighted view
over previously used directories/files, Uppercase is a search of the
whole file structure.
Still outstanding:
Needs the same comfort function additions as vim search, especially
reference search. (i.e., open corresponding document, yank path, open
editor,...)
2019-09-04 17:32:11 +00:00
|
|
|
|
" insert a citation of a source using bib ref (uses academia library)
|
|
|
|
|
nnoremap <leader>c :CiteRef<cr>
|
|
|
|
|
" insert a pretty printed Markdown version of a reference
|
|
|
|
|
nnoremap <leader>CM :CitePretty<cr>
|
|
|
|
|
|
2019-03-20 17:37:04 +00:00
|
|
|
|
" Mostly dealing with Prose writing from here on out
|
|
|
|
|
" Format current Paragraph (esp useful in prose writing)
|
|
|
|
|
nnoremap <silent> <leader>q gqap
|
|
|
|
|
xnoremap <silent> <leader>q gq
|
|
|
|
|
nnoremap <silent> <leader>Q vapJgqap
|
|
|
|
|
|
|
|
|
|
" Enter distraction free prose mode with F11
|
|
|
|
|
noremap <F11> :Goyo<CR>
|
|
|
|
|
|
2019-06-04 11:28:15 +00:00
|
|
|
|
" surround stuff with quotes, from normal or visual mode
|
|
|
|
|
nnoremap <leader>" viw<esc>a"<esc>bi"<esc>lel
|
|
|
|
|
vnoremap <leader>" <esc>`<i"<esc>`>la"<esc>l
|
|
|
|
|
|
|
|
|
|
" stronger versions of left,right - move all the way
|
|
|
|
|
nnoremap H ^
|
|
|
|
|
nnoremap L $
|
|
|
|
|
|
|
|
|
|
" }}}
|
|
|
|
|
" ABBREVIATIONS {{{
|
|
|
|
|
|
|
|
|
|
" Typos
|
|
|
|
|
iabbrev adn and
|
|
|
|
|
iabbrev waht what
|
|
|
|
|
iabbrev tehn then
|
|
|
|
|
iabbrev whit with
|
|
|
|
|
iabbrev whith with
|
|
|
|
|
|
|
|
|
|
" Text expansion
|
2019-09-18 14:01:43 +00:00
|
|
|
|
iabbrev @e@ marty.oehme@gmail.com
|
2019-06-04 11:28:15 +00:00
|
|
|
|
iabbrev ccopy Copyright 2019 Marty Oehme, all rights reserved.
|
|
|
|
|
|
|
|
|
|
"
|
2019-03-20 13:27:54 +00:00
|
|
|
|
" }}}
|
|
|
|
|
" END
|
|
|
|
|
" ================================================================================
|