Skip to main content

Home/ VIM Editor/ Group items tagged search

Rss Feed Group items tagged

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

Search for visually selected text - Vim Tips Wiki - a Wikia wiki - 0 views

  • With the following, you can use g/ (or g?) to search forwards (or backwards) for the currently selected text.
reckoner reckoner

Search and replace in a visual selection - Vim Tips Wiki - a Wikia wiki - 0 views

  • In visual mode, / and ? will update the visual selection just like any other cursor-movement command. In order to actually search within the visual selection, you will need to use the \%V atom, or use the markers defined by the visual selection with \%>'< and \%<'> atoms. This is best done by leaving the visual selection with <esc> before entering your search. You may want to consider a mapping to automatically leave visual selection and enter the appropriate atom(s). For example:
reckoner reckoner

Mozilla Firefox - 0 views

  • Nevertheless, spawning a shell in a VIM window is something I desperately sought after since the first day I started working with VIM, and searching on Google reveals that I'm not the only person. Someone even hacked together a Python script so you can start a shell in a window, but it's no terminal emulator, so your possibilities with this "shell" are limited. I wanted to have a real, working shell in VIM, so I wouldn't have to switch around with screen, use half-hearty solutions like splitvt etc.
reckoner reckoner

grep.vim - Grep search tools integration with Vim : vim online - 0 views

  • The grep plugin integrates the grep, fgrep, egrep, and agrep tools with Vim and allows you to search for a pattern in one or more files and jump to them. To use this plugin, you need the grep, fgrep, egrep, agrep, find and xargs utilities. These tools are present in most of the Unix installations. For MS-Windows systems, you can download the GNU grep and find utilities from the following sites:
Chris 089

Vi Vim for netbeans | Get Vi Vim for netbeans at SourceForge.net - 0 views

  •  
    Vi editor mode for netbeans. Does not really integrate vim, but allows basic vim-like command-mode, searching, etc.
reckoner reckoner

Vamshi's Vim Notes - 0 views

  • Cursor line and more... * You can turn on cursor line and cursor columns ':set cursorline' ':set cursorcolumn'
  • * Pressing 'q:' or ':<Ctrl-f>' gives the command history window (list of previously executed commands in the current session) * Pressing 'q/' or '/<Ctrl-f>' gives the command history window (list of previously executed commands in the current session)
  • Note: to highlight special keywords we can use the match option as ':hi <MyGroup> ctermbg=red' ':mat <MyGroup> /<pattern>/' To clear these highlights do ':mat[ch]'
  • ...11 more annotations...
  • * '/<pattern1>\|<pattern2>' search for multiple patterns using OR '\|'
  • * Show lines matching word under cursor '[I'
  • Repositioning the Screen 'z' Move current line to top of screen 'z.' Move current line to center of screen 'z-' Move current line to bottom of screen
  • CaSe FOrmaTting "~" swaps the cAse of a single character "g~~" toggles the case of an entire sentence 'guu' or 'Vu' makes an entire sentence lowercase 'gUU' or 'VU' makes an entire sentence UPPERCASE 'vE~' flip case word 'vEU' upper case word 'vEu' lower case word 'ggguG' lower case entire file
  • '=}a' or '=a}' re-indents the current {.....} block relative to how the {, } have been indented General key syntax '=<motion>'
  • Navigating - "[c" will go to the line of the next difference "]c" will go to the line of the previous difference
  • One way to use this is to create a number list insert 1 'qa' 'yy' 'p' 'CTRL-A' on the new line to convert the 1 to a 2 'q' '20@a' and voila! You have number 1 to 22 pasted in your file
  • Three commands can be used to apply commands over multiple files ':argdo' ':windo' ':bufdo' 'argdo' applies a commands on all the files indicated by the 'args' command ':args *.[ch]' ':argdo %s/<pattern1>/<pattern2>/ge | update' The 'e' option suppresses errors if <pattern1> is not found in a
  • You can easily start editing at a previously saved state/views by using the '-S' arguement as 'vim -S session.vim' To create a session at some point, you can use the command ':mks[ession][!] <filename>'
  • :help local-additions' shows you the entries for the local help file
  • The 'set' options can be traced as follows ':verbose set ' - this helps trace from which file this option has been set We can figure out for a particular group what 'autocmd' has been set ':autocmd ' - this shows all that has been set for a particular group & filetype
reckoner reckoner

cecscope - command and menu driven cscope interface : vim online - 0 views

  • (requires vim7.0aa snapshot #188 or later) DrChip's cscope interface supports commands:     CS     [cdefgist]   : cscope     CSl[!] [cdefgist]   : locallist style (! restores efm)     CSs[!] [cdefgist]   : split window and use cscope     !            split vertically     c (calls)    find functions calling function under cursor     d (called)   find functions called by function under cursor     e (egrep)    egrep search for the word under cursor     f (file)     open the file named under cursor     g (global)   find global definition(s) of word under cursor     i (includes) find files that #include file named under cursor     s (symbol)   find all references to the word under cursor     t (text)     find all instances of the word under cursor
reckoner reckoner

automatic type along completion as in Notepad++? - vim_use | Google Groups - 0 views

  • augroup foo   au!   au CursorMovedI,InsertEnter * if search('\k\{2,}\%#\k\@!','ncb') |               \ call feedkeys("\<c-n>\<c-p>","t") | endif augroup END inoremap <expr><cr> pumvisible()?"\<c-n>\<c-y> ":"\<cr>" Pressing return-key will accept the first match. Be ready to exit the editor.
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
1 - 12 of 12
Showing 20 items per page