From 2fd3d28a901e718b940286c2f4ca93423894f2ec Mon Sep 17 00:00:00 2001 From: Matthew Lemon Date: Sat, 18 Jun 2022 12:30:38 +0100 Subject: added a vim function to copy link to last buffer --- vim/vimrc | 8 ++++++++ 1 file changed, 8 insertions(+) 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') -- cgit v1.2.3