aboutsummaryrefslogtreecommitdiffstats
path: root/bundle
diff options
context:
space:
mode:
authorTeddy Wing2015-03-26 22:30:19 -0400
committerTeddy Wing2015-03-26 22:34:43 -0400
commit58f3b377161e92faa8aade9ff6b39cb66286eb33 (patch)
tree099c1bd5939404a5696671467381656f32404905 /bundle
parentdc188e3be88275af26b6c034011706002e5c6ecf (diff)
downloaddotvim-58f3b377161e92faa8aade9ff6b39cb66286eb33.tar.bz2
Add write-with-spaces plugin
Add a plugin to provide a way to write file names with spaces. Came from a Vim forum post. Handy to not have to always type backslashes if I want to save a file with spaces in it.
Diffstat (limited to 'bundle')
-rw-r--r--bundle/write-with-spaces/autoload/write_with_spaces.vim3
-rw-r--r--bundle/write-with-spaces/plugin/write_with_spaces.vim8
2 files changed, 11 insertions, 0 deletions
diff --git a/bundle/write-with-spaces/autoload/write_with_spaces.vim b/bundle/write-with-spaces/autoload/write_with_spaces.vim
new file mode 100644
index 0000000..a7e40ca
--- /dev/null
+++ b/bundle/write-with-spaces/autoload/write_with_spaces.vim
@@ -0,0 +1,3 @@
+function! write_with_spaces#Write(bang, filename)
+ execute "w".a:bang." ". substitute(a:filename, ' ', '\\ ', 'g')
+endfunction
diff --git a/bundle/write-with-spaces/plugin/write_with_spaces.vim b/bundle/write-with-spaces/plugin/write_with_spaces.vim
new file mode 100644
index 0000000..53db90f
--- /dev/null
+++ b/bundle/write-with-spaces/plugin/write_with_spaces.vim
@@ -0,0 +1,8 @@
+" Write with spaces
+"
+" Taken from iler.ml at
+" http://vim.1045645.n5.nabble.com/How-to-auto-escape-space-in-filename-when-write-tp1149064p1149065.html
+"
+" Provides a way to save files with spaces in their name
+
+command! -bang -nargs=* Write :call write_with_spaces#Write(<q-bang>, <q-args>)