I'd like to map a function key (f.i. F7) to have quickly the gggqG format command; i'd like to place it permanently in my .vimrc and working in console (not in gvim). I red some literature, but I was not able to solve. Any suggestion? Thanx

  • this largely depends on the terminal-emulator in use. It should work with <f7> for xterm out of the box. same for linux-console.
    – Naumann
    Commented Apr 7, 2018 at 21:15
  • at present here I'm using gnome-console
    – user41063
    Commented Apr 7, 2018 at 21:19
  • echo $SHELL tells me /bin/bash
    – user41063
    Commented Apr 7, 2018 at 21:25
  • $SHELL is not relevant here. Look for $TERM and :set term
    – Naumann
    Commented Apr 7, 2018 at 21:28
  • samiel@darkstar ~ $ $TERM xterm-256color:
    – user41063
    Commented Apr 7, 2018 at 21:33

1 Answer 1


simply put map <f7> gggqG into your .vimrc. It works out of the box for most terminals, including xterm and xterm-256color

  • yes, it was so simply.... working!
    – user41063
    Commented Apr 7, 2018 at 21:48
  • Teach a man to fish: :h key-notation :)
    – statox
    Commented Apr 8, 2018 at 10:57

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.