summaryrefslogtreecommitdiff
path: root/zlglib.vim
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--zlglib.vim (renamed from functions.vim)23
1 files changed, 17 insertions, 6 deletions
diff --git a/functions.vim b/zlglib.vim
index 5264701..0e280ff 100644
--- a/functions.vim
+++ b/zlglib.vim
@@ -1,5 +1,15 @@
+" Name: zlglib.vim
+" Author: zlg <zlg+vim@zlg.space>
+" License: Vim
+"
+" Integrate by symlinking to this file inside the 'autoload' directory:
+" cd $HOME/.vim/autoload
+" ln -s /path/to/zlglib.vim zlg.vim
+"
+" Next, hook things up as you wish via something like :call zlg#foo()
+
" StripTrailingWhitespaces, by Drew Neil of vimcasts.org {{{1
-function! <SID>StripTrailingWhitespaces()
+function! zlg#StripTrailingWhitespaces()
" Save last search and cursor position
let _s=@/
let l = line(".")
@@ -12,7 +22,7 @@ function! <SID>StripTrailingWhitespaces()
endfunction
" SynStack, by Drew Neil of vimcasts.org {{{1
-function! <SID>SynStack()
+function! zlg#SynStack()
if !exists("*synstack")
return
endif
@@ -20,7 +30,7 @@ function! <SID>SynStack()
endfunction
" CountCodeLines, by zlg {{{1
-function! <SID>CountCodeLines()
+function! zlg#CountCodeLines()
let code_count = 0
for line in getbufline("%", 1, "$")
if (len(line) > 0 && match(line, '\S\+') > -1)
@@ -58,7 +68,7 @@ function! s:IsCommentLine(line)
endfunction
" InsertDOW, by zlg {{{1
-function! <SID>InsertDOW()
+function! zlg#InsertDOW()
" Let's backup a random register
let tmpx = @x
let @x = system("date +\"%a \" -d" . strftime("%Y") . "-" . substitute(expand("<cWORD>"), ":", "", ""))
@@ -117,7 +127,7 @@ endfunction
" SwapKeys, by zlg {{{1
" This function isn't that fancy; it just flips a variable and calls the
" mapping function.
-function! SwapKeys()
+function! zlg#SwapKeys()
if (exists("g:use_dvorak") && (g:use_dvorak == 1 || g:use_dvorak == 0))
let g:use_dvorak = (!g:use_dvorak)
call SetKeyMap()
@@ -139,7 +149,7 @@ endfunction
" a global variable. In this case, it's g:use_dvorak, to swap between Dvorak
" and QWERTY layouts. It can be extended to use any number of key mappings
" that you need.
-function! SetKeyMap()
+function! zlg#SetKeyMap()
if g:use_dvorak == 1
" I use a Dvorak keyboard, so standard vim movement keys are a hassle.
" Since mnemonics are helpful all around, I need a mapping that gives me
@@ -206,6 +216,7 @@ function! SetKeyMap()
" Fold-related keybindings
noremap zh zj
noremap zt zk
+
echomsg "Bindings set to Dvorak"
else
" set qwerty keys; basically just resetting things