-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathvimrc_old
More file actions
165 lines (132 loc) · 4.15 KB
/
vimrc_old
File metadata and controls
165 lines (132 loc) · 4.15 KB
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
157
158
159
160
161
162
163
164
165
" Enable filetype detection, plugins, and indentation
filetype plugin indent on
" Enable modern Vim features not compatible with Vi spec.
set nocompatible
try
source /usr/local/google/home/tayo/.vimrc_microsoft
catch
" No machine-specific vimrc..
endtry
" Local configs on a given machine
try
source ~/.vimrc_local.vim
catch
endtry
let mapleader=","
"Colors
syntax on
set t_Co=256 "enable 256 color support in vim
set termguicolors
let g:lucius_style="dark"
let g:moria_style="light" " white, light, dark, black
let g:inkpot_black_background=0
set bg=dark
" colors
" light: moria_tayo,moria,papercolor,lunaperche,gruvbox
" dark: gruvbox,habamax,jellybeans,lucius,papercolor,wombat256,xoria256,zenburn256
color jellybeans "zenburn256,lucius,wombat256,moria_tayo,xoria256,jellybeans,gruvbox
"set background=dark
set tabstop=2
set shiftwidth=2
set softtabstop=2
set cindent
"set smartindent "apparently deprecated..
set autoindent
set showmatch "match parentheses
set matchtime=3
set expandtab "change tabs into spaces
set incsearch "searches in realtime as you type
set ruler
set hlsearch
set title "set term title to filename, etc
set textwidth=80
set wrap
set modeline
set ls=2
set number "line numbers
"set mouse=a "enable mouse usage
"
let g:python_recommended_style=0 " Use yapf for formatting
"set paste "paste things without worrying about indenting 'nopaste' to turn off
set pastetoggle=<F2>
set cursorline "highlight line containing the cursor
autocmd WinEnter * set cursorline "only active window shows cursor line
autocmd WinLeave * set nocursorline
set tags=./tags;/
set wildmenu wildmode=longest:full,full
"Status line: configure this better
"set statusline=%.100F
"set foldmethod=indent
"set foldminlines=24
"set foldnestmax=4
"Keyboard Mappings
"=================
command Bgd execute "set bg=dark"
command Bgl execute "set bg=light"
command FC execute "FormatCode"
" the following does not work with a range..
command FL execute "FormatLines"
"use CTRL-N to remove highlighted search terms
nmap <silent> <C-N> :silent noh<CR>h
"CTRL-[J|K|H|L] to move between windows
nnoremap <silent> <C-J> <C-W>j
nnoremap <silent> <C-K> <C-W>k
nnoremap <silent> <C-H> <C-W>h
nnoremap <silent> <C-L> <C-W>l
"JK or KJ can be used to exit insert mode
inoremap jk <esc>
inoremap kj <esc>
"CTRL-P: open file under cursor in new split window
nnoremap <C-P> <C-W>f
"CTRL-A is useful for tmux. I never use the number increment.
nnoremap <C-a> <Nop>
" filetype on
augroup filetype_settings
autocmd FileType cc,c,cpp,h,cu set smartindent "cindent
autocmd FileType make set noexpandtab "use hard tabs in Makefiles
autocmd FileType perl hi Comment ctermfg=Blue
autocmd FileType tex map <silent> <C-V> :s/^/%/<CR><C-N><CR>
autocmd Filetype stata set ft=sh
autocmd FileType typescript set filetype=javascript
" set wfh (make window height static), wfw (window width static)
"autocmd FileType tex :map <silent> <C-?> :s/^/%/<CR><C-N><CR>
augroup END
" Exit insert mode
inoremap jk <esc>
inoremap kj <esc>
":set cinoptions=(0,1N,g2,h2,:2,=2
" automatically change working dir to that of current file
if exists('+autochdir')
set autochdir
else
autocmd BufEnter * silent! lcd %:p:h:gs/ /\\ /
endif
let g:netrw_liststyle=3 "use hierarchical listing in netrw
let g:netrw_browse_split=4 "open new file in preview window
let g:netrw_altv=1 "open new file in vertical split (autochdir focuses there)
:set noea
:set nosplitright
"set spell "turn on spell-checking
"Gvim options
if has("gui_running")
":set guifont=Monospace\ 10
":set guifont=Noto\ Mono\ 12
if has('mac')
:set guifont=Menlo\ Regular:h12
:set guioptions+=k "Keep window size when resizing
elseif has('unix')
:set guifont=Ubuntu\ Mono\ 12
endif
set lines=50 columns=120
:set guioptions-=m "remove menubar (File, Edit, etc)
:set guioptions-=T "remove toolbar
:set guioptions-=r "remove right-hand scrollbar
:set guioptions-=L "remove left-hand scrollbar
endif
set vb t_vb= "turn off all audible bells etc
fun! TrimWhitespace()
let l:save = winsaveview()
keeppatterns %s/\s\+$//e
call winrestview(l:save)
endfun
command! TrimWhitespace call TrimWhitespace()