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

Move page (and every link pointing to it) up the directory hierarchy? #926

Closed
notevenaperson opened this issue Jun 22, 2020 · 5 comments
Closed
Assignees
Labels
enhancement link Related to link and path creation, modification, use [See #478]

Comments

@notevenaperson
Copy link

After using vimwiki for a while I realized that organizing my pages in many subfolders takes more effort than an immaculate file tree is worth, and makes linking a more time-consuming process.

I know of the VimwikiRenameFile function, which renames a file and updates links to it across the whole wiki, but I can't find one to move a file to a different directory without breaking every link.

@notevenaperson notevenaperson changed the title Move page (and all it's links) up the directory hierarchy? Move page (and everywhere it's linked) up the directory hierarchy? Jun 22, 2020
@notevenaperson notevenaperson changed the title Move page (and everywhere it's linked) up the directory hierarchy? Move page (and every link pointing to it) up the directory hierarchy? Jun 22, 2020
@tinmarino
Copy link
Member

Seems like a bug :VimwikiRenameFile should work

@tinmarino tinmarino self-assigned this Jul 24, 2020
@tinmarino tinmarino added the link Related to link and path creation, modification, use [See #478] label Jul 24, 2020
@tinmarino tinmarino added this to Needs triage in Bug Triage Deprecated via automation Jul 24, 2020
@tinmarino tinmarino moved this from Needs triage to Medium Priority in Bug Triage Deprecated Jul 24, 2020
@iandstanley
Copy link

I've really gotten into Vimwiki and it's great tools but I have hit an issue of too many files as well and I need to reorganise.

I have created a number of subdirectories and then tried :VimwikiRenameFile to migrate the file (I cant find any documentation to suggest another method)

When I try to migrate a file (say linux.wiki to linux/linux.wiki) with the command :VimwikiRenameFile linux/linux
i get an error
E488: trailing characters

the same issue occurs with :VimwikiRenameLink

I can't see a way of migrating content into a subdirectory without having either an error or manually updating links and probably missing loads

tinmarino added a commit to tinmarino/vimwiki that referenced this issue Jul 28, 2020
@tinmarino tinmarino removed the bug label Jul 29, 2020
tinmarino added a commit to tinmarino/vimwiki that referenced this issue Jul 29, 2020
tinmarino added a commit to tinmarino/vimwiki that referenced this issue Jul 29, 2020
tinmarino added a commit to tinmarino/vimwiki that referenced this issue Jul 29, 2020
@tinmarino
Copy link
Member

@notevenaperson Actually it wasn't a bug, my bad: VimwikiRenameFile did not support files in other dir
@iandstanley VimwikiRenameFile was not supposed to take argument: press enter and it ask you to input the file name

I considered both as feature request, I coded it and now in dev you can:

  1. Move file to an other directory
  2. Accept (Completable) argument

Please tell me if it works for you, especially the move to other directory

@tinmarino
Copy link
Member

Closed by 1f77e47

Bug Triage Deprecated automation moved this from Medium Priority to Closed Aug 4, 2020
@BehindTheBrain
Copy link

BehindTheBrain commented Oct 2, 2020

So I'm checking out rename functionality currently, and I notice 2 things about this issue:

  1. From cursory exploration, it seems that this feature is working on native syntax on dev, with the exception that it only works when doing
    :VimwikiRenameFile newpath/newname
    but not
    leader wr then newpath/newname,
    which still has blocks against any path in the new name.

Unless I'm missing something, this issue being addressed means we don't need the following guard anymore?

diff --git a/autoload/vimwiki/base.vim b/autoload/vimwiki/base.vim
index 1917718..1d4872e 100644
--- a/autoload/vimwiki/base.vim
+++ b/autoload/vimwiki/base.vim
@@ -1760,10 +1760,6 @@ function! s:input_rename_link() abort
   let new_link = input('Enter new name: ')
 
   " Guard: Check link
-  if new_link =~# '[/\\]'
-    call vimwiki#u#error('Cannot rename to a filename with path!')
-    return
-  endif
   if substitute(new_link, '\s', '', 'g') ==? ''
     call vimwiki#u#error('Cannot rename to an empty filename!')
     return

When I remove the guards, rename still seems to work for moving functionality using both methods. I didn't run all the tests yet -- that's my next order of business.

  1. There is no documentation of this feature added?

Should this issue be re-opened? A new one created?

deepredsky pushed a commit to deepredsky/vimwiki that referenced this issue Jan 16, 2021
jls83 pushed a commit to jls83/vimwiki that referenced this issue Jan 17, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement link Related to link and path creation, modification, use [See #478]
Projects
Development

No branches or pull requests

4 participants