aboutsummaryrefslogtreecommitdiff
path: root/vim/config/format.vim
diff options
context:
space:
mode:
authorTom Ryder <tom@sanctum.geek.nz>2017-10-30 19:11:22 +1300
committerTom Ryder <tom@sanctum.geek.nz>2017-10-30 19:11:22 +1300
commit1834c083aa436d59713b0054566e06648d67ac1e (patch)
treec49418442110da13aef79acfb7af29eee95ab4b1 /vim/config/format.vim
parentMove viminfo conf from spell.vim into new subfile (diff)
downloaddotfiles-1834c083aa436d59713b0054566e06648d67ac1e.tar.gz
dotfiles-1834c083aa436d59713b0054566e06648d67ac1e.zip
Apply name conventions, scoping to Vim identifiers
The Google VimScript Style Guide says <https://google.github.io/styleguide/vimscriptguide.xml#Naming>: >In general, use plugin-names-like-this, FunctionNamesLikeThis, >CommandNamesLikeThis, augroup_names_like_this, >variable_names_like_this. Adjusted variable, function, and `augroup` names accordingly, including setting script scope for some of the functions and their calls (`s:` and `<SID>` prefixes). Initially I tried using `prefix#`, but it turns out that this is a namespacing contention for publically callable functions like `pathogen#infect`, and none of these functions need to be publically callable.
Diffstat (limited to 'vim/config/format.vim')
-rw-r--r--vim/config/format.vim8
1 files changed, 4 insertions, 4 deletions
diff --git a/vim/config/format.vim b/vim/config/format.vim
index fadbd8f7..b307c4b6 100644
--- a/vim/config/format.vim
+++ b/vim/config/format.vim
@@ -20,12 +20,12 @@ endif
" very handy
"
if has('eval')
- function! ToggleFormatFlag(flag)
+ function! s:ToggleFormatFlag(flag)
let l:operation = (&formatoptions =~ a:flag) ? '-=' : '+='
silent! exec 'setlocal formatoptions' . l:operation . a:flag
setlocal formatoptions?
endfunction
- nnoremap <silent> <leader>a :<C-U>call ToggleFormatFlag('a')<CR>
- nnoremap <silent> <leader>c :<C-U>call ToggleFormatFlag('c')<CR>
- nnoremap <silent> <leader>t :<C-U>call ToggleFormatFlag('t')<CR>
+ nnoremap <silent> <leader>a :<C-U>call <SID>ToggleFormatFlag('a')<CR>
+ nnoremap <silent> <leader>c :<C-U>call <SID>ToggleFormatFlag('c')<CR>
+ nnoremap <silent> <leader>t :<C-U>call <SID>ToggleFormatFlag('t')<CR>
endif