summaryrefslogtreecommitdiff
path: root/nvim/init.vim
blob: 213099f2eee52e2e95e2a7a44f00c697e80bc646 (plain)
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

set noswapfile

" NERDTree #################################################################

let NERDTreeMouseMode=3
let NERDTreeMinimalUI=1
let NERDTreeAutoDeleteBuffer=1
let NERDTreeHighlightCursorline=1
let NERDTreeShowHidden=1
let g:NERDTreeIndicatorMapCustom = {
    \ "Modified"  : "Δ",
    \ "Staged"    : "✚",
    \ "Untracked" : "✭",
    \ "Renamed"   : "➜",
    \ "Unmerged"  : "☢",
    \ "Deleted"   : "-",
    \ "Dirty"     : "Δ",
    \ "Clean"     : "",
    \ "Unknown"   : ""
    \ }

map <C-n> :NERDTreeToggle<CR>
" always enter term buffer in insert mode
autocmd BufEnter * if &buftype == 'terminal' | :startinsert | endif

" rust.vim ###################################################################

let g:rustfmt_autosave = 1

" Caddyfile ####################################################################

au BufNewFile,BufRead Caddyfile,*.Caddyfile,Caddyfile.* set ft=caddyfile

" mine #####################################################################

"Makes current line/column highlighted, and set text width
set tw=80
set colorcolumn=+1
hi ColorColumn ctermfg=none ctermbg=grey cterm=none

"Buffers scroll a bit so cursor doens't go all the way to the bottom before
"scroll begins
set scrolloff=3

"Makes all .swp files go to /tmp instead of . CAUSE FUCK DA POLICE
set backupdir=/tmp
set directory=/tmp

"Better indenting
set autoindent
set expandtab
set tabstop=4
set shiftwidth=4

"Show eol and tabs
set list
set listchars=trail:░,tab:►\ ,extends:>,precedes:<

"Don't highlight search matches, don't jump while mid-search
set noincsearch
set nohlsearch

"We want certain types to only have 2 space for tabs
au FileType clojure    setlocal tabstop=2 shiftwidth=2
au FileType ruby       setlocal tabstop=2 shiftwidth=2
au FileType yaml       setlocal tabstop=2 shiftwidth=2
au FileType html       setlocal tabstop=2 shiftwidth=2
au FileType proto      setlocal tabstop=2 shiftwidth=2
au FileType javascript setlocal tabstop=2 shiftwidth=2
au FileType typescript setlocal tabstop=2 shiftwidth=2

"We want certain types to use tabs instead of spaces
au FileType go        setlocal nolist noexpandtab
au FileType make      setlocal nolist noexpandtab
au FileType caddyfile setlocal nolist noexpandtab

"Gemtext gets its own text wrapping behavior
"https://stackoverflow.com/questions/36950231/auto-wrap-lines-in-vim-without-inserting-newlines
au FileType gemtext setlocal number
au FileType gemtext setlocal tw=0
au FileType gemtext setlocal wrapmargin=0
au FileType gemtext setlocal wrap
au FileType gemtext setlocal linebreak
"au FileType gemtext setlocal columns=80
"https://stackoverflow.com/questions/20975928/moving-the-cursor-through-long-soft-wrapped-lines-in-vim
au FileType gemtext nnoremap <expr> j v:count ? 'j' : 'gj'
au FileType gemtext nnoremap <expr> k v:count ? 'k' : 'gk'

"terminal shortcuts
tnoremap <leader><leader> \
tnoremap <leader> <C-\><C-n>
"tab shortcuts for terminal mode have terminal escape code preceding them
tnoremap <leader>tn <C-\><C-n>:tabe term://zsh<CR>
tnoremap <leader>tN <C-\><C-n>:tabe<CR>
tnoremap <leader>ts <C-\><C-n>:vs term://zsh<CR>
tnoremap <leader>tS <C-\><C-n>:vnew<CR>
tnoremap <leader>ti <C-\><C-n>:sp term://zsh<CR>
tnoremap <leader>tI <C-\><C-n>:new<CR>
tnoremap <leader>th <C-\><C-n>gT
tnoremap <leader>tH <C-\><C-n>:-tabmove<CR>
tnoremap <leader>tl <C-\><C-n>gt
tnoremap <leader>tL <C-\><C-n>:+tabmove<CR>
tnoremap <leader>tx <C-\><C-n>:tabclose<CR>

"tab shortcuts
noremap <leader>tn :tabe term://zsh<CR>
noremap <leader>tN :tabe<CR>
noremap <leader>ts :vs term://zsh<CR>
noremap <leader>tS :vnew<CR>
noremap <leader>ti :sp term://zsh<CR>
noremap <leader>tI :new<CR>
noremap <leader>th gT
noremap <leader>tH :-tabmove<CR>
noremap <leader>tl gt
noremap <leader>tL :+tabmove<CR>
noremap <leader>tx :tabclose<CR>

" yank/paste into/from clipboard
set clipboard+=unnamedplus

" Enable mouse in all modes
set mouse=

"Clojure specific mappings
" Eval outerform
au FileType clojure nmap <buffer> cpP :Eval<cr>
" Eval full page
au FileType clojure nmap <buffer> cpR :%Eval<cr>

" Disable Ex mode!
nnoremap Q <Nop>