aboutsummaryrefslogtreecommitdiffstats
path: root/str.vim
diff options
context:
space:
mode:
authorPeter Odding <peter@peterodding.com>2011-03-15 23:00:55 +0100
committerPeter Odding <peter@peterodding.com>2011-03-15 23:00:55 +0100
commita205f918f5797d9183f7f479360ed91bbce2b388 (patch)
treed2cf19205d9cd875a463b6835cd249cd183f9d28 /str.vim
downloadvim-easytags-a205f918f5797d9183f7f479360ed91bbce2b388.tar.gz
Initial commit
Diffstat (limited to 'str.vim')
-rw-r--r--str.vim12
1 files changed, 12 insertions, 0 deletions
diff --git a/str.vim b/str.vim
new file mode 100644
index 0000000..19bfe09
--- /dev/null
+++ b/str.vim
@@ -0,0 +1,12 @@
+" Vim auto-load script
+" Author: Peter Odding <peter@peterodding.com>
+" Last Change: March 15, 2011
+" URL: http://peterodding.com/code/vim/misc/
+
+" Trim whitespace from start and end of string.
+
+function! xolox#misc#str#trim(s)
+ return substitute(a:s, '^\s*\(.\{-}\)\s*$', '\1', '')
+endfunction
+
+" vim: ts=2 sw=2 et