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

Re: Filetype dependent mapping when moving between splits

Expand Messages
  • Gary Johnson
    ... Put the key mapping for each filetype in your after/ftplugin file for each filetype: ~/.vim/after/ftplugin/perl.vim ~/.vim/after/ftplugin/c.vim
    Message 1 of 4 , Oct 7, 2013
      On 2013-10-07, Marek Schimara wrote:
      > Hi all,
      >
      > I can't seem to figure out how to map the same key (let's say <F6>) to jump
      > between subs in Perl when looking at a Perl file, between methods in C when in
      > a C source file, between keywords CREATE when in SQL, etc. I can do it on
      > BufEnter / BufWinEnter, but these don't happen when switching between (already
      > open) splits.

      Put the key mapping for each filetype in your after/ftplugin file
      for each filetype:

      ~/.vim/after/ftplugin/perl.vim
      ~/.vim/after/ftplugin/c.vim
      ~/.vim/after/ftplugin/sql.vim
      etc.

      You could use instead a FileType autocommand in your ~/.vimrc for
      each of the affected filetypes.

      When you define each key mapping, use the <buffer> qualifier, e.g.,

      nnoremap <buffer> <F6> rhs-of-mapping

      See

      :help map-<buffer>

      Regards,
      Gary

      --
      --
      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.
    • marek77
      ... Thanks, this is exactly what was needed! :-) Marek -- -- You received this message from the vim_use maillist. Do not top-post! Type your reply below the
      Message 2 of 4 , Oct 8, 2013
        On Monday, October 7, 2013 4:51:37 PM UTC+2, Gary Johnson wrote:
        > On 2013-10-07, Marek Schimara wrote:
        >
        > > Hi all,
        >
        > >
        >
        > > I can't seem to figure out how to map the same key (let's say <F6>) to jump
        >
        > > between subs in Perl when looking at a Perl file, between methods in C when in
        >
        > > a C source file, between keywords CREATE when in SQL, etc. I can do it on
        >
        > > BufEnter / BufWinEnter, but these don't happen when switching between (already
        >
        > > open) splits.
        >
        >
        >
        > Put the key mapping for each filetype in your after/ftplugin file
        >
        > for each filetype:
        >
        >
        >
        > ~/.vim/after/ftplugin/perl.vim
        >
        > ~/.vim/after/ftplugin/c.vim
        >
        > ~/.vim/after/ftplugin/sql.vim
        >
        > etc.
        >
        >
        >
        > You could use instead a FileType autocommand in your ~/.vimrc for
        >
        > each of the affected filetypes.
        >
        >
        >
        > When you define each key mapping, use the <buffer> qualifier, e.g.,
        >
        >
        >
        > nnoremap <buffer> <F6> rhs-of-mapping
        >
        >
        >
        > See
        >
        >
        >
        > :help map-<buffer>
        >
        >
        >
        > Regards,
        >
        > Gary


        Thanks, this is exactly what was needed! :-)

        Marek

        --
        --
        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.
      Your message has been successfully submitted and would be delivered to recipients shortly.