blob: 768cff3297914af93f8c68cb858f747e77ace4e1 (
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
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
|
" Heh
filetype plugin indent on
syntax on
set runtimepath+=~/.config/vim,~/.config/vim/after
set viminfo+=n~/.config/vim/viminfo
" Plugins
" s;https://github.com/\(.*\);Plug '\1';
call plug#begin('~/.config/vim/plugged')
Plug 'LordTlasT/live-server'
Plug 'airblade/vim-gitgutter'
Plug 'arcticicestudio/nord-vim'
Plug 'godlygeek/tabular'
Plug 'junegunn/fzf', { 'do': { -> fzf#install() } }
Plug 'junegunn/fzf.vim'
Plug 'michaeljsmith/vim-indent-object'
Plug 'tpope/vim-capslock'
Plug 'tpope/vim-commentary'
Plug 'tpope/vim-endwise'
Plug 'tpope/vim-fugitive'
Plug 'tpope/vim-repeat'
Plug 'tpope/vim-surround'
Plug 'tpope/vim-vinegar'
Plug 'yuezk/vim-js'
Plug 'theRealCarneiro/hyprland-vim-syntax'
call plug#end()
set termguicolors " amazing!
set signcolumn=yes " GitGutter
set updatetime=100
set tabstop=4 shiftwidth=4 " Turn tab to spaces
set backspace=2 backspace=indent,eol,start " Turn backspaces into tabspaces
set incsearch " Incremental search
set clipboard=unnamed " Use system primary clipboard
set number " Set (absolute) line numbers
set relativenumber " make them hybrid
set showmatch " Show matching bracket
set showcmd " Show partial command in status line
set laststatus=2 " show more status/file info
set cursorline " Highlight line at cursor
set ruler " Show cursor and progress in file
set wildmenu " Show command options (autocomplete)
set mouse= "nomouse
set encoding=utf-8 " Set encoding
set history=200 " Keep a lot more command history
""""""""""""COLORSCHEME"""""""""""""""""""""""
colo nord
hi! Normal ctermbg=NONE guibg=NONE
hi! NonText ctermbg=NONE guibg=NONE
"""""""""""""""""""""""""""""""""""""""""""""
let &t_SI = "\e[6 q" " Insert cursor
let &t_EI = "\e[2 q" " Normal cursor
let ghregex='\(^\|\s\s\)\zs\.\S\+' " Start netrw with dotfiles hidden
let g:netrw_list_hide=ghregex
""""""""""""""""""" FUNCTIONS AND COMMANDS
" autocomment z80
autocmd FileType z80 setlocal commentstring=;\ %s
" Return to last edit position
autocmd BufReadPost *
\ if line("'\"") > 1 && line("'\"") <= line("$") |
\ exe "normal! g`\"" |
\ endif
" Absolute numbers if window isn't focused
augroup numbertoggle
autocmd!
autocmd BufEnter,FocusGained,WinEnter * if &nu | set rnu | endif
autocmd BufLeave,FocusLost,WinLeave * if &nu | set nornu | endif
augroup END
" Toggle status bar
let s:hidden_all = 0
function! ToggleHiddenAll()
if s:hidden_all == 0
let s:hidden_all = 1
set noshowmode noruler nonu nornu laststatus=0 noshowcmd signcolumn=no
else
let s:hidden_all = 0
set showmode ruler nu rnu laststatus=2 showcmd signcolumn=yes
endif
endfunction
""""""""""""""""""""" MAPPINGS """"""""""""""""""""""""
let mapleader = ' '
" Windows
noremap <A-h> <C-W>h
noremap <A-j> <C-W>j
noremap <A-k> <C-W>k
noremap <A-l> <C-W>l
noremap <A-o> <C-W>o
nnoremap <C-H> :call ToggleHiddenAll()<CR>
" Closing brackets and quotes
inoremap " ""<left>
inoremap ' ''<left>
inoremap ` ``<left>
inoremap ( ()<left>
inoremap [ []<left>
inoremap { {}<left>
" goto buffer
nnoremap gb :buffers<CR>:buffer<Space>
let mapleader = " "
let maplocalleader = "\\"
" -- vinegar is already doing this
nnoremap - <cmd>Ex<cr>
" moving
inoremap <C-a> <C-o>I
inoremap <C-e> <C-o>A
inoremap <C-k> <C-o>D
inoremap (<cr> (<cr>)<C-o>O
inoremap (;<cr> (<cr>);<C-o>O
inoremap {<cr> {<cr>}<C-o>O
inoremap {;<cr> {<cr>};<C-o>O
" buffers
nnoremap gb <cmd>buffers<cr>:buffer<Space>
nnoremap <Leader>q <cmd>q!<cr>
nnoremap <Leader>Q <cmd>qa!<cr>
" Windows
nnoremap <A-h> <C-W>h
nnoremap <A-j> <C-W>j
nnoremap <A-k> <C-W>k
nnoremap <A-l> <C-W>l
nnoremap <A-o> <C-W>o
" command line
cnoremap <M-b> <C-Left>
cnoremap <M-f> <C-Right>
cnoremap <M-d> <C-Right><C-w>
" clipboard
nnoremap <Leader>y \
" templates
nnoremap <LocalLeader>rt :-1r
" utils
inoremap <LocalLeader>r <cmd>r!echo -n $RANDOM<cr><esc>kJA
" ordered list
nnoremap <LocalLeader>n <C-v>I0. <esc>gvg<C-a>
vnoremap <Leader>u <cmd>'<,'>s/^[0-9]\\+\\. //<cr><esc>
" scripts
nnoremap <Leader>x <cmd>!chmod +x %<cr>
" replace
nnoremap <Leader>sf [[:%s/\<<C-r><C-w>\>/<C-r><C-w><C-w>/gI<Left><Left><Left>]]
nnoremap <Leader>sl [[:s/\<<C-r><C-w>\>/<C-r><C-w><C-w>/gI<Left><Left><Left>]]
" write
nnoremap <LocalLeader>w <cmd>write<cr>
nnoremap <LocalLeader>W <cmd>write!<cr>
nnoremap <LocalLeader>e <cmd>edit<cr>
" Packer
nnoremap <Leader>P <cmd>PackerSync<cr>
" spelling
nnoremap <Leader><C-s> <cmd>setlocal spell!<cr>
|