summaryrefslogtreecommitdiffstats
path: root/vim/vimrc
diff options
context:
space:
mode:
authorMatthew Lemon <chaffinach+git@protonmail.ch>2022-06-18 12:30:38 +0100
committerMatthew Lemon <chaffinach+git@protonmail.ch>2022-06-18 12:30:38 +0100
commit2fd3d28a901e718b940286c2f4ca93423894f2ec (patch)
tree2c43695df74b4f01530c37c90dd2faedb70f9138 /vim/vimrc
parenteb45473eef69d72b1c054047c51f1529f8dc550f (diff)
added a vim function to copy link to last buffer
Diffstat (limited to '')
-rw-r--r--vim/vimrc8
1 files changed, 8 insertions, 0 deletions
diff --git a/vim/vimrc b/vim/vimrc
index 1a501c9..47403df 100644
--- a/vim/vimrc
+++ b/vim/vimrc
@@ -129,6 +129,14 @@ if has('folding')
set viewoptions=folds,options,cursor,unix,slash
endif
+" from https://www.reddit.com/r/vim/comments/f5gi2g/vim_notetaking_automatic_link_creation_between/
+" copies a link from file from previous buffer for pasting into
+" next buffer with "ap
+function! s:copy_filename_as_mdlink()
+ let fname=expand("%")
+ let @a="[" . fname . "](./" . fname. ")"
+endfunction
+autocmd BufLeave * call s:copy_filename_as_mdlink()
" vim-plug
call plug#begin('~/.vim/plugged')