comparison runtime/doc/windows.txt @ 27903:d19b7aee1925

Update runtime files. Commit: https://github.com/vim/vim/commit/c51cf0329809c7ae946c59d6f56699227efc9d1b Author: Bram Moolenaar <Bram@vim.org> Date: Sat Feb 26 12:25:45 2022 +0000 Update runtime files.
author Bram Moolenaar <Bram@vim.org>
date Sat, 26 Feb 2022 13:30:04 +0100
parents 063952f68595
children 6dd88e45d47d
comparison
equal deleted inserted replaced
27902:8481c8908b5e 27903:d19b7aee1925
471 < Moves to the window below the current one. 471 < Moves to the window below the current one.
472 This command is useful when a Normal mode cannot be used (for 472 This command is useful when a Normal mode cannot be used (for
473 the |CursorHold| autocommand event). Or when a Normal mode 473 the |CursorHold| autocommand event). Or when a Normal mode
474 command is inconvenient. 474 command is inconvenient.
475 The count can also be a window number. Example: > 475 The count can also be a window number. Example: >
476 :exe nr . "wincmd w" 476 :exe nr .. "wincmd w"
477 < This goes to window "nr". 477 < This goes to window "nr".
478 478
479 ============================================================================== 479 ==============================================================================
480 5. Moving windows around *window-moving* 480 5. Moving windows around *window-moving*
481 481
962 < Like with the |:ptag| command, you can use this to 962 < Like with the |:ptag| command, you can use this to
963 automatically show information about the word under the 963 automatically show information about the word under the
964 cursor. This is less clever than using |:ptag|, but you don't 964 cursor. This is less clever than using |:ptag|, but you don't
965 need a tags file and it will also find matches in system 965 need a tags file and it will also find matches in system
966 include files. Example: > 966 include files. Example: >
967 :au! CursorHold *.[ch] ++nested exe "silent! psearch " . expand("<cword>") 967 :au! CursorHold *.[ch] ++nested exe "silent! psearch " .. expand("<cword>")
968 < Warning: This can be slow. 968 < Warning: This can be slow.
969 969
970 Example *CursorHold-example* > 970 Example *CursorHold-example* >
971 971
972 :au! CursorHold *.[ch] ++nested exe "silent! ptag " . expand("<cword>") 972 :au! CursorHold *.[ch] ++nested exe "silent! ptag " .. expand("<cword>")
973 973
974 This will cause a ":ptag" to be executed for the keyword under the cursor, 974 This will cause a ":ptag" to be executed for the keyword under the cursor,
975 when the cursor hasn't moved for the time set with 'updatetime'. The "nested" 975 when the cursor hasn't moved for the time set with 'updatetime'. The "nested"
976 makes other autocommands be executed, so that syntax highlighting works in the 976 makes other autocommands be executed, so that syntax highlighting works in the
977 preview window. The "silent!" avoids an error message when the tag could not 977 preview window. The "silent!" avoids an error message when the tag could not
990 : let w = expand("<cword>") " get the word under cursor 990 : let w = expand("<cword>") " get the word under cursor
991 : if w =~ '\a' " if the word contains a letter 991 : if w =~ '\a' " if the word contains a letter
992 : 992 :
993 : " Delete any existing highlight before showing another tag 993 : " Delete any existing highlight before showing another tag
994 : silent! wincmd P " jump to preview window 994 : silent! wincmd P " jump to preview window
995 : if &previewwindow " if we really get there... 995 : if &previewwindow " if we really get there...
996 : match none " delete existing highlight 996 : match none " delete existing highlight
997 : wincmd p " back to old window 997 : wincmd p " back to old window
998 : endif 998 : endif
999 : 999 :
1000 : " Try displaying a matching tag for the word under the cursor 1000 : " Try displaying a matching tag for the word under the cursor
1001 : try 1001 : try
1002 : exe "ptag " . w 1002 : exe "ptag " .. w
1003 : catch 1003 : catch
1004 : return 1004 : return
1005 : endtry 1005 : endtry
1006 : 1006 :
1007 : silent! wincmd P " jump to preview window 1007 : silent! wincmd P " jump to preview window
1009 : if has("folding") 1009 : if has("folding")
1010 : silent! .foldopen " don't want a closed fold 1010 : silent! .foldopen " don't want a closed fold
1011 : endif 1011 : endif
1012 : call search("$", "b") " to end of previous line 1012 : call search("$", "b") " to end of previous line
1013 : let w = substitute(w, '\\', '\\\\', "") 1013 : let w = substitute(w, '\\', '\\\\', "")
1014 : call search('\<\V' . w . '\>') " position cursor on match 1014 : call search('\<\V' .. w .. '\>') " position cursor on match
1015 : " Add a match highlight to the word at this position 1015 : " Add a match highlight to the word at this position
1016 : hi previewWord term=bold ctermbg=green guibg=green 1016 : hi previewWord term=bold ctermbg=green guibg=green
1017 : exe 'match previewWord "\%' . line(".") . 'l\%' . col(".") . 'c\k*"' 1017 : exe 'match previewWord "\%' .. line(".") .. 'l\%' .. col(".") .. 'c\k*"'
1018 : wincmd p " back to old window 1018 : wincmd p " back to old window
1019 : endif 1019 : endif
1020 : endif 1020 : endif
1021 :endfun 1021 :endfun
1022 1022