Skip to content

Commit 64123e3

Browse files
committed
initial commit
0 parents  commit 64123e3

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

57 files changed

+1834
-0
lines changed

.backup/.gitkeep

Whitespace-only changes.

.gitignore

+28
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
### Vim ###
2+
# Swap
3+
[._]*.s[a-v][a-z]
4+
[._]*.sw[a-p]
5+
[._]s[a-rt-v][a-z]
6+
[._]ss[a-gi-z]
7+
[._]sw[a-p]
8+
9+
# Session
10+
Session.vim
11+
12+
# Temporary
13+
.netrwhist
14+
*~
15+
# Auto-generated tag files
16+
tags
17+
# Persistent undo
18+
[._]*.un~
19+
20+
autoload/
21+
plugged/
22+
plug_plugins/custom/
23+
.backup/
24+
.tmp/
25+
.undo/
26+
27+
config/_local.vim
28+
clang_complete.vmb

.tmp/.gitkeep

Whitespace-only changes.

.undo/.gitkeep

Whitespace-only changes.

LICENSE

+25
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
BSD 2-Clause License
2+
3+
Copyright (c) 2019 Kai-Ming Guo
4+
All rights reserved.
5+
6+
Redistribution and use in source and binary forms, with or without
7+
modification, are permitted provided that the following conditions are met:
8+
9+
* Redistributions of source code must retain the above copyright notice, this
10+
list of conditions and the following disclaimer.
11+
12+
* Redistributions in binary form must reproduce the above copyright notice,
13+
this list of conditions and the following disclaimer in the documentation
14+
and/or other materials provided with the distribution.
15+
16+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
17+
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
18+
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19+
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
20+
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
21+
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
22+
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
23+
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
24+
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
25+
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

README.md

+263
Large diffs are not rendered by default.

autoload/.gitkeep

Whitespace-only changes.

bootstrap.vim

+27
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
" Copyright (c) 2019 Kai-Ming Guo. All rights reserved.
2+
" Use of this source code is governed by a BSD-style license that can be
3+
" found in the LICENSE file.
4+
5+
6+
let g:vimdir = '~/.vim'
7+
let s:plug_file = g:vimdir . '/autoload/plug.vim'
8+
9+
if empty(glob(s:plug_file))
10+
let s:git_url = 'https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim'
11+
silent exec '!curl -fLo ' . s:plug_file . ' --create-dirs ' . s:git_url
12+
unlet s:git_url
13+
endif
14+
unlet s:plug_file
15+
16+
exec 'source ' . g:vimdir . '/config/plugin.vim'
17+
exec 'source ' . g:vimdir . '/config/basic.vim'
18+
exec 'source ' . g:vimdir . '/config/mapping.vim'
19+
exec 'source ' . g:vimdir . '/config/command.vim'
20+
exec 'source ' . g:vimdir . '/config/function.vim'
21+
exec 'source ' . g:vimdir . '/config/platform.vim'
22+
exec 'source ' . g:vimdir . '/config/autocmd.vim'
23+
exec 'source ' . g:vimdir . '/config/plugin_config.vim'
24+
25+
if filereadable(expand(g:vimdir . '/config/_local.vim'))
26+
exec 'source ' . g:vimdir . '/config/_local.vim'
27+
endif

config/autocmd.vim

+34
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
" Copyright (c) 2019 Kai-Ming Guo. All rights reserved.
2+
" Use of this source code is governed by a BSD-style license that can be
3+
" found in the LICENSE file.
4+
5+
6+
if has('autocmd')
7+
augroup auto_custom_settings
8+
" Clear the auto command group so we don't define it multiple times idea
9+
" from: http://learnvimscriptthehardway.stevelosh.com/chapters/14.html
10+
autocmd!
11+
12+
" When editing a file, always jump to the last current position
13+
" This must be after the uncompress command
14+
autocmd BufReadPost * if line("'\"") > 1 && line("'\"") <= line('$') |
15+
\ exe "normal! g'\"" | endif
16+
17+
" Resize splits when the window is resized
18+
" From: https://bitbuck.org/sjl/dotfiles/src/tip/vim/vimrc
19+
autocmd VimResized * :wincmd =
20+
21+
" Disable visualbell
22+
autocmd GUIEnter * set visualbell t_vb=
23+
24+
" The PC is fast enough, do syntax highlight syncing from start unless
25+
" 200 lines
26+
autocmd BufEnter * :syntax sync maxlines=200
27+
augroup END
28+
29+
augroup vimrc_make_settings
30+
autocmd!
31+
autocmd FileType make setlocal noexpandtab
32+
autocmd BufNewFile,BufRead CMakeLists.txt setlocal filetype=cmake
33+
augroup END
34+
endif

