Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enhancement: Reuse Vim Tabs with drop #238

Closed
davidlmontgomery opened this issue Aug 28, 2016 · 1 comment · Fixed by #1234
Closed

Enhancement: Reuse Vim Tabs with drop #238

davidlmontgomery opened this issue Aug 28, 2016 · 1 comment · Fixed by #1234

Comments

@davidlmontgomery
Copy link

I use vim and gvim opening many files in new tabs. I found that when following links forward and back vimwiki would frequently create a new tab for a file that was already open, so that I would end up with the same file open many times. My preference is to reuse the existing tab.

Below are two patch files for how I hacked my local vimwiki to reuse tabs instead of creating new ones.


--- markdown_base.vim   2016-07-02 14:13:32.750195233 -0700
+++ markdown_base.vim   2016-07-02 14:11:47.274198885 -0700
@@ -86,9 +86,9 @@
     elseif a:split ==# "vsplit"
       let cmd = ":vsplit "
     elseif a:split ==# "tabnew"
-      let cmd = ":tabnew "
+      let cmd = ":tab drop "
     else
-      let cmd = ":e "
+      let cmd = ":drop "
     endif

     " try WikiLink


--- base.vim    2016-07-02 14:13:21.342195628 -0700
+++ base.vim    2016-07-02 14:08:44.654205208 -0700
@@ -1270,7 +1270,7 @@
   if exists("b:vimwiki_prev_link")
     " go back to saved wiki link
     let prev_word = b:vimwiki_prev_link
-    execute ":e ".substitute(prev_word[0], '\s', '\\\0', 'g')
+    execute ":drop ".substitute(prev_word[0], '\s', '\\\0', 'g')
     call setpos('.', prev_word[1])
   else
     " maybe we came here by jumping to a tag -> pop from the tag stack

davidlmontgomery added a commit to davidlmontgomery/vimwiki that referenced this issue Apr 13, 2018
@tinmarino
Copy link
Member

Nice @davidlmontgomery,

Are you willing to make a PR with you branch (please)?

May you add some Vader tests ?

Cheers.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants