diff options
author | Tom Ryder <tom@sanctum.geek.nz> | 2019-06-01 01:03:26 +1200 |
---|---|---|
committer | Tom Ryder <tom@sanctum.geek.nz> | 2019-06-01 01:03:26 +1200 |
commit | 6255e5fae6a29cda2bf1abf7bcfad1818ec2529a (patch) | |
tree | d491b7f6cef0737b3c7be7a95aaf3bb3eeedf98c | |
parent | Merge branch 'release/v1.0.0' (diff) | |
parent | Bump VERSION (diff) | |
download | vim-write-mkpath-6255e5fae6a29cda2bf1abf7bcfad1818ec2529a.tar.gz vim-write-mkpath-6255e5fae6a29cda2bf1abf7bcfad1818ec2529a.zip |
Merge branch 'release/v1.1.0'v1.1.0
* release/v1.1.0:
Clean up alternate file buffer on :file
-rw-r--r-- | VERSION | 2 | ||||
-rw-r--r-- | autoload/write_mkpath.vim | 10 | ||||
-rw-r--r-- | doc/write_mkpath.txt | 2 |
3 files changed, 11 insertions, 3 deletions
@@ -1 +1 @@ -1.0.0 +1.1.0 diff --git a/autoload/write_mkpath.vim b/autoload/write_mkpath.vim index bfe45bd..6b1855d 100644 --- a/autoload/write_mkpath.vim +++ b/autoload/write_mkpath.vim @@ -18,9 +18,17 @@ function! write_mkpath#New(path) abort endif " Set filename to absolute path using :file {name}; do it silently so that - " the nice name remains displayed to the user + " the nice name remains displayed to the user. Record the name of the + " alternate buffer first, so we can put it back after :file messes with it. + let alt = @# execute 'silent file '.fnameescape(getcwd().'/'.a:path) + " That :file command will have set the alternate buffer to an unlisted + " buffer of the same name, which we don't want. Wipe it, and restore the + " previous alternative buffer. + bwipe # + let @# = alt + endfunction " Handle a :write operation; prompt for directory creation if needed with diff --git a/doc/write_mkpath.txt b/doc/write_mkpath.txt index db490f7..3416629 100644 --- a/doc/write_mkpath.txt +++ b/doc/write_mkpath.txt @@ -1,4 +1,4 @@ -*write_mkpath.txt* For Vim version 7.0 Last change: 2019 May 31 +*write_mkpath.txt* For Vim version 7.0 Last change: 2019 Jun 01 DESCRIPTION *write_mkpath* |