# VIm fancy

## Cr0t

```
let color = "true"

if has("syntax")

    if color == "true"

        " This will switch colors ON

        so ${VIMRUNTIME}/syntax/syntax.vim

    else

        " this switches colors OFF

        syntax off

        set t_Co=0

    endif

endif

set bs=2

set cin
```

copy and past the code into .vimrc and put the file into your home dir.

----------

## mksoft

While at it you can add:

```
" Use Vim settings, rather then Vi settings (much better!).

" This must be first, because it changes other options as a side effect.

set nocompatible

set history=50          " keep 50 lines of command line history

set ruler               " show the cursor position all the time

```

----------

## ChiaJesus

This is a really good tip. Thanks for sharing it!

-Chia

----------

## DArtagnan

yeap,

i copied it too  :Smile: 

----------

## RoadRunner

Yeah, nice tip! Thanks a lot

----------

## michaelb

more VIM goodness... Add some autocommands to your .vimrc file!

My favs:

```

" Note: In Vim a continuation line starts with \

:autocmd FileType *

\     set formatoptions=tcql nocindent comments&

:autocmd FileType c,cpp

\     set formatoptions=croql cindent

\     comments=sr:/*,mb:*,ex:*/,://

:set autoindent

:set autowrite

```

This will help with C and C++ code beautification.  :Smile: 

For a full listing of autocommands

```

:help autocmd

```

----------

## masseya

Here's some more good options for programmers (non-python):

```
set tabstop=2

set expandtab

set shiftwidth=1
```

----------

## masseya

Also, if you are looking for a neato tab completion utility check out SuperTab.  It is pretty cool.  Basically, you could be programming and have a variable named: really_descriptive but all you would have to type to reference it would be: rea <tab>.  It's really helpful.   :Smile: 

----------

## delta407

 *Tristam29 wrote:*   

> Basically, you could be programming and have a variable named: really_descriptive but all you would have to type to reference it would be: rea <tab>.  It's really helpful.  

 

So... sorta like bash. Cool.  :Very Happy: 

----------

## grakker

Way back when I was taking first year C programming, I found vi to be super slick.  I can't remember if it was out of the box or not (I think so though) but after first typing a variable or function, I could type the first few letters of the name, then hit cntrl-p and it would cycle through names that matched the pattern.

But even cooler than that was a .vimrc setting that I downloaded from somewhere that let me compile from inside vi and if the compiler farted on a syntax error or whatever, it would return to the line where the error occurred.  I don't know if I explained that very well, but it sure made that first semester easy.

Haven't programmed in awhile, but I still have a pretty warm spot for vim.

----------

## rojaro

here my two cents ... :)

most people use a black background on the console and the terminal/ssh clients. as vim uses the dark-blue color for comments they're often hardly readable (depending on the montior). add the following line:

```
hi Comment term=bold ctermfg=6 guifg=Blue
```

ctermfg defines the color, which is in the example cyan, which is much better readable.

----------

## riksta

here is a little tip from me, some of you may know it...some may not

When pasting into vim from say, a webpage, if all the layout of the text gets all auto indented (and pushed further and further right), before you press i to paste, type

```

:set paste

```

simlarly its nopaste to turn it back on  :Very Happy: 

----------

## Twink

 *masseya wrote:*   

> Also, if you are looking for a neato tab completion utility check out SuperTab.  It is pretty cool.  Basically, you could be programming and have a variable named: really_descriptive but all you would have to type to reference it would be: rea <tab>.  It's really helpful.  

 

isn't that just like pressing ctrl-P or ctrl-N while in insert mode?

----------

## riksta

well i just tried that ctrl+p and it doesnt work for me..i get:

-- Keyword completion (^N^P) Pattern not found

----------

## Narada

Add the code below to ~/.vimrc to set an F10 shortcut for pasting.  So, before pasting, press i to go into insert mode and press F10 to enter paste mode.  The order in which you press these doesn't matter.  

```
set pastetoggle=<F10>
```

----------

## hanzotutu

how to set expandtab if I am editing a fortran code (*.f)

I tried

```

autocmd FileType f set expandtab

```

but it doesn't work.

----------

## minaguib

Here are some chunks from my .vimrc file that you guys might find useful:

