Skip to main content

Home/ VIM Editor/ Group items tagged tips

Rss Feed Group items tagged

reckoner reckoner

Tip #63 - Applying substitutes to a visual block : vim online - 0 views

  • Applying substitutes to a visual block  tip karma   Rating 155/45, Viewed by 8082  Read and edit this tip on the Vim tip wiki. The wiki may have a more recent version of this tip. created:   March 28, 2001 8:26      complexity:   intermediate author:   Chip Campbell      as of Vim:   5.7 If you'd like to apply a substitute, or even any ex command, to a visual-block selected text region (ctrl-v and move), then you'll want Stefan Roemer's http://www.erols.com/astronaut/vim/vimscript/vis.vim .  Just source it in, and then press ":B".  On the command line you'll see :'<,'>BCtrl-V Just continue with the substitute or whatever... :'<,'>B s/abc/ABC/g and the substitute will be applied to just that block of text
reckoner reckoner

Tip #1439 - Using vim as an IDE all in one : vim online - 0 views

  • I've read a lot of tips about how to make vim as an IDE like editor. Most of them are really useful, and I want to sum up them in this tip, and then add some of my experiences.
reckoner reckoner

Vim tips and help - Amidst a tangled web - 0 views

  • View your search history: / Ctrl-F (:q to exit)
  • Restore the cursor to the file position in previous editing session (vim.org tip) Put this line in .vimrc: au BufReadPost * if line("'\"") > 0|if line("'\"") <= line("$")|exe("norm '\"")|else|exe "norm $"|endif|endif
reckoner reckoner

Tip #805 - Windows: gvim as an external editor : vim online - 0 views

  • This tip provides a (Windows only) means of using gvim as an external editor for almost any other program. This script has been tested with Lotus Notes and Internet Explorer on Windows NT.
reckoner reckoner

Tip #227 - Power of :g : for more context - 0 views

  • Display context (5 lines) for all occurences of a pattern     :g/<pattern>/z#.5     :g/<pattern>/z#.5|echo "=========="     << same as first, but with some beautification >> Delete all lines matching a pattern     :g/<pattern>/d Delete all blank lines (just an example for above)     :g/^\s*$/d Double space the file     :g/^/pu =\"\n\"     :g/^/pu _     << the above one also works >> Copy all lines matching a pattern to end of file     :g/<pattern>/t$ Yank all lines matching a pattern to register 'a'     0"ay0:g/<pattern>/y A Increment the number items from current line to end-of-document by one     :.,$g/^\d/exe "normal! \<c-a>" Comment (C) lines containing "DEBUG" statements     g/^\s*DEBUG/exe "norm! I/* \<Esc>A */\<Esc>" A Reverse lookup for records (eg: An address book, with Name on start-of-line and fields after a space)     :g/<patern>?^\w?p               "if only name is interested     :g/<patern>/ka|?^\w?p|'ap       "if name and the lookup-line is interested     :g/<patern>/?^\w?|+,/^[^ ]/-1p  "if entire record is interested Reverse a file (just to show the power of 'g')     :g/^/m0
reckoner reckoner

Tip #814 - Use cygwin shell : vim online - 0 views

  • set shell=C:/cygwin/bin/bash set shellcmdflag=--login\ -c set shellxquote=\"
reckoner reckoner

Tip #21 - easy pasting to windows apps : vim online - 0 views

  • In Vim, the unnamed register is the " register, and the Windows Clipboard is the * register. This means that if you yank something, you have to yank it to the * register if you want to paste it into a Windows app. If this is too much trouble, set the 'clipboard' option to 'unnamed'. Then you always yank to *. So pasting to windows apps doesn't require prefixing "* :   set   clipboard=unnamed
  • You can also have the Visual selection automatically copied to the clipboard.  If you :set go+=a
reckoner reckoner

Tip #77 - Displaying search results using folds : vim online - 0 views

  • A guy I work with told me about a function that an old IBM text editor had that he said was useful, and that is to create folds in the file after a search such that every line that is visible contains the search pattern(except possibly the first). All lines that do not contain the search pattern are folded up to the last occurence of the pattern or the top of the file.  One use for such a function is to be able to make a quick and dirty api of a source file.  For example, if working in Java, you could run the function using the pattern "public|protected|private" and ithe results would be that only the method headers would be visible (well, close enough).  
  •  
    call Foldsearch(pattern)
reckoner reckoner

A Collection of Vim Tips | Ayman Hourieh's Blog - 0 views

  • to auto-indent a piece of code, highlight it in visual mode, and press =. To auto-indent the current line, press ==. Use gq to wrap the highlighted peice of text.
  • SuperTab: Makes all insert-mode completion done with tab. To use, simply press TAB while in edit mode. minibufexpl: Adds a buffer explorer to the top of Vim's window, simplifies working with buffers. taglist: A source code browser that works with many languages, including C/C++, Java, Python, Perl, PHP, ... vcscommand: SVN/CVS integration.
1 - 20 of 42 Next › Last »
Showing 20 items per page