From 1c0aa32806e097a2a0c30b760ae4cad481e758c6 Mon Sep 17 00:00:00 2001 From: Yigit Sever Date: Fri, 8 Oct 2021 13:50:04 +0300 Subject: nvim: ported wiki functions --- .config/nvim/after/plugin/autocmds.vim | 2 ++ .config/nvim/after/plugin/functions.vim | 28 ++++++++++++++++++++++++++++ .config/nvim/after/plugin/tabular_extra.vim | 14 ++++++++++++++ 3 files changed, 44 insertions(+) create mode 100644 .config/nvim/after/plugin/autocmds.vim create mode 100644 .config/nvim/after/plugin/functions.vim create mode 100644 .config/nvim/after/plugin/tabular_extra.vim (limited to '.config/nvim/after/plugin') diff --git a/.config/nvim/after/plugin/autocmds.vim b/.config/nvim/after/plugin/autocmds.vim new file mode 100644 index 0000000..ae55046 --- /dev/null +++ b/.config/nvim/after/plugin/autocmds.vim @@ -0,0 +1,2 @@ +" I don't know how to port this yet +autocmd BufRead,BufWrite * if ! &bin | silent! %s/\s\+$//ge | endif diff --git a/.config/nvim/after/plugin/functions.vim b/.config/nvim/after/plugin/functions.vim new file mode 100644 index 0000000..87a1072 --- /dev/null +++ b/.config/nvim/after/plugin/functions.vim @@ -0,0 +1,28 @@ +" Will learn to port promise +function! CreateNote() + py3 import uuid + exe "e! " . fnameescape("~/nextcloud/personal_wiki/text/box/" . py3eval('str(uuid.uuid4())[:6]') . ".wiki") + let l:text="= up =\n\n= down =\n\n= keywords =\n\n" + put =l:text + norm gg +endfunction + +function! CreatePaper(citekey) + exe "e! " . fnameescape("~/nextcloud/personal_wiki/text/papers/" . a:citekey . ".wiki") + + let l:timestap="%date " . strftime("%F") + let l:text="= Came From =\n\n= Takeaways =\n\n= Might Go To =\n\n" + + put! =l:timestap + put =l:text +endfunction + +function! CreateReference(citekey) + exe "e! " . fnameescape("~/nextcloud/personal_wiki/text/reference/" . a:citekey . ".wiki") + + let l:timestap="%date " . strftime("%F") + let l:text="= Literature Notes =\n\n= Citation =\n\n" + + put! =l:timestap + put =l:text +endfunction diff --git a/.config/nvim/after/plugin/tabular_extra.vim b/.config/nvim/after/plugin/tabular_extra.vim new file mode 100644 index 0000000..28713ca --- /dev/null +++ b/.config/nvim/after/plugin/tabular_extra.vim @@ -0,0 +1,14 @@ +" after/plugin/my_tabular_commands.vim +" Provides extra :Tabularize commands + +if !exists(':Tabularize') + finish " Give up here; the Tabular plugin musn't have been loaded +endif + +nmap t= :Tabularize /= +vmap t= :Tabularize /= +nmap t: :Tabularize /:\zs +vmap t: :Tabularize /:\zs + +AddTabularPattern first_comma /^[^,]*\zs,/r0c0l0 +AddTabularPattern first_colon /^[^:]*\zs:/r0c0l0 -- cgit v1.2.3-70-g09d2