Switch to GNU stow
This commit is contained in:
parent
a2605c4254
commit
d34cecb27e
137 changed files with 39244 additions and 141 deletions
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
|
||||
Loading…
Add table
Add a link
Reference in a new issue