This commit is contained in:
nnduc
2025-02-01 17:58:10 +07:00
commit 9d9cab4665
25 changed files with 9679 additions and 0 deletions

2
nvim/coc-settings.json Normal file
View File

@ -0,0 +1,2 @@
{"coc.preferences.diagnostic.displayByAle":1
}

196
nvim/init.vim Normal file
View File

@ -0,0 +1,196 @@
syntax on
set number
set cursorline
set expandtab tabstop=4 shiftwidth=4 softtabstop=4
set autoindent
set spelllang=vi,en
" Fold
set foldmethod=syntax
set foldlevel=1
set foldnestmax=1
set encoding=utf8
" Search
set hlsearch
nnoremap i :nohls<CR>i
" Plugin
call plug#begin()
Plug 'neoclide/coc.nvim', {'branch': 'release'}
Plug 'dense-analysis/ale'
Plug 'preservim/nerdtree'
Plug 'preservim/nerdcommenter'
Plug 'lervag/vimtex'
Plug 'JuliaEditorSupport/julia-vim'
Plug 'junegunn/fzf', { 'do': { -> fzf#install() } }
Plug 'junegunn/fzf.vim'
Plug 'honza/vim-snippets'
Plug 'vim-airline/vim-airline'
Plug 'vim-airline/vim-airline-themes'
Plug 'kevinhwang91/nvim-bqf'
Plug 'morhetz/gruvbox'
Plug 'tpope/vim-fugitive'
Plug 'ynkdir/vim-diff'
call plug#end()
"Color scheme
"colorscheme iceberg
"set background=light
colorscheme gruvbox
let g:gruvbox_contrast_light = 'hard'
"Open NERDTree
:nnoremap <silent> <expr> <F2> g:NERDTree.IsOpen() ? "\:NERDTreeClose<CR>" : bufexists(expand('%')) ? "\:NERDTreeFind<CR>" : "\:NERDTree<CR>"
"Coc.nvim
inoremap <silent><expr> <TAB>
\ coc#pum#visible() ? coc#_select_confirm() :
\ coc#expandableOrJumpable() ? "\<C-r>=coc#rpc#request('doKeymap', ['snippets-expand-jump',''])\<CR>" :
\ CheckBackSpace() ? "\<TAB>" :
\ coc#refresh()
inoremap <silent><expr> <cr> pumvisible() ? coc#_select_confirm()
\: "\<C-g>u\<CR>\<c-r>=coc#on_enter()\<CR>"
function! CheckBackSpace() abort
let col = col('.') - 1
return !col || getline('.')[col - 1] =~# '\s'
endfunction
let g:coc_snippet_next = '<tab>'
inoremap <silent><expr> <CR> coc#pum#visible() ? coc#pum#confirm()
\: "\<C-g>u\<CR>\<c-r>=coc#on_enter()\<CR>"
" Comments
let mapleader = ","
" remap save
nnoremap <space> :w<CR>
" moving between windows
nnoremap <C-h> <C-W>h
nnoremap <C-j> <C-W>j
nnoremap <C-k> <C-W>k
nnoremap <C-l> <C-W>l
nnoremap <C-Left> <C-W>h
nnoremap <C-Down> <C-W>j
nnoremap <C-Up> <C-W>k
nnoremap <C-Right> <C-W>l
nnoremap <leader>to :tabonly<CR>
nnoremap <leader>o :only<CR>
nnoremap <leader><tab> :tabn<CR>
nnoremap <S-tab> :tabp<CR>
"set clipboard+=unnamedplus
" " Copy to clipboard
vnoremap <leader>y "+y
nnoremap <leader>Y "+yg_
nnoremap <leader>y "+y
nnoremap <leader>yy "+yy
" " Paste from clipboard
nnoremap <leader>p "+p
nnoremap <leader>P "+P
" FZF key mapping
nnoremap <silent> <Leader>b :Buffers<CR>
nnoremap <silent> <Leader>r :Rg<CR>
nnoremap <silent> <Leader>f :Files<CR>
nnoremap <silent> <Leader>g :GFiles<CR>
nnoremap <silent> <Leader>w :Rg <C-R><C-W><CR>
filetype plugin on
set splitright
set splitbelow
let g:input_lang = system('fcitx5-remote')
function! FcitxOff()
let l:input_status = system('fcitx5-remote')
let g:input_lang = l:input_status
if l:input_status == 2 "second input method
silent! execute '!fcitx5-remote -c'
endif
endfunction
function! FcitxOn()
let l:input_status = system('fcitx5-remote')
if l:input_status == 1
if g:input_lang == 2
silent! execute '!fcitx5-remote -o'
endif
endif
endfunction
augroup fcitxHandler
autocmd CmdLineEnter [/?] silent call FcitxOn()
autocmd CmdLineLeave [/?] silent call FcitxOff()
autocmd CmdLineEnter \? silent call FcitxOn()
autocmd CmdLineLeave \? silent call FcitxOff()
autocmd InsertEnter * silent call FcitxOn()
autocmd InsertLeave * silent call FcitxOff()
augroup END
"function! IBusOff()
"" Lưu engine hiện tại
"let g:ibus_prev_engine = system('ibus engine')
"" Chuyển sang engine tiếng Anh
"" Nếu bạn thấy cái cờ ở đây
"" khả năng là font của bạn đang renderemoji lung tung...
"" xkb : us :: eng (không có dấu cách)
"silent! execute '!ibus engine xkb🇺🇸:eng'
"endfunction
"function! IBusOn()
"let l:current_engine = system('ibus engine')
"" nếu engine được set trong normal mode thì
"" lúc vào insert mode duùn luôn engine đó
"if l:current_engine !~? 'xkb🇺🇸:eng'
"let g:ibus_prev_engine = l:current_engine
"endif
"" Khôi phục lại engine
"silent! execute '!ibus engine ' . g:ibus_prev_engine
"endfunction
"augroup IBusHandler
"" Khôi phục ibus engine khi tìm kiếm
"autocmd CmdLineEnter [/?] silent call IBusOn()
"autocmd CmdLineLeave [/?] silent call IBusOff()
"autocmd CmdLineEnter \? silent call IBusOn()
"autocmd CmdLineLeave \? silent call IBusOff()
"" Khôi phục ibus engine khi vào insert mode
"autocmd InsertEnter * silent call IBusOn()
"" Tắt ibus engine khi vào normal mode
"autocmd InsertLeave * silent call IBusOff()
"augroup END
"silent call IBusOff()
let g:vimtex_view_method= 'zathura'
"Language tool
map <F3> :ALEToggle<CR>
"Use 24-bit (true-color) mode in Vim/Neovim when outside tmux.
"If you're using tmux version 2.2 or later, you can remove the outermost $TMUX check and use tmux's 24-bit color support
"(see < http://sunaku.github.io/tmux-24bit-color.html#usage > for more information.)
if (empty($TMUX))
if (has("nvim"))
"For Neovim 0.1.3 and 0.1.4 < https://github.com/neovim/neovim/pull/2198 >
let $NVIM_TUI_ENABLE_TRUE_COLOR=1
endif
"For Neovim > 0.1.5 and Vim > patch 7.4.1799 < https://github.com/vim/vim/commit/61be73bb0f965a895bfb064ea3e55476ac175162 >
"Based on Vim patch 7.4.1770 (`guicolors` option) < https://github.com/vim/vim/commit/8a633e3427b47286869aa4b96f2bfc1fe65b25cd >
" < https://github.com/neovim/neovim/wiki/Following-HEAD#20160511 >
if (has("termguicolors"))
set termguicolors
endif
endif

101
nvim/init.vim(server) Normal file
View File

@ -0,0 +1,101 @@
syntax on
set number
set cursorline
set expandtab tabstop=4 shiftwidth=4 softtabstop=4
set autoindent
set spelllang=vi,en
" Fold
set foldmethod=syntax
set foldlevel=1
set foldnestmax=1
set encoding=utf8
" Search
set hlsearch
nnoremap i :nohls<CR>i
" Plugin
call plug#begin()
Plug 'neoclide/coc.nvim', {'branch': 'release'}
Plug 'preservim/nerdtree'
Plug 'preservim/nerdcommenter'
Plug 'junegunn/fzf', { 'do': { -> fzf#install() } }
Plug 'junegunn/fzf.vim'
Plug 'vim-airline/vim-airline'
Plug 'vim-airline/vim-airline-themes'
Plug 'kevinhwang91/nvim-bqf'
Plug 'morhetz/gruvbox'
Plug 'tpope/vim-fugitive'
Plug 'ynkdir/vim-diff'
call plug#end()
"Color scheme
colorscheme gruvbox
let g:gruvbox_contrast_light = 'hard'
set background=dark
" Comments
let mapleader = ","
"Open NERDTree
:nnoremap <silent> <expr> <F2> g:NERDTree.IsOpen() ? "\:NERDTreeClose<CR>" : bufexists(expand('%')) ? "\:NERDTreeFind<CR>" : "\:NERDTree<CR>"
"Coc.nvim
inoremap <silent><expr> <TAB>
\ coc#pum#visible() ? coc#_select_confirm() :
\ coc#expandableOrJumpable() ? "\<C-r>=coc#rpc#request('doKeymap', ['snippets-expand-jump',''])\<CR>" :
\ CheckBackSpace() ? "\<TAB>" :
\ coc#refresh()
inoremap <silent><expr> <CR> coc#pum#visible() ? coc#_select_confirm() : coc#refresh()
function! CheckBackSpace() abort
let col = col('.') - 1
return !col || getline('.')[col - 1] =~# '\s'
endfunction
let g:coc_snippet_next = '<tab>'
" remap save
nnoremap <space> :w<CR>
" moving between windows
nnoremap <C-h> <C-W>h
nnoremap <C-j> <C-W>j
nnoremap <C-k> <C-W>k
nnoremap <C-l> <C-W>l
nnoremap <C-Left> <C-W>h
nnoremap <C-Down> <C-W>j
nnoremap <C-Up> <C-W>k
nnoremap <C-Right> <C-W>l
nnoremap <leader>to :tabonly<CR>
nnoremap <leader>o :only<CR>
nnoremap <leader><tab> :tabn<CR>
nnoremap <S-tab> :tabp<CR>
"set clipboard+=unnamedplus
" " Copy to clipboard
vnoremap <leader>y "+y
nnoremap <leader>Y "+yg_
nnoremap <leader>y "+y
nnoremap <leader>yy "+yy
" " Paste from clipboard
nnoremap <leader>p "+p
nnoremap <leader>P "+P
" FZF key mapping
nnoremap <silent> <Leader>b :Buffers<CR>
nnoremap <silent> <Leader>r :Rg<CR>
nnoremap <silent> <Leader>f :Files<CR>
nnoremap <silent> <Leader>g :GFiles<CR>
nnoremap <silent> <Leader>w :Rg <C-R><C-W><CR>
filetype plugin on
set splitright
set splitbelow

227
nvim/latexmk.vim Normal file
View File

@ -0,0 +1,227 @@
" VimTeX - LaTeX plugin for Vim
"
" Maintainer: Karl Yngve Lervåg
" Email: karl.yngve@gmail.com
"
function! vimtex#compiler#latexmk#init(options) abort " {{{1
return s:compiler.new(a:options)
endfunction
" }}}1
function! vimtex#compiler#latexmk#get_rc_opt(root, opt, type, default) abort " {{{1
"
" Parse option from .latexmkrc.
"
" Arguments:
" root Root of LaTeX project
" opt Name of options
" type 0 if string, 1 if integer, 2 if list
" default Value to return if option not found in latexmkrc file
"
" Output:
" [value, location]
"
" value Option value (integer or string)
" location An integer that indicates where option was found
" -1: not found (default value returned)
" 0: global latexmkrc file
" 1: local latexmkrc file
"
if a:type == 0
let l:pattern = '^\s*\$' . a:opt . '\s*=\s*[''"]\(.\+\)[''"]'
elseif a:type == 1
let l:pattern = '^\s*\$' . a:opt . '\s*=\s*\(\d\+\)'
elseif a:type == 2
let l:pattern = '^\s*@' . a:opt . '\s*=\s*(\(.*\))'
else
throw 'VimTeX: Argument error'
endif
" Candidate files
" - each element is a pair [path_to_file, is_local_rc_file].
let l:files = [
\ [a:root . '/latexmkrc', 1],
\ [a:root . '/.latexmkrc', 1],
\ [fnamemodify('~/.latexmkrc', ':p'), 0],
\ [fnamemodify(
\ !empty($XDG_CONFIG_HOME) ? $XDG_CONFIG_HOME : '~/.config', ':p')
\ . '/latexmk/latexmkrc', 0]
\]
let l:result = [a:default, -1]
for [l:file, l:is_local] in l:files
if filereadable(l:file)
let l:match = matchlist(readfile(l:file), l:pattern)
if len(l:match) > 1
let l:result = [l:match[1], l:is_local]
break
end
endif
endfor
" Parse the list
if a:type == 2 && l:result[1] > -1
let l:array = split(l:result[0], ',')
let l:result[0] = []
for l:x in l:array
let l:x = substitute(l:x, "^'", '', '')
let l:x = substitute(l:x, "'$", '', '')
let l:result[0] += [l:x]
endfor
endif
return l:result
endfunction
" }}}1
let s:compiler = vimtex#compiler#_template#new({
\ 'name' : 'latexmk',
\ 'callback' : 1,
\ 'continuous': 1,
\ 'executable' : 'latexmk',
\ 'options' : [
\ '-verbose',
\ '-file-line-error',
\ '-synctex=1',
\ '-interaction=nonstopmode',
\ '-shell-escape',
\ '-output-directory=./output',
\ '-aux-directory=./',
\ ],
\})
function! s:compiler.__check_requirements() abort dict " {{{1
if !executable(self.executable)
call vimtex#log#warning(self.executable . ' is not executable')
throw 'VimTeX: Requirements not met'
endif
endfunction
" }}}1
function! s:compiler.__init() abort dict " {{{1
" Check if .latexmkrc sets the build_dir - if so this should be respected
let l:out_dir =
\ vimtex#compiler#latexmk#get_rc_opt(self.state.root, 'out_dir', 0, '')[0]
if !empty(l:out_dir)
if !empty(self.build_dir) && (self.build_dir !=# l:out_dir)
call vimtex#log#warning(
\ 'Setting out_dir from latexmkrc overrides build_dir!',
\ 'Changed build_dir from: ' . self.build_dir,
\ 'Changed build_dir to: ' . l:out_dir)
endif
let self.build_dir = l:out_dir
endif
endfunction
" }}}1
function! s:compiler.__build_cmd() abort dict " {{{1
let l:cmd = (has('win32')
\ ? 'set max_print_line=2000 & '
\ : 'max_print_line=2000 ') . self.executable
let l:cmd .= ' ' . join(self.options)
let l:cmd .= ' ' . self.get_engine()
if !empty(self.build_dir)
let l:cmd .= ' -outdir=' . fnameescape(self.build_dir)
endif
if self.continuous
let l:cmd .= ' -pvc -view=none'
if self.callback
for [l:opt, l:val] in [
\ ['compiling_cmd', 'vimtex_compiler_callback_compiling'],
\ ['success_cmd', 'vimtex_compiler_callback_success'],
\ ['failure_cmd', 'vimtex_compiler_callback_failure'],
\]
let l:cmd .= s:wrap_option_appendcmd(l:opt, 'echo ' . l:val)
endfor
endif
endif
return l:cmd . ' ' . vimtex#util#shellescape(self.state.base)
endfunction
" }}}1
function! s:compiler.__pprint_append() abort dict " {{{1
return [
\ ['callback', self.callback],
\ ['continuous', self.continuous],
\ ['executable', self.executable],
\]
endfunction
" }}}1
function! s:compiler.clean(full) abort dict " {{{1
let l:cmd = self.executable . ' ' . (a:full ? '-C ' : '-c ')
if !empty(self.build_dir)
let l:cmd .= printf(' -outdir=%s ', fnameescape(self.build_dir))
endif
let l:cmd .= vimtex#util#shellescape(self.state.base)
call vimtex#jobs#run(l:cmd, {'cwd': self.state.root})
endfunction
" }}}1
function! s:compiler.get_engine() abort dict " {{{1
" Parse tex_program from TeX directive
let l:tex_program_directive = self.state.get_tex_program()
let l:tex_program = l:tex_program_directive
" Parse tex_program from from pdf_mode option in .latexmkrc
let [l:pdf_mode, l:is_local] =
\ vimtex#compiler#latexmk#get_rc_opt(self.state.root, 'pdf_mode', 1, -1)
if l:pdf_mode >= 1 && l:pdf_mode <= 5
let l:tex_program_pdfmode = [
\ 'pdflatex',
\ 'pdfps',
\ 'pdfdvi',
\ 'lualatex',
\ 'xelatex',
\][l:pdf_mode-1]
" Use pdf_mode if there is no TeX directive
if l:tex_program_directive ==# '_'
let l:tex_program = l:tex_program_pdfmode
elseif l:is_local && l:tex_program_directive !=# l:tex_program_pdfmode
" Give warning when there may be a confusing conflict
call vimtex#log#warning(
\ 'Value of pdf_mode from latexmkrc is inconsistent with ' .
\ 'TeX program directive!',
\ 'TeX program: ' . l:tex_program_directive,
\ 'pdf_mode: ' . l:tex_program_pdfmode,
\ 'The value of pdf_mode will be ignored.')
endif
endif
return get(g:vimtex_compiler_latexmk_engines,
\ l:tex_program,
\ g:vimtex_compiler_latexmk_engines._)
endfunction
" }}}1
function! s:wrap_option_appendcmd(name, value) abort " {{{1
" Note: On Linux, we use double quoted perl strings; these interpolate
" variables. One should therefore NOT pass values that contain `$`.
let l:win_cmd_sep = has('nvim') ? '^&' : '&'
let l:common = printf('$%s = ($%s ? $%s', a:name, a:name, a:name)
return has('win32')
\ ? printf(' -e "%s . '' %s '' : '''') . ''%s''"',
\ l:common, l:win_cmd_sep, a:value)
\ : printf(' -e ''%s . " ; " : "") . "%s"''',
\ l:common, a:value)
endfunction
"}}}1

BIN
nvim/site/vi.utf-8.spl Normal file

Binary file not shown.

66
nvim/vi.aff Normal file
View File

@ -0,0 +1,66 @@
SET UTF-8
TRY naohiugtcedmylrbvskpxqfjwzNAOHIUGTCEDMYLRBVSKPXQFJWZ-
MAP 40
MAP ảã
MAP ẩẫ
MAP ẳẵ
MAP ẻẽ
MAP ểễ
MAP ỉĩ
MAP ỏõ
MAP ổỗ
MAP ởỡ
MAP ủũ
MAP ửữ
MAP ỷỹ
MAP (iêu)(iu)(ưu)
MAP (iếu)(íu)(ứu)
MAP (iều)(ìu)(ừu)
MAP (iểu)(ỉu)(ửu)
MAP (iễu)(ĩu)(ữu)
MAP (iệu)(ịu)(ựu)
MAP (ịc)(ịch)
MAP (íc)(ích)
MAP aàảãáạ
MAP ăằẳẵắặ
MAP âầẩẫấậ
MAP eèẻẽéẹ
MAP êềểễếệ
MAP iìỉĩíị
MAP oòỏõóọ
MAP ôồổỗốộ
MAP ơờởỡớợ
MAP uùủũúụ
MAP ưừửữứự
MAP yỳỷỹýỵ
MAP aàảãáạăằẳẵắặâầẩẫấậ
MAP eèẻẽéẹêềểễếệ
MAP oòỏõóọôồổỗốộơờởỡớợ
MAP uùủũúụưừửữứự
MAP óòỏaàáả
MAP óóỏeèéẻ
MAP úùủụyýỳỷỵ
MAP uưoờớỡởợ
REP 20
REP dz d
REP ch tr
REP d đ
REP đ d
REP d gi
REP f ph
REP g gh
REP gh g
REP gi d
REP j g
REP ng ngh
REP ngh ng
REP ou uo
REP ou ươ
REP uo ươ
REP s x
REP tr ch
REP x s
REP w qu
REP z d

6642
nvim/vi.dic Normal file

File diff suppressed because it is too large Load Diff

BIN
nvim/vi.dic.utf-8.spl Normal file

Binary file not shown.