```

set nobk

set ignorecase

set smartcase

set ttyfast

set visualbell t_vb=

set smarttab

set autoindent

set title

set ruler

set splitbelow

set tabstop=3

set shiftwidth=3

set wildignore=*.bak,~,*.o,*.info,*.swp,*.class,*.aux,*.log,*.tmp,*.tar,*.gz,*.tgz

set tags=./tags;../tags;../../tags;../../../tags;../../../../tags;~/tags

set dictionary-=/usr/share/dict/words dictionary+=/usr/share/dict/words 

set complete-=k complete+=k

set modeline

vnoremap < <gv

vnoremap > >gv

nmap n nmzz.`z

nmap N Nmzz.`z

nmap * *mzz.`z

nmap # #mzz.`z

nmap g* g*mzz.`z

nmap g# g#mzz.`z

map <C-P> :w !$ALIASPERL<CR>

map c<C-P> :w !$ALIASPERL -cw<CR>

map t<C-P> :%!perltidy -q -et=4 -l=0 -pt=2 -bar -cab=0 2>/dev/null<CR>

map <C-N> n

map <Space> za

syntax on

let perl_fold=1

autocmd BufWritePost *.pl,*.pm,*.cgi !$ALIASPERL -c %

autocmd BufEnter     *.pl,*.pm,*.cgi let oldkp=&kp | set keywordprg=$ALIASPERL\ -e\ '$c=shift;exec\"$ALIASPERLDOC\".($c=~/^[a-z]+$/?\"\ -f\ \":\"\ \").$c'

autocmd BufLeave     *.pl,*.pm,*.cgi let &keywordprg=oldkp

if version >= 600

   set guifont=Terminus\ 11

   set wildmenu

   filetype plugin indent on

   set dy=uhex

   

   silent! source ~/dotfiles/colorscheme.vim

   silent! source ~/dotfiles/taglist.vim

   let Tlist_Ctags_Cmd=$ALIASCTAGS

   let Tlist_Sort_Type="name" 

   let Tlist_Compact_Format=1 

   let Tlist_Exit_OnlyWindow=1 

   let Tlist_Inc_Winwidth=0

   nnoremap <silent> <F8> :Tlist<CR>

   nnoremap <silent> <F7> :TlistUpdate<CR>

   silent! source ~/dotfiles/EasyAccents.vim

endif

```

----------

## hanzotutu

 *hanzotutu wrote:*   

> how to set expandtab if I am editing a fortran code (*.f)
> 
> I tried
> 
> ```
> ...

 

I figured out by myself.....add this line to .vimrc will do the trick

```

autocmd FileType fortran set expandtab

```

----------

## Wi1d

Great tips. I really like the 'set pastetoggle=<F10>'. I do have a question maybe someone knows the answer to. When using vim & mutt to write and then edit an email, the revised version can look really chopped up, because of textwidth, leaving alot of partial lines and more editing work. Anyone know of a way to prevent this?

----------

## tactless

 *Cr0t wrote:*   

> 
> 
> ```
> let color = "true"
> 
> ...

 

Actually, this would suffice: 

```
syntax on
```

 *rojaro wrote:*   

> most people use a black background on the console and the terminal/ssh clients. as vim uses the dark-blue color for comments they're often hardly readable (depending on the montior). add the following line:
> 
> ```
> hi Comment term=bold ctermfg=6 guifg=Blue
> ```
> ...

 

Slightly better way to do avoid this problem:

```
set bg=dark
```

And if you use the GUI:

```
hi Normal guibg=black guifg=white
```

----------

## kashani

and if you're using SecureCRT under Windows to connect to your Linux box you must set your term type to be'linux' and then set ANSI color for color to work right. vt100 and other nonsense will show you shell colors, but it won't work for vim and other things. 

kashani

----------

## Bushwack

 *Narada wrote:*   

> Add the code below to ~/.vimrc to set an F10 shortcut for pasting.  So, before pasting, press i to go into insert mode and press F10 to enter paste mode.  The order in which you press these doesn't matter.  
> 
> ```
> set pastetoggle=<F10>
> ```
> ...

 

Taking it one step furthur:

```
nmap <silent> <C-V> :set paste<CR>"*p:set nopaste<CR>
```

Here's a couple more from my vimrc:

```
au Syntax * syn match Error /\s\+$\| \+\ze\t/  " highlight extra whitespace

set incsearch  " make search like the mozilla find as you type

