what are safe key combinations to remap in vim

classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|

what are safe key combinations to remap in vim

Rahul Nabar

Whenever I want to assign a repetitive operation to an easier
keystroke I'm always hesitant of inadvertently overwriting some great
inbuilt key combination. ( bad idea to remap dd or yy or 'a for
instance!)

Is there a suggestion of "safe" key combinations to go for? I use a
vt100 terminal so have only access to Fn1-Fn4 (or not?) and have used
up those already! :(

-Rahul
--~--~---------~--~----~------------~-------~--~----~
You received this message from the "vim_use" maillist.
For more information, visit http://www.vim.org/maillist.php
-~----------~----~----~----~------~----~------~--~---

Reply | Threaded
Open this post in threaded view
|

Re: what are safe key combinations to remap in vim

Yegappan Lakshmanan

Hi,

On Wed, Apr 9, 2008 at 9:40 AM, Rahul <[hidden email]> wrote:

>
>  Whenever I want to assign a repetitive operation to an easier
>  keystroke I'm always hesitant of inadvertently overwriting some great
>  inbuilt key combination. ( bad idea to remap dd or yy or 'a for
>  instance!)
>
>  Is there a suggestion of "safe" key combinations to go for? I use a
>  vt100 terminal so have only access to Fn1-Fn4 (or not?) and have used
>  up those already! :(
>

You can refer to the "Finding unused keys" section in the "Mapping keys
in Vim" tutorial available at:

http://vim.wikia.com/wiki/Mapping_keys_in_Vim_-_Tutorial_%28Part_2%29

- Yegappan

--~--~---------~--~----~------------~-------~--~----~
You received this message from the "vim_use" maillist.
For more information, visit http://www.vim.org/maillist.php
-~----------~----~----~----~------~----~------~--~---

Reply | Threaded
Open this post in threaded view
|

Re: what are safe key combinations to remap in vim

Benjamin Fritz
In reply to this post by Rahul Nabar

On 4/9/08, Rahul <[hidden email]> wrote:

>
>  Whenever I want to assign a repetitive operation to an easier
>  keystroke I'm always hesitant of inadvertently overwriting some great
>  inbuilt key combination. ( bad idea to remap dd or yy or 'a for
>  instance!)
>
>  Is there a suggestion of "safe" key combinations to go for? I use a
>  vt100 terminal so have only access to Fn1-Fn4 (or not?) and have used
>  up those already! :(
>
>
>  -Rahul

Meta keys are almost always safe (<M-A>, <M-B>, etc.). Check for
mappings from plugins, etc. before using.

When in doubt, use the help. For example, to see if CTRL-J is taken
(it is, but there are several commands to do the same thing) type
:help CTRL-J and then press CTRL-D instead of ENTER to list all
results. Then view each result to see what they do and if there are
any alternate ways to do the same thing before mapping.

If the mapping is for one mode only, you can prepend the mode. For
example, for CTRL-J in insert mode,

:help i_CTRL-J

--~--~---------~--~----~------------~-------~--~----~
You received this message from the "vim_use" maillist.
For more information, visit http://www.vim.org/maillist.php
-~----------~----~----~----~------~----~------~--~---

Reply | Threaded
Open this post in threaded view
|

Re: what are safe key combinations to remap in vim

Benjamin Fritz
In reply to this post by Yegappan Lakshmanan

On 4/9/08, Yegappan Lakshmanan <[hidden email]> wrote:

>
>  Hi,
>
>
>  On Wed, Apr 9, 2008 at 9:40 AM, Rahul <[hidden email]> wrote:
>  >
>  >  Whenever I want to assign a repetitive operation to an easier
>  >  keystroke I'm always hesitant of inadvertently overwriting some great
>  >  inbuilt key combination. ( bad idea to remap dd or yy or 'a for
>  >  instance!)
>  >
>  >  Is there a suggestion of "safe" key combinations to go for? I use a
>  >  vt100 terminal so have only access to Fn1-Fn4 (or not?) and have used
>  >  up those already! :(
>  >
>
>
> You can refer to the "Finding unused keys" section in the "Mapping keys
>  in Vim" tutorial available at:
>
>  http://vim.wikia.com/wiki/Mapping_keys_in_Vim_-_Tutorial_%28Part_2%29
>
>
>  - Yegappan
>
>

Oh, and you can also use the map leader (see :help <Leader>), which
defaults to the backslash key. For example,

nmap <leader>h :echo "hello world!"<CR>

--~--~---------~--~----~------------~-------~--~----~
You received this message from the "vim_use" maillist.
For more information, visit http://www.vim.org/maillist.php
-~----------~----~----~----~------~----~------~--~---

Reply | Threaded
Open this post in threaded view
|

RE: what are safe key combinations to remap in vim

Gene Kwiecinski
In reply to this post by Rahul Nabar

>Is there a suggestion of "safe" key combinations to go for? I use a
>vt100 terminal so have only access to Fn1-Fn4 (or not?) and have used
>up those already! :(

Lotta people use ';' and/or ',' as a leader char.  So if you want to
/r/eformat some text, you can map ",r" to a set of commands, function,
etc.  Kinda the way 'g' prefaces like a brazillion separate commands
(go-to, reformat, etc.).

I've been thinking of doing that for the first time, as I never had
occasion/need before to remap anything like that.  Really should, but
never got a round tuit.

--~--~---------~--~----~------------~-------~--~----~
You received this message from the "vim_use" maillist.
For more information, visit http://www.vim.org/maillist.php
-~----------~----~----~----~------~----~------~--~---

Reply | Threaded
Open this post in threaded view
|

Re: what are safe key combinations to remap in vim

Benjamin Fritz

On 4/9/08, Gene Kwiecinski <[hidden email]> wrote:

>
>  >Is there a suggestion of "safe" key combinations to go for? I use a
>  >vt100 terminal so have only access to Fn1-Fn4 (or not?) and have used
>  >up those already! :(
>
>
> Lotta people use ';' and/or ',' as a leader char.  So if you want to
>  /r/eformat some text, you can map ",r" to a set of commands, function,
>  etc.  Kinda the way 'g' prefaces like a brazillion separate commands
>  (go-to, reformat, etc.).
>
>  I've been thinking of doing that for the first time, as I never had
>  occasion/need before to remap anything like that.  Really should, but
>  never got a round tuit.
>

The problem with ; and , is that they are already commands, used to
repeat the last f, t, F, or T search to more rapidly jump to a certain
character.

See :help ; and :help ,

--~--~---------~--~----~------------~-------~--~----~
You received this message from the "vim_use" maillist.
For more information, visit http://www.vim.org/maillist.php
-~----------~----~----~----~------~----~------~--~---