TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

Ask HN: What's in your .vimrc file?

123 pointsby Xichekolasover 15 years ago
Other than the default stuff of course. As you can see, my additions are quite pathetic so far (only been into vim for a few months):<p><pre><code> set expandtab set sts=2 if v:progname =~? "gvim" colorscheme twilight endif</code></pre>

45 comments

aliemover 15 years ago
I just keep swap files and backup ones in my .vim/ directory<p><pre><code> set backupdir=~/.vim/backup set backup set directory=~/.vim/tmp </code></pre> This to see line numbers on the left (i find it a bit more readable instead of watching at the bottom-right)<p><pre><code> set number </code></pre> added a simple way to speedup my writing with (I know it's crappy but it works ...until you need to add just one bracket/quote)<p><pre><code> " autocomplete parenthesis, brackets and braces inoremap ( ()&#60;Left&#62; inoremap [ []&#60;Left&#62; inoremap { {}&#60;Left&#62; " autocomplete quotes inoremap ' '&#60;Esc&#62;:call QuoteInsertionWrapper("'")&#60;CR&#62;a inoremap " "&#60;Esc&#62;:call QuoteInsertionWrapper('"')&#60;CR&#62;a inoremap ` `&#60;Esc&#62;:call QuoteInsertionWrapper('`')&#60;CR&#62;a function! QuoteInsertionWrapper (quote) let col = col('.') if getline('.')[col-2] !~ '\k' &#38;&#38; getline('.')[col] !~ '\k' normal ax exe "normal r".a:quote."h" end endfunction </code></pre> and mapped f1/f2 to switch buffer<p><pre><code> noremap &#60;f1&#62; :bprev!&#60;CR&#62; noremap &#60;f2&#62; :bnext!&#60;CR&#62; </code></pre> <i>Some of this wall of text was stolen from a nice, but a bit too big, vimrc i found somewhere</i><p>If you need something specific try <a href="http://vim.wikia.com/" rel="nofollow">http://vim.wikia.com/</a>
tsallyover 15 years ago
Do this to prevent yourself from learning the arrow keys while learning:<p><pre><code> map &#60;down&#62; &#60;nop&#62; map &#60;left&#62; &#60;nop&#62; map &#60;right&#62; &#60;nop&#62; map &#60;up&#62; &#60;nop&#62; imap &#60;down&#62; &#60;nop&#62; imap &#60;left&#62; &#60;nop&#62; imap &#60;right&#62; &#60;nop&#62; imap &#60;up&#62; &#60;nop&#62; </code></pre> (There's actually a recently reported bug that causes the up arrow to do some strange things, but you get the idea).
评论 #856489 未加载
txxxxdover 15 years ago
Most of what I use was copied from this excellent site: <a href="http://www.vi-improved.org/vimrc.php" rel="nofollow">http://www.vi-improved.org/vimrc.php</a>
评论 #856089 未加载
thristianover 15 years ago
Didn't we have one of these threads a little while ago? Ah yes, here we go:<p><a href="http://news.ycombinator.com/item?id=821100" rel="nofollow">http://news.ycombinator.com/item?id=821100</a><p>Here's a repost of my comment from that thread:<p>I've been using Vim for over ten years now, across several jobs and platforms and tasks, so my .vimrc and .gvimrc have gathered quite a bit of cruft. I keep them in a git repository along with my various other generically useful config files, and just check them out on each new machine I get an account on.<p>There's too much stuff in these files to describe what everything does, but there's a lot of comments, so along with the Vim online help you should be able to figure everything out:<p>.vimrc: <a href="http://paste.ubuntu.com/270714/" rel="nofollow">http://paste.ubuntu.com/270714/</a><p>.gvimrc: <a href="http://paste.ubuntu.com/270716/" rel="nofollow">http://paste.ubuntu.com/270716/</a><p>Highlights include a single key-binding for stepping through every buffer in every tab, consistent mouse-handling between console-vim and gvim, and code to automatically make gvim inherit the GNOME default monospace font.
jeyover 15 years ago
<p><pre><code> colors torte syn on set expandtab set tabstop=4 set shiftwidth=4 set ruler set ignorecase set autoindent set smartindent set hlsearch set incsearch set backspace=indent,eol,start set laststatus=2 autocmd BufEnter * :syntax sync fromstart "set hidden set history=1000 runtime macros/matchit.vim set wildmenu "set wildmode=list:longest set wildmode=longest:full,full set title set scrolloff=3 autocmd BufEnter *.rb :set ts=2 sw=2 "let c_space_errors=1 </code></pre> I'm kinda unsure what good posting this will do...
machriderover 15 years ago
This crap has accumulated over the years, so I'm not sure if any of it is obsolete or unneeded, but here's what I found in mine:<p><pre><code> set expandtab " Convert tabs to spaces set tabstop=4 " &#60;TAB&#62; four spaces set shiftwidth=4 " Shift width four spaces (for auto indent) set noautoindent " Turn off autoindent by default set smartindent " Use smart indent instead set incsearch " Use incremental searches (cool) set backspace=2 " Set backspace mode to allow backspacing in insert mode set ruler " Show position of cursor in status line set showmatch " Show matching parens/braces when writing code set wh=55 " Minimum window height set textwidth=78 " Maximum line width when writing comments " Speed up response to ESC key set notimeout set ttimeout set timeoutlen=100 " Make completion more like bash set wildmode=longest,list " Cure hangs during compiles? set swapsync= " For fuck's sake, don't throw away the indent when i hit # inoremap # X^H# " Disable auto-commenting of // in C/C++ au FileType c,cpp setlocal comments-=:// " Highlight trailing whitespace hi TrailingSpace ctermbg=1 au filetype c,cpp,python match TrailingSpace "\s\+\n"</code></pre>
brkover 15 years ago
Nothing.<p>I work on many different systems from time to time. I don't like to get too used to things that aren't universal. I have found out (the hard way) that relying on convenience can bite you in the ass when it's 3AM and you've been up for 67 consecutive hours and you execute some keystrokes from habit and they don't do what you expected.<p>I'll admit, I probably cripple my productivity overall for working this way, but it's what I'm used to.
评论 #856177 未加载
评论 #856306 未加载
评论 #856127 未加载
natover 15 years ago
<a href="http://bitbucket.org/natw/dotfiles/src/tip/.vimrc" rel="nofollow">http://bitbucket.org/natw/dotfiles/src/tip/.vimrc</a><p>some parts I haven't seen mentioned otherwise:<p><pre><code> set statusline=[TYPE=%Y]\ [ENC=%{&#38;fenc}]\ [ASCII=\%03.3b]\ [HEX=\%02.2B]\ [POS=%04l,%04v][%p%%] hi StatusLine term=bold,reverse cterm=bold ctermfg=7 ctermbg=0 hi StatusLineNC term=reverse cterm=bold ctermfg=8 </code></pre> gives me a nice status bar with some good info<p><pre><code> set t_Co=256 colorscheme railscasts </code></pre> best color scheme I've found yet, and I don't know how I lived before 256 colors<p><pre><code> set noerrorbells set novisualbell set t_vb= </code></pre> This might be redundant, but I hate error bells SO MUCH. This might be even more important than "set nocompatible".<p><pre><code> map ^P :set paste!&#60;CR&#62;:set paste?&#60;CR&#62; </code></pre> in python mode at least, autoindent will usually mess up pasted text<p>Plus the usual 4 space soft tab, autoindent stuff. I also highly suggest keeping your dotfiles in some kind of version control. It is definitely fun to see them grow, and I can't imagine working on multiple systems without it.
paulgbover 15 years ago
Mainly for python scripting, but works decently for most editing I do.<p><pre><code> syntax on " syntax highlighting set tabstop=4 " PEP-8 uses 4 spaces per indentation level set shiftwidth=4 " shifting (PEP-8) set expandtab " spaces instead of tabs (PEP-8, and just bettter in general) filetype on " file type detection filetype indent on " special indentation rules for file type filetype plugin on " auto-completion rules for file type set hls " highlight search terms (:noh to turn off temporarily) set ignorecase " ignore case for searches (:set noignorecase to turn off) set incsearch " search as you type colorscheme darkblue " slightly nicer colour scheme set scrolloff=15 " keep 15 lines of context on both sides of cursor when scrolling </code></pre> <a href="http://github.com/paulgb/settings/blob/9ebf793bcf202589c74f387eda2cd7f88385a6bf/.vimrc" rel="nofollow">http://github.com/paulgb/settings/blob/9ebf793bcf202589c74f3...</a>
aristoxenusover 15 years ago
Some I like:<p><pre><code> " Keep cycled-away buffers open (preserving undo, " allowing buffer switch without write) set hidden " Facilities for handling pasting into vim, preserving " indentation of the pasted text. " This will make &#60;F4&#62; start paste mode and &#60;F5&#62; stop paste mode. " Note that typing &#60;F5&#62; in paste mode inserts &#60;F5&#62;, since in paste " mode everything is inserted literally, except the 'pastetoggle' key " sequence. map &#60;F4&#62; :set paste&#60;CR&#62; map &#60;F5&#62; :set nopaste&#60;CR&#62; imap &#60;F4&#62; &#60;C-O&#62;:set paste&#60;CR&#62; imap &#60;F5&#62; &#60;nop&#62; set pastetoggle=&#60;F11&#62; " Toggle line-numbers with key sequence Ctrl-N-N: nmap &#60;C-N&#62;&#60;C-N&#62; :set invnumber &#60;CR&#62; " Consolidate swapfiles to keep working directories clean set directory=~/.vim/swap</code></pre>
Plugawyover 15 years ago
Been through some changes lately - this is the trimmed down of my .gvimrc (MacVim). " window settings set lines=70 set columns=200 set fileencoding=utf8<p><pre><code> set incsearch set ignorecase set hlsearch " make the status line more useful set statusline=%F%m%r%h%w[%L][%{&#38;ff}]%y[%p%%][%04l,%04v] set nocompatible " backspace mode set bs=2 " highlitt current line and add line numbers set cursorline set number " yummy set guifont=Monaco:h11.00 " turn off the scrollbars and the rest of the crap set guioptions=eg ""set foldenable ""set foldmethod=indent filetype plugin on filetype on " autoindenting set cindent set smartindent set autoindent " display improvements set list " show indents set listchars=tab:\.\ ,trail:- set ruler set showcmd " i use tabs instead of spaces, wanna make something of it? set noexpandtab set tabstop=4 set shiftwidth=4 set softtabstop=4 " temp files set backupdir=~/.vim/bak set directory=~/.vim/tmp " colorz syntax on colorscheme herald " molokai, zenburn, darkburn, vibrantink " PLUGINZ " allml settings let g:allml_global_maps = 1 let g:HiMtchBrkt=1 let g:SCMDiffCommand="/opt/subversion/bin/svn" inoremap &#60;C-B&#62; &#60;ESC&#62;:call PhpDocSingle()&#60;CR&#62; nnoremap &#60;C-B&#62; :call PhpDocSingle()&#60;CR&#62; vnoremap &#60;C-B&#62; :call PhpDocRange()&#60;CR&#62; " PHP specific fixes " highlights interpolated variables in sql strings and does sql-syntax highlighting. yay autocmd FileType php let php_sql_query=1 " does exactly that. highlights html inside of php strings autocmd FileType php let php_htmlInStrings=1 " discourages use oh short tags. c'mon its deprecated remember autocmd FileType php let php_noShortTags=1 " settings for cake au BufNewFile *.ctp set filetype=php au BufRead *.ctp set filetype=php</code></pre>
SlyShyover 15 years ago
set nocompatible<p>set backspace=indent,eol,start<p>if has("vms") set nobackup else set backup endif set history=50 set ruler set showcmd set incsearch<p>map Q gq<p>inoremap &#60;C-U&#62; &#60;C-G&#62;u&#60;C-U&#62;<p>if has('mouse') set mouse=a endif<p>if &#38;t_Co &#62; 2 || has("gui_running") syntax on set hlsearch endif<p>if has("autocmd")<p><pre><code> filetype plugin indent on augroup vimrcEx au! autocmd FileType text setlocal textwidth=78 autocmd BufReadPost * \ if line("'\"") &#62; 1 &#38;&#38; line("'\"") &#60;= line("$") | \ exe "normal! g`\"" | \ endif augroup END </code></pre> else<p><pre><code> set autoindent </code></pre> endif<p>if !exists(":DiffOrig") command DiffOrig vert new | set bt=nofile | r # | 0d_ | diffthis \ | wincmd p | diffthis endif<p>colors zenburn<p>:filetype plugin on<p>set et set sw=4 set smarttab set lbr<p>set t_Co=256<p>set backupdir=./.backup,.,/tmp set directory=.,./.backup,/tmp<p>set nobackup set nowritebackup<p>set number<p>compiler ruby<p>autocmd Filetype ruby source ~/.vim/ruby-macros.vim nnoremap &#60;silent&#62; &#60;F8&#62; :TlistToggle&#60;CR&#62;<p>let Tlist_Auto_Open=1<p>:set title titlestring=%&#60;%f\ %([%{Tlist_Get_Tagname_By_Line()}]%)<p>set virtualedit=all
bmjover 15 years ago
Mine, though I've (mostly) moved to emacs these days:<p><pre><code> set nocompatible source $VIMRUNTIME/vimrc_example.vim source $VIMRUNTIME/mswin.vim behave mswin set tabstop=4 set shiftwidth=4 set gfn=Consolas:h10:cANSI set number set cin! colorscheme evening map &#60;silent&#62;&#60;A-Right&#62; :tabnext&#60;CR&#62; map &#60;silent&#62;&#60;A-Left&#62; :tabprevious&#60;CR&#62; map &#60;F10&#62; :browse tabnew&#60;CR&#62; set diffexpr=MyDiff() function MyDiff() let opt = '' if &#38;diffopt =~ 'icase' | let opt = opt . '-i ' | endif if &#38;diffopt =~ 'iwhite' | let opt = opt . '-b ' | endif silent execute '\"!C:\Program Files\vim\diff\" -a ' . opt . v:fname_in . ' ' . v:fname_new . ' &#62; ' . v:fname_out endfunction </code></pre> EDIT: Updated formatting.
pyreover 15 years ago
A good line to memorize:<p><pre><code> :set et sts=4 sw=4 ts=4 et = expandtab (spaces instead of tabs) ts = tabstop (the number of spaces that a tab equates to) sw = shiftwidth (the number of spaces to use when indenting -- or de-indenting -- a line) sts = softtabstop (the number of spaces to use when expanding tabs) </code></pre> Also you might want to move 'colorscheme twilight' into the ~/.gvimrc file instead; it makes the .vimrc file cleaner when you separated out all of the gui-specific stuff.<p>My full vimrc and setup is here: <a href="http://github.com/bsandrow/vimc" rel="nofollow">http://github.com/bsandrow/vimc</a><p>{edit} Another good one:<p><pre><code> noremap Y y$ </code></pre> By default Y is mapped to the equivalent of yy. This makes Y act like the 'copy/yank' equivalent of D. {/edit}
slmbrhrtover 15 years ago
Here are just a couple things I find really useful day to day. I used to have a timeout that would revert to normal mode from insert mode after about 30 seconds if idle, but I got tired of that after about six months and just got in the habit of hitting Escape when I finished with an insert action. I did it just now, even though this is a textarea.<p><pre><code> " For (ab)use with :sp map &#60;C-j&#62; &#60;C-W&#62;j&#60;C-W&#62;_ map &#60;C-k&#62; &#60;C-W&#62;k&#60;C-W&#62;_ set wmh=0 so=999 winheight=999 nnoremap i :noh&#60;CR&#62;i " \s is global-replace-this-word :nnoremap &#60;Leader&#62;s :%s/\&#60;&#60;C-r&#62;&#60;C-w&#62;\&#62;//g&#60;Left&#62;&#60;Left&#62;</code></pre>
boxofjunkover 15 years ago
The one addition to my .vimrc that I can't live without:<p><pre><code> nnoremap &#60;Space&#62; :</code></pre>
评论 #857303 未加载
dtfover 15 years ago
Map some "leader" commands for common operations, eg:<p><pre><code> let mapleader=',' let g:mapleader=',' nmap &#60;leader&#62;w :w!&#60;cr&#62; nmap &#60;leader&#62;q :q&#60;cr&#62; nmap &#60;leader&#62;f :find&#60;cr&#62; map &#60;leader&#62;d :execute 'NERDTreeToggle ' . getcwd()&#60;CR&#62; nmap &#60;leader&#62;m :make&#60;cr&#62; " cut &#38; paste map &#60;leader&#62;c "+y map &#60;leader&#62;x "+d map &#60;leader&#62;v "+p </code></pre> Also quicker window navigation:<p><pre><code> map &#60;C-j&#62; &#60;C-W&#62;j map &#60;C-k&#62; &#60;C-W&#62;k map &#60;C-h&#62; &#60;C-W&#62;h map &#60;C-l&#62; &#60;C-W&#62;l</code></pre>
viraptorover 15 years ago
The interesting stuff only:<p><pre><code> set showbreak=&#62;\ set wildignore=*.bak,*.pyc,*.swp set wildmenu set wildmode=list:longest </code></pre> This is actually quicker than reaching for ESC most of the time:<p><pre><code> inoremap &#60;C-s&#62; &#60;ESC&#62; vnoremap &#60;C-s&#62; &#60;ESC&#62; </code></pre> Tab switching:<p><pre><code> noremap &#60;C-l&#62; gt noremap &#60;C-h&#62; gT </code></pre> Something useful for syntax file writing:<p><pre><code> noremap &#60;F6&#62; :echo synIDattr(synID(line("."), col("."), 1), "name")&#60;CR&#62;</code></pre>
bnmrrsover 15 years ago
Most of my .vim folder and .vimrc came from andreiz and tomasr. I have it committed to github for easy download on any server I'm working on. <a href="http://github.com/bnmrrs/dotfies" rel="nofollow">http://github.com/bnmrrs/dotfies</a> if anybody would like to check it out.<p><pre><code> map ,q :q!&#60;CR&#62; map ,s :w&#60;CR&#62; map ,w :x&#60;CR&#62; nmap &#60;silent&#62; &#60;F6&#62; :set number!&#60;CR&#62; </code></pre> and ctags are especially useful
评论 #856153 未加载
enumover 15 years ago
I think :set wildmenu is great, especially for relative newbies such as myself:<p><pre><code> command! CD cd %:p:h " change to current buffer's directory set incsearch " Incremental search set hlsearch " Highlight search set guifont=Bitstream\ Vera\ Sans\ Mono\ 12 set nowritebackup " no stupid backup files set noswapfile " no stupid recovery files set wildmenu " it's wild set visualbell set fileformat=unix</code></pre>
omegazeroover 15 years ago
Reformat hex-dumps into 32-bit words, 8 words per line.<p>nmap H :s/\v(\S{8})/\1 /g&#60;CR&#62;:s/\v((\S{8} ){8})/\1&#60;C-V&#62;&#60;CR&#62;/g&#60;CR&#62;:nohl&#60;CR&#62;
rarrrrrrover 15 years ago
<p><pre><code> "tab completion of words in insert mode function InsertTabWrapper() let col = col('.') - 1 if !col || getline('.')[col - 1] !~ '\k' return "\&#60;tab&#62;" else return "\&#60;c-p&#62;" endif endfunction inoremap &#60;tab&#62; &#60;c-r&#62;=InsertTabWrapper()&#60;cr&#62;</code></pre>
mickeybenover 15 years ago
I used almost everything from thoughtbot articles :<p><a href="http://robots.thoughtbot.com/post/166073596/intro-rails-vim" rel="nofollow">http://robots.thoughtbot.com/post/166073596/intro-rails-vim</a><p>and<p><a href="http://robots.thoughtbot.com/post/159805668/2009-rubyists-guide-to-a-mac-os-x-development" rel="nofollow">http://robots.thoughtbot.com/post/159805668/2009-rubyists-gu...</a>
ktfover 15 years ago
I do a lot of copying/pasting from my browser (and other random places), so these mappings make my life easier:<p><pre><code> " copy/paste with the system clipboard map ^P "+gP map ^C "+y </code></pre> Also this, for dealing with DOS-style stuff:<p><pre><code> " map &#60;ctrl&#62;+s to remove ^M from the ends of lines map ^S :%s\/^M\/\/g</code></pre>
评论 #856139 未加载
meese_over 15 years ago
<a href="http://github.com/msanders/vim-files/blob/master/.vimrc" rel="nofollow">http://github.com/msanders/vim-files/blob/master/.vimrc</a><p>Most of it's just my quirks but I think there's some useful bits in there. My vim setup is _heavily_ customized, for better or for worse.
nikhilpanditover 15 years ago
I like autocomplete in my .vimrc<p>function! InsertTabWrapper() let col = col('.')-1 if !col || getline('.')[col-1]!~'\k' return "\&#60;tab&#62;" else return "\&#60;C-P&#62;" endif endfunction inoremap &#60;tab&#62; &#60;C-R&#62;=InsertTabWrapper()&#60;CR&#62;
csextonover 15 years ago
Adopted from the mighty tpope's vimrc file, and somewhat dependent on some of the plugins (also in my dotfiles repo on github)<p><a href="http://github.com/csexton/dotfiles/blob/master/home/vimrc" rel="nofollow">http://github.com/csexton/dotfiles/blob/master/home/vimrc</a>
throw_awayover 15 years ago
someone mentioned listchars elsewhere, but I prefer these glyphs:<p><pre><code> set listchars=tab:»·,trail:· set list </code></pre> this makes it so all your tabs and trailing whitespace is visible. note, this will make you hate almost every other developer.
评论 #856249 未加载
评论 #856374 未加载
评论 #856454 未加载
amixover 15 years ago
It's a little outdated, but I spent some time on tweaking it: <a href="http://amix.dk/vim/vimrc.html" rel="nofollow">http://amix.dk/vim/vimrc.html</a><p>I specially like:<p><pre><code> map &#60;space&#62; / map &#60;c-space&#62; ? </code></pre> And the parenthesis/bracket expanding.
yanover 15 years ago
Mine's not very advanced; .gvimrc for MacVim:<p><pre><code> set guifont=Pragmata:h14 set guioptions=egmrLt set nohlsearch set number set ts=3 colors vividchalk syntax on </code></pre> Pragmata is a delicious, delicious font.
评论 #856159 未加载
patroclesover 15 years ago
Put your vimrc under revision control. Watch it grow from 5 lines to over 500 in the span of a year.<p>It seems like switching the developer bit in the brain for config files does wonders for environment personalization.
latortugaover 15 years ago
<a href="http://github.com/latortuga/personal/blob/master/_vimrc" rel="nofollow">http://github.com/latortuga/personal/blob/master/_vimrc</a><p>I've been messing with code folding lately, cool stuff.
cdmwebsover 15 years ago
Lots: <a href="http://github.com/cdmwebs/dotfiles/raw/master/vimrc" rel="nofollow">http://github.com/cdmwebs/dotfiles/raw/master/vimrc</a><p>Probably time to clean it up a bit.
jrockwayover 15 years ago
Emacs version here: <a href="http://news.ycombinator.com/item?id=856108" rel="nofollow">http://news.ycombinator.com/item?id=856108</a>
lansteinover 15 years ago
perhaps of interest:<p><pre><code> " for vertical split, with the pipe dividers hidden :hi clear vertsplit :hi vertsplit ctermbg=Black ctermfg=Black " quit quits all :nmap :q :qa :nmap :wq :wqa " H/L go to beginning/end of line without moving fingers :nmap H 0 :nmap L $ " turn off matching paren highlighting let loaded_matchparen = 1</code></pre>
评论 #858168 未加载
thereover 15 years ago
<a href="http://github.com/jcs/dotfiles/blob/master/.vimrc" rel="nofollow">http://github.com/jcs/dotfiles/blob/master/.vimrc</a>
mcantorover 15 years ago
Mine is a behemoth, so I have pasted it here:<p><a href="http://pastebin.com/f6e58888a" rel="nofollow">http://pastebin.com/f6e58888a</a>
kd5bjoover 15 years ago
<p><pre><code> syntax on set background=dark set et set ts=4 set ruler set shiftwidth=4</code></pre>
ccollinsover 15 years ago
Sorry about how long this is!! This is the culmination of about 1.5 years using VIM as my exclusive text editor for web development. When I started I was using PHP and now I'm using Ruby on Rails. If you have any general questions about VIM, specific questions about my .vimrc, or anything related, ask in the comments and I'll try to answer:<p>set fo=tcqln ic nohls nu sc scs sm tm=200 wim=longest,list nonumber<p>let g:explDetailedList=1<p>" store all of your vim swp files in one place, make sure this directory exists<p>set backupdir=/Users/{YOUR_USERNAME}/vim_swp<p>set directory=/Users/{YOUR_USERNAME}/vim_swp<p>set bs=indent,eol,start<p>set hlsearch<p>" Use incremental searching<p>set incsearch<p>" Set standard setting for PEAR coding standards<p>set tabstop=4<p>set shiftwidth=4<p>" Auto expand tabs to spaces<p>set expandtab<p>" Auto indent after a {<p>set autoindent<p>set smartindent<p>" Linewidth to endless<p>set textwidth=0<p>" Do not wrap lines automatically<p>set wrap<p>" DO NOT Show line numbers by default<p>set nonumber<p>" Jump 5 lines when running out of the screen<p>set scrolljump=5<p>" Indicate jump out of the screen when 3 lines before end of the screen<p>set scrolloff=3<p>" Repair wired terminal/vim settings<p>set backspace=start,eol<p>" This function determines, wether we are on the start of the line text (then tab indents) or<p>" if we want to try autocompletion<p>function InsertTabWrapper()<p><pre><code> let col = col('.') - 1 if !col || getline('.')[col - 1] !~ '\k' return "\&#60;tab&#62;" else return "\&#60;c-p&#62;" endif </code></pre> endfunction<p>" Remap the tab key to select action with InsertTabWrapper<p>inoremap &#60;tab&#62; &#60;c-r&#62;=InsertTabWrapper()&#60;cr&#62;<p>" set list<p>" set listchars=tab:&#62;-,trail:-<p>" set listchars=tab:&#62;-,trail:-,eol:$<p>set ignorecase " caseinsensitive searches<p>set showmode " always show command or insert mode<p>set ruler " show line and column information<p>set showmatch " show matching brackets<p>set formatoptions=tcqor<p>set whichwrap=b,s,&#60;,&#62;,[,]<p>syntax on<p>" Added by chris<p>" from <a href="http://items.sjbach.com/319/configuring-vim-right" rel="nofollow">http://items.sjbach.com/319/configuring-vim-right</a><p>set hidden<p>set history=1000<p>nnoremap ' `<p>nnoremap ` '<p>set smartcase "is case sensitive only if there's a capital letter<p>set title<p>" enables matching if/elseif/else/etc., sort of works<p>runtime macros/matchit.vim<p>"from <a href="http://blog.learnr.org/post/59098925/configuring-vim-some-more" rel="nofollow">http://blog.learnr.org/post/59098925/configuring-vim-some-mo...</a><p>map H ^<p>map L $<p>" End Added by chris<p>let loaded_matchparen = 1<p>nmap &#60;F6&#62; &#60;ESC&#62;:call LoadSession()&#60;CR&#62;<p>let s:sessionloaded = 0<p>function LoadSession()<p><pre><code> source Session.vim let s:sessionloaded = 1 </code></pre> endfunction<p>function SaveSession()<p><pre><code> if s:sessionloaded == 1 mksession! end </code></pre> endfunction<p>autocmd VimLeave * call SaveSession() "Reopen your session with 'vim -S Session.vim'
评论 #856206 未加载
jyf1987over 15 years ago
syntax on<p>color zellner<p>set cursorline<p>set cursorcolumn<p>set nu<p>set autoindent<p>set tabstop=4<p>map &#60;C-n&#62; &#60;ESC&#62;&#60;ESC&#62;:tabnew&#60;CR&#62;<p>map &#60;C-left&#62; &#60;ESC&#62;&#60;ESC&#62;:tabprev&#60;CR&#62;<p>map &#60;C-right&#62; &#60;ESC&#62;&#60;ESC&#62;:tabnext&#60;CR&#62;<p>map &#60;C-down&#62; &#60;ESC&#62;&#60;ESC&#62;:tabclose&#60;CR
tvaughanover 15 years ago
:set viminfo="" :set modeline ai et si sw=8 ts=8 :syntax off
tybrisover 15 years ago
$ wc .vimrc<p>427 2342 16457 .vimrc<p>Way too much
ilyakover 15 years ago
<p><pre><code> " menu for encoding set wildmenu set wcm=&#60;Tab&#62; set ts=4 menu Encoding.koi8-r :e ++enc=koi8-r&#60;CR&#62; menu Encoding.windows-1251 :e ++enc=cp1251&#60;CR&#62; menu Encoding.utf-8 :e ++enc=utf-8 &#60;CR&#62; map &#60;F8&#62; :emenu Encoding.&#60;TAB&#62;</code></pre>
donwover 15 years ago
Characters. Lots of characters.
geocarover 15 years ago
<p><pre><code> set vi</code></pre>