```

----------

## Wi1d

 *Wi1d wrote:*   

> Great tips. I really like the 'set pastetoggle=<F10>'. I do have a question maybe someone knows the answer to. When using vim & mutt to write and then edit an email, the revised version can look really chopped up, because of textwidth, leaving alot of partial lines and more editing work. Anyone know of a way to prevent this?

 

Here is what you do to fix that. Put the following into your .vimrc file:

```
nnoremap R gqap

vnoremap R gq
```

Then after you edit your emails do a <shift>V to highlight the edited area and then hit <shift>R rewrap your lines.

----------

## Leffe

Emerge app-vim/gentoo-syntax for syntax files for Gentoo configuration files like /etc/portage/packages.keywords.

----------

## sireyessire

 *Leffe wrote:*   

> Emerge app-vim/gentoo-syntax for syntax files for Gentoo configuration files like /etc/portage/packages.keywords.

 

For fluxbox users there is also a package for highlighting syntax:

app-vim/fluxbox-syntax  :Wink: 

----------

## Xk2c

 *Bushwack wrote:*   

> 
> 
> ```
> nmap <silent> <C-V> :set paste<CR>"*p:set nopaste<CR>
> 
> ...

 

Thanks. That i was looking for.   :Smile: 

----------

## gAzo0o

I would like to ask, if there is a way to set the tab key to produce let's say 4 spaces. I'm doing a little python coding and I preffer spaces, but it would more comfortable doing them with just the tab key - like i can in eric for example. I'm trying to switch from eric to vim, which I found more useful  :Smile: 

----------

## Mousee

 *gAzo0o wrote:*   

> I would like to ask, if there is a way to set the tab key to produce let's say 4 spaces. I'm doing a little python coding and I preffer spaces, but it would more comfortable doing them with just the tab key - like i can in eric for example. I'm trying to switch from eric to vim, which I found more useful 

 

Something like this should work:

```

set tabstop=4

```

The above sets the number of spaces that a <Tab> counts for.

----------

## gAzo0o

Thanks, but that's still a tab, not spaces. I don't want to mix them.

----------

## Xk2c

 *gAzo0o wrote:*   

> Thanks, but that's still a tab, not spaces. I don't want to mix them.

 

```
set tabstop=4 

set expandtab
```

----------

## gAzo0o

 *Xk2c wrote:*   

> 
> 
> ```
> set tabstop=4 
> 
> ...

 

That's what I was looking for. Thanks.

----------

## Dralnu

 *tactless wrote:*   

> Slightly better way to do avoid this problem:
> 
> ```
> set bg=dark
> ```
> ...

 

That solves a major problem I had. Thanks.

I'm going to look through my "Learning the vi editor" book and see if I cann't come up with something handy...

----------

## Dralnu

For the coders out there:

So when you go to overwrite a file, there is a backup saved

```
set backup
```

Save said backup to the same dir the file is in:

```
set backupdir=.
```

To see the line numbers next to the lines:

```
set number
```

If you have a thing for wordwraps:

```
set wrapmargin=?
```

 Where ? == the point you want the line to break at.

yw

----------

## dashnu

emerge aspell aspell-en spellutils

Add this to vimrc

```
# Spell Check.

map ^T :w!<CR>:!aspell check %<CR>:e! %<CR>

map ^T \1\2<CR>:e! %<CR>

map \1 :w!<CR>

map \2 :!newsbody -qs -n % -p aspell check \%f<CR>

```

Those are control chars so you need to type ctrl v ctrl t

handy for mutt users.

----------

## Sedrik

Here is my vimrc =)

```

"show the 'ruler' in the status bar, that is always show current location.

set ruler

"Tell us what mode we are currently in =)

set showmode

"No auto break line plz

set textwidth=0

"Ignore case search

set ignorecase

"Mouse settings, no mouse window focus

set nomousefocus

"Hide mouse when printing

set mousehide

"xterm functionality

set mousemodel=extend

"No ugly bracketjumpingmatching, DIE EMACS DIE

set noshowmatch

"Expand tabs to 2 spaces, always!

set tabstop=2

set shiftwidth=2

set expandtab

"Use tab for autocompletion

set wildchar=<Tab>

"Allow command completion listing

set wildmenu

set wildmode=longest:full,full

"Replace unknown commands with hex values.

set display+=uhex

"Nice indentation

set autoindent

"I dont like auto saving.

set noautowrite

"No wrap around long lines, let them continue

set nowrap

"Search during type

set incsearch

"Make backspace behave normal

set backspace=2

"Report alot

