-
Notifications
You must be signed in to change notification settings - Fork 0
/
vimrc
156 lines (129 loc) · 5.53 KB
/
vimrc
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
"
"
" This is my .vimrc
" There are many like it, but this one is mine.
"
" I've drawn inspiration from the following
" https://github.com/romainl/idiomatic-vimrc
" https://dougblack.io/words/a-good-vimrc.html
" https://github.com/thoughtbot/dotfiles/blob/master/vimrc
" https://pragprog.com/book/dnvim2/practical-vim-second-edition
" https://pragprog.com/book/modvim/modern-vim
"
" http://www.textfiles.com/art/texthistory.txt
" https://thenewstack.io/surprisingly-rich-history-ascii-art/
"
"
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" ,,,
" (o o)
" ----------------------------oOO--( )--OOo-------------------------------------
"
" Basic Tweaks
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" better safe than sorry
" https://stackoverflow.com/a/5845583
set nocompatible
" see :help :filetype-overview
filetype plugin indent on
" https://github.com/thoughtbot/dotfiles/blob/master/vimrc
" switch syntax highlighting on, when the terminal has colors
if (&t_Co > 2 || has("gui_running")) && !exists("syntax_on")
syntax on
endif
set backspace=indent,eol,start " proper backspace behavior
set linespace=0 " No extra spaces between rows
set nowrap " wrap long lines
set autoindent " indent at the same level as the previous line
set showmatch " show matching brackets/parenthesis
" ui tweaks
set number " Line numbers on
set virtualedit=onemore " allow for cursor beyond last character
if filereadable(expand("~/.vim/pack/bundle/start/vim-colors-solarized/colors/solarized.vim"))
set term=xterm-256color " TODO only need this for color to work, why though
" https://superuser.com/q/311370
let g:solarized_termcolors=256
syntax enable
set background=dark
colorscheme solarized
let g:airline_theme='solarized'
endif
" space over tab
" https://softwareengineering.stackexchange.com/a/66
set shiftwidth=4 " use indents of 4 spaces
set tabstop=4 " an indentation every four columns
set expandtab " 4 space tabs everywhere
" searching tweaks
set incsearch " find as you type search, hit '<CR>' to stop.
set hlsearch " highlight search terms
set ignorecase " case insensitive search
set smartcase " case sensitive when uppercase present
set wildmenu " command-line completion
set wildmode=list:longest,full " command <Tab> completion
" movement and scrolling tweaks
set scrolljump=5 " lines to scroll when cursor leaves screen
set scrolloff=3 " minimum lines to keep above and below cursor
" move vertically by visual line, skip over soft wrap lines
nnoremap j gj
nnoremap k gk
" Quicker window movement
nnoremap <C-j> <C-w>j
nnoremap <C-k> <C-w>k
nnoremap <C-h> <C-w>h
nnoremap <C-l> <C-w>l
" brains
set hidden " more than one unsaved buffer
set history=500 " default is 20
set viewoptions=folds,options,cursor,unix,slash " :help viewoptions
set nobackup " no backup, swapfiles
set nowritebackup
set noswapfile
" key (re)mappings
" the default leader is '\', but many people, myself included prefer ',' as it's
" in a standard postion
let mapleader = ','
" Yank from the cursor to the end of the line, to be consistent with C and D.
nnoremap Y y$
" visual shifting (does not exit Visual mode)
vnoremap < <gv
vnoremap > >gv
" Folding
" :help usr_28
set foldenable " enable folding
set foldlevelstart=10 " open most folds by default
set foldnestmax=10 " 10 nested fold max
set foldmethod=indent " fold based on indent level
" space open/closes folds
nnoremap <space> za
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" \ /
" -----==( o )==-----
"
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" Bundles
" Using Vim 8 built in bundle support, all bundles I use are
" just cloned into ~/.vim/pack/bundle/start/
" here is what I currently use and any config jiggering
" https://github.com/vim-airline/vim-airline.git
" https://github.com/scrooloose/nerdtree.git
" https://github.com/tpope/vim-fugitive.git
" https://github.com/jlanzarotta/bufexplorer.git
" https://github.com/vim-airline/vim-airline-themes.git
" https://github.com/altercation/vim-colors-solarized.git
map <C-e> :NERDTreeToggle<CR>:NERDTreeMirror<CR>
map <leader>e :NERDTreeFind<CR>
nmap <leader>nt :NERDTreeFind<CR>
let NERDTreeShowBookmarks=1
let NERDTreeIgnore=['\.pyc', '\~$', '\.swo$', '\.swp$', '\.git', '\.hg', '\.svn', '\.bzr']
let NERDTreeChDirMode=0
let NERDTreeQuitOnOpen=1
let NERDTreeShowHidden=1
let NERDTreeKeepTreeInNewTab=1
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" \__/
" (oo)
" //||\\
"
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""