diff options
author | Hsieh Chin Fan <pham@topo.tw> | 2024-08-05 18:41:51 +0800 |
---|---|---|
committer | Hsieh Chin Fan <pham@topo.tw> | 2024-08-05 18:41:51 +0800 |
commit | b57c461014f585655d897abf0e0ac982807396b7 (patch) | |
tree | d3b10761cb75d52ff41b0822bc646c9d1c08d935 /vim/init/basic.vim | |
parent | cc96870ff94afba7b0f2dc18f0209611ff7201f7 (diff) |
Update
Diffstat (limited to 'vim/init/basic.vim')
-rw-r--r-- | vim/init/basic.vim | 35 |
1 files changed, 24 insertions, 11 deletions
diff --git a/vim/init/basic.vim b/vim/init/basic.vim index c4dfa61..fd20476 100644 --- a/vim/init/basic.vim +++ b/vim/init/basic.vim | |||
@@ -4,6 +4,17 @@ | |||
4 | " Used for general usecases. No keymap and personal preference | 4 | " Used for general usecases. No keymap and personal preference |
5 | "====================================================================== | 5 | "====================================================================== |
6 | 6 | ||
7 | " Initial for terminal emulator {{{ | ||
8 | augroup Enter | ||
9 | au! | ||
10 | function! SetEmulaterBackground() | ||
11 | redir => output | hi Normal | redir END | ||
12 | let bg_color = matchstr(output, 'guibg=\zs[^\s]\+\ze') | ||
13 | exe "!alacritty msg config 'colors.primary.background=\"\\"..bg_color.."\"'" | ||
14 | endfunc | ||
15 | autocmd VimEnter * call SetEmulaterBackground() | ||
16 | augroup END | ||
17 | "}}} | ||
7 | " For Vimscript {{{ | 18 | " For Vimscript {{{ |
8 | 19 | ||
9 | " Usage: type --- for foldmark | 20 | " Usage: type --- for foldmark |
@@ -27,7 +38,9 @@ augroup tabinfo | |||
27 | endfunc | 38 | endfunc |
28 | function! RemoveBufFromTabs() | 39 | function! RemoveBufFromTabs() |
29 | for tab in gettabinfo() | 40 | for tab in gettabinfo() |
30 | call filter(tab.variables.bufs, "v:val != "..expand('<abuf>')) | 41 | if has_key(t:, 'bufs') |
42 | call filter(tab.variables.bufs, "v:val != "..expand('<abuf>')) | ||
43 | endif | ||
31 | endfor | 44 | endfor |
32 | endfunc | 45 | endfunc |
33 | 46 | ||
@@ -78,7 +91,7 @@ set showtabline=2 | |||
78 | set number relativenumber | 91 | set number relativenumber |
79 | 92 | ||
80 | " Cursor | 93 | " Cursor |
81 | set cursorline | 94 | " set cursorline |
82 | set guicursor=n-v-c-sm:block,i-ci-ve:ver25,r-cr-o:hor20 | 95 | set guicursor=n-v-c-sm:block,i-ci-ve:ver25,r-cr-o:hor20 |
83 | set matchtime=2 | 96 | set matchtime=2 |
84 | 97 | ||
@@ -95,7 +108,7 @@ set errorformat+=[%f:%l]\ ->\ %m,[%f:%l]:%m | |||
95 | set splitright | 108 | set splitright |
96 | 109 | ||
97 | " Set signcolumn | 110 | " Set signcolumn |
98 | set signcolumn=auto:3 | 111 | set signcolumn=yes:3 |
99 | " Custom sign from help page :h sign | 112 | " Custom sign from help page :h sign |
100 | sign define piet text=>> texthl=Search | 113 | sign define piet text=>> texthl=Search |
101 | 114 | ||
@@ -107,7 +120,7 @@ sign define piet text=>> texthl=Search | |||
107 | " Don't wrap line when typing CJK characters | 120 | " Don't wrap line when typing CJK characters |
108 | " Don't add spaces for CJK | 121 | " Don't add spaces for CJK |
109 | " Don't add comment at next line | 122 | " Don't add comment at next line |
110 | autocmd Filetype * set fo+=mB fo-=cro | 123 | autocmd Filetype * set formatoptions+=mB formatoptions-=cro |
111 | 124 | ||
112 | set shiftwidth=2 | 125 | set shiftwidth=2 |
113 | set autoindent smartindent | 126 | set autoindent smartindent |
@@ -140,10 +153,9 @@ set suffixesadd=.md " Enable reference markdown file without | |||
140 | " }}} | 153 | " }}} |
141 | " SEARCH {{{ | 154 | " SEARCH {{{ |
142 | 155 | ||
143 | set ignorecase " Search case without case sensation | 156 | set ignorecase smartcase " Search case without case sensation |
144 | set smartcase | 157 | set hlsearch " Highlight all matched texts |
145 | set hlsearch " Highlight all matched texts | 158 | set incsearch " Show matched strings when typing |
146 | set incsearch " Show matched strings when typing | ||
147 | 159 | ||
148 | " }}} | 160 | " }}} |
149 | " BUFFERS {{{ | 161 | " BUFFERS {{{ |
@@ -209,16 +221,17 @@ set writebackup | |||
209 | " HIGHLIGHT {{{ | 221 | " HIGHLIGHT {{{ |
210 | 222 | ||
211 | syntax enable | 223 | syntax enable |
212 | set conceallevel=1 | 224 | set syntax=filetype |
225 | set conceallevel=2 | ||
213 | 226 | ||
214 | " Defualt highlight for matched parenthesis is so weird in many colorscheme | 227 | " Defualt highlight for matched parenthesis is so weird in many colorscheme |
215 | " Why the background color is lighter than my caret !? | 228 | " Why the background color is lighter than my caret !? |
216 | " highlight MatchParen ctermfg=NONE ctermbg=darkgrey cterm=NONE | 229 | " highlight MatchParen ctermfg=NONE ctermbg=darkgrey cterm=NONE |
217 | highlight LuaParen ctermfg=NONE ctermbg=darkgrey cterm=NONE | 230 | hi LuaParen ctermfg=NONE ctermbg=darkgrey cterm=NONE |
218 | 231 | ||
219 | " Show trailing spaces | 232 | " Show trailing spaces |
220 | highlight ExtraWhitespace ctermbg=red guibg=red | ||
221 | match ExtraWhitespace /\s\+$/ | 233 | match ExtraWhitespace /\s\+$/ |
234 | hi ExtraWhitespace ctermbg=red guibg=red | ||
222 | 235 | ||
223 | " }}} | 236 | " }}} |
224 | " MISC {{{ | 237 | " MISC {{{ |