set report=0

"Allow nice command prompt

set cmdheight=2

"Enable syntax highlightning and some nice filetype associations

syntax enable

filetype on

filetype plugin on

filetype indent on

" Paste with ctrl+v

nmap <silent> <C-v> :set paste<CR>"*p:set nopaste<CR>

" You can use - to jump between windows

map - <c-w>w

",v brings up my .vimrc

",V reloads it -- making all changes active (have to save first)

map ,v :sp ~/.vimrc<CR><C-W>_

map <silent> ,V :source ~/.vimrc<CR>:filetype detect<CR>:exe ":echo 'vimrc reloaded'"<CR>

"Highlight trailing backspaces =)

highlight WhiteSpaceEOL ctermbg=Red guibg=Red

match WhiteSpaceEOL /\s\+$/

autocmd WinEnter * match WhiteSpaceEOL /\s\+$/<CR>

" Load xml fold settings

let g:xml_syntax_folding = 1

```

Now to my question.

Does anyone know how to make page up/down work and behave like normal? on my laptop they are next to my arrow keys and I hate when i accidently thouch page down when i'm reaching for an arrow key because the marker don't remember where it was when I press page up again.

----------

## Dralnu

Remap them to the cursor keys you mean? I'd think that would be fairly simple, I just don't remeber how...

----------

## Sedrik

 *Dralnu wrote:*   

> Remap them to the cursor keys you mean? I'd think that would be fairly simple, I just don't remeber how...

 

That would kill the functionality of the keys.. I still want to be able to use them just that if I accidentily press one of them I want to press the other one and be back where I was.

----------

## Dralnu

 *Sedrik wrote:*   

>  *Dralnu wrote:*   Remap them to the cursor keys you mean? I'd think that would be fairly simple, I just don't remeber how... 
> 
> That would kill the functionality of the keys.. I still want to be able to use them just that if I accidentily press one of them I want to press the other one and be back where I was.

 

Hrm. Best I could say would be see if you cann't remap them in the program (sorry if I wasn't clear).

----------

## Sedrik

 *Dralnu wrote:*   

>  *Sedrik wrote:*    *Dralnu wrote:*   Remap them to the cursor keys you mean? I'd think that would be fairly simple, I just don't remeber how... 
> 
> That would kill the functionality of the keys.. I still want to be able to use them just that if I accidentily press one of them I want to press the other one and be back where I was. 
> 
> Hrm. Best I could say would be see if you cann't remap them in the program (sorry if I wasn't clear).

 

hmm ok, will have to look at it some more then :/

----------

## numerodix

How do I remap <F2> to save the file regardless of what mode I am in? So far I have

```
map! <F2> <ESC>:w<RETURN>i
```

But this only works in insert mode. I would like it to work in command mode as well.

----------

## clock_cycles

:%s/\(.*\)\(\/\/\)\(.*\)/\1\/\*\3 \*\//

That will make comments like "//" change to C comments like "/* ... */".

\(.*\)

That is any region of text.  The \1 and \3 represent regions one and three respectively.

Correct me if I'm wrong.

----------

## truc

you know you can use something else than the default delimiter '/', and just FYI there is no need to escape the * at the right side of the second delimiter

so  shorter version would be

```
%s://\(.*\):/* \1 */:
```

----------

## numerodix

 *numerodix wrote:*   

> How do I remap <F2> to save the file regardless of what mode I am in? So far I have
> 
> ```
> map! <F2> <ESC>:w<RETURN>i
> ```
> ...

 

Found this out myself by just trying it.   :Confused: 

```
map! <F2> <ESC>:w<RETURN>a

map  <F2> :w<RETURN>

map! <F3> <ESC>:tabnew<RETURN>

map  <F3> :tabnew<RETURN>
```

----------

## w98

Wow, kinda surprised nobody here has mentioned more about folding, one of my favorite aspects of vim:

```
set fdm=marker fmr=[[[,]]]
```

This essentially turns this code (simple php as an example): 

```
<?php

function blah ($param1,$param2) //[[[

{

  // my code goes here

  // etc

} //]]]

?>
```

into something easier to read when wrapped all around a series of functions when you open the file:

```
<?php

+--  8 lines: function do_query($sql)//-----------------------------------------

+-- 14 lines: function do_sql($sql,$db=0) //------------------------------------

+-- 22 lines: function save_new_data($tablename,$details) //--------------------

