├── .gitignore ├── screenshots └── preview.png ├── plugin └── vim-tips-wiki.vim ├── doc ├── vim-tips-wiki-1442.txt ├── vim-tips-wiki-583.txt ├── vim-tips-wiki-753.txt ├── vim-tips-wiki-323.txt ├── vim-tips-wiki-567.txt ├── vim-tips-wiki-266.txt ├── vim-tips-wiki-23.txt ├── vim-tips-wiki-568.txt ├── vim-tips-wiki-725.txt ├── vim-tips-wiki-1053.txt ├── vim-tips-wiki-1153.txt ├── vim-tips-wiki-782.txt ├── vim-tips-wiki-164.txt ├── vim-tips-wiki-649.txt ├── vim-tips-wiki-1012.txt ├── vim-tips-wiki-569.txt ├── vim-tips-wiki-1084.txt ├── vim-tips-wiki-642.txt ├── vim-tips-wiki-673.txt ├── vim-tips-wiki-449.txt ├── vim-tips-wiki-15.txt ├── vim-tips-wiki-181.txt ├── vim-tips-wiki-313.txt ├── vim-tips-wiki-586.txt ├── vim-tips-wiki-1341.txt ├── vim-tips-wiki-1035.txt ├── vim-tips-wiki-662.txt ├── vim-tips-wiki-404.txt ├── vim-tips-wiki-286.txt ├── vim-tips-wiki-131.txt ├── vim-tips-wiki.txt ├── vim-tips-wiki-817.txt ├── vim-tips-wiki-347.txt ├── vim-tips-wiki-522.txt ├── vim-tips-wiki-999.txt ├── vim-tips-wiki-1245.txt ├── vim-tips-wiki-1031.txt ├── vim-tips-wiki-261.txt ├── vim-tips-wiki-502.txt ├── vim-tips-wiki-751.txt ├── vim-tips-wiki-834.txt ├── vim-tips-wiki-1617.txt ├── vim-tips-wiki-997.txt ├── vim-tips-wiki-643.txt ├── vim-tips-wiki-819.txt ├── vim-tips-wiki-34.txt ├── vim-tips-wiki-745.txt ├── vim-tips-wiki-1413.txt ├── vim-tips-wiki-875.txt ├── vim-tips-wiki-868.txt ├── vim-tips-wiki-137.txt ├── vim-tips-wiki-426.txt ├── vim-tips-wiki-457.txt ├── vim-tips-wiki-1388.txt ├── vim-tips-wiki-1483.txt ├── vim-tips-wiki-214.txt ├── vim-tips-wiki-50.txt ├── vim-tips-wiki-1584.txt ├── vim-tips-wiki-17.txt ├── vim-tips-wiki-919.txt ├── vim-tips-wiki-691.txt ├── vim-tips-wiki-749.txt ├── vim-tips-wiki-149.txt ├── vim-tips-wiki-1499.txt ├── vim-tips-wiki-852.txt ├── vim-tips-wiki-1620.txt ├── vim-tips-wiki-869.txt ├── vim-tips-wiki-477.txt ├── vim-tips-wiki-1023.txt ├── vim-tips-wiki-682.txt ├── vim-tips-wiki-876.txt ├── vim-tips-wiki-405.txt ├── vim-tips-wiki-328.txt ├── vim-tips-wiki-582.txt ├── vim-tips-wiki-1309.txt ├── vim-tips-wiki-1590.txt ├── vim-tips-wiki-864.txt ├── vim-tips-wiki-1321.txt ├── vim-tips-wiki-148.txt ├── vim-tips-wiki-1506.txt ├── vim-tips-wiki-156.txt ├── vim-tips-wiki-615.txt ├── vim-tips-wiki-168.txt ├── vim-tips-wiki-1103.txt ├── vim-tips-wiki-575.txt ├── vim-tips-wiki-631.txt ├── vim-tips-wiki-1010.txt ├── vim-tips-wiki-742.txt ├── vim-tips-wiki-1090.txt ├── vim-tips-wiki-650.txt ├── vim-tips-wiki-734.txt ├── vim-tips-wiki-498.txt ├── vim-tips-wiki-765.txt ├── vim-tips-wiki-1009.txt ├── vim-tips-wiki-1389.txt ├── vim-tips-wiki-652.txt ├── vim-tips-wiki-409.txt ├── vim-tips-wiki-399.txt ├── vim-tips-wiki-510.txt ├── vim-tips-wiki-559.txt ├── vim-tips-wiki-1359.txt ├── vim-tips-wiki-1490.txt ├── vim-tips-wiki-677.txt ├── vim-tips-wiki-489.txt ├── vim-tips-wiki-880.txt ├── vim-tips-wiki-1204.txt ├── vim-tips-wiki-719.txt ├── vim-tips-wiki-106.txt ├── vim-tips-wiki-1302.txt ├── vim-tips-wiki-862.txt ├── vim-tips-wiki-900.txt ├── vim-tips-wiki-85.txt ├── vim-tips-wiki-87.txt ├── vim-tips-wiki-1603.txt ├── vim-tips-wiki-816.txt ├── vim-tips-wiki-897.txt ├── vim-tips-wiki-1286.txt ├── vim-tips-wiki-645.txt ├── vim-tips-wiki-104.txt ├── vim-tips-wiki-698.txt ├── vim-tips-wiki-230.txt ├── vim-tips-wiki-336.txt ├── vim-tips-wiki-889.txt ├── vim-tips-wiki-1455.txt ├── vim-tips-wiki-284.txt ├── vim-tips-wiki-712.txt ├── vim-tips-wiki-1609.txt ├── vim-tips-wiki-518.txt ├── vim-tips-wiki-737.txt ├── vim-tips-wiki-577.txt ├── vim-tips-wiki-1563.txt ├── vim-tips-wiki-570.txt ├── vim-tips-wiki-262.txt ├── vim-tips-wiki-846.txt ├── vim-tips-wiki-1589.txt ├── vim-tips-wiki-387.txt ├── vim-tips-wiki-905.txt ├── vim-tips-wiki-1042.txt ├── vim-tips-wiki-1259.txt ├── vim-tips-wiki-1262.txt ├── vim-tips-wiki-363.txt ├── vim-tips-wiki-1001.txt ├── vim-tips-wiki-1326.txt ├── vim-tips-wiki-1050.txt ├── vim-tips-wiki-1332.txt ├── vim-tips-wiki-539.txt ├── vim-tips-wiki-1028.txt ├── vim-tips-wiki-1472.txt ├── vim-tips-wiki-446.txt ├── vim-tips-wiki-1112.txt ├── vim-tips-wiki-1297.txt ├── vim-tips-wiki-301.txt ├── vim-tips-wiki-859.txt └── vim-tips-wiki-1294.txt ├── Cargo.toml └── README.md /.gitignore: -------------------------------------------------------------------------------- 1 | /target 2 | /originals 3 | -------------------------------------------------------------------------------- /screenshots/preview.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DanilaMihailov/vim-tips-wiki/HEAD/screenshots/preview.png -------------------------------------------------------------------------------- /plugin/vim-tips-wiki.vim: -------------------------------------------------------------------------------- 1 | function OpenRandomWikiTip() 2 | let n = system('/bin/bash -c "echo $RANDOM % 1678 + 1 | bc"') 3 | execute "help vtw-".n 4 | endfunction 5 | 6 | command! RandomVimTip call OpenRandomWikiTip() 7 | -------------------------------------------------------------------------------- /doc/vim-tips-wiki-1442.txt: -------------------------------------------------------------------------------- 1 | *vim-tips-wiki-1442.txt* VimTip1442 *vtw-1442* 2 | 3 | 4 | 5 | Why not delete this 6 | 7 | CATEGORIES *vtw-1442-cats* 8 | 9 | 10 | 11 | vim:tw=78:et:ft=help:norl: -------------------------------------------------------------------------------- /doc/vim-tips-wiki-583.txt: -------------------------------------------------------------------------------- 1 | *vim-tips-wiki-583.txt* Vim as XML Editor *vtw-583* 2 | 3 | 4 | 5 | created 2003 · complexity intermediate · author Tobi · version 6.0 6 | 7 | ============================================================================== 8 | 9 | CATEGORIES *vtw-583-cats* 10 | 11 | XML |vtw-by-category-xml| 12 | 13 | 14 | vim:tw=78:et:ft=help:norl: -------------------------------------------------------------------------------- /Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "vim-tips-wiki" 3 | version = "0.1.0" 4 | authors = ["Danila Mihailov "] 5 | edition = "2018" 6 | 7 | # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html 8 | 9 | [dependencies] 10 | select = "0.4.3" 11 | reqwest = { version = "0.10" } 12 | tokio = { version = "0.2", features = ["full"] } 13 | regex = "1" 14 | urlencoding = "1.0.0" 15 | rayon = "1.1" 16 | crossbeam = "0.7.3" 17 | -------------------------------------------------------------------------------- /doc/vim-tips-wiki-753.txt: -------------------------------------------------------------------------------- 1 | *vim-tips-wiki-753.txt* Make File-Open track directory of current file *vtw-753* 2 | 3 | Tip 753 [https://vim.fandom.com/wiki/Make_File-Open_track_directory_of_current_file] Previous |vtw-752| Next |vtw-754| 4 | 5 | created June 21, 2004 · complexity basic · author Rob Allen · version 6.0 6 | 7 | ============================================================================== 8 | 9 | To get the File, Open dialog box to default to the current file's directory 10 | add: 11 | 12 | > 13 | set browsedir=buffer 14 | < 15 | 16 | to your vimrc file. 17 | 18 | COMMENTS *vtw-753-comments* 19 | 20 | CATEGORIES *vtw-753-cats* 21 | 22 | File Handling |vtw-by-category-file-handling| 23 | 24 | 25 | vim:tw=78:et:ft=help:norl: -------------------------------------------------------------------------------- /doc/vim-tips-wiki-323.txt: -------------------------------------------------------------------------------- 1 | *vim-tips-wiki-323.txt* Using folders with latex *vtw-323* 2 | 3 | Tip 323 [https://vim.fandom.com/wiki/Using_folders_with_latex] Previous |vtw-322| Next |vtw-325| 4 | 5 | created 2002 · complexity basic · author Raoul Jean Pierre Bonnal · version 6 | 6.0 7 | 8 | ============================================================================== 9 | 10 | > 11 | set foldmarker=\\begin,\\end 12 | set foldmethod=marker 13 | < 14 | 15 | This is useful with a big latex document. 16 | 17 | COMMENTS *vtw-323-comments* 18 | 19 | CATEGORIES *vtw-323-cats* 20 | 21 | Candidates for deletion |vtw-by-category-candidates-for-deletion| 22 | LaTeX |vtw-by-category-latex| 23 | 24 | 25 | vim:tw=78:et:ft=help:norl: -------------------------------------------------------------------------------- /doc/vim-tips-wiki-567.txt: -------------------------------------------------------------------------------- 1 | *vim-tips-wiki-567.txt* Edit a temporary copy of the current file *vtw-567* 2 | 3 | Tip 567 [https://vim.fandom.com/wiki/Edit_a_temporary_copy_of_the_current_file] Previous |vtw-566| Next |vtw-568| 4 | 5 | created 2003 · complexity basic · author mosh · version 6.0 6 | 7 | ============================================================================== 8 | 9 | Edit a copy of the current file as $TMP/file-$DATE by pressing `zs` using the 10 | following mapping. 11 | 12 | > 13 | :map zs :exe "sav $TMP/" . expand("%:t") . strftime("-%Y-%m-%d_%H%M%S") 14 | < 15 | 16 | COMMENTS *vtw-567-comments* 17 | 18 | CATEGORIES *vtw-567-cats* 19 | 20 | Review |vtw-by-category-review| 21 | 22 | 23 | vim:tw=78:et:ft=help:norl: -------------------------------------------------------------------------------- /doc/vim-tips-wiki-266.txt: -------------------------------------------------------------------------------- 1 | *vim-tips-wiki-266.txt* Command line switch to source a script *vtw-266* 2 | 3 | Tip 266 [https://vim.fandom.com/wiki/Command_line_switch_to_source_a_script] Previous |vtw-265| Next |vtw-267| 4 | 5 | created June 26, 2002 · complexity basic · author Max Ischenko · version 6.0 6 | 7 | ============================================================================== 8 | 9 | Use the -S option to start Vim and source a script file: 10 | 11 | > 12 | gvim -S foobar.vim 13 | < 14 | 15 | This tip is trivial, but I see the following too often. Time to update your 16 | mind! 17 | 18 | > 19 | gvim -c ":so foobar.vim" 20 | < 21 | 22 | COMMENTS *vtw-266-comments* 23 | 24 | CATEGORIES *vtw-266-cats* 25 | 26 | Review |vtw-by-category-review| 27 | 28 | 29 | vim:tw=78:et:ft=help:norl: -------------------------------------------------------------------------------- /doc/vim-tips-wiki-23.txt: -------------------------------------------------------------------------------- 1 | *vim-tips-wiki-23.txt* Vim xterm title *vtw-23* 2 | 3 | Tip 23 [https://vim.fandom.com/wiki/Vim_xterm_title] Previous |vtw-22| Next |vtw-24| 4 | 5 | created March 1, 2001 · complexity basic · author stone · version 5.7 6 | 7 | ============================================================================== 8 | 9 | To make your xterm inherit the title from Vim. e.g. 'Vim - ~/.vimrc' put this 10 | in your vimrc: 11 | 12 | > 13 | :set title 14 | < 15 | 16 | REFERENCES *vtw-23-references* 17 | - :help 'title' 18 | - :help 'titlestring' 19 | 20 | 21 | COMMENTS *vtw-23-comments* 22 | 23 | CATEGORIES *vtw-23-cats* 24 | 25 | Options |vtw-by-category-options| 26 | Terminals |vtw-by-category-terminals| 27 | 28 | 29 | vim:tw=78:et:ft=help:norl: -------------------------------------------------------------------------------- /doc/vim-tips-wiki-568.txt: -------------------------------------------------------------------------------- 1 | *vim-tips-wiki-568.txt* Use temporary tags file when browsing new source *vtw-568* 2 | 3 | Tip 568 [https://vim.fandom.com/wiki/Use_temporary_tags_file_when_browsing_new_source] Previous |vtw-567| Next |vtw-569| 4 | 5 | created September 30, 2003 · complexity basic · author mosh · version 6.0 6 | 7 | ============================================================================== 8 | 9 | Create and use $TMP/tags for local source dir (which may be unwriteable). 10 | Unix users can change c:/tmp to ~/tmp/ (I use $TMP with sh). 11 | 12 | > 13 | :map t :!(cd %:p:h;ctags -o c:/tmp/tags -R .)&:set tags^=c:/tmp/tags 14 | < 15 | 16 | COMMENTS *vtw-568-comments* 17 | 18 | CATEGORIES *vtw-568-cats* 19 | 20 | Review |vtw-by-category-review| 21 | Navigation |vtw-by-category-navigation| 22 | 23 | 24 | vim:tw=78:et:ft=help:norl: -------------------------------------------------------------------------------- /doc/vim-tips-wiki-725.txt: -------------------------------------------------------------------------------- 1 | *vim-tips-wiki-725.txt* Quick mapping for backing up the file *vtw-725* 2 | 3 | Tip 725 [https://vim.fandom.com/wiki/Quick_mapping_for_backing_up_the_file] Previous |vtw-719| Next |vtw-727| 4 | 5 | created 2004 · complexity basic · author Devin Weaver · version 6.0 6 | 7 | ============================================================================== 8 | 9 | Add this simple mapping into your vimrc to make a quick way to backup your 10 | document by typing `\b` in normal mode. 11 | 12 | > 13 | " For safe measures lets make a quick backup mapping. 14 | nnoremap b :let x=&backupset backupwritelet &backup=xunlet x 15 | < 16 | 17 | COMMENTS *vtw-725-comments* 18 | 19 | CATEGORIES *vtw-725-cats* 20 | 21 | File Handling |vtw-by-category-file-handling| 22 | 23 | 24 | vim:tw=78:et:ft=help:norl: -------------------------------------------------------------------------------- /doc/vim-tips-wiki-1053.txt: -------------------------------------------------------------------------------- 1 | *vim-tips-wiki-1053.txt* Lookup word in dict *vtw-1053* 2 | 3 | Tip 1053 [https://vim.fandom.com/wiki/Lookup_word_in_dict] Previous |vtw-1052| Next |vtw-1054| 4 | 5 | created November 20, 2005 · complexity basic · author Jan Christoph Ebersbach 6 | · version 6.0 7 | 8 | ============================================================================== 9 | 10 | Put this in your vimrc to lookup the inner or selected word in dict. Please 11 | adjust latin1 to your encoding. 12 | 13 | > 14 | nnoremap ,l mayiw`a:exe "!dict -P - $(echo " . @" . "\| recode latin1..utf-8)" 15 | vnoremap ,l may`a:exe "!dict -P - $(echo " . @" . "\| recode latin1..utf-8)" 16 | < 17 | 18 | COMMENTS *vtw-1053-comments* 19 | 20 | CATEGORIES *vtw-1053-cats* 21 | 22 | Review |vtw-by-category-review| 23 | 24 | 25 | vim:tw=78:et:ft=help:norl: -------------------------------------------------------------------------------- /doc/vim-tips-wiki-1153.txt: -------------------------------------------------------------------------------- 1 | *vim-tips-wiki-1153.txt* Apply range to any command that does not accept ranges *vtw-1153* 2 | 3 | Tip 1153 [https://vim.fandom.com/wiki/Apply_range_to_any_command_that_does_not_accept_ranges] Previous |vtw-1151| Next |vtw-1154| 4 | 5 | created 2006 · complexity basic · author Yakov Lerner · version 6.0 6 | 7 | ============================================================================== 8 | 9 | Some commands do not accept ranges, but you want to execute them for every 10 | line in the range. 11 | 12 | This trick allows to apply the range to any command that does not accept 13 | range directly: 14 | 15 | > 16 | :n1,n2 g/^/ command 17 | < 18 | 19 | That is, you add `g/^/` between the range and the command. 20 | 21 | COMMENTS *vtw-1153-comments* 22 | 23 | CATEGORIES *vtw-1153-cats* 24 | 25 | Review |vtw-by-category-review| 26 | 27 | 28 | vim:tw=78:et:ft=help:norl: -------------------------------------------------------------------------------- /doc/vim-tips-wiki-782.txt: -------------------------------------------------------------------------------- 1 | *vim-tips-wiki-782.txt* Jump to definition of entity under cursor *vtw-782* 2 | 3 | Tip 782 [https://vim.fandom.com/wiki/Jump_to_definition_of_entity_under_cursor] Previous |vtw-781| Next |vtw-784| 4 | 5 | created 2004 · complexity basic · author Aron Stansvik · version 5.7 6 | 7 | ============================================================================== 8 | 9 | This is what I use when reading/editing DTDs that make use of entities 10 | heavily: 11 | 12 | > 13 | :map e yiw ?" 14 | < 15 | 16 | That will map e to search backwards for the definition of the entity 17 | under the cursor, then you can just CTRL-o back to where you were. Makes 18 | reading DTDs less painful. 19 | 20 | COMMENTS *vtw-782-comments* 21 | 22 | CATEGORIES *vtw-782-cats* 23 | 24 | Review |vtw-by-category-review| 25 | 26 | 27 | vim:tw=78:et:ft=help:norl: -------------------------------------------------------------------------------- /doc/vim-tips-wiki-164.txt: -------------------------------------------------------------------------------- 1 | *vim-tips-wiki-164.txt* Make non-ASCII characters displayed on console *vtw-164* 2 | 3 | Tip 164 [https://vim.fandom.com/wiki/Make_non-ASCII_characters_displayed_on_console] Previous |vtw-159| Next |vtw-165| 4 | 5 | created November 14, 2001 · complexity basic · author Gerhard Häring · 6 | version 5.7 7 | 8 | ============================================================================== 9 | 10 | I had a problem with VIM on the FreeBSD console: it didn't display characters 11 | like German umlauts correctly, but escaped them with a tilde. The solution is 12 | to teach VIM about printable characters. I use the following on my vimrc 13 | [https://vim.fandom.com/wiki/Vimrc]: 14 | 15 | > 16 | set isprint=@,128-255 17 | < 18 | 19 | COMMENTS *vtw-164-comments* 20 | 21 | CATEGORIES *vtw-164-cats* 22 | 23 | Review |vtw-by-category-review| 24 | 25 | 26 | vim:tw=78:et:ft=help:norl: -------------------------------------------------------------------------------- /doc/vim-tips-wiki-649.txt: -------------------------------------------------------------------------------- 1 | *vim-tips-wiki-649.txt* Expand existing abbreviation *vtw-649* 2 | 3 | Tip 649 [https://vim.fandom.com/wiki/Expand_existing_abbreviation] Previous |vtw-648| Next |vtw-650| 4 | 5 | created February 4, 2004 · complexity basic · author Yakov Lerner · version 6 | 6.0 7 | 8 | ============================================================================== 9 | 10 | This mapping expands an existing abbreviation: 11 | 12 | > 13 | map diw:exe "normal i".@" 14 | < 15 | 16 | COMMENTS *vtw-649-comments* 17 | 18 | That won't work if the abbreviation is the last word on the line. Try: 19 | 20 | > 21 | :nno ciw@"_s"b 22 | < 23 | 24 | ============================================================================== 25 | 26 | CATEGORIES *vtw-649-cats* 27 | 28 | Review |vtw-by-category-review| 29 | 30 | 31 | vim:tw=78:et:ft=help:norl: -------------------------------------------------------------------------------- /doc/vim-tips-wiki-1012.txt: -------------------------------------------------------------------------------- 1 | *vim-tips-wiki-1012.txt* Quoted Printable to Plain *vtw-1012* 2 | 3 | Tip 1012 [https://vim.fandom.com/wiki/Quoted_Printable_to_Plain] Previous |vtw-1010| Next |vtw-1014| 4 | 5 | created 2005 · complexity intermediate · author Bertram Scharpf · version 6.0 6 | 7 | ============================================================================== 8 | 9 | Sometimes I pipe an email into Vim and then I cannot read it because it is 10 | encoded in quoted printable. Mentioning this in my vimrc helps: 11 | 12 | > 13 | nnoremap Q :%s/=\(\x\x\\n\)/\=submatch(1)=='\n'?'':nr2char('0x'.submatch(1))/ge 14 | vnoremap Q :s/=\(\x\x\\n\)/\=submatch(1)=='\n'?'':nr2char('0x'.submatch(1))/ge 15 | < 16 | 17 | COMMENTS *vtw-1012-comments* 18 | 19 | CATEGORIES *vtw-1012-cats* 20 | 21 | Email |vtw-by-category-email| 22 | 23 | 24 | vim:tw=78:et:ft=help:norl: -------------------------------------------------------------------------------- /doc/vim-tips-wiki-569.txt: -------------------------------------------------------------------------------- 1 | *vim-tips-wiki-569.txt* Insert line numbers with a Perl filter *vtw-569* 2 | 3 | Tip 569 [https://vim.fandom.com/wiki/Insert_line_numbers_with_a_Perl_filter] Previous |vtw-568| Next |vtw-570| 4 | 5 | created September 30, 2003 · complexity basic · author mosh · version 6.0 6 | 7 | ============================================================================== 8 | 9 | > 10 | " Create a menu item to call Perl on the file. 11 | " Edit the -e "script" before pressing return to filter thru Perl. 12 | " Script below works shell=sh, and add line numbers to the file. 13 | :amenu Mo1.Format.NumberLines:!perl :1,$!perl -ne \"printf(\\"\%3d:\%s\\",\$.,\$_);\" 14 | < 15 | 16 | See Insert line numbers |vtw-65| for other methods. 17 | 18 | COMMENTS *vtw-569-comments* 19 | 20 | CATEGORIES *vtw-569-cats* 21 | 22 | Review |vtw-by-category-review| 23 | 24 | 25 | vim:tw=78:et:ft=help:norl: -------------------------------------------------------------------------------- /doc/vim-tips-wiki-1084.txt: -------------------------------------------------------------------------------- 1 | *vim-tips-wiki-1084.txt* Setting Clearcase View as the title of the gvim window *vtw-1084* 2 | 3 | Tip 1084 [https://vim.fandom.com/wiki/Setting_Clearcase_View_as_the_title_of_the_gvim_window] Previous |vtw-1077| Next |vtw-1087| 4 | 5 | created December 24, 2005 · complexity basic · author Shankar R · version 6.0 6 | 7 | ============================================================================== 8 | 9 | When working in ClearCase, it would be very useful to set the title of the 10 | window to the view from which we are opening gvim. 11 | 12 | This is very helpful for developers with more than one view and one project 13 | open at the same time. 14 | 15 | > 16 | :set title 17 | :let &titlestring = $CLEARCASE_ROOT 18 | < 19 | 20 | COMMENTS *vtw-1084-comments* 21 | 22 | CATEGORIES *vtw-1084-cats* 23 | 24 | VersionControl |vtw-by-category-versioncontrol| 25 | 26 | 27 | vim:tw=78:et:ft=help:norl: -------------------------------------------------------------------------------- /doc/vim-tips-wiki-642.txt: -------------------------------------------------------------------------------- 1 | *vim-tips-wiki-642.txt* Use K to easily run a Windows program for the current word *vtw-642* 2 | 3 | Tip 642 [https://vim.fandom.com/wiki/Use_K_to_easily_run_a_Windows_program_for_the_current_word] Previous |vtw-641| Next |vtw-643| 4 | 5 | created January 21, 2004 · complexity basic · author David Risner · version 6 | 6.0 7 | 8 | ============================================================================== 9 | 10 | To get the K command to open a Windows program without creating a command 11 | prompt window that needs to be closed, you can do the following: 12 | 13 | In your vimrc add: 14 | 15 | > 16 | map K yiw:exec "silent !".&kp." ".@0 17 | < 18 | 19 | You can then set the keywordprg (abbreviated kp above) to the program you 20 | want to run. 21 | 22 | COMMENTS *vtw-642-comments* 23 | 24 | CATEGORIES *vtw-642-cats* 25 | 26 | Review |vtw-by-category-review| 27 | 28 | 29 | vim:tw=78:et:ft=help:norl: -------------------------------------------------------------------------------- /doc/vim-tips-wiki-673.txt: -------------------------------------------------------------------------------- 1 | *vim-tips-wiki-673.txt* Prompted quit in insert-mode *vtw-673* 2 | 3 | Tip 673 [https://vim.fandom.com/wiki/Prompted_quit_in_insert-mode] Previous |vtw-672| Next |vtw-675| 4 | 5 | created 2004 · complexity basic · author Yada · version 5.7 6 | 7 | ============================================================================== 8 | 9 | I find myself typing `:wq` in insert-mode many times. Add this to your vimrc. 10 | 11 | > 12 | function WQHelper() 13 | let x = confirm("Current Mode == Insert-Mode!\n Would you like ':wq'?"," &Yes \n &No",1,1) 14 | if x == 1 15 | silent! :wq 16 | else 17 | "??? 18 | endif 19 | endfunction 20 | " 21 | iab wq :call WQHelper() 22 | < 23 | 24 | COMMENTS *vtw-673-comments* 25 | 26 | what does it do? 27 | 28 | CATEGORIES *vtw-673-cats* 29 | 30 | Review |vtw-by-category-review| 31 | 32 | 33 | vim:tw=78:et:ft=help:norl: -------------------------------------------------------------------------------- /doc/vim-tips-wiki-449.txt: -------------------------------------------------------------------------------- 1 | *vim-tips-wiki-449.txt* Fortran highlighting problems *vtw-449* 2 | 3 | Tip 449 [https://vim.fandom.com/wiki/Fortran_highlighting_problems] Previous |vtw-446| Next |vtw-450| 4 | 5 | created 2003 · complexity basic · author Fabien Bouleau · version 6.0 6 | 7 | ============================================================================== 8 | 9 | Sometimes the Fortran syntax files do not set the correct source form which 10 | can cause issues with highlighting. In order to fix this issue a user may wish 11 | to set the source manually for the `.for` extension. This can be done by 12 | adding the following to the .vimrc file: 13 | 14 | > 15 | au BufRead,BufNewFile *.for let b:fortran_fixed_source=1 16 | < 17 | 18 | COMMENTS *vtw-449-comments* 19 | 20 | CATEGORIES *vtw-449-cats* 21 | 22 | LanguageSpecific |vtw-by-category-languagespecific| 23 | Syntax |vtw-by-category-syntax| 24 | 25 | 26 | vim:tw=78:et:ft=help:norl: -------------------------------------------------------------------------------- /doc/vim-tips-wiki-15.txt: -------------------------------------------------------------------------------- 1 | *vim-tips-wiki-15.txt* Displaying status line always *vtw-15* 2 | 3 | Tip 15 [https://vim.fandom.com/wiki/Displaying_status_line_always] Previous |vtw-14| Next |vtw-16| 4 | 5 | created February 24, 2001 · complexity basic · author Yegappan · version 5.7 6 | 7 | ============================================================================== 8 | 9 | To display the status line always, set the following option in your vimrc 10 | [https://vim.fandom.com/wiki/Vimrc]: 11 | 12 | > 13 | :set laststatus=2 14 | < 15 | 16 | The advantage of having the status line displayed always is, you can see the 17 | current mode, file name, file status, ruler, etc. 18 | 19 | REFERENCES *vtw-15-references* 20 | - :help 'laststatus' 21 | 22 | 23 | COMMENTS *vtw-15-comments* 24 | 25 | CATEGORIES *vtw-15-cats* 26 | 27 | Options |vtw-by-category-options| 28 | 29 | 30 | vim:tw=78:et:ft=help:norl: -------------------------------------------------------------------------------- /doc/vim-tips-wiki-181.txt: -------------------------------------------------------------------------------- 1 | *vim-tips-wiki-181.txt* Get the vim patched source *vtw-181* 2 | 3 | Tip 181 [https://vim.fandom.com/wiki/Get_the_vim_patched_source] Previous |vtw-180| Next |vtw-182| 4 | 5 | created December 14, 2001 · complexity basic · author benoit cerrina · 6 | version 6.0 7 | 8 | ============================================================================== 9 | 10 | There has been a number of person (including) asking in the Vim list how to 11 | keep up with Bram's incredible bug correction and patch writing skills, but 12 | there is a great way to do this! 13 | 14 | Use the cvs source which is available at 15 | http://sourceforge.net/cvs/?group_id=8 16 | [http://sourceforge.net/cvs/?group_id=8] it is kept up to date and its a lot 17 | easier than applying all the patch in order. 18 | 19 | COMMENTS *vtw-181-comments* 20 | 21 | CATEGORIES *vtw-181-cats* 22 | 23 | Review |vtw-by-category-review| 24 | 25 | 26 | vim:tw=78:et:ft=help:norl: -------------------------------------------------------------------------------- /doc/vim-tips-wiki-313.txt: -------------------------------------------------------------------------------- 1 | *vim-tips-wiki-313.txt* Printing using kprinter *vtw-313* 2 | 3 | Tip 313 [https://vim.fandom.com/wiki/Printing_using_kprinter] Previous |vtw-312| Next |vtw-315| 4 | 5 | created August 14, 2002 · complexity basic · author tom regner · version 6.0 6 | 7 | ============================================================================== 8 | 9 | Just add 10 | 11 | > 12 | set printexpr=system('kprinter'\ .\ '\ '\ .\ v:fname_in)\ .\ delete(v:fname_in)\ +\ v:shell_error 13 | < 14 | 15 | to your vimrc [https://vim.fandom.com/wiki/Vimrc]; further on all your 16 | printing will be piped through the nice and consistent print-dialog of kde. 17 | 18 | Gnome users can replace kprinter with gtklp 19 | 20 | COMMENTS *vtw-313-comments* 21 | 22 | CATEGORIES *vtw-313-cats* 23 | 24 | Review |vtw-by-category-review| 25 | Integration |vtw-by-category-integration| 26 | Options |vtw-by-category-options| 27 | 28 | 29 | vim:tw=78:et:ft=help:norl: -------------------------------------------------------------------------------- /doc/vim-tips-wiki-586.txt: -------------------------------------------------------------------------------- 1 | *vim-tips-wiki-586.txt* Smarter pasting *vtw-586* 2 | 3 | Tip 586 [https://vim.fandom.com/wiki/Smarter_pasting] Previous |vtw-584| Next |vtw-588| 4 | 5 | created 2003 · complexity basic · author Usman Latif · version 5.7 6 | 7 | ============================================================================== 8 | 9 | Using `:put "` pastes text from the default register below the current line. 10 | That is useful if some characters within a line have been copied, and you 11 | would like the copied text pasted as a separate line. 12 | 13 | Use the following mappings in your vimrc [https://vim.fandom.com/wiki/Vimrc] 14 | to make that easier. The first pastes after the current line, while the second 15 | pastes before the current line. 16 | 17 | > 18 | nnoremap ,p :put " 19 | nnoremap ,P :put! " 20 | < 21 | 22 | COMMENTS *vtw-586-comments* 23 | 24 | CATEGORIES *vtw-586-cats* 25 | 26 | 27 | 28 | vim:tw=78:et:ft=help:norl: -------------------------------------------------------------------------------- /doc/vim-tips-wiki-1341.txt: -------------------------------------------------------------------------------- 1 | *vim-tips-wiki-1341.txt* Power K *vtw-1341* 2 | 3 | Tip 1341 [https://vim.fandom.com/wiki/Power_K] Previous |vtw-1338| Next |vtw-1343| 4 | 5 | created 2006 · complexity basic · author gosman · version n/a 6 | 7 | ============================================================================== 8 | 9 | Press the `K` key in normal mode to see the man page for the word under the 10 | cursor. 11 | 12 | COMMENTS *vtw-1341-comments* 13 | 14 | You can view other chapters by typing the chapter number before you press 15 | `K`. 16 | 17 | ============================================================================== 18 | 19 | You can add "set keywordprg=man\ -a" to your vimrc to see all the manpages 20 | for a particular word when you press "K". 21 | 22 | ============================================================================== 23 | 24 | CATEGORIES *vtw-1341-cats* 25 | 26 | Review |vtw-by-category-review| 27 | 28 | 29 | vim:tw=78:et:ft=help:norl: -------------------------------------------------------------------------------- /doc/vim-tips-wiki-1035.txt: -------------------------------------------------------------------------------- 1 | *vim-tips-wiki-1035.txt* View NFO-files correctly *vtw-1035* 2 | 3 | Tip 1035 [https://vim.fandom.com/wiki/View_NFO-files_correctly] Previous |vtw-1033| Next |vtw-1036| 4 | 5 | created November 1, 2005 · complexity basic · version 7.0 6 | 7 | ============================================================================== 8 | 9 | Most .NFO files [http://en.wikipedia.org/wiki/.nfo] use the otherwise 10 | uncommon file encoding of cp437. To view them correctly in Vim, the encoding 11 | has to be specified. 12 | 13 | If you are already viewing the file, just type: 14 | 15 | > 16 | :e ++enc=cp437 17 | < 18 | 19 | That will reload the file forcing the encoding to cp437. 20 | 21 | If you want all NFO files to open this way, you can add the following line to 22 | your .vimrc 23 | 24 | > 25 | autocmd BufReadPre *.nfo :setlocal fileencodings=cp437,utf-8 26 | < 27 | 28 | COMMENTS *vtw-1035-comments* 29 | 30 | CATEGORIES *vtw-1035-cats* 31 | 32 | 33 | 34 | vim:tw=78:et:ft=help:norl: -------------------------------------------------------------------------------- /doc/vim-tips-wiki-662.txt: -------------------------------------------------------------------------------- 1 | *vim-tips-wiki-662.txt* Quote unquoted HTML attributes *vtw-662* 2 | 3 | Tip 662 [https://vim.fandom.com/wiki/Quote_unquoted_HTML_attributes] Previous |vtw-660| Next |vtw-667| 4 | 5 | created 2004 · complexity basic · author James Childers · version 6.0 6 | 7 | ============================================================================== 8 | 9 | This is a simple regex that can be used to search an HTML file and replace 10 | all unquoted attributes with their quoted version. 11 | 12 | > 13 | map  :%s/\([^&^?]\)\(\<[[:alnum:]-]\{-}\)=\([[:alnum:]-#%]\+\)/\1\2="\3"/g 14 | < 15 | 16 | COMMENTS *vtw-662-comments* 17 | 18 | I use this regex and abbreviate it to "reg1". 19 | 20 | > 21 | cabbrev reg1 %s/=\([^"][^> ]\{0,40\}\)/="\1"/gc 22 | < 23 | 24 | ============================================================================== 25 | 26 | CATEGORIES *vtw-662-cats* 27 | 28 | Review |vtw-by-category-review| 29 | HTML |vtw-by-category-html| 30 | 31 | 32 | vim:tw=78:et:ft=help:norl: -------------------------------------------------------------------------------- /doc/vim-tips-wiki-404.txt: -------------------------------------------------------------------------------- 1 | *vim-tips-wiki-404.txt* Tags for Mixed Assembly and C *vtw-404* 2 | 3 | Tip 404 [https://vim.fandom.com/wiki/Tags_for_Mixed_Assembly_and_C] Previous |vtw-402| Next |vtw-405| 4 | 5 | created 2003 · complexity basic · author Vasudev Nayak · version 5.7 6 | 7 | ============================================================================== 8 | 9 | While accessing C functions/variables from assembly (especially for those 10 | DSP/low level guys out there) the usual exuberant ctags doesn't work. 11 | 12 | The solution: 13 | 14 | COMMENTS *vtw-404-comments* 15 | 16 | What on earth does this accomplish? How does this get the assembly symbols in 17 | the tags files? Why doesn't it work out-of-the-box (what problem does this 18 | solve)? 19 | 20 | --Fritzophrenic [https://vim.fandom.com/wiki/User:Fritzophrenic] 15:31, May 21 | 3, 2011 (UTC) 22 | 23 | CATEGORIES *vtw-404-cats* 24 | 25 | Review |vtw-by-category-review| 26 | Navigation |vtw-by-category-navigation| 27 | 28 | 29 | vim:tw=78:et:ft=help:norl: -------------------------------------------------------------------------------- /doc/vim-tips-wiki-286.txt: -------------------------------------------------------------------------------- 1 | *vim-tips-wiki-286.txt* Recover overwritten file *vtw-286* 2 | 3 | Tip 286 [https://vim.fandom.com/wiki/Recover_overwritten_file] Previous |vtw-285| Next |vtw-288| 4 | 5 | created 2002 · complexity basic · author Little Dragon · version 5.7 6 | 7 | ============================================================================== 8 | 9 | I was once editing a file and wanted to test something. The test was meant to 10 | add a line at the end of the file, from outside Vim. All was fine, but instead 11 | of >> to append the output to the file, I wrote > to replace the file with the 12 | output by mistake. 13 | 14 | If you happen to do something like that, the solution is: 15 | 16 | > 17 | :recover 18 | < 19 | 20 | This command only works if you have a swap file. If you do not have a swap 21 | file, the recover command will not work. 22 | 23 | COMMENTS *vtw-286-comments* 24 | 25 | CATEGORIES *vtw-286-cats* 26 | 27 | File Handling |vtw-by-category-file-handling| 28 | 29 | 30 | vim:tw=78:et:ft=help:norl: -------------------------------------------------------------------------------- /doc/vim-tips-wiki-131.txt: -------------------------------------------------------------------------------- 1 | *vim-tips-wiki-131.txt* Scroll alternate window *vtw-131* 2 | 3 | Tip 131 [https://vim.fandom.com/wiki/Scroll_alternate_window] Previous |vtw-130| Next |vtw-132| 4 | 5 | created October 11, 2001 · complexity basic · author Max Ischenko · version 6 | 6.0 7 | 8 | ============================================================================== 9 | 10 | This mapping allow you to quickly scroll inactive window when displaying 11 | several windows concurrently. 12 | 13 | > 14 | nmap  :call ScrollOtherWindow("down") 15 | nmap  :call ScrollOtherWindow("up") 16 | 17 | fun! ScrollOtherWindow(dir) 18 | if a:dir == "down" 19 | let move = "\" 20 | elseif a:dir == "up" 21 | let move = "\" 22 | endif 23 | exec "normal \p" . move . "\p" 24 | endfun 25 | < 26 | 27 | COMMENTS *vtw-131-comments* 28 | 29 | CATEGORIES *vtw-131-cats* 30 | 31 | Review |vtw-by-category-review| 32 | 33 | 34 | vim:tw=78:et:ft=help:norl: -------------------------------------------------------------------------------- /doc/vim-tips-wiki.txt: -------------------------------------------------------------------------------- 1 | *vim-tips-wiki.txt* Read tips from Vim Tips Wiki 2 | 3 | INTRODUCTION *vim-tips-wiki* 4 | 5 | 1500+ tips downloaded from Vim Tips Wiki 6 | [https://vim.fandom.com/wiki/Vim_Tips_Wiki], parsed and formatted to look and 7 | work like native Vim help files. 8 | 9 | You can use |:helpgrep| to search tips, to jump tags and |gO| (thats 10 | capital o) to see table of contents. All tips are numbered and tagged in a 11 | format `vtw-N` where `N` is number of a tip. 12 | 13 | Try 14 | > 15 | :help vtw-1 16 | < 17 | You can get random tip by executing *:RandomVimTip* command. 18 | 19 | LISTS OF TIPS *vim-tips-wiki-lists* 20 | 21 | In order |vtw-index| 22 | Alphabetically |vtw-alphabetically| 23 | By category |vtw-by-category| 24 | 25 | WHY THOUGH *vim-tips-wiki-why* 26 | 27 | Sometimes I find myself using |:helpgrep| and not finding what I am looking 28 | for, often because I did not use correct word or phrase. I hope that having 29 | 1500+ tips written by users will help solve this problem. 30 | 31 | ============================================================================== 32 | vim:tw=78:ft=help:norl: 33 | 34 | -------------------------------------------------------------------------------- /doc/vim-tips-wiki-817.txt: -------------------------------------------------------------------------------- 1 | *vim-tips-wiki-817.txt* Non-blinking block cursor in a Linux console *vtw-817* 2 | 3 | Tip 817 [https://vim.fandom.com/wiki/Non-blinking_block_cursor_in_a_Linux_console] Previous |vtw-816| Next |vtw-818| 4 | 5 | created November 7, 2004 · complexity basic · author David Schweikert · 6 | version 5.7 7 | 8 | ============================================================================== 9 | 10 | If you are a Linux user editing with Vim in the console, you can put the 11 | following in your vimrc to have a nice non-blinking block cursor like in an 12 | xterm: 13 | 14 | > 15 | if &term == "linux" 16 | set t_ve+=^[[?81;0;112c 17 | endif 18 | < 19 | 20 | Note that the ^[ above needs to be typed like this: . 21 | 22 | See Documentation/VGA-softcursor.txt in the kernel sources for details about 23 | this escape sequence. 24 | 25 | COMMENTS *vtw-817-comments* 26 | 27 | CATEGORIES *vtw-817-cats* 28 | 29 | Review |vtw-by-category-review| 30 | Integration |vtw-by-category-integration| 31 | 32 | 33 | vim:tw=78:et:ft=help:norl: -------------------------------------------------------------------------------- /doc/vim-tips-wiki-347.txt: -------------------------------------------------------------------------------- 1 | *vim-tips-wiki-347.txt* Format paragraph without changing the cursor position *vtw-347* 2 | 3 | Tip 347 [https://vim.fandom.com/wiki/Format_paragraph_without_changing_the_cursor_position] Previous |vtw-346| Next |vtw-348| 4 | 5 | created 2002 · complexity basic · version 6.0 6 | 7 | ============================================================================== 8 | 9 | To format the current paragraph: 10 | - `gqap` 11 | - `gwap` same, but restores cursor position 12 | 13 | 14 | COMMENTS *vtw-347-comments* 15 | 16 | TO DO 17 | - Thanks to anon who pointed out that gwap makes the original tip obsolete (I 18 | have removed it). 19 | - We don't have any other tips that explain basics of paragraph formatting, so 20 | this may as well be it. 21 | - Need to explain what "format" means here. 22 | - Need to mention textwidth, formatexpr, formatprg and probably more (but keep 23 | it simple). 24 | 25 | 26 | CATEGORIES *vtw-347-cats* 27 | 28 | Todo |vtw-by-category-todo| 29 | 30 | 31 | vim:tw=78:et:ft=help:norl: -------------------------------------------------------------------------------- /doc/vim-tips-wiki-522.txt: -------------------------------------------------------------------------------- 1 | *vim-tips-wiki-522.txt* Fix an autoindent error *vtw-522* 2 | 3 | Tip 522 [https://vim.fandom.com/wiki/Fix_an_autoindent_error] Previous |vtw-519| Next |vtw-523| 4 | 5 | created 2003 · complexity basic · author Breadman · version 5.7 6 | 7 | ============================================================================== 8 | 9 | When splitting a line in two, I sometimes insert a return before a space. 10 | Unfortunately, this mangles the autoindentation: the last tab turns into 11 | spaces. The following map fixes that problem: 12 | 13 | > 14 | "Fixes a rare autoindent error 15 | inoremap =ReturnWrapper() 16 | function ReturnWrapper() 17 | if strpart(getline('.'), col('.') - 1) =~ '^\s*\S' 18 | return "\wi\" 19 | else 20 | return "\" 21 | endif 22 | endf 23 | < 24 | 25 | COMMENTS *vtw-522-comments* 26 | 27 | CATEGORIES *vtw-522-cats* 28 | 29 | Review |vtw-by-category-review| 30 | Indenting |vtw-by-category-indenting| 31 | 32 | 33 | vim:tw=78:et:ft=help:norl: -------------------------------------------------------------------------------- /doc/vim-tips-wiki-999.txt: -------------------------------------------------------------------------------- 1 | *vim-tips-wiki-999.txt* Maximize current window *vtw-999* 2 | 3 | Tip 999 [https://vim.fandom.com/wiki/Maximize_current_window] Previous |vtw-998| Next |vtw-1001| 4 | 5 | created 2005 · complexity basic · author Narayanan Iyer · version 5.7 6 | 7 | ============================================================================== 8 | 9 | Map a key to make the current window as large as possible (without closing 10 | other windows): 11 | 12 | > 13 | map _ 14 | < 15 | 16 | If you don't mind closing other windows, you can make the current window even 17 | larger: 18 | 19 | > 20 | :only 21 | < 22 | 23 | Or you can use CTRL-W o (or CTRL-W CTRL-O), which does the same thing as 24 | `:only` in even fewer keystrokes. 25 | 26 | REFERENCES *vtw-999-references* 27 | - :help |:resize| 28 | - :help |:only| 29 | 30 | 31 | COMMENTS *vtw-999-comments* 32 | 33 | CATEGORIES *vtw-999-cats* 34 | 35 | Split windows |vtw-by-category-split-windows| 36 | 37 | 38 | vim:tw=78:et:ft=help:norl: -------------------------------------------------------------------------------- /doc/vim-tips-wiki-1245.txt: -------------------------------------------------------------------------------- 1 | *vim-tips-wiki-1245.txt* Correcting accented characters *vtw-1245* 2 | 3 | Tip 1245 [https://vim.fandom.com/wiki/Correcting_accented_characters] Previous |vtw-1244| Next |vtw-1247| 4 | 5 | created May 25, 2006 · complexity basic · author Luis A. Florit · version 5.7 6 | 7 | ============================================================================== 8 | 9 | This will help if you receive text (e.g, email from wrongly configured 10 | clients) with lots of '\nnn' or '&#nnn;' strings, where n is a digit. These 11 | 'nnn' are the decimal codes of non-ascii characters. To convert all at the 12 | same time, you can do the following: 13 | 14 | > 15 | :%s/\\\([0-9]*\)/\=nr2char(submatch(1))/g 16 | or 17 | :%s/&#\([0-9]*\);/\=nr2char(submatch(1))/g 18 | < 19 | 20 | REFERENCES *vtw-1245-references* 21 | - :help |nr2char()| 22 | - :help |submatch()| 23 | 24 | 25 | COMMENTS *vtw-1245-comments* 26 | 27 | CATEGORIES *vtw-1245-cats* 28 | 29 | Review |vtw-by-category-review| 30 | 31 | 32 | vim:tw=78:et:ft=help:norl: -------------------------------------------------------------------------------- /doc/vim-tips-wiki-1031.txt: -------------------------------------------------------------------------------- 1 | *vim-tips-wiki-1031.txt* Vim inside Java *vtw-1031* 2 | 3 | Tip 1031 [https://vim.fandom.com/wiki/Vim_inside_Java] Previous |vtw-1030| Next |vtw-1032| 4 | 5 | created October 29, 2005 · complexity advanced · author Pavel Tavoda · 6 | version 5.7 7 | 8 | ============================================================================== 9 | 10 | If you would like to embed Vim inside your Java application I found, that 11 | best way how to do it, is Java terminal emulation. Download jta26.jar from 12 | http://javassh.org/space/start [http://javassh.org/space/start]. Then start 13 | Vim from your Java program and redirect stdin and stdout to and from terminal 14 | emulator. 15 | 16 | For some unknown reason you have to use Vim without GUI support, that is, GUI 17 | support isn't compiled into binary. You have to use pure terminal Vim. 18 | 19 | COMMENTS *vtw-1031-comments* 20 | 21 | CATEGORIES *vtw-1031-cats* 22 | 23 | Review |vtw-by-category-review| 24 | Integration |vtw-by-category-integration| 25 | Java |vtw-by-category-java| 26 | 27 | 28 | vim:tw=78:et:ft=help:norl: -------------------------------------------------------------------------------- /doc/vim-tips-wiki-261.txt: -------------------------------------------------------------------------------- 1 | *vim-tips-wiki-261.txt* Close windows from gvim popup menu *vtw-261* 2 | 3 | Tip 261 [https://vim.fandom.com/wiki/Close_windows_from_gvim_popup_menu] Previous |vtw-258| Next |vtw-262| 4 | 5 | created 2002 · complexity basic · author sean · version 6.0 6 | 7 | ============================================================================== 8 | 9 | In gvim, you can use the mouse for copy/paste etc with: 10 | 11 | > 12 | :set mousemodel=popup 13 | < 14 | 15 | or: 16 | 17 | > 18 | :set mousemodel=popup_setpos 19 | < 20 | 21 | You can also customize your popup menu by editing $VIMRUNTIME/menu.vim. 22 | 23 | To close windows from the popup menu add these lines to your .gvimrc 24 | 25 | > 26 | :amenu PopUp.Close.\ Window :confirm close 27 | :amenu PopUp.Close.\ Other :confirm only 28 | < 29 | 30 | REFERENCES *vtw-261-references* 31 | - :help 'mousemodel' 32 | 33 | 34 | COMMENTS *vtw-261-comments* 35 | 36 | CATEGORIES *vtw-261-cats* 37 | 38 | Usage |vtw-by-category-usage| 39 | 40 | 41 | vim:tw=78:et:ft=help:norl: -------------------------------------------------------------------------------- /doc/vim-tips-wiki-502.txt: -------------------------------------------------------------------------------- 1 | *vim-tips-wiki-502.txt* View character class *vtw-502* 2 | 3 | Tip 502 [https://vim.fandom.com/wiki/View_character_class] Previous |vtw-498| Next |vtw-503| 4 | 5 | created July 2, 2003 · complexity intermediate · author beo · version 6.0 6 | 7 | ============================================================================== 8 | 9 | This one shows the definition of a predefined character class. ([:alpha:], 10 | [:graph:] etc.) The cursor is assumed to point to the name of the character 11 | class one wants to examine. Press "cc". 12 | 13 | > 14 | fun! s:Show() 15 | norm! viwy 16 | echo 'class [:' . @" . ':]' . "\n" 17 | let pat = '[[:' . @" . ':]]' 18 | let i = 0 19 | while i < 256 20 | let ch = nr2char(i) 21 | if ch =~ pat | echon ch . '(' . i . ')' . "\t" | endif 22 | let i = i + 1 23 | endwhile 24 | endfun 25 | nn cc :call Show() 26 | < 27 | 28 | COMMENTS *vtw-502-comments* 29 | 30 | CATEGORIES *vtw-502-cats* 31 | 32 | Review |vtw-by-category-review| 33 | 34 | 35 | vim:tw=78:et:ft=help:norl: -------------------------------------------------------------------------------- /doc/vim-tips-wiki-751.txt: -------------------------------------------------------------------------------- 1 | *vim-tips-wiki-751.txt* Go to line *vtw-751* 2 | 3 | Tip 751 [https://vim.fandom.com/wiki/Go_to_line] Previous |vtw-750| Next |vtw-752| 4 | 5 | created June 21, 2004 · complexity basic · author Char · version 5.7 6 | 7 | ============================================================================== 8 | 9 | There are at least three different ways to go to a particular line (line 42 10 | for example): 11 | 12 | > 13 | 42G 14 | 42gg 15 | :42 16 | 19 | exe 42 20 | < 21 | 22 | COMMENTS *vtw-751-comments* 23 | 24 | To bring line 42 to the top (centre or bottom) of your screen, add `zt` (`z.` 25 | or `zb`) to one of the aforementioned commands.Moreover, to navigate to the 26 | Higher, Middle or Lower part of your screen, just press `H`, `M` or `L` (which 27 | are, respectively, capital H, capital M and capital L). 28 | 29 | CATEGORIES *vtw-751-cats* 30 | 31 | Moving |vtw-by-category-moving| 32 | 33 | 34 | vim:tw=78:et:ft=help:norl: -------------------------------------------------------------------------------- /doc/vim-tips-wiki-834.txt: -------------------------------------------------------------------------------- 1 | *vim-tips-wiki-834.txt* Word-wise cut, copy and paste *vtw-834* 2 | 3 | Tip 834 [https://vim.fandom.com/wiki/Word-wise_cut,_copy_and_paste] Previous |vtw-832| Next |vtw-835| 4 | 5 | created 2004 · complexity basic · author andyf · version 6.0 6 | 7 | ============================================================================== 8 | 9 | Word-wise cut, copy & paste over the current word. There's nothing special or 10 | magical about these bindings, just that I find them really useful for coding, 11 | and I thought I'd share. 12 | 13 | Add the following lines to vimrc: 14 | 15 | > 16 | map viw"+gPb 17 | map viw"+y 18 | map viw"+x 19 | < 20 | 21 | These bindings follow the Windows-style keys of control-V, control-C, and 22 | control-X; except using alt instead of control. Adjust to your preference. 23 | 24 | COMMENTS *vtw-834-comments* 25 | 26 | I think yiw is more convenient. 27 | 28 | ============================================================================== 29 | 30 | CATEGORIES *vtw-834-cats* 31 | 32 | Review |vtw-by-category-review| 33 | 34 | 35 | vim:tw=78:et:ft=help:norl: -------------------------------------------------------------------------------- /doc/vim-tips-wiki-1617.txt: -------------------------------------------------------------------------------- 1 | *vim-tips-wiki-1617.txt* Quickfix and doxygen *vtw-1617* 2 | 3 | Tip 1617 [https://vim.fandom.com/wiki/Quickfix_and_doxygen] Previous |vtw-1616| Next |vtw-1618| 4 | 5 | created 6 | [https://vim.fandom.com/wiki/Vim_Tips_Wiki:New_tips/200902#Quickfix_and_doxygen] 7 | 2009 · complexity basic · author Gdw2 · version 7.0 8 | 9 | ============================================================================== 10 | 11 | We often use `:make` to build my C++ project and then go through the compile 12 | errors and fix them. :help |quickfix| 13 | 14 | This simple tip shows how you can use `:make` to use Quickfix with doxygen 15 | [http://www.stack.nl/~dimitri/doxygen/]. 16 | 17 | From the shell command line, generate a default config file: 18 | 19 | > 20 | $doxygen -g 21 | < 22 | 23 | From within Vim do the following: 24 | 25 | > 26 | :set makeprg=doxygen 27 | :make Doxyfile 28 | < 29 | 30 | Quickfix will then allow you to go through your doxygen errors as you would 31 | through gcc errors. 32 | 33 | COMMENTS *vtw-1617-comments* 34 | 35 | CATEGORIES *vtw-1617-cats* 36 | 37 | 38 | 39 | vim:tw=78:et:ft=help:norl: -------------------------------------------------------------------------------- /doc/vim-tips-wiki-997.txt: -------------------------------------------------------------------------------- 1 | *vim-tips-wiki-997.txt* Saving file made easy *vtw-997* 2 | 3 | Tip 997 [https://vim.fandom.com/wiki/Saving_file_made_easy] Previous |vtw-996| Next |vtw-998| 4 | 5 | created 2005 · complexity basic · version 6.0 6 | 7 | ============================================================================== 8 | 9 | To save a file, we do :w. 10 | 11 | If you add the following line to your vimrc, you can easily save a file by 12 | pressing F2. 13 | 14 | > 15 | map  :w! 16 | < 17 | 18 | COMMENTS *vtw-997-comments* 19 | 20 | I just press `ZZ` to save and exit. 21 | 22 | ============================================================================== 23 | 24 | F2 is too far away from where I keep my fingers - I prefer the following: 25 | 26 | > 27 | map W :wa^M 28 | map! ^W ^[:wa^Ma 29 | < 30 | 31 | This makes W save all buffers in command mode and Ctrl+W do the same in 32 | insert mode. 33 | 34 | ============================================================================== 35 | 36 | CATEGORIES *vtw-997-cats* 37 | 38 | Review |vtw-by-category-review| 39 | 40 | 41 | vim:tw=78:et:ft=help:norl: -------------------------------------------------------------------------------- /doc/vim-tips-wiki-643.txt: -------------------------------------------------------------------------------- 1 | *vim-tips-wiki-643.txt* Disable built-in command *vtw-643* 2 | 3 | Tip 643 [https://vim.fandom.com/wiki/Disable_built-in_command] Previous |vtw-642| Next |vtw-644| 4 | 5 | created January 26, 2004 · complexity intermediate · author Alfvaen · version 6 | 5.7 7 | 8 | ============================================================================== 9 | 10 | If there's a built-in key command in Vim that you find annoying, or that you 11 | often hit by accident, then you can disable the key by mapping it to nothing. 12 | For example: 13 | 14 | > 15 | :map K 16 | < 17 | 18 | For "", type the five characters as they appear (less-than N o p 19 | greater-than). 20 | 21 | Of course, you can always 22 | 23 | > 24 | :unmap K 25 | < 26 | 27 | if you start doing C programming and want to instantly "man" things under the 28 | cursor again. 29 | 30 | REFERENCES *vtw-643-references* 31 | - :help || 32 | 33 | 34 | COMMENTS *vtw-643-comments* 35 | 36 | CATEGORIES *vtw-643-cats* 37 | 38 | Review |vtw-by-category-review| 39 | 40 | 41 | vim:tw=78:et:ft=help:norl: -------------------------------------------------------------------------------- /doc/vim-tips-wiki-819.txt: -------------------------------------------------------------------------------- 1 | *vim-tips-wiki-819.txt* Minimize and restore gvim under Windows using shortcut keys *vtw-819* 2 | 3 | Tip 819 [https://vim.fandom.com/wiki/Minimize_and_restore_gvim_under_Windows_using_shortcut_keys] Previous |vtw-818| Next |vtw-822| 4 | 5 | created 2004 · complexity basic · author Siegfried Bublitz · version 5.7 6 | 7 | ============================================================================== 8 | 9 | Pressing `CTRL-Z` in normal or visual mode will send Vim to the background, 10 | suspending it. Even gvim is iconized. In Microsoft Windows, this means 11 | pressing "minimize" the current gvim window. 12 | 13 | Windows also provides a "shortcut key" property in the "Properties" dialog of 14 | any given shortcut. You can open this dialog and enter `CTRL-ALT-Z` as the 15 | shortcut key by selecting the shortcut key box and typing the key combination. 16 | Doing so allows you to press `CTRL-ALT-Z` to bring Vim to the foreground after 17 | launching it, and press `CTRL-Z` to minimize. 18 | 19 | COMMENTS *vtw-819-comments* 20 | 21 | CATEGORIES *vtw-819-cats* 22 | 23 | Windows |vtw-by-category-windows| 24 | 25 | 26 | vim:tw=78:et:ft=help:norl: -------------------------------------------------------------------------------- /doc/vim-tips-wiki-34.txt: -------------------------------------------------------------------------------- 1 | *vim-tips-wiki-34.txt* Control the position of the new window *vtw-34* 2 | 3 | Tip 34 [https://vim.fandom.com/wiki/Control_the_position_of_the_new_window] Previous |vtw-33| Next |vtw-35| 4 | 5 | created March 7, 2001 · complexity intermediate · author slimzhao · version 6 | 5.7 7 | 8 | ============================================================================== 9 | 10 | There are a few ways to open a new window (:help |opening-window|), but some 11 | users may not like the placement of this new window. By default, Vim opens the 12 | new window above the current one for horizontal splits, and to the left of the 13 | current one for vertical splits. You can customize this behavior like most 14 | other things in Vim: 15 | 16 | > 17 | :set splitbelow 18 | < 19 | 20 | make the new window appear below the current window. 21 | 22 | > 23 | :set splitright 24 | < 25 | 26 | make the new window appear on the right. 27 | 28 | COMMENTS *vtw-34-comments* 29 | 30 | TO DO 31 | - Move tip to give it a better name? 32 | 33 | 34 | CATEGORIES *vtw-34-cats* 35 | 36 | Todo |vtw-by-category-todo| 37 | 38 | 39 | vim:tw=78:et:ft=help:norl: -------------------------------------------------------------------------------- /doc/vim-tips-wiki-745.txt: -------------------------------------------------------------------------------- 1 | *vim-tips-wiki-745.txt* Find VIMRUNTIME in a bash script *vtw-745* 2 | 3 | Tip 745 [https://vim.fandom.com/wiki/Find_VIMRUNTIME_in_a_bash_script] Previous |vtw-744| Next |vtw-746| 4 | 5 | created June 15, 2004 · complexity advanced · author Steve Hall · version 6.0 6 | 7 | ============================================================================== 8 | 9 | I recently needed the value of $VIMRUNTIME in a bash shell script and was 10 | forwarded these two terrific solutions that may be of use to others. 11 | 12 | > 13 | vim --cmd 'echo $VIMRUNTIME' --cmd 'quit' 2> /tmp/VIMRUNTIME.txt 14 | VIMRUNTIME=`perl -pe 's/\r\n//g' /tmp/VIMRUNTIME.txt` 15 | rm -f /tmp/VIMRUNTIME.txt 16 | < 17 | 18 | > 19 | VIMRUNTIME=`vim -e -T dumb --cmd 'exe "set t_cm=\"|echo $VIMRUNTIME|quit' | tr -d '\015' ` 20 | < 21 | 22 | Both properly capture Vim's output and handle the trailing line feed, 23 | although in remarkably different ways. 24 | 25 | COMMENTS *vtw-745-comments* 26 | 27 | CATEGORIES *vtw-745-cats* 28 | 29 | Review |vtw-by-category-review| 30 | Integration |vtw-by-category-integration| 31 | 32 | 33 | vim:tw=78:et:ft=help:norl: -------------------------------------------------------------------------------- /doc/vim-tips-wiki-1413.txt: -------------------------------------------------------------------------------- 1 | *vim-tips-wiki-1413.txt* Make tar of all files in vim buffer *vtw-1413* 2 | 3 | Tip 1413 [https://vim.fandom.com/wiki/Make_tar_of_all_files_in_vim_buffer] Previous |vtw-1393| Next |vtw-1431| 4 | 5 | created 2006 · complexity basic · author Eric Smith · version 5.7 6 | 7 | ============================================================================== 8 | 9 | The following command will make a tar file including path information of all 10 | files in the current Vim buffer. If you wish to omit paths, leave out the 11 | ':p'. 12 | 13 | > 14 | :silent bufdo !tar -rvf archive.tar %:p 15 | < 16 | 17 | I use it to copy projects (where all files are open in split screen), from 18 | one machine to another. 19 | 20 | COMMENTS *vtw-1413-comments* 21 | 22 | Zip version - zip all the files in your Vim session. 23 | 24 | > 25 | :silent bufdo !zip proj.zip % 26 | < 27 | 28 | ---You probably want to use `:mksession` to save your window setup also? 29 | 30 | ============================================================================== 31 | 32 | CATEGORIES *vtw-1413-cats* 33 | 34 | Review |vtw-by-category-review| 35 | 36 | 37 | vim:tw=78:et:ft=help:norl: -------------------------------------------------------------------------------- /doc/vim-tips-wiki-875.txt: -------------------------------------------------------------------------------- 1 | *vim-tips-wiki-875.txt* Using bar in external grep *vtw-875* 2 | 3 | Tip 875 [https://vim.fandom.com/wiki/Using_bar_in_external_grep] Previous |vtw-874| Next |vtw-876| 4 | 5 | created February 15, 2005 · complexity basic · author David S · version 5.7 6 | 7 | ============================================================================== 8 | 9 | It took me a while to notice this at :help |:bar|: 10 | 11 | '|' can be used to separate commands, so you can give multiple commands in one line. If you want to use '|' in an argument, precede it with '\'. 12 | 13 | When using bar in grep from a shell prompt you would use something like: 14 | 15 | > 16 | grep -i "main\(menu\|tool\)" * 17 | or 18 | grep -iE "main(menu|tool)" * 19 | < 20 | 21 | However, you must remember to add an extra escape to the '|' character in 22 | your regex when using grep from Vim, like so: 23 | 24 | > 25 | grep -i "main\(menu\\|tool\)" * 26 | or 27 | grep -iE "main(menu\|tool)" * 28 | < 29 | 30 | COMMENTS *vtw-875-comments* 31 | 32 | CATEGORIES *vtw-875-cats* 33 | 34 | Review |vtw-by-category-review| 35 | 36 | 37 | vim:tw=78:et:ft=help:norl: -------------------------------------------------------------------------------- /doc/vim-tips-wiki-868.txt: -------------------------------------------------------------------------------- 1 | *vim-tips-wiki-868.txt* Go to end-of-line when using langmap *vtw-868* 2 | 3 | Tip 868 [https://vim.fandom.com/wiki/Go_to_end-of-line_when_using_langmap] Previous |vtw-864| Next |vtw-869| 4 | 5 | created 2005 · complexity basic · author Ivan Tishchenko · version 6.0 6 | 7 | ============================================================================== 8 | 9 | Recently I found it very helpful to use the 'langmap' option. But I've got a 10 | problem: When I switch to my language, I'm not able to use the `$` command 11 | (go-to-end-of-line), because the keyboard layout for my language does not 12 | contain this character at all. 13 | 14 | I had to press , or use some other inconvenient way of jumping to the 15 | end of a line. 16 | 17 | Today I found another way, which is much easier: command `g_` moves the 18 | cursor to the last non-blank character in the line. This works with 'langmap', 19 | for all English characters are always "mapped" properly. 20 | 21 | See also VimTip278 |vtw-278|. 22 | 23 | COMMENTS *vtw-868-comments* 24 | 25 | CATEGORIES *vtw-868-cats* 26 | 27 | Review |vtw-by-category-review| 28 | 29 | 30 | vim:tw=78:et:ft=help:norl: -------------------------------------------------------------------------------- /doc/vim-tips-wiki-137.txt: -------------------------------------------------------------------------------- 1 | *vim-tips-wiki-137.txt* Automatically wrap left and right *vtw-137* 2 | 3 | Tip 137 [https://vim.fandom.com/wiki/Automatically_wrap_left_and_right] Previous |vtw-135| Next |vtw-138| 4 | 5 | created 2001 · complexity basic · author Brian Medley · version 6.0 6 | 7 | ============================================================================== 8 | 9 | By default, when pressing left/right cursor keys, Vim will not move to the 10 | previous/next line after reaching first/last character in the line. This can 11 | be quite annoying for new users. Fortunately this behaviour can be easily 12 | changed by putting this in your vimrc file: 13 | 14 | > 15 | set whichwrap+=<,>,h,l,[,] 16 | < 17 | 18 | This causes the left and right arrow keys, as well as `h` and `l`, to wrap 19 | when used at beginning or end of lines. ( < > are the cursor keys used in 20 | normal and visual mode, and `[ ]` are the cursor keys in insert mode). 21 | 22 | REFERENCES *vtw-137-references* 23 | - :help 'whichwrap' 24 | 25 | 26 | COMMENTS *vtw-137-comments* 27 | 28 | CATEGORIES *vtw-137-cats* 29 | 30 | 31 | 32 | vim:tw=78:et:ft=help:norl: -------------------------------------------------------------------------------- /doc/vim-tips-wiki-426.txt: -------------------------------------------------------------------------------- 1 | *vim-tips-wiki-426.txt* Protecting a file from accidental changes *vtw-426* 2 | 3 | Tip 426 [https://vim.fandom.com/wiki/Protecting_a_file_from_accidental_changes] Previous |vtw-425| Next |vtw-427| 4 | 5 | created 2003 · complexity basic · author zzapper · version 5.7 6 | 7 | ============================================================================== 8 | 9 | A common programmimg situation, you are comparing two versions of the same 10 | file. One is the "reference file" which you don't want to update. However they 11 | look so similar that you can get confused. 12 | 13 | Solution: Set the master file to read only, and change its color scheme. 14 | 15 | > 16 | :set nomodifiable 17 | :colorscheme peachpuff 18 | < 19 | 20 | Non-modifiable is better than `:set ro` as `nomodifiable` won't even let you 21 | start changing stuff, whereas `:set ro` will only warn you once. 22 | 23 | COMMENTS *vtw-426-comments* 24 | 25 | You can permanently protect a file by setting a suitable modeline :help 26 | |modeline|. 27 | 28 | > 29 | // vim:noma 30 | < 31 | 32 | CATEGORIES *vtw-426-cats* 33 | 34 | Review |vtw-by-category-review| 35 | 36 | 37 | vim:tw=78:et:ft=help:norl: -------------------------------------------------------------------------------- /doc/vim-tips-wiki-457.txt: -------------------------------------------------------------------------------- 1 | *vim-tips-wiki-457.txt* Follow tag in new window *vtw-457* 2 | 3 | Tip 457 [https://vim.fandom.com/wiki/Follow_tag_in_new_window] Previous |vtw-452| Next |vtw-458| 4 | 5 | created 2003 · complexity basic · author PopEsc · version 6.0 6 | 7 | ============================================================================== 8 | 9 | If you use tags, you might want to follow a tag, but leave the current window 10 | open. The following mapping allows you to do this easily with Ctrl-\. 11 | 12 | > 13 | :map  :sp_ 14 | < 15 | 16 | COMMENTS *vtw-457-comments* 17 | 18 | This creates a new window of maximal size and the original window shrinks to 19 | one line. To have the windows be of equal size, just eliminate the "_" at 20 | the end. 21 | 22 | ============================================================================== 23 | 24 | Just use 'CTRL-W ]'. 25 | 26 | ============================================================================== 27 | 28 | CATEGORIES *vtw-457-cats* 29 | 30 | Review |vtw-by-category-review| 31 | Navigation |vtw-by-category-navigation| 32 | Dodgy |vtw-by-category-dodgy| 33 | 34 | 35 | vim:tw=78:et:ft=help:norl: -------------------------------------------------------------------------------- /doc/vim-tips-wiki-1388.txt: -------------------------------------------------------------------------------- 1 | *vim-tips-wiki-1388.txt* Vim and ocaml interpreter *vtw-1388* 2 | 3 | Tip 1388 [https://vim.fandom.com/wiki/Vim_and_ocaml_interpreter] Previous |vtw-1386| Next |vtw-1389| 4 | 5 | created 2006 · complexity basic · author setog · version n/a 6 | 7 | ============================================================================== 8 | 9 | I try to learn ocaml, and I add this lines in my vimrc to run the code in the 10 | ocaml interpreter: 11 | 12 | > 13 | set sb 14 | map  :split /tmp/ocaml \| %d \|setlocal ft=omlet \| setlocal autowrite \| r!ocaml < # 15 | map  :dr /tmp/ocaml \| %d \|setlocal ft=omlet \|setlocal autowrite \| r!ocaml < # 16 | < 17 | 18 | The first map (F11) open a temp file in a split and write the output in it 19 | (with omlet syntax). 20 | 21 | I use the second (F12) to do it if I have already a split with the result. 22 | 23 | I do a set autowrite, but I am sure we can use the same property of `:he` 24 | command (a buffer in read only without needing to save it). 25 | 26 | COMMENTS *vtw-1388-comments* 27 | 28 | CATEGORIES *vtw-1388-cats* 29 | 30 | Review |vtw-by-category-review| 31 | 32 | 33 | vim:tw=78:et:ft=help:norl: -------------------------------------------------------------------------------- /doc/vim-tips-wiki-1483.txt: -------------------------------------------------------------------------------- 1 | *vim-tips-wiki-1483.txt* Show file modification time and more on status bar *vtw-1483* 2 | 3 | Tip 1483 [https://vim.fandom.com/wiki/Show_file_modification_time_and_more_on_status_bar] Previous |vtw-1472| Next |vtw-1484| 4 | 5 | created January 21, 2007 · complexity basic · author Ace · version 5.7 6 | 7 | ============================================================================== 8 | 9 | > 10 | autocmd BufWrite * call SetStatusLine() 11 | autocmd BufRead * call SetStatusLine() 12 | function! SetStatusLine() 13 | set statusline=[%n]\ %f\ %(\ \ (%M%R%H)%)\ \ \ %=\t%{ShowTab()}\ \ \ Modified:\ %{Time()}\ \ [%3l:%3L,%2c]\ %p%%\ 14 | endfunction 15 | 16 | function! Time() 17 | return strftime("%c", getftime(bufname("%"))) 18 | endfunction 19 | 20 | function! ShowTab() 21 | let TabLevel = (indent('.') / &ts ) 22 | if TabLevel == 0 23 | let TabLevel='*' 24 | endif 25 | return TabLevel 26 | endfunction 27 | < 28 | 29 | See also VimTip1472 |vtw-1472|. 30 | 31 | COMMENTS *vtw-1483-comments* 32 | 33 | CATEGORIES *vtw-1483-cats* 34 | 35 | Review |vtw-by-category-review| 36 | 37 | 38 | vim:tw=78:et:ft=help:norl: -------------------------------------------------------------------------------- /doc/vim-tips-wiki-214.txt: -------------------------------------------------------------------------------- 1 | *vim-tips-wiki-214.txt* Current buffer based menus *vtw-214* 2 | 3 | Tip 214 [https://vim.fandom.com/wiki/Current_buffer_based_menus] Previous |vtw-213| Next |vtw-215| 4 | 5 | created February 14, 2002 · complexity intermediate · author Tomas Zellerin · 6 | version 6.0 7 | 8 | ============================================================================== 9 | 10 | If you have different menus for different filetypes, and you want to have 11 | only the menu relevant to current buffer displayed, you can use this approach: 12 | 13 | In your vimrc: 14 | 15 | > 16 | au BufEnter * if exists('b:BuffEnter')|exec b:BuffEnter|endif 17 | au BufLeave * if exists('b:BuffEnter')|exec b:BuffLeave|endif 18 | < 19 | 20 | In appropriate ftplugin/?.vim, there are assigned commands to create or 21 | destroy the menus - here typed in directly, may be of course call to a 22 | menu-generating function or whatever. 23 | 24 | > 25 | let b:BuffEnter='amenu C.added ...' 26 | let b:BuffLeave='unmenu! C|unmenu C' 27 | < 28 | 29 | COMMENTS *vtw-214-comments* 30 | 31 | CATEGORIES *vtw-214-cats* 32 | 33 | Review |vtw-by-category-review| 34 | 35 | 36 | vim:tw=78:et:ft=help:norl: -------------------------------------------------------------------------------- /doc/vim-tips-wiki-50.txt: -------------------------------------------------------------------------------- 1 | *vim-tips-wiki-50.txt* Recovering files *vtw-50* 2 | 3 | Tip 50 [https://vim.fandom.com/wiki/Recovering_files] Previous |vtw-49| Next |vtw-51| 4 | 5 | created 2001 · complexity basic · version 5.7 6 | 7 | ============================================================================== 8 | 9 | If the power fails, or your computer crashes, any file you were editing 10 | probably won't be saved. However, when the computer is restarted, you should 11 | be able to recover the file by typing: 12 | 13 | > 14 | vim -r 15 | < 16 | 17 | where is the name of the file you were editing at the time of the 18 | crash. 19 | 20 | If you were editing without a file name, enter: 21 | 22 | > 23 | vim -r "" 24 | < 25 | 26 | You can list the recoverable files: 27 | 28 | > 29 | vim -r 30 | < 31 | 32 | Each of these commands should be executed in the directory where you were 33 | when the crash occurred. 34 | 35 | REFERENCES *vtw-50-references* 36 | - :help |recovery| 37 | 38 | 39 | COMMENTS *vtw-50-comments* 40 | 41 | CATEGORIES *vtw-50-cats* 42 | 43 | 44 | 45 | vim:tw=78:et:ft=help:norl: -------------------------------------------------------------------------------- /doc/vim-tips-wiki-1584.txt: -------------------------------------------------------------------------------- 1 | *vim-tips-wiki-1584.txt* Visual selection *vtw-1584* 2 | 3 | Tip 1584 [https://vim.fandom.com/wiki/Visual_selection] Previous |vtw-1583| Next |vtw-1585| 4 | 5 | created 6 | [https://vim.fandom.com/wiki/Vim_Tips_Wiki:New_tips/200802#Visual_selection] 7 | 2008 · complexity basic · author Metacosm · version 7.0 8 | 9 | ============================================================================== 10 | 11 | TO DO 12 | - Make this a simple introduction to visual selection. 13 | - Move some of content of following to here (with a link to here): - 312 Copy, 14 | cut and paste |vtw-312| - 344 Cut or copy lines without counting the lines 15 | |vtw-344| - 386 Cut/copy and paste using visual selection |vtw-386| 16 | 17 | 18 | RESELECT A VISUAL BLOCK *vtw-1584-reselect-a-visual-block* 19 | 20 | Did you just do something on a visual range, and to your horror the visual 21 | block vanished? 22 | 23 | Just type `gv` to reselect the last block. 24 | 25 | COMMENTS *vtw-1584-comments* 26 | 27 | CATEGORIES *vtw-1584-cats* 28 | 29 | Getting started |vtw-by-category-getting-started| 30 | Todo |vtw-by-category-todo| 31 | 32 | 33 | vim:tw=78:et:ft=help:norl: -------------------------------------------------------------------------------- /doc/vim-tips-wiki-17.txt: -------------------------------------------------------------------------------- 1 | *vim-tips-wiki-17.txt* Erasing previously entered characters in insert mode *vtw-17* 2 | 3 | Tip 17 [https://vim.fandom.com/wiki/Erasing_previously_entered_characters_in_insert_mode] Previous |vtw-16| Next |vtw-18| 4 | 5 | created February 24, 2001 · complexity basic · author Yegappan · version 5.7 6 | 7 | ============================================================================== 8 | 9 | In insert mode, to allow the backspace key to erase previously entered 10 | characters, autoindent, and newlines, set the following option: 11 | 12 | > 13 | :set backspace=indent,eol,start 14 | < 15 | 16 | Or: 17 | 18 | > 19 | :set backspace=2 20 | < 21 | 22 | By default this option is empty, not allowing you to backspace over 23 | characters that weren't entered during the current insert mode session, the 24 | automatically inserted indentation, or across line breaks. This is the 25 | standard vi behavior. 26 | 27 | REFERENCES *vtw-17-references* 28 | - :help 'backspace' 29 | 30 | 31 | COMMENTS *vtw-17-comments* 32 | 33 | Good work! 34 | 35 | CATEGORIES *vtw-17-cats* 36 | 37 | Options |vtw-by-category-options| 38 | 39 | 40 | vim:tw=78:et:ft=help:norl: -------------------------------------------------------------------------------- /doc/vim-tips-wiki-919.txt: -------------------------------------------------------------------------------- 1 | *vim-tips-wiki-919.txt* Moving by screen lines instead of file lines *vtw-919* 2 | 3 | Tip 919 [https://vim.fandom.com/wiki/Moving_by_screen_lines_instead_of_file_lines] Previous |vtw-918| Next |vtw-920| 4 | 5 | created April 28, 2005 · complexity basic · author Raj Kiran Grandhi · 6 | version 5.7 7 | 8 | ============================================================================== 9 | 10 | Using 'gj' and 'gk' instead of just 'j' and 'k' allows moving down and up by 11 | screen lines instead of file lines. Here are a few nifty mappings for that: 12 | 13 | > 14 | :noremap gk 15 | :noremap! gk 16 | :noremap gj 17 | :noremap! gj 18 | " the following are optional, to move by file lines using Alt-arrows 19 | :noremap! 20 | :noremap! 21 | :noremap k 22 | :noremap j 23 | < 24 | 25 | COMMENTS *vtw-919-comments* 26 | 27 | See: 28 | - VimTip38 |vtw-38| 29 | - VimTip308 |vtw-308| 30 | 31 | 32 | ============================================================================== 33 | 34 | CATEGORIES *vtw-919-cats* 35 | 36 | Review |vtw-by-category-review| 37 | 38 | 39 | vim:tw=78:et:ft=help:norl: -------------------------------------------------------------------------------- /doc/vim-tips-wiki-691.txt: -------------------------------------------------------------------------------- 1 | *vim-tips-wiki-691.txt* Use gf to open a file via its URL *vtw-691* 2 | 3 | Tip 691 [https://vim.fandom.com/wiki/Use_gf_to_open_a_file_via_its_URL] Previous |vtw-690| Next |vtw-692| 4 | 5 | created 2004 · complexity intermediate · author Xiangjiang Ma · version 6.0 6 | 7 | ============================================================================== 8 | 9 | To make `gf` work for a URL, say, `file:///C:/myfile.txt`, I have the 10 | following in my vimrc on Windows: 11 | 12 | > 13 | au BufReadCmd file:///* exe "bd!|edit ".substitute(expand(""),"file:/*","","") 14 | < 15 | 16 | COMMENTS *vtw-691-comments* 17 | 18 | How about extending it for `http://x.y [http://x.y]` 19 | 20 | For network file like http:// ftp:// etc, I guess it is better to use netrw 21 | plugin. 22 | 23 | ============================================================================== 24 | 25 | TO DO 26 | - Handle escaped characters like %20 for spaces. 27 | 28 | 29 | --Fritzophrenic [https://vim.fandom.com/wiki/User:Fritzophrenic] 16:12, 30 | January 6, 2010 (UTC) 31 | 32 | CATEGORIES *vtw-691-cats* 33 | 34 | Review |vtw-by-category-review| 35 | Todo |vtw-by-category-todo| 36 | 37 | 38 | vim:tw=78:et:ft=help:norl: -------------------------------------------------------------------------------- /doc/vim-tips-wiki-749.txt: -------------------------------------------------------------------------------- 1 | *vim-tips-wiki-749.txt* Uuencode and uudecode text in Vim *vtw-749* 2 | 3 | Tip 749 [https://vim.fandom.com/wiki/Uuencode_and_uudecode_text_in_Vim] Previous |vtw-748| Next |vtw-750| 4 | 5 | created June 17, 2004 · complexity basic · author Pan S · version 6.0 6 | 7 | ============================================================================== 8 | 9 | When you want to attach something in your email, uuencode is extremely 10 | useful. 11 | 12 | This is a mapping to uuencode and uudecode in BASE64. 13 | 14 | > 15 | nnoremap ue :%!uuencode -m /dev/stdout 16 | nnoremap ud :%!uudecode -o /dev/stdout 17 | vnoremap ue !uuencode -m /dev/stdout 18 | vnoremap ud !uudecode -o /dev/stdout 19 | < 20 | 21 | Assumption: you have uuencode installed in your PATH. (For cygwin it is 22 | included in the sharutils package; for Unix it should be similar.) 23 | 24 | Similar mapping can be used to any type of filter, such as the C indenter and 25 | C preprocessor. 26 | 27 | COMMENTS *vtw-749-comments* 28 | 29 | CATEGORIES *vtw-749-cats* 30 | 31 | Review |vtw-by-category-review| 32 | 33 | 34 | vim:tw=78:et:ft=help:norl: -------------------------------------------------------------------------------- /doc/vim-tips-wiki-149.txt: -------------------------------------------------------------------------------- 1 | *vim-tips-wiki-149.txt* Update the diff view automatically *vtw-149* 2 | 3 | Tip 149 [https://vim.fandom.com/wiki/Update_the_diff_view_automatically] Previous |vtw-148| Next |vtw-150| 4 | 5 | created October 29, 2001 · complexity intermediate · author Douglas Potts · 6 | version 6.0 7 | 8 | ============================================================================== 9 | 10 | When trying to reconcile differences between files, and using the new 'diff' 11 | functionality in Vim 6.0 you may want to automatically update the differences 12 | as you are working along. A convienent time is when you write out either of 13 | the files you are diff'ing. This autocmd will take care of doing that for you. 14 | 15 | > 16 | " If doing a diff. Upon writing changes to file, automatically update the 17 | " differences 18 | autocmd BufWritePost * if &diff == 1 | diffupdate | endif 19 | < 20 | 21 | COMMENTS *vtw-149-comments* 22 | 23 | A more aggressive auto-diffupdate 24 | [http://groups.google.com/group/vim_use/browse_thread/thread/64d65c0400010e01] 25 | is discussed on vim_use and should probably be merged into this tip. 26 | 27 | CATEGORIES *vtw-149-cats* 28 | 29 | 30 | 31 | vim:tw=78:et:ft=help:norl: -------------------------------------------------------------------------------- /doc/vim-tips-wiki-1499.txt: -------------------------------------------------------------------------------- 1 | *vim-tips-wiki-1499.txt* Jump back to spell checked words *vtw-1499* 2 | 3 | Tip 1499 [https://vim.fandom.com/wiki/Jump_back_to_spell_checked_words] Previous |vtw-1498| Next |vtw-1500| 4 | 5 | created 2007 · complexity basic · author john · version 7.0 6 | 7 | ============================================================================== 8 | 9 | Sometimes when a user is spell checking a long document they may 10 | inadvertently mark a word as correct and jump to the next word using the `]s` 11 | command. If the user had not jumped to the next word, they would be able to 12 | issue the `zug` command to mark the word as 'not found'. But, when a user has 13 | already moved to the next word, they must first move back in the jump list to 14 | the word they inadvertently marked as 'correct' using the `Ctrl-O` command. 15 | Then the user can issue the `zug` command, marking the word as 'not found' 16 | before continuing forward. 17 | 18 | SEE ALSO *vtw-1499-see-also* 19 | 20 | :help |spell| 21 | 22 | COMMENTS *vtw-1499-comments* 23 | 24 | CATEGORIES *vtw-1499-cats* 25 | 26 | Spell Checking |vtw-by-category-spell-checking| 27 | 28 | 29 | vim:tw=78:et:ft=help:norl: -------------------------------------------------------------------------------- /doc/vim-tips-wiki-852.txt: -------------------------------------------------------------------------------- 1 | *vim-tips-wiki-852.txt* Make support for NEC V850 CA850 compilers *vtw-852* 2 | 3 | Tip 852 [https://vim.fandom.com/wiki/Make_support_for_NEC_V850_CA850_compilers] Previous |vtw-851| Next |vtw-853| 4 | 5 | created January 14, 2005 · complexity intermediate · author Lee 6 | Riemenschneider · version 6.0 7 | 8 | ============================================================================== 9 | 10 | This line will replace "make" with the "build" command when using ":make". 11 | 12 | > 13 | " Use build.exe for making 14 | set makeprg=build\ -script\ script.bld\ -XO\ build.err 15 | < 16 | 17 | Note: It directs the output to a file called "build.err" and assumes a script 18 | based build where the scriptname is "script.bld". 19 | 20 | This line allows the error output from the build to be processed for display 21 | and linking back to the source. 22 | 23 | > 24 | " Find CA850 errors and warnings 25 | set errorformat=%f\ %l\ %.%#rror:\ %t%n:%m,%f\ %l\ %.%#arning:\ %t%n:%m,%+Eld850:\ %.%#rror:\ %t%n:%m 26 | < 27 | 28 | COMMENTS *vtw-852-comments* 29 | 30 | CATEGORIES *vtw-852-cats* 31 | 32 | Review |vtw-by-category-review| 33 | Compiler |vtw-by-category-compiler| 34 | 35 | 36 | vim:tw=78:et:ft=help:norl: -------------------------------------------------------------------------------- /doc/vim-tips-wiki-1620.txt: -------------------------------------------------------------------------------- 1 | *vim-tips-wiki-1620.txt* Indent C blocks where braces are opened and closed on a single line *vtw-1620* 2 | 3 | Tip 1620 [https://vim.fandom.com/wiki/Indent_C_blocks_where_braces_are_opened_and_closed_on_a_single_line] Previous |vtw-1619| Next |vtw-1621| 4 | 5 | created 6 | [https://vim.fandom.com/wiki/Vim_Tips_Wiki:New_tips/200903#Indent_C_blocks_where_braces_are_opened_and_closed_on_a_single_line] 7 | 2009 · complexity basic · author Sightless · version 7.0 8 | 9 | ============================================================================== 10 | 11 | This snippet, which should be put in `~/.vim/indent/c.vim` to work, gives 12 | indentation like this: 13 | 14 | > 15 | for (;;) 16 | { do_something(); } 17 | < 18 | 19 | rather than having the contents of the loop at the same indent level as the 20 | 'for' keyword. 21 | 22 | > 23 | func! MyCindent(l) 24 | let extra = match(getline(a:l),'^\s*{.*}$')==-1?0:&sw 25 | return cindent(a:l)+extra 26 | endfunc 27 | setlocal indentexpr=MyCindent(v:lnum) 28 | setlocal cinkeys+=} 29 | let &l:indentkeys=&l:cinkeys 30 | < 31 | 32 | COMMENTS *vtw-1620-comments* 33 | 34 | CATEGORIES *vtw-1620-cats* 35 | 36 | 37 | 38 | vim:tw=78:et:ft=help:norl: -------------------------------------------------------------------------------- /doc/vim-tips-wiki-869.txt: -------------------------------------------------------------------------------- 1 | *vim-tips-wiki-869.txt* Opening new buffer below the current *vtw-869* 2 | 3 | Tip 869 [https://vim.fandom.com/wiki/Opening_new_buffer_below_the_current] Previous |vtw-868| Next |vtw-872| 4 | 5 | created 2005 · complexity basic · author Ivan Tishchenko · version 6.0 6 | 7 | ============================================================================== 8 | 9 | Have you ever been annoyed with that fact that `:new` opens a buffer above 10 | the current window instead of below? If yes, then try `:below new` to open the 11 | new window below the current one, for this one command. 12 | 13 | You can also have all splits open below the current window by default, using 14 | the option. For example, place the following in your vimrc 15 | [https://vim.fandom.com/wiki/Vimrc]: 16 | 17 | > 18 | set splitbelow 19 | < 20 | 21 | The process is similar if you want vertically-split windows to open to the 22 | right. Use `:below vnew` to create a new vertical buffer on the right, or put 23 | the following in vimrc: 24 | 25 | > 26 | set splitright 27 | < 28 | 29 | COMMENTS *vtw-869-comments* 30 | 31 | CATEGORIES *vtw-869-cats* 32 | 33 | Split windows |vtw-by-category-split-windows| 34 | 35 | 36 | vim:tw=78:et:ft=help:norl: -------------------------------------------------------------------------------- /doc/vim-tips-wiki-477.txt: -------------------------------------------------------------------------------- 1 | *vim-tips-wiki-477.txt* Put the indentation level on the status line *vtw-477* 2 | 3 | Tip 477 [https://vim.fandom.com/wiki/Put_the_indentation_level_on_the_status_line] Previous |vtw-476| Next |vtw-478| 4 | 5 | created May 20, 2003 · complexity basic · author sputnik · version 5.7 6 | 7 | ============================================================================== 8 | 9 | Related to VimTip303 |vtw-303| 10 | 11 | In vimrc: 12 | 13 | > 14 | set statusline=\t%{ShowTab()}\ %P 15 | fu ShowTab() 16 | let TabLevel = (indent('.') / &ts ) 17 | if TabLevel == 0 18 | let TabLevel='*' 19 | endif 20 | return TabLevel 21 | endf 22 | < 23 | 24 | COMMENTS *vtw-477-comments* 25 | 26 | > 27 | fu ShowTab() 28 | return (indent('.') / &ts ) 29 | endf 30 | < 31 | 32 | ============================================================================== 33 | 34 | > 35 | s/ts/sw/ 36 | < 37 | 38 | ============================================================================== 39 | 40 | CATEGORIES *vtw-477-cats* 41 | 42 | Review |vtw-by-category-review| 43 | Indenting |vtw-by-category-indenting| 44 | Options |vtw-by-category-options| 45 | 46 | 47 | vim:tw=78:et:ft=help:norl: -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Vim Tips Wiki 2 | **1500+** tips downloaded from [Vim Tips Wiki](https://vim.fandom.com/wiki/Vim_Tips_Wiki), parsed and formatted to look and work like native Vim help files. 3 | 4 | You can use `:helpgrep` to search tips, `Ctrl-]` to jump tags and `gO` (thats capital o) to see table of contents. All tips are numbered and tagged in a format `vtw-N` where `N` is number of a tip. 5 | 6 | Try `:help vtw-1`. Checkout plugin help `:h vim-wiki-tips`, theres lists of tips sorted by order, alphabet and category. And there is command `:RandomVimTip` that opens random tip. 7 | 8 | **Note**: this plugin is *not* related to [vimwiki](https://github.com/vimwiki/vimwiki) (amazing plugin btw). 9 | 10 | ![Screenshot](https://github.com/DanilaMihailov/vim-wiki-tips/blob/master/screenshots/preview.png?raw=true) (*color scheme gruvbox, light variant*) 11 | 12 | ## Installation 13 | 14 | ### [vim-plug](https://github.com/junegunn/vim-plug) 15 | 1. Add the following configuration to your `.vimrc`. 16 | 17 | Plug 'danilamihailov/vim-tips-wiki' 18 | 19 | 2. Install with `:PlugInstall`. 20 | 21 | Or use your favorite plugin manager 22 | 23 | ## Why, though? 24 | Sometimes I find myself using `:helpgrep` and not finding what I am looking for, often because I did not use correct word or phrase. I hope that having 1500+ tips written by users will help solve this problem. 25 | -------------------------------------------------------------------------------- /doc/vim-tips-wiki-1023.txt: -------------------------------------------------------------------------------- 1 | *vim-tips-wiki-1023.txt* Go to alternate file or next file if no alternate *vtw-1023* 2 | 3 | Tip 1023 [https://vim.fandom.com/wiki/Go_to_alternate_file_or_next_file_if_no_alternate] Previous |vtw-1021| Next |vtw-1025| 4 | 5 | created October 23, 2005 · complexity intermediate · author Yakov Lerner · 6 | version 6.0 7 | 8 | ============================================================================== 9 | 10 | > 11 | " Ctrl-^ is very handy command in normal mode. Ctrl-^ 12 | " switches to "alternate file". When there is no "alternate file", 13 | " I wanted Ctrl-^ to jump to next file in the list. 14 | " Insert following commands into your vimrc, then 15 | " Ctrl-^ will be enhanced so that when there is no alternate file 16 | " but there is next file, it will jump to the next file. 17 | " My remapping of . If there is no alternate file, then switch to next file. 18 | function! MySwitch() 19 | if expand('#')=="" | silent! next 20 | else 21 | exe "normal! \" 22 | endif 23 | endfu 24 | map  :call MySwitch() 25 | < 26 | 27 | COMMENTS *vtw-1023-comments* 28 | 29 | CATEGORIES *vtw-1023-cats* 30 | 31 | Review |vtw-by-category-review| 32 | 33 | 34 | vim:tw=78:et:ft=help:norl: -------------------------------------------------------------------------------- /doc/vim-tips-wiki-682.txt: -------------------------------------------------------------------------------- 1 | *vim-tips-wiki-682.txt* Errorformat for Intel ifort *vtw-682* 2 | 3 | 4 | 5 | 6 | 7 | This tip is very similar to the following: 8 | - VimTip1575 |vtw-1575| 9 | 10 | 11 | These tips need to be merged – see the merge guidelines 12 | [https://vim.fandom.com/wiki/Vim_Tips_Wiki:Merge_guidelines].Tip 682 [https://vim.fandom.com/wiki/Errorformat_for_Intel_ifort] Previous |vtw-681| Next |vtw-683| 13 | 14 | created 2004 · complexity basic · author Chris Hennes · version 5.7 15 | 16 | ============================================================================== 17 | 18 | Intel changed the errorformat for their Fortran compiler with version 8.0. An 19 | errorformat string that works with the new compiler is: 20 | 21 | > 22 | set efm=%E%.%#rror:\ %f\\,\ line\ %l:\ %m,\%-C%.%#,\%-Z\%p^ 23 | < 24 | 25 | Note that you may have to change your `isfilename` string to not allow 26 | commas, like this: 27 | 28 | > 29 | let isf="@,48-57,/,.,-,_,+,#,^,,$,%,~,=" 30 | < 31 | 32 | COMMENTS *vtw-682-comments* 33 | 34 | CATEGORIES *vtw-682-cats* 35 | 36 | Duplicate |vtw-by-category-duplicate| 37 | Compiler |vtw-by-category-compiler| 38 | LanguageSpecific |vtw-by-category-languagespecific| 39 | 40 | 41 | vim:tw=78:et:ft=help:norl: -------------------------------------------------------------------------------- /doc/vim-tips-wiki-876.txt: -------------------------------------------------------------------------------- 1 | *vim-tips-wiki-876.txt* Selecting blocks of paragraphs *vtw-876* 2 | 3 | Tip 876 [https://vim.fandom.com/wiki/Selecting_blocks_of_paragraphs] Previous |vtw-875| Next |vtw-878| 4 | 5 | created 2005 · complexity basic · author Dane Summers · version 6.0 6 | 7 | ============================================================================== 8 | 9 | Here are two mappings that help copy SQL queries from gvim to other 10 | applications running under Windows. 11 | 12 | > 13 | "Select all of current paragraph. 14 | :map (V) 15 | 16 | "Copy all of current paragraph to clipboard. 17 | :map (V)*y'' 18 | < 19 | 20 | TO DO Fix above: 21 | 22 | COMMENTS *vtw-876-comments* 23 | 24 | You can select a paragraph by typing `vip` or `vap` 25 | 26 | See :help |v_ip| (vip = visual inner paragraph). 27 | 28 | In general, use :help v_ for help on in visual mode. 29 | 30 | Or :help c_ for the command line, or :help i_ for insert 31 | mode. 32 | 33 | ============================================================================== 34 | 35 | CATEGORIES *vtw-876-cats* 36 | 37 | Review |vtw-by-category-review| 38 | Todo |vtw-by-category-todo| 39 | 40 | 41 | vim:tw=78:et:ft=help:norl: -------------------------------------------------------------------------------- /doc/vim-tips-wiki-405.txt: -------------------------------------------------------------------------------- 1 | *vim-tips-wiki-405.txt* ShowBlockName one-liner equivalent for one coding style *vtw-405* 2 | 3 | Tip 405 [https://vim.fandom.com/wiki/ShowBlockName_one-liner_equivalent_for_one_coding_style] Previous |vtw-404| Next |vtw-406| 4 | 5 | created January 17, 2003 · complexity intermediate · author William Natter · 6 | version 6.0 7 | 8 | ============================================================================== 9 | 10 | I use [[ and its look-alikes a lot for browsing my C++ code. You can use 11 | ShowLine() and the following mapping to obtain something close to 12 | ShowBlockName (and it's pretty fast): 13 | 14 | > 15 | map z[ [[k:call ShowLine()`` 16 | < 17 | 18 | REFERENCES *vtw-405-references* 19 | - :help |[[| 20 | - :help |``| 21 | 22 | 23 | COMMENTS *vtw-405-comments* 24 | 25 | ShowLine() is not built in to Vim. 26 | 27 | Guessing from the vague original tip, I would say that this tip is meant to be a supplement to script#381 (ShowLine.vim). 28 | 29 | ============================================================================== 30 | 31 | CATEGORIES *vtw-405-cats* 32 | 33 | Review |vtw-by-category-review| 34 | C |vtw-by-category-c| 35 | 36 | 37 | vim:tw=78:et:ft=help:norl: -------------------------------------------------------------------------------- /doc/vim-tips-wiki-328.txt: -------------------------------------------------------------------------------- 1 | *vim-tips-wiki-328.txt* Vim in Microsoft Visual Foxpro *vtw-328* 2 | 3 | Tip 328 [https://vim.fandom.com/wiki/Vim_in_Microsoft_Visual_Foxpro] Previous |vtw-325| Next |vtw-330| 4 | 5 | created September 18, 2002 · complexity basic · author Stanislav Sitar · 6 | version 5.7 7 | 8 | ============================================================================== 9 | 10 | You can tell Microsoft Visual FoxPro 11 | [http://en.wikipedia.org/wiki/Visual_FoxPro] to use an external editor for 12 | editing project files. 13 | 14 | To tell MS VFP to use Vim, use regedit to locate: 15 | 16 | [HKEY_CURRENT_USER\Software\Microsoft\VisualFoxPro\5.0\Options] 17 | 18 | and create a new item 19 | 20 | > 21 | TEDIT 22 | < 23 | 24 | with string content 25 | 26 | > 27 | "/N C:\Progra~1\vim\vim61\gvim.exe" 28 | < 29 | 30 | (or whatever your path to Vim happens to be). 31 | 32 | This will not replace the internal VFP editor for such things as modifying 33 | the "click method" for a button (unfortunately), but when you modify a 34 | program, VFP will fire up gvim. 35 | 36 | COMMENTS *vtw-328-comments* 37 | 38 | CATEGORIES *vtw-328-cats* 39 | 40 | Review |vtw-by-category-review| 41 | Integration |vtw-by-category-integration| 42 | 43 | 44 | vim:tw=78:et:ft=help:norl: -------------------------------------------------------------------------------- /doc/vim-tips-wiki-582.txt: -------------------------------------------------------------------------------- 1 | *vim-tips-wiki-582.txt* Quick save *vtw-582* 2 | 3 | Tip 582 [https://vim.fandom.com/wiki/Quick_save] Previous |vtw-581| Next |vtw-583| 4 | 5 | created 2003 · complexity basic · version 5.7 6 | 7 | ============================================================================== 8 | 9 | To easily save the current file, while keeping it open, use a mapping in your 10 | vimrc [https://vim.fandom.com/wiki/Vimrc]: 11 | 12 | > 13 | noremap s :update 14 | < 15 | 16 | With the default leader key, just press `\s` to save any changes to the 17 | current file. If the buffer has not been modified since the last save, the 18 | file is not written. 19 | 20 | On many Windows systems, the file mswin.vim is sourced when Vim starts. In 21 | that case, Ctrl-S is mapped to `:update`, so the above mapping is not 22 | necessary (press Ctrl-S to save). 23 | 24 | REFERENCES *vtw-582-references* 25 | - :help |:update| command to save file if changed 26 | - :help 'autowrite' option to automatically save file before certain commands 27 | 28 | 29 | COMMENTS *vtw-582-comments* 30 | 31 | CATEGORIES *vtw-582-cats* 32 | 33 | Usage |vtw-by-category-usage| 34 | 35 | 36 | vim:tw=78:et:ft=help:norl: -------------------------------------------------------------------------------- /doc/vim-tips-wiki-1309.txt: -------------------------------------------------------------------------------- 1 | *vim-tips-wiki-1309.txt* Safari style keybindings for tab navigation *vtw-1309* 2 | 3 | Tip 1309 [https://vim.fandom.com/wiki/Safari_style_keybindings_for_tab_navigation] Previous |vtw-1308| Next |vtw-1311| 4 | 5 | created 2006 · complexity basic · version 6.0 6 | 7 | ============================================================================== 8 | 9 | Tab navigation for those of us using Macs, and used to the way Safari does 10 | it. Inspired by VimTip1221 |vtw-1221|. 11 | 12 | Add the following to your .gvimrc, restart gvim/vim7.0 and use the following 13 | keys: 14 | - : New Tab 15 | - : Next Tab 16 | - : Previous Tab 17 | 18 | 19 | > 20 | "custom tab stuff 21 | " tab navigation like safari 22 | " idea adopted from: [[VimTip1221]] 23 | :nmap  :tabprevious 24 | :nmap  :tabnext 25 | :map  :tabprevious 26 | :map  :tabnext 27 | :imap :tabpreviousi 28 | :imap :tabnexti 29 | :nmap  :tabnew 30 | :imap :tabnew 31 | < 32 | 33 | COMMENTS *vtw-1309-comments* 34 | 35 | CATEGORIES *vtw-1309-cats* 36 | 37 | Mac OS X |vtw-by-category-mac-os-x| 38 | Tabs |vtw-by-category-tabs| 39 | 40 | 41 | vim:tw=78:et:ft=help:norl: -------------------------------------------------------------------------------- /doc/vim-tips-wiki-1590.txt: -------------------------------------------------------------------------------- 1 | *vim-tips-wiki-1590.txt* Editing a hard link to a file *vtw-1590* 2 | 3 | Tip 1590 [https://vim.fandom.com/wiki/Editing_a_hard_link_to_a_file] Previous |vtw-1589| Next |vtw-1591| 4 | 5 | created 6 | [https://vim.fandom.com/wiki/Vim_Tips_Wiki:New_tips/200802#Editing_a_hard_link_to_a_file] 7 | 2008 · complexity basic · author Metacosm · version 7.0 8 | 9 | ============================================================================== 10 | 11 | On Unix-based systems, the shell command `ln x y` creates `y` as a hard link 12 | to file `x`. There is only a single file, so if you edit `y`, you will also 13 | change `x`. 14 | 15 | If wanted, you can configure Vim so that it will break hard links whenever a 16 | file is written, providing a backup is made. In that case, editing `y` would 17 | automatically remove the link, and create a separate file, leaving `x` 18 | unchanged. The Vim command (in vimrc [https://vim.fandom.com/wiki/Vimrc]) is: 19 | 20 | > 21 | set backupcopy=auto,breakhardlink 22 | < 23 | 24 | REFERENCES *vtw-1590-references* 25 | - :help 'backup' 26 | - :help 'backupcopy' 27 | 28 | 29 | COMMENTS *vtw-1590-comments* 30 | 31 | CATEGORIES *vtw-1590-cats* 32 | 33 | 34 | 35 | vim:tw=78:et:ft=help:norl: -------------------------------------------------------------------------------- /doc/vim-tips-wiki-864.txt: -------------------------------------------------------------------------------- 1 | *vim-tips-wiki-864.txt* Make arrow keys work in visual mode under Windows *vtw-864* 2 | 3 | Tip 864 [https://vim.fandom.com/wiki/Make_arrow_keys_work_in_visual_mode_under_Windows] Previous |vtw-863| Next |vtw-868| 4 | 5 | created 2005 · complexity basic · version 6.0 6 | 7 | ============================================================================== 8 | 9 | On Windows, new users may notice that the arrow keys end visual mode rather 10 | than extending the selection. 11 | 12 | If this happens, it is because of the `behave mswin` line in the default 13 | _vimrc installed on a Windows system. 14 | 15 | The best solution is to simply remove this line from the global _vimrc, or to 16 | create your own _vimrc without it. 17 | 18 | However, if you like most of the effects of `behave mswin` (see :help 19 | |behave|) and only want to "fix" the visual selection behavior, simply put 20 | this into your vimrc after the `behave mswin`: 21 | 22 | > 23 | set keymodel-=stopsel 24 | < 25 | 26 | REFERENCES *vtw-864-references* 27 | - :help |:behave| 28 | - :help 'keymodel' 29 | 30 | 31 | COMMENTS *vtw-864-comments* 32 | 33 | CATEGORIES *vtw-864-cats* 34 | 35 | Windows |vtw-by-category-windows| 36 | 37 | 38 | vim:tw=78:et:ft=help:norl: -------------------------------------------------------------------------------- /doc/vim-tips-wiki-1321.txt: -------------------------------------------------------------------------------- 1 | *vim-tips-wiki-1321.txt* Fold a C sharp region *vtw-1321* 2 | 3 | Tip 1321 [https://vim.fandom.com/wiki/Fold_a_C_sharp_region] Previous |vtw-1320| Next |vtw-1322| 4 | 5 | created 2006 · complexity basic · author John Cena · version 6.0 6 | 7 | ============================================================================== 8 | 9 | Here is how to fold the following region by typing `zf%` 10 | 11 | > 12 | #region 13 | ... 14 | #endregion 15 | < 16 | 17 | Just add the following line in your cs.vim file placed in syntax folder 18 | beneath your vimruntime path. 19 | 20 | > 21 | let b:match_words = '\s*#\s*region.*$:\s*#\s*endregion' 22 | < 23 | 24 | It works even if the cursor is not on the "#region" keyword. 25 | 26 | REFERENCES *vtw-1321-references* 27 | - :help 'matchpairs' 28 | 29 | 30 | COMMENTS *vtw-1321-comments* 31 | 32 | And copy the "matchit.vim" file from your macros folder to plugin folder for 33 | it to automatically load everytime a window opens. 34 | 35 | ============================================================================== 36 | 37 | CATEGORIES *vtw-1321-cats* 38 | 39 | C sharp |vtw-by-category-c-sharp| 40 | Plugin |vtw-by-category-plugin| 41 | 42 | 43 | vim:tw=78:et:ft=help:norl: -------------------------------------------------------------------------------- /doc/vim-tips-wiki-148.txt: -------------------------------------------------------------------------------- 1 | *vim-tips-wiki-148.txt* Make great use of those homemade menus *vtw-148* 2 | 3 | Tip 148 [https://vim.fandom.com/wiki/Make_great_use_of_those_homemade_menus] Previous |vtw-147| Next |vtw-149| 4 | 5 | created October 24, 2001 · complexity basic · author Rex Byrns · version 6.0 6 | 7 | ============================================================================== 8 | 9 | I accidentally discovered that using (e.g 10 | b - for the buffer menu) causes the menu to break out in a separate 11 | window. 12 | 13 | Selecting the menu with the mouse and then hitting enter does not seem to do 14 | it. 15 | 16 | I will have to learn to add hotletters to my menus now so that the mouse can 17 | take a break. 18 | 19 | COMMENTS *vtw-148-comments* 20 | 21 | I suspect you're referring to the tearoff capability of the gui menus. your 22 | 'guioptions' must include a 't' in the value for them to be enabled. they are 23 | the very first thing (looks like a small pair of scissors surrounded by 24 | hyphens) in each menu and CAN be clicked with the mouse also. 25 | 26 | ============================================================================== 27 | 28 | CATEGORIES *vtw-148-cats* 29 | 30 | Review |vtw-by-category-review| 31 | 32 | 33 | vim:tw=78:et:ft=help:norl: -------------------------------------------------------------------------------- /doc/vim-tips-wiki-1506.txt: -------------------------------------------------------------------------------- 1 | *vim-tips-wiki-1506.txt* Swap LHS and RHS of an Assignment statement *vtw-1506* 2 | 3 | Tip 1506 [https://vim.fandom.com/wiki/Swap_LHS_and_RHS_of_an_Assignment_statement] Previous |vtw-1505| Next |vtw-1507| 4 | 5 | created 6 | [https://vim.fandom.com/wiki/Vim_Tips_Wiki:New_tips/200712#Swap_LHS_and_RHS_of_an_Assignment_statement] 7 | 2007 · complexity basic · author Mike Brotherston · version 7.0 8 | 9 | ============================================================================== 10 | 11 | Suppose you have a statement (C/C++/Java/etc): 12 | 13 | > 14 | alpha = beta; 15 | < 16 | 17 | and you want to change it to: 18 | 19 | > 20 | beta = alpha; 21 | < 22 | 23 | Try this mapping: 24 | 25 | > 26 | noremap  :s/\([^ =]*\)\([ ]*\)=[ ]*\([^;]*\);/\3 = \1;/:nohl 27 | < 28 | 29 | may cause Unix terminals to suspend. Replace with or something 30 | easy to remember for your own purposes. 31 | 32 | This mucks with your current matched highlighting selections; thus the 33 | trailing `:nohl`. If someone knows how to do this without mucking with the 34 | incremental searches jot it down. 35 | 36 | COMMENTS *vtw-1506-comments* 37 | 38 | CATEGORIES *vtw-1506-cats* 39 | 40 | LanguageSpecific |vtw-by-category-languagespecific| 41 | 42 | 43 | vim:tw=78:et:ft=help:norl: -------------------------------------------------------------------------------- /doc/vim-tips-wiki-156.txt: -------------------------------------------------------------------------------- 1 | *vim-tips-wiki-156.txt* Describe a SQL table from Vim *vtw-156* 2 | 3 | Tip 156 [https://vim.fandom.com/wiki/Describe_a_SQL_table_from_Vim] Previous |vtw-155| Next |vtw-158| 4 | 5 | created November 7, 2001 · complexity basic · author Demian L. Neidetcher · 6 | version 5.7 7 | 8 | ============================================================================== 9 | 10 | Here is a bash script to call from Vim, when you want information about a 11 | table while you are editing SQL code. Put the script in a file named describe. 12 | 13 | > 14 | #!/usr/bin/bash 15 | 16 | f=aTempFile.sql 17 | u= 18 | p= 19 | d= 20 | 21 | echo "/* describe for $1" 22 | echo "describe $1;" > $f; 23 | echo "quit;" >> $f; 24 | 25 | sqlplus -S $u/$p@$d @$f 26 | rm -f $f; 27 | echo " end describe for $1 */" 28 | < 29 | 30 | Your path needs to include the script (as well as sqlplus), then from Vim you 31 | type: 32 | 33 | > 34 | :r !describe 35 | < 36 | 37 | That inserts a listing of the table columns, complete with Java/C comments. 38 | 39 | COMMENTS *vtw-156-comments* 40 | 41 | CATEGORIES *vtw-156-cats* 42 | 43 | Review |vtw-by-category-review| 44 | SQL |vtw-by-category-sql| 45 | 46 | 47 | vim:tw=78:et:ft=help:norl: -------------------------------------------------------------------------------- /doc/vim-tips-wiki-615.txt: -------------------------------------------------------------------------------- 1 | *vim-tips-wiki-615.txt* Moving to the next word in insert mode *vtw-615* 2 | 3 | Tip 615 [https://vim.fandom.com/wiki/Moving_to_the_next_word_in_insert_mode] Previous |vtw-614| Next |vtw-616| 4 | 5 | created 2003 · complexity basic · author kallumama · version 5.7 6 | 7 | ============================================================================== 8 | 9 | You can move to the next word in insert mode using 10 | 11 | You can move to the next word in normal mode using `w` 12 | 13 | You can move to the previous word in insert mode using 15 | 16 | COMMENTS *vtw-615-comments* 17 | 18 | This is true when not using :behave mswin. and will work 19 | in either case. 20 | 21 | ============================================================================== 22 | 23 | Not quite. differs depending on whether you are in insert mode or 24 | not. 25 | 26 | normal mode: moves by WORDS (like ":normal W") :help || 27 | 28 | insert mode: moves by words (like ":normal w") :help |i_| 29 | 30 | ============================================================================== 31 | 32 | CATEGORIES *vtw-615-cats* 33 | 34 | Review |vtw-by-category-review| 35 | 36 | 37 | vim:tw=78:et:ft=help:norl: -------------------------------------------------------------------------------- /doc/vim-tips-wiki-168.txt: -------------------------------------------------------------------------------- 1 | *vim-tips-wiki-168.txt* Viewing the actual XPM data in GVIM *vtw-168* 2 | 3 | Tip 168 [https://vim.fandom.com/wiki/Viewing_the_actual_XPM_data_in_GVIM] Previous |vtw-167| Next |vtw-171| 4 | 5 | created 2001 · complexity basic · author Carl Lunde · version 6.0 6 | 7 | ============================================================================== 8 | 9 | Gvim has an excellent syntax highlighting for XPM images, but sometimes it's 10 | useful to view the actual data. This can be achieved by searching for 11 | everything, type in "/." and all characters will be highlighted and therefore 12 | the old colouring is lost. To regain the normal highlighting you can search 13 | for a non-existent sequence, like "/foo". 14 | 15 | COMMENTS *vtw-168-comments* 16 | 17 | This requires search highlighting to be turned on, see VimTip14 |vtw-14| (or 18 | just type :set hlsearch). It should also work with 5.7 19 | 20 | ============================================================================== 21 | 22 | Instead of searching for something nonexistant like /foo, just type :noh (for 23 | no highlighting) 24 | 25 | ============================================================================== 26 | 27 | CATEGORIES *vtw-168-cats* 28 | 29 | Review |vtw-by-category-review| 30 | 31 | 32 | vim:tw=78:et:ft=help:norl: -------------------------------------------------------------------------------- /doc/vim-tips-wiki-1103.txt: -------------------------------------------------------------------------------- 1 | *vim-tips-wiki-1103.txt* Fix scrolling when using Trackpoint *vtw-1103* 2 | 3 | Tip 1103 [https://vim.fandom.com/wiki/Fix_scrolling_when_using_Trackpoint] Previous |vtw-1092| Next |vtw-1107| 4 | 5 | created January 11, 2006 · complexity basic · author Marcus Keinath · version 6 | 5.7 7 | 8 | ============================================================================== 9 | 10 | If you are using a pointing device called Trackpoint (or TouchStyk as 11 | Synaptics calls it) you might encounter a problem with scrolling in gvim: When 12 | you use split windows, the scrolling function will always scroll one window 13 | regardless of where the cursor is. 14 | 15 | To correct this (works for me with the Synaptics driver version 08/01/2005, 16 | 8.1.2.0): 17 | - Backup the file tp4table.dat in C:\Programme\Synaptics\SynTP 18 | - Edit the file tp4table.dat in C:\Programme\Synaptics\SynTP as below – insert 19 | at line 128 (after Java support) 20 | 21 | 22 | > 23 | ; gvim support 24 | *,*,gvim.exe,*,*,*,WheelStd,0,9 25 | < 26 | 27 | After restarting SynTPEnh.exe (e.g. rebooting), it will work. 28 | 29 | COMMENTS *vtw-1103-comments* 30 | 31 | CATEGORIES *vtw-1103-cats* 32 | 33 | Review |vtw-by-category-review| 34 | Windows |vtw-by-category-windows| 35 | 36 | 37 | vim:tw=78:et:ft=help:norl: -------------------------------------------------------------------------------- /doc/vim-tips-wiki-575.txt: -------------------------------------------------------------------------------- 1 | *vim-tips-wiki-575.txt* Chop long lines *vtw-575* 2 | 3 | Tip 575 [https://vim.fandom.com/wiki/Chop_long_lines] Previous |vtw-573| Next |vtw-576| 4 | 5 | created October 4, 2003 · complexity basic · author mosh · version 6.0 6 | 7 | ============================================================================== 8 | 9 | > 10 | " Some regexp substitutions for your menus from vimrc 11 | :amenu Mo1.Format.ChopLongLines :%s!\(.\{-80,}\)\s!\1\r!gc 12 | :amenu Mo1.Format.JoinHypenatedLines :%s,\v\s+(\w+)-\n(\s*)(\S+)\s*, \1\3^M\2,gc 13 | :amenu Mo1.Format.JoinBackSlashLines :%s,\\\n,,gc 14 | < 15 | 16 | COMMENTS *vtw-575-comments* 17 | 18 | As far as chopping lines goes, look at man fmt. Note that fmt chops lines to 19 | 72 (or is it 75?) by default. You can also set it using fmt flag. 20 | 21 | Chop long lines from line 1 to 10 22 | 23 | > 24 | :1,10!fmt 25 | < 26 | 27 | Also, you can do visual block and use fmt! (this is the best part): 28 | - 'v' to start visual mode in command mode. 29 | - select a block 30 | - then type '!fmt' 31 | 32 | 33 | ============================================================================== 34 | 35 | CATEGORIES *vtw-575-cats* 36 | 37 | Review |vtw-by-category-review| 38 | 39 | 40 | vim:tw=78:et:ft=help:norl: -------------------------------------------------------------------------------- /doc/vim-tips-wiki-631.txt: -------------------------------------------------------------------------------- 1 | *vim-tips-wiki-631.txt* Disabling IME input in Windows *vtw-631* 2 | 3 | Tip 631 [https://vim.fandom.com/wiki/Disabling_IME_input_in_Windows] Previous |vtw-630| Next |vtw-632| 4 | 5 | created January 4, 2004 · complexity basic · author Avery M. · version 5.7 6 | 7 | ============================================================================== 8 | 9 | Often, your Windows locale will reflect a foreign country (e.g. Japan) so you 10 | can write text in another character set, but you don't want Vim to do that by 11 | default. It is annoying to have to disable IME input every time you start up 12 | Vim. But it's much easier than that. Simply add this line to your vimrc: 13 | 14 | > 15 | set iminsert=0 16 | < 17 | 18 | Now, you will start out in regular Roman input mode, without IME. 19 | 20 | COMMENTS *vtw-631-comments* 21 | 22 | imcmdline and imsearch can also be disabled in the same way. 23 | 24 | ============================================================================== 25 | 26 | > 27 | set imdisable 28 | < 29 | 30 | ============================================================================== 31 | 32 | CATEGORIES *vtw-631-cats* 33 | 34 | Review |vtw-by-category-review| 35 | I18n |vtw-by-category-i18n| 36 | Windows |vtw-by-category-windows| 37 | 38 | 39 | vim:tw=78:et:ft=help:norl: -------------------------------------------------------------------------------- /doc/vim-tips-wiki-1010.txt: -------------------------------------------------------------------------------- 1 | *vim-tips-wiki-1010.txt* Change C++ comments to C comments *vtw-1010* 2 | 3 | Tip 1010 [https://vim.fandom.com/wiki/Change_C%2B%2B_comments_to_C_comments] Previous |vtw-1009| Next |vtw-1012| 4 | 5 | created 2005 · complexity basic · author Frans · version 6.0 6 | 7 | ============================================================================== 8 | 9 | Developers and users will often have a need to change one pattern of text to 10 | match a different pattern. This can be completed using a key map and a regular 11 | expression. For example some development requires developers to be MISRA 12 | compliant. One of the MISRA rules is `//-style-comments` are not acceptable. 13 | These occurrences must be replaced by `/*-style-comments-*/`. Adding the 14 | following mapping to the vimrc file will do this per line. 15 | 16 | > 17 | :map /\/\/xxi/*A*/ 18 | < 19 | 20 | This will do the action per found line. Start at the beginning of the file, 21 | and repeatedly press . Alternatively, this regular expression can be used: 22 | 23 | > 24 | :map  %s,//\(.*\),/*\1 */, 25 | < 26 | 27 | COMMENTS *vtw-1010-comments* 28 | 29 | CATEGORIES *vtw-1010-cats* 30 | 31 | Text processing |vtw-by-category-text-processing| 32 | Usage |vtw-by-category-usage| 33 | 34 | 35 | vim:tw=78:et:ft=help:norl: -------------------------------------------------------------------------------- /doc/vim-tips-wiki-742.txt: -------------------------------------------------------------------------------- 1 | *vim-tips-wiki-742.txt* Change filetype based on directory path *vtw-742* 2 | 3 | Tip 742 [https://vim.fandom.com/wiki/Change_filetype_based_on_directory_path] Previous |vtw-741| Next |vtw-743| 4 | 5 | created 2004 · complexity basic · author Michael Pyne · version 6.0 6 | 7 | ============================================================================== 8 | 9 | I recently installed pyblosxom to do blogging, using Vim to edit blog posts. 10 | Pyblosxom automatically transforms .txt files under a certain path into HTML, 11 | RSS, or whatever else is appropriate. These .txt files will probably contain 12 | HTML, so if you would like to tell Vim to use a different syntax highlighting 13 | style for files under a directory path, try adding this to your vimrc 14 | [https://vim.fandom.com/wiki/Vimrc]: 15 | 16 | > 17 | autocmd BufRead,BufNewFile ~/.pyblosxom/data/* set syntax=html 18 | < 19 | 20 | COMMENTS *vtw-742-comments* 21 | 22 | As an aside, another way to go about this would be a user command that gives 23 | you a skeleton entry, saved and named (for instance current time/date stamp) 24 | as you desire with your cursor placed where you want. File format, patch mode 25 | and other such options can be set as desired as well. 26 | 27 | CATEGORIES *vtw-742-cats* 28 | 29 | 30 | 31 | vim:tw=78:et:ft=help:norl: -------------------------------------------------------------------------------- /doc/vim-tips-wiki-1090.txt: -------------------------------------------------------------------------------- 1 | *vim-tips-wiki-1090.txt* Get inline help for PHP functions *vtw-1090* 2 | 3 | Tip 1090 [https://vim.fandom.com/wiki/Get_inline_help_for_PHP_functions] Previous |vtw-1088| Next |vtw-1092| 4 | 5 | created December 28, 2005 · complexity basic · author Max S. Ivanov · version 6 | 6.0 7 | 8 | ============================================================================== 9 | 10 | Do you want to get inline help for PHP functions? Use this extremely simple 11 | command: 12 | 13 | > 14 | map "vyiw:new:execute "r!lynx -dump http://localhost/phpman/function.".@v.".html":1 15 | < 16 | 17 | Place the cursor on a PHP function name and press . You will see a new 18 | window open with a textual help page. 19 | 20 | Of course you have to install httpd, the php documentation, and the lynx text 21 | web browser. 22 | 23 | COMMENTS *vtw-1090-comments* 24 | 25 | See also VimTip598 |vtw-598|. 26 | 27 | ============================================================================== 28 | 29 | ManPageView script#489 [https://www.vim.org/scripts/script.php?script_id=489] 30 | also supports PHP help. 31 | 32 | ============================================================================== 33 | 34 | CATEGORIES *vtw-1090-cats* 35 | 36 | Review |vtw-by-category-review| 37 | 38 | 39 | vim:tw=78:et:ft=help:norl: -------------------------------------------------------------------------------- /doc/vim-tips-wiki-650.txt: -------------------------------------------------------------------------------- 1 | *vim-tips-wiki-650.txt* Abbreviation that prompts whether to expand it or not *vtw-650* 2 | 3 | Tip 650 [https://vim.fandom.com/wiki/Abbreviation_that_prompts_whether_to_expand_it_or_not] Previous |vtw-649| Next |vtw-651| 4 | 5 | created February 4, 2004 · complexity basic · author Yakov Lerner · version 6 | 6.0 7 | 8 | ============================================================================== 9 | 10 | You can define an abbreviation in such a way that it will ask whether to 11 | expand it or not. The trick is to define it as an expression, then have that 12 | expression ask for confirmation: 13 | 14 | > 15 | function! s:Ask(abbr,expansion,defprompt) 16 | let answer = confirm("Expand '" . a:abbr . "'?", "&Yes\n&No", a:defprompt) 17 | " testing against 1 and not 2, I correctly take care of 18 | return answer == 1 ? a:expansion : a:abbr 19 | endfunction 20 | 21 | iabbrev for Ask('for', "for () {\n}", 2) 22 | < 23 | 24 | REFERENCES *vtw-650-references* 25 | - :help |:iabbrev| 26 | - :help |:map-expression| 27 | 28 | 29 | COMMENTS *vtw-650-comments* 30 | 31 | CATEGORIES *vtw-650-cats* 32 | 33 | Abbreviations |vtw-by-category-abbreviations| 34 | Map |vtw-by-category-map| 35 | 36 | 37 | vim:tw=78:et:ft=help:norl: -------------------------------------------------------------------------------- /doc/vim-tips-wiki-734.txt: -------------------------------------------------------------------------------- 1 | *vim-tips-wiki-734.txt* Fix the x command in virtualedit mode *vtw-734* 2 | 3 | Tip 734 [https://vim.fandom.com/wiki/Fix_the_x_command_in_virtualedit_mode] Previous |vtw-733| Next |vtw-735| 4 | 5 | created 2004 · complexity basic · author Yakov Lerner · version 6.0 6 | 7 | ============================================================================== 8 | 9 | This tip is useful only for those who use virtualedit mode (`set 10 | virtualedit=all`, or `set ve=all`). 11 | 12 | I like virtualedit mode except for behaviour of '`x`' (delete character). 13 | When '`x`' is used past end-of-line, it does nothing. I wanted it to jump left 14 | to the actual end-of-line so as to start deleting characters there. Below is 15 | '`x`' redefinition that does exactly this; and it does not break '`x`' in 16 | non-virtualedit mode: 17 | 18 | > 19 | " redefine x for virtualEdit so that past end of line, it jumps left to end-of-line 20 | function! Redefine_x_ForVirtualEdit() 21 | if &ve != "" && col('.') >= col('$') 22 | normal $ 23 | endif 24 | endfu! 25 | silent! unmap x 26 | :nnoremap x x:call Redefine_x_ForVirtualEdit() 27 | < 28 | 29 | COMMENTS *vtw-734-comments* 30 | 31 | CATEGORIES *vtw-734-cats* 32 | 33 | Review |vtw-by-category-review| 34 | 35 | 36 | vim:tw=78:et:ft=help:norl: -------------------------------------------------------------------------------- /doc/vim-tips-wiki-498.txt: -------------------------------------------------------------------------------- 1 | *vim-tips-wiki-498.txt* Completion using a syntax file *vtw-498* 2 | 3 | Tip 498 [https://vim.fandom.com/wiki/Completion_using_a_syntax_file] Previous |vtw-495| Next |vtw-502| 4 | 5 | created 2003 · complexity intermediate · author Daniel Molina · version 6.0 6 | 7 | ============================================================================== 8 | 9 | To complete syntax words, you can use omnicompletion: 10 | 11 | > 12 | setlocal omnifunc=syntaxcomplete#Complete 13 | < 14 | 15 | And then CTRL-X CTRL-O to activate completion. 16 | 17 | A more robust solution from :help |ft-syntax-omni| 18 | 19 | > 20 | if has("autocmd") && exists("+omnifunc") 21 | autocmd Filetype * 22 | \ if &omnifunc == "" | 23 | \ setlocal omnifunc=syntaxcomplete#Complete | 24 | \ endif 25 | endif 26 | < 27 | 28 | This version will avoid changing omnifunc if it's already set (presumably to 29 | something more comprehensive). 30 | 31 | SEE ALSO *vtw-498-see-also* 32 | - :help |ft-syntax-omni| 33 | - :help |complete| 34 | 35 | 36 | COMMENTS *vtw-498-comments* 37 | 38 | CATEGORIES *vtw-498-cats* 39 | 40 | Completion |vtw-by-category-completion| 41 | Syntax |vtw-by-category-syntax| 42 | 43 | 44 | vim:tw=78:et:ft=help:norl: -------------------------------------------------------------------------------- /doc/vim-tips-wiki-765.txt: -------------------------------------------------------------------------------- 1 | *vim-tips-wiki-765.txt* Completion using a syntax file *vtw-765* 2 | 3 | Tip 498 [https://vim.fandom.com/wiki/Completion_using_a_syntax_file] Previous |vtw-495| Next |vtw-502| 4 | 5 | created 2003 · complexity intermediate · author Daniel Molina · version 6.0 6 | 7 | ============================================================================== 8 | 9 | To complete syntax words, you can use omnicompletion: 10 | 11 | > 12 | setlocal omnifunc=syntaxcomplete#Complete 13 | < 14 | 15 | And then CTRL-X CTRL-O to activate completion. 16 | 17 | A more robust solution from :help |ft-syntax-omni| 18 | 19 | > 20 | if has("autocmd") && exists("+omnifunc") 21 | autocmd Filetype * 22 | \ if &omnifunc == "" | 23 | \ setlocal omnifunc=syntaxcomplete#Complete | 24 | \ endif 25 | endif 26 | < 27 | 28 | This version will avoid changing omnifunc if it's already set (presumably to 29 | something more comprehensive). 30 | 31 | SEE ALSO *vtw-765-see-also* 32 | - :help |ft-syntax-omni| 33 | - :help |complete| 34 | 35 | 36 | COMMENTS *vtw-765-comments* 37 | 38 | CATEGORIES *vtw-765-cats* 39 | 40 | Completion |vtw-by-category-completion| 41 | Syntax |vtw-by-category-syntax| 42 | 43 | 44 | vim:tw=78:et:ft=help:norl: -------------------------------------------------------------------------------- /doc/vim-tips-wiki-1009.txt: -------------------------------------------------------------------------------- 1 | *vim-tips-wiki-1009.txt* Quickly change word or line *vtw-1009* 2 | 3 | Tip 1009 [https://vim.fandom.com/wiki/Quickly_change_word_or_line] Previous |vtw-1008| Next |vtw-1010| 4 | 5 | created 2005 · complexity basic · author Anupam · version 5.7 6 | 7 | ============================================================================== 8 | 9 | To quickly change a word you can use `cw`,`caw` or `ciw`. Use `c$` or just 10 | `C` to quickly change from the cursor to the end of a line, `cc` to change an 11 | entire line, or `cis` for a sentence. 12 | 13 | The standard change word command requires you to type `cw`, then a new word, 14 | then press Escape. Using the version below, you would type `pw`, then a new 15 | word, then press Space to exit back to normal mode. Or, you would type `p$`, 16 | then a new line, then press Enter. 17 | 18 | > 19 | nmap pw :inoremap Space> Space>Esc>:iunmap lt>Space>CR> cw 20 | 21 | nmap p$ :inoremap CR> CR>Esc>:iunmap lt>CR>CR> c$ 22 | < 23 | 24 | SEE ALSO *vtw-1009-see-also* 25 | - :help |c| 26 | - :help |movement| 27 | - :help |text-objects| 28 | 29 | 30 | COMMENTS *vtw-1009-comments* 31 | 32 | CATEGORIES *vtw-1009-cats* 33 | 34 | 35 | 36 | vim:tw=78:et:ft=help:norl: -------------------------------------------------------------------------------- /doc/vim-tips-wiki-1389.txt: -------------------------------------------------------------------------------- 1 | *vim-tips-wiki-1389.txt* Trailing white space aware Delete key *vtw-1389* 2 | 3 | Tip 1389 [https://vim.fandom.com/wiki/Trailing_white_space_aware_Delete_key] Previous |vtw-1388| Next |vtw-1391| 4 | 5 | created 2006 · complexity basic · author pulp · version 6.0 6 | 7 | ============================================================================== 8 | 9 | This function will extend the 'delete key' to delete trailing white spaces 10 | and empty lines at once. Leading blanks are preserved. 11 | 12 | Tested with: Insert Mode, set virtualedit=all, set backspace=2, blanks for 13 | ident. 14 | 15 | > 16 | function! Smart_Del(...) 17 | let line=getline (".") 18 | let column = col(".") 19 | let part2= strpart(line, column-1) 20 | if part2 =~ '^\s*$' && part2!="" 21 | let part1= strpart(line, 0, column-1) 22 | call setline (".", part1) 23 | endif 24 | iunmap 25 | execute "normal i\\" 26 | if column > 1 27 | execute "normal l" 28 | endif 29 | inoremap : call Smart_Del() 30 | endfunction 31 | inoremap : call Smart_Del() 32 | < 33 | 34 | COMMENTS *vtw-1389-comments* 35 | 36 | CATEGORIES *vtw-1389-cats* 37 | 38 | Review |vtw-by-category-review| 39 | 40 | 41 | vim:tw=78:et:ft=help:norl: -------------------------------------------------------------------------------- /doc/vim-tips-wiki-652.txt: -------------------------------------------------------------------------------- 1 | *vim-tips-wiki-652.txt* Save all open buffers at once *vtw-652* 2 | 3 | Tip 652 [https://vim.fandom.com/wiki/Save_all_open_buffers_at_once] Previous |vtw-651| Next |vtw-653| 4 | 5 | created 2004 · complexity intermediate · author Andreas Berg · version 6.0 6 | 7 | ============================================================================== 8 | 9 | Vim can open multiple files, each in its own buffer. Here is how to save all 10 | changes and continue working, or save all changes and exit Vim. It is also 11 | possible to quit all (discard changes). 12 | 13 | The `:wa` and `:xa` commands only write a file when its buffer has been 14 | changed. By contrast, the `:w` command always writes the current buffer to its 15 | file (use `:update` to save the current buffer only if it has been changed). 16 | 17 | Warning: If you enter `:qa!`, Vim will discard all changes without asking 18 | "are you sure?". 19 | 20 | SEE ALSO *vtw-652-see-also* 21 | - Tutorial [https://vim.fandom.com/wiki/Tutorial] 22 | 23 | 24 | REFERENCES *vtw-652-references* 25 | - :help |window-exit| 26 | 27 | 28 | COMMENTS *vtw-652-comments* 29 | 30 | CATEGORIES *vtw-652-cats* 31 | 32 | Usage |vtw-by-category-usage| 33 | 34 | 35 | vim:tw=78:et:ft=help:norl: -------------------------------------------------------------------------------- /doc/vim-tips-wiki-409.txt: -------------------------------------------------------------------------------- 1 | *vim-tips-wiki-409.txt* Using selected text in a command *vtw-409* 2 | 3 | Tip 409 [https://vim.fandom.com/wiki/Using_selected_text_in_a_command] Previous |vtw-408| Next |vtw-410| 4 | 5 | created January 21, 2003 · complexity basic · author Lyle · version 5.7 6 | 7 | ============================================================================== 8 | 9 | I wish to use selected text as part of a command - say, to substitute 10 | instances of a very long variable with a shorter name: 11 | 12 | > 13 | :%s//ShorterName/g 14 | < 15 | 16 | How do I do that? 17 | 18 | COMMENTS *vtw-409-comments* 19 | 20 | ============================================================================== 21 | 22 | Just put the cursor over the word in your text. In the command line press 23 | the to get the word. 24 | 25 | See h: c__ 26 | 27 | ============================================================================== 28 | 29 | I have the following maps: 30 | 31 | > 32 | vmap ,g :s/// 33 | map ,g :s/// 34 | < 35 | 36 | I then just add the closing delimiter and flags and hit return. These 37 | mappings have saved me a great deal of time. 38 | 39 | ============================================================================== 40 | 41 | CATEGORIES *vtw-409-cats* 42 | 43 | 44 | 45 | vim:tw=78:et:ft=help:norl: -------------------------------------------------------------------------------- /doc/vim-tips-wiki-399.txt: -------------------------------------------------------------------------------- 1 | *vim-tips-wiki-399.txt* Fold away empty lines *vtw-399* 2 | 3 | Tip 399 [https://vim.fandom.com/wiki/Fold_away_empty_lines] Previous |vtw-398| Next |vtw-400| 4 | 5 | created 2003 · complexity basic · author Thomas · version 6.0 6 | 7 | ============================================================================== 8 | 9 | You can fold sequences of two or more empty lines (may contain whitespace) 10 | with these settings: 11 | 12 | > 13 | :syn match MyEmptyLines "\(^\s*\n\)\+" fold 14 | :syn sync fromstart 15 | :setlocal foldmethod=syntax 16 | < 17 | 18 | After entering the above, type `zM` to close all folds, or `zR` to open them. 19 | 20 | If you have set '`foldcolumn`' to more than 0 you can open/close the 21 | empty-line blocks by clicking the '+' or '-' with the mouse in the folder 22 | column. 23 | 24 | SEE ALSO *vtw-399-see-also* 25 | - Remove unwanted empty lines |vtw-72| to delete blank lines 26 | 27 | 28 | COMMENTS *vtw-399-comments* 29 | 30 | Thanks for the tip, it works indeed, but appears to be very slow. Hundreds of 31 | empty lines have been added on a file I must look at, but it takes 30s before 32 | I can view the result -any idea ? 33 | 34 | Regards, 35 | 36 | Greg 37 | 38 | CATEGORIES *vtw-399-cats* 39 | 40 | 41 | 42 | vim:tw=78:et:ft=help:norl: -------------------------------------------------------------------------------- /doc/vim-tips-wiki-510.txt: -------------------------------------------------------------------------------- 1 | *vim-tips-wiki-510.txt* Set VIMRUNTIME within vimrc *vtw-510* 2 | 3 | Tip 510 [https://vim.fandom.com/wiki/Set_VIMRUNTIME_within_vimrc] Previous |vtw-509| Next |vtw-514| 4 | 5 | created July 18, 2003 · complexity basic · author maxiangjiang · version 6.0 6 | 7 | ============================================================================== 8 | 9 | In general, $VIMRUNTIME cannot be set within vimrc. 10 | 11 | This tip is for those who want to avoid setting $VIMRUNTIME as an 12 | enviromental variable (either rc file on Unix or enviroment on Windows). 13 | 14 | I found the following steps worked on my PC and Unix: 15 | - Find out your $VIM (on Windows, it is the directory where gvim.exe lives). 16 | - Create a directory called doc under $VIM (now, we have $VIM/doc). 17 | - Copy help.txt from official $VIMRUNTIME/doc (now, we have $VIM/doc/help.txt). 18 | 19 | 20 | Now, we can set $VIMRUNTIME within vimrc, for example 21 | 22 | > 23 | let $VIMRUNTIME='C:/usr/share/vim/vim63' 24 | < 25 | 26 | I find it is useful on PC especially when I have cygwin installed, thus a 27 | single copy of VIMRUNTIME can be shared for both vi (cygwin version) and 28 | gvim.exe (win32 version). 29 | 30 | COMMENTS *vtw-510-comments* 31 | 32 | CATEGORIES *vtw-510-cats* 33 | 34 | Review |vtw-by-category-review| 35 | 36 | 37 | vim:tw=78:et:ft=help:norl: -------------------------------------------------------------------------------- /doc/vim-tips-wiki-559.txt: -------------------------------------------------------------------------------- 1 | *vim-tips-wiki-559.txt* Use Vim to expire your mail so Mutt will delete them later *vtw-559* 2 | 3 | Tip 559 [https://vim.fandom.com/wiki/Use_Vim_to_expire_your_mail_so_Mutt_will_delete_them_later] Previous |vtw-558| Next |vtw-560| 4 | 5 | created 2003 · complexity basic · author Nazri Ramliy · version 6.0 6 | 7 | ============================================================================== 8 | 9 | Mutt has a feature to list expired mails (`~E`). Sadly, there's no built in 10 | way to set the expiry date of a certain mail so I came up with a Vim mapping 11 | to manually insert the "`Expiry:`" field of the mail header. It will ask for 12 | the date the email should expire (default is 'today') and then run the date 13 | command to produce the RFC-822 compliant date. 14 | 15 | Here's the mapping and related function: 16 | 17 | > 18 | " Set expire date for the currently edited mail 19 | nnoremap e gg/^Date: :call GetExpiryDate():exe "normal! oExpires:\ndate --rfc-822 -d '". ExpiryDate."'"!!shkJ 20 | function GetExpiryDate() 21 | call inputsave() 22 | let g:ExpiryDate = input("Enter expiry date: ", "today") 23 | call inputrestore() 24 | endfunction 25 | < 26 | 27 | COMMENTS *vtw-559-comments* 28 | 29 | CATEGORIES *vtw-559-cats* 30 | 31 | Email |vtw-by-category-email| 32 | 33 | 34 | vim:tw=78:et:ft=help:norl: -------------------------------------------------------------------------------- /doc/vim-tips-wiki-1359.txt: -------------------------------------------------------------------------------- 1 | *vim-tips-wiki-1359.txt* Calculator and code evaluation using Perl *vtw-1359* 2 | 3 | Tip 1359 [https://vim.fandom.com/wiki/Calculator_and_code_evaluation_using_Perl] Previous |vtw-1356| Next |vtw-1361| 4 | 5 | created October 17, 2006 · complexity basic · author Michael Hooreman · 6 | version n/a 7 | 8 | ============================================================================== 9 | 10 | This is a Perl variation of VimTip1235 |vtw-1235|. 11 | 12 | You can calculate with Perl inside Vim, and do more by adding the following 13 | to your vimrc: 14 | 15 | > 16 | :command! -nargs=+ Evaluate :perl VIM::Msg(eval{}) 17 | < 18 | 19 | This prints the last statement value of the provided code as argument, so you 20 | can do more than a calculation. 21 | 22 | Examples: 23 | 24 | > 25 | :Evaluate 1+2 26 | > 3 27 | 28 | :Evaluate sin(0) 29 | > 0 30 | 31 | :Evaluate $a=sin(0);$a==sin(0)?"equal":"not equal" 32 | > equal 33 | 34 | :Evaluate @a=(0..10); join "", map{$_%2?"-":$_}@a; 35 | > 0-2-4-6-8-10 36 | < 37 | 38 | COMMENTS *vtw-1359-comments* 39 | 40 | An alternative is VimTip1349 |vtw-1349|. 41 | 42 | Does not need Python nor Perl. 43 | 44 | ============================================================================== 45 | 46 | CATEGORIES *vtw-1359-cats* 47 | 48 | Review |vtw-by-category-review| 49 | 50 | 51 | vim:tw=78:et:ft=help:norl: -------------------------------------------------------------------------------- /doc/vim-tips-wiki-1490.txt: -------------------------------------------------------------------------------- 1 | *vim-tips-wiki-1490.txt* Bookmark files *vtw-1490* 2 | 3 | Tip 1490 [https://vim.fandom.com/wiki/Bookmark_files] Previous |vtw-1486| Next |vtw-1491| 4 | 5 | created 2007 · complexity basic · author Mosh · version n/a 6 | 7 | ============================================================================== 8 | 9 | I read lots of files each day, and use file `~/.vims` to remember the 10 | important ones. 11 | 12 | > 13 | function! MoshBookmark() 14 | redir >> ~/.vims 15 | echo 16 | echo strftime("%Y-%b-%d %a %H:%M") 17 | echo "cd ". $PWD 18 | echo "vim ". expand("%:p").':'.line('.') 19 | echo ' word='.expand("") 20 | echo ' cline='.getline('.') 21 | redir END 22 | endfunction 23 | :command! MoshBookmark :call MoshBookmark() 24 | < 25 | 26 | Vim's builtin viminfo loses bookmarks during multiple sessions of Vim, hence 27 | this solution is required. 28 | 29 | COMMENTS *vtw-1490-comments* 30 | 31 | TO DO Explain when to use above function and what idea is. 32 | 33 | To use the bookmark file, open it in Vim: `vim ~/.vims` 34 | 35 | Press gF when cursor is on a filename. 36 | 37 | ============================================================================== 38 | 39 | CATEGORIES *vtw-1490-cats* 40 | 41 | Review |vtw-by-category-review| 42 | Todo |vtw-by-category-todo| 43 | 44 | 45 | vim:tw=78:et:ft=help:norl: -------------------------------------------------------------------------------- /doc/vim-tips-wiki-677.txt: -------------------------------------------------------------------------------- 1 | *vim-tips-wiki-677.txt* Quick way to insert opening and closing braces for programmers *vtw-677* 2 | 3 | 4 | 5 | 6 | 7 | This tip is very similar to the following: 8 | - VimTip630 |vtw-630| 9 | 10 | 11 | These tips need to be merged – see the merge guidelines 12 | [https://vim.fandom.com/wiki/Vim_Tips_Wiki:Merge_guidelines].Tip 677 [https://vim.fandom.com/wiki/Quick_way_to_insert_opening_and_closing_braces_for_programmers] Previous |vtw-676| Next |vtw-680| 13 | 14 | created 2004 · complexity basic · author Yada · version 5.7 15 | 16 | ============================================================================== 17 | 18 | This insert-mode map is fairly easy. It will save a lot of keystrokes for 19 | opening and closing braces when programming. It works best with cindent on 20 | (:set cindent) since vim will automatically indent to the right tabstop. I 21 | mapped it to insert-mode Ctrl-F. 22 | 23 | Example: 24 | 25 | > 26 | int main() Ctrl-F 27 | < 28 | 29 | will produce: 30 | 31 | > 32 | int main() { 33 | | 34 | } 35 | < 36 | 37 | insert the following in your vimrc file 38 | 39 | > 40 | " Opening and closing braces 41 | imap {}O 42 | < 43 | 44 | COMMENTS *vtw-677-comments* 45 | 46 | CATEGORIES *vtw-677-cats* 47 | 48 | Duplicate |vtw-by-category-duplicate| 49 | Brackets |vtw-by-category-brackets| 50 | 51 | 52 | vim:tw=78:et:ft=help:norl: -------------------------------------------------------------------------------- /doc/vim-tips-wiki-489.txt: -------------------------------------------------------------------------------- 1 | *vim-tips-wiki-489.txt* Section jump in Latex *vtw-489* 2 | 3 | Tip 489 [https://vim.fandom.com/wiki/Section_jump_in_Latex] Previous |vtw-488| Next |vtw-490| 4 | 5 | created June 19, 2003 · complexity basic · version 6 | 7 | ============================================================================== 8 | 9 | This is a small mapping that can be used for jumping sections in a latex 10 | file. 11 | 12 | > 13 | map ]s :/\\\(sub\)\{,2}section\s*{ :noh 14 | map [s :?\\\(sub\)\{,2}section\s*{ :noh 15 | < 16 | 17 | The above commands don't work with a count. The following maps correctly work 18 | with a count and also update the pattern.Also, if you want to keep the 19 | original search pattern, just comment out the "let @/ = pat" line. 20 | 21 | > 22 | " section jumping 23 | noremap ]] :call TexJump2Section( v:count1, '' ) 24 | noremap [[ :call TexJump2Section( v:count1, 'b' ) 25 | function! TexJump2Section( cnt, dir ) 26 | let i = 0 27 | let pat = '^\s*\\\(part\|chapter\|\(sub\)*section\|paragraph\)\>\|\%$\|\%^' 28 | let flags = 'W' . a:dir 29 | while i < a:cnt && search( pat, flags ) > 0 30 | let i = i+1 31 | endwhile 32 | let @/ = pat 33 | endfunction 34 | < 35 | 36 | CATEGORIES *vtw-489-cats* 37 | 38 | LaTeX |vtw-by-category-latex| 39 | 40 | 41 | vim:tw=78:et:ft=help:norl: -------------------------------------------------------------------------------- /doc/vim-tips-wiki-880.txt: -------------------------------------------------------------------------------- 1 | *vim-tips-wiki-880.txt* Shebang line automatically generated *vtw-880* 2 | 3 | Tip 880 [https://vim.fandom.com/wiki/Shebang_line_automatically_generated] Previous |vtw-879| Next |vtw-882| 4 | 5 | created February 20, 2005 · complexity basic · author Bertram Scharpf · 6 | version 6.0 7 | 8 | ============================================================================== 9 | 10 | In my Python or Ruby scripts, the first line is always a shebang line. I 11 | create it automatically by adding this to my vimrc 12 | [https://vim.fandom.com/wiki/Vimrc]: 13 | 14 | > 15 | augroup Shebang 16 | autocmd BufNewFile *.py 0put =\"#!/usr/bin/env python\# -*- coding: iso-8859-15 -*-\\"|$ 17 | autocmd BufNewFile *.rb 0put =\"#!/usr/bin/env ruby\# -*- coding: None -*-\\"|$ 18 | autocmd BufNewFile *.tex 0put =\"%&plain\\"|$ 19 | autocmd BufNewFile *.\(cc\|hh\) 0put =\"//\// \".expand(\":t\").\" -- \//\\"|2|start! 20 | augroup END 21 | < 22 | 23 | COMMENTS *vtw-880-comments* 24 | 25 | You can also create a skeleton-file for each filetype and read it - see :help 26 | |template|. 27 | 28 | ============================================================================== 29 | 30 | CATEGORIES *vtw-880-cats* 31 | 32 | Review |vtw-by-category-review| 33 | Automated Text Insertion |vtw-by-category-automated-text-insertion| 34 | 35 | 36 | vim:tw=78:et:ft=help:norl: -------------------------------------------------------------------------------- /doc/vim-tips-wiki-1204.txt: -------------------------------------------------------------------------------- 1 | *vim-tips-wiki-1204.txt* Send to default printer with no prompts under Windows *vtw-1204* 2 | 3 | Tip 1204 [https://vim.fandom.com/wiki/Send_to_default_printer_with_no_prompts_under_Windows] Previous |vtw-1203| Next |vtw-1206| 4 | 5 | created April 18, 2006 · complexity basic · author Mario · version 6.0 6 | 7 | ============================================================================== 8 | 9 | Sometimes after viewing something, you want to see a hardcopy of it. Vim 10 | provides a command for this: 11 | 12 | > 13 | :hardcopy 14 | < 15 | 16 | On Windows a typical printers dialog box is displayed. Once you OK that box, 17 | Vim sends the document off to the printer. I thought that was great! But how 18 | could I do it faster? 19 | 20 | Shortly afterwards, I learned the comnmad: 21 | 22 | > 23 | :ha 24 | < 25 | 26 | and that would do the exact same thing. Was there an even faster way to do 27 | that? The answer is yes. You can type: 28 | 29 | > 30 | :ha! 31 | < 32 | 33 | and that will send it right off to the default printer wtihout a dialog box 34 | stopping you! 35 | 36 | When I first learned of ":ha!" I smiled all day! 37 | 38 | For systems other than Windows, these commands will work slightly 39 | differently. See the Docs for details. 40 | 41 | COMMENTS *vtw-1204-comments* 42 | 43 | CATEGORIES *vtw-1204-cats* 44 | 45 | Review |vtw-by-category-review| 46 | 47 | 48 | vim:tw=78:et:ft=help:norl: -------------------------------------------------------------------------------- /doc/vim-tips-wiki-719.txt: -------------------------------------------------------------------------------- 1 | *vim-tips-wiki-719.txt* Use Python to build project in Visual Studio *vtw-719* 2 | 3 | Tip 719 [https://vim.fandom.com/wiki/Use_Python_to_build_project_in_Visual_Studio] Previous |vtw-718| Next |vtw-725| 4 | 5 | created 2004 · complexity intermediate · author Jens Berlips · version 6.0 6 | 7 | ============================================================================== 8 | 9 | See also Integrate gvim with Visual Studio 10 | [https://vim.fandom.com/wiki/Integrate_gvim_with_Visual_Studio]. 11 | 12 | This tip's functionality is also provided by visual_studio.vim: script#864 13 | [https://www.vim.org/scripts/script.php?script_id=864]. 14 | 15 | If you want to rebuild the entire project in Visual Studio 6++: 16 | 17 | > 18 | function! RebuildAllVC() 19 | python << EOF 20 | import win32com.client 21 | obj = win32com.client.GetActiveObject('MSDev.Application') 22 | obj.RebuildAll() 23 | EOF 24 | endfunction 25 | < 26 | 27 | There are a lot more things you can do, check out MSDN 28 | [http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vcug98/html/_asug_application_object.asp]; 29 | the application in that link is the "obj" in the code. 30 | 31 | COMMENTS *vtw-719-comments* 32 | 33 | CATEGORIES *vtw-719-cats* 34 | 35 | Review |vtw-by-category-review| 36 | Integration |vtw-by-category-integration| 37 | Windows |vtw-by-category-windows| 38 | 39 | 40 | vim:tw=78:et:ft=help:norl: -------------------------------------------------------------------------------- /doc/vim-tips-wiki-106.txt: -------------------------------------------------------------------------------- 1 | *vim-tips-wiki-106.txt* Insert mail signatures from a rotating file *vtw-106* 2 | 3 | Tip 106 [https://vim.fandom.com/wiki/Insert_mail_signatures_from_a_rotating_file] Previous |vtw-105| Next |vtw-107| 4 | 5 | created 2001 · complexity basic · author brz · version 6.0 6 | 7 | ============================================================================== 8 | 9 | By adding the following line to your `vimrc`, you can use a simple email 10 | signature rotator: 11 | 12 | > 13 | map ms :e c:\sign.txtggV/^-- $k"*xG$a*:w:bdG$a"*P 14 | < 15 | 16 | This rotator expects the user to have a file at the location `C:/sign.txt` 17 | with the following information: 18 | 19 | > 20 | -- 21 | first signature 22 | -- 23 | second signature 24 | -- 25 | third signature 26 | -- 27 | < 28 | 29 | When a user finishes an email, they may call the shortcut `\ms` and the 30 | 'first signature' will be inserted into the email. This will also push the 31 | first signature in `C:\sign.txt` to the end of the file. To change to a 32 | different signature from the one which is next in the file type `u` and `\ms` 33 | again. 34 | 35 | The `sign.txt` file must employ a signature separator like the following: '-- 36 | '. 37 | 38 | COMMENTS *vtw-106-comments* 39 | 40 | CATEGORIES *vtw-106-cats* 41 | 42 | Email |vtw-by-category-email| 43 | 44 | 45 | vim:tw=78:et:ft=help:norl: -------------------------------------------------------------------------------- /doc/vim-tips-wiki-1302.txt: -------------------------------------------------------------------------------- 1 | *vim-tips-wiki-1302.txt* Custom resizing on the spot *vtw-1302* 2 | 3 | Tip 1302 [https://vim.fandom.com/wiki/Custom_resizing_on_the_spot] Previous |vtw-1301| Next |vtw-1303| 4 | 5 | created August 11, 2006 · complexity basic · author atomik fungus · version 6 | 5.7 7 | 8 | ============================================================================== 9 | 10 | This was inspired by VimTip173 |vtw-173|. Sometimes you don't want to have 11 | your windows on their max or min width (length) so I added the following 12 | commands to my vimrc. 13 | 14 | > 15 | "This two change in between vertical windows maximizing their length, and if you keep them pressed they will increase width by 2 columns steps. 16 | "very nice when lines are too long to fit in just one row. 17 | nmap h_>> 18 | nmap l_>> 19 | < 20 | 21 | The same can be done for the horizontal split. 22 | 23 | COMMENTS *vtw-1302-comments* 24 | 25 | TO DO Take the time to figure out how to make this useful. By length the 26 | author means height. Should use a repeat number. If you need this tip to 27 | increase the width, won't you need a way to decrease it? 28 | 29 | ============================================================================== 30 | 31 | CATEGORIES *vtw-1302-cats* 32 | 33 | Review |vtw-by-category-review| 34 | Todo |vtw-by-category-todo| 35 | 36 | 37 | vim:tw=78:et:ft=help:norl: -------------------------------------------------------------------------------- /doc/vim-tips-wiki-862.txt: -------------------------------------------------------------------------------- 1 | *vim-tips-wiki-862.txt* How to toggle between all vertical and all horizontal window layout *vtw-862* 2 | 3 | Tip 862 [https://vim.fandom.com/wiki/How_to_toggle_between_all_vertical_and_all_horizontal_window_layout] Previous |vtw-861| Next |vtw-863| 4 | 5 | created 2005 · complexity intermediate · author Charles E. Campbell, Jr. · 6 | version 6.0 7 | 8 | ============================================================================== 9 | 10 | Suppose you have three windows in a "horizontal list", like this: 11 | 12 | > 13 | Window1|Window2|Window3 14 | < 15 | 16 | Entering the command: 17 | 18 | > 19 | :windo wincmd K 20 | < 21 | 22 | will change the windows to a "vertical list", like this: 23 | 24 | > 25 | Window1 26 | Window2 27 | Window3 28 | < 29 | 30 | Starting with a "vertical list", entering the command: 31 | 32 | > 33 | :windo wincmd H 34 | < 35 | 36 | will change the windows to a "horizontal list". 37 | 38 | RELATED PLUGINS *vtw-862-related-plugins* 39 | - twl.vim [http://www.drchip.org/astronaut/vim/index.html#TWL] implements 40 | `:TWL` (toggle window layout) which detects which type of window layout you 41 | currently have (vertical or horizontal), and applies the correct command to 42 | toggle the layout. 43 | 44 | 45 | COMMENTS *vtw-862-comments* 46 | 47 | CATEGORIES *vtw-862-cats* 48 | 49 | 50 | 51 | vim:tw=78:et:ft=help:norl: -------------------------------------------------------------------------------- /doc/vim-tips-wiki-900.txt: -------------------------------------------------------------------------------- 1 | *vim-tips-wiki-900.txt* Insert comment boxes in your code *vtw-900* 2 | 3 | Tip 900 [https://vim.fandom.com/wiki/Insert_comment_boxes_in_your_code] Previous |vtw-899| Next |vtw-901| 4 | 5 | created March 22, 2005 · complexity intermediate · author Ken Holm · version 6 | 5.7 7 | 8 | ============================================================================== 9 | 10 | Put this in your vimrc and you can have nicely aligned comment boxes: 11 | 12 | > 13 | map ,co O#====================================================================================================##====================================================================================================100\|Dkk100\|DjA 14 | < 15 | 16 | Note: 17 | - The above should all be on one line. 18 | - There is a space after the "A" at the end of the line above. 19 | - While in navigation mode use ,co to create a comment block. 20 | - The comment block will chop off at column 100. 21 | - It relies on having autoindent set. 22 | 23 | 24 | COMMENTS *vtw-900-comments* 25 | 26 | This should have the same result, I believe: 27 | 28 | > 29 | map ,co O#100A=100\|Di#i##100a=100\|DkA 30 | < 31 | 32 | ============================================================================== 33 | 34 | CATEGORIES *vtw-900-cats* 35 | 36 | Review |vtw-by-category-review| 37 | 38 | 39 | vim:tw=78:et:ft=help:norl: -------------------------------------------------------------------------------- /doc/vim-tips-wiki-85.txt: -------------------------------------------------------------------------------- 1 | *vim-tips-wiki-85.txt* How to mimic the vim 6.0 plugin feature with older versions *vtw-85* 2 | 3 | Tip 85 [https://vim.fandom.com/wiki/How_to_mimic_the_vim_6.0_plugin_feature_with_older_versions] Previous |vtw-84| Next |vtw-86| 4 | 5 | created July 5, 2001 · complexity intermediate · author bubbleboy · version 6 | 5.7 7 | 8 | ============================================================================== 9 | 10 | If you do not have Vim 6.0, but would like to mimic the plugins directory 11 | feature then copy and paste this into your vimrc: 12 | 13 | > 14 | exec "source " . substitute(glob($VIM."/plugins/*.vim"), "\n", "\nsource ", "g") 15 | < 16 | 17 | It will automatically source every Vim script file located in the vim/plugins 18 | directory. 19 | 20 | Now, to add a new plugin, just drop the script in this directory and Vim will 21 | automatically find it. 22 | 23 | COMMENTS *vtw-85-comments* 24 | 25 | To make Vim look in your home directory for the plugins directory: 26 | 27 | Use $HOME, or ~ (tilde), instead of $VIM. If you use tilde, it must be inside 28 | the quotes. The $VIM (or $HOME) may be placed inside the quotes as well - 29 | glob("$VIM/plugins/*.vim") works just fine. 30 | 31 | ============================================================================== 32 | 33 | CATEGORIES *vtw-85-cats* 34 | 35 | Review |vtw-by-category-review| 36 | Plugin |vtw-by-category-plugin| 37 | 38 | 39 | vim:tw=78:et:ft=help:norl: -------------------------------------------------------------------------------- /doc/vim-tips-wiki-87.txt: -------------------------------------------------------------------------------- 1 | *vim-tips-wiki-87.txt* Get vim 5.x window in vim 6.x *vtw-87* 2 | 3 | Tip 87 [https://vim.fandom.com/wiki/Get_vim_5.x_window_in_vim_6.x] Previous |vtw-86| Next |vtw-88| 4 | 5 | created July 14, 2001 · complexity basic · author Leif Wickland · version 6.0 6 | 7 | ============================================================================== 8 | 9 | The format of the window title in Vim 5.x (well, at least for 5.7,.8, for 10 | Win32) used to be VIM - . It's not in the win32 11 | binary of 6.0an that I found. I want my old way back. 12 | 13 | Turns out, all that it takes to get it back is 14 | 15 | > 16 | :set title titlestring=VIM\ -\ %F "make sure that the window caption setting is turned on and set caption to Vim 5.x style 17 | < 18 | 19 | Oh, however, one thing I did like about the 6.0 style is that it puts the 20 | word "help" in the title when the current buffer is a help file; so, I just 21 | tacked %h to my titlestring giving: 22 | 23 | > 24 | :set title titlestring=VIM\ -\ %F\ %h "make sure that the window caption setting is turned on and set caption to Vim 5.x style 25 | < 26 | 27 | REFERENCES *vtw-87-references* 28 | - :help 'titlestring' 29 | - :help 'statusline' 30 | 31 | 32 | COMMENTS *vtw-87-comments* 33 | 34 | CATEGORIES *vtw-87-cats* 35 | 36 | Review |vtw-by-category-review| 37 | 38 | 39 | vim:tw=78:et:ft=help:norl: -------------------------------------------------------------------------------- /doc/vim-tips-wiki-1603.txt: -------------------------------------------------------------------------------- 1 | *vim-tips-wiki-1603.txt* Recreate tempfile directory *vtw-1603* 2 | 3 | Tip 1603 [https://vim.fandom.com/wiki/Recreate_tempfile_directory] Previous |vtw-1602| Next |vtw-1604| 4 | 5 | created 6 | [https://vim.fandom.com/wiki/Vim_Tips_Wiki:New_tips/200808#Recreate_tempfile_directory] 7 | August 27, 2008 · complexity basic · author Egr10whois · version 7.0 8 | 9 | ============================================================================== 10 | 11 | Occasionally, when an editing session is up for several days, but no feature 12 | that creates temporary files has been used, some administrative script 13 | (especially on multiuser or server systems configured to run for months at a 14 | time) may decide that Vim's temporary file directory is stale, because it 15 | hasn't been accessed in N days, and remove it. 16 | 17 | Unfortunately, Vim's error reporting when this happens may not identify the 18 | missing directory path; for example: 19 | 20 | > 21 | :hardcopy 22 | E324: Can't open PostScript output file 23 | < 24 | 25 | Fortunately, it is easy to determine the temporary file directory path: 26 | 27 | > 28 | :echo tempname() 29 | /tmp/v012345/67 30 | < 31 | 32 | or even to recreate it, without ever leaving Vim: 33 | 34 | > 35 | :call mkdir(fnamemodify(tempname(),':h'),'p',0700) 36 | < 37 | 38 | COMMENTS *vtw-1603-comments* 39 | 40 | CATEGORIES *vtw-1603-cats* 41 | 42 | 43 | 44 | vim:tw=78:et:ft=help:norl: -------------------------------------------------------------------------------- /doc/vim-tips-wiki-816.txt: -------------------------------------------------------------------------------- 1 | *vim-tips-wiki-816.txt* JAVH - Just another Vim Hacker *vtw-816* 2 | 3 | Tip 816 [https://vim.fandom.com/wiki/JAVH_-_Just_another_Vim_Hacker] Previous |vtw-814| Next |vtw-817| 4 | 5 | created November 5, 2004 · complexity basic · author zzapper · version 5.7 6 | 7 | ============================================================================== 8 | 9 | Perl has its JAPH Just Another Perl Hacker (a short script that produces the 10 | output 'Just another Perl hacker' (Google for it)). I thought one day I'd try 11 | to something similar with Vim, the trick being to make it as obscure as 12 | possible: 13 | 14 | > 15 | vim -c ":%s%s*%Cyrnfr)fcbafbe[Oenz(Zbbyranne%|:%s)[[()])-)Ig|norm Vg?" 16 | < 17 | 18 | Here are some others, from various sources. 19 | 20 | > 21 | :s(.*(rekcaH iV rehtonA tsuJ(|t.|s).$)&&)|-s'.'s,\\(.\\)\\(.\\)\\(\\2.*\\),\\2\\3\\1,|'g|s=[^|]*|$=s,.,,=|d a|@a 22 | < 23 | 24 | > 25 | gvim -c "exec \"normal itYNQ#v'Z#ABG#GUR#BAYL#BAR\"|%s/#/ /g|normal ggVGg?ggVG~" 26 | < 27 | 28 | So what's the point: 29 | 30 | This "tip" shows that you can do some pretty complex stuff with the Vim -c 31 | command. 32 | 33 | > 34 | vim -c "cmd1|cmd2|cmd3" 35 | # Example: print paste contents to default printer 36 | gvim -c 's/^/\=@*/|hardcopy!|q!' 37 | < 38 | 39 | COMMENTS *vtw-816-comments* 40 | 41 | CATEGORIES *vtw-816-cats* 42 | 43 | Review |vtw-by-category-review| 44 | 45 | 46 | vim:tw=78:et:ft=help:norl: -------------------------------------------------------------------------------- /doc/vim-tips-wiki-897.txt: -------------------------------------------------------------------------------- 1 | *vim-tips-wiki-897.txt* Some tips on saving the document *vtw-897* 2 | 3 | Tip 897 [https://vim.fandom.com/wiki/Some_tips_on_saving_the_document] Previous |vtw-896| Next |vtw-899| 4 | 5 | created 2005 · complexity basic · author Salman Halim · version 6.0 6 | 7 | ============================================================================== 8 | 9 | I use the following mappings to save my document -- they do away with the 10 | need for hitting escape when I'm in visual or insert modes. 11 | 12 | > 13 | nmap  :w 14 | vmap 15 | imap 16 | < 17 | 18 | However, control-s will freeze some computers; if that happens, hit control-q 19 | to get out it. 20 | 21 | In most Unixes you can disable control-S by doing this: 22 | 23 | > 24 | /bin/stty stop undef 25 | < 26 | 27 | The F2 series of mappings are different; they only write if needed 28 | (performing an update) and return you to where you were: insert mode, visual 29 | selection etc. 30 | 31 | > 32 | nmap  :update 33 | vmap gv 34 | imap 35 | < 36 | 37 | So, if you're done with a particular operation, hit control-s (or whatever 38 | you come up with as a replacement); if you're not done, but want to save (just 39 | to be safe), use the F2 series of mappings. 40 | 41 | COMMENTS *vtw-897-comments* 42 | 43 | CATEGORIES *vtw-897-cats* 44 | 45 | 46 | 47 | vim:tw=78:et:ft=help:norl: -------------------------------------------------------------------------------- /doc/vim-tips-wiki-1286.txt: -------------------------------------------------------------------------------- 1 | *vim-tips-wiki-1286.txt* Use gvim for diff under TortoiseCVS *vtw-1286* 2 | 3 | Tip 1286 [https://vim.fandom.com/wiki/Use_gvim_for_diff_under_TortoiseCVS] Previous |vtw-1285| Next |vtw-1287| 4 | 5 | created July 17, 2006 · complexity basic · author Tom Purl · version 6.0 6 | 7 | ============================================================================== 8 | 9 | The diff mode of Vim and Gvim is really excellent, and I like to use it as 10 | the external diff application with TortoiseCVS. Here's how you would configure 11 | this: 12 | 13 | 1. Right-click any file and choose "CVS -> Preferences". 14 | 15 | 2. In the TortoiseCVS window, choose the "Tools" tab. 16 | 17 | 3. Place the following in the "Diff Application" text box (adjust for your 18 | Vim install location): 19 | 20 | > 21 | C:\Program Files\Vim\vim70\gvim.exe 22 | < 23 | 24 | 4. Place the following in the "Two-way diff parameters" text box: 25 | 26 | > 27 | -d "%1" "%2" 28 | < 29 | 30 | Now you should be able to right-click a CVS-controlled file, choose the "CVS 31 | diff" option and view results in Gvim. 32 | 33 | Any additional Gvim parameters should only appear in the "Two-way diff 34 | parameters" text box, not the "Diff application" text box. 35 | 36 | COMMENTS *vtw-1286-comments* 37 | 38 | CATEGORIES *vtw-1286-cats* 39 | 40 | Integration |vtw-by-category-integration| 41 | VersionControl |vtw-by-category-versioncontrol| 42 | 43 | 44 | vim:tw=78:et:ft=help:norl: -------------------------------------------------------------------------------- /doc/vim-tips-wiki-645.txt: -------------------------------------------------------------------------------- 1 | *vim-tips-wiki-645.txt* Enabling Windows shortcuts for gvim *vtw-645* 2 | 3 | Tip 645 [https://vim.fandom.com/wiki/Enabling_Windows_shortcuts_for_gvim] Previous |vtw-644| Next |vtw-646| 4 | 5 | created 2004 · complexity basic · author Girish Gajwani · version 5.7 6 | 7 | ============================================================================== 8 | 9 | I was trying to figure out why Alt+space would not work, as I would have to 10 | use the mouse to maximize/restore/minimize my gvim window (on Win32) which was 11 | a pain and found that I needed to 12 | 13 | > 14 | set winaltkeys=yes 15 | < 16 | 17 | to make this work. Now I can use 18 | 19 | > 20 | Alt+Space followed by 'x to maximize 21 | Alt+Space followed by 'n' to minimize 22 | Alt+Space followed by 'r' to restore! 23 | < 24 | 25 | Note that with `winaltkeys=yes`, you won't be able to map any ALT key 26 | combinations. If this is a problem for you, try `winaltkeys=menu` or 27 | `winaltkeys=no` in conjunction with `:simalt`. 28 | 29 | REFERENCES *vtw-645-references* 30 | - :help 'winaltkeys' 31 | - :help |:simalt| 32 | - VimTip494 |vtw-494| 33 | 34 | 35 | COMMENTS *vtw-645-comments* 36 | 37 | I have been struggling with this problem. Thank you very much for sharing 38 | this information. 39 | 40 | CATEGORIES *vtw-645-cats* 41 | 42 | Windows |vtw-by-category-windows| 43 | 44 | 45 | vim:tw=78:et:ft=help:norl: -------------------------------------------------------------------------------- /doc/vim-tips-wiki-104.txt: -------------------------------------------------------------------------------- 1 | *vim-tips-wiki-104.txt* Capture SQL query output *vtw-104* 2 | 3 | Tip 104 [https://vim.fandom.com/wiki/Capture_SQL_query_output] Previous |vtw-103| Next |vtw-105| 4 | 5 | created September 3, 2001 · complexity advanced · author meonkeys · version 6 | 5.7 7 | 8 | ============================================================================== 9 | 10 | DBI::Shell is a Perl module that is used as a shell interface to Perl's 11 | popular DBI (database interface) package. Forget your favorite SQL navigation 12 | gui and give this method a shot. This has only been tested in Unix. 13 | 14 | 1. Run dbish (runs DBI::Shell; installed with DBI::Shell) and connect to any 15 | database. 16 | 17 | 2. In dbish, set /format box. 18 | 19 | 3. Enter your query. 20 | 21 | 4. To execute query, type "/ | vim -" 22 | 23 | This runs the query and pipes the output to the standard input of Vim. 24 | 25 | Here are some follow-up tips: 26 | - Use gvim instead of Vim so a new window will pop up. 27 | - Set nowrap once in Vim. 28 | 29 | 30 | COMMENTS *vtw-104-comments* 31 | 32 | Note that if your are using MySQL cli, you can type : "pager vim -" (without 33 | the quotes indeed). 34 | 35 | Then every select, desc, show, etc. will be opened in Vim. 36 | 37 | ============================================================================== 38 | 39 | CATEGORIES *vtw-104-cats* 40 | 41 | Review |vtw-by-category-review| 42 | 43 | 44 | vim:tw=78:et:ft=help:norl: -------------------------------------------------------------------------------- /doc/vim-tips-wiki-698.txt: -------------------------------------------------------------------------------- 1 | *vim-tips-wiki-698.txt* Mbox archive emails *vtw-698* 2 | 3 | Tip 698 [https://vim.fandom.com/wiki/Mbox_archive_emails] Previous |vtw-697| Next |vtw-699| 4 | 5 | created April 12, 2004 · complexity intermediate · author Paul Jolly · 6 | version 5.7 7 | 8 | ============================================================================== 9 | 10 | First see: http://www.vim.org/maillist.php#help 11 | [http://www.vim.org/maillist.php#help] 12 | 13 | Follow the instructions to get hold of the archive messages you need. For 14 | example, I sent an email to the following address to retrieve mails 43413 to 15 | 43512: 16 | 17 | > 18 | vim-get.43413_43512@vim.org 19 | < 20 | 21 | They will be returned as individual attachments to a single mail, one reply 22 | per request. 23 | 24 | Save all the attachments in a new temporary directory, say /tmp/temp. 25 | 26 | Download the following script: 27 | http://kmail.kde.org/unsupported/xfmail2mbox.sh 28 | [http://kmail.kde.org/unsupported/xfmail2mbox.sh] 29 | 30 | Run the script, passing the aforementioned directory as an argument: 31 | 32 | > 33 | $ xfmail2mbox /tmp/temp 34 | < 35 | 36 | where $ indicates a shell command. 37 | 38 | This will create a file called /tmp/temp.mbox, an mbox format file of emails 39 | found in /tmp/temp 40 | 41 | COMMENTS *vtw-698-comments* 42 | 43 | CATEGORIES *vtw-698-cats* 44 | 45 | Review |vtw-by-category-review| 46 | 47 | 48 | vim:tw=78:et:ft=help:norl: -------------------------------------------------------------------------------- /doc/vim-tips-wiki-230.txt: -------------------------------------------------------------------------------- 1 | *vim-tips-wiki-230.txt* Copy current file to another location from within vim *vtw-230* 2 | 3 | Tip 230 [https://vim.fandom.com/wiki/Copy_current_file_to_another_location_from_within_vim] Previous |vtw-228| Next |vtw-231| 4 | 5 | created April 2, 2002 · complexity basic · author Tabrez Syed · version 5.7 6 | 7 | ============================================================================== 8 | 9 | I work on jsp pages in my source tree but I have to copy the jsp files over 10 | to the tomcat directory in order to view my changes.The following mapping will 11 | copy the file being edited to another location. 12 | 13 | > 14 | command Cpage silent !cp '%:p' "c:/Progra~1/Tomcat/webapps/console/pages/%" 15 | < 16 | 17 | Explanation: 18 | 19 | > 20 | % refers to the current buffer 21 | %:p refers to the path to the file 22 | silent suppresses the command prompt window. 23 | < 24 | 25 | Usage: 26 | 27 | > 28 | :Cpage 29 | < 30 | 31 | COMMENTS *vtw-230-comments* 32 | 33 | Why not 34 | 35 | > 36 | :w %:t c:/Progra~1/Tomcat/webapps/console/pages/ 37 | < 38 | 39 | ============================================================================== 40 | 41 | on a windows environment eg. to tmp dir: 42 | 43 | > 44 | :silent !copy %:p "c:\tmp\" 45 | < 46 | 47 | ============================================================================== 48 | 49 | CATEGORIES *vtw-230-cats* 50 | 51 | Review |vtw-by-category-review| 52 | 53 | 54 | vim:tw=78:et:ft=help:norl: -------------------------------------------------------------------------------- /doc/vim-tips-wiki-336.txt: -------------------------------------------------------------------------------- 1 | *vim-tips-wiki-336.txt* Jump to a line number *vtw-336* 2 | 3 | Tip 336 [https://vim.fandom.com/wiki/Jump_to_a_line_number] Previous |vtw-335| Next |vtw-337| 4 | 5 | created October 3, 2002 · complexity basic · author Odyss · version 5.7 6 | 7 | ============================================================================== 8 | 9 | An easy way to to get to a line (whose number we know) faster is to combine 10 | some existing methods: 11 | 12 | > 13 | :123 14 | or 15 | 123G 16 | or 17 | 123gg 18 | < 19 | 20 | The solution is to map the key in Normal Mode, to the G command: 21 | 22 | > 23 | :nnoremap G 24 | < 25 | 26 | We can type the line number and then press Enter to get there. Without the 27 | mapping, 123 will jump 123 lines down from the current position rather 28 | than to an absolute number. With the mapping, you can jump very quickly 29 | especially if you use the numeric keypad. On some systems, to get the numeric 30 | keypad's Enter key working, you may need to add the following mapping to make 31 | it do the same as the normal Enter key (or as in the mapping above): 32 | 33 | > 34 | :nmap 35 | < 36 | 37 | To launch Vim and start at a certain line, you can pass the line number as 38 | follows: 39 | 40 | > 41 | vim file.txt +123 42 | < 43 | 44 | COMMENTS *vtw-336-comments* 45 | 46 | CATEGORIES *vtw-336-cats* 47 | 48 | 49 | 50 | vim:tw=78:et:ft=help:norl: -------------------------------------------------------------------------------- /doc/vim-tips-wiki-889.txt: -------------------------------------------------------------------------------- 1 | *vim-tips-wiki-889.txt* Set gvim font in MacOSX *vtw-889* 2 | 3 | 4 | 5 | 6 | 7 | This tip is very similar to the following: 8 | - VimTip632 |vtw-632| 9 | - VimTip1587 |vtw-1587| 10 | 11 | 12 | These tips need to be merged – see the merge guidelines 13 | [https://vim.fandom.com/wiki/Vim_Tips_Wiki:Merge_guidelines].Tip 889 [https://vim.fandom.com/wiki/Set_gvim_font_in_MacOSX] Previous |vtw-888| Next |vtw-891| 14 | 15 | created March 5, 2005 · complexity basic · author flipouk · version 6.0 16 | 17 | ============================================================================== 18 | 19 | You set your font for gvim on Mac OS X by including a line like this in your 20 | $HOME/.vimrc or $HOME/.gvimrc: 21 | 22 | > 23 | set guifont=Monaco:h14 24 | < 25 | 26 | or 27 | 28 | > 29 | set guifont=Andale\ Mono:h14 30 | < 31 | 32 | If your font doesn't look smooth, you can try adding this line to 33 | $HOME/.gvimrc: 34 | 35 | > 36 | set antialias 37 | < 38 | 39 | If you're using Monaco on OSX you might want to try disabling antialias: 40 | 41 | > 42 | set noantialias 43 | < 44 | 45 | REFERENCES *vtw-889-references* 46 | - :help 'guifont' 47 | - :help 'antialias' 48 | 49 | 50 | COMMENTS *vtw-889-comments* 51 | 52 | CATEGORIES *vtw-889-cats* 53 | 54 | Duplicate |vtw-by-category-duplicate| 55 | Mac OS X |vtw-by-category-mac-os-x| 56 | 57 | 58 | vim:tw=78:et:ft=help:norl: -------------------------------------------------------------------------------- /doc/vim-tips-wiki-1455.txt: -------------------------------------------------------------------------------- 1 | *vim-tips-wiki-1455.txt* Jumps to a local/global definition by same key *vtw-1455* 2 | 3 | Tip 1455 [https://vim.fandom.com/wiki/Jumps_to_a_local/global_definition_by_same_key] Previous |vtw-1454| Next |vtw-1456| 4 | 5 | created 2007 · complexity basic · author Shotaro Aoyama · version n/a 6 | 7 | ============================================================================== 8 | 9 | When you want to jump to a definition of a variable, what do you do? Use 10 | `C-]` or `gd`? 11 | 12 | `C-]` finds only global variables (and functions; ctags extracts only global 13 | objects). 14 | 15 | On the other hand, `gd` detects only local variables. 16 | 17 | I think it's a bit complicated to choose between them. So I wrote this 18 | function: 19 | 20 | > 21 | function! GoDefinition() 22 | let l:pos = getpos('.') 23 | normal! gd 24 | if getpos('.') == l:pos 25 | execute 'tag' expand('') 26 | endif 27 | endfunction 28 | nnoremap  :call GoDefinition() 29 | < 30 | 31 | This function first does `gd` to try to find a local definition of a variable 32 | under the cursor, and if it failed then probably the variable is a global 33 | variable, so it tries `:tag`. 34 | 35 | This way, you can jump to the definition of both local and global variables 36 | with the same key. 37 | 38 | COMMENTS *vtw-1455-comments* 39 | 40 | CATEGORIES *vtw-1455-cats* 41 | 42 | Review |vtw-by-category-review| 43 | 44 | 45 | vim:tw=78:et:ft=help:norl: -------------------------------------------------------------------------------- /doc/vim-tips-wiki-284.txt: -------------------------------------------------------------------------------- 1 | *vim-tips-wiki-284.txt* Print syntax highlighted buffer in one color *vtw-284* 2 | 3 | 4 | 5 | 6 | 7 | This tip is very similar to the following: 8 | - VimTip111 |vtw-111| 9 | 10 | 11 | These tips need to be merged – see the merge guidelines 12 | [https://vim.fandom.com/wiki/Vim_Tips_Wiki:Merge_guidelines].Tip 284 [https://vim.fandom.com/wiki/Print_syntax_highlighted_buffer_in_one_color] Previous |vtw-283| Next |vtw-285| 13 | 14 | created July 20, 2002 · complexity basic · author Sean · version 6.0 15 | 16 | ============================================================================== 17 | 18 | I use this mapping to print syntax highlighted C++ code in B&W. 19 | 20 | This tip needs print_bw 21 | [https://www.vim.org/scripts/script.php?script_id=233]. 22 | 23 | The mapping is as follows 24 | 25 | > 26 | map  :color print_bw:hardcopy:color sean:syn on 27 | < 28 | 29 | Change ":color sean" to whatever is your chosen color scheme. 30 | 31 | Need to change line 7 of print_bw from "syntax reset" to "syntax off". 32 | 33 | on a syntax highlighted buffer turns off syntax highlighting, sets the 34 | colors to B&W, prints the buffer, resets the color scheme and turns on syntax 35 | highlighting again. 36 | 37 | COMMENTS *vtw-284-comments* 38 | 39 | CATEGORIES *vtw-284-cats* 40 | 41 | Duplicate |vtw-by-category-duplicate| 42 | Review |vtw-by-category-review| 43 | Syntax |vtw-by-category-syntax| 44 | 45 | 46 | vim:tw=78:et:ft=help:norl: -------------------------------------------------------------------------------- /doc/vim-tips-wiki-712.txt: -------------------------------------------------------------------------------- 1 | *vim-tips-wiki-712.txt* Reverse letters *vtw-712* 2 | 3 | Tip 712 [https://vim.fandom.com/wiki/Reverse_letters] Previous |vtw-711| Next |vtw-713| 4 | 5 | created 2004 · complexity basic · author David Fishburn · version 5.7 6 | 7 | ============================================================================== 8 | 9 | Simply enable visual mode (v), highlight the characters you want inverted, 10 | and hit `\is`. 11 | 12 | For a single word you can use `vw` (or `viw`): 13 | 14 | > 15 | viw\is 16 | < 17 | 18 | > 19 | vnoremap is :let old_reg_a=@a 20 | \:let old_reg=@" 21 | \gv"ay 22 | \:let @a=substitute(@a, '.\(.*\)\@=', 23 | \ '\=@a[strlen(submatch(1))]', 'g') 24 | \gvca 25 | \:let @a=old_reg_a 26 | \:let @"=old_reg 27 | < 28 | 29 | COMMENTS *vtw-712-comments* 30 | 31 | If your Vim has +rightleft (check vim --version), the following visual mode 32 | map does the job: 33 | 34 | > 35 | vmap fR c:set ri":set nori 36 | < 37 | 38 | A map that reverses the sequence of lines (again, visual mode): 39 | 40 | > 41 | vmap fr :set lz'>o'V'>j:'<+1,'>-1g/^/m '<'dd:set nolz 42 | < 43 | 44 | ============================================================================== 45 | 46 | CATEGORIES *vtw-712-cats* 47 | 48 | Review |vtw-by-category-review| 49 | 50 | 51 | vim:tw=78:et:ft=help:norl: -------------------------------------------------------------------------------- /doc/vim-tips-wiki-1609.txt: -------------------------------------------------------------------------------- 1 | *vim-tips-wiki-1609.txt* Print to a Postscript file *vtw-1609* 2 | 3 | Tip 1609 [https://vim.fandom.com/wiki/Print_to_a_Postscript_file] Previous |vtw-1608| Next |vtw-1610| 4 | 5 | created 6 | [https://vim.fandom.com/wiki/Vim_Tips_Wiki:New_tips/200811#Print_to_a_Postscript_file] 7 | November 11, 2008 · complexity basic · author Sightless · version 7.0 8 | 9 | ============================================================================== 10 | 11 | If you want to be able to print to printer and file, place this snippet in 12 | your vimrc [https://vim.fandom.com/wiki/Vimrc]: 13 | 14 | > 15 | let &printexpr="(v:cmdarg=='' ? ". 16 | \"system('lpr' . (&printdevice == '' ? '' : ' -P' . &printdevice)". 17 | \". ' ' . v:fname_in) . delete(v:fname_in) + v:shell_error". 18 | \" : system('mv '.v:fname_in.' '.v:cmdarg) + v:shell_error)" 19 | < 20 | 21 | Then you can print to file by issuing: 22 | 23 | > 24 | :hardcopy filename.ps 25 | < 26 | 27 | or to printer by just issuing: 28 | 29 | > 30 | :hardcopy 31 | < 32 | 33 | COMMENTS *vtw-1609-comments* 34 | 35 | So far this could be considered a bit insecure, as the filename isn't escaped 36 | at all. Probably fnameescape or something like that should be used. 37 | 38 | Why not just using the builtin ":hardcopy >file.ps"? 39 | 40 | ============================================================================== 41 | 42 | CATEGORIES *vtw-1609-cats* 43 | 44 | 45 | 46 | vim:tw=78:et:ft=help:norl: -------------------------------------------------------------------------------- /doc/vim-tips-wiki-518.txt: -------------------------------------------------------------------------------- 1 | *vim-tips-wiki-518.txt* Errorformat for icc7 *vtw-518* 2 | 3 | 4 | 5 | 6 | 7 | This tip is very similar to the following: 8 | - VimTip1575 |vtw-1575| 9 | 10 | 11 | These tips need to be merged – see the merge guidelines 12 | [https://vim.fandom.com/wiki/Vim_Tips_Wiki:Merge_guidelines].Tip 518 [https://vim.fandom.com/wiki/Errorformat_for_icc7] Previous |vtw-517| Next |vtw-519| 13 | 14 | created 2003 · complexity basic · version 5.7 15 | 16 | ============================================================================== 17 | 18 | Vim's errorformat option can be combined with the :make command to reduce 19 | development time (this is part of Vim's 'quickfix' capability). This option 20 | allows Vim to parse the output of a compiler in order to bring up a list of 21 | errors and warnings that you can jump to. But, Vim will not be able to parse 22 | the output of every compiler by default, so you need to tell it how. 23 | 24 | This is an errorformat for the Intel icc7 compiler: 25 | 26 | > 27 | set errorformat=%E%f(%l):\ %m,%-C,%-C%p,%Z 28 | < 29 | 30 | REFERENCES *vtw-518-references* 31 | - :help 'errorformat' 32 | - :help |:make| 33 | - :help |quickfix| 34 | 35 | 36 | COMMENTS *vtw-518-comments* 37 | 38 | CATEGORIES *vtw-518-cats* 39 | 40 | Duplicate |vtw-by-category-duplicate| 41 | C |vtw-by-category-c| 42 | Compiler |vtw-by-category-compiler| 43 | 44 | 45 | vim:tw=78:et:ft=help:norl: -------------------------------------------------------------------------------- /doc/vim-tips-wiki-737.txt: -------------------------------------------------------------------------------- 1 | *vim-tips-wiki-737.txt* Fine tuning syntax colors *vtw-737* 2 | 3 | Tip 737 [https://vim.fandom.com/wiki/Fine_tuning_syntax_colors] Previous |vtw-736| Next |vtw-738| 4 | 5 | created May 31, 2004 · complexity basic · author FreeFall90 · version 6.0 6 | 7 | ============================================================================== 8 | 9 | If you want to change just one or two colors in your syntax highlighting, 10 | there is a simpler way other than editing color files (or creating new ones). 11 | For example, I wanted to tweak the default colors a bit, so I added the 12 | following lines to my vimrc [https://vim.fandom.com/wiki/Vimrc] file: 13 | 14 | > 15 | highlight comment ctermfg=lightblue 16 | highlight constant ctermfg=red 17 | < 18 | 19 | This made the comments and constants easier to read on my screen. Replace 20 | "comment" or "constant" with whatever text type you want to change the color 21 | of. Try experimenting with different colors to see what looks best to you. 22 | (This was NOT gone in the gui vim, as I don't use it/have it installed). 23 | 24 | REFERENCES *vtw-737-references* 25 | - :help |usr_06.txt| 26 | 27 | 28 | COMMENTS *vtw-737-comments* 29 | 30 | In vim 7.2 this makes the given element bolded as well as changing the color. 31 | 32 | CATEGORIES *vtw-737-cats* 33 | 34 | Dodgy |vtw-by-category-dodgy| 35 | Syntax |vtw-by-category-syntax| 36 | 37 | 38 | vim:tw=78:et:ft=help:norl: -------------------------------------------------------------------------------- /doc/vim-tips-wiki-577.txt: -------------------------------------------------------------------------------- 1 | *vim-tips-wiki-577.txt* Access vim@vim.org using Newsgroup Reader *vtw-577* 2 | 3 | Tip 577 [https://vim.fandom.com/wiki/Access_vim@vim.org_using_Newsgroup_Reader] Previous |vtw-576| Next |vtw-579| 4 | 5 | created 2003 · complexity basic · author Pan Shizhu · version 6.0 6 | 7 | ============================================================================== 8 | 9 | For some reason one may not prefer mailling lists over usenet newsgroups 10 | (like me). 11 | 12 | IMHO Newsgroup reader is a lot more versatile and easy to use. So, find a 13 | newsgroup equivalent for vim@vim.org is improtant for newsgreoup users. 14 | Unfortunately, the comp.editors on USENET is not as active as vim@vim.org. 15 | 16 | The non-official news server news.gmane.org, have a mirror to vim@vim.org, 17 | named gmane.editors.vim, the maillist vim@vim.org and newsgroup 18 | gmane.editors.vim seemed to be syncronised together. 19 | 20 | To access the gmane news, just new an account with the NNTP server 21 | news.gmane.org, then find the newsgroup gmane.editors.vim, then you can enjoy 22 | vim@vim.org with your favorate news reader program, and without messing up 23 | mailling list messages with your private e-mail client (which is what the 24 | newsgroup designed for). 25 | 26 | I think gmane.editors.vim should be highly recommended for newsgroup users. 27 | 28 | COMMENTS *vtw-577-comments* 29 | 30 | CATEGORIES *vtw-577-cats* 31 | 32 | Review |vtw-by-category-review| 33 | 34 | 35 | vim:tw=78:et:ft=help:norl: -------------------------------------------------------------------------------- /doc/vim-tips-wiki-1563.txt: -------------------------------------------------------------------------------- 1 | *vim-tips-wiki-1563.txt* Create new subroutines *vtw-1563* 2 | 3 | Tip 1563 [https://vim.fandom.com/wiki/Create_new_subroutines] Previous |vtw-1562| Next |vtw-1564| 4 | 5 | created 6 | [https://vim.fandom.com/wiki/Vim_Tips_Wiki:New_tips/200805#Create_new_subroutines] 7 | 2008 · complexity basic · author Pressel · version 7.0 8 | 9 | ============================================================================== 10 | 11 | Here is a convenience function to help Perl programmers when writing new 12 | routines. 13 | 14 | Put the cursor on a word, then type `\ns` (assuming the default backslash 15 | leader key) to create a new subroutine. The subroutine is given the name of 16 | the word under the cursor, and is placed at the "bottom" of the file. If any 17 | `__xxx__` tokens are used (such as `__DATA__` or `__END__`), the subroutine is 18 | inserted before that token. Otherwise, it is appended to the end of the file. 19 | 20 | > 21 | nnoremap ns :call Newsub() 22 | function! Newsub() 23 | let word = "sub " . expand("") . "{}" 24 | let ln = search("__.*__", 'nW') 25 | if ln == 0 26 | call append('$', word) 27 | else 28 | call append(ln-1, word) 29 | endif 30 | endfunction 31 | < 32 | 33 | COMMENTS *vtw-1563-comments* 34 | 35 | CATEGORIES *vtw-1563-cats* 36 | 37 | Automated Text Insertion |vtw-by-category-automated-text-insertion| 38 | Perl |vtw-by-category-perl| 39 | 40 | 41 | vim:tw=78:et:ft=help:norl: -------------------------------------------------------------------------------- /doc/vim-tips-wiki-570.txt: -------------------------------------------------------------------------------- 1 | *vim-tips-wiki-570.txt* Align text into a table *vtw-570* 2 | 3 | 4 | 5 | 6 | 7 | This tip is very similar to the following: 8 | - VimTip893 |vtw-893| 9 | - VimTip139 |vtw-139| 10 | - VimTip894 |vtw-894| 11 | 12 | 13 | These tips need to be merged – see the merge guidelines 14 | [https://vim.fandom.com/wiki/Vim_Tips_Wiki:Merge_guidelines].Tip 570 [https://vim.fandom.com/wiki/Align_text_into_a_table] Previous |vtw-569| Next |vtw-571| 15 | 16 | created September 30, 2003 · complexity basic · author mosh · version 6.0 17 | 18 | ============================================================================== 19 | 20 | Align badly formatted text into a table by selecting the region, then 21 | pressing . This case aligns the '='; you decide the centering string 22 | before pressing return. 23 | 24 | You need the perl script "align" from 25 | http://www.cs.albany.edu/~mosh/Perl/align 26 | [http://www.cs.albany.edu/~mosh/Perl/align]. 27 | 28 | Mapping is: 29 | 30 | > 31 | :vmap  !perl ~/perl/align -c:= 32 | < 33 | 34 | Example input: 35 | 36 | > 37 | " x = 1; 38 | " xyz = 245; 39 | " a=1; 40 | < 41 | 42 | Example output: 43 | 44 | > 45 | " x = 1; 46 | " xyz = 245; 47 | " a = 1; 48 | < 49 | 50 | COMMENTS *vtw-570-comments* 51 | 52 | CATEGORIES *vtw-570-cats* 53 | 54 | Review |vtw-by-category-review| 55 | Duplicate |vtw-by-category-duplicate| 56 | Usage |vtw-by-category-usage| 57 | 58 | 59 | vim:tw=78:et:ft=help:norl: -------------------------------------------------------------------------------- /doc/vim-tips-wiki-262.txt: -------------------------------------------------------------------------------- 1 | *vim-tips-wiki-262.txt* Change the gvim mouse arrow cursor *vtw-262* 2 | 3 | Tip 262 [https://vim.fandom.com/wiki/Change_the_gvim_mouse_arrow_cursor] Previous |vtw-261| Next |vtw-264| 4 | 5 | created 2002 · complexity basic · author ncr · version 6.0 6 | 7 | ============================================================================== 8 | 9 | Here is how you can change the shape of your mouseptr in gvim. 10 | 11 | > 12 | :set mouseshape=n:pencil 13 | < 14 | 15 | This will change the shape of the mouseptr to pencil in normal mode. You can 16 | choose different shapes for different modes. See :help 'mouseshape'. 17 | 18 | Want more shapes? 19 | 20 | Then look for the file cursorfont.h in your X11/ directory. This file 21 | contains lots of cursor shape #define definitions, like 22 | 23 | > 24 | . 25 | #define XC_heart 62 26 | . 27 | < 28 | 29 | Now `:set mouseshape=n:62` will set the shape of the mouseptr to heart in 30 | normal mode. 31 | 32 | COMMENTS *vtw-262-comments* 33 | 34 | Not available for Windows. 35 | 36 | ============================================================================== 37 | 38 | Actually, only certain built-in cursors are available in Windows. Pencil 39 | doesn't work, but others do. See `:help mouseshape` 40 | 41 | ============================================================================== 42 | 43 | CATEGORIES *vtw-262-cats* 44 | 45 | Review |vtw-by-category-review| 46 | Mouse |vtw-by-category-mouse| 47 | 48 | 49 | vim:tw=78:et:ft=help:norl: -------------------------------------------------------------------------------- /doc/vim-tips-wiki-846.txt: -------------------------------------------------------------------------------- 1 | *vim-tips-wiki-846.txt* Ampersand in freebsd shell commands to view LaTeX files *vtw-846* 2 | 3 | Tip 846 [https://vim.fandom.com/wiki/Ampersand_in_freebsd_shell_commands_to_view_LaTeX_files] Previous |vtw-844| Next |vtw-847| 4 | 5 | created January 9, 2005 · complexity basic · author Rabee Tourky · version 6 | 6.0 7 | 8 | ============================================================================== 9 | 10 | Could not execute shell commands ending with ampersand (&) in gvim running 11 | under FreeBSD. Commands like: 12 | 13 | > 14 | :!xdvi & 15 | :!xterm & 16 | < 17 | 18 | did not work. This meant that I couldn't use vim-latex to view documents dvi 19 | since by default vim-latex sends a command ending with &. The problem does not 20 | occur in vim. 21 | 22 | Hint: Check the parameters gvim is started with! In the KDE menu gvim is 23 | started with -f option which can cause this problem. 24 | 25 | +The problem is solved if the shell is changed to ksh from the default sh or 26 | bash. 27 | 28 | Install pdksh: 29 | 30 | > 31 | $ su (su to root) 32 | # cd /usr/ports/shells/pdksh/ 33 | #make install cleanset 34 | < 35 | 36 | Change the shell to ksh in .vimrc. Add: 37 | 38 | > 39 | set sh=ksh 40 | < 41 | 42 | REFERENCES *vtw-846-references* 43 | - :help 'shell' 44 | 45 | 46 | COMMENTS *vtw-846-comments* 47 | 48 | CATEGORIES *vtw-846-cats* 49 | 50 | Review |vtw-by-category-review| 51 | 52 | 53 | vim:tw=78:et:ft=help:norl: -------------------------------------------------------------------------------- /doc/vim-tips-wiki-1589.txt: -------------------------------------------------------------------------------- 1 | *vim-tips-wiki-1589.txt* Environment variables *vtw-1589* 2 | 3 | Tip 1589 [https://vim.fandom.com/wiki/Environment_variables] Previous |vtw-1588| Next |vtw-1590| 4 | 5 | created 6 | [https://vim.fandom.com/wiki/Vim_Tips_Wiki:New_tips/200802#Environment_variables] 7 | 2008 · complexity basic · author Metacosm · version 7.0 8 | 9 | ============================================================================== 10 | 11 | Vim can read and write environment variables within your current shell 12 | session. Use a `$` prefix to identify an environment variable, as in the 13 | following examples. 14 | 15 | Display the contents of the PATH environment variable: 16 | 17 | > 18 | :echo $PATH 19 | < 20 | 21 | Assign the PATH environment variable to a Vim variable: 22 | 23 | > 24 | :let myvar = $PATH 25 | < 26 | 27 | Change the PATH environment variable for the current session: 28 | 29 | > 30 | :let $PATH = '/foo:/bar' 31 | < 32 | 33 | Insert the contents of the PATH environment variable into the buffer:Press 34 | `i` to enter insert mode, press Ctrl-r then `=$PATH` and press Enter. 35 | 36 | Append to the Existing Path. 37 | 38 | > 39 | :let $PATH .= ':/foo:/bar' 40 | < 41 | 42 | REFERENCES *vtw-1589-references* 43 | - :help |expr-env| 44 | - :help |expression-syntax| 45 | - :help |{{{id}}}| 46 | 47 | 48 | COMMENTS *vtw-1589-comments* 49 | 50 | CATEGORIES *vtw-1589-cats* 51 | 52 | 53 | 54 | vim:tw=78:et:ft=help:norl: -------------------------------------------------------------------------------- /doc/vim-tips-wiki-387.txt: -------------------------------------------------------------------------------- 1 | *vim-tips-wiki-387.txt* Inserting a prefix in a parameter list *vtw-387* 2 | 3 | Tip 387 [https://vim.fandom.com/wiki/Inserting_a_prefix_in_a_parameter_list] Previous |vtw-386| Next |vtw-388| 4 | 5 | created 2002 · complexity Intermediate · author feral · version 6.0 6 | 7 | ============================================================================== 8 | 9 | This is a way to quickly prefix a character (or characters) to a parameter 10 | list, via `:substitute` 11 | 12 | In the thought that others may like the same preferred style as I, here is an 13 | easy way to prefix each param with an underscore. 14 | 15 | The command: 16 | 17 | > 18 | :s/\<\(\I\i*\s\{-}[,)]\)/_\1/g 19 | < 20 | 21 | A sample menu entry: 22 | 23 | > 24 | amenu Fe&ral's.Prefix\ underscores\ to\ params :s/\<\(\I\i*\s\{-}[,)]\)/_\1/g  :noh 25 | < 26 | 27 | AN EXAMPLE *vtw-387-an-example* 28 | 29 | Before: 30 | 31 | > 32 | BOOL CSomeView::Create(DWORD dwStyle, const RECT& rect, CWnd* pParentWnd, UINT nID) 33 | < 34 | 35 | After: 36 | 37 | > 38 | BOOL CSomeView::Create(DWORD _dwStyle, const RECT& _rect, CWnd* _pParentWnd, UINT _nID) 39 | < 40 | 41 | REFERENCES *vtw-387-references* 42 | - :help |:substitute| 43 | - :help |pattern-overview| 44 | 45 | 46 | COMMENTS *vtw-387-comments* 47 | 48 | CATEGORIES *vtw-387-cats* 49 | 50 | Usage |vtw-by-category-usage| 51 | 52 | 53 | vim:tw=78:et:ft=help:norl: -------------------------------------------------------------------------------- /doc/vim-tips-wiki-905.txt: -------------------------------------------------------------------------------- 1 | *vim-tips-wiki-905.txt* Remember my buffers *vtw-905* 2 | 3 | Tip 905 [https://vim.fandom.com/wiki/Remember_my_buffers] Previous |vtw-904| Next |vtw-906| 4 | 5 | created 2005 · complexity basic · version 5.7 6 | 7 | ============================================================================== 8 | 9 | Vim can remember the list of your opened buffers even after you close Vim. 10 | 11 | In Vim, or vimrc do: 12 | 13 | > 14 | :exec 'set viminfo=%,' . &viminfo 15 | < 16 | 17 | The '%' flag tells vim to remember your list of opened buffers in your 18 | viminfo file. 19 | 20 | Try, for example, opening Vim and editing your vimrc file. Then without using 21 | `:bd` to delete the buffer, quit Vim (`:wq`). If you open Vim again, check 22 | your buffer list (`:ls`) and you will notice that the vimrc buffer is still 23 | there. 24 | 25 | COMMENTS *vtw-905-comments* 26 | 27 | Instead of 28 | 29 | > 30 | :exec 'set viminfo=%,' . &viminfo 31 | < 32 | 33 | to put a string at the start of an option you can also use the shorter 34 | 35 | > 36 | :set viminfo^=% 37 | < 38 | 39 | ============================================================================== 40 | 41 | What happens if I open more than one Vim at a time? I would think it would 42 | make more sense to save a session instead. 43 | 44 | ============================================================================== 45 | 46 | CATEGORIES *vtw-905-cats* 47 | 48 | Review |vtw-by-category-review| 49 | 50 | 51 | vim:tw=78:et:ft=help:norl: -------------------------------------------------------------------------------- /doc/vim-tips-wiki-1042.txt: -------------------------------------------------------------------------------- 1 | *vim-tips-wiki-1042.txt* Use maven with quickfix *vtw-1042* 2 | 3 | Tip 1042 [https://vim.fandom.com/wiki/Use_maven_with_quickfix] Previous |vtw-1041| Next |vtw-1043| 4 | 5 | created November 8, 2005 · complexity basic · author jkw · version 6.0 6 | 7 | ============================================================================== 8 | 9 | Using maven with quickfix is pretty simple, just add: 10 | 11 | > 12 | compiler ant 13 | set makeprg=maven\ -q\ -f\ project.xml\ jar:install 14 | < 15 | 16 | to your vimrc. I use the jar:install goal but java:compile will suffice. 17 | 18 | COMMENTS *vtw-1042-comments* 19 | 20 | Consider :help |write-compiler-plugin|. 21 | 22 | ============================================================================== 23 | 24 | This tip is for maven, but in this days all people use maven3 (or maven2) and 25 | this tip does nothing for that. Or am I wrong? 26 | 27 | Does maven2 and maven3 not understand the same parameters anymore? If yes, then you should be able to just replace maven by maven2 or maven3 or whatever it is called, if not, well feel free to adjust the tip for maven2 and maven3 then ;) Chrisbra (talk) 09:04, October 19, 2012 (UTC) 28 | 29 | The maven-compiler-vim [https://github.com/JalaiAmitahl/maven-compiler.vim] 30 | plugin sets all of this up for you very nicely. 31 | 32 | CATEGORIES *vtw-1042-cats* 33 | 34 | Review |vtw-by-category-review| 35 | Compiler |vtw-by-category-compiler| 36 | Java |vtw-by-category-java| 37 | 38 | 39 | vim:tw=78:et:ft=help:norl: -------------------------------------------------------------------------------- /doc/vim-tips-wiki-1259.txt: -------------------------------------------------------------------------------- 1 | *vim-tips-wiki-1259.txt* Edit Java jar and other files *vtw-1259* 2 | 3 | Tip 1259 [https://vim.fandom.com/wiki/Edit_Java_jar_and_other_files] Previous |vtw-1251| Next |vtw-1260| 4 | 5 | created 2006 · complexity basic · author emmby · version 7.0 6 | 7 | ============================================================================== 8 | 9 | Jar files are zip files, and you can browse them from within Vim simply by 10 | treating them the same as Vim treats zip files. 11 | 12 | If you want to figure out how to do this yourself, read :help |new-filetype| 13 | and zipPlugin.vim. The latter is a plugin distributed with Vim: in Vim, put 14 | the cursor on `$VIMRUNTIME/plugin/zipPlugin.vim` and type `gf`. 15 | 16 | For impatient people, just place the following in a file named 17 | `~/.vim/ftdetect/jar.vim` (on Unix systems) or 18 | `$HOME/vimfiles/ftdetect/jar.vim` (on Windows systems): 19 | 20 | > 21 | au BufRead,BufNewFile *.jar,*.war,*.ear,*.sar,*.rar set filetype=zip 22 | < 23 | 24 | If you open a jar file in Vim, you will be able to browse it. If that does 25 | not work, update to a recent version of Vim with zipPlugin installed. 26 | 27 | COMMENTS *vtw-1259-comments* 28 | 29 | From :help |zip-extension| a .jar file can be unzipped with the following in 30 | vimrc [https://vim.fandom.com/wiki/Vimrc]. 31 | 32 | > 33 | au BufReadCmd *.jar call zip#Browse(expand("")) 34 | < 35 | 36 | CATEGORIES *vtw-1259-cats* 37 | 38 | Review |vtw-by-category-review| 39 | 40 | 41 | vim:tw=78:et:ft=help:norl: -------------------------------------------------------------------------------- /doc/vim-tips-wiki-1262.txt: -------------------------------------------------------------------------------- 1 | *vim-tips-wiki-1262.txt* Git grep *vtw-1262* 2 | 3 | Tip 1262 [https://vim.fandom.com/wiki/Git_grep] Previous |vtw-1261| Next |vtw-1265| 4 | 5 | created June 18, 2006 · complexity basic · author Timo Hirvonen · version 7.0 6 | 7 | ============================================================================== 8 | 9 | git grep searches for a pattern in a currently selected git branch. 10 | This adds :G command to run the command from within Vim. 11 | 12 | > 13 | func GitGrep(...) 14 | let save = &grepprg 15 | set grepprg=git\ grep\ -n\ $* 16 | let s = 'grep' 17 | for i in a:000 18 | let s = s . ' ' . i 19 | endfor 20 | exe s 21 | let &grepprg = save 22 | endfun 23 | command -nargs=? G call GitGrep() 24 | < 25 | 26 | You can also limit searching to files matching a pattern (git will do the 27 | pattern matching): 28 | 29 | > 30 | :G -- '*.c' 31 | < 32 | 33 | ADDITIONS *vtw-1262-additions* 34 | 35 | The following addition will run git grep on the word under the cursor when 36 | Ctrl+X G is pressed. 37 | 38 | > 39 | func GitGrepWord() 40 | normal! "zyiw 41 | call GitGrep('-w -e ', getreg('z')) 42 | endf 43 | nmap G :call GitGrepWord() 44 | < 45 | 46 | COMMENTS *vtw-1262-comments* 47 | 48 | CATEGORIES *vtw-1262-cats* 49 | 50 | VersionControl |vtw-by-category-versioncontrol| 51 | 52 | 53 | vim:tw=78:et:ft=help:norl: -------------------------------------------------------------------------------- /doc/vim-tips-wiki-363.txt: -------------------------------------------------------------------------------- 1 | *vim-tips-wiki-363.txt* Fast start up in a telnet session *vtw-363* 2 | 3 | Tip 363 [https://vim.fandom.com/wiki/Fast_start_up_in_a_telnet_session] Previous |vtw-362| Next |vtw-364| 4 | 5 | created November 7, 2002 · complexity basic · author vim_power · version 5.7 6 | 7 | ============================================================================== 8 | 9 | When you telnet to a remote machine and fire Vim on that machine, sometimes 10 | it takes a lot of time for Vim to start. instead if you use 11 | 12 | > 13 | vim -X 14 | < 15 | 16 | it will start vim almost instantaneously. This is because "-X" options tells 17 | vim not to connect to the local X server, which can save a lot of startup 18 | time. 19 | 20 | Also 21 | 22 | > 23 | vim -X --noplugin 24 | < 25 | 26 | will not load any plugins in $VIMRUNTIME/plugin directory, this will again 27 | speed up the starting and is very useful especially when running vim from a 28 | Disk mounted over NFS. 29 | 30 | COMMENTS *vtw-363-comments* 31 | 32 | This is great! I alway use vim via telnet on remote machines but it always 33 | tried to connect to my XServer. Up to now, I always made something like 'unset 34 | DISPLAY; vim ...'. 35 | 36 | I think it's a bug in the manual pages since the option -X is not mentioned 37 | there (same applies for -O). 38 | 39 | ============================================================================== 40 | 41 | CATEGORIES *vtw-363-cats* 42 | 43 | Review |vtw-by-category-review| 44 | 45 | 46 | vim:tw=78:et:ft=help:norl: -------------------------------------------------------------------------------- /doc/vim-tips-wiki-1001.txt: -------------------------------------------------------------------------------- 1 | *vim-tips-wiki-1001.txt* Save buffer without changing Last Modified attribute *vtw-1001* 2 | 3 | Tip 1001 [https://vim.fandom.com/wiki/Save_buffer_without_changing_Last_Modified_attribute] Previous |vtw-999| Next |vtw-1003| 4 | 5 | created 2005 · complexity basic · author Craig Emery · version 5.7 6 | 7 | ============================================================================== 8 | 9 | There are times when I change something in a file and I've no need for the 10 | file's "last modified" time to be changed. For example, I might be updating a 11 | comment in a source file, and I don't need my build system to re-compile the 12 | file. 13 | 14 | If your build of Vim has `+python` you can define the following function and 15 | call it instead of using the write command. 16 | 17 | > 18 | function! WritePreserveMtime() 19 | python << EEOOFF 20 | import vim 21 | import os.path 22 | import os 23 | fpath = vim.current.buffer.name 24 | atime = os.path.getatime(fpath) 25 | mtime = os.path.getmtime(fpath) 26 | vim.command("w") 27 | os.utime(fpath, (atime, mtime)) 28 | EEOOFF 29 | endfunction 30 | < 31 | 32 | See :help |python| for information on calling Python from inside Vim. 33 | 34 | Since I 35 | 36 | > 37 | :map  :w 38 | < 39 | 40 | I also 41 | 42 | > 43 | :map  :call WritePreserveMtime() 44 | < 45 | 46 | COMMENTS *vtw-1001-comments* 47 | 48 | CATEGORIES *vtw-1001-cats* 49 | 50 | Review |vtw-by-category-review| 51 | 52 | 53 | vim:tw=78:et:ft=help:norl: -------------------------------------------------------------------------------- /doc/vim-tips-wiki-1326.txt: -------------------------------------------------------------------------------- 1 | *vim-tips-wiki-1326.txt* Map extra keys on non US keyboards *vtw-1326* 2 | 3 | Tip 1326 [https://vim.fandom.com/wiki/Map_extra_keys_on_non_US_keyboards] Previous |vtw-1323| Next |vtw-1332| 4 | 5 | created 2006 · complexity basic · author Martin Krischik · version 6.0 6 | 7 | ============================================================================== 8 | 9 | On a US keyboard, it is convenient to press `[` and `]` which each have their 10 | own key. 11 | 12 | You can have the same convenience on non-US keyboards with a map like the 13 | following (this example is for a German keyboard): 14 | 15 | > 16 | map ü 17 | map ö [ 18 | map ä ] 19 | map Ö { 20 | map Ä } 21 | map ß / 22 | < 23 | 24 | A key like `ü` is only useful in insert mode, and you can still use it in 25 | that mode. 26 | 27 | COMMENTS *vtw-1326-comments* 28 | 29 | Enter is heavily used and - in Turkish Q keyboard layout - far from hand 30 | position so it is productive to use "ş" character as in normal mode. That 31 | way the keyboard characters are lay like G H J K L Ş which boosts performance. 32 | It is also possibly a good idea to use "ğ" as a mapleader key which lays just 33 | above Ş. 34 | 35 | ============================================================================== 36 | 37 | nmap ş 38 | let mapleader = "ğ" " in your .vimrc file 39 | 40 | ============================================================================== 41 | 42 | CATEGORIES *vtw-1326-cats* 43 | 44 | 45 | 46 | vim:tw=78:et:ft=help:norl: -------------------------------------------------------------------------------- /doc/vim-tips-wiki-1050.txt: -------------------------------------------------------------------------------- 1 | *vim-tips-wiki-1050.txt* Move comment line to end of next line *vtw-1050* 2 | 3 | Tip 1050 [https://vim.fandom.com/wiki/Move_comment_line_to_end_of_next_line] Previous |vtw-1048| Next |vtw-1051| 4 | 5 | created 2005 · complexity basic · author matahijau · version 5.7 6 | 7 | ============================================================================== 8 | 9 | Let's say you have some C or Java that looks like this: 10 | 11 | > 12 | // get the age of the person 13 | age = person.getAge(); 14 | < 15 | 16 | If you want to compact your code a bit you might want to stick the comment at 17 | the end of the statement instead of on its own line. Essentially you want to 18 | "join up": 19 | 20 | > 21 | map kddpkJ 22 | < 23 | 24 | Used on the example above by placing the cursor on the second line and typing 25 | ctrl-shift-j, you will now have: 26 | 27 | > 28 | age = person.getAge(); // get the age of the person 29 | < 30 | 31 | `ddp` is used to swap the lines before joining, so the comment line is at the 32 | end of the newly joined line. 33 | 34 | COMMENTS *vtw-1050-comments* 35 | 36 | A better way of swapping lines is to use 37 | 38 | > 39 | :m+ 40 | :m-2 41 | < 42 | 43 | Hence, modifying "map kddpkJ" and maintaining cursor position: 44 | 45 | > 46 | nmap mz:m-2J`z 47 | < 48 | 49 | ============================================================================== 50 | 51 | CATEGORIES *vtw-1050-cats* 52 | 53 | Review |vtw-by-category-review| 54 | 55 | 56 | vim:tw=78:et:ft=help:norl: -------------------------------------------------------------------------------- /doc/vim-tips-wiki-1332.txt: -------------------------------------------------------------------------------- 1 | *vim-tips-wiki-1332.txt* Using remote editing with knetattach *vtw-1332* 2 | 3 | Tip 1332 [https://vim.fandom.com/wiki/Using_remote_editing_with_knetattach] Previous |vtw-1326| Next |vtw-1333| 4 | 5 | created 2006 · complexity basic · version 6.0 6 | 7 | ============================================================================== 8 | 9 | I was trying kde's knetattach yesterday. It doesn't seem to know about Vim's 10 | built-in remote editing commands. To get knetattach to play nicely with Vim, I 11 | wrote the following Python script and made it the default application for 12 | remote text files. The application command line reads "net_vim_open.py %u", 13 | where %u is translated to the remote fish url. 14 | 15 | > 16 | #!/usr/bin/python 17 | #net_vim_open.py 18 | 19 | import os, sys 20 | 21 | def open_gvim(): 22 | v = sys.argv[1]; 23 | if v[0:4] != 'fish': 24 | error_file = open('.net_vim_errors','a'); 25 | print >> error_file, "Error starting gvim"; 26 | print >> error_file, sys.argv; 27 | error_file.close(); 28 | else: 29 | v = v.replace("fish:", "scp:", 1); 30 | v = v.replace(":22", "/", 1); 31 | cmd = ' '.join(['gvim',v]); 32 | os.system(cmd); 33 | return; 34 | 35 | open_gvim(); 36 | sys.exit(); 37 | < 38 | 39 | COMMENTS *vtw-1332-comments* 40 | 41 | CATEGORIES *vtw-1332-cats* 42 | 43 | Review |vtw-by-category-review| 44 | Integration |vtw-by-category-integration| 45 | 46 | 47 | vim:tw=78:et:ft=help:norl: -------------------------------------------------------------------------------- /doc/vim-tips-wiki-539.txt: -------------------------------------------------------------------------------- 1 | *vim-tips-wiki-539.txt* Quick access to Vim tips and scripts with konqueror *vtw-539* 2 | 3 | Tip 539 [https://vim.fandom.com/wiki/Quick_access_to_Vim_tips_and_scripts_with_konqueror] Previous |vtw-537| Next |vtw-542| 4 | 5 | created August 23, 2003 · complexity basic · author zoran · version 5.7 6 | 7 | ============================================================================== 8 | 9 | For those of you using KDE and Konqueror to browse vim.sf.net, you can add it 10 | to the so called "Web Shortcuts" in konqueror: 11 | 12 | 1. In Konqueror choose "Settings/Configure Konqueror" 13 | 14 | 2. Goto "Web Shortcuts", choose "Add..." 15 | 16 | 3. Now configure the shortcut: 17 | - Search Name Provider: "VIM Tips" 18 | - Search URI: "http://vim.sourceforge.net/tips/tip.php?tip_id=\{@}" 19 | - URI shortcuts: "vt,vimt,vimtip" 20 | 21 | 22 | 4. Click OK and Apply the changes to Konqueror 23 | 24 | You can now use: "vt:4" in Konqueror's location bar to jump directly to 25 | VimTip4 |vtw-4|. 26 | 27 | Feel free to do the same for Vim scripts using 28 | "http://vim.sourceforge.net/scripts/script.php?script_id=\{@}" as the Search 29 | URI. 30 | 31 | COMMENTS *vtw-539-comments* 32 | 33 | TO DO Need to update above now that the tips are here in the Vim Tips wiki. 34 | 35 | ============================================================================== 36 | 37 | CATEGORIES *vtw-539-cats* 38 | 39 | Review |vtw-by-category-review| 40 | Integration |vtw-by-category-integration| 41 | Todo |vtw-by-category-todo| 42 | 43 | 44 | vim:tw=78:et:ft=help:norl: -------------------------------------------------------------------------------- /doc/vim-tips-wiki-1028.txt: -------------------------------------------------------------------------------- 1 | *vim-tips-wiki-1028.txt* Read tag files from all directories in your path *vtw-1028* 2 | 3 | Tip 1028 [https://vim.fandom.com/wiki/Read_tag_files_from_all_directories_in_your_path] Previous |vtw-1026| Next |vtw-1029| 4 | 5 | created 2005 · complexity intermediate · version 6.0 6 | 7 | ============================================================================== 8 | 9 | In my development environment, I have several header files directories. I 10 | need these directories to be both in my path, and in my tags list. 11 | 12 | To accomplish this I use the following Python based script: 13 | 14 | > 15 | set path=.,$_WINCEROOT/.,$_WINCEROOT/public/,$_WINCEROOT/public/common/oak/inc,$_WINCEROOT/public/common/ddk/inc,$_WINCEROOT/public/common/sdk/inc,$_WINCEROOT/private/cellcore/dtpt/inc 16 | set tags=./tags,../tags,../inc/tags 17 | 18 | function! BuildTagsFromPath() 19 | python << EOF 20 | import sys 21 | import vim 22 | paths = vim.eval("&path") # &path gets the option path. 23 | pathsSplit = paths.split(",") 24 | 25 | # prepend original tag list before path. 26 | tags = vim.eval("&tags") 27 | for path in pathsSplit: 28 | tags += "%s/tags," % (path) 29 | cmdSetTags = "set tags=%s" % tags 30 | vim.command(cmdSetTags) 31 | EOF 32 | endfunction 33 | 34 | call BuildTagsFromPath() 35 | < 36 | 37 | COMMENTS *vtw-1028-comments* 38 | 39 | CATEGORIES *vtw-1028-cats* 40 | 41 | Review |vtw-by-category-review| 42 | Navigation |vtw-by-category-navigation| 43 | 44 | 45 | vim:tw=78:et:ft=help:norl: -------------------------------------------------------------------------------- /doc/vim-tips-wiki-1472.txt: -------------------------------------------------------------------------------- 1 | *vim-tips-wiki-1472.txt* Show file modification time on status bar *vtw-1472* 2 | 3 | Tip 1472 [https://vim.fandom.com/wiki/Show_file_modification_time_on_status_bar] Previous |vtw-1470| Next |vtw-1483| 4 | 5 | created January 13, 2007 · complexity basic · version 5.7 6 | 7 | ============================================================================== 8 | 9 | Put in your vimrc [https://vim.fandom.com/wiki/Vimrc]: 10 | 11 | > 12 | set statusline=%<%f%<%{FileTime()}%<%h%m%r%=%-20.(line=%03l,col=%02c%V,totlin=%L%)\%h%m%r%=%-30(,BfNm=%n%Y%)\%P\*%=%{CurTime()} 13 | set rulerformat=%15(%c%V\ %p%%%) 14 | "set rulerformat=%<%f%<%{FileTime()}%<%h%m%r%=%-20.(line=%03l,col=%02c%V,totlin=%L%)\%h%m%r%=%-30(,BfNm=%n%Y%)\%P\*%=%{CurTime()} 15 | 16 | function! FileTime() 17 | let ext=tolower(expand("%:e")) 18 | let fname=tolower(expand('%<')) 19 | let filename=fname . '.' . ext 20 | let msg="" 21 | let msg=msg." ".strftime("(Modified %b,%d %y %H:%M:%S)",getftime(filename)) 22 | return msg 23 | endfunction 24 | 25 | function! CurTime() 26 | let ftime="" 27 | let ftime=ftime." ".strftime("%b,%d %y %H:%M:%S") 28 | return ftime 29 | endfunction 30 | < 31 | 32 | COMMENTS *vtw-1472-comments* 33 | 34 | This gets the file's mtime on each update. Isn't that somewhat of an 35 | overkill? 36 | 37 | ============================================================================== 38 | 39 | CATEGORIES *vtw-1472-cats* 40 | 41 | Review |vtw-by-category-review| 42 | 43 | 44 | vim:tw=78:et:ft=help:norl: -------------------------------------------------------------------------------- /doc/vim-tips-wiki-446.txt: -------------------------------------------------------------------------------- 1 | *vim-tips-wiki-446.txt* Quick and dirty Postgres query *vtw-446* 2 | 3 | Tip 446 [https://vim.fandom.com/wiki/Quick_and_dirty_Postgres_query] Previous |vtw-445| Next |vtw-449| 4 | 5 | created March 23, 2003 · complexity basic · author Shawn Deleurme · version 6 | 5.7 7 | 8 | ============================================================================== 9 | 10 | Here is a simple and useful mapping for anyone who can't stand developing 11 | queries on the psql prompt or messing around with the single \e psql edit 12 | buffer. 13 | 14 | > 15 | map  :!psql -d yourdb < % less 16 | < 17 | 18 | COMMENTS *vtw-446-comments* 19 | 20 | You could also consider use the database extension plugin for Vim, which 21 | provides a lot of features for Postgress. script#356 22 | [https://www.vim.org/scripts/script.php?script_id=356] db_ext.vim 23 | 24 | ============================================================================== 25 | 26 | One other way of using vim with the \e command in psql is to set the 27 | PSQL_EDITOR environment variable. On a redhat system you'd do the following: 28 | 29 | > 30 | export PSQL_EDITOR=vim 31 | < 32 | 33 | ============================================================================== 34 | 35 | When using old versions of psql the buffer does not have the .sql extension. 36 | If you want syntax highlighting use: 37 | 38 | > 39 | export PSQL_EDITOR='vim +"set syntax=sql" ' 40 | < 41 | 42 | CATEGORIES *vtw-446-cats* 43 | 44 | Review |vtw-by-category-review| 45 | 46 | 47 | vim:tw=78:et:ft=help:norl: -------------------------------------------------------------------------------- /doc/vim-tips-wiki-1112.txt: -------------------------------------------------------------------------------- 1 | *vim-tips-wiki-1112.txt* Listing buffers *vtw-1112* 2 | 3 | Tip 1112 [https://vim.fandom.com/wiki/Listing_buffers] Previous |vtw-1111| Next |vtw-1114| 4 | 5 | created 2006 · complexity basic · author Matt Zyzik · version 5.7 6 | 7 | ============================================================================== 8 | 9 | Use the following to list your buffers. 10 | 11 | > 12 | nnoremap  :ls\|sleep 13 | < 14 | 15 | Press Alt-: to show the results of `:ls` for one second. Pressing Alt-: 3 16 | times will show the `:ls` listing for 3 seconds. 17 | 18 | You can also hold down Alt-: to show the file list continuously, then press 19 | Ctrl-c when you're done. This can be very useful when working with many files. 20 | 21 | COMMENTS *vtw-1112-comments* 22 | 23 | I'll try this for some days: 24 | 25 | > 26 | map  :ls!sleep =v:count1 27 | < 28 | 29 | ============================================================================== 30 | 31 | > 32 | " alt-; display buffer list for 3 seconds 33 | nnoremap  :ls3sleep 34 | < 35 | 36 | ============================================================================== 37 | 38 | It should be noted that if 'lazyredraw' isn't set, the original mapping will 39 | cause the entire display to be refreshed for each combination. 40 | 41 | ============================================================================== 42 | 43 | CATEGORIES *vtw-1112-cats* 44 | 45 | Review |vtw-by-category-review| 46 | 47 | 48 | vim:tw=78:et:ft=help:norl: -------------------------------------------------------------------------------- /doc/vim-tips-wiki-1297.txt: -------------------------------------------------------------------------------- 1 | *vim-tips-wiki-1297.txt* Display last viewed text lines at top of new shell *vtw-1297* 2 | 3 | Tip 1297 [https://vim.fandom.com/wiki/Display_last_viewed_text_lines_at_top_of_new_shell] Previous |vtw-1296| Next |vtw-1298| 4 | 5 | created August 5, 2006 · complexity basic · author pulp · version n/a 6 | 7 | ============================================================================== 8 | 9 | > 10 | function! s:Shell(...) 11 | let curline=line ('.') 12 | if curline < 6 13 | let start=0 14 | else 15 | let start=curline-5 16 | endif 17 | let end=curline+15 18 | execute 'silent !clear' 19 | execute 'silent !echo -e "\n...\n"' 20 | execute 'silent !sed ' . start . ',' . end . '\!d %' 21 | execute 'silent !echo -e "\n...\n"' 22 | execute 'shell' 23 | endfunction 24 | command! Shell call s:Shell() 25 | < 26 | 27 | Executing ":Shell" will start a new shell and display the last viewed text 28 | lines in the top of the new shell. 29 | 30 | Useful if you read a 'README' file and you want to follow the install 31 | instruction ("./configurer, make etc). 32 | 33 | With the displayed text you do not need to remember the commands. 34 | 35 | COMMENTS *vtw-1297-comments* 36 | 37 | This may be an alternative: 38 | 39 | > 40 | :nnoremap gsh :set t_te= t_ti=:sh:set t_te& t_ti& 41 | < 42 | 43 | ============================================================================== 44 | 45 | CATEGORIES *vtw-1297-cats* 46 | 47 | Review |vtw-by-category-review| 48 | 49 | 50 | vim:tw=78:et:ft=help:norl: -------------------------------------------------------------------------------- /doc/vim-tips-wiki-301.txt: -------------------------------------------------------------------------------- 1 | *vim-tips-wiki-301.txt* Edit file found by whereis *vtw-301* 2 | 3 | Tip 301 [https://vim.fandom.com/wiki/Edit_file_found_by_whereis] Previous |vtw-299| Next |vtw-302| 4 | 5 | created August 7, 2002 · complexity intermediate · author Little Dragon · 6 | version 5.7 7 | 8 | ============================================================================== 9 | 10 | You can write a little shell function that will let you easily edit any file 11 | that is in the path, or which's location can be retrieved with the whereis 12 | tool. This is something similar to what I have in /etc/profile: 13 | 14 | > 15 | function vvim() { vim `whereis $1|cut -d: -f2` } 16 | function ggvim() { gvim `whereis $1|cut -d: -f2` } 17 | < 18 | 19 | Then just type, for example, "vvim ls", and you'll start vim with /bin/ls and 20 | /usr/share/man/ls.1.gz loaded. (it's not very useful to edit /bin/ls, but you 21 | get the ideea). 22 | 23 | A more useful example: vvim profile 24 | 25 | COMMENTS *vtw-301-comments* 26 | 27 | I liked the idea, great for editing scripts, but it didn't work for the 28 | shells I use. Here's how I got it to work for the 2 shells I use: 29 | 30 | For 'bash': 31 | 32 | > 33 | vvim () { command vim `whereis "$@" | cut -d: -f2` ; } 34 | < 35 | 36 | For 'tcsh' in .tcshrc: 37 | 38 | > 39 | alias vvim 'vim `whereis \!* | cut -d: -f2` ' 40 | < 41 | 42 | ============================================================================== 43 | 44 | CATEGORIES *vtw-301-cats* 45 | 46 | Review |vtw-by-category-review| 47 | 48 | 49 | vim:tw=78:et:ft=help:norl: -------------------------------------------------------------------------------- /doc/vim-tips-wiki-859.txt: -------------------------------------------------------------------------------- 1 | *vim-tips-wiki-859.txt* Show how many lines between matching pairs *vtw-859* 2 | 3 | Tip 859 [https://vim.fandom.com/wiki/Show_how_many_lines_between_matching_pairs] Previous |vtw-858| Next |vtw-860| 4 | 5 | created 2005 · complexity basic · version 6.0 6 | 7 | ============================================================================== 8 | 9 | There are many situations where you may want to count the number of lines 10 | between matching pairs of characters, such as parenthesises and braces. This 11 | can be especially useful when programming Java, C++, Perl. 12 | 13 | Simply set the following: 14 | 15 | > 16 | :set showcmd 17 | < 18 | 19 | After this, in bottomright corner of vim window you will see count of lines 20 | currently selected in visual mode (if there are any), among many other useful 21 | things. 22 | 23 | Now, to see how many lines are between pairs, you set cursor on first pair, 24 | enter visual mode and press %. Now in bottom right corner you see desired 25 | number. 26 | 27 | Or, for certain matched pairs like {...} groups in a C program, you can use a 28 | text object. For example, in C code, anywhere within matched braces, enter 29 | visual mode and press "iB" to select everything between the braces. The bottom 30 | right corner contains the desired count. 31 | 32 | COMMENTS *vtw-859-comments* 33 | 34 | TO DO 35 | - Rename tip to make it a more generic tip on the 'showcmd' option? 36 | 37 | 38 | CATEGORIES *vtw-859-cats* 39 | 40 | Usage |vtw-by-category-usage| 41 | Todo |vtw-by-category-todo| 42 | 43 | 44 | vim:tw=78:et:ft=help:norl: -------------------------------------------------------------------------------- /doc/vim-tips-wiki-1294.txt: -------------------------------------------------------------------------------- 1 | *vim-tips-wiki-1294.txt* Ignore white space in vimdiff *vtw-1294* 2 | 3 | Tip 1294 [https://vim.fandom.com/wiki/Ignore_white_space_in_vimdiff] Previous |vtw-1291| Next |vtw-1295| 4 | 5 | created 2006 · complexity basic · author vagusri · version 5.7 6 | 7 | ============================================================================== 8 | 9 | I had been searching for a way to ignore white spaces while using vimdiff. 10 | Unfortunately, `vimdiff -h` yields the generic Vim help. I finally found that 11 | including the following line in vimrc solves the problem. 12 | 13 | > 14 | set diffopt+=iwhite 15 | < 16 | 17 | From the command line use: 18 | 19 | > 20 | vimdiff -c 'set diffopt+=iwhite' ... 21 | < 22 | 23 | To have vimdiff ignore whitespace while normal vim doesn't, simply put this 24 | into your .vimrc: 25 | 26 | > 27 | if &diff 28 | " diff mode 29 | set diffopt+=iwhite 30 | endif 31 | < 32 | 33 | To have a toggle way to ignore / not ignore whitespaces in vimdiff, put this 34 | into your .vimrc: 35 | 36 | > 37 | if &diff 38 | map gs :call IwhiteToggle() 39 | function! IwhiteToggle() 40 | if &diffopt =~ 'iwhite' 41 | set diffopt-=iwhite 42 | else 43 | set diffopt+=iwhite 44 | endif 45 | endfunction 46 | endif 47 | < 48 | 49 | REFERENCES *vtw-1294-references* 50 | - :help |vimdiff| 51 | - :help 'diffopt' 52 | 53 | 54 | CATEGORIES *vtw-1294-cats* 55 | 56 | VimDiff |vtw-by-category-vimdiff| 57 | 58 | 59 | vim:tw=78:et:ft=help:norl: --------------------------------------------------------------------------------