Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

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:

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()

    let col = col('.') - 1

    if !col || getline('.')[col - 1] !~ '\k'

        return "\<tab>"

    else

        return "\<c-p>"

    endif
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()

  source Session.vim

  let s:sessionloaded = 1
endfunction

function SaveSession()

  if s:sessionloaded == 1

    mksession!

  end
endfunction

autocmd VimLeave * call SaveSession() "Reopen your session with 'vim -S Session.vim'



I love the scrolljump and scrolloff, never seen those before...also I think you may have just changed my life by showing me how to use sessions.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: