Loading ...
Sorry, an error occurred while loading the content.

139466Re: How to reverse an imap in javascript, for json files?

Expand Messages
  • Christian Brabandt
    Oct 8, 2013
    • 0 Attachment
      Hi Sam!

      On Di, 08 Okt 2013, Sam Roberts wrote:

      > I map " to ' (because my fingers always do ", but our coding standards are ').
      >
      > " in after/ftplugin/javascript.vim
      > imap <buffer> " '
      >
      > However, " is required in json, and the javascript plugin seems to be
      > applying itself to json files.
      >
      > I tried to use vim-json, which I quite like for its highlighting and
      > syntax checking... but, I don't want to C-v " every time I need a
      > double quote.
      >
      > " error... in after/ftplugin/json.vim
      > iunmap <buffer> "
      >
      >
      > I've tried a few variations, including autocommands. I'm a bit baffled.
      >
      > Can anybody suggest how I get an imap for only *.javascript, not
      > *.json? Preferably while still using vim-json?

      Don't know about vim-json, but try this autocommand:

      augroup MyJSONMaps
      au!
      au BufRead * if expand("<afile>") !~# ".json" | imap <buffer> " ' | endif
      augroup END

      Mit freundlichen Grüßen
      Christian
      --
      Die Welt ist voll von Leuten, die Wasser predigen und Wein trinken.
      -- Giovanni Guareschi

      --
      --
      You received this message from the "vim_use" maillist.
      Do not top-post! Type your reply below the text you are replying to.
      For more information, visit http://www.vim.org/maillist.php

      ---
      You received this message because you are subscribed to the Google Groups "vim_use" group.
      To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscribe@....
      For more options, visit https://groups.google.com/groups/opt_out.
    • Show all 2 messages in this topic