.
This commit is contained in:
@@ -1,5 +1,3 @@
|
|||||||
" Modeline and Notes {
|
|
||||||
" Environment {
|
|
||||||
" get current neovim version
|
" get current neovim version
|
||||||
let g:vim_version = -1
|
let g:vim_version = -1
|
||||||
|
|
||||||
@@ -34,22 +32,19 @@
|
|||||||
let mapleader = ','
|
let mapleader = ','
|
||||||
let maplocalleader = '_'
|
let maplocalleader = '_'
|
||||||
|
|
||||||
" }
|
|
||||||
|
|
||||||
" General {
|
" General {
|
||||||
|
|
||||||
noremap <leader>h :noh<CR> " turn off highlight
|
noremap <leader>h :noh<CR> " turn off highlight
|
||||||
|
|
||||||
filetype plugin indent on " Automatically detect file types.
|
filetype plugin indent on " Automatically detect file types.
|
||||||
syntax on " Syntax highlighting
|
syntax on " Syntax highlighting
|
||||||
"set mouse=a " Automatically enable mouse usage
|
set mouse=a " Automatically enable mouse usage
|
||||||
set mousehide " Hide the mouse cursor while typing
|
set mousehide " Hide the mouse cursor while typing
|
||||||
scriptencoding utf-8
|
" scriptencoding utf-8
|
||||||
|
|
||||||
|
|
||||||
" Most prefer to automatically switch to the current file directory when
|
" Most prefer to automatically switch to the current file directory when
|
||||||
" a new buffer is opened;
|
" a new buffer is opened;
|
||||||
autocmd BufEnter * if bufname("") !~ "^\[A-Za-z0-9\]*://" | lcd %:p:h | endif
|
" autocmd BufEnter * if bufname("") !~ "^\[A-Za-z0-9\]*://" | lcd %:p:h | endif
|
||||||
" Always switch to the current file directory
|
" Always switch to the current file directory
|
||||||
|
|
||||||
set shortmess+=filmnrxoOtT " Abbrev. of messages (avoids 'hit enter')
|
set shortmess+=filmnrxoOtT " Abbrev. of messages (avoids 'hit enter')
|
||||||
@@ -104,15 +99,10 @@
|
|||||||
|
|
||||||
set cmdheight=1 " get rid of the extra useless line at the bottom(if not working, probably a plugin is changing the value)
|
set cmdheight=1 " get rid of the extra useless line at the bottom(if not working, probably a plugin is changing the value)
|
||||||
|
|
||||||
"highlight clear SignColumn " SignColumn should match background
|
|
||||||
"highlight clear LineNr " Current line number row will have same background color in relative mode
|
|
||||||
"highlight clear CursorLineNr " Remove highlight color from current line number
|
|
||||||
|
|
||||||
if has('cmdline_info')
|
if has('cmdline_info')
|
||||||
set ruler " Show the ruler
|
set ruler " Show the ruler
|
||||||
set rulerformat=%30(%=\:b%n%y%m%r%w\ %l,%c%V\ %P%) " A ruler on steroids
|
set rulerformat=%30(%=\:b%n%y%m%r%w\ %l,%c%V\ %P%) " A ruler on steroids
|
||||||
set showcmd " Show partial commands in status line and
|
set showcmd " Show partial commands in status line and
|
||||||
|
|
||||||
endif
|
endif
|
||||||
|
|
||||||
set backspace=indent,eol,start " Backspace for dummies
|
set backspace=indent,eol,start " Backspace for dummies
|
||||||
@@ -136,7 +126,6 @@
|
|||||||
|
|
||||||
" Formatting {
|
" Formatting {
|
||||||
|
|
||||||
"set nowrap " Do not wrap long lines
|
|
||||||
set autoindent " Indent at the same level of the previous line
|
set autoindent " Indent at the same level of the previous line
|
||||||
set expandtab " Tabs are spaces, not tabs
|
set expandtab " Tabs are spaces, not tabs
|
||||||
set shiftwidth=4 " Use indents of 4 spaces
|
set shiftwidth=4 " Use indents of 4 spaces
|
||||||
@@ -173,33 +162,16 @@
|
|||||||
noremap j gj
|
noremap j gj
|
||||||
noremap k gk
|
noremap k gk
|
||||||
|
|
||||||
" Stupid shift key fixes
|
|
||||||
" if !exists('g:spf13_no_keyfixes')
|
|
||||||
" if has("user_commands")
|
|
||||||
" command! -bang -nargs=* -complete=file E e<bang> <args>
|
|
||||||
" command! -bang -nargs=* -complete=file W w<bang> <args>
|
|
||||||
" command! -bang -nargs=* -complete=file Wq wq<bang> <args>
|
|
||||||
" command! -bang -nargs=* -complete=file WQ wq<bang> <args>
|
|
||||||
" command! -bang Wa wa<bang>
|
|
||||||
" command! -bang WA wa<bang>
|
|
||||||
" command! -bang Q q<bang>
|
|
||||||
" command! -bang QA qa<bang>
|
|
||||||
" command! -bang Qa qa<bang>
|
|
||||||
" endif
|
|
||||||
|
|
||||||
" cmap Tabe tabe
|
|
||||||
" endif
|
|
||||||
|
|
||||||
" Yank from the cursor to the end of the line, to be consistent with C and D.
|
" Yank from the cursor to the end of the line, to be consistent with C and D.
|
||||||
nnoremap Y y$
|
nnoremap Y y$
|
||||||
|
|
||||||
if has('nvim')
|
" if has('nvim')
|
||||||
set foldmethod=expr
|
" set foldmethod=expr
|
||||||
set foldexpr=nvim_treesitter#foldexpr()
|
" set foldexpr=nvim_treesitter#foldexpr()
|
||||||
else
|
" else
|
||||||
set foldmethod=syntax
|
" set foldmethod=syntax
|
||||||
autocmd FileType python set foldmethod=indent
|
" autocmd FileType python,vim set foldmethod=indent
|
||||||
endif
|
" endif
|
||||||
|
|
||||||
" so when a buffer open it wouldn't be fold by default
|
" so when a buffer open it wouldn't be fold by default
|
||||||
set nofoldenable
|
set nofoldenable
|
||||||
@@ -229,9 +201,6 @@
|
|||||||
map zl zL
|
map zl zL
|
||||||
map zh zH
|
map zh zH
|
||||||
|
|
||||||
" Easier formatting
|
|
||||||
" nnoremap <silent> <leader>q gwip
|
|
||||||
|
|
||||||
" Functions {
|
" Functions {
|
||||||
|
|
||||||
" Initialize directories for undo, swap, viewdir
|
" Initialize directories for undo, swap, viewdir
|
||||||
@@ -306,14 +275,6 @@
|
|||||||
vnoremap p "0p
|
vnoremap p "0p
|
||||||
|
|
||||||
|
|
||||||
" TIPS: :hi can be used to check current highlight options
|
|
||||||
" Coc has wired floating color, this is an attempt to fix it
|
|
||||||
" highlight CocFloating ctermbg=green
|
|
||||||
" highlight FgCocErrorFloatBgCocFloating cterm=bold ctermfg=124 guifg=DarkRed ctermbg=green
|
|
||||||
|
|
||||||
" c highlight fix
|
|
||||||
" highlight cComment ctermfg=12 guifg=#458588
|
|
||||||
|
|
||||||
" copy to system
|
" copy to system
|
||||||
set clipboard=unnamed
|
set clipboard=unnamed
|
||||||
|
|
||||||
|
|||||||
+21
-50
@@ -37,7 +37,7 @@
|
|||||||
|
|
||||||
Plug 'dstein64/vim-startuptime'
|
Plug 'dstein64/vim-startuptime'
|
||||||
Plug 'simeji/winresizer'
|
Plug 'simeji/winresizer'
|
||||||
Plug 'rust-lang/rust.vim'
|
Plug 'rust-lang/rust.vim', { 'for': ['rust'] }
|
||||||
|
|
||||||
Plug 'tpope/vim-surround'
|
Plug 'tpope/vim-surround'
|
||||||
Plug 'rhysd/conflict-marker.vim'
|
Plug 'rhysd/conflict-marker.vim'
|
||||||
@@ -64,7 +64,7 @@
|
|||||||
Plug 'tpope/vim-commentary'
|
Plug 'tpope/vim-commentary'
|
||||||
|
|
||||||
" put text in neibouring tmux pane into auto complete
|
" put text in neibouring tmux pane into auto complete
|
||||||
Plug 'wellle/tmux-complete.vim'
|
" Plug 'wellle/tmux-complete.vim'
|
||||||
|
|
||||||
Plug 'ludovicchabant/vim-gutentags', { 'for': ['c', 'cpp'] }
|
Plug 'ludovicchabant/vim-gutentags', { 'for': ['c', 'cpp'] }
|
||||||
Plug 'lambdalisue/readablefold.vim'
|
Plug 'lambdalisue/readablefold.vim'
|
||||||
@@ -80,7 +80,7 @@
|
|||||||
" The bottom buffer display
|
" The bottom buffer display
|
||||||
Plug 'Donaldttt/vim-bufferline'
|
Plug 'Donaldttt/vim-bufferline'
|
||||||
Plug 'ryanoasis/vim-devicons'
|
Plug 'ryanoasis/vim-devicons'
|
||||||
" Plug 'Yggdroot/indentLine'
|
Plug 'junegunn/goyo.vim'
|
||||||
endif
|
endif
|
||||||
|
|
||||||
if executable('node')
|
if executable('node')
|
||||||
@@ -182,6 +182,13 @@ endfunction
|
|||||||
\ { 'header': [' RECENT'], 'type': 'files' },
|
\ { 'header': [' RECENT'], 'type': 'files' },
|
||||||
\ { 'header': [' SESSIONS'], 'type': 'sessions' },
|
\ { 'header': [' SESSIONS'], 'type': 'sessions' },
|
||||||
\ ]
|
\ ]
|
||||||
|
|
||||||
|
" session related KeyBinding. These KeyBinding uses function from startify
|
||||||
|
nnoremap <silent> <leader><leader>s :SSave<CR>
|
||||||
|
nnoremap <silent> <leader><leader>l :SLoad<CR>
|
||||||
|
nnoremap <silent> <leader><leader>d :SDelete!<CR>
|
||||||
|
nnoremap <silent> <leader><leader>c :SClose<CR>
|
||||||
|
|
||||||
endif
|
endif
|
||||||
" }
|
" }
|
||||||
"
|
"
|
||||||
@@ -237,6 +244,7 @@ endfunction
|
|||||||
" }
|
" }
|
||||||
|
|
||||||
" bling/vim-bufferline {
|
" bling/vim-bufferline {
|
||||||
|
if HasPlug("vim-bufferline") && HasPlug("vim-airline")
|
||||||
let g:bufferline_echo = 0
|
let g:bufferline_echo = 0
|
||||||
let g:bufferline_modified = '+'
|
let g:bufferline_modified = '+'
|
||||||
|
|
||||||
@@ -248,11 +256,14 @@ endfunction
|
|||||||
let g:bufferline_fixed_index = -1
|
let g:bufferline_fixed_index = -1
|
||||||
let g:bufferline_inactive_highlight = 'StatusLineNC'
|
let g:bufferline_inactive_highlight = 'StatusLineNC'
|
||||||
let g:bufferline_active_highlight = 'StatusLine'
|
let g:bufferline_active_highlight = 'StatusLine'
|
||||||
|
endif
|
||||||
|
|
||||||
" }
|
" }
|
||||||
|
|
||||||
" mbbill/undotree {
|
" mbbill/undotree {
|
||||||
|
if HasPlug("undotree")
|
||||||
nnoremap <leader>ut :UndotreeToggle<CR>
|
nnoremap <leader>ut :UndotreeToggle<CR>
|
||||||
|
endif
|
||||||
" }
|
" }
|
||||||
|
|
||||||
" airblade/vim-rooter {
|
" airblade/vim-rooter {
|
||||||
@@ -299,20 +310,11 @@ endfunction
|
|||||||
" nvim-tree.lua {
|
" nvim-tree.lua {
|
||||||
if g:vim_type == 'nvim' && HasPlug("nvim-tree.lua")
|
if g:vim_type == 'nvim' && HasPlug("nvim-tree.lua")
|
||||||
|
|
||||||
" Hide vim bottom statusline
|
|
||||||
" autocmd FileType NvimTree setlocal noshowmode noruler laststatus=0 noshowcmd
|
|
||||||
" set noshowmode noruler laststatus=0 noshowcmd
|
|
||||||
" autocmd BufRead,BufNewFile NvimTree set laststatus=0 " This will work instead
|
|
||||||
endif
|
endif
|
||||||
" }
|
" }
|
||||||
|
|
||||||
"if has('nvim') && str2float(g:nvim_version) >= 0.5 && HasPlug("lualine.nvim")
|
|
||||||
" nvim-lualine/lualine.nvim {
|
|
||||||
" }
|
|
||||||
"else
|
|
||||||
"
|
|
||||||
" vim-airline {
|
" vim-airline {
|
||||||
if g:vim_type == 'vim' && HasPlug("vim-airline")
|
if HasPlug("vim-airline")
|
||||||
" Set configuration options for the statusline plugin vim-airline.
|
" Set configuration options for the statusline plugin vim-airline.
|
||||||
" Use the powerline theme and optionally enable powerline symbols.
|
" Use the powerline theme and optionally enable powerline symbols.
|
||||||
|
|
||||||
@@ -360,6 +362,7 @@ endfunction
|
|||||||
"endif
|
"endif
|
||||||
|
|
||||||
" junegunn/fzf {
|
" junegunn/fzf {
|
||||||
|
if HasPlug("fzf") && HasPlug("fzf.vim")
|
||||||
" [Buffers] Jump to the existing window if possible
|
" [Buffers] Jump to the existing window if possible
|
||||||
let g:fzf_buffers_jump = 1
|
let g:fzf_buffers_jump = 1
|
||||||
|
|
||||||
@@ -373,7 +376,6 @@ endfunction
|
|||||||
let g:fzf_preview_window = ['right:50%', 'ctrl-/']
|
let g:fzf_preview_window = ['right:50%', 'ctrl-/']
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
" check if ripgrep is installed
|
" check if ripgrep is installed
|
||||||
if ! executable('rg')
|
if ! executable('rg')
|
||||||
command! -bang -nargs=* Rg
|
command! -bang -nargs=* Rg
|
||||||
@@ -383,11 +385,11 @@ endfunction
|
|||||||
endif
|
endif
|
||||||
noremap <leader><leader>r :Rg<CR>
|
noremap <leader><leader>r :Rg<CR>
|
||||||
noremap <leader><leader>f :Files<CR>
|
noremap <leader><leader>f :Files<CR>
|
||||||
|
endif
|
||||||
" }
|
" }
|
||||||
|
|
||||||
" neoclide/coc.nvim {
|
" neoclide/coc.nvim {
|
||||||
if HasPlug("coc.nvim") && executable('node')
|
if HasPlug("coc.nvim") && executable('node')
|
||||||
" add desired extensions to the following global variable
|
|
||||||
" coc-clangd: c/c++, may need to install clangd seperatly
|
" coc-clangd: c/c++, may need to install clangd seperatly
|
||||||
|
|
||||||
if filereadable(g:mydotfiles_directory . "/coc-nvim-config.vim")
|
if filereadable(g:mydotfiles_directory . "/coc-nvim-config.vim")
|
||||||
@@ -447,9 +449,6 @@ endfunction
|
|||||||
call system("touch " . g:vim_dir . a:name)
|
call system("touch " . g:vim_dir . a:name)
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
" all signal files:
|
|
||||||
" .transparent_light_theme.signal
|
|
||||||
" .transparent_dark_theme.signal
|
|
||||||
function! SignalFileExists(filename)
|
function! SignalFileExists(filename)
|
||||||
if filereadable(g:vim_dir . a:filename)
|
if filereadable(g:vim_dir . a:filename)
|
||||||
return v:true
|
return v:true
|
||||||
@@ -489,7 +488,9 @@ endfunction
|
|||||||
if g:vim_type == 'nvim' && g:vim_version >= 0.5
|
if g:vim_type == 'nvim' && g:vim_version >= 0.5
|
||||||
"execute('AirlineTheme ' . a:theme)
|
"execute('AirlineTheme ' . a:theme)
|
||||||
else
|
else
|
||||||
execute('AirlineTheme ' . a:theme)
|
if HasPlug('vim-airline') && HasPlug('vim-airline-themes')
|
||||||
|
execute('AirlineTheme ' . a:theme)
|
||||||
|
endif
|
||||||
endif
|
endif
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
@@ -497,29 +498,6 @@ endfunction
|
|||||||
" There is no plugin for this for nvim < 0.5 or vim without lua support
|
" There is no plugin for this for nvim < 0.5 or vim without lua support
|
||||||
function! TransparentBackgroundFix()
|
function! TransparentBackgroundFix()
|
||||||
if !has('nvim') || g:vim_version < 0.5
|
if !has('nvim') || g:vim_version < 0.5
|
||||||
" if v:true
|
|
||||||
" if v:true
|
|
||||||
highlight CursorLineNr ctermbg=none
|
|
||||||
highlight SignColumn ctermbg=none
|
|
||||||
if v:false
|
|
||||||
"highlight CursorLineNr ctermbg=none
|
|
||||||
highlight CocWarningHighlight ctermbg=none
|
|
||||||
highlight CocErrorSign ctermbg=none ctermfg=9 cterm=bold
|
|
||||||
highlight CocErrorHighlight ctermbg=none ctermfg=9 cterm=underline,bold
|
|
||||||
highlight CocInfoHighlight ctermbg=none
|
|
||||||
highlight CocHintHighlight ctermbg=none
|
|
||||||
highlight CocWarningSign ctermbg=none
|
|
||||||
highlight CocInfoSign ctermbg=none
|
|
||||||
highlight CocHintSign ctermbg=none
|
|
||||||
if g:dark_or_light_theme == 'dark'
|
|
||||||
highlight! link TempColor Visual
|
|
||||||
highlight! link CocFloating TempColor
|
|
||||||
highlight! link CocErrorFloat TempColor
|
|
||||||
highlight! link CocWarningFloat TempColor
|
|
||||||
highlight! link CocInfoFloat TempColor
|
|
||||||
highlight! link CocHintFloat TempColor
|
|
||||||
endif
|
|
||||||
endif
|
|
||||||
endif
|
endif
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
@@ -572,7 +550,6 @@ endfunction
|
|||||||
\ }
|
\ }
|
||||||
\ }
|
\ }
|
||||||
execute("colorscheme " . g:light_theme)
|
execute("colorscheme " . g:light_theme)
|
||||||
DeleteSignalFile()
|
|
||||||
endif
|
endif
|
||||||
endif
|
endif
|
||||||
endfunction
|
endfunction
|
||||||
@@ -663,7 +640,7 @@ endfunction
|
|||||||
call SetDarkTheme()
|
call SetDarkTheme()
|
||||||
call SetStatusLineTheme(g:airline_dark_theme)
|
call SetStatusLineTheme(g:airline_dark_theme)
|
||||||
" for saving theme state
|
" for saving theme state
|
||||||
call DeleteSignalFile(".light_theme.signal")
|
call DeleteSignalFile('.light_theme.signal')
|
||||||
endif
|
endif
|
||||||
|
|
||||||
if (g:transparent_dark_theme && g:dark_or_light_theme == 'dark') || (g:transparent_light_theme && g:dark_or_light_theme == 'light')
|
if (g:transparent_dark_theme && g:dark_or_light_theme == 'dark') || (g:transparent_light_theme && g:dark_or_light_theme == 'light')
|
||||||
@@ -715,12 +692,6 @@ endfunction
|
|||||||
nnoremap <silent> <C-w>% :vsplit<CR>
|
nnoremap <silent> <C-w>% :vsplit<CR>
|
||||||
nnoremap <silent> <C-w>" :split<CR>
|
nnoremap <silent> <C-w>" :split<CR>
|
||||||
|
|
||||||
" session related KeyBinding. These KeyBinding uses function from startify
|
|
||||||
nnoremap <silent> <leader><leader>s :SSave<CR>
|
|
||||||
nnoremap <silent> <leader><leader>l :SLoad<CR>
|
|
||||||
nnoremap <silent> <leader><leader>d :SDelete!<CR>
|
|
||||||
nnoremap <silent> <leader><leader>c :SClose<CR>
|
|
||||||
|
|
||||||
" }
|
" }
|
||||||
"
|
"
|
||||||
" Lua configuration
|
" Lua configuration
|
||||||
|
|||||||
@@ -60,6 +60,9 @@ function! CocThemeFix()
|
|||||||
|
|
||||||
hi Error cterm=underline ctermfg=124 ctermbg=none
|
hi Error cterm=underline ctermfg=124 ctermbg=none
|
||||||
hi javaError cterm=underline ctermfg=124 ctermbg=none
|
hi javaError cterm=underline ctermfg=124 ctermbg=none
|
||||||
|
|
||||||
|
highlight CursorLineNr ctermbg=none
|
||||||
|
highlight SignColumn ctermbg=none
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
call CocThemeFix()
|
call CocThemeFix()
|
||||||
|
|||||||
Reference in New Issue
Block a user