1
0
mirror of https://github.com/jdhao/nvim-config.git synced 2025-06-08 14:14:33 +02:00

59 Commits

Author SHA1 Message Date
jdhao
e57e747b26 Merge pull request #72 from jdhao/lua-au-ctx
refactor: use ctx table for lua autocmd callback
2022-08-21 18:21:22 +08:00
jdhao
c3f8d75ece refactor: use ctx table for lua autocmd callback 2022-08-21 18:20:21 +08:00
jdhao
78baf8d015 Merge pull request #71 from jdhao/snip
update markdown snippet
2022-08-21 11:48:15 +08:00
jdhao
9d8a58be17 update markdown snippet 2022-08-21 11:47:03 +08:00
jdhao
2372d9159f Merge pull request #70 from jdhao/lua-autuocmd
refactor: move part of autocmd to lua script
2022-08-20 02:02:12 -05:00
jdhao
e9a3d16260 refactor: move part of autocmd to lua script 2022-08-20 15:00:10 +08:00
jdhao
fdf8236fc2 Merge pull request #69 from jdhao/fix-autocmd
update the autocmd for saving a file
2022-08-20 00:52:33 -05:00
jdhao
085c8017d8 update the autocmd for saving a file 2022-08-20 13:50:23 +08:00
jdhao
efa7b215e7 Merge pull request #68 from jdhao/install-win
update install script for Windows
2022-08-19 07:06:43 -05:00
jdhao
e68c687f23 update install script for Windows 2022-08-19 20:05:40 +08:00
jdhao
497f93d6c7 Merge pull request #67 from jdhao/packer-autoinstall
feat: auto-install plugins for fresh install
2022-08-18 11:43:49 -05:00
jdhao
cfe2e0611d feat: auto-install plugins for fresh install 2022-08-19 00:42:02 +08:00
jdhao
9de08d0afe Merge pull request #66 from jdhao/lsp
add config dir to workspace.library for lua lsp
2022-08-18 13:16:51 +08:00
jdhao
d5b7584e68 add config dir to workspace.library for lua lsp 2022-08-18 13:15:20 +08:00
jdhao
64a7a23309 Merge pull request #64 from jdhao/fix-firenvim
update firenvim conf
2022-08-15 22:57:50 +08:00
jdhao
c1efc0bad6 update firenvim conf 2022-08-15 22:56:56 +08:00
jdhao
b3b69f21f4 update mapping 2022-08-15 00:22:24 +08:00
jdhao
f491e26676 Merge pull request #63 from jdhao/large-file
handle large file better
2022-08-15 00:08:16 +08:00
jdhao
e7e4892c22 handle large file better 2022-08-15 00:06:52 +08:00
jdhao
a52a362b02 update version check 2022-08-14 22:54:19 +08:00
jdhao
2880d7bce3 chore: renaming 2022-08-14 20:16:00 +08:00
jdhao
7e6dd23d37 add fidget-nvim for lsp-progress 2022-08-14 20:12:52 +08:00
jdhao
fcbd7d3a0d Merge pull request #62 from jdhao/lua-lsp
update lua lsp conf
2022-08-14 18:11:41 +08:00
jdhao
97f302084f update sumneko lua settings
1. remove runtime.path settings. It seems that it is not necessary, 03a047ef52.
2. update workspace.library, ref plugin ii14/emmylua-nvim
2022-08-14 17:53:40 +08:00
jdhao
9d29544d72 update linux setup script
1. lua-language-server
2. format fix
2022-08-14 12:01:38 +08:00
jdhao
cad9f5a214 make inspect() global 2022-08-14 11:39:37 +08:00
jdhao
ecde08941b update lua-language-server conf
lua-language-server has changed its running method significantly, so we
need to change it in the nvim-lspconfig.
2022-08-13 23:08:25 +08:00
jdhao
ab88c112ff make dashboard-nvim an opt plugin 2022-08-13 23:03:42 +08:00
jdhao
4c96243a4c init.vim --> init.lua cleanup 2022-08-13 22:45:13 +08:00
jdhao
fdc158272b init.vim --> init.lua follow 2022-08-13 22:43:33 +08:00
jdhao
b331cddc73 Merge pull request #61 from jdhao/init.lua
Transition from init.vim to init.lua
2022-08-13 22:39:47 +08:00
jdhao
b11c57e36f Transition from init.vim to init.lua 2022-08-13 22:37:49 +08:00
jdhao
84d73660fa add stylua conf 2022-08-13 17:12:08 +08:00
jdhao
a9cc10b2ef Merge pull request #60 from jdhao/doc
update setup doc
2022-08-12 20:32:48 +08:00
jdhao
cad6112cc2 update setup doc 2022-08-12 20:31:32 +08:00
jdhao
4d7fd6580a Merge pull request #58 from jdhao/mapping-doc
update readme about mappings
2022-08-11 01:29:33 +08:00
jdhao
f492a94db6 update readme about mappings 2022-08-11 01:28:14 +08:00
jdhao
0c92d9a018 update mappings
1. add mapping for gJ
2. remove mappings for <C-H>, since I rarely use them
2022-08-10 21:24:14 +08:00
jdhao
369687b047 refactor: disable showing trailing space and mix indent for non-modifiable buffers 2022-08-07 00:25:08 +08:00
jdhao
54908dfe9f fix: dashboard map is not local 2022-08-07 00:24:37 +08:00
jdhao
2e5f5c5991 update demo image in README 2022-08-07 00:12:55 +08:00
jdhao
8291b15599 remove alpha-nvim, use dashboard-nvim 2022-08-07 00:01:23 +08:00
jdhao
3de31f7d0a disable language command in macOS for now
Due to packaging issue, nvim version 0.7.2 for macOS does not have
`:language` command built in, see also neovim/neovim#19127.
2022-08-06 22:36:49 +08:00
jdhao
6b59c268f9 Merge pull request #57 from jdhao/fix-trailing-space
fix: trailing white sapces do not show as expected
2022-08-06 17:22:32 +08:00
jdhao
dd550dc3d0 fix: trailing white sapces do not show as expected
The plugin whitespace.nvim has changed its internal implementation.
It is not reliable to depend on external plugins.
2022-08-06 17:19:13 +08:00
jdhao
3aae07df56 Merge pull request #56 from jdhao/js-setup
add setup for javascript
2022-08-06 14:23:31 +08:00
jdhao
ed5ddf60cc add setup for javascript 2022-08-06 14:20:28 +08:00
jdhao
bcdc8d3f66 small fix 2022-08-01 20:57:37 +08:00
jdhao
5498a05bf7 revert to vim-auto-save
auto-save.nvim is erroring out
2022-08-01 01:14:09 +08:00
jdhao
644f8b6e2d add theme catppuccin 2022-07-28 01:32:41 +08:00
jdhao
3af7dd51b8 update packer config 2022-07-28 01:22:10 +08:00
jdhao
e0fc068f2e update nvim-cmp conf since cmp-nvim-lua is removed 2022-07-28 00:51:48 +08:00
jdhao
58ed71f870 use emmylua-nvim instead of cmp-nvim-lua for better completion 2022-07-27 21:08:03 +08:00
jdhao
aae9a7b7a7 update winblend 2022-07-27 13:17:22 +08:00
jdhao
33270f3257 add command ToPDF 2022-07-19 01:18:26 +08:00
jdhao
99d5a0343b update title str format 2022-07-11 23:14:16 +08:00
jdhao
3678da1b3c update titlestring 2022-07-02 16:47:58 +08:00
jdhao
a8fdbf3573 disable showing current theme used 2022-06-28 00:36:37 +08:00
jdhao
351ba5fc63 update option shortmess 2022-06-28 00:36:19 +08:00
29 changed files with 624 additions and 273 deletions

6
.stylua.toml Normal file
View File

@@ -0,0 +1,6 @@
# config for stylua, ref: https://github.com/JohnnyMorganz/StyLua
line_endings = "Unix"
indent_type = "Spaces"
indent_width = 2
quote_style = "AutoPreferDouble"
no_call_parentheses = true

View File

