Skip to main content

Home/ VIM Editor/ Group items tagged file

Rss Feed Group items tagged

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

VI and VIM editor: Tutorial and advanced features - 0 views

  • Hyper-Linking to include files: Place cursor over the file name (i.e. #include "fileABC.h") Enter the letter combination: gf (go to file) This will load file fileABC.h into vim. Use the following entry in your ~/.vimrc file to define file paths. Change path to something appropriate if necessary. "Recursively set the path of the project.set path=$PWD/**
reckoner reckoner

Übergibson: Embedding vim Settings in the File You're Editing - 0 views

  • lets you embed options in the file itself so that other people who edit the file in vim will see it the way you do—all the tabs will line up correctly, etc., regardless of how they have their ~/.vimrc file set up. This is called a modeline, in the parlance of our times.
reckoner reckoner

vimsh.tar.gz - terminal/shell buffer script for python enabled [g]vim : vim online - 0 views

  • A terminal/shell buffer script for python enabled [g]vim (+python).  Allows execution of shell commands in a vim buffer. It does not use r! <cmd>.   Some of it's features:       - It retains state because it's interactive.  For example, set an environment variable and it "stays" because the          shell process is the same through the whole session.       - It can run interactive line based programs like ftp/telnet/python/ssh/etc including masked password input (pty supported platform only).       - Since it's a vim buffer you can go into normal mode and move around the buffer, yank, paste, use word completion, etc       - Runs on Linux and Windows, primary development and testing is done on Linux.  Windows has limitations          ( no interactive programs ) due to lack of pty support.        Requirements: To use it you must have a python enabled [g]vim and run on a platform that supports pty ( i.e. Linux ), or pipes ( Windows, Linux, et all ). The pty version has much better formatted output than the pipes version and supports running interactive programs.  Please read vimsh.readme for other installation details.  Tested on vim 6.0 using Slackware and Gentoo Linux, FreeBSD, and Windows XP.   I'd also like to hear from users running other operating systems, i.e. QNX/Solaris/other BSDs. !!!!! WINDOWS USERS !!!!!, there is a zip file available at the above link. The version kept here on vimonline is a tarred, gzipped file ( tar.gz ). If you are going to use Winzip with the .tar.gz file be sure to turn off the "Tar file smart CR/LF handling". It doesn't work well. Please send me bug reports and suggestions if you use it.  I appreciate all the patches I've been getting lately!
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

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

clipboarded: vim as an IDE - 0 views

  • File exploringAlright. You need two plugins, NERDTree and BufExplorer.NERDTree is started by typing :NERDTree and it will give you a much better file explorer than any other IDE. BufExplorer is started by typing \be and it will allow you to access a list of recently used files, and switch between them quickly.You might also want to bone up on windows and tabs (:help windows and :help tabs)
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

How can I work on VIM for python code such as cscope for C code? - 0 views

  • Change to the top level directory that contains your python source files, and do find -name '*.py' > cscope.files cscope -b
  • How can I work on VIM for python code such as cscope for C code?
reckoner reckoner

taglist.vim - Source code browser (supports C/C++, java, perl, python, tcl, sql, php, e... - 0 views

  • The "Tag List" plugin is a source code browser plugin for Vim and provides an overview of the structure of source code files and allows you to efficiently browse through source code files for different programming languages.  You can visit the taglist plugin home page for more information
reckoner reckoner

DirDiff.vim - A plugin to diff and merge two directories recursively. : vim online - 0 views

  • This is a utility that performs a recursive diff on two directories and generate a diff "window".  Based on that window you can perform various diff operations such as opening two files in Vim's diff mode, copy the file or directory recursively to the other, or remove the directory tree from the source directory.
reckoner reckoner

Daily Vim: Vim to Postscript - 0 views

  • Here's a little Vim trick that might be of interest. If you're on a non-Windows machine, you can make the Vim hardcopy command print to a postscript file instead of a real printer. Try issue the following::hardcopy > file.ps
reckoner reckoner

SCMDiff - Highlight changed lines in a file via SCM diff command : vim online - 0 views

  • It allows you to quickly toggle (through a keybinding, Ctrl-D by default) the highlighting of changed lines in a file through an SCM's diff command.
  •  
    needed some hand tweaking on my part to get it to work
reckoner reckoner

Vim documentation: eval - 0 views

  • :au BufReadPost * if line("'\"") > 1 && line("'\"") <= line("$") | exe "normal! g'\"" | endif
  •  
    Restore the cursor to the file position in previous editing session
reckoner reckoner

GVim won't 'cd' to dropped file's dir - vim_use | Google Groups - 0 views

  • Andrew schrieb: > Is there a way to get GVim to auto-`cd` to a dropped file's directory? > My gripe is that when I `:sav` the edited file giving it a new name, it > ends up in my home directory, which *of course* is not what I'd want to > do. > I'm using version 7.0.237 on KDE 3.5 for Linux. > Thanks in advance, > Andrew     :h drag-n-drop hold down Shift while dropping the file. For similar situations, I need this often but not always, thus I mapped a function key to it:     :nn <F3> :cd %:p:h<cr>     :h ::p If you want it always, set 'autochdir'     :h 'acd
reckoner reckoner

vim : Message: RE: repeating action between marks - 1 views

  • RE: repeating action between marks >Say for example I'd like to indent the text between lines 10-20. I'd >like to use marks points to indicate the lines through which to >repeat the last action I performed on a single line (in this case an >indentation), how would I do that? >I know I could for example do some regex like this: >:'a,'bs/^/ / >and clearly I can do this with a visual selection. >but how could I repeat the last action I performed over two marks: >:'a,'b<something goes here to indicate 'repeat last action'> '&' is a good start. Eg, if I use a 's///' command on one line just to see if it works as expected, I can repeat it through the entire file with :g//& :.,$& :15,20& etc., and it'll redo the 's///' command on the rest of the file or whatever limits you impose. If you do a non-'s///' command, eg, ":10,30>" to indent lines instead, you can look for patterns, etc., and do things like :/beginpattern/,/endpattern/> too. Not quite sure if that's what you were asking about, but if not, just yell back...
reckoner reckoner

Vim Color Editor HOW-TO (Vi Improved with syntax color highlighting) - 0 views

  • If a file type you want to use is not detected, then there are two ways to add it.
  •  
    how to customize syntax highlighting for new types fileTypes
reckoner reckoner

minibufexpl.vim - Elegant buffer explorer - takes very little screen space : vim online - 0 views

  • description Several modern GUI editors list your open buffers as tabs along the top or bottom of your screen (VisualStudio, DreamWeaver, EditPlus and UltraEdit come to mind), now we have this feature in VIM! You can checkout a screenshot here: http://www.wavell.net/vim/vim_screenshot.gif. You can quickly switch buffers by double-clicking the appropriate "tab" (if you don't want to use the mouse just put the cursor on the "tab" and press enter). As you open and close buffers the tabs get updated. Buffers that are modified get visually marked and buffers that are open in a window get visually marked. The -MiniBufferExplorer- opens automatically when you open more than one eligible buffer (no need to open the explorer if you’re only editing one file.) -MiniBufExplorer- doesn't bother showing non-modifiable or hidden buffers. You can delete buffers by selecting them and pressing d on the keyboard.
1 - 20 of 32 Next ›
Showing 20 items per page