config/basic.vim

+206
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,206 @@
1+
" Copyright (c) 2019 Kai-Ming Guo. All rights reserved.
2+
" Use of this source code is governed by a BSD-style license that can be
3+
" found in the LICENSE file.
4+
5+
6+
"
7+
" ---------------------------------------------------------------------------
8+
" _. General {{{
9+
10+
" Sets how many lines of history Vim has to remember
11+
set history=500
12+
13+
" Set 'nocompatible' to ward off unexpected things that your distro might
14+
" have made, as well as sanely reset options when re-sourcing .vimrc
15+
if has('vim_starting')
16+
" Set compatibility to Vim only
17+
if &compatible | set nocompatible | endif
18+
endif
19+
20+
" Attempt to determine the type of a file based on its name and possibly its
21+
" contents. Use this to allow intelligent auto-indenting for each filetype,
22+
" and for plugins that are filetype specific
23+
filetype indent plugin on
24+
25+
" Set to auto read when a file is change from the outside
26+
set autoread
27+
28+
" }}}
29+
30+
" ---------------------------------------------------------------------------
31+
" _. Vim User Interface {{{
32+
33+
" Set 7 lines to the cursor - when moving vertically using j/k
34+
set so=7
35+
36+
" Avoid garbled characters in Chinese language windows OS
37+
set langmenu=en
38+
exec 'source ' . $VIMRUNTIME . '/delmenu.vim'
39+
exec 'source ' . $VIMRUNTIME . '/menu.vim'
40+
41+
" Better command-line completion
42+
set wildmenu
43+
44+
" Ignore compiled files
45+
set wildignore+=*.o,*.obj,*.exe,*.so,*.dll,*.pyc,.svn,.hg,.bzr,.git,
46+
\.sass-cache,*.class,*.scssc,*.cssc,sprockets%*,*.lessc,*/node_modules/*,
47+
\rake-pipeline-*
48+
49+
" Display the cursor position on the last line of the screen or in the status
50+
" line of a window
51+
set ruler
52+
53+
" Display line numbers on the left
54+
set number
55+
56+
" Always display the status line, even if only one window is displayed
57+
set laststatus=2
58+
59+
" A buffer becomes hidden when it is abandoned
60+
set hidden
61+
62+
" Configure backspace so it acts as it should act
63+
set backspace=eol,start,indent
64+
set whichwrap+=<,>,h,l
65+
66+
" Use case insensitive search, except when using capital letters
67+
set ignorecase
68+
set smartcase
69+
70+
" Highlight search results
71+
set hlsearch
72+
73+
" Vim loves to redraw the screen during things it probably doesn't need
74+
" to--like in the middle of macros. This tells Vim not to bother redrawing
75+
" during these scenarios, leading to faster macros
76+
set lazyredraw
77+
78+
" For regular expressions turn magic on
79+
set magic
80+
81+
" With `showmatch`, when your cursor moves over a parenthesis-like
82+
" character, the matching one will be highlighted as well
83+
set showmatch
84+
85+
" How many tenths of a second to blink when matching brackets
86+
set mat=5
87+
88+
" No annoying sound on errors
89+
set noerrorbells visualbell t_vb=
90+
91+
" Color the 80th column differently as a wrapping guide
92+
if exists('+colorcolumn')
93+
set colorcolumn=80
94+
endif
95+
96+
" Quickly time out on keycodes, but never time out on mappings
97+
set notimeout ttimeout ttimeoutlen=200
98+
99+
" }}}
100+
101+
" ---------------------------------------------------------------------------
102+
" _. Colors and Fonts {{{
103+
104+
" Enable syntax highlighting
105+
if has('syntax') && !exists('g:syntax_on')
106+
syntax enable
107+
endif
108+
109+
" Force 256 color mode if available
110+
if $TERM =~ '-256color'
111+
set t_Co=256
112+
set t_ut=
113+
endif
114+
115+
" Set utf8 as standard encoding and en_US as the standard language
116+
set encoding=utf8
117+
118+
" Use Unix as the standard file type
119+
set fileformats=unix,dos,mac
120+
121+
" Display different types of white spaces.
122+
set list
123+
set listchars=tab:›\ ,trail:•,extends:#,nbsp:.
124+
125+
" }}}
126+
127+
" ---------------------------------------------------------------------------
128+
" _. Files and Backups {{{
129+
130+
" Double // causes backups to use full file path
131+
exec 'set backupdir=' . g:vimdir . '/.backup//'
132+
exec 'set directory=' . g:vimdir . '/.tmp//'
133+
134+
" Turn on backups
135+
set backup
136+
137+
" }}}
138+
139+
" ---------------------------------------------------------------------------
140+
" _. Text, Tab and Indent Related {{{
141+
142+
" Yanks go on clipboard instead
143+
if has('clipboard')
144+
if has('unnamedplus')
145+
" When possible use + register for copy-paste
146+
set clipboard=unnamed,unnamedplus
147+
else
148+
" On macOS and Windows, use * register for copy-paste
149+
set clipboard=unnamed
150+
endif
151+
endif
152+
153+
" Linebreak on 500 characters
154+
set linebreak
155+
set textwidth=500
156+
157+
" Use multiple of shiftwidth when indenting with '<' and '>'
158+
set shiftround
159+
160+
" Auto-indent spaces with C in Vim
161+
set autoindent
162+
set cindent
163+
164+
" }}}
165+
166+
" ---------------------------------------------------------------------------
167+
" _. Moving Around, Tabs and Buffers {{{
168+
169+
" Specify the behavior when switching between buffers
170+
try
171+
set switchbuf=useopen,usetab,newtab
172+
set stal=2
173+
catch
174+
endtry
175+
176+
" }}}
177+
178+
" ---------------------------------------------------------------------------
179+
" _. Status Line {{{
180+
181+
" Set the command window height to 2 lines, to avoid many cases of having to
182+
" `press <Enter> to continue`
183+
set cmdheight=2
184+
185+
" Default status line format
186+
set statusline=%<%f\ %h%m%r\ %y%=%{v:register}\ %-14.(%l,%c%V%)\ %P
187+
188+
" }}}
189+
190+
" ---------------------------------------------------------------------------
191+
" _. Status Line {{{
192+
193+
" Enable mouse
194+
set mouse=a
195+
if has('neovim')
196+
if has('mouse_sgr')
197+
set ttymouse=sgr
198+
else
199+
set ttymouse=xterm2
200+
endif
201+
endif
202+
203+
" Hide when characters are typed
204+
set mousehide
205+
206+
" }}}

config/command.vim

+23
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
" Copyright (c) 2019 Kai-Ming Guo. All rights reserved.
2+
" Use of this source code is governed by a BSD-style license that can be
3+
" found in the LICENSE file.
4+
5+
6+
" Silently execute an external command
7+
" No 'Press Any Key to Contiue BS'
8+
" From: http://vim.wikia.com/wiki/Avoiding_the_%22Hit_ENTER_to_continue%22_prompts
9+
command! -nargs=1 SilentCmd
10+
\ | execute ':silent !' . <q-args>
11+
\ | execute ':redraw!'
12+
13+
" No one is really happy until you have this shortcuts
14+
cnoreabbrev W! w!
15+
cnoreabbrev Q! q!
16+
cnoreabbrev Qall! qall!
17+
cnoreabbrev Wq wq
18+
cnoreabbrev Wa wa
19+
cnoreabbrev wQ wq
20+
cnoreabbrev wQ wq
21+
cnoreabbrev W w
22+
cnoreabbrev Q q
23+
cnoreabbrev Qall qall

0 commit comments

Comments
 (0)