-
Notifications
You must be signed in to change notification settings - Fork 0
/
vimrc
109 lines (91 loc) · 2.46 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
" globals?
let mapleader=" "
set nocompatible
set t_Co=256
set omnifunc=syntaxcomplete#Complete
syntax enable
filetype plugin indent on
set encoding=utf-8
set path+=**
set backspace=indent,eol,start
set autoread
set visualbell
" tabbing
set ai
set tabstop=8
set softtabstop=0
set shiftwidth=8
set smarttab
set smartindent
autocmd FileType systemverilog,verilog setlocal tabstop=2 shiftwidth=2 softtabstop=2 noexpandtab " hacky fix for verilog files
" organized backup and undo files
set noswapfile
set nobackup
set nowb
" persistent undo
if has('persistent_undo') && isdirectory(expand('~').'/.vim/undos')
silent !mkdir ~/.vim/undos > /dev/null 2>&1
set undodir=~/.vim/undos
set undofile
endif
" colors
set background=dark
hi Normal guibg=NONE ctermbg=NONE
" gutter numbering
set nu
set relativenumber
" Auto-complete when strings are present, otherwise tab
function! CleverTab()
if strpart( getline('.'), 0, col('.')-1 ) =~ '^\s*$'
return "\<Tab>"
else
return "\<C-N>"
endif
endfunction
inoremap <Tab> <C-R>=CleverTab()<CR>
" search
set hlsearch
set incsearch
set ignorecase
set smartcase
" scrolling
set scrolloff=8 "Start scrolling when we're 8 lines away from margins
set sidescrolloff=15
set sidescroll=1
" tabbing in :
set wildmenu
set wildmode=list:longest,full
" completion
set complete+=kspell " dictionary
set completeopt=menuone,longest " behavior of complete menu
set shortmess+=c " don't print status message on completion
" netrw
let g:netrw_banner=0 " disable annoying banner
let g:netrw_browse_split=4 " open in prior window
let g:netrw_altv=1 " open splits to the right
let g:netrw_liststyle=3 " tree view
let g:netrw_list_hide=netrw_gitignore#Hide()
let g:netrw_list_hide.=',\(^\|\s\s\)\zs\.\S\+'
" maps
inoremap kj <Esc>
map ; :
map <leader><leader> :b#<CR>
map <leader>v <c-w>v
map <leader>s <c-w>s
map <leader>h <c-w>h
map <leader>j <c-w>j
map <leader>k <c-w>k
map <leader>l <c-w>l
map <leader>/ :nohlsearch<CR> " clear search highlight
map <leader>p :tabe ~/post.md<CR> " open post-it file
map <leader>$ :s/\s\+$//g<CR> " remove whitespace at the end of lines
map <leader>q :%bd<bar>e#<CR> " delete all buffers except current
map <leader>r :checkt<CR> " reload all buffers
" can use :b<space> to use vim autocompete, also adding a shortcut
nnoremap <silent> <Leader><Enter> :buffer<space>
" source local .vim file
try
source $HOME/.vim/exports.local.vim
catch
" ignore if not found
endtry