Ask HN: What's in your .vimrc file?
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):
set expandtab
set sts=2
if v:progname =~? "gvim"
colorscheme twilight
endif
68 comments
[ 2.6 ms ] story [ 97.7 ms ] threadThis is something of the last two weeks or so, before that it was happening too, but much less frequently.
PG, Are you still looking for a specific iPhone interface?
Probably time to clean it up a bit.
If you need something specific try http://vim.wikia.com/
I specially like:
And the parenthesis/bracket expanding.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, but it's what I'm used to.
The machines I am working on are not my own, and often have no access to the Internet directly.
However, I'm generally doing more "editing" than "coding" so it's not a major limitation anyway.
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.
However, for editors I've just always preferred to stay as basic and reliable as possible. vi is quick, easy, simple and has been on every *nix machine that I've ever walked up to. Relying on customizitions beyond that is, for me, sub-optimal.
I have had more than a handful of workdays that spanned 2 or 3 or 4 continuous days with little or no sleep at all (although thankfully not in several years). In those cases we were usually recovering from planned maintenance gone wrong. In one case I was trying to edit/update some config files, force software upgrades into a bunch core switches and dispatch pilots with spare parts. It was helpful, to me, to be able to rely on the basics as I hopped through SSH sessions from server to server (but, I did use host keys to speed my logins).
My case is moreso for edits and small customizations and not long sessions of coding, so I really don't NEED a whole lot beyond the basics of what I can memorize.
That can't be healthy. My longest stretch (age 17) was something like that and I fell down half a flight of stairs without waking up when going home.
Please be careful.
I started with vi so long ago that I remember being surprised around five years ago when I accidentally discovered that vim knows about the arrow keys. So I've never had to un-learn the arrow keys.
You may want to turn them back on eventually. It's nice to be able to move the cursor without thinking about it, whether your hands are on the keyboard, over the arrow keys or on the mouse, sort of like being able to play the chord you want no matter where your hand is on the fretboard.
As for my .vimrc, there are years of settings and commands I never use and can't remember what for, like junk DNA. I enjoy discovering and sharing the occasional treat, but I've gone pretty much meat and potatoes over the years.
Depending on your setup, your ruler (:set ruler) may or may not always show the file. This will make it always show:
set statusline=%<%F\ %h%m%r%=%-14.(%l,%c%V%)\ %P
I like the tabula colorscheme, which you can find on vim.org:
colorscheme tabula
I like smartcase: set ic set smartcase
and I like the ability to override it when I search: /\Cfindonlylowercaseinstances (:help, and then look in chapter usr_27.txt)
My full vimrc and setup is here: http://github.com/bsandrow/vimc
{edit} Another good one:
By default Y is mapped to the equivalent of yy. This makes Y act like the 'copy/yank' equivalent of D. {/edit}set fo=tcqln ic nohls nu sc scs sm tm=200 wim=longest,list nonumber
let g:explDetailedList=1
" store all of your vim swp files in one place, make sure this directory exists
set backupdir=/Users/{YOUR_USERNAME}/vim_swp
set directory=/Users/{YOUR_USERNAME}/vim_swp
set bs=indent,eol,start
set hlsearch
" Use incremental searching
set incsearch
" Set standard setting for PEAR coding standards
set tabstop=4
set shiftwidth=4
" Auto expand tabs to spaces
set expandtab
" Auto indent after a {
set autoindent
set smartindent
" Linewidth to endless
set textwidth=0
" Do not wrap lines automatically
set wrap
" DO NOT Show line numbers by default
set nonumber
" Jump 5 lines when running out of the screen
set scrolljump=5
" Indicate jump out of the screen when 3 lines before end of the screen
set scrolloff=3
" Repair wired terminal/vim settings
set backspace=start,eol
" This function determines, wether we are on the start of the line text (then tab indents) or
" if we want to try autocompletion
function InsertTabWrapper()
endfunction" Remap the tab key to select action with InsertTabWrapper
inoremap <tab> <c-r>=InsertTabWrapper()<cr>
" set list
" set listchars=tab:>-,trail:-
" set listchars=tab:>-,trail:-,eol:$
set ignorecase " caseinsensitive searches
set showmode " always show command or insert mode
set ruler " show line and column information
set showmatch " show matching brackets
set formatoptions=tcqor
set whichwrap=b,s,<,>,[,]
syntax on
" Added by chris
" from http://items.sjbach.com/319/configuring-vim-right
set hidden
set history=1000
nnoremap ' `
nnoremap ` '
set smartcase "is case sensitive only if there's a capital letter
set title
" enables matching if/elseif/else/etc., sort of works
runtime macros/matchit.vim
"from http://blog.learnr.org/post/59098925/configuring-vim-some-mo...
map H ^
map L $
" End Added by chris
let loaded_matchparen = 1
nmap <F6> <ESC>:call LoadSession()<CR>
let s:sessionloaded = 0
function LoadSession()
endfunctionfunction SaveSession()
endfunctionautocmd VimLeave * call SaveSession() "Reopen your session with 'vim -S Session.vim'
I've been messing with code folding lately, cool stuff.