+-- 22 lines: function save_old_data($tablename,$details,$where_clause) //------

+-- 13 lines: function clean_array($array) //-----------------------------------

+-- 11 lines: function get_fields($tablename) //--------------------------------

?>

```

To expand a folded piece of code, just move your cursor over it, and hit 'zo' for open, or 'zc' to close ... it's awesome for really huge pieces of code. I tend to put these markers around large loops, entire functions, etc.

The square braces can be replaced ... the default is {{{ and }}} respectively, but since most of my (current) scripting work is PHP/Perl, I decided something that wouldn't make it harder to use the '%' key to find matching braces.

For the record, my full .exrc file is 

```
set tabstop=2 shiftwidth=2 ai ignorecase fdm=marker fmr=[[[,]]] nohls

syntax on
```

nohls turns off the highlighting during searches, 'ai' is the auto-indent ("set noai" turns it off for pasting), ignorecase obviously forces case-insensitive text searches, and tabstop/shiftwidth have been covered a lot already.

My other favorite, for re-indenting code, is to open a source file, and type 

```
gg=G
```

 which if I recall calls the 'indent' application to reindent code as best as it can.

----------

## Sedrik

Instead of using folding markers I would recommend setting up some folding syntax. I have done this once for an xml file. By this way you get around the extremly anoying part of having to insert folding markers in your code (really ugly with bloat). It's a little bit harder to get exactly what you want but alot nicer. If you have ever worked in a project with people not using vi you will know why folding markers is a bad way to go.

Here is an example for an xml file (far from optimal though).

~/.vim/after/syntax/xml.vim

```
syn sync fromstart

set foldmethod=syntax

"This variable sets the fold level that you start in

set foldlevel=1

"This variable tells vim depth of nesting to use

set foldnestmax=3

"This sets the color of the folds to distinguish them from

"the rest of the text

highlight Folded ctermbg=DarkGrey ctermfg=DarkCyan
```

Then add "let g:xml_syntax_folding = 1" to your ~/.vimrc file.

This was taken from the openbox wiki page, go there for more info. http://gentoo-wiki.com/Openbox#Manual_Configuration

----------

## Sedrik

To everyone who is interested in folding I found this nice little peace of code in the tip section at vim.sourceforge.org

 *Quote:*   

> Just a note to all fold users,
> 
> :set fmr={,}
> 
> :set fdm=marker
> ...

 

Does someone know a way to determine what kind of file I'm currently viewing in vim? that way one could add this to his/hers vimrc and instant joy will follow.  :Very Happy: 

EDIT!

And to follow up on this. I was tipped about a much better way to do it.

put the set's in cpp.vim and put that file in ~/.vim/ftplugin/ and it will load automaticly. =)

----------

## Xk2c

 *Sedrik wrote:*   

> Does someone know a way to determine what kind of file I'm currently viewing in vim? that way one could add this to his/hers vimrc and instant joy will follow. 

 

(%R%Y,%{&encoding},%{&fileformat})

----------

## Sedrik

 *Xk2c wrote:*   

>  *Sedrik wrote:*   Does someone know a way to determine what kind of file I'm currently viewing in vim? that way one could add this to his/hers vimrc and instant joy will follow.  
> 
> (%R%Y,%{&encoding},%{&fileformat})

 

I found out that this was a little bit of an overkill.. se my previous post (the edited part)

----------

## Sedrik

A friend of mine tipped me today about this plugin for firefox, checck it out I find the hints (f) quite usefull =)

http://vimperator.mozdev.org/

----------

## smlgbl

 *Sedrik wrote:*   

> 
> 
> Now to my question.
> 
> Does anyone know how to make page up/down work and behave like normal? on my laptop they are next to my arrow keys and I hate when i accidently thouch page down when i'm reaching for an arrow key because the marker don't remember where it was when I press page up again.

 

You could map the keys to make a mark whenever you press them. To retain their original functionality though, it would probably be difficult to use just the opposite key for jumping back to that location. I think of a mapping like this: (I take it you know the mark-feature of vim)

```

imap <PageUp> <ESC>mp<C-B>a

nmap <PageUp> mp<C-B>

imap <PageDown> <ESC>mp<C-F>a

nmap <PageDown> mp<C-F>

