Bram Moolenaar schrieb:
>
> Adek336 wrote:
>
>> Hi! When using TAB for filename completion sometimes you get a few
>> levels too deep like
>> :e /a/b/c/d/e/f-long-path-name-here/
>> so you have to use backspace to get back to
>> :e /a/b/c/d/e/
>>
>> and that is annoying.
>>
>> The patch below makes Ctrl-T remove the last pathname component by
>> removing chars up to the first found slash or space character. I chose
>> Ctrl-T very arbitraly, I don't know if this is a good choice.
>>
>> Is this feature acceptable?
> It can be useful, especially because CTRL-W deletes too much.
> Your patch should probably use 'isfname' and also stop at characters
> that are not included.
Isn't it desirable to put features in Vim scripts if possible? Here is
an improved version of the Ctrl-T mapping posted to vim_use:
cnoremap <C-T> <C-\>e(RemoveLastPathComponent())<cr>
func! RemoveLastPathComponent()
return substitute(getcmdline(), '\%(\\ \|[\\/[EMAIL
PROTECTED])\+[\\/]\=$\|.$', '', '')
endfunc
Description:
Ctrl-T removes the last path component. It uses 'isfname' and stops at
characters not included, except escaped spaces. At least one character
is always removed.
--
Andy
--~--~---------~--~----~------------~-------~--~----~
You received this message from the "vim_dev" maillist.
For more information, visit http://www.vim.org/maillist.php
-~----------~----~----~----~------~----~------~--~---