Skip to main content

Home/ VIM Editor/ Group items tagged howto

Rss Feed Group items tagged

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

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

Vim Cookbook - 0 views

  • This is the Vim cookbook page. It contains short recipes for doing many simple and not so simple things in Vim. You should already know the basics of Vim, however each command is explained in detail. Each set of instructions is a complete package. Feel free to pick and choose what you need.
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

Opening every buffer in its own tab - vim_use | Google Groups - 0 views

  • s Ben Fritz says, all you need is wildmenu completion on :b <Tab> An example, to show just how powerful this is: :set wildmenu wildmode=full
reckoner reckoner

shortcut for ex ranges - vim_use | Google Groups - 0 views

  • > Hi, > After reading the thread on asynchronous processes I was just looking > at the help for the ! command which I rarely use, and after playing > with it I realized that it translates a motion from normal mode into a > range for an ex command, i.e. doing !2j gives you an ex command line > of :.,+2! to start your filter with.  This made me wonder: Is there a > way to do this without the filter?  In other words, instead of having > to type :.,+2s I could get there with a 2j combined with something.  I > realize I can do it with the ! itself by just backspacing over the ! > at the end of the ex command, but is there a more 'official' way to do > this? No, there isn't. But in your example, you know the number of lines you want to get in your range, so you can type     3: to get     :.,.+2 In general: !2j  has the form {operator}{motion}     :h operator You can create a custom operator (and name it e.g. "g:") with     :h g@ Once it has been done here (from Jan 2008, see the whole discussion) http://groups.google.com/group/vim_dev/msg/c6fb56645c188244 The details are somewhat tricky (if this reads better than ugly ...).
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

Preexisting code indentation - Vim Tips Wiki - a Wikia wiki - 0 views

  • lternative: if your file has indent 4 and you want an indent of 3 and gg=G is not working as expected, try :set inde=indent(v:lnum)/4*3 then go ahead with the well known gg=G use tabs or spaces, doesn't matter
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

Daily Vim: Quick Paste - 0 views

  • You may have noticed that pasting outside text into Vim from insert mode can lead to awkwardly stair-stepped text. You may also know that this is easily avoidable via :set paste from normal mode. I paste from outside often enough, that I've added the following to my vimrc making it that much easier.set pastetoggle=<F5>
1 - 19 of 19
Showing 20 items per page