sent 14:08:31 27 November 2010, Saturday
by ZyX:
Some additional notes:
1. Do not pollute buffer and global scopes with lots of variables: either use 
two dictionaries (one global and one buffer) which will hold all of them (for 
example, see how it is implemented in vim-addon-manager), or do as I do: purge 
out all global and buffer variables, use script-global dictionary with buffer 
numbers as keys to emulate buffer-local variables and just script variables for 
other purposes.
2. Let user decide which mapping to use: replace lots of buffer maps with
    if !exists('b:map_leader')
        let b:map_leader=','
    endif
    execute "noremap ".b:map_leader."... ..."
and replace global mappings with
    let s:org_maps={'effort': '<F5>'}
    function s:GetLHS(name)
        return ((exists('g:org_maps.'.a:name))?
               \      (g:org_maps[a:name]):
               \      (s:org_maps[a:name]))
    endfunction
          
    if !empty(s:GetLHS('effort'))
        execute "inoremap ".(s:GetLHS('effort'))." <C-r>=Effort()<CR>"
        execute "noremap ".(s:GetLHS('effort'))." <C-r>=Effort()<CR>"
    endif
users won't thank you if you unconditionally remap functional key.
3. Replace
    let g:weekdaystring = '\cmon\|tue\|wed\|thu\|fri\|sat\|sun'
with
    let s:weekdaystring = '\c'.join(g:org_options.weekdays, '\|')
in order to let users localize it.
4. Replace
    set formatlistpat=^\\s*\\d\\+\\.\\s\\+\\\|^\\s*\\-\\s\\+
with
    let &l:formatlistpat='^\s*\d\+\.\s\+\|^\s*-\s\+'
because 1) it is more readable without lots of backslashes and 2) its sets local 
option, not global. I do not know, why you have escaped `-' here, so that 
escaping was removed.
No comments:
Post a Comment