|
| 1 | +" This must be first, because it changes other options as side effect |
| 2 | +set nocompatible |
| 3 | + |
| 4 | +" Use pathogen to easily modify the runtime path to include all |
| 5 | +" plugins under the ~/.vim/bundle directory |
| 6 | +" call pathogen#helptags() |
| 7 | +" call pathogen#runtime_append_all_bundles() |
| 8 | + |
| 9 | +" change the mapleader from \ to , |
| 10 | +let mapleader="," |
| 11 | + |
| 12 | +" Quickly edit/reload the vimrc file |
| 13 | +nmap <silent> <leader>ev :e $MYVIMRC<CR> |
| 14 | +nmap <silent> <leader>sv :so $MYVIMRC<CR> |
| 15 | +
|
| 16 | +" It hides buffers instead of closing them. This means that you can |
| 17 | +" have unwritten changes to a file and open a new file using :e, |
| 18 | +" without being forced to write or undo your changes first. Also, |
| 19 | +" undo buffers and marks are preserved while the buffer is open. |
| 20 | +set hidden |
| 21 | + |
| 22 | +set nowrap " don't wrap lines |
| 23 | +set tabstop=2 " a tab is four spaces |
| 24 | +set backspace=indent,eol,start |
| 25 | + " allow backspacing over everything in insert mode |
| 26 | +set autoindent " always set autoindenting on |
| 27 | +set copyindent " copy the previous indentation on autoindenting |
| 28 | +set number " always show line numbers |
| 29 | +set shiftwidth=2 " number of spaces to use for autoindenting |
| 30 | +set shiftround " use multiple of shiftwidth when indenting with '<' and '>' |
| 31 | +set showmatch " set show matching parenthesis |
| 32 | +set ignorecase " ignore case when searching |
| 33 | +set smartcase " ignore case if search pattern is all lowercase, |
| 34 | + " case-sensitive otherwise |
| 35 | + " shiftwidth, not tabstop |
| 36 | +set smarttab " insert tabs on the start of a line according to |
| 37 | + " shiftwidth, not tabstop |
| 38 | +set hlsearch " highlight search terms |
| 39 | +set incsearch " show search matches as you type |
| 40 | + |
| 41 | +set history=1000 " remember more commands and search history |
| 42 | +set undolevels=1000 " use many muchos levels of undo |
| 43 | +set wildignore=*.swp,*.bak,*.pyc,*.class |
| 44 | +set title " change the terminal's title |
| 45 | +set visualbell " don't beep |
| 46 | +set noerrorbells " don't beep |
| 47 | + |
| 48 | +" Comment in the following lines to turn off swap files during crashes |
| 49 | +" set nobackup |
| 50 | +" set noswapfile |
| 51 | + |
| 52 | +" This enables vim to load plugins, settings or key mappings that |
| 53 | +" are only useful in the context of specific file types |
| 54 | +filetype plugin indent on |
| 55 | + |
| 56 | +" Set some file type specific settings |
| 57 | +if has('autocmd') |
| 58 | + autocmd filetype python set expandtab |
| 59 | +endif |
| 60 | + |
| 61 | +" Syntax highlighting |
| 62 | +if &t_Co >= 256 || has("gui_running") |
| 63 | +" colorscheme mustang |
| 64 | +endif |
| 65 | + |
| 66 | +if &t_Co > 2 || has("gui_running") |
| 67 | + " switch syntax highlighting on, when the terminal has colors |
| 68 | + syntax on |
| 69 | +endif |
| 70 | + |
| 71 | +" Highlight whitespace in a convenient way |
| 72 | +" set list |
| 73 | +" set listchars=tab:>.,trail:.,extends:#,nbsp:. |
| 74 | + |
| 75 | +" Disable tab display for HTML & XML files |
| 76 | +autocmd filetype html,xml set listchars-=tab:>. |
| 77 | + |
| 78 | +" Press F2 to switch into paste mode and paste large copy buffer |
| 79 | +set pastetoggle=<F2> |
| 80 | + |
| 81 | +" ; works contextually the same as : |
| 82 | +nnoremap ; : |
| 83 | +
|
| 84 | +" Use Q for formatting the current paragraph (or selection) |
| 85 | +vmap Q gq |
| 86 | +nmap Q gqap |
| 87 | +
|
| 88 | +" Skip to the next row, instead of next newline |
| 89 | +nnoremap j gj |
| 90 | +nnoremap k gk |
| 91 | +
|
| 92 | +" Easy window navigation |
| 93 | +map <C-h> <C-w>h |
| 94 | +map <C-j> <C-w>j |
| 95 | +map <C-k> <C-w>k |
| 96 | +map <C-l> <C-w>l |
| 97 | +
|
| 98 | +" Silence search history |
| 99 | +" Clear it with ,/ command |
| 100 | +nmap <silent> ,/ :nohlsearch<CR> |
| 101 | +
|
| 102 | +" Save as sudo if file not opened with sudo |
| 103 | +cmap w!! w !sudo tee % >/dev/null |
| 104 | +
|
| 105 | +" Column highlighting |
| 106 | +au WinLeave * set nocursorline nocursorcolumn |
| 107 | +au WinEnter * set cursorline cursorcolumn |
| 108 | +set cursorline cursorcolumn |
0 commit comments