1. Gabriel AHTUNE
  2. SuperNormal

Commits

Gabriel AHTUNE  committed 1b1e369

Solve the unusefulcase of the line filled with only space/tab, in insert mode
home button go to the penultimate character. whereas I was expecting it to go to the last.

  • Participants
  • Parent commits 3716846
  • Branches default

Comments (0)

Files changed (1)

File plugin/supernormal.vim

View file
         let save_ve = &ve
         set ve=all
         exec "norm! gi\<C-O>l"
-        let startofline = strpart(getline('.'), 0, col('.') - 1)
+        let startofline = strpart(getline('.'), 0, col('.') - 2)
         if (startofline =~'^\s*$') && col('.') != 1
-            norm! 0
+            norm! 0i
         elseif startofline =~ '^\W*$' && col('.') != 1
-            norm! ^
+            norm! ^a
         else
             call GotoFirstWord()
+            norm! a
         endif
         let &ve = save_ve
+        return ''
     endfunction
 
     onoremap <silent> <Home> :call SuperHome()<CR>
     nnoremap <silent> <Home> :call SuperHome()<CR>
-    inoremap <silent> <Home> <ESC>:call SuperHomeInInsert()<CR>i
+    inoremap <silent> <Home> <C-O>:call SuperHomeInInsert()<CR>
     vnoremap <silent> <Home> om`o<ESC>:call SuperHome()<CR>v``o
 endif