aboutsummaryrefslogtreecommitdiffhomepage
path: root/vim/init/basic.vim
diff options
context:
space:
mode:
Diffstat (limited to 'vim/init/basic.vim')
-rw-r--r--vim/init/basic.vim35
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 {{{
8augroup 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()
16augroup 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
78set number relativenumber 91set number relativenumber
79 92
80" Cursor 93" Cursor
81set cursorline 94" set cursorline
82set guicursor=n-v-c-sm:block,i-ci-ve:ver25,r-cr-o:hor20 95set guicursor=n-v-c-sm:block,i-ci-ve:ver25,r-cr-o:hor20
83set matchtime=2 96set matchtime=2
84 97
@@ -95,7 +108,7 @@ set errorformat+=[%f:%l]\ ->\ %m,[%f:%l]:%m
95set splitright 108set splitright
96 109
97" Set signcolumn 110" Set signcolumn
98set signcolumn=auto:3 111set signcolumn=yes:3
99" Custom sign from help page :h sign 112" Custom sign from help page :h sign
100sign define piet text=>> texthl=Search 113sign 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
110autocmd Filetype * set fo+=mB fo-=cro 123autocmd Filetype * set formatoptions+=mB formatoptions-=cro
111 124
112set shiftwidth=2 125set shiftwidth=2
113set autoindent smartindent 126set autoindent smartindent
@@ -140,10 +153,9 @@ set suffixesadd=.md " Enable reference markdown file without
140" }}} 153" }}}
141" SEARCH {{{ 154" SEARCH {{{
142 155
143set ignorecase " Search case without case sensation 156set ignorecase smartcase " Search case without case sensation
144set smartcase 157set hlsearch " Highlight all matched texts
145set hlsearch " Highlight all matched texts 158set incsearch " Show matched strings when typing
146set 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
211syntax enable 223syntax enable
212set conceallevel=1 224set syntax=filetype
225set 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
217highlight LuaParen ctermfg=NONE ctermbg=darkgrey cterm=NONE 230hi LuaParen ctermfg=NONE ctermbg=darkgrey cterm=NONE
218 231
219" Show trailing spaces 232" Show trailing spaces
220highlight ExtraWhitespace ctermbg=red guibg=red
221match ExtraWhitespace /\s\+$/ 233match ExtraWhitespace /\s\+$/
234hi ExtraWhitespace ctermbg=red guibg=red
222 235
223" }}} 236" }}}
224" MISC {{{ 237" MISC {{{