-
Notifications
You must be signed in to change notification settings - Fork 1
/
base.vim
134 lines (105 loc) · 2.22 KB
/
base.vim
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
"
" NATIVE CONFIG
"
"mappings
let mapleader = ' '
inoremap jk <Esc>
"quit
nmap <silent> <C-p> :q<CR>
nmap <silent> <C-m> :update<CR>
"jump back to and forth
noremap <leader>o <C-o>zz
noremap <leader>i <C-i>zz
"trailing
"noremap <C-c> <S-j>
"buffer TODO find new ones
"nmap <C-n> :bnext<CR>
"nmap <C-p> :bprevious<CR>
"nmap <C-y> :bdelete<CR>
"save
set autowrite
set autowriteall
"save undo / redo across sessions
set undofile
set undodir=~/.vim/undo
"splits
function! WinMove(key)
let t:curwin = winnr()
exec "wincmd ".a:key
if (t:curwin == winnr())
if (match(a:key,'[jk]'))
wincmd v
else
wincmd s
endif
exec "wincmd ".a:key
endif
endfunction
noremap <silent> <C-h> :call WinMove('h')<CR>
noremap <silent> <C-j> :call WinMove('j')<CR>
noremap <silent> <C-k> :call WinMove('k')<CR>
noremap <silent> <C-l> :call WinMove('l')<CR>
"terminal
tnoremap jk <C-\><C-n>
tnoremap <C-u> <C-\><C-n>:q<CR>
"signcolumn
set timeoutlen=300
set signcolumn=yes
"true colors
set termguicolors
let $NVIM_TUI_ENABLE_TRUE_COLOR=1
"vim update delay in ms
set updatetime=250
"useful for resizing panes
set mouse=a
"syntax
syntax enable
"is not useful in screenshare
"use :set number to disable
set number relativenumber
set autoread
set encoding=UTF-8
"set foldmethod=syntax
"uses system clipboard
set clipboard=unnamedplus
"disable pre rendering of some things like ```
set conceallevel=0
"toggle invisible characters
set list
set listchars=tab:→\ ,eol:¬,trail:~,extends:❯,precedes:❮,space:␣
"set listchars=eol:¬,trail:~,extends:❯,precedes:❮
set showbreak=↪
"default for vim sleuth
set expandtab
set tabstop=2
set shiftwidth=2
"split
set splitbelow
set splitright
"in house fuzzy finder
set path+=**
set wildmenu
"searching
set ignorecase
set smartcase
set hlsearch
nmap <Esc> <cmd>nohlsearch<cr>
set cursorline
set laststatus=2
set scrolloff=8
set startofline
"autosave files
augroup save_when_leave
au BufLeave * silent! wall
augroup END
set hidden
set nobackup
set nowritebackup
set noswapfile
set noshowmode "already in status line
"automatically source .vimrc from project folder
set exrc
set secure
"filetypes
au BufRead,BufNewFile *.nix set filetype=nix
au BufRead,BufNewFile *.libsonnet set filetype=jsonnet