syntax on
set background=dark
set et
set ts=4
set ruler
set shiftwidth=4Ask HN: What's in your .vimrc file?
21–30 of 69 posts
Re: Ask HN: What's in your .vimrc file?
#22 map ,q :q!
map ,s :w
map ,w :x
nmap :set number!
and ctags are especially usefulRe: Ask HN: What's in your .vimrc file?
#23 map
map
map
map
imap
imap
imap
imap
(There's actually a recently reported bug that causes the up arrow to do some strange things, but you get the idea).Re: Ask HN: What's in your .vimrc file?
#24 :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)
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.My full vimrc and setup is here: http://github.com/bsandrow/vimc
{edit} Another good one:
noremap Y y$
By default Y is mapped to the equivalent of yy. This makes Y act like the 'copy/yank' equivalent of D.
{/edit}Re: Ask HN: What's in your .vimrc file?
#25Re: Ask HN: What's in your .vimrc file?
#26Most 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. http://github.com/bnmrrs/dotfies if anybody would like to check it out. map ,q :q! map ,s :w map ,w :x nmap :set number! and ctags are especially useful
let mapleader = "," "
let g:mapleader = ","
map q :q!
map s :w
map w :x
The mapleader is basically used to give your custom keybindings a separate namespace. It looks like that's what your doing here, but using the variable makes it easier to change later f you want.Re: Ask HN: What's in your .vimrc file?
#27Mine's not very advanced; .gvimrc for MacVim: set guifont=Pragmata:h14 set guioptions=egmrLt set nohlsearch set number set ts=3 colors vividchalk syntax on Pragmata is a delicious, delicious font.
Re: Ask HN: What's in your .vimrc file?
#28 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=unixRe: Ask HN: What's in your .vimrc file?
#29Nothing. 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. I'll admit, I probably cripple my productivity overall for working this way…
You really could say that about anything. You could say that one shouldn't program in dynamically-typed languages because 'one day' you'll have to program in a statically-typed language and all your habits will 'bite you in the ass.' I think that you should really blame this part:
> and you've been up for 67 consecutive hours
Unless you're trying out for the SEALS, I don't think this is normally part of any job description. And I hardly think this is some sort of 'common case' that you should be planning for. There's a difference between preparing for the worst and over-preparing for the worst.
Re: Ask HN: What's in your .vimrc file?
#30 set expandtab " Convert tabs to spaces
set tabstop=4 " 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"