>> On Sat, 13 Jun 2009 20:18:02 -0400, 
>> Daniel Underwood <djuatde...@gmail.com> said:

D> I edit python code in vim using Terminal on xfce.  I find myself, not
D> surprisingly, having to exit "insert mode" and save changes frequently
D> (when making code changes and wishing to test the immediate effects of
D> the changes in a separate terminal).  This requires pressing 4 keys:
D> "esc", ":", "w", and "enter".  How can I configure a shortcut (ideally
D> using an F# key) that will perform this sequence of 4 key-presses?

   If you're moving to a separate terminal to test, that sounds like
   another keystroke or mouse-movement.  You could set up vi/vim to
   autosave on suspension, then use one function key to suspend back to
   your shell prompt, run your test, and use a shell alias to get back
   to your edit session.

   VIM settings:
      set autowrite
      imap #5 <ESC>:suspend<CR>

   Shell aliases (works for bash/zsh, syntax for tcsh is different):
      alias 1='%1'
      alias 2='%2'
      alias 3='%3'
      alias 4='%4'
      alias 5='%5'
      alias 6='%6'
      alias 7='%7'
      alias 8='%8'
      alias 9='%9'

   This way, you can restart a suspended job without having to type a dopey
   percent sign first.  Here are some other VIM mappings I've found useful.

   I hate using the shift key unless it's essential, so to indent/deindent:
      map ; >>
      map = <<

   It's easier for me to see context when the cursor is around the middle
   of the screen:
      map q z.

   Sometimes I like a column ruler just for a second or two.  Press 'E' to
   see it, then 'u':
      map E 
o<Esc>i....+....1....+....2....+....3....+....4....+....5....+....6....+....7....+<Esc>

   I like my paragraphs ragged-right, around 75 columns long.  This lets me
   reformat whatever paragraph I'm in by pressing 'v':
      map v }jmbk{ma}:'a,.!fmt -1^V|fmt -75<CR>'b

   The "^V" is an actual control character, so you have to hit Ctrl-V twice
   to put it in your .vimrc file.  My .vimrc file is here:
      http://www.hcst.net/~vogelke/src/editors/vim/

-- 
Karl Vogel                      I don't speak for the USAF or my company
To sin by silence when they should protest makes cowards of men.
                                                    --Abraham Lincoln
_______________________________________________
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to "freebsd-questions-unsubscr...@freebsd.org"

Reply via email to