Mercurial > vim
comparison runtime/doc/tips.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 | babd9f1dbe12 |
children | f8116058ca76 |
comparison
equal
deleted
inserted
replaced
27902:8481c8908b5e | 27903:d19b7aee1925 |
---|---|
99 use the macros). | 99 use the macros). |
100 - An identifier database file called "ID" in the current directory. You can | 100 - An identifier database file called "ID" in the current directory. You can |
101 create it with the shell command "mkid file1 file2 ..". | 101 create it with the shell command "mkid file1 file2 ..". |
102 | 102 |
103 Put this in your .vimrc: > | 103 Put this in your .vimrc: > |
104 map _u :call ID_search()<Bar>execute "/\\<" . g:word . "\\>"<CR> | 104 map _u :call ID_search()<Bar>execute "/\\<" .. g:word .. "\\>"<CR> |
105 map _n :n<Bar>execute "/\\<" . g:word . "\\>"<CR> | 105 map _n :n<Bar>execute "/\\<" .. g:word .. "\\>"<CR> |
106 | 106 |
107 function! ID_search() | 107 function! ID_search() |
108 let g:word = expand("<cword>") | 108 let g:word = expand("<cword>") |
109 let x = system("lid --key=none ". g:word) | 109 let x = system("lid --key=none " .. g:word) |
110 let x = substitute(x, "\n", " ", "g") | 110 let x = substitute(x, "\n", " ", "g") |
111 execute "next " . x | 111 execute "next " .. x |
112 endfun | 112 endfun |
113 | 113 |
114 To use it, place the cursor on a word, type "_u" and vim will load the file | 114 To use it, place the cursor on a word, type "_u" and vim will load the file |
115 that contains the word. Search for the next occurrence of the word in the | 115 that contains the word. Search for the next occurrence of the word in the |
116 same file with "n". Go to the next file with "_n". | 116 same file with "n". Go to the next file with "_n". |
354 *format-bullet-list* | 354 *format-bullet-list* |
355 This mapping will format any bullet list. It requires that there is an empty | 355 This mapping will format any bullet list. It requires that there is an empty |
356 line above and below each list entry. The expression commands are used to | 356 line above and below each list entry. The expression commands are used to |
357 be able to give comments to the parts of the mapping. > | 357 be able to give comments to the parts of the mapping. > |
358 | 358 |
359 :let m = ":map _f :set ai<CR>" " need 'autoindent' set | 359 :let m = ":map _f :set ai<CR>" " need 'autoindent' set |
360 :let m = m . "{O<Esc>" " add empty line above item | 360 :let m ..= "{O<Esc>" " add empty line above item |
361 :let m = m . "}{)^W" " move to text after bullet | 361 :let m ..= "}{)^W" " move to text after bullet |
362 :let m = m . "i <CR> <Esc>" " add space for indent | 362 :let m ..= "i <CR> <Esc>" " add space for indent |
363 :let m = m . "gq}" " format text after the bullet | 363 :let m ..= "gq}" " format text after the bullet |
364 :let m = m . "{dd" " remove the empty line | 364 :let m ..= "{dd" " remove the empty line |
365 :let m = m . "5lDJ" " put text after bullet | 365 :let m ..= "5lDJ" " put text after bullet |
366 :execute m |" define the mapping | 366 :execute m |" define the mapping |
367 | 367 |
368 (<> notation |<>|. Note that this is all typed literally. ^W is "^" "W", not | 368 (<> notation |<>|. Note that this is all typed literally. ^W is "^" "W", not |
369 CTRL-W. You can copy/paste this into Vim if '<' is not included in | 369 CTRL-W. You can copy/paste this into Vim if '<' is not included in |
370 'cpoptions'.) | 370 'cpoptions'.) |
512 endif | 512 endif |
513 if c == '[' | 513 if c == '[' |
514 let c = '\[' | 514 let c = '\[' |
515 let c2 = '\]' | 515 let c2 = '\]' |
516 endif | 516 endif |
517 let s_skip ='synIDattr(synID(line("."), col("."), 0), "name") ' . | 517 let s_skip ='synIDattr(synID(line("."), col("."), 0), "name") ' .. |
518 \ '=~? "string\\|comment"' | 518 \ '=~? "string\\|comment"' |
519 execute 'if' s_skip '| let s_skip = 0 | endif' | 519 execute 'if' s_skip '| let s_skip = 0 | endif' |
520 | 520 |
521 let [m_lnum, m_col] = searchpairpos(c, '', c2, s_flags, s_skip) | 521 let [m_lnum, m_col] = searchpairpos(c, '', c2, s_flags, s_skip) |
522 | 522 |
523 if m_lnum > 0 && m_lnum >= line('w0') && m_lnum <= line('w$') | 523 if m_lnum > 0 && m_lnum >= line('w0') && m_lnum <= line('w$') |
524 exe 'match Search /\(\%' . c_lnum . 'l\%' . c_col . | 524 exe 'match Search /\(\%' .. c_lnum .. 'l\%' .. c_col .. |
525 \ 'c\)\|\(\%' . m_lnum . 'l\%' . m_col . 'c\)/' | 525 \ 'c\)\|\(\%' .. m_lnum .. 'l\%' .. m_col .. 'c\)/' |
526 let s:paren_hl_on = 1 | 526 let s:paren_hl_on = 1 |
527 endif | 527 endif |
528 endfunction | 528 endfunction |
529 | 529 |
530 autocmd CursorMoved,CursorMovedI * call s:Highlight_Matching_Paren() | 530 autocmd CursorMoved,CursorMovedI * call s:Highlight_Matching_Paren() |