```

Then, whenever you press Page-Up or Down, it will set a mark by the name of "p". If you intended to use the Page-Buttons, then it will reset that mark continually, rendering it useless, but you don't care as you anyway wanted to jump around your file. But if you actually wanted to use your normal arrow keys, then you can just press "`p" (without the quotation marks, but with the apostrophe, whatever it's called, the one left of the "1" key and "p") Then you will jump to the mark that you left. You might as well set another mapping for jumping back, if "`p" is to strenuous.

I hope this helped.

----------

## clock_cycles

Has anyone thought about a log file syntax?

```
~/.vim/syntax/log.vim

syntax keyword keyword emerge

syntax keyword keyword Cleaning

syntax keyword keyword Merging

syntax keyword keyword Updating

syntax keyword keyword Finished

syntax keyword keyword Compiling

syntax match number "\<[0-9]*\>"

syntax region String start="("hs=e+1 end=")"he=s-1

syntax region Comment start=">>>"hs=e+1 end="$"

highlight number ctermfg=DarkYellow

highlight keyword ctermfg=DarkGreen

highlight String ctermfg=DarkCyan

highlight Comment ctermfg=Magenta

~/.vimrc

autocmd BufRead *.log set filetype=log

```

----------

## smlgbl

 *Sedrik wrote:*   

> A friend of mine tipped me today about this plugin for firefox, checck it out I find the hints (f) quite usefull =)
> 
> http://vimperator.mozdev.org/

 

Thanks for the tip, I love it!

----------

## grx

These are all great tips-- thanks everyone.

Does anyone know how to get vi to automatically detect when it should start indenting, not just when the previous line is indented?

For example, if I type 

```
int main(void)

{
```

it would automatically try to indent the next line?

----------

## dkure

 *grx wrote:*   

> Does anyone know how to get vi to automatically detect when it should start indenting, not just when the previous line is indented?

 

```
set cindent
```

----------

## dustice

Just like to share something I found handy:

```
syntax sync fromstart
```

Fixes the mistaken syntax highlighting which occurs sometimes in longer files.

----------

## Sedrik

I recently found this little peace of code godness on the vim tip wiki.

```
"Highlight trailing backspaces =)

au Syntax * syn match Error /\s\+$/ | syn match Error /^\s* \t\s*/
```

It replaces the highlighting I have posted before and works like a charm without errors  :Smile: 

----------

## Wi1d

As far as scripts/plugins here is my top 3 list:

snippetsEmu - Be jealous of the mac's textmate no more. It's easy to customize and works great. I'm predicting in a future releases of this plugin I will only have to think and it will appear.

NERD_tree - Nice to set your projects directory

svncommand - Nice svn integration

autoclose - Inserts matching bracket, paren, brace or quote

----------

## iElectric

If I open a file from terminal with "gvim -p pathtofile", it opens every time a new instance of gvim with that tab.

Is there a way to let it use only one instance and add the tabs inside? (that is how it works in Windows for example)

----------

## BitJam

Take a look at  this page.

```
$ gvim --servername xyzzy file-1

$ gvim --serverlist

XYZZY

$ gvim --servername xyzzy --remote file-2
```

The first line opens file-1 in gvim and is a "vim server" named xyzzy.  The second line merely verifies that the xyzzy server is available.  The third line opens file-2 in the first gvim instance.

Unfortunately, this combo does not open file-2 in a new tab.  But maybe this will get you started in the right direction.  You can tell gvim to first open up a new tab with:

```
$ gvim --servername xyzzy --remote-send "<Esc>:tabenew<CR>"
```

I think it would be pretty easy to write a little Bash function that will let you open a bunch of files in tabs in an existing instance of gvim although there might be an easier way that I don't know about.

----------

## iElectric

BitJam, thank you very much! This is the key:

alias vim='gvim -p --servername gvim1 --remote-tab'

----------

## BitJam

I can't believe I missed remote-tab.  Thanks for posting the correct solution.  I will be using it.

----------

## Sedrik

Anyone that knows how to rebind every command in vim? I would like a list of the commands available so that I can change them (recently changed to sv_dvorak and now every key is quite messed up).

Thanks =)

----------

## Sedrik

I recently wrote this as a follow up of the G=gg tip that was posted.

```

map ? mnG=gg'nzz
```

It has some issues I would like to get your opinions on.

the mark is apperently set on the start of the line so you dont return to the exact same spot as you where in, can this be fixed?

You dont get to see where long lines where broken, if you have long strings this is anoying since c wont compile anymore then.

I would like to see how many rows where affected, can this be done?

----------

