-
Notifications
You must be signed in to change notification settings - Fork 0
/
.vimrc
146 lines (116 loc) · 4.91 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
" Initial .vimrc based on recommendations from MIT's missing-semester course.
" Additional inspiration from vim-galore's minimal-vimrc
" Setting `nocompatible` switches from the default Vi-compatibility mode and
" enables useful Vim functionality. This configuration option turns out not to
" be necessary for the file named '~/.vimrc', because Vim automatically enters
" nocompatible mode if that file is present. But I'm including it here just in
" case this config file is loaded some other way (e.g. saved as `foo`, and then
" Vim started with `vim -u foo`).
set nocompatible
" Enable true color and a colorscheme
if exists('+termguicolors')
let &t_8f = "\<Esc>[38;2;%lu;%lu;%lum"
let &t_8b = "\<Esc>[48;2;%lu;%lu;%lum"
set termguicolors
endif
let g:gruvbox_contrast_dark = 'hard'
set background=dark
colorscheme gruvbox
" Background Color Erase fix for kitty terminal emulator
let &t_ut=''
" Show non-printable characters.
set list
if has('multi_byte') && &encoding ==# 'utf-8'
let &listchars = 'tab:▸ ,extends:❯,precedes:❮,nbsp:±'
else
let &listchars = 'tab:> ,extends:>,precedes:<,nbsp:.'
endif
set ttyfast " fast(er) redrawing
set lazyredraw " only redraw when necessary
" Turn on syntax highlighting.
syntax on
filetype plugin indent on " Load plugins according to detected filetype
" Auto-indent
set autoindent " Indent according to previous line
set expandtab " Uses spaces instead of tabs
set softtabstop=4 " Tab key inserts 4 spaces
set shiftwidth=4 " >> indents by 4 spaces
set shiftround " >> indents to next multiple of 'shiftwidth'
" Disable the default Vim startup message.
set shortmess+=I
" Show line numbers.
set number
" This enables relative line numbering mode. With both number and
" relativenumber enabled, the current line shows the true line number, while
" all other lines (above and below) are numbered relative to the current line.
set relativenumber
" Always show the status line at the bottom, even if you only have one window open.
set laststatus=2
" The backspace key has slightly unintuitive behavior by default. For example,
" by default, you can't backspace before the insertion point set with 'i'.
" This configuration makes backspace behave more reasonably, in that you can
" backspace over anything.
set backspace=indent,eol,start
" By default, Vim doesn't let you hide a buffer (i.e. have a buffer that isn't
" shown in any window) that has unsaved changes. This is to prevent you from "
" forgetting about unsaved changes and then quitting e.g. via `:qa!`. We find
" hidden buffers helpful enough to disable this protection. See `:help hidden`
" for more information on this.
set hidden
" This setting makes search case-insensitive when all characters in the string
" being searched are lowercase. However, the search becomes case-sensitive if
" it contains any capital letters. This makes searching more convenient.
set ignorecase
set smartcase
set incsearch " highlights as you search with / or ?
set wrapscan " search wraps around end-of-file
"set hlsearch " keeps matches highlighted
" Unbind some useless/annoying default key bindings.
nmap Q <Nop> " Enters Ex mode. You almost never want this.
" Disable audible bell because it's annoying.
set noerrorbells visualbell t_vb=
" Enable mouse support.
set mouse+=a
" Try to prevent bad habits like using the arrow keys for movement
" Do this in normal mode...
nnoremap <Left> :echoe "Use h"<CR>
nnoremap <Right> :echoe "Use l"<CR>
nnoremap <Up> :echoe "Use k"<CR>
nnoremap <Down> :echoe "Use j"<CR>
" ...and in insert mode
"inoremap <Left> <ESC>:echoe "Use h"<CR>
"inoremap <Right> <ESC>:echoe "Use l"<CR>
"inoremap <Up> <ESC>:echoe "Use k"<CR>
"inoremap <Down> <ESC>:echoe "Use j"<CR>
""" My customizations """
"" Plugins ""
" vim-plug
call plug#begin()
" The default plugin directory will be:
" - vim: '~/.vim/plugged'
" - neovim: stdpath('data') . '/plugged'
" This can be customized by passing it as an argument:
" - e.g. 'call plug#begin('~/.vim/path/to/plugins')
" - avoid using standard vim directory names like 'plugin'
" Make sure to use single quotes to specify plugins!
" fish shell script highlighting and completion
Plug 'nickeb96/fish.vim'
" NERDTree file system explorer
Plug 'preservim/nerdtree'
" Tim Pope plugins
Plug 'tpope/vim-fugitive' " git plugin
Plug 'tpope/vim-surround'
" this call also executes `filetype plugin indent on` and `syntax on`
call plug#end()
" FZF Vim integration
"set rtp+=/usr/bin/fzf
" powerline/airline functionality
set rtp+=/usr/share/powerline/bindings/vim
python3 from powerline.vim import setup as powerline_setup
python3 powerline_setup()
python3 del powerline_setup
"let g:airline_powerline_fonts = 1
"let g:airline_theme='gruvbox'
" NERDTree functionality
" Exit Vim if NERDTree is the only window remaining in the only tab.
autocmd BufEnter * if tabpagenr('$') == 1 && winnr('$') == 1 && exists('b:NERDTree') && b:NERDTree.isTabTree() | quit | endif