aboutsummaryrefslogtreecommitdiff
path: root/vim/plugin
diff options
context:
space:
mode:
Diffstat (limited to 'vim/plugin')
-rw-r--r--vim/plugin/big_file_options.vim (renamed from vim/plugin/big_file.vim)15
-rw-r--r--vim/plugin/command_typos.vim37
-rw-r--r--vim/plugin/copy_linebreak.vim3
-rw-r--r--vim/plugin/fixed_join.vim3
-rw-r--r--vim/plugin/strip_trailing_whitespace.vim5
-rw-r--r--vim/plugin/toggle_option_flag.vim20
6 files changed, 58 insertions, 25 deletions
diff --git a/vim/plugin/big_file.vim b/vim/plugin/big_file_options.vim
index ec30158a..fd686fd8 100644
--- a/vim/plugin/big_file.vim
+++ b/vim/plugin/big_file_options.vim
@@ -1,6 +1,6 @@
"
-" big_file.vim: When opening a large file, take some measures to keep things
-" loading quickly.
+" big_file_options.vim: When opening a large file, take some measures to keep
+" things loading quickly.
"
" Author: Tom Ryder <tom@sanctum.geek.nz>
" License: Same as Vim itself
@@ -23,10 +23,10 @@ if has('eval') && has('autocmd')
endif
" Declare function for turning off slow options
- function! s:BigFileOptions(name, size)
+ function! s:BigFileOptions()
" Don't do anything if the file is under the threshold
- if getfsize(a:name) <= a:size
+ if getfsize(expand('<afile>')) <= g:big_file_size
return
endif
@@ -39,7 +39,8 @@ if has('eval') && has('autocmd')
endif
" Limit the number of columns of syntax highlighting
- if exists('&synmaxcol') && &synmaxcol > g:big_file_synmaxcol
+ if exists('&synmaxcol')
+ \ && &synmaxcol > g:big_file_synmaxcol
execute 'setlocal synmaxcol=' . g:big_file_synmaxcol
endif
@@ -53,7 +54,9 @@ if has('eval') && has('autocmd')
" Define autocmd for calling to check filesize
augroup big_file_options_bufreadpre
autocmd!
- autocmd BufReadPre * call s:BigFileOptions(expand('<afile>'), g:big_file_size)
+ autocmd BufReadPre
+ \ *
+ \ call s:BigFileOptions()
augroup end
endif
diff --git a/vim/plugin/command_typos.vim b/vim/plugin/command_typos.vim
index 32d194fb..6f46b115 100644
--- a/vim/plugin/command_typos.vim
+++ b/vim/plugin/command_typos.vim
@@ -7,13 +7,32 @@
" License: Same as Vim itself
"
if has('eval') && has('user_commands')
- command! -bang -complete=file -nargs=? E e<bang> <args>
- command! -bang -complete=file -nargs=? W w<bang> <args>
- command! -bang -complete=file -nargs=? WQ wq<bang> <args>
- command! -bang -complete=file -nargs=? Wq wq<bang> <args>
- command! -bang Q q<bang>
- command! -bang Qa qa<bang>
- command! -bang QA qa<bang>
- command! -bang Wa wa<bang>
- command! -bang WA wa<bang>
+
+ command! -bang -complete=file -nargs=?
+ \ E
+ \ edit<bang> <args>
+ command! -bang -complete=file -nargs=?
+ \ W
+ \ write<bang> <args>
+ command! -bang -complete=file -nargs=?
+ \ WQ
+ \ wq<bang> <args>
+ command! -bang -complete=file -nargs=?
+ \ Wq
+ \ wq<bang> <args>
+ command! -bang
+ \ Q
+ \ quit<bang>
+ command! -bang
+ \ Qa
+ \ qall<bang>
+ command! -bang
+ \ QA
+ \ qall<bang>
+ command! -bang
+ \ Wa
+ \ wall<bang>
+ command! -bang
+ \ WA
+ \ wa<bang>
endif
diff --git a/vim/plugin/copy_linebreak.vim b/vim/plugin/copy_linebreak.vim
index 1dc537d4..5c8d5f77 100644
--- a/vim/plugin/copy_linebreak.vim
+++ b/vim/plugin/copy_linebreak.vim
@@ -31,6 +31,7 @@ if has('eval')
endfunction
" Provide mapping proxy to the function just defined
- noremap <Plug>CopyLinebreak
+ noremap <silent> <unique>
+ \ <Plug>CopyLinebreak
\ :<C-U>call <SID>CopyLinebreak()<CR>
endif
diff --git a/vim/plugin/fixed_join.vim b/vim/plugin/fixed_join.vim
index c002f667..5e3a5c2b 100644
--- a/vim/plugin/fixed_join.vim
+++ b/vim/plugin/fixed_join.vim
@@ -24,6 +24,7 @@ if has('eval')
endfunction
" Create mapping proxy to the function just defined
- noremap <Plug>FixedJoin
+ noremap <silent> <unique>
+ \ <Plug>FixedJoin
\ :<C-U>call <SID>FixedJoin()<CR>
endif
diff --git a/vim/plugin/strip_trailing_whitespace.vim b/vim/plugin/strip_trailing_whitespace.vim
index 17fff33f..3840195b 100644
--- a/vim/plugin/strip_trailing_whitespace.vim
+++ b/vim/plugin/strip_trailing_whitespace.vim
@@ -36,6 +36,7 @@ if has('eval')
" Increment the line counter for the next iteration
let l:li = l:li + 1
+
endwhile
" If the last non-whitespace line was before the last line proper, we can
@@ -54,9 +55,11 @@ if has('eval')
" Return the cursor to the saved position
call cursor(l:lc, l:cc)
endif
+
endfunction
" Create mapping proxy to the function just defined
- noremap <Plug>StripTrailingWhitespace
+ noremap <silent> <unique>
+ \ <Plug>StripTrailingWhitespace
\ :<C-U>call <SID>StripTrailingWhitespace()<CR>
endif
diff --git a/vim/plugin/toggle_option_flag.vim b/vim/plugin/toggle_option_flag.vim
index 10b4fe7a..43561a25 100644
--- a/vim/plugin/toggle_option_flag.vim
+++ b/vim/plugin/toggle_option_flag.vim
@@ -25,20 +25,26 @@ if has('eval') && has('user_commands')
endif
" Choose which set command to use
- let l:set = a:local ? 'setlocal' : 'set'
+ let l:set = a:local
+ \ ? 'setlocal'
+ \ : 'set'
- " Use eval() to assign -= or += to l:op for the option toggle
+ " eval() to assign -= or += to l:op for the option toggle
" (I couldn't get {curly braces} indirection to work)
let l:op = ''
execute 'let l:op = &'.a:option.' =~# a:flag ? "-=" : "+="'
- " Use eval() to perform the option toggle and then print the value
- execute l:set . ' ' . a:option . l:op . a:flag . ' ' . a:option . '?'
+ " eval() to perform the option toggle and then print the value
+ execute l:set . ' ' . a:option . l:op . a:flag
+ execute l:set . ' ' . a:option . '?'
endfunction
" User commands wrapping around calls to the above function
- command! -nargs=+ ToggleOptionFlag :call <SID>Toggle(<f-args>, 0)
- command! -nargs=+ ToggleOptionFlagLocal :call <SID>Toggle(<f-args>, 1)
-
+ command! -nargs=+
+ \ ToggleOptionFlag
+ \ call <SID>Toggle(<f-args>, 0)
+ command! -nargs=+
+ \ ToggleOptionFlagLocal
+ \ call <SID>Toggle(<f-args>, 1)
endif