Commits

Gabriel AHTUNE committed f9dc9b9

Add configuration variable for home button

  • Participants
  • Parent commits f2c3372

Comments (0)

Files changed (1)

File plugin/supernormal.vim

 " g:SuperNormalSnipmateCompatible
 " You will need to comment the line in the Snipmate plugin
 " >>>  ino <silent> <tab> <c-r>=TriggerSnippet()<cr>
+"
+" g:SuperNormalHomeCharacters
 
 " -----------------------------------------------------------------------------
 "  Del Button section
 " ---------------------------------------------------------------------------
 
 if !exists("g:SuperNormalDeactivateHomeMapping")
+
+    if !exists("g:SuperNormalHomeCharacters")
+        let g:SuperNormalHomeCharacters = '*-'
+    endif
+
     function! GotoFirstWord()
         let commentchar = substitute(&commentstring,'\S\zs%s','','')
         let save_search = @/
         norm! 0
-        let @/='^\%'.line('.').'l\s*['.commentchar.'*-]*\s*\zs\w*'
+        let @/='^\%'.line('.').'l\s*['.commentchar.g:SuperNormalHomeCharacters.']*\s*\zs\w*'
         silent exec "keepjump norm! n"
         silent exec "nohl"
         let @/ = save_search
         let startofline = strpart(getline('.'), 0, col('.') - 1)
         if (startofline =~'^\s*$') && col('.') != 1
             norm! 0
-        elseif startofline =~ '^\s*['.commentchar.'*-]*\s*$' && col('.') != 1
+        elseif startofline =~ '^\s*['.commentchar.g:SuperNormalHomeCharacters.']*\s*$' && col('.') != 1
             norm! ^
         else
             call GotoFirstWord()
     endfunction
 
     function! SuperHomeInInsert()
+        let commentchar = substitute(&commentstring,'\S\zs%s','','')
         let save_ve = &ve
         set ve=all
         exec "norm! gi\<C-O>l"
         let startofline = strpart(getline('.'), 0, col('.') - 2)
         if (startofline =~'^\s*$') && col('.') != 1
             norm! 0i
-        elseif startofline =~ '^\W*$' && col('.') != 1
+        elseif startofline =~ '^\s*['.commentchar.g:SuperNormalHomeCharacters.']*\s*$'  && col('.') != 1
             norm! ^a
         else
             call GotoFirstWord()