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

:swapname prints different string at different occasions #355

Open
GoogleCodeExporter opened this issue Aug 21, 2015 · 2 comments
Open

:swapname prints different string at different occasions #355

GoogleCodeExporter opened this issue Aug 21, 2015 · 2 comments

Comments

@GoogleCodeExporter
Copy link

What steps will reproduce the problem?

1. % vim -u NONE -U NONE --noplugin
2. :edit a_file.txt
3. :swapname           -> prints ".a_file.txt.swp"
4. :q!
5. % vim -u NONE -U NONE --noplugin a_file.txt
6. :swapname           -> prints "/home/user/.a_file.txt.swp"


What is the expected output? What do you see instead?

Prints the path of the swapfile as relative or absolute path, depending on when 
I called the command. Since I use the output in a script, it would be nice if 
the output would be consistent.

What version of the product are you using? On what operating system?

Both Vim 7.2 and Vim 7.4 on Linux.


Original issue reported on code.google.com by [email protected] on 23 Apr 2015 at 1:06

@GoogleCodeExporter
Copy link
Author

You could write a custom script, something like this:

:command! Swapname :redir =>a|exe ':sil swapname'|redir end |let a=a[1:]|echo 
fnamemodify(a, ':p')

Alternatively, I'll attach a patch here. But until this is merged, use a script 
like this one.

Original comment by [email protected] on 23 Apr 2015 at 7:08

Attachments:

@GoogleCodeExporter
Copy link
Author

Thanks for the patch and the workaround, but ... the patch doesn't fix the 
problem for me. I applied it, but the behavior is the same as before.
After all, you can easily work around it so it's not a big deal.

Original comment by [email protected] on 29 Apr 2015 at 9:52

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

No branches or pull requests

1 participant