Feature: Add wiki page to buffer list using badd (#1185)

Co-authored-by: Tinmarino <tinmarino@gmail.com>
This commit is contained in:
Jean-Luc Bastarache
2021-12-18 10:08:54 -05:00
committed by GitHub
parent ecce184493
commit ee31d45553
3 changed files with 21 additions and 0 deletions
+2
View File
@@ -1660,6 +1660,8 @@ function! vimwiki#base#follow_link(split, ...) abort
let cmd = ':split ' let cmd = ':split '
elseif a:split ==# 'vsplit' elseif a:split ==# 'vsplit'
let cmd = ':vsplit ' let cmd = ':vsplit '
elseif a:split ==# 'badd'
let cmd = ':badd '
elseif a:split ==# 'tab' elseif a:split ==# 'tab'
let cmd = ':tabnew ' let cmd = ':tabnew '
else else
+14
View File
@@ -359,6 +359,13 @@ MAP MODE
Maps to |:VimwikiVSplitLink|. Maps to |:VimwikiVSplitLink|.
Remap command: `<Plug>VimwikiVSplitLink` Remap command: `<Plug>VimwikiVSplitLink`
*vimwiki_<M-CR>*
<M-CR> n Add to the buffer list, without loading, if it wasn't
listed yet (create target wiki page if needed). May
not work in some terminals. Remapping could help.
Maps to |:VimwikiBaddLink|.
Remap command: `<Plug>VimwikiBaddLink`
*vimwiki_<C-S-CR>* *vimwiki_<D-CR>* *vimwiki_<C-S-CR>* *vimwiki_<D-CR>*
<C-S-CR>, <D-CR> n Follow wiki link (create target wiki page if needed), <C-S-CR>, <D-CR> n Follow wiki link (create target wiki page if needed),
opening in a new tab. opening in a new tab.
@@ -796,6 +803,10 @@ Vimwiki file.
If 'move_cursor' is given and nonzero, the cursor moves to the window with If 'move_cursor' is given and nonzero, the cursor moves to the window with
the opened link, otherwise, it stays in the window with the link. the opened link, otherwise, it stays in the window with the link.
*:VimwikiBaddLink*
Add to the buffer list, without loading, if it wasn't listed yet (create
target wiki page if needed).
*:VimwikiTabnewLink* *:VimwikiTabnewLink*
Follow wiki link in a new tab (create target wiki page if needed). Follow wiki link in a new tab (create target wiki page if needed).
@@ -3958,6 +3969,7 @@ Contributors and their Github usernames in roughly chronological order:
- Vinny Furia (@vinnyfuria) - Vinny Furia (@vinnyfuria)
- paperbenni (@paperbenni) - paperbenni (@paperbenni)
- Lily Foster (@lilyinstarlight) - Lily Foster (@lilyinstarlight)
- Jean-Luc Bastarache (@jlbas)
- Youssof Taha (@ysftaha) - Youssof Taha (@ysftaha)
- Thomas Leyh (@leyhline) - Thomas Leyh (@leyhline)
@@ -4019,6 +4031,8 @@ New:~
alternative date string format alternative date string format
* Feature: Add |VimwikiPasteLink| to paste an absolute wiki link to the * Feature: Add |VimwikiPasteLink| to paste an absolute wiki link to the
current file current file
* Feature: Add |VimwikiBaddLink| to add links to the buffer list, without
loading, if they weren't listed yet
Changed:~ Changed:~
* PR #1047: Allow to replace default mapping of VimwikiToggleListItem * PR #1047: Allow to replace default mapping of VimwikiToggleListItem
+5
View File
@@ -306,6 +306,7 @@ command! -buffer VimwikiFollowLink call vimwiki#base#follow_link('nosplit', 0, 1
command! -buffer VimwikiGoBackLink call vimwiki#base#go_back_link() command! -buffer VimwikiGoBackLink call vimwiki#base#go_back_link()
command! -buffer -nargs=* VimwikiSplitLink call vimwiki#base#follow_link('hsplit', <f-args>) command! -buffer -nargs=* VimwikiSplitLink call vimwiki#base#follow_link('hsplit', <f-args>)
command! -buffer -nargs=* VimwikiVSplitLink call vimwiki#base#follow_link('vsplit', <f-args>) command! -buffer -nargs=* VimwikiVSplitLink call vimwiki#base#follow_link('vsplit', <f-args>)
command! -buffer VimwikiBaddLink call vimwiki#base#follow_link('badd', 0, 1)
command! -buffer -nargs=? VimwikiNormalizeLink call vimwiki#base#normalize_link(<f-args>) command! -buffer -nargs=? VimwikiNormalizeLink call vimwiki#base#normalize_link(<f-args>)
@@ -386,6 +387,7 @@ if str2nr(vimwiki#vars#get_global('key_mappings').mouse)
\ :call vimwiki#base#follow_link('nosplit', 0, 1, "\<lt>2-LeftMouse>")<CR> \ :call vimwiki#base#follow_link('nosplit', 0, 1, "\<lt>2-LeftMouse>")<CR>
nnoremap <silent><buffer> <S-2-LeftMouse> <LeftMouse>:VimwikiSplitLink<CR> nnoremap <silent><buffer> <S-2-LeftMouse> <LeftMouse>:VimwikiSplitLink<CR>
nnoremap <silent><buffer> <C-2-LeftMouse> <LeftMouse>:VimwikiVSplitLink<CR> nnoremap <silent><buffer> <C-2-LeftMouse> <LeftMouse>:VimwikiVSplitLink<CR>
nnoremap <silent><buffer> <MiddleMouse> <LeftMouse>:VimwikiBaddLink<CR>
nnoremap <silent><buffer> <RightMouse><LeftMouse> :VimwikiGoBackLink<CR> nnoremap <silent><buffer> <RightMouse><LeftMouse> :VimwikiGoBackLink<CR>
endif endif
@@ -406,6 +408,8 @@ nnoremap <silent><script><buffer> <Plug>VimwikiSplitLink
\ :VimwikiSplitLink<CR> \ :VimwikiSplitLink<CR>
nnoremap <silent><script><buffer> <Plug>VimwikiVSplitLink nnoremap <silent><script><buffer> <Plug>VimwikiVSplitLink
\ :VimwikiVSplitLink<CR> \ :VimwikiVSplitLink<CR>
nnoremap <silent><script><buffer> <Plug>VimwikiBaddLink
\ :VimwikiBaddLink<CR>
nnoremap <silent><script><buffer> <Plug>VimwikiNormalizeLink nnoremap <silent><script><buffer> <Plug>VimwikiNormalizeLink
\ :VimwikiNormalizeLink 0<CR> \ :VimwikiNormalizeLink 0<CR>
vnoremap <silent><script><buffer> <Plug>VimwikiNormalizeLinkVisual vnoremap <silent><script><buffer> <Plug>VimwikiNormalizeLinkVisual
@@ -440,6 +444,7 @@ if str2nr(vimwiki#vars#get_global('key_mappings').links)
call vimwiki#u#map_key('n', '<CR>', '<Plug>VimwikiFollowLink') call vimwiki#u#map_key('n', '<CR>', '<Plug>VimwikiFollowLink')
call vimwiki#u#map_key('n', '<S-CR>', '<Plug>VimwikiSplitLink') call vimwiki#u#map_key('n', '<S-CR>', '<Plug>VimwikiSplitLink')
call vimwiki#u#map_key('n', '<C-CR>', '<Plug>VimwikiVSplitLink') call vimwiki#u#map_key('n', '<C-CR>', '<Plug>VimwikiVSplitLink')
call vimwiki#u#map_key('n', '<M-CR>', '<Plug>VimwikiBaddLink')
call vimwiki#u#map_key('n', '+', '<Plug>VimwikiNormalizeLink') call vimwiki#u#map_key('n', '+', '<Plug>VimwikiNormalizeLink')
call vimwiki#u#map_key('v', '+', '<Plug>VimwikiNormalizeLinkVisual') call vimwiki#u#map_key('v', '+', '<Plug>VimwikiNormalizeLinkVisual')
call vimwiki#u#map_key('v', '<CR>', '<Plug>VimwikiNormalizeLinkVisualCR') call vimwiki#u#map_key('v', '<CR>', '<Plug>VimwikiNormalizeLinkVisualCR')