Does vim provide a placeholder key mapping construct, i.e. one that cannot be invoked from the keyboard?
Something like
nnoremap <cannot_be_pressed>[KEY] [STOCK_MAPPING]
It's probably not clear why I'm asking. I was trying to add ]c [c mappings for non-diff files without stepping on the existing diff mapping. Most approaches I tried ran into various issues with global mapping conflicts. The solution that worked for me was to map the stock behavior to a function key (which I don't use) and set up a function where I could execute normal one or the other. This is not bad (and can be extended) but it seems like there ought to be a behavior something like <Plug> or <Sid> for this situation.
--
--
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
---
You received this message because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Thursday, October 23, 2014
Re: shortcuts for long filenames
On Thursday, October 23, 2014 9:06:50 AM UTC-5, Tim Chase wrote:
>
> A couple ideas in addition to Jürgen's good suggestions:
>
> - you can use tab-completion, so you could type
>
> :e /v<tab>/www/h<tab>/si<tab>/all/m<tab>/jq<tab>
>
> or something like that
>
To expand on this: recursive directory search in tab completion!
:e /var/**/modules/jq<tab>
Or, add a path to Vim, and use ":find" (which also has tab completion):
:set path+=/var/www/html/sites/all/modules
:find jq<tab>
--
--
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
---
You received this message because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
>
> A couple ideas in addition to Jürgen's good suggestions:
>
> - you can use tab-completion, so you could type
>
> :e /v<tab>/www/h<tab>/si<tab>/all/m<tab>/jq<tab>
>
> or something like that
>
To expand on this: recursive directory search in tab completion!
:e /var/**/modules/jq<tab>
Or, add a path to Vim, and use ":find" (which also has tab completion):
:set path+=/var/www/html/sites/all/modules
:find jq<tab>
--
--
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
---
You received this message because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Re: shortcuts for long filenames
Hi,
DwigtArmyOfChampions schrieb am 23.10.2014 um 16:24:
> Thanks! These are great! Second question: Is there an easy way to
> delete a word after pasting that text? Suppose I want to delete
> "modules/". Is there a quick way to do that without deleting each
> character through backspace?
>
just press Ctrl-W.
Regards,
Jürgen
--
Sometimes I think the surest sign that intelligent life exists elsewhere
in the universe is that none of it has tried to contact us. (Calvin)
--
--
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
---
You received this message because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
DwigtArmyOfChampions schrieb am 23.10.2014 um 16:24:
> Thanks! These are great! Second question: Is there an easy way to
> delete a word after pasting that text? Suppose I want to delete
> "modules/". Is there a quick way to do that without deleting each
> character through backspace?
>
just press Ctrl-W.
Regards,
Jürgen
--
Sometimes I think the surest sign that intelligent life exists elsewhere
in the universe is that none of it has tried to contact us. (Calvin)
--
--
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
---
You received this message because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Re: shortcuts for long filenames
Thanks! These are great! Second question: Is there an easy way to delete a word after pasting that text? Suppose I want to delete "modules/". Is there a quick way to do that without deleting each character through backspace?
--
--
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
---
You received this message because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
--
--
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
---
You received this message because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Re: shortcuts for long filenames
On 2014-10-23 05:58, DwigtArmyOfChampions wrote:
> Oftentimes I'm opening really long filenames in command mode, for
> example:
>
> :e /var/www/html/sites/all/modules/jqueryui_theme/jqueryui_theme.module
>
> Is there a way to create aliases for this file? Or if not the whole
> file, how about part of the path, like everything up to and
> including "modules"? That's a lot of typing!
A couple ideas in addition to Jürgen's good suggestions:
- you can use tab-completion, so you could type
:e /v<tab>/www/h<tab>/si<tab>/all/m<tab>/jq<tab>
or something like that
- You can store the things you want in a variable/register and then
recall them on the command-line using control+R to insert them:
:let @m='/var/www/html/sites/all/modules/' " do this once
:e <C-R>mjq<tab>jq*theme.module
where the "<C-R>m" inserts the contents of the register "m" in
which you stored the path you want. You can even set up multiple
registers if you have multiple paths. You can also use variables
if you prefer more descriptive (and less-likely to get tromped by
yanking/pasting), so you could do
:let mod='/var/www/html/sites/all/modules/' " do this once
:e <C-R>=mod<CR>jq<tab>jq*theme.module
- if you have other files open in the same directory, you can use the
'autochdir' setting to enter that directory which would make it as
simple as going into a sibling file's window/buffer and then
issuing
:e jq*theme.module
or some such command because you don't need to enter the path
I'm sure there are other snippets/plugins that would make this easy
as well, but the above have sufficed for me when I've had such a need.
-tim
--
--
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
---
You received this message because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
> Oftentimes I'm opening really long filenames in command mode, for
> example:
>
> :e /var/www/html/sites/all/modules/jqueryui_theme/jqueryui_theme.module
>
> Is there a way to create aliases for this file? Or if not the whole
> file, how about part of the path, like everything up to and
> including "modules"? That's a lot of typing!
A couple ideas in addition to Jürgen's good suggestions:
- you can use tab-completion, so you could type
:e /v<tab>/www/h<tab>/si<tab>/all/m<tab>/jq<tab>
or something like that
- You can store the things you want in a variable/register and then
recall them on the command-line using control+R to insert them:
:let @m='/var/www/html/sites/all/modules/' " do this once
:e <C-R>mjq<tab>jq*theme.module
where the "<C-R>m" inserts the contents of the register "m" in
which you stored the path you want. You can even set up multiple
registers if you have multiple paths. You can also use variables
if you prefer more descriptive (and less-likely to get tromped by
yanking/pasting), so you could do
:let mod='/var/www/html/sites/all/modules/' " do this once
:e <C-R>=mod<CR>jq<tab>jq*theme.module
- if you have other files open in the same directory, you can use the
'autochdir' setting to enter that directory which would make it as
simple as going into a sibling file's window/buffer and then
issuing
:e jq*theme.module
or some such command because you don't need to enter the path
I'm sure there are other snippets/plugins that would make this easy
as well, but the above have sufficed for me when I've had such a need.
-tim
--
--
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
---
You received this message because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Re: shortcuts for long filenames
Hi,
DwigtArmyOfChampions schrieb am 23.10.2014 um 14:58:
> Oftentimes I'm opening really long filenames in command mode, for
> example:
>
> :e> /var/www/html/sites/all/modules/jqueryui_theme/jqueryui_theme.module
>
> Is there a way to create aliases for this file? Or if not the whole
> file, how about part of the path, like everything up to and including
> "modules"? That's a lot of typing!
you can define a simple command line abbreviation
cnoreabbrev mods /var/www/html/sites/all/modules/
But that would trigger every time you write the word "mods" on the
command line.
A better version of this abbreviation is
cnoreabbrev <expr> mods getcmdtype() == ":" && getcmdline() =~ '\smods$' ? '/var/www/html/sites/all/modules/' : 'mods'
This abbreviation checks that you are in colon mode (and not at the
search prompt) and makes sure 'mods' was at least separated from other
text by a whitespace character. That way you prevent 'mods' from being
expanded if it part of a file path or file name.
If you want a different name for the abbreviation make sure to replace
'mods' in all three places.
Regards,
Jürgen
--
Sometimes I think the surest sign that intelligent life exists elsewhere
in the universe is that none of it has tried to contact us. (Calvin)
--
--
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
---
You received this message because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
DwigtArmyOfChampions schrieb am 23.10.2014 um 14:58:
> Oftentimes I'm opening really long filenames in command mode, for
> example:
>
> :e> /var/www/html/sites/all/modules/jqueryui_theme/jqueryui_theme.module
>
> Is there a way to create aliases for this file? Or if not the whole
> file, how about part of the path, like everything up to and including
> "modules"? That's a lot of typing!
you can define a simple command line abbreviation
cnoreabbrev mods /var/www/html/sites/all/modules/
But that would trigger every time you write the word "mods" on the
command line.
A better version of this abbreviation is
cnoreabbrev <expr> mods getcmdtype() == ":" && getcmdline() =~ '\smods$' ? '/var/www/html/sites/all/modules/' : 'mods'
This abbreviation checks that you are in colon mode (and not at the
search prompt) and makes sure 'mods' was at least separated from other
text by a whitespace character. That way you prevent 'mods' from being
expanded if it part of a file path or file name.
If you want a different name for the abbreviation make sure to replace
'mods' in all three places.
Regards,
Jürgen
--
Sometimes I think the surest sign that intelligent life exists elsewhere
in the universe is that none of it has tried to contact us. (Calvin)
--
--
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
---
You received this message because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
shortcuts for long filenames
Oftentimes I'm opening really long filenames in command mode, for example:
:e /var/www/html/sites/all/modules/jqueryui_theme/jqueryui_theme.module
Is there a way to create aliases for this file? Or if not the whole file, how about part of the path, like everything up to and including "modules"? That's a lot of typing!
--
--
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
---
You received this message because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
:e /var/www/html/sites/all/modules/jqueryui_theme/jqueryui_theme.module
Is there a way to create aliases for this file? Or if not the whole file, how about part of the path, like everything up to and including "modules"? That's a lot of typing!
--
--
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
---
You received this message because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Subscribe to:
Posts (Atom)