|
| 1 | +" Based on this https://gist.github.com/gabrielso/3724745 |
| 2 | + |
| 3 | +" Set vim as default editor |
| 4 | +" sudo update-alternatives --config editor |
| 5 | + |
| 6 | +" Enable syntax highlighting |
| 7 | +syntax on |
| 8 | + |
| 9 | +" Use Vim settings, rather than Vi settings |
| 10 | +set nocompatible |
| 11 | + |
| 12 | +" Read file when modified outside Vim |
| 13 | +set autoread |
| 14 | + |
| 15 | +" Do not keep any history |
| 16 | +"set viminfo='0,:0,<0,@0,f0 |
| 17 | +"set nobackup |
| 18 | +"set nowb |
| 19 | +set noswapfile |
| 20 | + |
| 21 | +" Allow backspacing over everything in INSERT mode |
| 22 | +set backspace=indent,eol,start |
| 23 | + |
| 24 | +" Show ruler and command visual aid |
| 25 | +set ruler |
| 26 | +set showcmd |
| 27 | + |
| 28 | +" Set color at 80'th column |
| 29 | +set colorcolumn=80 |
| 30 | +highlight ColorColumn ctermbg=4 |
| 31 | + |
| 32 | +" Disable bells |
| 33 | +set noerrorbells |
| 34 | +set visualbell |
| 35 | +set t_vb= |
| 36 | + |
| 37 | +" Don't use Ex mode, use Q for formatting |
| 38 | +map Q gq |
| 39 | +
|
| 40 | +" CTRL-U in INSERT mode deletes a lot. Use CTRL-G u to first break undo, |
| 41 | +" so that you can undo CTRL-U after inserting a line break. |
| 42 | +inoremap <C-U> <C-G>u<C-U> |
| 43 | +
|
| 44 | +" Set partial search and result highlighting |
| 45 | +set incsearch |
| 46 | +set hlsearch |
| 47 | + |
| 48 | +" Ignore case when searching |
| 49 | +set ignorecase |
| 50 | +set smartcase |
| 51 | + |
| 52 | +" Show matching bracets |
| 53 | +set showmatch |
| 54 | + |
| 55 | +" Highlight the cursor line |
| 56 | +"set cursorline |
| 57 | + |
| 58 | +" Use Monaco as default font |
| 59 | +set guifont=Monaco:h12 |
| 60 | + |
| 61 | +" Hide the toolbar in GUI |
| 62 | +set guioptions-=T |
| 63 | + |
| 64 | +" Set the colorscheme and window transparency |
| 65 | +"colorscheme desert |
| 66 | +"set transparency=5 |
| 67 | + |
| 68 | +" Disable 'command' and 'option' navigation bindings |
| 69 | +if has("gui_macvim") |
| 70 | + let macvim_skip_cmd_opt_movement = 1 |
| 71 | +endif |
| 72 | + |
| 73 | +" Change Netrw tree mode |
| 74 | +let g:netrw_liststyle=3 |
| 75 | + |
| 76 | +" Set default vertical split to right |
| 77 | +set splitright |
| 78 | + |
| 79 | +" Set soft tabs |
| 80 | +set tabstop=4 |
| 81 | +set shiftwidth=4 |
| 82 | +set expandtab |
| 83 | +set smarttab |
| 84 | + |
| 85 | +" Indent |
| 86 | +set ai |
| 87 | +set si |
| 88 | + |
| 89 | +" Show invisibles |
| 90 | +"set listchars=eol:¬,tab:▸\ ,trail:· |
| 91 | +set listchars=tab:▸\ ,trail:· |
| 92 | +highlight NonText guifg=#4a4a59 |
| 93 | +highlight SpecialKey guifg=#4a4a59 |
| 94 | + |
| 95 | +" Enable mouse and clipboard sharing |
| 96 | +set mouse=a |
| 97 | +set clipboard+=unnamedplus |
| 98 | + |
| 99 | +" Show line number and listchars |
| 100 | +set list |
| 101 | +set nu |
| 102 | +set rnu |
| 103 | + |
| 104 | +" Autocomplete enclosures |
| 105 | +" https://stackoverflow.com/a/62536744/15911637 |
| 106 | + |
| 107 | +" Use jk to press Esc |
| 108 | +inoremap jk <Esc> |
| 109 | +
|
| 110 | +" switch buffer |
| 111 | +" https://stackoverflow.com/a/5562707/15911637 |
| 112 | +map gn :bn<cr> |
| 113 | +map gp :bp<cr> |
| 114 | +map gd :bd<cr> |
| 115 | +
|
| 116 | +" Clear highlight |
| 117 | +map <C-h> :noh<cr> |
0 commit comments