Skip to content

Commit

Permalink
Merge remote-tracking branch 'max/master'
Browse files Browse the repository at this point in the history
Conflicts:
	vimrc
  • Loading branch information
nathansobo committed Oct 23, 2011
2 parents 145e8c6 + 7a7ef94 commit 954741a
Show file tree
Hide file tree
Showing 8 changed files with 129 additions and 136 deletions.
15 changes: 11 additions & 4 deletions .gitmodules
Expand Up @@ -26,10 +26,6 @@
path = bundle/nerdtree
url = git://github.com/scrooloose/nerdtree.git
ignore = dirty
[submodule "bundle/nerdcommenter"]
path = bundle/nerdcommenter
url = git://github.com/scrooloose/nerdcommenter.git
ignore = dirty
[submodule "bundle/ack.vim"]
path = bundle/ack.vim
url = https://github.com/mileszs/ack.vim.git
Expand Down Expand Up @@ -78,3 +74,14 @@
path = bundle/javascript
url = git://github.com/pangloss/vim-javascript.git
ignore = dirty
[submodule "bundle/abolish"]
path = bundle/abolish
url = https://github.com/tpope/vim-abolish.git
[submodule "bundle/commentary"]
path = bundle/commentary
url = https://github.com/tpope/vim-commentary.git
ignore = dirty
[submodule "bundle/indent-object"]
path = bundle/indent-object
url = https://github.com/michaeljsmith/vim-indent-object.git
ignore = dirty
1 change: 1 addition & 0 deletions bundle/abolish
Submodule abolish added at 6a633f
1 change: 1 addition & 0 deletions bundle/commentary
Submodule commentary added at 62b725
1 change: 1 addition & 0 deletions bundle/indent-object
Submodule indent-object added at 78fffa
5 changes: 4 additions & 1 deletion gvimrc
@@ -1,4 +1,4 @@
set guifont=Monaco:h16
set guifont=Monaco:h15
set bg=dark
colorscheme ir_black

Expand All @@ -11,6 +11,9 @@ set guioptions-=r
set columns=999
set lines=999

" highlight current row.
set cursorline

" *** MACVIM ONLY ***
if has("gui_macvim")

Expand Down
4 changes: 3 additions & 1 deletion snippets/javascript.snippets
Expand Up @@ -3,11 +3,13 @@ snippet f
${1}
}${2}
snippet fp
function() {
function(${1}) {
${2}
}${3}
snippet con
console.log(${1});
snippet cv
console.log("${1:variable}:", $1);
snippet it
it("${1:does something}", function() {
${2}
Expand Down
2 changes: 2 additions & 0 deletions snippets/ruby.snippets
Expand Up @@ -26,3 +26,5 @@ snippet let
let(:${1}) { ${2} }
snippet its
its(:${1}) { ${2} }
snippet pv
puts "${1:variable}: #{$1}"
236 changes: 106 additions & 130 deletions vimrc
@@ -1,142 +1,40 @@
" use Pathogen for plugins
" use pathogen for plugins
call pathogen#runtime_append_all_bundles()
call pathogen#helptags()


"-------------------------------------------
" EDITING
" OPTIONS
"-------------------------------------------

filetype plugin indent on
syntax on
set nocompatible

" leader key for custom mappings
let mapleader=','

" don't allow bindings starting with escape in insert mode
set noesckeys

" let tilde (toggle case) behave like an operator
set tildeop

" move up and down within wrapped lines
noremap j gj
noremap k gk
" make Y consistent w/ D and C
map Y y$
" increase/decrease indentation
imap <S-TAB> <C-o><<
vmap <TAB> >gv
vmap <S-TAB> <gv
" bubble lines
nmap <C-Up> [e
nmap <C-Down> ]e
vmap <C-Up> [egv
vmap <C-Down> ]egv
" command-/ to toggle comments
let NERDSpaceDelims = 1
map <D-/> <plug>NERDCommenterToggle<CR>
imap <D-/> <Esc><plug>NERDCommenterToggle<CR>i
" command mode autocomplete - like bash
set wildmode=list:longest

" insert mode autocomplete - menu, only from open buffers
set complete=.,w,b
set pumheight=10
set completeopt=menu
inoremap <C-Space> <C-n>
inoremap <M-Space> <C-p>
" reindent the entire file and return to original position
noremap <Leader>= gg=G``
" remove any mappings in select mode
smapclear

"-------------------------------------------
" SEARCHING
"-------------------------------------------

" searching
set hlsearch
set incsearch
set noignorecase
set ignorecase
set smartcase

" control-l clears both the command line and search highlighting
noremap <C-l> :nohlsearch<CR><C-l>
" command-shift-F for ack - search in project
map <D-F> :Ack!<space>
vmap <D-F> :call AckVisual()<CR>
function! AckVisual()
normal gv"xy
let command = "ack '".@x."'"
cexpr system(command)
cw
endfunction
" autocomplete (insert mode)
set complete=.,w,b
set pumheight=10
set completeopt=menu

" autocomplete (command line mode)
set wildmode=list:longest

"-------------------------------------------
" BUFFERS/FILES
"-------------------------------------------
" don't allow bindings starting with escape in insert mode
set noesckeys

" let unsaved buffers exist in the background.
set hidden

" don't prompt for file changes outside vim
" autosave, autoload
set autoread

" autosave when changing buffers or losing focus.
set autowriteall
autocmd FocusLost * silent! wall

" directory for swp files
if has('unix') || has('mac')
set backupdir=/tmp
set directory=/tmp
end

" NERDTree - project drawer
" - toggle drawer
" - go to current file
map \ :NERDTreeToggle<CR>
map \| :NERDTreeFind<CR>
map <Leader>n :NERDTreeToggle<CR>
let g:NERDTreeMinimalUI=1
let g:NERDTreeDirArrows=1
let g:NERDTreeChDirMode=2

" command-T - open files with fuzzy matching
let g:CommandTMaxHeight=10
map <leader>N :CommandT<CR>
map <D-N> :CommandT<CR>
imap <D-N> <Esc>:CommandT<CR>
map <leader>B :CommandTBuffer<CR>
map <D-B> :CommandTBuffer<CR>
imap <D-B> <Esc>:CommandTBuffer<CR>
imap <D-E> :MRU<CR>
map <D-E> :MRU<CR>
" copy current file path to system pasteboard.
map <silent> <D-C> :let @* = expand("%")<CR>:echo "Copied: ".expand("%")<CR>
" run ctags, with or without gemhome included
map <leader>rt :!ctags -R --exclude=.git --exclude=log *<CR>
map <leader>rT :!ctags -R --exclude=.git --exclude=log * `rvm gemhome`/*<CR>

"-------------------------------------------
" APPEARANCE
"-------------------------------------------

syntax on

" folding
set foldmethod=indent
set nofoldenable
Expand All @@ -156,12 +54,6 @@ set laststatus=2
set number
set ruler

" show (partial) command in the status line
set showcmd

" highlight current row.
set cursorline

" don't hard wrap long lines
set nowrap
set textwidth=0
Expand All @@ -179,39 +71,123 @@ set softtabstop=2
set expandtab
set list listchars=tab:\ \ ,trail:·

" directory for swp files
if has('unix') || has('mac')
set backupdir=/tmp
set directory=/tmp
end

"-------------------------------------------
" FILETYPES
" MAPPINGS
"-------------------------------------------

" insert ' => '
autocmd FileType ruby imap <Space>=><Space>
" leader key for custom mappings
let mapleader=','

" text files should autoindent, for making outlines
autocmd FileType text set autoindent
" move up and down within wrapped lines
noremap j gj
noremap k gk
" make Y consistent w/ D and C
map Y y$
" increase/decrease indentation
xmap <TAB> >gv
xmap <S-TAB> <gv
" highlight JSON files as javascript
" autocomplete
inoremap <C-Space> <C-n>
inoremap <M-Space> <C-p>
" clear the command line and search highlighting
noremap <C-l> :nohlsearch<CR><C-l>
noremap <leader>/ :nohlsearch<CR><C-l>
" copy current file path to system pasteboard.
map <silent> <D-C> :let @* = expand("%")<CR>:echo "Copied: ".expand("%")<CR>
" regenerate tags, with or without gemhome included
map <leader>rt :!ctags -R --exclude=.git --exclude=log *<CR>
map <leader>rT :!ctags -R --exclude=.git --exclude=log * `rvm gemhome`/*<CR>
" jump to a tag in vertical split. ('control-w ]' already does this with a horizontal split)
nnoremap <C-w><C-]> :exec "vertical belowright stag" expand("<cword>")<CR>
nnoremap <C-w>g<C-]> :exec "vertical belowright stselect" expand("<cword>")<CR>
vnoremap <C-w><C-]> :<C-w>exec "vertical belowright stag" GetCurrentVisualSelection()<CR>
vnoremap <C-w>g<C-]> :<C-w>exec "vertical belowright stselect" GetCurrentVisualSelection()<CR>
"-------------------------------------------
" PLUGIN CONFIG
"-------------------------------------------

" commentary - toggle comments
nmap <D-/> <plug>CommentaryLine
xmap <D-/> <plug>Commentarygv
imap <D-/> <C-o><plug>CommentaryLine
map <leader>c <plug>Commentary
nmap <leader>cc <plug>CommentaryLine
" ack - search in project
noremap <D-F> :Ack!<space>
vnoremap <D-F> :<C-w>exec "Ack! '" . GetCurrentVisualSelection() . "'"<CR>
" nerdtree - project drawer
map \ :NERDTreeToggle<CR>
map \| :NERDTreeFind<CR>
map <Leader>n :NERDTreeToggle<CR>
let g:NERDTreeMinimalUI=1
let g:NERDTreeDirArrows=1
let g:NERDTreeChDirMode=2

" command-T - open files with fuzzy matching
let g:CommandTMaxHeight=10
map <leader>N :CommandT<CR>
map <D-N> :CommandT<CR>
imap <D-N> <Esc>:CommandT<CR>
map <leader>B :CommandTBuffer<CR>
map <D-B> :CommandTBuffer<CR>
imap <D-B> <Esc>:CommandTBuffer<CR>
"-------------------------------------------
" AUTO-COMMANDS
"-------------------------------------------

" json
autocmd BufRead,BufNewFile *.json set filetype=javascript

" highlight jasmine_fixture files as HTML
" jasmine fixtures
autocmd BufRead,BufNewFile *.jasmine_fixture set filetype=html

" highlight some other filetypes as ruby
" ruby
autocmd BufRead,BufNewFile *.thor set filetype=ruby
autocmd BufRead,BufNewFile *.god set filetype=ruby
autocmd BufRead,BufNewFile Gemfile* set filetype=ruby
autocmd BufRead,BufNewFile Vagrantfile set filetype=ruby
autocmd BufRead,BufNewFile soloistrc set filetype=ruby
autocmd FileType ruby imap <Space>=><Space>
" plain text
autocmd BufRead,BufNewFile *.txt set filetype=text
autocmd BufRead,BufNewFile *.text set filetype=text
autocmd BufRead,BufNewFile *README* set filetype=text
autocmd FileType text set autoindent

" make and git files use real tabs
autocmd FileType make set noexpandtab
autocmd BufRead,BufNewFile .git* set noexpandtab

"-------------------------------------------
" FUNCTIONS
"-------------------------------------------

function! GetCurrentVisualSelection()
let reg_save = @x
normal! gv"xy
let selection = @x
let @x = reg_save
return selection
endfunction

"-------------------------------------------
" LOCAL CONFIG
"-------------------------------------------
Expand Down

0 comments on commit 954741a

Please sign in to comment.