@@ -36,7 +36,7 @@
# Introduction # Introduction
This repo hosts my Nvim configuration for Linux, macOS, and Windows. This repo hosts my Nvim configuration for Linux, macOS, and Windows.
`init.vim` is the config entry point for terminal Nvim, `init.lua` is the config entry point for terminal Nvim,
and `ginit.vim` is the additional config file for [GUI client of Nvim](https://github.com/neovim/neovim/wiki/Related-projects#gui). and `ginit.vim` is the additional config file for [GUI client of Nvim](https://github.com/neovim/neovim/wiki/Related-projects#gui).
My configurations are heavily documented to make it as clear as possible. My configurations are heavily documented to make it as clear as possible.
@@ -88,16 +88,16 @@ and how to set up on different platforms (Linux, macOS, and Windows).
For more UI demos, check [here](https://github.com/jdhao/nvim-config/issues/15). For more UI demos, check [here](https://github.com/jdhao/nvim-config/issues/15).
## Start screen with alpha-nvim ## Start screen with dashboard-nvim
<p align="center"> <p align="center">
<img src="https://user-images.githubusercontent.com/16662357/139459989-0537ded4-c119-4749-99bf-b551ca1ba118.jpg" width="800"> <img src="https://user-images.githubusercontent.com/16662357/183256752-fb23b215-a6b8-4646-beed-9999f52d53f1.png" width="800">
</p> </p>
## fuzzy finding using LeaderF ## File fuzzy finding using LeaderF
<p align="center"> <p align="center">
<img src="https://user-images.githubusercontent.com/16662357/139462025-7bce98c5-d2d5-413f-9659-20545865cdca.gif" width="800"> <img src="https://user-images.githubusercontent.com/16662357/183257017-2d9d7605-3c4b-4e1d-8955-30998f9b6f28.gif" width="800">
</p> </p>
## Code autocompletion with nvim-cmp ## Code autocompletion with nvim-cmp
@@ -142,43 +142,46 @@ Go to a string starting with `se`
Some of the shortcuts I use frequently are listed here. In the following shortcuts, `<leader>` represents ASCII character `,`. Some of the shortcuts I use frequently are listed here. In the following shortcuts, `<leader>` represents ASCII character `,`.
| Shortcut | Mode | platform | Description | | Shortcut | Mode | platform | Description |
|-------------------|---------------|-----------------|------------------------------------------------------------------| |-------------------|---------------|-----------------|--------------------------------------------------------------------------|
| `<leader>ff` | Normal | Linux/macOS/Win | Fuzzy file searching in a floating window | | `<leader>ff` | Normal | Linux/macOS/Win | Fuzzy file searching in a floating window |
| `<leader>fh` | Normal | Linux/macOS/Win | Fuzzy help file grepping in a floating window | | `<leader>fh` | Normal | Linux/macOS/Win | Fuzzy help file grepping in a floating window |
| `<leader>fg` | Normal | Linux/macOS/Win | Fuzzy project-wide grepping in a floating window | | `<leader>fg` | Normal | Linux/macOS/Win | Fuzzy project-wide grepping in a floating window |
| `<leader>ft` | Normal | Linux/macOS/Win | Fuzzy buffer tag searching in a floating window | | `<leader>ft` | Normal | Linux/macOS/Win | Fuzzy buffer tag searching in a floating window |
| `<leader>fb` | Normal | Linux/macOS/Win | Fuzzy buffer switching in a floating window | | `<leader>fb` | Normal | Linux/macOS/Win | Fuzzy buffer switching in a floating window |
| `<leader><Space>` | Normal | Linux/macOS/Win | Remove trailing white spaces | | `<leader><Space>` | Normal | Linux/macOS/Win | Remove trailing white spaces |
| `<leader>v` | Normal | Linux/macOS/Win | Reselect last pasted text | | `<leader>v` | Normal | Linux/macOS/Win | Reselect last pasted text |
| `<leader>ev` | Normal | Linux/macOS/Win | Edit Nvim config in a new tabpage | | `<leader>ev` | Normal | Linux/macOS/Win | Edit Nvim config in a new tabpage |
| `<leader>sv` | Normal | Linux/macOS/Win | Reload Nvim config | | `<leader>sv` | Normal | Linux/macOS/Win | Reload Nvim config |
| `<leader>st` | Normal | Linux/macOS/Win | Show highlight group for cursor text | | `<leader>st` | Normal | Linux/macOS/Win | Show highlight group for cursor text |
| `<leader>q` | Normal | Linux/macOS/Win | Quit current window | | `<leader>q` | Normal | Linux/macOS/Win | Quit current window |
| `<leader>Q` | Normal | Linux/macOS/Win | Quit all window and close Nvim | | `<leader>Q` | Normal | Linux/macOS/Win | Quit all window and close Nvim |
| `<leader>w` | Normal | Linux/macOS/Win | Save current buffer content | | `<leader>w` | Normal | Linux/macOS/Win | Save current buffer content |
| `<leader>y` | Normal | Linux/macOS/Win | Copy the content of entire buffer to default register | | `<leader>y` | Normal | Linux/macOS/Win | Copy the content of entire buffer to default register |
| `<leader>cl` | Normal | Linux/macOS/Win | Toggle cursor column | | `<leader>cl` | Normal | Linux/macOS/Win | Toggle cursor column |
| `<leader>cd` | Normal | Linux/macOS/Win | Change current working directory to to the dir of current buffer | | `<leader>cd` | Normal | Linux/macOS/Win | Change current working directory to to the dir of current buffer |
| `<space>t` | Normal | Linux/macOS/Win | Toggle tag window (show project tags in the right window) | | `<space>t` | Normal | Linux/macOS/Win | Toggle tag window (show project tags in the right window) |
| `<leader>gs` | Normal | Linux/macOS/Win | Show Git status result | | `<leader>gs` | Normal | Linux/macOS/Win | Show Git status result |
| `<leader>gw` | Normal | Linux/macOS/Win | Run Git add for current file | | `<leader>gw` | Normal | Linux/macOS/Win | Run Git add for current file |
| `<leader>gd` | Normal | Linux/macOS/Win | Run git diff for current file | | `<leader>gd` | Normal | Linux/macOS/Win | Run git diff for current file |
| `<leader>gc` | Normal | Linux/macOS/Win | Run git commit | | `<leader>gc` | Normal | Linux/macOS/Win | Run git commit |
| `<leader>gpl` | Normal | Linux/macOS/Win | Run git pull | | `<leader>gpl` | Normal | Linux/macOS/Win | Run git pull |
| `<leader>gpu` | Normal | Linux/macOS/Win | Run git push | | `<leader>gpu` | Normal | Linux/macOS/Win | Run git push |
| `<F9>` | Normal | Linux/macOS/Win | Run current source file (for Python, C++) | | `<F9>` | Normal | Linux/macOS/Win | Compile&run current source file (for C++, LaTeX, Lua, Python) |
| `<F11>` | Normal | Linux/macOS/Win | Toggle spell checking | | `<F11>` | Normal | Linux/macOS/Win | Toggle spell checking |
| `<F12>` | Normal | Linux/macOS/Win | Toggle paste mode | | `<F12>` | Normal | Linux/macOS/Win | Toggle paste mode |
| `\x` | Normal | Linux/macOS/Win | Close location or quickfix window | | `\x` | Normal | Linux/macOS/Win | Close location or quickfix window |
| `\d` | Normal | Linux/macOS/Win | Close current buffer and go to previous buffer | | `\d` | Normal | Linux/macOS/Win | Close current buffer and go to previous buffer |
| `{count}gb` | Normal | Linux/macOS/Win | Go to buffer {count} or next buffer in the buffer list. | | `{count}gb` | Normal | Linux/macOS/Win | Go to buffer `{count}` or next buffer in the buffer list. |
| `Alt-m` | Normal | macOS/Win | Markdown previewing in system browser | | `{operator}iB` | Normal | Linux/macOS/Win | Operate in the whole buffer, `{operator}` can be `v`, `y`, `c`, `d` etc. |
| `Alt-Shift-m` | Normal | macOS/Win | Stopping Markdown previewing in system browser | | `Alt-k` | Normal | Linux/macOS/Win | Move current line or selected lines up |
| `ob` | Normal/Visual | macOS/Win | Open link under cursor or search visual selection | | `Alt-j` | Normal | Linux/macOS/Win | Move current line or selected lines down |
| `ctrl-u` | Insert | Linux/macOS/Win | Turn word under cursor to upper case | | `Alt-m` | Normal | macOS/Win | Markdown previewing in system browser |
| `ctrl-t` | Insert | Linux/macOS/Win | Turn word under cursor to title case | | `Alt-Shift-m` | Normal | macOS/Win | Stopping Markdown previewing in system browser |
| `jk` | Insert | Linux/macOS/Win | Return to Normal mode without lagging | | `ob` | Normal/Visual | macOS/Win | Open link under cursor or search visual selection |
| `ctrl-u` | Insert | Linux/macOS/Win | Turn word under cursor to upper case |
| `ctrl-t` | Insert | Linux/macOS/Win | Turn word under cursor to title case |
| `jk` | Insert | Linux/macOS/Win | Return to Normal mode without lagging |
# Custom commands # Custom commands

View File

@@ -0,0 +1,8 @@
" Disable inserting comment leader after hitting o or O or <Enter>
set formatoptions-=o
set formatoptions-=r
set tabstop=2 " number of visual spaces per TAB
set softtabstop=2 " number of spaces in tab when editing
set shiftwidth=2 " number of spaces to use for autoindent
set expandtab " expand tab to spaces so that tabs are spaces

View File

@@ -131,9 +131,11 @@ function! utils#Get_titlestr() abort
if g:is_linux if g:is_linux
let l:title_str = hostname() . ' ' let l:title_str = hostname() . ' '
endif endif
let l:title_str = l:title_str . expand('%:p:~') . ' '
if &buflisted let l:buf_path = expand('%:p:~')
let l:title_str = l:title_str . strftime('%Y-%m-%d %H:%M',getftime(expand('%'))) let l:title_str = l:title_str . l:buf_path . ' '
if &buflisted && l:buf_path != ""
let l:title_str = l:title_str . strftime('%Y-%m-%d %H:%M:%S%z', getftime(expand('%')))
endif endif
return l:title_str return l:title_str

View File

@@ -41,26 +41,6 @@ function s:resume_cursor_position() abort
endif endif
endfunction endfunction
" Display a message when the current file is not in utf-8 format.
" Note that we need to use `unsilent` command here because of this issue:
" https://github.com/vim/vim/issues/4379
augroup non_utf8_file_warn
autocmd!
" we can not use `lua vim.notify()`: it will error out E5107 parsing lua.
autocmd BufRead * if &fileencoding != 'utf-8' | call v:lua.vim.notify('File not in UTF-8 format!', 'warn', {'title': 'nvim-config'}) | endif
augroup END
" Automatically reload the file if it is changed outside of Nvim, see
" https://unix.stackexchange.com/a/383044/221410. It seems that `checktime`
" command does not work in command line. We need to check if we are in command
" line before executing this command. See also
" https://vi.stackexchange.com/a/20397/15292.
augroup auto_read
autocmd!
autocmd FileChangedShellPost * call v:lua.vim.notify("File changed on disk. Buffer reloaded!", 'warn', {'title': 'nvim-config'})
autocmd FocusGained,CursorHold * if getcmdwintype() == '' | checktime | endif
augroup END
augroup numbertoggle augroup numbertoggle
autocmd! autocmd!
autocmd BufEnter,FocusGained,InsertLeave,WinEnter * if &nu | set rnu | endif autocmd BufEnter,FocusGained,InsertLeave,WinEnter * if &nu | set rnu | endif
@@ -88,12 +68,6 @@ function! s:custom_highlight() abort
highlight MatchParen cterm=bold,underline gui=bold,underline highlight MatchParen cterm=bold,underline gui=bold,underline
endfunction endfunction
" highlight yanked region, see `:h lua-highlight`
augroup highlight_yank
autocmd!
au TextYankPost * silent! lua vim.highlight.on_yank{higroup="YankColor", timeout=300, on_visual=false}
augroup END
augroup auto_close_win augroup auto_close_win
autocmd! autocmd!
autocmd BufEnter * call s:quit_current_win() autocmd BufEnter * call s:quit_current_win()
@@ -125,13 +99,25 @@ augroup git_repo_check
autocmd VimEnter,DirChanged * call utils#Inside_git_repo() autocmd VimEnter,DirChanged * call utils#Inside_git_repo()
augroup END augroup END
" Auto-generate packer_compiled.lua file " ref: https://vi.stackexchange.com/a/169/15292
augroup packer_auto_compile function! s:handle_large_file() abort
let g:large_file = 10485760 " 10MB
let f = expand("<afile>")
if getfsize(f) > g:large_file || getfsize(f) == -2
set eventignore+=all
" turning off relative number helps a lot
set norelativenumber
setlocal noswapfile bufhidden=unload buftype=nowrite undolevels=-1
else
set eventignore-=all relativenumber
endif
endfunction
augroup LargeFile
autocmd! autocmd!
autocmd BufWritePost */nvim/lua/plugins.lua source <afile> | PackerCompile autocmd BufReadPre * call s:handle_large_file()
augroup END augroup END
augroup auto_create_dir " Load auto-command defined in Lua
autocmd! lua require("custom-autocmd")
autocmd BufWritePre * lua require('utils').may_create_dir()
augroup END

View File

@@ -37,7 +37,9 @@ let g:mapleader = ','
let g:vimsyn_embed = 'l' let g:vimsyn_embed = 'l'
" Use English as main language " Use English as main language
language en_US.utf-8 if !g:is_mac
language en_US.utf-8
endif
" use filetype.lua instead of filetype.vim " use filetype.lua instead of filetype.vim
let g:do_filetype_lua = 1 let g:do_filetype_lua = 1

View File

@@ -87,7 +87,7 @@ xnoremap > >gv
inoremap <expr> <tab> pumvisible() ? "\<c-n>" : "\<tab>" inoremap <expr> <tab> pumvisible() ? "\<c-n>" : "\<tab>"
inoremap <expr> <s-tab> pumvisible() ? "\<c-p>" : "\<s-tab>" inoremap <expr> <s-tab> pumvisible() ? "\<c-p>" : "\<s-tab>"
" Edit and reload init.vim quickly " Edit and reload nvim config file quickly
nnoremap <silent> <leader>ev :<C-U>tabnew $MYVIMRC <bar> tcd %:h<cr> nnoremap <silent> <leader>ev :<C-U>tabnew $MYVIMRC <bar> tcd %:h<cr>
nnoremap <silent> <leader>sv :<C-U>silent update $MYVIMRC <bar> source $MYVIMRC <bar> nnoremap <silent> <leader>sv :<C-U>silent update $MYVIMRC <bar> source $MYVIMRC <bar>
\ call v:lua.vim.notify("Nvim config successfully reloaded!", 'info', {'title': 'nvim-config'})<cr> \ call v:lua.vim.notify("Nvim config successfully reloaded!", 'info', {'title': 'nvim-config'})<cr>
@@ -101,10 +101,6 @@ nnoremap / /\v
" Search in selected region " Search in selected region
xnoremap / :<C-U>call feedkeys('/\%>'.(line("'<")-1).'l\%<'.(line("'>")+1)."l")<CR> xnoremap / :<C-U>call feedkeys('/\%>'.(line("'<")-1).'l\%<'.(line("'>")+1)."l")<CR>
" Find and replace (like Sublime Text 3)
nnoremap <C-H> :%s/
xnoremap <C-H> :s/
" Change current working directory locally and print cwd after that, " Change current working directory locally and print cwd after that,
" see https://vim.fandom.com/wiki/Set_working_directory_to_the_current_file " see https://vim.fandom.com/wiki/Set_working_directory_to_the_current_file
nnoremap <silent> <leader>cd :<C-U>lcd %:p:h<CR>:pwd<CR> nnoremap <silent> <leader>cd :<C-U>lcd %:p:h<CR>:pwd<CR>
@@ -171,6 +167,7 @@ onoremap <silent> iB :<C-U>call text_obj#Buffer()<CR>
" Do not move my cursor when joining lines. " Do not move my cursor when joining lines.
nnoremap J mzJ`z nnoremap J mzJ`z
nnoremap gJ mzgJ`z
" Break inserted text into smaller undo units. " Break inserted text into smaller undo units.
for ch in [',', '.', '!', '?', ';', ':'] for ch in [',', '.', '!', '?', ';', ':']

View File

@@ -112,6 +112,9 @@ set shortmess+=c
" choice, IMHO. " choice, IMHO.
set shortmess+=S set shortmess+=S
" Disable showing intro message (:intro)
set shortmess+=I
" Completion behaviour " Completion behaviour
" set completeopt+=noinsert " Auto select the first completion entry " set completeopt+=noinsert " Auto select the first completion entry
set completeopt+=menuone " Show menu even if there is only one item set completeopt+=menuone " Show menu even if there is only one item
@@ -120,7 +123,7 @@ set completeopt-=preview " Disable the preview window
set pumheight=10 " Maximum number of items to show in popup menu set pumheight=10 " Maximum number of items to show in popup menu
set pumblend=10 " pseudo transparency for completion menu set pumblend=10 " pseudo transparency for completion menu
set winblend=5 " pseudo transparency for floating window set winblend=0 " pseudo transparency for floating window
" Insert mode key word completion setting " Insert mode key word completion setting
set complete+=kspell complete-=w complete-=b complete-=u complete-=t set complete+=kspell complete-=w complete-=b complete-=u complete-=t

View File

@@ -371,9 +371,16 @@ if exists('g:started_by_firenvim') && g:started_by_firenvim
\ } \ }
\ } \ }
function! s:setup_firenvim() abort
set noruler noshowcmd
set laststatus=0 showtabline=0
endfunction
augroup firenvim augroup firenvim
autocmd! autocmd!
autocmd BufEnter *.txt setlocal filetype=markdown laststatus=0 nonumber noshowcmd noruler showtabline=1 autocmd FileType text call s:setup_firenvim()
autocmd BufNewFile github.com_*.txt set filetype=markdown
autocmd BufNewFile stackoverflow.com_*.txt set filetype=markdown
augroup END augroup END
endif endif
@@ -425,3 +432,6 @@ function! s:wilder_init() abort
echohl Error |echomsg "Wilder.nvim missing: run :PackerSync to fix."|echohl None echohl Error |echomsg "Wilder.nvim missing: run :PackerSync to fix."|echohl None
endtry endtry
endfunction endfunction
""""""""""""""""""""""""""""""vim-auto-save settings""""""""""""""""""""""""""""""
let g:auto_save = 1 " enable AutoSave on Vim startup

View File

@@ -54,6 +54,13 @@ function! s:theme_setup_dict.kanagawa() dict abort
colorscheme kanagawa colorscheme kanagawa
endfunction endfunction
function! s:theme_setup_dict.catppuccin() dict abort
let g:catppuccin_flavour = "frappe" " latte, frappe, macchiato, mocha
lua require("catppuccin").setup()
colorscheme catppuccin
endfunction
" Theme to directory name mapping, because theme repo name is not necessarily " Theme to directory name mapping, because theme repo name is not necessarily
" the same as the theme name itself. " the same as the theme name itself.
let s:theme2dir = { let s:theme2dir = {
@@ -67,6 +74,7 @@ let s:theme2dir = {
\ 'everforest' :'everforest', \ 'everforest' :'everforest',
\ 'nightfox': 'nightfox.nvim', \ 'nightfox': 'nightfox.nvim',
\ 'kanagawa': 'kanagawa.nvim', \ 'kanagawa': 'kanagawa.nvim',
\ 'catppuccin': 'catppuccin'
\ } \ }
let s:theme = utils#RandElement(keys(s:theme2dir)) let s:theme = utils#RandElement(keys(s:theme2dir))
@@ -85,7 +93,7 @@ if !s:status
endif endif
execute 'call ' . s:colorscheme_func execute 'call ' . s:colorscheme_func
if g:logging_level == 'info' if g:logging_level == 'debug'
let s:msg1 = "Colorscheme: " . s:theme let s:msg1 = "Colorscheme: " . s:theme
call v:lua.vim.notify(s:msg1, 'info', {'title': 'nvim-config'}) call v:lua.vim.notify(s:msg1, 'info', {'title': 'nvim-config'})
endif endif

View File

@@ -2,9 +2,48 @@ This doc summarizes how to install and use this configuration in detail.
# Pre-requisite # Pre-requisite
## Terminal emulators
Which [terminal emulator](https://en.wikipedia.org/wiki/Terminal_emulator) we choose to use greatly affects the appearance and features of Nvim.
Since Nvim supports true colors, terminals that support true colors are preferred.
For a list of terminals that support true colors, see [here](https://github.com/termstandard/colors).
For macOS, we can use [kitty](https://sw.kovidgoyal.net/kitty/), [iterm2](https://www.iterm2.com/), [wezterm](https://wezfurlong.org/wezterm/) or [Alacritty](https://github.com/jwilm/alacritty).
If you ssh to Linux server on Windows, I recommend [wsltty](https://github.com/mintty/wsltty) and [Cygwin](https://www.cygwin.com/),
both of them use [mintty](https://github.com/mintty/mintty) as the terminal emulator.
For the latest version of Windows 10, you can also try [Windows Terminal](https://github.com/microsoft/terminal).
## Patched Fonts
Since statusline or file explorer plugins often use Unicode symbols not available in normal font,
we need to install a patched font from the [nerd-fonts](https://github.com/ryanoasis/nerd-fonts) project.
# Automatic installation
## Automatic Installation for Linux
To set up a workable Nvim environment on Linux,
I use [a bash script](nvim_setup_linux.sh) to automatically install necessary dependencies, Nvim itself and configs.
Note that the variable `PYTHON_INSTALLED`, `SYSTEM_PYTHON` and `ADD_TO_SYSTEM_PATH` in the script
should be set properly based on your environment.
## Automatic installation for Windows
Run the script [nvim_setup_windows.ps1](nvim_setup_windows.ps1) in PowerShell **with Administrator rights**:
```
.\docs\nvim_setup_windows.ps1
```
# Manual install
There are a few dependencies if we want to use Nvim for efficient editing and development work. There are a few dependencies if we want to use Nvim for efficient editing and development work.
## Python ## Dependencies
### Python
A lot of Nvim plugins are mainly written in Python, so we must install Python 3. A lot of Nvim plugins are mainly written in Python, so we must install Python 3.
The easiest way to install is via [Anaconda](https://docs.anaconda.com/anaconda/install/index.html) or [Miniconda](https://docs.conda.io/en/latest/miniconda.html). The easiest way to install is via [Anaconda](https://docs.anaconda.com/anaconda/install/index.html) or [Miniconda](https://docs.conda.io/en/latest/miniconda.html).
@@ -12,7 +51,7 @@ The easiest way to install is via [Anaconda](https://docs.anaconda.com/anaconda/
After installation, make sure that you can run `python --version`, After installation, make sure that you can run `python --version`,
and that the output should be Python 3.x. and that the output should be Python 3.x.
## Pynvim ### Pynvim
Nvim relies on [pynvim](https://github.com/neovim/pynvim) to communicate with plugins that utilize its Python binding. Nvim relies on [pynvim](https://github.com/neovim/pynvim) to communicate with plugins that utilize its Python binding.
Pynvim is required by plugins such as [wilder.nvim](https://github.com/gelguy/wilder.nvim). Pynvim is required by plugins such as [wilder.nvim](https://github.com/gelguy/wilder.nvim).
@@ -21,7 +60,7 @@ Pynvim is required by plugins such as [wilder.nvim](https://github.com/gelguy/wi
pip install -U pynvim pip install -U pynvim
``` ```
## python-lsp-server ### python-lsp-server
[python-lsp-server (pylsp)](https://github.com/python-lsp/python-lsp-server) is a Python [Language Server](https://microsoft.github.io/language-server-protocol/) for completion, linting, go to definition, etc. [python-lsp-server (pylsp)](https://github.com/python-lsp/python-lsp-server) is a Python [Language Server](https://microsoft.github.io/language-server-protocol/) for completion, linting, go to definition, etc.
@@ -33,7 +72,7 @@ Note the executable for pylsp is also named `pylsp`. You need to set its PATH co
If you use pip from Anaconda, the executable path may be something like `$CONDA_ROOT/bin/pylsp`. If you use pip from Anaconda, the executable path may be something like `$CONDA_ROOT/bin/pylsp`.
For native python, the path for pylsp may be like `$HOME/.local/bin/pylsp` For native python, the path for pylsp may be like `$HOME/.local/bin/pylsp`
## Node ### Node
We need to install node.js from [here](https://nodejs.org/en/download/). We need to install node.js from [here](https://nodejs.org/en/download/).
For Linux, you can use the following script: For Linux, you can use the following script:
@@ -60,7 +99,7 @@ source ~/.bash_profile
# source ~/.zshrc # source ~/.zshrc
``` ```
## vim-language-server ### vim-language-server
[vim-language-server](https://github.com/iamcco/vim-language-server) provides completion for vim script. We can install vim-language-server globally: [vim-language-server](https://github.com/iamcco/vim-language-server) provides completion for vim script. We can install vim-language-server globally:
@@ -70,7 +109,7 @@ npm install -g vim-language-server
vim-language-server is installed in the same directory as the node executable. vim-language-server is installed in the same directory as the node executable.
## Git ### Git
Git is required by plugin manager [packer.nvim](https://github.com/wbthomason/packer.nvim) and other git-related plugins. Git is required by plugin manager [packer.nvim](https://github.com/wbthomason/packer.nvim) and other git-related plugins.
@@ -79,7 +118,7 @@ The version of Git on the Linux system may be too old so that plugins may break.
Check [here](https://jdhao.github.io/2021/03/27/upgrade_git_on_linux/) on how to install and set up the latest version of Git. Check [here](https://jdhao.github.io/2021/03/27/upgrade_git_on_linux/) on how to install and set up the latest version of Git.
For Windows, install [Git for Windows](https://git-scm.com/download/win) and make sure you can run `git` from command line. For Windows, install [Git for Windows](https://git-scm.com/download/win) and make sure you can run `git` from command line.
## ctags ### ctags
In order to use tags related plugins such as [vista.vim](https://github.com/liuchengxu/vista.vim), we need to install a ctags distribution. In order to use tags related plugins such as [vista.vim](https://github.com/liuchengxu/vista.vim), we need to install a ctags distribution.
Universal-ctags is preferred. Universal-ctags is preferred.
@@ -102,7 +141,7 @@ choco install universal-ctags
Set its PATH properly and make sure you can run `ctags` from command line. Set its PATH properly and make sure you can run `ctags` from command line.
## Ripgrep ### Ripgrep
[Ripgrep](https://github.com/BurntSushi/ripgrep), aka, `rg`, is a fast grepping tool available for both Linux, Windows and macOS. [Ripgrep](https://github.com/BurntSushi/ripgrep), aka, `rg`, is a fast grepping tool available for both Linux, Windows and macOS.
It is used by several searching plugins. It is used by several searching plugins.
@@ -112,7 +151,7 @@ For Linux, we can download the [binary release](https://github.com/BurntSushi/ri
Set its PATH properly and make sure you can run `rg` from command line. Set its PATH properly and make sure you can run `rg` from command line.
## Linters ### Linters
A linter is a tool to check the source code for possible style and syntax issues. A linter is a tool to check the source code for possible style and syntax issues.
Based on the programming languages we use, we may need to install various linters. Based on the programming languages we use, we may need to install various linters.
@@ -122,35 +161,18 @@ Based on the programming languages we use, we may need to install various linter
Set their PATH properly and make sure you can run `pylint`, `flake8` and `vint` from command line. Set their PATH properly and make sure you can run `pylint`, `flake8` and `vint` from command line.
## Terminal emulators ## Install Nvim
Which [terminal emulator](https://en.wikipedia.org/wiki/Terminal_emulator) we choose to use greatly affects the appearance and features of Nvim.
Since Nvim supports true colors, terminals that support true colors are preferred.
For a list of terminals that support true colors, see [here](https://github.com/termstandard/colors).
For macOS, we can use [kitty](https://sw.kovidgoyal.net/kitty/), [iterm2](https://www.iterm2.com/), [wezterm](https://wezfurlong.org/wezterm/) or [Alacritty](https://github.com/jwilm/alacritty).
If you ssh to Linux server on Windows, I recommend [wsltty](https://github.com/mintty/wsltty) and [Cygwin](https://www.cygwin.com/),
both of them use [mintty](https://github.com/mintty/mintty) as the terminal emulator.
For the latest version of Windows 10, you can also try [Windows Terminal](https://github.com/microsoft/terminal).
## Patched Fonts
Since statusline or file explorer plugins often use Unicode symbols not available in normal font,
we need to install a patched font from the [nerd-fonts](https://github.com/ryanoasis/nerd-fonts) project.
# Install Nvim
There are various ways to install Nvim depending on your system. There are various ways to install Nvim depending on your system.
This config is only maintained for [the latest nvim stable release](https://github.com/neovim/neovim/releases/tag/stable). This config is only maintained for [the latest nvim stable release](https://github.com/neovim/neovim/releases/tag/stable).
## Linux ### Linux
You can directly download the binary release from [here](https://github.com/neovim/neovim/releases/download/stable/nvim-linux64.tar.gz). You can directly download the binary release from [here](https://github.com/neovim/neovim/releases/download/stable/nvim-linux64.tar.gz).
You can also use the system package manager to install nvim, You can also use the system package manager to install nvim,
but that is not reliable since the latest version may not be available. but that is not reliable since the latest version may not be available.
## Windows ### Windows
You may download from [nvim release](https://github.com/neovim/neovim/releases/download/stable/nvim-win64.zip) from GitHub and manually extract it. You may download from [nvim release](https://github.com/neovim/neovim/releases/download/stable/nvim-win64.zip) from GitHub and manually extract it.
@@ -164,7 +186,7 @@ choco install neovim
# scoop install neovim # scoop install neovim
``` ```
## macOS ### macOS
It is recommended to install neovim via [Homebrew](https://brew.sh/) on macOS. Simply run the following command: It is recommended to install neovim via [Homebrew](https://brew.sh/) on macOS. Simply run the following command:
@@ -175,9 +197,11 @@ brew install neovim
After installing Nvim, we need to set the path to nvim correctly. After installing Nvim, we need to set the path to nvim correctly.
**Make sure that you can run `nvim` from the command line after all these setups**. **Make sure that you can run `nvim` from the command line after all these setups**.
# Setting up Nvim ## Setting up Nvim
## Install plugin manager packer.nvim After installing nvim and all the dependencies, we will install plugin managers and set up this config.
### Install plugin manager packer.nvim
I use packer.nvim to manage my plugins. We need to install packer.nvim on our system first. I use packer.nvim to manage my plugins. We need to install packer.nvim on our system first.
@@ -193,7 +217,7 @@ For macOS and Linux, run the following command:
git clone --depth=1 https://github.com/wbthomason/packer.nvim ~/.local/share/nvim/site/pack/packer/opt/packer.nvim git clone --depth=1 https://github.com/wbthomason/packer.nvim ~/.local/share/nvim/site/pack/packer/opt/packer.nvim
``` ```
## How to install this configuration ### How to install this configuration
On Linux and macOS, the directory is `~/.config/nvim`. On Linux and macOS, the directory is `~/.config/nvim`.
On Windows, the config directory is `$HOME/AppData/Local/nvim`[^1]. On Windows, the config directory is `$HOME/AppData/Local/nvim`[^1].
@@ -207,18 +231,4 @@ git clone --depth=1 https://github.com/jdhao/nvim-config.git .
After that, when we first open nvim, run command `:PackerSync` to install all the plugins. After that, when we first open nvim, run command `:PackerSync` to install all the plugins.
Since I use quite a lot of plugins (more than 60), it may take some time to install all of them. Since I use quite a lot of plugins (more than 60), it may take some time to install all of them.
# Automatic installation
## Automatic Installation for Linux #
To set up a workable Nvim environment on Linux,
I use [a bash script](nvim_setup_linux.sh) to automatically install necessary dependencies, Nvim itself and configs.
Note that the variable `PYTHON_INSTALLED`, `SYSTEM_PYTHON` and `ADD_TO_SYSTEM_PATH` in the script
should be set properly based on your environment.
## Automatic installation for Windows
Run script [nvim_setup_windows.ps1](nvim_setup_windows.ps1) under PowerShell.
[^1]: Use `echo %userprofile%` to see where your `$HOME` is. [^1]: Use `echo %userprofile%` to see where your `$HOME` is.

View File

@@ -120,6 +120,35 @@ fi
# Install bash-language-server # Install bash-language-server
"$NODE_DIR/bin/npm" install -g bash-language-server "$NODE_DIR/bin/npm" install -g bash-language-server
#######################################################################
# lua-language-server #
#######################################################################
SUMNEKO_LUA_DIR=$HOME/tools/lua-language-server
SUMNEKO_LUA_SRC_NAME=$HOME/packages/lua-language-server.tar.gz
SUMNEKO_LUA_LINK="https://github.com/sumneko/lua-language-server/releases/download/3.5.3/lua-language-server-3.5.3-linux-x64.tar.gz"
if [[ -z "$(command -v lua-language-server)" ]] && [[ ! -f "$SUMNEKO_LUA_DIR/bin/lua-language-server" ]]; then
echo 'Install lua-language-server'
if [[ ! -f $SUMNEKO_LUA_SRC_NAME ]]; then
echo "Downloading lua-language-server and renaming"
wget $SUMNEKO_LUA_LINK -O "$SUMNEKO_LUA_SRC_NAME"
fi
if [[ ! -d "$SUMNEKO_LUA_DIR" ]]; then
echo "Creating lua-language-server directory under tools directory"
mkdir -p "$SUMNEKO_LUA_DIR"
echo "Extracting to directory $SUMNEKO_LUA_DIR"
tar zxvf "$SUMNEKO_LUA_SRC_NAME" -C "$SUMNEKO_LUA_DIR"
fi
if [[ "$ADD_TO_SYSTEM_PATH" = true ]] && [[ "$USE_BASH_SHELL" = true ]]; then
echo "export PATH=\"$SUMNEKO_LUA_DIR/bin:\$PATH\"" >> "$HOME/.bash_profile"
fi
else
echo "lua-language-server is already installed. Skip installing it."
fi
####################################################################### #######################################################################
# Ripgrep part # # Ripgrep part #
####################################################################### #######################################################################
@@ -145,8 +174,8 @@ if [[ -z "$(command -v rg)" ]] && [[ ! -f "$RIPGREP_DIR/rg" ]]; then
fi fi
# set up manpath and zsh completion for ripgrep # set up manpath and zsh completion for ripgrep
mkdir -p $HOME/tools/ripgrep/doc/man/man1 mkdir -p "$HOME/tools/ripgrep/doc/man/man1"
mv $HOME/tools/ripgrep/doc/rg.1 $HOME/tools/ripgrep/doc/man/man1 mv "$HOME/tools/ripgrep/doc/rg.1" "$HOME/tools/ripgrep/doc/man/man1"
if [[ "$USE_BASH_SHELL" = true ]]; then if [[ "$USE_BASH_SHELL" = true ]]; then
echo 'export MANPATH=$HOME/tools/ripgrep/doc/man:$MANPATH' >> "$HOME/.bash_profile" echo 'export MANPATH=$HOME/tools/ripgrep/doc/man:$MANPATH' >> "$HOME/.bash_profile"

View File

@@ -1,6 +1,8 @@
# Install scoop # Set policy to avoid errors
Set-ExecutionPolicy RemoteSigned -scope CurrentUser Set-ExecutionPolicy RemoteSigned -scope CurrentUser
iwr -useb get.scoop.sh | iex
# Install scoop
Invoke-WebRequest -UseBasicParsing get.scoop.sh | Invoke-Expression
# Install node # Install node
scoop install nodejs scoop install nodejs
@@ -18,7 +20,7 @@ npm install -g vim-language-server
# Install bash-language-server # Install bash-language-server
npm install -g bash-language-server npm install -g bash-language-server
# Install miniconda3 # Install miniconda3 (for Python)
scoop install miniconda3 scoop install miniconda3
# Install pynvim # Install pynvim
@@ -27,6 +29,27 @@ pip install -U pynvim
# Install python-language-server # Install python-language-server
pip install 'python-lsp-server[all]' pylsp-mypy pyls-isort pip install 'python-lsp-server[all]' pylsp-mypy pyls-isort
# Install visual c++ redistribution
scoop install vcredist2022
# Install 7zip
scoop install 7zip
# Install lua-language-server
$sumneko_lua_link = "https://github.com/sumneko/lua-language-server/releases/download/3.5.3/lua-language-server-3.5.3-win32-x64.zip"
$sumneko_lua_install_dir = "D:\portable_tools"
$sumneko_lua_src_dir = "$sumneko_lua_install_dir\lua-language-server.zip"
$sumneko_lua_dir = "$sumneko_lua_install_dir\lua-language-server"
# Download file, ref: https://stackoverflow.com/a/51225744/6064933
Invoke-WebRequest $sumneko_lua_link -OutFile "$sumneko_lua_src_dir"
# Extract the zip file using 7zip, ref: https://stackoverflow.com/a/41933215/6064933
7z x "$sumneko_lua_src_dir" -o"$sumneko_lua_dir"
# Setup PATH env variable, ref: https://stackoverflow.com/q/714877/6064933
[Environment]::SetEnvironmentVariable("Path", $env:Path + ";$sumneko_lua_dir\bin", "Machine")
# Install neovim nightly # Install neovim nightly
scoop bucket add versions scoop bucket add versions
scoop install neovim scoop install neovim

37
init.lua Normal file
View File

@@ -0,0 +1,37 @@
-- This is my personal Nvim configuration supporting Mac, Linux and Windows, with various plugins configured.
-- This configuration evolves as I learn more about Nvim and become more proficient in using Nvim.
-- Since it is very long (more than 1000 lines!), you should read it carefully and take only the settings that suit you.
-- I would not recommend cloning this repo and replace your own config. Good configurations are personal,
-- built over time with a lot of polish.
--
-- Author: Jie-dong Hao
-- Email: jdhao@hotmail.com
-- Blog: https://jdhao.github.io/
-- check if we have the latest stable version of nvim
local expected_ver = "0.7.2"
local utils = require "utils"
local nvim_ver = utils.get_nvim_version()
if nvim_ver ~= expected_ver then
local msg = string.format("Unsupported nvim version: expect %s, but got %s instead!", expected_ver, nvim_ver)
vim.api.nvim_echo({ { msg, "ErrorMsg" } }, false, {})
return
end
local core_conf_files = {
"globals.vim",
"options.vim",
"autocommands.vim",
"mappings.vim",
"plugins.vim",
"themes.vim",
}
-- source all the core config files
for _, name in ipairs(core_conf_files) do
local path = string.format("%s/core/%s", vim.fn.stdpath('config'), name)
local source_cmd = "source " .. path
vim.cmd(source_cmd)
end

View File

@@ -1,31 +0,0 @@
" This is my personal Nvim configuration supporting Mac, Linux and Windows, with various plugins configured.
" This configuration evolves as I learn more about Nvim and become more proficient in using Nvim.
" Since it is very long (more than 1000 lines!), you should read it carefully and take only the settings that suit you.
" I would not recommend cloning this repo and replace your own config. Good configurations are personal,
" built over time with a lot of polish.
"
" Author: Jie-dong Hao
" Email: jdhao@hotmail.com
" Blog: https://jdhao.github.io/
" check if we have the lastest stable version of nvim
let s:expect_ver = printf('nvim-%s', '0.7.2')
let s:actual_ver = matchstr(execute('version'), 'NVIM v\zs[^\n]*')
if !has(s:expect_ver)
echohl Error | echomsg printf("%s required, but got nvim %s!", s:expect_ver, s:actual_ver) | echohl None
finish
endif
let s:core_conf_files = [
\ 'globals.vim',
\ 'options.vim',
\ 'autocommands.vim',
\ 'mappings.vim',
\ 'plugins.vim',
\ 'themes.vim'
\ ]
for s:fname in s:core_conf_files
execute printf('source %s/core/%s', stdpath('config'), s:fname)
endfor

View File

@@ -1,32 +0,0 @@
local alpha = require("alpha")
local dashboard = require("alpha.themes.dashboard")
-- Set header
dashboard.section.header.val = {
" ",
" ███╗ ██╗███████╗ ██████╗ ██╗ ██╗██╗███╗ ███╗ ",
" ████╗ ██║██╔════╝██╔═══██╗██║ ██║██║████╗ ████║ ",
" ██╔██╗ ██║█████╗ ██║ ██║██║ ██║██║██╔████╔██║ ",
" ██║╚██╗██║██╔══╝ ██║ ██║╚██╗ ██╔╝██║██║╚██╔╝██║ ",
" ██║ ╚████║███████╗╚██████╔╝ ╚████╔╝ ██║██║ ╚═╝ ██║ ",
" ╚═╝ ╚═══╝╚══════╝ ╚═════╝ ╚═══╝ ╚═╝╚═╝ ╚═╝ ",
" ",
}
-- Set menu
dashboard.section.buttons.val = {
dashboard.button( "Leader f f", " > Find file", ":Leaderf file --popup<CR>"),
dashboard.button( "Leader f r", " > Recent files" , ":Leaderf mru --popup<CR>"),
dashboard.button( "Leader f g", " > Project grep" , ":Leaderf rg --popup<CR>"),
dashboard.button( "u", " > Update plugins" , ":PackerSync<CR>"),
dashboard.button( "e", " > New file" , ":enew <CR>"),
dashboard.button( "q", " > Quit NVIM", ":qa<CR>"),
}
local fortune = require("alpha.fortune")
dashboard.section.footer.val = fortune()
alpha.setup(dashboard.opts)
-- Send config to alpha
alpha.setup(dashboard.opts)

View File

@@ -1,15 +0,0 @@
require("autosave").setup({
enabled = true,
execution_message = "Autosaved at " .. vim.fn.strftime("%H:%M:%S"),
events = { "InsertLeave", "TextChanged" },
conditions = {
exists = true,
filename_is_not = {"plugins.lua"},
filetype_is_not = {},
modifiable = true,
},
write_all_buffers = false,
on_off_commands = true,
clean_command_line_interval = 1000,
debounce_delay = 135,
})

View File

@@ -0,0 +1,65 @@
local dashboard = require("dashboard")
dashboard.custom_header = {
" ",
" ",
" ",
" ███╗ ██╗ ███████╗ ██████╗ ██╗ ██╗ ██╗ ███╗ ███╗",
" ████╗ ██║ ██╔════╝██╔═══██╗ ██║ ██║ ██║ ████╗ ████║",
" ██╔██╗ ██║ █████╗ ██║ ██║ ██║ ██║ ██║ ██╔████╔██║",
" ██║╚██╗██║ ██╔══╝ ██║ ██║ ╚██╗ ██╔╝ ██║ ██║╚██╔╝██║",
" ██║ ╚████║ ███████╗╚██████╔╝ ╚████╔╝ ██║ ██║ ╚═╝ ██║",
" ╚═╝ ╚═══╝ ╚══════╝ ╚═════╝ ╚═══╝ ╚═╝ ╚═╝ ╚═╝",
" ",
" ",
" ",
" ",
}
dashboard.custom_center = {
{
icon = "",
desc = "Find File ",
action = "Leaderf file --popup",
shortcut = "<Leader> f f",
},
{
icon = "",
desc = "Recently opened files ",
action = "Leaderf mru --popup",
shortcut = "<Leader> f r",
},
{
icon = "",
desc = "Project grep ",
action = "Leaderf rg --popup",
shortcut = "<Leader> f g",
},
{
icon = "",
desc = "Open Nvim config ",
action = "tabnew $MYVIMRC | tcd %:p:h",
shortcut = "<Leader> e v",
},
{
icon = "",
desc = "New file ",
action = "enew",
shortcut = "e ",
},
{
icon = "",
desc = "Quit Nvim ",
-- desc = "Quit Nvim ",
action = "qa",
shortcut = "q "
}
}
vim.cmd([[
augroup dashboard_enter
au!
autocmd FileType dashboard nnoremap <buffer> q :qa<CR>
autocmd FileType dashboard nnoremap <buffer> e :enew<CR>
augroup END
]])

View File

@@ -0,0 +1 @@
require"fidget".setup{}

View File

@@ -13,7 +13,7 @@ local custom_attach = function(client, bufnr)
vim.keymap.set("n", "<C-k>", vim.lsp.buf.signature_help, opts) vim.keymap.set("n", "<C-k>", vim.lsp.buf.signature_help, opts)
vim.keymap.set("n", "<space>wa", vim.lsp.buf.add_workspace_folder, opts) vim.keymap.set("n", "<space>wa", vim.lsp.buf.add_workspace_folder, opts)
vim.keymap.set("n", "<space>wr", vim.lsp.buf.remove_workspace_folder, opts) vim.keymap.set("n", "<space>wr", vim.lsp.buf.remove_workspace_folder, opts)
vim.keymap.set("n", "<space>wl", function() print(vim.inspect(vim.lsp.buf.list_workspace_folders())) end, opts) vim.keymap.set("n", "<space>wl", function() inspect(vim.lsp.buf.list_workspace_folders()) end, opts)
vim.keymap.set("n", "<space>rn", vim.lsp.buf.rename, opts) vim.keymap.set("n", "<space>rn", vim.lsp.buf.rename, opts)
vim.keymap.set("n", "gr", vim.lsp.buf.references, opts) vim.keymap.set("n", "gr", vim.lsp.buf.references, opts)
vim.keymap.set("n", "[d", vim.diagnostic.goto_prev, opts) vim.keymap.set("n", "[d", vim.diagnostic.goto_prev, opts)
@@ -21,10 +21,10 @@ local custom_attach = function(client, bufnr)
vim.keymap.set("n", "<space>q", function() vim.diagnostic.setqflist({open = true}) end, opts) vim.keymap.set("n", "<space>q", function() vim.diagnostic.setqflist({open = true}) end, opts)
vim.keymap.set("n", "<space>ca", vim.lsp.buf.code_action, opts) vim.keymap.set("n", "<space>ca", vim.lsp.buf.code_action, opts)
vim.api.nvim_create_autocmd("CursorHold", { api.nvim_create_autocmd("CursorHold", {
buffer=bufnr, buffer=bufnr,
callback = function() callback = function()
local opts = { local float_opts = {
focusable = false, focusable = false,
close_events = { "BufLeave", "CursorMoved", "InsertEnter", "FocusLost" }, close_events = { "BufLeave", "CursorMoved", "InsertEnter", "FocusLost" },
border = 'rounded', border = 'rounded',
@@ -36,11 +36,11 @@ local custom_attach = function(client, bufnr)
vim.b.diagnostics_pos = { nil, nil } vim.b.diagnostics_pos = { nil, nil }
end end
local cursor_pos = vim.api.nvim_win_get_cursor(0) local cursor_pos = api.nvim_win_get_cursor(0)
if (cursor_pos[1] ~= vim.b.diagnostics_pos[1] or cursor_pos[2] ~= vim.b.diagnostics_pos[2]) and if (cursor_pos[1] ~= vim.b.diagnostics_pos[1] or cursor_pos[2] ~= vim.b.diagnostics_pos[2]) and
#vim.diagnostic.get() > 0 #vim.diagnostic.get() > 0
then then
vim.diagnostic.open_float(nil, opts) vim.diagnostic.open_float(nil, float_opts)
end end
vim.b.diagnostics_pos = cursor_pos vim.b.diagnostics_pos = cursor_pos
@@ -148,36 +148,30 @@ if utils.executable('bash-language-server') then
}) })
end end
local sumneko_binary_path = fn.exepath("lua-language-server") if utils.executable("lua-language-server") then
if vim.g.is_mac or vim.g.is_linux and sumneko_binary_path ~= "" then -- settings for lua-language-server can be found on https://github.com/sumneko/lua-language-server/wiki/Settings .
local sumneko_root_path = fn.fnamemodify(sumneko_binary_path, ":h:h:h")
local runtime_path = vim.split(package.path, ";")
table.insert(runtime_path, "lua/?.lua")
table.insert(runtime_path, "lua/?/init.lua")
lspconfig.sumneko_lua.setup({ lspconfig.sumneko_lua.setup({
on_attach = custom_attach, on_attach = custom_attach,
cmd = { sumneko_binary_path, "-E", sumneko_root_path .. "/main.lua" },
settings = { settings = {
Lua = { Lua = {
runtime = { runtime = {
-- Tell the language server which version of Lua you're using (most likely LuaJIT in the case of Neovim) -- Tell the language server which version of Lua you're using (most likely LuaJIT in the case of Neovim)
version = "LuaJIT", version = "LuaJIT",
-- Setup your lua path
path = runtime_path,
}, },
diagnostics = { diagnostics = {
-- Get the language server to recognize the `vim` global -- Get the language server to recognize the `vim` global
globals = { "vim" }, globals = { "vim" },
}, },
workspace = { workspace = {
-- Make the server aware of Neovim runtime files -- Make the server aware of Neovim runtime files,
library = api.nvim_get_runtime_file("", true), -- see also https://github.com/sumneko/lua-language-server/wiki/Libraries#link-to-workspace .
}, -- Lua-dev.nvim also has similar settings for sumneko lua, https://github.com/folke/lua-dev.nvim/blob/main/lua/lua-dev/sumneko.lua .
-- Do not send telemetry data containing a randomized but unique identifier library = {
telemetry = { fn.stdpath('data') .. "/site/pack/packer/opt/emmylua-nvim",
enable = false, fn.stdpath('config'),
},
maxPreload = 2000,
preloadFileSize = 50000,
}, },
}, },
}, },

View File

@@ -33,7 +33,6 @@ cmp.setup({
sources = { sources = {
{ name = 'nvim_lsp' }, -- For nvim-lsp { name = 'nvim_lsp' }, -- For nvim-lsp
{ name = 'ultisnips' }, -- For ultisnips user. { name = 'ultisnips' }, -- For ultisnips user.
{ name = 'nvim_lua' }, -- for nvim lua function
{ name = 'path' }, -- for path completion { name = 'path' }, -- for path completion
{ name = 'buffer', keyword_length = 4 }, -- for buffer word completion { name = 'buffer', keyword_length = 4 }, -- for buffer word completion
{ name = 'omni' }, { name = 'omni' },

View File

@@ -21,20 +21,36 @@ local function ime_state()
end end
local function trailing_space() local function trailing_space()
-- Get the positions of trailing whitespaces from plugin 'jdhao/whitespace.nvim'. if not vim.o.modifiable then
local trailing_space_pos = vim.b.trailing_whitespace_pos return ""
end
local line_num = nil
for i=1, fn.line('$') do
local linetext = fn.getline(i)
-- To prevent invalid escape error, we wrap the regex string with `[[]]`.
local idx = fn.match(linetext, [[\v\s+$]])
if idx ~= -1 then
line_num = i
break
end
end
local msg = "" local msg = ""
if #trailing_space_pos > 0 then if line_num ~= nil then
-- Note that lua index is 1-based, not zero based!!! msg = string.format("[%d]trailing", line_num)
local line = trailing_space_pos[1][1]
msg = string.format("[%d]trailing", line)
end end
return msg return msg
end end
local function mixed_indent() local function mixed_indent()
if not vim.o.modifiable then
return ""
end
local space_pat = [[\v^ +]] local space_pat = [[\v^ +]]
local tab_pat = [[\v^\t+]] local tab_pat = [[\v^\t+]]
local space_indent = fn.search(space_pat, 'nwc') local space_indent = fn.search(space_pat, 'nwc')

89
lua/custom-autocmd.lua Normal file
View File

@@ -0,0 +1,89 @@
local fn = vim.fn
local api = vim.api
local utils = require("utils")
-- Display a message when the current file is not in utf-8 format.
-- Note that we need to use `unsilent` command here because of this issue:
-- https://github.com/vim/vim/issues/4379
api.nvim_create_augroup("non_utf8_file", {
clear = true
})
api.nvim_create_autocmd({ "BufRead" }, {
pattern = "*",
group = "non_utf8_file",
callback = function()
if vim.bo.fileencoding ~= 'utf-8' then
vim.notify("File not in UTF-8 format!", vim.log.levels.WARN, { title = "nvim-config" })
end
end
})
-- highlight yanked region, see `:h lua-highlight`
api.nvim_create_augroup("highlight_yank", {
clear = true
})
api.nvim_create_autocmd({ "TextYankPost" }, {
pattern = "*",
group = "highlight_yank",
callback = function()
vim.highlight.on_yank { higroup = "YankColor", timeout = 300, on_visual = false }
end
})
-- Auto-generate packer_compiled.lua file
api.nvim_create_augroup("packer_auto_compile", {
clear = true
})
api.nvim_create_autocmd({ "BufWritePost" }, {
pattern = "*/nvim/lua/plugins.lua",
group = "packer_auto_compile",
callback = function(ctx)
local cmd = "source " .. ctx.file
vim.cmd(cmd)
vim.cmd("PackerCompile")
end
})
-- Auto-create dir when saving a file, in case some intermediate directory does not exist
api.nvim_create_augroup("auto_create_dir", {
clear = true
})
api.nvim_create_autocmd({ "BufWritePre" }, {
pattern = "*",
group = "auto_create_dir",
callback = function(ctx)
local dir = fn.fnamemodify(ctx.file, ":p:h")
utils.may_create_dir(dir)
end
})
-- Automatically reload the file if it is changed outside of Nvim, see https://unix.stackexchange.com/a/383044/221410.
-- It seems that `checktime` does not work in command line. We need to check if we are in command
-- line before executing this command, see also https://vi.stackexchange.com/a/20397/15292 .
api.nvim_create_augroup("auto_read", {
clear = true
})
api.nvim_create_autocmd({ "FileChangedShellPost" }, {
pattern = "*",
group = "auto_read",
callback = function()
vim.notify("File changed on disk. Buffer reloaded!", vim.log.levels.WARN, { title = "nvim-config" })
end
})
api.nvim_create_autocmd({ "FocusGained", "CursorHold" }, {
pattern = "*",
group = "auto_read",
callback = function()
if fn.getcmdwintype() == '' then
vim.cmd("checktime")
end
end
})

View File

@@ -1,8 +1,11 @@
local keymap = vim.keymap local keymap = vim.keymap
-- Go to the begining and end of current line in insert mode quickly -- Go to the beginning and end of current line in insert mode quickly
keymap.set('i', '<C-A>', '<HOME>') keymap.set('i', '<C-A>', '<HOME>')
keymap.set('i', '<C-E>', '<END>') keymap.set('i', '<C-E>', '<END>')
-- Go to beginning of command in command-line mode
keymap.set('c', '<C-A>', '<HOME>')
-- Delete the character to the right of the cursor -- Delete the character to the right of the cursor
keymap.set('i', '<C-D>', '<DEL>') keymap.set('i', '<C-D>', '<DEL>')

View File

@@ -1,23 +1,34 @@
local utils = require("utils") local utils = require("utils")
local fn = vim.fn local fn = vim.fn
vim.g.package_home = fn.stdpath("data") .. "/site/pack/packer/" -- The root dir to install all plugins. Plugins are under opt/ or start/ sub-directory.
local packer_install_dir = vim.g.package_home .. "/opt/packer.nvim" vim.g.plugin_home = fn.stdpath("data") .. "/site/pack/packer"
local packer_repo = "https://github.com/wbthomason/packer.nvim" -- Where to install packer.nvim -- the package manager (we make it opt)
local install_cmd = string.format("10split |term git clone --depth=1 %s %s", packer_repo, packer_install_dir) local packer_dir = vim.g.plugin_home .. "/opt/packer.nvim"
-- Whether this is a fresh install, i.e., packer itself and plugins have not been installed.
local fresh_install = false
-- Auto-install packer in case it hasn't been installed. -- Auto-install packer in case it hasn't been installed.
if fn.glob(packer_install_dir) == "" then if fn.glob(packer_dir) == "" then
fresh_install = true
-- Now we need to install packer.nvim first.
local packer_repo = "https://github.com/wbthomason/packer.nvim"
local install_cmd = string.format("!git clone --depth=1 %s %s", packer_repo, packer_dir)
vim.api.nvim_echo({ { "Installing packer.nvim", "Type" } }, true, {}) vim.api.nvim_echo({ { "Installing packer.nvim", "Type" } }, true, {})
vim.cmd(install_cmd) vim.cmd(install_cmd)
end end
-- Load packer.nvim -- Load packer.nvim
vim.cmd("packadd packer.nvim") vim.cmd("packadd packer.nvim")
local util = require('packer.util')
require("packer").startup({ local packer = require("packer")
local packer_util = require('packer.util')
packer.startup({
function(use) function(use)
-- it is recommened to put impatient.nvim before any other plugins -- it is recommened to put impatient.nvim before any other plugins
use {'lewis6991/impatient.nvim', config = [[require('impatient')]]} use {'lewis6991/impatient.nvim', config = [[require('impatient')]]}
@@ -30,7 +41,7 @@ require("packer").startup({
-- nvim-cmp completion sources -- nvim-cmp completion sources
use {"hrsh7th/cmp-nvim-lsp", after = "nvim-cmp"} use {"hrsh7th/cmp-nvim-lsp", after = "nvim-cmp"}
use {"hrsh7th/cmp-nvim-lua", after = "nvim-cmp"} -- use {"hrsh7th/cmp-nvim-lua", after = "nvim-cmp"}
use {"hrsh7th/cmp-path", after = "nvim-cmp"} use {"hrsh7th/cmp-path", after = "nvim-cmp"}
use {"hrsh7th/cmp-buffer", after = "nvim-cmp"} use {"hrsh7th/cmp-buffer", after = "nvim-cmp"}
use { "hrsh7th/cmp-omni", after = "nvim-cmp" } use { "hrsh7th/cmp-omni", after = "nvim-cmp" }
@@ -119,6 +130,7 @@ require("packer").startup({
use({"sainnhe/everforest", opt = true}) use({"sainnhe/everforest", opt = true})
use({"EdenEast/nightfox.nvim", opt = true}) use({"EdenEast/nightfox.nvim", opt = true})
use({"rebelot/kanagawa.nvim", opt = true}) use({"rebelot/kanagawa.nvim", opt = true})
use({"catppuccin/nvim", as = "catppuccin", opt = true})
-- Show git change (change, delete, add) signs in vim sign column -- Show git change (change, delete, add) signs in vim sign column
use({"mhinz/vim-signify", event = 'BufEnter'}) use({"mhinz/vim-signify", event = 'BufEnter'})
@@ -136,7 +148,7 @@ require("packer").startup({
use({ "akinsho/bufferline.nvim", event = "VimEnter", config = [[require('config.bufferline')]] }) use({ "akinsho/bufferline.nvim", event = "VimEnter", config = [[require('config.bufferline')]] })
-- fancy start screen -- fancy start screen
-- use { 'goolord/alpha-nvim', event = 'VimEnter', config = [[require('config.alpha-nvim')]] } use { 'glepnir/dashboard-nvim', event = "VimEnter", config = [[require('config.dashboard-nvim')]] }
use({ use({
"lukas-reineke/indent-blankline.nvim", "lukas-reineke/indent-blankline.nvim",
@@ -183,13 +195,7 @@ require("packer").startup({
-- use 'mg979/vim-visual-multi' -- use 'mg979/vim-visual-multi'
-- Autosave files on certain events -- Autosave files on certain events
use({ use({"907th/vim-auto-save", event = "InsertEnter"})
"Pocco81/AutoSave.nvim",
event = "VimEnter",
config = function()
vim.defer_fn(function() require('config.autosave') end, 1500)
end
})
-- Show undo history visually -- Show undo history visually
use({"simnalamburt/vim-mundo", cmd = {"MundoToggle", "MundoShow"}}) use({"simnalamburt/vim-mundo", cmd = {"MundoToggle", "MundoShow"}})
@@ -356,14 +362,25 @@ require("packer").startup({
requires = { 'kyazdani42/nvim-web-devicons' }, requires = { 'kyazdani42/nvim-web-devicons' },
config = [[require('config.nvim-tree')]] config = [[require('config.nvim-tree')]]
} }
use { 'ii14/emmylua-nvim', ft = 'lua' }
use { 'j-hui/fidget.nvim', after = 'nvim-lspconfig', config = [[require('config.fidget-nvim')]]}
end, end,
config = { config = {
max_jobs = 16, max_jobs = 16,
compile_path = util.join_paths(fn.stdpath('data'), 'site', 'lua', 'packer_compiled.lua'), compile_path = packer_util.join_paths(fn.stdpath('data'), 'site', 'lua', 'packer_compiled.lua'),
}, },
}) })
local status, _ = pcall(require, 'packer_compiled') -- For fresh install, we need to install plugins. Otherwise, we just need to require `packer_compiled.lua`.
if not status then if fresh_install then
-- We can command `PackerSync` here, because only after packer.startup, we can know what plugins to install.
-- So plugin install should be done after the startup process.
vim.cmd("PackerSync")
else
local status, _ = pcall(require, 'packer_compiled')
if not status then
vim.notify("Error requiring packer_compiled.lua: run PackerSync to fix!") vim.notify("Error requiring packer_compiled.lua: run PackerSync to fix!")
end
end end

View File

@@ -1,7 +1,7 @@
local fn = vim.fn local fn = vim.fn
-- inspect something -- inspect something
function inspect(item) function _G.inspect(item)
vim.pretty_print(item) vim.pretty_print(item)
end end
@@ -15,14 +15,20 @@ function M.executable(name)
return false return false
end end
function M.may_create_dir() --- Create a dir if if does not exist
local fpath = fn.expand('<afile>') function M.may_create_dir(dir)
local parent_dir = fn.fnamemodify(fpath, ":p:h") local res = fn.isdirectory(dir)
local res = fn.isdirectory(parent_dir)
if res == 0 then if res == 0 then
fn.mkdir(parent_dir, 'p') fn.mkdir(dir, 'p')
end end
end end
function M.get_nvim_version()
local actual_ver = vim.version()
local nvim_ver_str = string.format("%d.%d.%d", actual_ver.major, actual_ver.minor, actual_ver.patch)
return nvim_ver_str
end
return M return M

View File

@@ -47,7 +47,7 @@ $0
endsnippet endsnippet
snippet font "HTML font tag" snippet font "HTML font tag"
<font color="${1:red}">${2:TEXT}</font> <font color="${1:blue}">${2:TEXT}</font>
endsnippet endsnippet
snippet link "Markdown links" snippet link "Markdown links"

View File

@@ -8,3 +8,40 @@ call utils#Cabbrev('man', 'Man')
" show current date and time in human readable format " show current date and time in human readable format
command! -nargs=? Datetime echo utils#iso_time(<q-args>) command! -nargs=? Datetime echo utils#iso_time(<q-args>)
" Convert Markdown file to PDF
command! ToPDF call s:md_to_pdf()
function! s:md_to_pdf() abort
" check if pandoc is installed
if executable('pandoc') != 1
echoerr "pandoc not found"
return
endif
let l:md_path = expand("%:p")
let l:pdf_path = fnamemodify(l:md_path, ":r") .. ".pdf"
let l:header_path = stdpath('config') . '/resources/head.tex'
let l:cmd = "pandoc --pdf-engine=xelatex --highlight-style=zenburn --table-of-content " .
\ "--include-in-header=" . l:header_path . " -V fontsize=10pt -V colorlinks -V toccolor=NavyBlue " .
\ "-V linkcolor=red -V urlcolor=teal -V filecolor=magenta -s " .
\ l:md_path . " -o " . l:pdf_path
if g:is_mac
let l:cmd = l:cmd . '&& open ' . l:pdf_path
endif
if g:is_win
let l:cmd = l:cmd . '&& start ' . l:pdf_path
endif
" echomsg l:cmd
let l:id = jobstart(l:cmd)
if l:id == 0 || l:id == -1
echoerr "Error running command"
endif
endfunction

78
resources/head.tex Normal file
View File

@@ -0,0 +1,78 @@
\usepackage{fancyvrb,newverbs}
\usepackage[top=2cm, bottom=1.5cm, left=2cm, right=2cm]{geometry}
\PassOptionsToPackage{dvipsnames,svgnames,x11names}{xcolor}
\usepackage{hyperref}
% begin a new page for each section (first level header),
% we need to combine this with `-V subparagraph` when invoking pandc
% \usepackage{titlesec}
% \newcommand{\sectionbreak}{\clearpage}
% change background color for inline code in markdown files.
% The following code does not work well for long text, because the text will exceed the page boundary.
\definecolor{bgcolor}{HTML}{DADADA}
\let\oldtexttt\texttt
\renewcommand{\texttt}[1]{
\colorbox{bgcolor}{\oldtexttt{#1}}
}
% change style of quote, see also https://tex.stackexchange.com/a/436253/114857
\usepackage[most]{tcolorbox}
\definecolor{linequote}{RGB}{224,215,188}
\definecolor{backquote}{RGB}{249,245,233}
\definecolor{bordercolor}{RGB}{221,221,221}
% change left border: https://tex.stackexchange.com/a/475716/114857
% change left margin: https://tex.stackexchange.com/a/457936/114857
\newtcolorbox{myquote}[1][]{%
enhanced,
breakable,
size=minimal,
left=10pt,
top=5pt,
bottom=5pt,
frame hidden,
boxrule=0pt,
sharp corners=all,
colback=backquote,
borderline west={2pt}{0pt}{bordercolor},
#1
}
% redefine quote environment to use the myquote environment, see https://tex.stackexchange.com/a/337587/114857
\renewenvironment{quote}{\begin{myquote}}{\end{myquote}}
% start a new page after toc, we need to save the old command before defining
% new one to avoid recursive command calls,
% see https://tex.stackexchange.com/questions/47351/can-i-redefine-a-command-to-contain-itself
\let\oldtoc\tableofcontents
\renewcommand{\tableofcontents}{\oldtoc\newpage}
% fix header level issue
\usepackage{enumitem}
\setlistdepth{9}
\setlist[itemize,1]{label=$\bullet$}
\setlist[itemize,2]{label=$\bullet$}
\setlist[itemize,3]{label=$\bullet$}
\setlist[itemize,4]{label=$\bullet$}
\setlist[itemize,5]{label=$\bullet$}
\setlist[itemize,6]{label=$\bullet$}
\setlist[itemize,7]{label=$\bullet$}
\setlist[itemize,8]{label=$\bullet$}
\setlist[itemize,9]{label=$\bullet$}
\renewlist{itemize}{itemize}{9}
\setlist[enumerate,1]{label=$\arabic*.$}
\setlist[enumerate,2]{label=$\alph*.$}
\setlist[enumerate,3]{label=$\roman*.$}
\setlist[enumerate,4]{label=$\arabic*.$}
\setlist[enumerate,5]{label=$\alpha*$}
\setlist[enumerate,6]{label=$\roman*.$}
\setlist[enumerate,7]{label=$\arabic*.$}
\setlist[enumerate,8]{label=$\alph*.$}
\setlist[enumerate,9]{label=$\roman*.$}
\renewlist{enumerate}{enumerate}{9}