| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113 |
- " Do not try to be compatible with vi
- set nocompatible
- if has("autocmd")
- " Clear existing autocmd
- autocmd!
- endif
- " Use bundles config {{{
- if filereadable(expand("~/.vimrc.bundles"))
- source ~/.vimrc.bundles
- endif
- " }}}
- filetype plugin indent on " Automatically detect file types.
- if has("autocmd")
- " Source the vimrc file after saving it
- autocmd BufWritePost .vimrc nested source $MYVIMRC
- endif
- """"""""
- "" Tabs and Text Formatting
- """"""""""""""""""""""""""""""""""""""""""""""""""""""
- syntax on " Syntax highlighting
- set nowrap
- set cursorline " Highlight current line
- set expandtab " convert tab characters into spaces
- set tabstop=2 " actual tab press distance
- set softtabstop=2 " let backspace delete by indents
- set shiftround " indent to nearest tabstops
- set shiftwidth=2 " amount to indent with > and <
- set smarttab " backspace tabs where appropriate even if spaces
- set textwidth=80 " try to keep text within 80 characters
- set colorcolumn=+1 " mark out the limits of the textwidth
- set mouse=a
- set nojoinspaces " Prevents inserting two spaces after punctuation on a join (J)
- set splitright " Puts new vsplit windows to the right of the current
- set splitbelow " Puts new split windows to the bottom of the current
- set backspace=indent,eol,start " Backspace for dummies
- set linespace=0 " No extra spaces between rows
- set number " Line numbers on
- set showmatch " Show matching brackets/parenthesis
- set incsearch " Find as you type search
- set hlsearch " Highlight search terms
- set winminheight=0 " Windows can be 0 line high
- set ignorecase " Case insensitive search
- set smartcase " Case sensitive when uc present
- set wildmenu " Show list instead of just completing
- set modeline " Support vim modelines at the top of files
- "set wildmode=list:longest,full " Command <Tab> completion, list matches, then longest common part, then all.
- set whichwrap=b,s,h,l,<,>,[,] " Backspace and cursor keys wrap too
- set shortmess+=filmnrxoOtT " Abbrev. of messages (avoids 'hit enter')
- set scrolloff=5 " Minimum lines to keep above and below cursor
- set foldenable " Auto fold code
- set list
- set listchars=tab:›\ ,trail:•,extends:#,nbsp:. " Highlight problematic whitespace
- if has('persistent_undo')
- set undofile " So is persistent undo ...
- set undolevels=1000 " Maximum number of changes that can be undone
- set undoreload=10000 " Maximum number lines to save for undo on a buffer reload
- endif
- """"""""
- "" Key Remaps
- """"""""""""""""""""""""""""""""""""""""""""""""""""""""
- let mapleader = ','
- " More convenient escape
- inoremap kj <ESC>
- inoremap jk <ESC>
- " Yank from the cursor to the end of the line, to be consistent with C and D.
- nnoremap Y y$
- nnoremap <silent> <leader>w :set wrap!<CR>
- " Toggle paste mode - no autoindenting of pasted material
- nnoremap <silent> <leader>p :set paste! paste?<CR>
- " Toggle visible whitespace characters
- nnoremap <silent> <leader>l :set list!<CR>
- " Toggle scrollbind for moving multiple splits in sync together
- nnoremap <silent> <leader>s :set scrollbind! scrollbind?<CR>
- " Backspace to clear current search (and stop highlighting)
- nnoremap <silent> <backspace> :call ClearSearch()<CR>
- function! ClearSearch()
- if (@/ != "")
- let @/=""
- redraw
- endif
- endfunction
- " Allow using the repeat operator with a visual selection (!)
- " http://stackoverflow.com/a/8064607/127816
- vnoremap . :normal .<CR>
- """"""""" Source local scripts/plugins
- for filePath in split(globpath('~/dotfiles/vim/settings', '*.vim'), '\n')
- execute 'source' filePath
- endfor
|