mirror of https://github.com/bjeanes/dotfiles.git
Switch to Vundle, remove a bunch of un-used vim bundles, and refactor vimrc files
parent
4b56bc2068
commit
7e1d9a9b35
|
@ -1,147 +0,0 @@
|
|||
[submodule "vim/bundle/fugitive"]
|
||||
path = vim/bundle/fugitive
|
||||
url = git://github.com/tpope/vim-fugitive.git
|
||||
[submodule "vim/bundle/NERDCommenter"]
|
||||
path = vim/bundle/NERDCommenter
|
||||
url = git://github.com/scrooloose/nerdcommenter.git
|
||||
[submodule "vim/bundle/repeat"]
|
||||
path = vim/bundle/repeat
|
||||
url = git://github.com/tpope/vim-repeat.git
|
||||
[submodule "vim/bundle/abolish"]
|
||||
path = vim/bundle/abolish
|
||||
url = git://github.com/tpope/vim-abolish.git
|
||||
[submodule "vim/bundle/surround"]
|
||||
path = vim/bundle/surround
|
||||
url = git://github.com/tpope/vim-surround.git
|
||||
[submodule "vim/bundle/ragtag"]
|
||||
path = vim/bundle/ragtag
|
||||
url = git://github.com/tpope/vim-ragtag.git
|
||||
[submodule "vim/bundle/markdown"]
|
||||
path = vim/bundle/markdown
|
||||
url = git://github.com/tpope/vim-markdown.git
|
||||
[submodule "vim/bundle/rake"]
|
||||
path = vim/bundle/rake
|
||||
url = git://github.com/tpope/vim-rake.git
|
||||
[submodule "vim/bundle/git"]
|
||||
path = vim/bundle/git
|
||||
url = git://github.com/tpope/vim-git.git
|
||||
[submodule "vim/bundle/syntastic"]
|
||||
path = vim/bundle/syntastic
|
||||
url = git://github.com/scrooloose/syntastic.git
|
||||
[submodule "vim/bundle/haml"]
|
||||
path = vim/bundle/haml
|
||||
url = git://github.com/tpope/vim-haml.git
|
||||
[submodule "vim/bundle/unimpaired"]
|
||||
path = vim/bundle/unimpaired
|
||||
url = git://github.com/tpope/vim-unimpaired.git
|
||||
[submodule "vim/bundle/rails"]
|
||||
path = vim/bundle/rails
|
||||
url = git://github.com/tpope/vim-rails.git
|
||||
[submodule "vim/bundle/cucumber"]
|
||||
path = vim/bundle/cucumber
|
||||
url = git://github.com/tpope/vim-cucumber.git
|
||||
[submodule "vim/bundle/endwise"]
|
||||
path = vim/bundle/endwise
|
||||
url = git://github.com/tpope/vim-endwise.git
|
||||
[submodule "vim/bundle/snipmate"]
|
||||
path = vim/bundle/snipmate
|
||||
url = git://github.com/msanders/snipmate.vim.git
|
||||
[submodule "vim/bundle/nerdtree"]
|
||||
path = vim/bundle/nerdtree
|
||||
url = git://github.com/scrooloose/nerdtree.git
|
||||
[submodule "vim/bundle/command-t"]
|
||||
path = vim/bundle/command-t
|
||||
url = git://git.wincent.com/command-t.git
|
||||
[submodule "vim/bundle/Conque-Shell"]
|
||||
path = vim/bundle/Conque-Shell
|
||||
url = git://github.com/vim-scripts/Conque-Shell.git
|
||||
[submodule "vim/bundle/align"]
|
||||
path = vim/bundle/align
|
||||
url = git://github.com/tsaleh/vim-align.git
|
||||
[submodule "vim/bundle/markdown-preview"]
|
||||
path = vim/bundle/markdown-preview
|
||||
url = git://github.com/robgleeson/vim-markdown-preview.git
|
||||
[submodule "vim/bundle/supertab"]
|
||||
path = vim/bundle/supertab
|
||||
url = git://github.com/ervandew/supertab.git
|
||||
[submodule "vim/bundle/javascript"]
|
||||
path = vim/bundle/javascript
|
||||
url = git://github.com/pangloss/vim-javascript.git
|
||||
[submodule "vim/bundle/indent-object"]
|
||||
path = vim/bundle/indent-object
|
||||
url = git://github.com/michaeljsmith/vim-indent-object.git
|
||||
[submodule "vim/bundle/taglist"]
|
||||
path = vim/bundle/taglist
|
||||
url = git://github.com/vim-scripts/taglist.vim.git
|
||||
[submodule "vim/bundle/matchit"]
|
||||
path = vim/bundle/matchit
|
||||
url = git://github.com/mhz/vim-matchit.git
|
||||
[submodule "vim/bundle/textobj-user"]
|
||||
path = vim/bundle/textobj-user
|
||||
url = git://github.com/kana/vim-textobj-user.git
|
||||
[submodule "vim/bundle/textobj-rubyblock"]
|
||||
path = vim/bundle/textobj-rubyblock
|
||||
url = git://github.com/nelstrom/vim-textobj-rubyblock.git
|
||||
[submodule "vim/bundle/tabular"]
|
||||
path = vim/bundle/tabular
|
||||
url = git://github.com/godlygeek/tabular.git
|
||||
[submodule "vim/bundle/ruby-refactoring"]
|
||||
path = vim/bundle/ruby-refactoring
|
||||
url = git://github.com/ecomba/vim-ruby-refactoring.git
|
||||
[submodule "vim/bundle/AutoAlign"]
|
||||
path = vim/bundle/AutoAlign
|
||||
url = git://github.com/vim-scripts/AutoAlign.git
|
||||
[submodule "vim/bundle/nginx"]
|
||||
path = vim/bundle/nginx
|
||||
url = git://github.com/vim-scripts/nginx.vim.git
|
||||
[submodule "vim/bundle/vimwiki"]
|
||||
path = vim/bundle/vimwiki
|
||||
url = git://github.com/vim-scripts/vimwiki.git
|
||||
[submodule "vim/bundle/speeddating"]
|
||||
path = vim/bundle/speeddating
|
||||
url = git://github.com/vim-scripts/speeddating.vim.git
|
||||
[submodule "vim/bundle/ruby"]
|
||||
path = vim/bundle/ruby
|
||||
url = git://github.com/vim-ruby/vim-ruby.git
|
||||
[submodule "vim/bundle/indent-guides"]
|
||||
path = vim/bundle/indent-guides
|
||||
url = git://github.com/nathanaelkane/vim-indent-guides.git
|
||||
[submodule "vim/snippets"]
|
||||
path = vim/snippets
|
||||
url = git://github.com/scrooloose/snipmate-snippets.git
|
||||
[submodule "vim/bundle/vim-css-color"]
|
||||
path = vim/bundle/vim-css-color
|
||||
url = git://github.com/skammer/vim-css-color.git
|
||||
[submodule "vim/bundle/AutoCloseTag"]
|
||||
path = vim/bundle/AutoCloseTag
|
||||
url = git://github.com/vim-scripts/HTML-AutoCloseTag.git
|
||||
[submodule "vim/bundle/Ack.vim"]
|
||||
path = vim/bundle/Ack.vim
|
||||
url = git://github.com/mileszs/ack.vim.git
|
||||
[submodule "vim/bundle/vim-flog"]
|
||||
path = vim/bundle/vim-flog
|
||||
url = git://github.com/fousa/vim-flog.git
|
||||
[submodule "vim/bundle/extradite"]
|
||||
path = vim/bundle/extradite
|
||||
url = git://github.com/int3/vim-extradite.git
|
||||
[submodule "vim/bundle/VimClojure"]
|
||||
path = vim/bundle/VimClojure
|
||||
url = git://github.com/vim-scripts/VimClojure.git
|
||||
[submodule "vim/bundle/vim-solarized"]
|
||||
path = vim/bundle/vim-solarized
|
||||
url = git://github.com/altercation/vim-colors-solarized.git
|
||||
[submodule "vim/bundle/git-grep"]
|
||||
path = vim/bundle/git-grep
|
||||
url = git://github.com/tjennings/git-grep-vim.git
|
||||
[submodule "vim/bundle/mru.vim"]
|
||||
path = vim/bundle/mru.vim
|
||||
url = git://github.com/vim-scripts/mru.vim.git
|
||||
[submodule "vim/bundle/ZoomWin"]
|
||||
path = vim/bundle/ZoomWin
|
||||
url = https://github.com/vim-scripts/ZoomWin.git
|
||||
[submodule "vim/bundle/coffee-script"]
|
||||
path = vim/bundle/coffee-script
|
||||
url = https://github.com/kchmck/vim-coffee-script.git
|
||||
[submodule "vim/bundle/vim-rake"]
|
||||
path = vim/bundle/vim-rake
|
||||
url = git://github.com/tpope/vim-rake.git
|
|
@ -47,3 +47,4 @@ tmp*
|
|||
tmp/**/*
|
||||
doc/tags
|
||||
.bundle/*
|
||||
.rbx/
|
||||
|
|
|
@ -0,0 +1,16 @@
|
|||
" Source vimrc after saving it
|
||||
autocmd! BufWritePost .vimrc,vimrc source $MYVIMRC | NERDTreeToggle | NERDTreeToggle
|
||||
|
||||
" Auto save files on window blur
|
||||
autocmd! FocusLost * :up
|
||||
|
||||
" make and python use real tabs
|
||||
au! FileType make set noexpandtab
|
||||
au! FileType python set noexpandtab
|
||||
|
||||
au! FileType scss syntax cluster sassCssAttributes add=@cssColors
|
||||
|
||||
" Thorfile, Rakefile and Gemfile are Ruby
|
||||
au! BufRead,BufNewFile {Gemfile,Rakefile,Thorfile,config.ru} set ft=ruby
|
||||
|
||||
au! BufRead,BufNewFile gitconfig set ft=gitconfig
|
File diff suppressed because one or more lines are too long
|
@ -0,0 +1 @@
|
|||
Subproject commit bfdf714f8ea10a6bcba7a1375a5700b11077dcd9
|
|
@ -0,0 +1 @@
|
|||
Subproject commit 95d03970850208d3314ff4fa271e009950045a94
|
|
@ -0,0 +1 @@
|
|||
Subproject commit 7da632f0cccbb7587bd0c9153b98e89fa8689c5f
|
|
@ -0,0 +1 @@
|
|||
Subproject commit e7ee18e2e7ed60509aa951cd34b57193fa14e5ab
|
|
@ -0,0 +1 @@
|
|||
Subproject commit f340ec93f5071238823db6dcd2431c924fee4418
|
|
@ -0,0 +1 @@
|
|||
Subproject commit ffc45dd5a59b7b62edb02641c69a163f19fd02c0
|
|
@ -0,0 +1 @@
|
|||
Subproject commit b28e7be63235982501ab7dd30c03ea7feef7b095
|
|
@ -0,0 +1 @@
|
|||
Subproject commit 12f692f4369526f408e724fa74a0da527ebe2f2f
|
|
@ -0,0 +1 @@
|
|||
Subproject commit 595b29a16e0ff45e0332c18ba44cf0245da34dfe
|
|
@ -0,0 +1 @@
|
|||
Subproject commit dc1692561461fd0b7642e05b03b7670974112eee
|
|
@ -0,0 +1 @@
|
|||
Subproject commit 417eaf8a20a6208e34ff167f5636b20f8f812ed8
|
|
@ -0,0 +1 @@
|
|||
Subproject commit 2ef3e5a4876a4cd5ea83a0dcbf17f5c3edbf9de3
|
|
@ -0,0 +1 @@
|
|||
Subproject commit 9a9d1994eaeae3f2f23da6bb71111782ab70276c
|
|
@ -0,0 +1 @@
|
|||
Subproject commit 201bdd0eff4cd79847cf006f143deb62f8f97342
|
|
@ -0,0 +1 @@
|
|||
Subproject commit 291cbe97f2c367f40360949f19b4fa8fb0740e9f
|
|
@ -0,0 +1 @@
|
|||
Subproject commit de3e72a384c9b1cc8707c9bc37cefc24d8484ebf
|
|
@ -0,0 +1 @@
|
|||
Subproject commit ae3a2653f824bb9e969f462c5d77e035a518ea61
|
|
@ -0,0 +1 @@
|
|||
Subproject commit d94405aae64ff10fc10a78807b5e9214c83c60df
|
|
@ -0,0 +1 @@
|
|||
Subproject commit 8a93dc7a57308e08f7d3c83f9824a1c43e12c5ba
|
|
@ -0,0 +1 @@
|
|||
Subproject commit 01221f4fe3aebdfbdac73e4b349cb268b2c75c67
|
|
@ -0,0 +1 @@
|
|||
Subproject commit 84297c90516c40df5c6e224930c3bd92a8046efd
|
|
@ -0,0 +1 @@
|
|||
Subproject commit cae6df72cf99cc7ae725978bcb7eb81bce816bdf
|
|
@ -0,0 +1,90 @@
|
|||
filetype off
|
||||
|
||||
set rtp+=~/.vim/bundle/vundle/
|
||||
call vundle#rc()
|
||||
|
||||
" Let Vundle manage Vundle
|
||||
Bundle 'gmarik/vundle'
|
||||
|
||||
" Experimenting
|
||||
Bundle 'robgleeson/hammer.vim'
|
||||
let g:HammerQuiet = 1
|
||||
|
||||
" Languages/Syntaxes/Frameworks {{{
|
||||
" Ruby {{{
|
||||
Bundle 'vim-ruby/vim-ruby'
|
||||
Bundle 'tpope/vim-endwise'
|
||||
Bundle 'tpope/vim-rake'
|
||||
Bundle 'tpope/vim-rails'
|
||||
Bundle 'tpope/vim-haml'
|
||||
" }}}
|
||||
|
||||
" Markdown/Textile/etc {{{
|
||||
Bundle 'tpope/vim-markdown'
|
||||
" }}}
|
||||
|
||||
" Other {{{
|
||||
Bundle 'tpope/vim-cucumber'
|
||||
Bundle 'skammer/vim-css-color'
|
||||
Bundle 'kchmck/vim-coffee-script'
|
||||
" }}}
|
||||
" }}}
|
||||
|
||||
" Git {{{
|
||||
Bundle 'tpope/vim-fugitive'
|
||||
Bundle 'tpope/vim-git'
|
||||
" }}}
|
||||
|
||||
" Utility {{{
|
||||
Bundle 'tpope/vim-bundler'
|
||||
Bundle 'tjennings/git-grep-vim'
|
||||
|
||||
Bundle 'scrooloose/nerdcommenter'
|
||||
let NERDSpaceDelims = 1 " space between comment and code
|
||||
|
||||
Bundle 'ZoomWin'
|
||||
map <Leader>z :ZoomWin<CR>
|
||||
imap <Leader>z <Esc>:ZoomWin<CR>
|
||||
|
||||
Bundle 'vimwiki'
|
||||
let g:vimwiki_hl_cb_checked = 1
|
||||
let g:vimwiki_menu = 'Plugin.Vimwiki'
|
||||
let g:vimwiki_badsyms = ' '
|
||||
let g:vimwiki_use_mouse = 1
|
||||
let g:vimwiki_dir_link = 'index'
|
||||
let g:vimwiki_list = [
|
||||
\ {
|
||||
\ 'path': '~/Dropbox/Wiki/Text',
|
||||
\ 'path_html': '~/Dropbox/Wiki/HTML',
|
||||
\ 'nested_syntaxes': {
|
||||
\ 'ruby': 'ruby'
|
||||
\ }
|
||||
\ }
|
||||
\]
|
||||
|
||||
Bundle 'scrooloose/nerdtree'
|
||||
let NERDTreeIgnore = ['\.rbc$', '\~$']
|
||||
let NERDTreeChDirMode = 2
|
||||
let NERDTreeMouseMode = 3
|
||||
let NERDTreeQuitOnOpen = 1
|
||||
let NERDTreeMinimalUI = 1
|
||||
let NERDTreeDirArrows = 1
|
||||
map <Leader>n :NERDTreeToggle<CR>
|
||||
|
||||
Bundle 'Command-T'
|
||||
let g:CommandTMaxFiles = 20000
|
||||
let g:CommandTMaxHeight = 10
|
||||
set wildignore+=Transmission*Remote*GUI
|
||||
|
||||
Bundle 'Indent-Guides'
|
||||
let g:indent_guides_color_change_percent = 7
|
||||
autocmd! VimEnter * IndentGuidesEnable
|
||||
|
||||
Bundle 'Syntastic'
|
||||
let g:syntastic_enable_signs = 1
|
||||
let g:syntastic_auto_loc_list = 0
|
||||
" }}}
|
||||
|
||||
autocmd! BufWritePost bundles.vim source ~/.vim/bundles.vim
|
||||
filetype plugin indent on
|
||||
|
|
@ -2,8 +2,6 @@ set guioptions-=T " hide toolbar
|
|||
set guioptions+=Rr " Turn on scroll bars
|
||||
|
||||
if has("gui_macvim")
|
||||
" macmenu Window.Toggle\ Full\ Screen\ Mode key=<D-CR>
|
||||
|
||||
set transparency=7
|
||||
|
||||
" Fullscreen takes up entire screen
|
||||
|
@ -16,11 +14,6 @@ if has("gui_macvim")
|
|||
" Command-/ to toggle comments
|
||||
map <D-/> <plug>NERDCommenterToggle
|
||||
imap <D-/> <Esc><plug>NERDCommenterToggle i
|
||||
|
||||
" Command-T (a la Textmate)
|
||||
macmenu &File.New\ Tab key=<nop>
|
||||
map <D-t> :CommandT<CR>
|
||||
imap <D-t> <Esc>:CommandT<CR>
|
||||
end
|
||||
|
||||
" Source vimrc after saving it
|
||||
|
|
|
@ -1 +0,0 @@
|
|||
Subproject commit fc0b41cd02c142442ede3f39bc444e897232dd3f
|
|
@ -0,0 +1,107 @@
|
|||
syntax on
|
||||
|
||||
" Visual
|
||||
set number
|
||||
set ruler
|
||||
set guioptions=ce
|
||||
set showmatch " Briefly jump to a paren once it's balanced
|
||||
set linespace=2
|
||||
set background=dark
|
||||
colorscheme railscasts
|
||||
|
||||
" Tabs/Whitespace
|
||||
set tabstop=2
|
||||
set shiftwidth=2
|
||||
set autoindent
|
||||
set smarttab
|
||||
set expandtab
|
||||
set nowrap
|
||||
set list
|
||||
set listchars=tab:▸\ ,eol:¬,trail:·
|
||||
set backspace=indent,eol,start " allow backspacing over everything in insert mode
|
||||
|
||||
" Misc
|
||||
set switchbuf=useopen " Don't re-open already opened buffers
|
||||
set nostartofline " Avoid moving cursor to BOL when jumping around
|
||||
set virtualedit=all " Let cursor move past the last char
|
||||
set whichwrap=b,s,h,l,<,>,[,]
|
||||
let mapleader = ','
|
||||
set autoread " watch for file changes
|
||||
set mouse=a
|
||||
set fileformats=unix
|
||||
|
||||
" Bells
|
||||
set novisualbell " No blinking
|
||||
set noerrorbells " No noise.
|
||||
set vb t_vb= " disable any beeps or flashes on error
|
||||
|
||||
" Searching
|
||||
set hlsearch
|
||||
set incsearch
|
||||
set ignorecase
|
||||
set smartcase
|
||||
|
||||
" Tab completion
|
||||
set wildmode=list:longest,list:full
|
||||
set wildignore+=*.o,*.obj,.git,*.rbc,*.swp
|
||||
|
||||
" Status bar
|
||||
set laststatus=2
|
||||
set statusline=%<%f\ %h%m%r%{fugitive#statusline()}%=%-14.(%l,%c%V%)\ %P
|
||||
|
||||
" Folding
|
||||
set foldenable " Turn on folding
|
||||
set foldmethod=marker " Fold on the marker
|
||||
set foldlevel=100 " Don't autofold anything (but I can still fold manually)
|
||||
set foldopen=block,hor,mark,percent,quickfix,tag " what movements open folds
|
||||
|
||||
|
||||
" Directories for swp files
|
||||
" persistent undos
|
||||
set undofile
|
||||
set undodir=~/.vim/dirs/undos
|
||||
|
||||
set backupdir=~/.vim/dirs/backups
|
||||
set directory=~/.vim/dirs/swaps
|
||||
|
||||
" Nicer text navigation
|
||||
nmap j gj
|
||||
nmap k gk
|
||||
|
||||
" Reselect visual block after adjusting indentation
|
||||
vnoremap < <gv
|
||||
vnoremap > >gv
|
||||
|
||||
" Nicer splitting
|
||||
set splitbelow
|
||||
set splitright
|
||||
map <C-_> :split<CR>
|
||||
map <C-\> :vsplit<CR>
|
||||
|
||||
" Emacs-like keys for the command line
|
||||
cnoremap <C-A> <Home>
|
||||
cnoremap <C-E> <End>
|
||||
cnoremap <C-K> <C-U>
|
||||
|
||||
" Move around in insert mode
|
||||
inoremap <C-h> <left>
|
||||
inoremap <C-k> <up>
|
||||
inoremap <C-j> <down>
|
||||
inoremap <C-l> <right>
|
||||
|
||||
" Opens an edit command with the path of the currently edited file filled in Normal mode: <Leader>e
|
||||
map <Leader>e :e <C-R>=expand("%:p:h") . "/" <CR>
|
||||
|
||||
" Strip trailing whitespace on save
|
||||
function! <SID>StripTrailingWhitespaces()
|
||||
" Preparation: save last search, and cursor position.
|
||||
let _s=@/
|
||||
let l = line(".")
|
||||
let c = col(".")
|
||||
" Do the business:
|
||||
%s/\s\+$//e
|
||||
" Clean up: restore previous search history, and cursor position
|
||||
let @/=_s
|
||||
call cursor(l, c)
|
||||
endfunction
|
||||
autocmd! BufWritePre * :call <SID>StripTrailingWhitespaces()
|
328
vim/vimrc
328
vim/vimrc
|
@ -1,294 +1,21 @@
|
|||
set nocompatible
|
||||
|
||||
runtime! macros/matchit.vim
|
||||
|
||||
" Syntax
|
||||
syntax on
|
||||
filetype plugin indent on
|
||||
"match ErrorMsg '\%>80v.\+'
|
||||
|
||||
" UI
|
||||
set number
|
||||
set ruler
|
||||
set guioptions=ce
|
||||
set mouse=a
|
||||
set background=dark
|
||||
colorscheme railscasts
|
||||
|
||||
" Tabs/Whitespace
|
||||
set tabstop=2
|
||||
set shiftwidth=2
|
||||
set autoindent
|
||||
set smarttab
|
||||
set expandtab
|
||||
set nowrap
|
||||
set list
|
||||
set listchars=tab:▸\ ,eol:¬,trail:·
|
||||
|
||||
set switchbuf=useopen " Don't re-open already opened buffers
|
||||
set nostartofline " Avoid moving cursor to BOL when jumping around
|
||||
set virtualedit=all " Let cursor move past the last char
|
||||
set showmatch " Briefly jump to a paren once it's balanced
|
||||
set whichwrap=b,s,h,l,<,>,[,]
|
||||
let mapleader = ','
|
||||
set statusline=%<%f\ %h%m%r%{fugitive#statusline()}%=%-14.(%l,%c%V%)\ %P
|
||||
set autoread " watch for file changes
|
||||
set fileformats=unix
|
||||
|
||||
" Searching
|
||||
set hlsearch
|
||||
set incsearch
|
||||
set ignorecase
|
||||
set smartcase
|
||||
|
||||
" Tab completion
|
||||
set wildmode=list:longest,list:full
|
||||
set wildignore+=*.o,*.obj,.git,*.rbc,*.swp
|
||||
|
||||
" Status bar
|
||||
set laststatus=2
|
||||
|
||||
" Format
|
||||
set linespace=2
|
||||
|
||||
" Nicer text navigation
|
||||
nmap j gj
|
||||
nmap k gk
|
||||
|
||||
" NERDTree configuration
|
||||
let NERDTreeIgnore = ['\.rbc$', '\~$']
|
||||
let NERDTreeChDirMode = 2
|
||||
let NERDTreeMouseMode = 3
|
||||
let NERDTreeQuitOnOpen = 1
|
||||
let NERDTreeMinimalUI = 1
|
||||
let NERDTreeDirArrows = 1
|
||||
map <Leader>n :NERDTreeToggle<CR>
|
||||
|
||||
" Project Tree
|
||||
autocmd! VimEnter * call s:CdIfDirectory(expand("<amatch>"))
|
||||
|
||||
" Reselect visual block after adjusting indentation
|
||||
vnoremap < <gv
|
||||
vnoremap > >gv
|
||||
|
||||
" For when you forget to sudo.. Really Write the file.
|
||||
cmap w!! w !sudo tee % >/dev/null
|
||||
|
||||
" TODO create function to generate tags for gemset and append a path to
|
||||
" current tags that represents that gemset.
|
||||
set tags=tmp/tags;/,./tmp/tags;/,tags;/,./tags;/
|
||||
|
||||
" If the parameter is a directory, cd into it
|
||||
function! s:CdIfDirectory(directory)
|
||||
let explicitDirectory = isdirectory(a:directory)
|
||||
let directory = explicitDirectory || empty(a:directory)
|
||||
|
||||
if explicitDirectory
|
||||
exe "ChangeDirectory " . a:directory
|
||||
endif
|
||||
|
||||
if directory
|
||||
NERDTree
|
||||
wincmd p
|
||||
bd
|
||||
endif
|
||||
endfunction
|
||||
|
||||
" NERDTree utility function
|
||||
function! s:UpdateNERDTree(...)
|
||||
let stay = 0
|
||||
|
||||
if(exists("a:1"))
|
||||
let stay = a:1
|
||||
end
|
||||
|
||||
if exists("t:NERDTreeBufName")
|
||||
let nr = bufwinnr(t:NERDTreeBufName)
|
||||
if nr != -1
|
||||
exe nr . "wincmd w"
|
||||
exe substitute(mapcheck("R"), "<CR>", "", "")
|
||||
if !stay
|
||||
wincmd p
|
||||
end
|
||||
endif
|
||||
endif
|
||||
|
||||
if exists("CommandTFlush")
|
||||
CommandTFlush
|
||||
endif
|
||||
endfunction
|
||||
|
||||
" Utility functions to create file commands
|
||||
function! s:CommandCabbr(abbreviation, expansion)
|
||||
execute 'cabbrev ' . a:abbreviation . ' <c-r>=getcmdpos() == 1 && getcmdtype() == ":" ? "' . a:expansion . '" : "' . a:abbreviation . '"<CR>'
|
||||
endfunction
|
||||
|
||||
function! s:FileCommand(name, ...)
|
||||
if exists("a:1")
|
||||
let funcname = a:1
|
||||
else
|
||||
let funcname = a:name
|
||||
endif
|
||||
|
||||
execute 'command! -nargs=1 -complete=file ' . a:name . ' :call ' . funcname . '(<f-args>)'
|
||||
endfunction
|
||||
|
||||
function! s:DefineCommand(name, destination)
|
||||
call s:FileCommand(a:destination)
|
||||
call s:CommandCabbr(a:name, a:destination)
|
||||
endfunction
|
||||
|
||||
" Public NERDTree-aware versions of builtin functions
|
||||
function! ChangeDirectory(dir, ...)
|
||||
execute "cd " . a:dir
|
||||
let stay = exists("a:1") ? a:1 : 1
|
||||
|
||||
NERDTree
|
||||
|
||||
wincmd l
|
||||
"if !stay
|
||||
"wincmd p
|
||||
"endif
|
||||
endfunction
|
||||
|
||||
function! Touch(file)
|
||||
execute "!touch " . a:file
|
||||
call s:UpdateNERDTree()
|
||||
endfunction
|
||||
|
||||
function! Remove(file)
|
||||
let current_path = expand("%")
|
||||
let removed_path = fnamemodify(a:file, ":p")
|
||||
|
||||
if (current_path == removed_path) && (getbufvar("%", "&modified"))
|
||||
echo "You are trying to remove the file you are editing. Please close the buffer first."
|
||||
else
|
||||
execute "!rm " . a:file
|
||||
endif
|
||||
|
||||
call s:UpdateNERDTree()
|
||||
endfunction
|
||||
|
||||
function! Edit(file)
|
||||
if exists("b:NERDTreeRoot")
|
||||
wincmd p
|
||||
endif
|
||||
|
||||
execute "e " . a:file
|
||||
|
||||
ruby << RUBY
|
||||
destination = File.expand_path(VIM.evaluate(%{system("dirname " . a:file)}))
|
||||
pwd = File.expand_path(Dir.pwd)
|
||||
home = pwd == File.expand_path("~")
|
||||
|
||||
if home || Regexp.new("^" + Regexp.escape(pwd)) !~ destination
|
||||
VIM.command(%{call ChangeDirectory(system("dirname " . a:file), 0)})
|
||||
end
|
||||
RUBY
|
||||
endfunction
|
||||
|
||||
" Define the NERDTree-aware aliases
|
||||
call s:DefineCommand("cd", "ChangeDirectory")
|
||||
call s:DefineCommand("touch", "Touch")
|
||||
call s:DefineCommand("rm", "Remove")
|
||||
call s:DefineCommand("e", "Edit")
|
||||
|
||||
" This helps with RVM etc
|
||||
set shell=zsh
|
||||
|
||||
" CTags
|
||||
map <Leader>rt :!ctags --extra=+f -R *<CR><CR>
|
||||
|
||||
" Remember last location in file
|
||||
if has("autocmd")
|
||||
au! BufReadPost * if line("'\"") > 0 && line("'\"") <= line("$")
|
||||
\| exe "normal g'\"" | endif
|
||||
endif
|
||||
|
||||
function! s:setupWrapping()
|
||||
set wrap
|
||||
set wm=2
|
||||
set textwidth=72
|
||||
endfunction
|
||||
|
||||
function! s:setupMarkup()
|
||||
call s:setupWrapping()
|
||||
map <buffer> <Leader>p :Mm <CR>
|
||||
endfunction
|
||||
|
||||
" make and python use real tabs
|
||||
au! FileType make set noexpandtab
|
||||
au! FileType python set noexpandtab
|
||||
|
||||
au! FileType scss syntax cluster sassCssAttributes add=@cssColors
|
||||
|
||||
" Thorfile, Rakefile and Gemfile are Ruby
|
||||
au! BufRead,BufNewFile {Gemfile,Rakefile,Thorfile,config.ru} set ft=ruby
|
||||
au! FileType ruby let &l:tags = pathogen#legacyjoin(pathogen#uniq(
|
||||
\ pathogen#split(&tags) +
|
||||
\ map(split($GEM_PATH,':'),'v:val."/gems/*/tags"')))
|
||||
|
||||
au! BufRead,BufNewFile gitconfig set ft=gitconfig
|
||||
|
||||
" md, markdown, and mk are markdown and define buffer-local preview
|
||||
au! BufRead,BufNewFile *.{md,markdown,mdown,mkd,mkdn} call s:setupMarkup()
|
||||
|
||||
au! BufRead,BufNewFile *.txt call s:setupWrapping()
|
||||
set tags=tmp/tags;/,./tmp/tags;/,tags;/,./tags;/
|
||||
|
||||
cmap <F10> :echo "hi<" . synIDattr(synID(line("."),col("."),1),"name") . '> trans<'
|
||||
\ . synIDattr(synID(line("."),col("."),0),"name") . "> lo<"
|
||||
\ . synIDattr(synIDtrans(synID(line("."),col("."),1)),"name") . ">"<CR>
|
||||
|
||||
" allow backspacing over everything in insert mode
|
||||
set backspace=indent,eol,start
|
||||
|
||||
" Opens an edit command with the path of the currently edited file filled in
|
||||
" Normal mode: <Leader>e
|
||||
map <Leader>e :e <C-R>=expand("%:p:h") . "/" <CR>
|
||||
|
||||
" Nicer split controls
|
||||
map <C-_> :split<CR>
|
||||
map <C-\> :vsplit<CR>
|
||||
|
||||
" Emacs-like keys for the command line
|
||||
cnoremap <C-A> <Home>
|
||||
cnoremap <C-E> <End>
|
||||
cnoremap <C-K> <C-U>
|
||||
|
||||
set wildignore+=Transmission*Remote*GUI
|
||||
|
||||
let g:ragtag_global_maps = 1
|
||||
|
||||
" persistent undos
|
||||
|
||||
set undodir=~/.vim/undos
|
||||
set undofile
|
||||
|
||||
"Directories for swp files
|
||||
set backupdir=~/.vim/dirs/backups
|
||||
set undodir=~/.vim/dirs/undos
|
||||
set directory=~/.vim/dirs/swaps
|
||||
|
||||
" To HTML
|
||||
let html_number_lines = 0
|
||||
let use_xhtml = 1
|
||||
let html_use_css = 1
|
||||
|
||||
" Strip trailing whitespace
|
||||
function! <SID>StripTrailingWhitespaces()
|
||||
" Preparation: save last search, and cursor position.
|
||||
let _s=@/
|
||||
let l = line(".")
|
||||
let c = col(".")
|
||||
" Do the business:
|
||||
%s/\s\+$//e
|
||||
" Clean up: restore previous search history, and cursor position
|
||||
let @/=_s
|
||||
call cursor(l, c)
|
||||
endfunction
|
||||
|
||||
autocmd! BufWritePre * :call <SID>StripTrailingWhitespaces()
|
||||
|
||||
" Align cucumber tables
|
||||
inoremap <silent> <Bar> <Bar><Esc>:call <SID>align()<CR>a
|
||||
|
||||
|
@ -303,45 +30,11 @@ function! s:align()
|
|||
endif
|
||||
endfunction
|
||||
|
||||
autocmd! FocusLost * :up
|
||||
|
||||
" Prevents '<Plug>DiscretionaryEnd' being inserted when pressing <Enter> in
|
||||
" insert mode on new files. Blame SuperTab
|
||||
let g:SuperTabCrMapping = 0
|
||||
let g:SuperTabDefaultCompletionType = "context"
|
||||
|
||||
|
||||
" vim wiki
|
||||
let g:vimwiki_hl_cb_checked = 1
|
||||
let g:vimwiki_menu = 'Plugin.Vimwiki'
|
||||
let g:vimwiki_badsyms = ' '
|
||||
let g:vimwiki_use_mouse = 1
|
||||
let g:vimwiki_dir_link = 'index'
|
||||
let g:vimwiki_list = [
|
||||
\ {
|
||||
\ 'path': '~/Dropbox/Wiki/Text',
|
||||
\ 'path_html': '~/Dropbox/Wiki/HTML',
|
||||
\ 'nested_syntaxes': {
|
||||
\ 'ruby': 'ruby'
|
||||
\ }
|
||||
\ }
|
||||
\]
|
||||
|
||||
" Command-T
|
||||
let g:CommandTMaxFiles = 20000
|
||||
let g:CommandTMaxHeight = 10
|
||||
|
||||
" Syntastic
|
||||
let g:syntastic_enable_signs = 1
|
||||
let g:syntastic_auto_loc_list = 0
|
||||
|
||||
" Indent Guides
|
||||
let g:indent_guides_color_change_percent = 7
|
||||
autocmd! VimEnter * IndentGuidesEnable
|
||||
|
||||
" Put a space between comments and comment marker
|
||||
let NERDSpaceDelims = 1
|
||||
|
||||
" snipMate config
|
||||
let g:snips_author = 'Bodaniel Jeanes'
|
||||
|
||||
|
@ -349,23 +42,14 @@ let g:snips_author = 'Bodaniel Jeanes'
|
|||
let vimclojure#ParenRainbow=1
|
||||
autocmd FileType clojure AutoCloseOff
|
||||
|
||||
" ZoomWin
|
||||
map <Leader>z :ZoomWin<CR>
|
||||
imap <Leader>z <Esc>:ZoomWin<CR>
|
||||
|
||||
" Move around in insert mode
|
||||
inoremap <C-h> <left>
|
||||
inoremap <C-k> <up>
|
||||
inoremap <C-j> <down>
|
||||
inoremap <C-l> <right>
|
||||
|
||||
" Source vimrc after saving it
|
||||
autocmd! BufWritePost .vimrc,vimrc source $MYVIMRC | NERDTreeToggle | NERDTreeToggle
|
||||
|
||||
" Quick editing of common dot-files
|
||||
map <Leader>vv :edit $MYVIMRC<CR>
|
||||
map <Leader>gg :edit $MYGVIMRC<CR>
|
||||
map <Leader>.. :ChangeDirectory ~/.config<CR>:wincmd l<CR>:enew<CR>
|
||||
map <Leader>.. :cd ~/.config<CR>:enew<CR>
|
||||
|
||||
source ~/.vim/ui.vim
|
||||
source ~/.vim/autocommands.vim
|
||||
source ~/.vim/bundles.vim
|
||||
|
||||
if filereadable(expand('~/.vimrc.local'))
|
||||
source ~/.vimrc.local
|
||||
|
|
Loading…
Reference in New Issue