Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

Improve on vim mappings #40

Closed
wants to merge 3 commits into from

3 participants

@blueyed

No description provided.

blueyed added some commits
@blueyed blueyed Do not add normal mode mappings for Vim.
Closes #35
7ab92a4
@blueyed blueyed Improve mapping for Vim, using <Plug> maps>
Add redirection through <Plug>SparkupExecute and <Plug>SparkupNext and
check if mappings are defined for them before assigning default maps.
72deab1
@Osse

I have a different mapping issue with sparkup.py. I have switched . and : with "noremap . :" and "noremap : ." because I use : much more often than . and my (Norwegian) keyboard is set up so that S-. produces :

I wonder if your suggestion also fixes this issue. I see you use imap instead of inoremap but there is some other Vim-fu there that I don't understand.

I have tried replacing imap with inoremap in the original sparkup.vim with success. I haven't noticed any side effects.

@blueyed

@Osse: Yes, it should be using inoremap - otherwise the : being used would get mapped to . with your mapping. I will change my pull request accordingly - I had just kept it like it was.
Thanks for notifying.

@blueyed blueyed Use `inoremap` for calling Sparkup{,Next}().
This will make the mapping work properly with e.g.
`noremap : .`.

See rstacruz/sparkup#40 (comment)
0decf72
@faceleg
Collaborator

Would you consider syncing this with master? Then I'd be able to merge it in more easily.

@faceleg faceleg closed this
@mikker mikker referenced this pull request from a commit in mikker/sparkup
@blueyed blueyed Use `inoremap` for calling Sparkup{,Next}().
This will make the mapping work properly with e.g.
`noremap : .`.

See rstacruz#40 (comment)
6faebdb
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Apr 5, 2011
  1. @blueyed

    Do not add normal mode mappings for Vim.

    blueyed authored
    Closes #35
  2. @blueyed

    Improve mapping for Vim, using <Plug> maps>

    blueyed authored
    Add redirection through <Plug>SparkupExecute and <Plug>SparkupNext and
    check if mappings are defined for them before assigning default maps.
Commits on May 23, 2011
  1. @blueyed

    Use `inoremap` for calling Sparkup{,Next}().

    blueyed authored
    This will make the mapping work properly with e.g.
    `noremap : .`.
    
    See rstacruz/sparkup#40 (comment)
This page is out of date. Refresh to see the latest.
Showing with 9 additions and 4 deletions.
  1. +9 −4 vim/ftplugin/html/sparkup.vim
View
13 vim/ftplugin/html/sparkup.vim
@@ -26,10 +26,15 @@ if !exists('g:sparkupNextMapping')
let g:sparkupNextMapping = '<c-n>'
endif
-exec 'nmap <buffer> ' . g:sparkupExecuteMapping . ' :call <SID>Sparkup()<cr>'
-exec 'imap <buffer> ' . g:sparkupExecuteMapping . ' <c-g>u<Esc>:call <SID>Sparkup()<cr>'
-exec 'nmap <buffer> ' . g:sparkupNextMapping . ' :call <SID>SparkupNext()<cr>'
-exec 'imap <buffer> ' . g:sparkupNextMapping . ' <c-g>u<Esc>:call <SID>SparkupNext()<cr>'
+inoremap <buffer> <Plug>SparkupExecute <c-g>u<Esc>:call <SID>Sparkup()<cr>
+inoremap <buffer> <Plug>SparkupNext <c-g>u<Esc>:call <SID>SparkupNext()<cr>
+
+if ! hasmapto('<Plug>SparkupExecute', 'i')
+ exec 'imap <buffer> ' . g:sparkupExecuteMapping . ' <Plug>SparkupExecute'
+endif
+if ! hasmapto('<Plug>SparkupNext', 'i')
+ exec 'imap <buffer> ' . g:sparkupNextMapping . ' <Plug>SparkupNext'
+endif
if exists('*s:Sparkup')
finish
Something went wrong with that request. Please try again.