m (Exhance Ctrl-^: when there is no alternate file, go to next file, otherwise act as notmal Ctrl-^ moved to Go to alternate file or next file if no alternate: Page moved by JohnBot to improve title) |
(Adjust previous/next navigation) |
||
(4 intermediate revisions by the same user not shown) | |||
Line 1: | Line 1: | ||
{{review}} |
{{review}} |
||
+ | {{TipImported |
||
− | {{Tip |
||
|id=1023 |
|id=1023 |
||
+ | |previous=1021 |
||
− | |title=exhance Ctrl-^: when there is no alternate file, go to next file, otherwise act as notmal Ctrl-^ |
||
+ | |next=1025 |
||
− | |created=October 23, 2005 |
+ | |created=October 23, 2005 |
|complexity=intermediate |
|complexity=intermediate |
||
|author=Yakov Lerner |
|author=Yakov Lerner |
||
|version=6.0 |
|version=6.0 |
||
|rating=2/2 |
|rating=2/2 |
||
+ | |category1= |
||
− | |text= |
||
+ | |category2= |
||
⚫ | |||
− | |||
⚫ | |||
− | |||
⚫ | |||
− | |||
⚫ | |||
− | |||
⚫ | |||
− | |||
⚫ | |||
− | |||
− | |||
− | |||
⚫ | |||
− | |||
⚫ | |||
− | |||
⚫ | |||
− | |||
− | else |
||
− | |||
⚫ | |||
− | |||
− | endif |
||
− | |||
⚫ | |||
− | |||
⚫ | |||
− | |||
− | " }}} my remapping of <C-^>. |
||
− | |||
− | |||
}} |
}} |
||
+ | <pre> |
||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
+ | else |
||
⚫ | |||
+ | endif |
||
⚫ | |||
⚫ | |||
+ | </pre> |
||
− | == |
+ | ==Comments== |
− | Fix: replace 'next' with 'silent! next' to suppress error message when there is only 1 file. |
||
− | |||
− | Change this line: |
||
− | if expand('#')=="" | : next |
||
− | to this: |
||
− | if expand('#')=="" | silent! next |
||
− | |||
− | Yakov Lerner |
||
− | |||
− | |||
− | jilerner--AT--yahoo.com |
||
− | , October 24, 2005 4:14 |
||
− | ---- |
||
− | <!-- parsed by vimtips.py in 0.519795 seconds--> |
Latest revision as of 10:16, 12 April 2009
Tip 1023 Printable Monobook Previous Next
created October 23, 2005 · complexity intermediate · author Yakov Lerner · version 6.0
" Ctrl-^ is very handy command in normal mode. Ctrl-^ " switches to "alternate file". When there is no "alternate file", " I wanted Ctrl-^ to jump to next file in the list. " Insert following commands into your vimrc, then " Ctrl-^ will be enhanced so that when there is no alternate file " but there is next file, it will jump to the next file. " My remapping of <C-^>. If there is no alternate file, then switch to next file. function! MySwitch() if expand('#')=="" | silent! next else exe "normal! \<c-^>" endif endfu map <C-^> :call MySwitch()<CR>