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

Re: mapping keys

Expand Messages
  • soundphed
    You all rock so much, exactly the info I needed, I m vim in in style now, thank you so much!! -j ... --~--~---------~--~----~------------~-------~--~----~ You
    Message 1 of 5 , Feb 20, 2008
      You all rock so much, exactly the info I needed, I'm vim'in in style
      now, thank you so much!! -j

      On Feb 20, 9:20 am, "Benjamin Fritz" <fritzophre...@...> wrote:
      > On 2/20/08, Sadarax <sada...@...> wrote:
      >
      >
      >
      > > Tony's reply was good, but here is a bit more that might be useful. The
      > > variable '%' is the current buffer. If you need more functionality from
      > > this, you might look at the help for expand(). I use this often with if
      > > statements. Such as:
      >
      > > if expand("%:e") =~ "^cpp$"
      > > ...
      > > endif
      >
      > > -Sadarax
      >
      > > On Feb 19, 2008 8:44 PM, Tony Mechelynck <antoine.mechely...@...>
      > > wrote:
      >
      > > > soundphed wrote:
      > > > > Hi I was wondering if its possible to get the current file being
      > > > > edited as a variable to use in a !shell command within vi, and then
      > > > > map it to a key. I have a shell script that call curl to upload files
      > > > > via ftp, and I was thinking that if I was just able to hit <F2> or
      > > > > something and have it call the script with the currently editing
      > > > > filename, it would save me a lot of typing/time. Is this possible??
      >
      > > > Sure it is (well, at least within vim; I don't know about vi): just figure
      > > out
      > > > what you would type and assign it to a key. Maybe something like
      >
      > > > :map <F2> :!upload.sh %:p<CR>
      >
      > > > See
      > > > :help :!
      > > > :help cmdline-special
      >
      > > > Best regards,
      > > > Tony.
      > > > --
      > > > "I don't have any solution but I certainly admire the problem."
      > > > -- Ashleigh Brilliant
      >
      > > --
      > > How sad it would be to live a life less wonderful, if only because one were
      > > afraid of a little hard work. If you shy away from challenges, you shy away
      > > from some of the greatest achievements in life.
      >
      > Also, you might consider using a cabbrev rather than a mapping if you
      > usually use the current file, but might sometimes specify a different
      > file.
      >
      > Something like:
      >
      > :cabbrev upload !upload.sh %
      >
      > This will allow you to type :upload<enter> to upload the current file,
      > or :upload<space> to allow you to edit the command before running it.
      >
      > I have a cabbrev similar to this for using the vimgrep command, which
      > I normally use to search for the word under the cursor in all files of
      > the same type in the current directory, but not always.
      --~--~---------~--~----~------------~-------~--~----~
      You received this message from the "vim_use" maillist.
      For more information, visit http://www.vim.org/maillist.php
      -~----------~----~----~----~------~----~------~--~---
    Your message has been successfully submitted and would be delivered to recipients shortly.