rstacruz / sparkup

A parser for a condensed HTML format
MIT License
1.57k stars 145 forks source link

SparkupNext() doesn't account for non-standard movement keys #98

Closed ghost closed 10 years ago

ghost commented 10 years ago

On line 118, execute 'normal l' screws up because I use a dvorak keyboard layout and remapped my movement to dhtn. Changing this to normal n corrected the problem, but that won't work for everyone since keybindings vary across the board

Here's my stab at refactoring it to work independently of keybindings:

function! s:SparkupNext()
    " 1: empty tag, 2: empty attribute, 3: empty line
    let n = search('><\/\|\(""\)\|\(^\s*$\)', 'Wp')
    if n == 3
        startinsert!
    else
        let p = getpos(".")
        let p[2] = p[2] + 1
        call setpos(".", p)
        startinsert
    endif
endfunction

If I knew how to generate a patch or figure out pull requests, I'd offer it; I hope this is satisfactory. This plugin is great, btw! I can't wait to integrate it with my workflow. Thanks for reading.

EDIT: corrected execute setpos to call setpos.

ghost commented 10 years ago

Looks like the accepted Pull Request from my fork didn't close this issue, so I'll close it myself. Thanks for accepting the code!

faceleg commented 10 years ago

:+1: