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

Re: cmap to use a substitute command

Expand Messages
  • David Fishburn
    ... Thanks Andy. I regularly use the MRU plugin with it s tab completion. I will often use it to get close to a file I want to edit (absolute path) and then
    Message 1 of 7 , Apr 21, 2012
    • 0 Attachment
      On 4/20/2012 3:07 PM, Andy Wokula wrote:
      > Am 20.04.2012 19:53, schrieb David Fishburn:
      >> Good Morning.
      >>
      >> Vim 7.3.1-421 Windows 7 64-bit.
      >>
      >> I want to create a command mode mapping which will do a substitution
      >> on what is already typed in.
      >> I am just wondering how to get access to the command line?
      >>
      >> My searches through the help which was based on cmap and mapmode-c
      >> didn't reveal anything I could use.
      >>
      >> Thanks,
      >> Dave
      >
      > :h getcmdline()
      > :h c_CTRL-\_e
      > :h c_CTRL-R_=
      > :h getcmdpos()
      > :h setcmdpos()
      >
      > I've used all of the above in conomode.vim:
      > http://vim.sf.net/scripts/script.php?script_id=2388
      >
      > (maybe not very readable code, but should be enough to get some
      > inspiration :-)
      >

      Thanks Andy.

      I regularly use the MRU plugin with it's tab completion.

      I will often use it to get close to a file I want to edit (absolute
      path) and then need to change :MRU to :e and finish editing the command
      line and edit the file.

      So, this cmap will do what I want <C-e> for "e"dit:
      cmap <C-e> <C-\>esubstitute(getcmdline(), '^MRU\>', 'e', '')<CR>

      Dave


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