Created
June 4, 2015 07:25
-
-
Save JonahMoses/18df544b4ba2ea41220b to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
source ~/.dotfiles/vim/bundles " Bundles | |
2 | |
3 syntax on " Enable syntax highlighting | |
4 filetype plugin indent on " Enable filetype-specific indenting and plugins | |
5 | |
6 nnoremap Q <nop>| " disable EX mode | |
7 nnoremap q <nop>| " disable EX mode | |
8 nnoremap <Space> <nop>| " remove functionality from spacebar to allow leader to be spacebar | |
9 let mapleader = ' '| " leader is spacebar | |
10 nnoremap ; :| " remap ; to : | |
11 imap jj <esc>| " jj instead of escape | |
12 nnoremap ? :Ag<SPACE>| " ? is Ag search| | |
13 nnoremap <leader>w :w<cr>| " leader w to save | |
14 nnoremap <leader>q :q<cr>| " leader q to quit | |
15 nnoremap <leader>fq :q!<cr>| " leader q to quit | |
16 nnoremap s <nop>| " disable s entering insert mode | |
17 nnoremap <leader>rw :%s/\s\+$//e<cr>| " leader rw removes all trailing whitespace | |
18 nnoremap <leader>h :noh<cr>| " leader h removes all search highlighting | |
19 nnoremap <leader>cn :vsplit ~/Dropbox/coding/coding-notes.txt<cr>| " open coding notes to the right | |
20 nnoremap <leader>p :set paste!<cr>| " toggle paste | |
21 nnoremap <leader>a mzgg=G`z;| " auto aligns entire page | |
22 noremap <leader>a mzgg=G`z;| " auto aligns entire page visual mode | |
23 nnoremap n <nop>| " disable n entering insert mode | |
24 nnoremap <leader>rl :call NumberToggle()<cr>| " call NumberToggle | |
25 nnoremap <leader>n :set number!<cr>| | |
26 nnoremap <leader><leader> :b#<cr>| " leader leader switches between last two files | |
27 map <leader>cu :Tabularize /| " align up on whatever I enter | |
28 map <leader>ce :Tabularize /=<cr>| " align up on = | |
29 map <leader>cc :Tabularize /:<cr>| " align up on : | |
30 map <leader>cq :Tabularize /" <cr>| " align up on " | |
31 | |
32 set autoindent " set auto indent | |
33 set showbreak=↪ " show character for wrapped lines | |
34 set ts=2 " set indent to 2 spaces | |
35 set shiftwidth=2 | |
36 set expandtab " use spaces, not tab characters | |
37 set textwidth=0 | |
38 set splitbelow " Open new split panes to right and bottom, which feels more natural | |
39 set splitright " Open new split panes to right and bottom, which feels more natural | |
40 | |
41 set formatoptions-=or " Dont add the comment prefix when I hit enter or o/O on a comment line. | |
42 set nocompatible " Dont need to be compatible with old vim | |
43 set showmatch " show bracket matches | |
44 set scrolloff=3 " minimum lines above/below cursor | |
45 set ruler " show row and column in footer | |
46 set laststatus=2 " always show status bar | |
set showcmd " display commands | |
48 set noswapfile | |
49 set wrap linebreak nolist " dont insert new lines on word wrap | |
50 set number | |
51 | |
52 set ignorecase " ignore case in search | |
53 set smartcase " pay attention to case when caps are used | |
54 set hlsearch " highlight all search matches | |
55 set incsearch " show search results as I type | |
56 | |
57 set mouse=a " enable mouse support | |
58 set clipboard=unnamed | |
59 set ttimeoutlen=500 " decrease timeout for faster insert with 'O' | |
60 set ttyfast | |
61 set noswapfile | |
62 set wildmenu " enable bash style tab completion | |
63 set wildmode=longest,list | |
64 set wildignore+=*.gif,*.jpg,*.png,*.log " Ignore images and log files | |
65 set wildignore+=node_modules/* " Ignore node_modules | |
66 set history=500 " keep 500 lines of command line history | |
67 match ErrorMsg '\s\+$' " show extra whitespace | |
68 set ttimeout " (Hopefully) removes the delay when hitting esc in insert mode | |
69 | |
70 " Toggle between relative and number | |
71 function! NumberToggle() | |
72 if (&relativenumber == 1) | |
73 set number! | |
74 set relativenumber! | |
75 else | |
76 set relativenumber! | |
77 set number! | |
78 endif | |
79 endfunc | |
80 | |
81 " NerdTree | |
82 nnoremap <leader>t :NERDTreeToggle<cr> | |
83 let NERDTreeQuitOnOpen =1 | |
84 autocmd bufenter * if (winnr("$") == 1 && exists("b:NERDTreeType") && b:NERDTreeType == "primary") | q | endif " Open NerdTree if vim starts with no files | |
85 | |
86 " Use Silver Searcher instead of grep | |
87 let g:ctrlp_use_caching = 0 | |
88 if executable('ag') | |
89 set grepprg=ag\ --nogroup\ --nocolor\ --column | |
90 | |
91 let g:ctrlp_user_command = 'ag %s -l --nocolor -g ""' | |
else | |
93 let g:ctrlp_user_command = ['.git', 'cd %s && git ls-files . -co --exclude-standard', 'find %s -type f'] | |
94 let g:ctrlp_prompt_mappings = { | |
95 \ 'AcceptSelection("e")': ['<space>', '<cr>', '<2-LeftMouse>'], | |
96 \ } | |
97 endif | |
98 | |
99 " Make those pry and debugger statements painfully obvious | |
100 au BufEnter *.rb syn match error contained "\<binding.pry\>" | |
101 au BufEnter *.rb syn match error contained "\<debugger\>" | |
102 au BufEnter *.js syn match error contained "\<console.log\>" | |
103 | |
104 " Fuzzy finder: ignore stuff that can't be opened, and generated files | |
105 let g:fuzzy_ignore = "*.png;*.PNG;*.JPG;*.jpg;*.GIF;*.gif;vendor/**;coverage/**;tmp/**;rdoc/**" | |
106 | |
107 " Reload .vimrc on save | |
108 augroup reload_vimrc " { | |
109 autocmd! | |
110 autocmd BufWritePost $MYVIMRC source $MYVIMRC | |
111 augroup END " } | |
112 | |
113 " filetype settings | |
114 augroup myfiletypes | |
115 autocmd! | |
116 au FileType ruby,eruby,yaml setlocal ai sw=2 sts=2 et " autoindent with two spaces, always expand tabs | |
117 au FileType ruby,eruby,yaml setlocal path+=lib | |
118 au FileType ruby,eruby,yaml setlocal colorcolumn=80 | |
119 au FileType ruby,eruby,yaml setlocal iskeyword+=? " Make ?s part of words | |
120 au FileType gitcommit setlocal spell " spell checking for commit messages | |
121 au BufRead,BufNewFile *.md,*.txt setlocal spell " Turn on spell-checking in markdown and text. | |
122 au BufNewFile,BufReadPost *.md set filetype=markdown " By default, vim thinks .md is Modula-2. | |
123 au BufNewFile,BufRead *.json setf javascript " treat JSON like JavaScript | |
124 au BufNewFile,BufRead *.txt setlocal nolist " Don't display whitespace | |
125 au FileType xml exe ":silent 1,$!xmllint --format --recover - 2>/dev/null" " Format xml files | |
126 augroup END | |
127 | |
128 " Configure Syntastic syntax checking to check on open as well as save | |
129 let g:syntastic_check_on_open=1 | |
130 let g:syntastic_html_tidy_ignore_errors=[" proprietary attribute \"ng-"] | |
131 | |
132 " Make the omnicomplete text readable | |
133 " highlight PmenuSel ctermfg=red | |
134 " highlight Pmenu ctermfg=red ctermbg=red | |
135 " highlight Search cterm=NONE ctermfg=white ctermbg=darkblue | |
137 " Quicker window movement | |
138 nnoremap <C-h> <C-w>h | |
139 nnoremap <C-j> <C-w>j | |
140 nnoremap <C-k> <C-w>k | |
141 nnoremap <C-l> <C-w>l |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment