From f164600ca7044b40b516c382a63500f7bed002a5 Mon Sep 17 00:00:00 2001 From: kaiv2 Date: Wed, 26 Jan 2022 10:41:17 +0800 Subject: [PATCH 0001/1278] lsp --- coc-settings.json | 68 -- ftplugin/java.lua | 76 ++ ftplugin/lua.lua | 2 + init.lua | 8 + init.vim | 1246 ------------------------ lua/basic.lua | 66 ++ lua/keybindings.lua | 78 ++ lua/lsp/init.lua | 36 + lua/lsp/java.lua | 30 + lua/lsp/lua.lua | 27 + lua/plugins/config/LeaderF.lua | 1 + lua/plugins/config/bufferline.lua | 14 + lua/plugins/config/nvim-cmp.lua | 66 ++ lua/plugins/config/nvim-tree.lua | 8 + lua/plugins/config/nvim-treesitter.lua | 30 + lua/plugins/init.lua | 51 + plugin/packer_compiled.lua | 181 ++++ 17 files changed, 674 insertions(+), 1314 deletions(-) delete mode 100644 coc-settings.json create mode 100644 ftplugin/java.lua create mode 100644 ftplugin/lua.lua create mode 100644 init.lua delete mode 100644 init.vim create mode 100644 lua/basic.lua create mode 100644 lua/keybindings.lua create mode 100644 lua/lsp/init.lua create mode 100644 lua/lsp/java.lua create mode 100644 lua/lsp/lua.lua create mode 100644 lua/plugins/config/LeaderF.lua create mode 100644 lua/plugins/config/bufferline.lua create mode 100644 lua/plugins/config/nvim-cmp.lua create mode 100644 lua/plugins/config/nvim-tree.lua create mode 100644 lua/plugins/config/nvim-treesitter.lua create mode 100644 lua/plugins/init.lua create mode 100644 plugin/packer_compiled.lua diff --git a/coc-settings.json b/coc-settings.json deleted file mode 100644 index e1aba31f..00000000 --- a/coc-settings.json +++ /dev/null @@ -1,68 +0,0 @@ -{ - "codeLens.enable": true, - "coc.preferences.extensionUpdateCheck": "daily", - "diagnostic.errorSign": "\ufc65", - "diagnostic.warningSign": "\uf06a", - "diagnostic.infoSign": "\uf05a", - "diagnostic.hintSign": "\uf864", - - "java.configuration.maven.userSettings": "/opt/software/apache-maven-3.6.3/conf/settings.xml", - "java.maven.downloadSources": true, - "java.maven.updateSnapshots": true, - "java.format.enabled": true, - "java.saveActions.organizeImports": false, - "java.selectionRange.enabled": true, - "java.sources.organizeImports.starThreshold": 99, - "java.sources.organizeImports.staticStarThreshold": 99, - "java.format.settings.url": "/opt/software/java-format-style/alibaba/eclipse-codestyle.xml", - "java.project.resourceFilters": [ - "node_modules", - ".git", - ".idea", - "target" - ], - "java.configuration.runtimes": [ - { - "name": "JavaSE-1.8", - "path": "/Library/Java/JavaVirtualMachines/zulu-8.jdk/Contents/Home" - }, - { - "name": "JavaSE-11", - "path": "/Library/Java/JavaVirtualMachines/zulu-11.jdk/Contents/Home" - } - ], - "java.home": "/Library/Java/JavaVirtualMachines/zulu-17.jdk/Contents/Home", - "java.jdt.ls.vmargs": "-XX:+UseParallelGC -XX:GCTimeRatio=4 -XX:AdaptiveSizePolicyWeight=90 -Dsun.zip.disableMemoryMapping=true -Xmx1G -Xms100m -javaagent:\"/opt/software/lsp/lombok.jar\"", - "java.referencesCodeLens.enabled": false, - "java.implementationsCodeLens.enabled": true, - - "explorer.icon.enableNerdfont": true, - "explorer.width": 31, - "explorer.quitOnOpen": true, - "explorer.sources": [ - { - "name": "bookmark", - "expand": false - }, - { - "name": "buffer", - "expand": false - }, - { - "name": "file", - "expand": true - } - ], - "explorer.file.showHiddenFiles": true, - "explorer.git.showIgnored": true, - - "rust-analyzer.server.path": "~/.rustup/toolchains/nightly-aarch64-apple-darwin/bin/rust-analyzer", - - "clangd.path": "/opt/homebrew/Cellar/llvm/13.0.0_1/bin/clangd", - - - "highlight.colors.enable": true, - "highlight.colorNames.enable": true, - "highlight.document.enable": true, - "coc.preferences.colorSupport": false -} diff --git a/ftplugin/java.lua b/ftplugin/java.lua new file mode 100644 index 00000000..298b64b5 --- /dev/null +++ b/ftplugin/java.lua @@ -0,0 +1,76 @@ +-- If you started neovim within `~/dev/xy/project-1` this would resolve to `project-1` +local project_name = vim.fn.fnamemodify(vim.fn.getcwd(), ':p:h:t') + +local workspace_dir = '/Users/kailuo/jdtls-workspace/' .. project_name + +-- See `:help vim.lsp.start_client` for an overview of the supported `config` options. +local config = { + -- The command that starts the language server + -- See: https://github.com/eclipse/eclipse.jdt.ls#running-from-the-command-line + cmd = { + '/Library/Java/JavaVirtualMachines/zulu-11.jdk/Contents/Home/bin/java', -- or '/path/to/java11_or_newer/bin/java' + '-Declipse.application=org.eclipse.jdt.ls.core.id1', + '-Dosgi.bundles.defaultStartLevel=4', + '-Declipse.product=org.eclipse.jdt.ls.core.product', + '-Dlog.protocol=true', + '-Dlog.level=ALL', + '-Xms1g', + '-Xmx2g', + '--add-modules=ALL-SYSTEM', + '--add-opens', 'java.base/java.util=ALL-UNNAMED', + '--add-opens', 'java.base/java.lang=ALL-UNNAMED', + '-jar', '/opt/software/jdtls/plugins/org.eclipse.equinox.launcher_1.6.300.v20210813-1054.jar', + '-configuration', '/opt/software/jdtls/config_mac', + '-data', workspace_dir, + }, + + -- 💀 + -- This is the default if not provided, you can remove it. Or adjust as needed. + -- One dedicated LSP server & client will be started per unique root_dir + -- root_dir = require('jdtls.setup').find_root({'.git', 'mvnw', 'gradlew'}), + + -- Here you can configure eclipse.jdt.ls specific settings + -- See https://github.com/eclipse/eclipse.jdt.ls/wiki/Running-the-JAVA-LS-server-from-the-command-line#initialize-request + -- for a list of options + settings = { + java = { + home = "/Library/Java/JavaVirtualMachines/zulu-11.jdk/Contents/Home", + eclipse = { + downloadSources = true, + }, + server = { + launchMode = "Hybrid", + }, + configuration = { + maven = { + userSettings = "/opt/software/apache-maven-3.6.3/conf/settings.xml", + globalSettings = "/opt/software/apache-maven-3.6.3/conf/settings.xml", + }, + runtimes = { + { + name = "JavaSE-1.8", + path = "/Library/Java/JavaVirtualMachines/zulu-8.jdk/Contents/Home", + }, + { + name = "JavaSE-11", + path = "/Library/Java/JavaVirtualMachines/zulu-11.jdk/Contents/Home", + }, + } + }, + } + }, + + -- Language server `initializationOptions` + -- You need to extend the `bundles` with paths to jar files + -- if you want to use additional eclipse.jdt.ls plugins. + -- + -- See https://github.com/mfussenegger/nvim-jdtls#java-debug-installation + -- + -- If you don't plan on using the debugger or other eclipse.jdt.ls plugins you can remove this + init_options = { + bundles = {} + }, +} +-- This starts a new client & server, +-- or attaches to an existing client & server depending on the `root_dir`. +require('jdtls').start_or_attach(config) diff --git a/ftplugin/lua.lua b/ftplugin/lua.lua new file mode 100644 index 00000000..139597f9 --- /dev/null +++ b/ftplugin/lua.lua @@ -0,0 +1,2 @@ + + diff --git a/init.lua b/init.lua new file mode 100644 index 00000000..cc280a9c --- /dev/null +++ b/init.lua @@ -0,0 +1,8 @@ +require('basic') +require('plugins') +require('lsp') +require('keybindings') + +-- vim.api.nvim_command('colorscheme gruvbox') +vim.cmd("colorscheme gruvbox") +vim.cmd("highlight Normal guibg=NONE ctermbg=None") diff --git a/init.vim b/init.vim deleted file mode 100644 index 66ceade6..00000000 --- a/init.vim +++ /dev/null @@ -1,1246 +0,0 @@ -set nocompatible " 关闭兼容模式 -" filetype off " 关闭自动补全 - -" 侦测文件类型 -filetype on -" 为特定文件类型载入相关缩进文件 -filetype indent on -" 载入文件类型插件 -filetype plugin on -filetype plugin indent on -set number " 打开行号设置 -set relativenumber " 显示相对行号 -set encoding=utf-8 -set ruler " 光标信息 -set hlsearch " 高亮显示搜索 -" exec "nohlsearch" -set incsearch " 边搜索边高亮 -set ignorecase " 忽悠大小写 -set smartcase " 智能大小写 - -set cursorline " 突出显示当前行 -set showcmd " 显示命令 -" 增强模式中的命令行自动完成操作 -set wildmenu " 可选菜单 - -" 可以在buffer的任何地方使用鼠标(类似office中在工作区双击鼠标定位) -set mouse=a -set selection=exclusive -set selectmode=mouse,key - -" 在被分割的窗口间显示空白,便于阅读 -set fillchars="vert:│,fold:·,sep:│" -" set fillchars=vert:\ -" ,stl:\ ,stlnc:\ -" set ambiwidth=double - -set ts=4 " tab 占4个字符宽度 -set softtabstop=4 -set shiftwidth=4 -set expandtab -" set autoindent " 复制上一行的缩进 -" expandtab " tab为4个空格 -" set autochdir - -" 高亮显示匹配的括号 -set showmatch - -" 匹配括号高亮的时间(单位是十分之一秒) -set matchtime=5 -" 光标移动到buffer的顶部和底部时保持3行距离 -set scrolloff=3 - -autocmd Filetype dart setlocal ts=2 sw=2 expandtab -autocmd Filetype html setlocal ts=2 sw=2 expandtab -autocmd Filetype css setlocal ts=2 sw=2 expandtab -autocmd Filetype javascript setlocal ts=2 sw=2 expandtab -autocmd Filetype json setlocal ts=2 sw=2 expandtab -autocmd Filetype lua setlocal ts=2 sw=2 expandtab - -syntax enable " 语法高亮 -syntax on - -" set t_Co=256 -" 开启24bit的颜色,开启这个颜色会更漂亮一些 -set termguicolors -set background=dark -" set background=light -" colorscheme desert -" packadd! dracula -" colorscheme one -" 最后加载 gruvbox 主题 -" autocmd vimenter * colorscheme gruvbox - -" 取消备份 -set nobackup -set noswapfile - -" 恢复上次光标位置 -au BufReadPost * if line("'\"") > 1 && line("'\"") <= line("$") | exe "normal! g'\"" | endif - - -" ============================================================================ -" 快捷键配置 -" ============================================================================ -let mapleader=";" " 定义快捷键前缀,即 - -" ==== 系统剪切板复制粘贴 ==== -" v 模式下复制内容到系统剪切板 -vmap c "+yy -" n 模式下复制一行到系统剪切板 -nmap c "+yy -" n 模式下粘贴系统剪切板的内容 -nmap v "+p - -" 取消搜索高亮显示 -noremap :nohlsearch - -" 分屏大写调整快捷键配置 -noremap :res -2 -noremap :res +2 -noremap :vertical resize +2 -noremap :vertical resize -2 - -" 标签页切换 -" noremap te :tabe -" noremap th :-tabnext -" noremap tl :+tabnext - -" 分割线 -" set fillchars=vert:'│' - -if exists('g:neovide') - let g:neovide_cursor_vfx_mode = "railgun" - set guifont=DejaVuSansMono\ Nerd\ Font:h14 - let g:neovide_transparency=0.8 - " let g:neovide_fullscreen=v:true - let g:neovide_remember_window_size = v:true - let g:neovide_input_use_logo=v:true -else -endif - - -" 插件配置 -call plug#begin('~/.vim/plugged') - -" vim 状态栏 -Plug 'vim-airline/vim-airline' -Plug 'vim-airline/vim-airline-themes' - -" 左侧导航目录 使用coc.explorer -" Plug 'preservim/nerdtree' -" 侧边栏美化(需要下载字体,暂时不用) -" Plug 'ryanoasis/vim-devicons' - -" 图标高亮插件 -" Plug 'tiagofumo/vim-nerdtree-syntax-highlight' - -" vim 文件左侧 git 状态 -" Plug 'airblade/vim-gitgutter' - -" 文件搜索插件 -" Plug 'kien/ctrlp.vim' -" 方法大纲搜索 -" Plug 'tacahiroy/ctrlp-funky' - -" 类似 ctrlp 功能 -" Plug 'Shougo/denite.nvim', {'do': ':UpdateRemotePlugins' } - -Plug 'kyazdani42/nvim-web-devicons' " for file icons -" 文件管理 -Plug 'kyazdani42/nvim-tree.lua' - -" 缓冲区标题栏 -Plug 'akinsho/bufferline.nvim' - - -" blankline -Plug 'lukas-reineke/indent-blankline.nvim' - -" -Plug 'andymass/vim-matchup' - -" 大纲 -Plug 'majutsushi/tagbar' - -" editorconfig 插件 -Plug 'editorconfig/editorconfig-vim' - -" 快速注释插件 -Plug 'scrooloose/nerdcommenter' - -" git 插件 -Plug 'tpope/vim-fugitive' -Plug 'junegunn/gv.vim' - - -" go 语言相关插件 -Plug 'fatih/vim-go', { 'do': ':GoUpdateBinaries' } -" Plug 'volgar1x/vim-gocode' - -" 主题 -Plug 'dracula/vim', { 'as': 'dracula' } -" colorscheme one -Plug 'rakr/vim-one' -Plug 'morhetz/gruvbox' -Plug 'altercation/vim-colors-solarized' - - -" 可以在导航目录中看到 git 版本信息 -" Plug 'Xuyuanp/nerdtree-git-plugin' - -" 自动补全括号的插件,包括小括号,中括号,以及花括号 -" Plug 'jiangmiao/auto-pairs' - -" 可以使 nerdtree Tab 标签的名称更友好些 -" Plug 'jistr/vim-nerdtree-tabs' - -" html 神器 -Plug 'mattn/emmet-vim' - -" 补全插件 -Plug 'neoclide/coc.nvim', {'branch': 'release'} - -" markdown 插件 - - -" rust 插件 -Plug 'rust-lang/rust.vim' - -" dart 插件 -Plug 'dart-lang/dart-vim-plugin' - - -" Vim 寄存器列表查看插件 -Plug 'junegunn/vim-peekaboo' - -" 配对符号替换插件 -Plug 'tpope/vim-surround' - -" 最近打开文件 -Plug 'mhinz/vim-startify' - -" 全局查找替换插件 -Plug 'brooth/far.vim' - -" 异步执行任务插件 -Plug 'skywind3000/asynctasks.vim' -Plug 'skywind3000/asyncrun.vim' -" Plug 'skywind3000/asyncrun.extra' - -" jsx 插件 -Plug 'chemzqm/vim-jsx-improve' - -" 多光标插件 -Plug 'mg979/vim-visual-multi' - -" 类似 vim gitlens 插件 -Plug 'APZelos/blamer.nvim' - -" 类似 vscode ctrl+p -Plug 'Yggdroot/LeaderF', { 'do': ':LeaderfInstallCExtension' } - -" 浮动终端 -Plug 'voldikss/vim-floaterm' -Plug 'voldikss/LeaderF-floaterm' - -" debug 插件 -Plug 'puremourning/vimspector' - - - -" lsp -" Plug 'neovim/nvim-lspconfig' -" Plug 'williamboman/nvim-lsp-installer' - -" debug -" Plug 'mfussenegger/nvim-dap' - -" 数据库客户端 -Plug 'tpope/vim-dadbod' -Plug 'kristijanhusak/vim-dadbod-ui' -Plug 'kristijanhusak/vim-dadbod-completion' - -" 表格模式插件 -Plug 'dhruvasagar/vim-table-mode' - -" 自动对齐插件 -Plug 'junegunn/vim-easy-align' - -" LSP 大纲插件 -Plug 'liuchengxu/vista.vim' - -" 彩虹括号 -Plug 'luochen1990/rainbow' - -" plantuml 语法高亮 -Plug 'aklt/plantuml-syntax' - -" markdown 预览插件 -Plug 'iamcco/markdown-preview.nvim', { 'do': 'cd app && yarn install' } - -" 代码高亮 -Plug 'nvim-treesitter/nvim-treesitter', {'do': ':TSUpdate'} - -" 快捷键提示 -Plug 'folke/which-key.nvim' - -" 颜色显示 -Plug 'norcalli/nvim-colorizer.lua' - -" 消息通知 -Plug 'rcarriga/nvim-notify' - -" wildmenu 补全美化 -if has('nvim') - function! UpdateRemotePlugins(...) - " Needed to refresh runtime files - let &rtp=&rtp - UpdateRemotePlugins - endfunction - - Plug 'gelguy/wilder.nvim', { 'do': function('UpdateRemotePlugins') } -else - Plug 'gelguy/wilder.nvim' - - " To use Python remote plugin features in Vim, can be skipped - Plug 'roxma/nvim-yarp' - Plug 'roxma/vim-hug-neovim-rpc' -endif - - -call plug#end() -" 主题设置 -colorscheme gruvbox -" colorscheme one -" colorscheme solarized -" 透明背景 -" hi Normal ctermfg=252 ctermbg=none -highlight Normal guibg=NONE ctermbg=None - - - -" 退出 terminal 模式 -tnoremap - -" "============================================================================== -" " nerdtree 文件列表插件配置 -" "============================================================================== -" " 关闭打开NERDTree快捷键 -" noremap t :NERDTreeToggle -" " 如果使用vim-plug的话,加上这一句可以避免光标在nerdtree -" " 中的时候进行插件升级而导致nerdtree崩溃 -" let g:plug_window = 'noautocmd vertical topleft new' -" " 在nerdtree中删除文件之后,自动删除vim中相应的buffer -" let NERDTreeAutoDeleteBuffer = 1 -" " 进入目录自动将workspace更改为此目录 -" let g:NERDTreeChDirMode = 2 -" -" " 显示隐藏文件 -" let NERDTreeShowHidden=1 -" " let g:NERTreeMapToggleHidden = '.' -" -" " let g:NERDTreeDirArrowExpandable = '▸' -" " let g:NERDTreeDirArrowCollapsible = '▾' -" let g:NERDTreeDirArrowExpandable = '' -" let g:NERDTreeDirArrowCollapsible = '' -" " 显示行号 -" " let NERDTreeShowLineNumbers=1 -" " 设置宽度 -" let NERDTreeWinSize=31 -" " 自动打开 nerdtree -" " autocmd StdinReadPre * let s:std_in=1 -" " autocmd VimEnter * if argc() == 1 && isdirectory(argv()[0]) && !exists("s:std_in") | exe 'NERDTree' argv()[0] | wincmd p | ene | endif -" autocmd StdinReadPre * let s:std_in=1 -" autocmd VimEnter * if argc() == 1 && isdirectory(argv()[0]) && !exists("s:std_in") | exe 'NERDTree' argv()[0] | wincmd p | ene | exe 'cd '.argv()[0] | endif -" -" " 使用 vim 而不是 vim . -" " autocmd VimEnter * if argc() == 0 && !exists("s:std_in") | NERDTree | endif -" " 打开任意文件启动 nerdtree 我不需要 -" " autocmd vimenter * NERDTree -" " 打开 vim 文件及显示书签列表 -" " let NERDTreeShowBookmarks=2 -" " 忽略一下文件的显示 -" let NERDTreeIgnore=['\.pyc','\~$','\.swp'] -" " 显示在右边 -" " let NERDTreeWinPos=1 - - - -" "============================================================================== -" " nerdtree-git-plugin 插件 -" "============================================================================== -" let g:NERDTreeGitStatusIndicatorMapCustom = { -" \ "Modified" : "✹", -" \ "Staged" : "✚", -" \ "Untracked" : "✭", -" \ "Renamed" : "➜", -" \ "Unmerged" : "═", -" \ "Deleted" : "✖", -" \ "Dirty" : "✗", -" \ "Clean" : "✔︎", -" \ 'Ignored' : '☒', -" \ "Unknown" : "?" -" \ } -" -" let g:NERDTreeGitStatusShowIgnored = 1 -" let g:NERDTreeGitStatusUseNerdFonts = 1 - - -"============================================================================== -" vim-nerdtree-syntax-highlight 插件 -"============================================================================== -" 自定义颜色 -" you can add these colors to your .vimrc to help customizing -" let s:brown = "905532" -" let s:aqua = "3AFFDB" -" let s:blue = "689FB6" -" let s:darkBlue = "44788E" -" let s:purple = "834F79" -" let s:lightPurple = "834F79" -" let s:red = "AE403F" -" let s:beige = "F5C06F" -" let s:yellow = "F09F17" -" let s:orange = "D4843E" -" let s:darkOrange = "F16529" -" let s:pink = "CB6F6F" -" let s:salmon = "EE6E73" -" let s:green = "8FAA54" -" let s:lightGreen = "31B53E" -" let s:white = "FFFFFF" -" let s:rspec_red = 'FE405F' -" let s:git_orange = 'F54D27' -" -" let g:NERDTreeExtensionHighlightColor = {} " this line is needed to avoid error -" let g:NERDTreeExtensionHighlightColor['css'] = s:blue " sets the color of css files to blue -" -" let g:NERDTreeExactMatchHighlightColor = {} " this line is needed to avoid error -" let g:NERDTreeExactMatchHighlightColor['.gitignore'] = s:git_orange " sets the color for .gitignore files -" -" let g:NERDTreePatternMatchHighlightColor = {} " this line is needed to avoid error -" let g:NERDTreePatternMatchHighlightColor['.*_spec\.rb$'] = s:rspec_red " sets the color for files ending with _spec.rb -" -" let g:WebDevIconsDefaultFolderSymbolColor = s:beige " sets the color for folders that did not match any rule -" let g:WebDevIconsDefaultFileSymbolColor = s:blue " sets the color for files that did not match any rule - - -"============================================================================== -" ctrlp.vim 文件搜索插件配置 -"============================================================================== -" 快捷键配置 -" let g:ctrlp_map = '' -" let g:ctrlp_cmd = 'CtrlP' -" 设置工作目录读取方式 -" let g:ctrlp_working_path_mode = 'ra' -" 忽略搜索文件 -"let g:ctrlp_custom_ignore = '\v[\/]\.(git|hg|svn)$' -" let g:ctrlp_custom_ignore = { -" \ 'dir': '\v[\/](\.git|\.hg|\.svn|target|node_modules)$', -" \ 'file': '\v\.(exe|so|dll|class)$', -" \ 'link': 'some_bad_symbolic_links', -" \ } - - -"============================================================================== -" ctrlp-funky 插件配置 -"============================================================================== -" map :CtrlPFunky -" let g:ctrlp_extensions = ['funky'] -" let g:ctrlp_funky_syntax_highlight = 1 - - - -"============================================================================== -" tagbar 插件配置 -"============================================================================== -" map :TagbarToggle -let g:tagbar_type_go = { - \ 'ctagstype' : 'go', - \ 'kinds' : [ - \ 'p:package', - \ 'i:imports:1', - \ 'c:constants', - \ 'v:variables', - \ 't:types', - \ 'n:interfaces', - \ 'w:fields', - \ 'e:embedded', - \ 'm:methods', - \ 'r:constructor', - \ 'f:functions' - \ ], - \ 'sro' : '.', - \ 'kind2scope' : { - \ 't' : 'ctype', - \ 'n' : 'ntype' - \ }, - \ 'scope2kind' : { - \ 'ctype' : 't', - \ 'ntype' : 'n' - \ }, - \ 'ctagsbin' : 'gotags', - \ 'ctagsargs' : '-sort -silent' -\ } - - -"============================================================================== -" vim-airline 配置 -"============================================================================== -" 启用显示缓冲区 -let g:airline#extensions#tabline#enabled = 1 -let g:airline#extensions#tabline#left_sep = ' ' -" let g:airline#extensions#tabline#left_alt_sep = '|' -let g:airline#extensions#tabline#formatter = 'default' -let g:airline_powerline_fonts = 1 - - -"============================================================================== -" nerdocmmenter 注释插件配置 -"============================================================================== -let g:NERDSpaceDelims = 1 " 默认情况下,在注释分割符后添加空格 -let g:NERDCompactSexyComs = 1 " 使用紧凑语法进行美化的多行s注释 -let g:NERDDefaultAlign = 'left' " 让对齐向注释分割符向左而不是跟随代码缩进 -let g:NERDAltDelims_java = 1 " 默认情况,将语言设置为使用其备用分割符 -let g:NERDCustomDelimiters = { 'c': { 'left': '/**', 'right': '*/'}, 'java': { 'left': '//', 'right': ''}} " 添加自定义格式 -let g:NERDCommentEmptyLines = 1 " 允许注释和反转空行(在注释区域时很有用) -let g:NERDTrimTrailingWhitespace = 1 " 在取消s注释时启用尾部空格的修剪 -let g:NERDToggleCheckAllLines = 1 " 启用检查是否以注释 - -"============================================================================== -" vim-go 插件 -"============================================================================== -let g:go_fmt_command = "goimports" " 格式化将默认的 gofmt 替换 -let g:go_autodetect_gopath = 1 -let g:go_list_type = "quickfix" - -let g:go_version_warning = 1 -let g:go_highlight_types = 1 -let g:go_highlight_fields = 1 -let g:go_highlight_functions = 1 -let g:go_highlight_function_calls = 1 -let g:go_highlight_operators = 1 -let g:go_highlight_extra_types = 1 -let g:go_highlight_methods = 1 -let g:go_highlight_generate_tags = 1 - -let g:godef_split=2 - - - - -"============================================================================== -" coc.nvim 插件 -"============================================================================== - -" 插件列表 -let g:coc_global_extensions = [ - \'coc-vimlsp', - \'coc-snippets', - \'coc-prettier', - \'coc-pairs', - \'coc-marketplace', - \'coc-lists', - \'coc-highlight', - \'coc-git', - \'coc-emmet', - \'coc-yaml', - \'coc-vetur', - \'coc-tsserver', - \'coc-rust-analyzer', - \'coc-pyright', - \'coc-json', - \'coc-java', - \'coc-java-debug', - \'coc-xml', - \'coc-html', - \'coc-flutter', - \'coc-tasks', - \'coc-floaterm', - \'coc-translator', - \'coc-toml', - \'coc-markdownlint', - \'coc-gitignore', - \'coc-sh', - \'coc-clangd', - \'coc-sql', - \'coc-css'] -" 插件列表备注 -" coc-imselect 输入法中英显示 Mac 下专用 - -" TextEdit might fail if hidden is not set. -set hidden - -" Some servers have issues with backup files, see #649. -set nobackup -set nowritebackup - -" Give more space for displaying messages. -" set cmdheight=2 - -" Having longer updatetime (default is 4000 ms = 4 s) leads to noticeable -" delays and poor user experience. -set updatetime=400 - -" Don't pass messages to |ins-completion-menu|. -set shortmess+=c - -" Always show the signcolumn, otherwise it would shift the text each time -" diagnostics appear/become resolved. -if has("patch-8.1.1564") - " Recently vim can merge signcolumn and number column into one - set signcolumn=number -else - set signcolumn=yes -endif - -" Use tab for trigger completion with characters ahead and navigate. -" NOTE: Use command ':verbose imap ' to make sure tab is not mapped by -" other plugin before putting this into your config. -inoremap - \ pumvisible() ? "\" : - \ check_back_space() ? "\" : - \ coc#refresh() -inoremap pumvisible() ? "\" : "\" - -function! s:check_back_space() abort - let col = col('.') - 1 - return !col || getline('.')[col - 1] =~# '\s' -endfunction - -" Use to trigger completion. -inoremap coc#refresh() - -" Use to confirm completion, `u` means break undo chain at current -" position. Coc only does snippet and additional edit on confirm. -" could be remapped by other vim plugin, try `:verbose imap `. -if exists('*complete_info') - inoremap complete_info()["selected"] != "-1" ? "\" : "\u\" -else - inoremap pumvisible() ? "\" : "\u\" -endif - -" Use `[g` and `]g` to navigate diagnostics -nmap [g (coc-diagnostic-prev) -nmap ]g (coc-diagnostic-next) - -" GoTo code navigation. -nmap gd (coc-definition) -nmap gy (coc-type-definition) -nmap gi (coc-implementation) -nmap gr (coc-references) - -" Use K to show documentation in preview window. -nnoremap K :call show_documentation() - -function! s:show_documentation() - if (index(['vim','help'], &filetype) >= 0) - execute 'h '.expand('') - else - call CocAction('doHover') - endif -endfunction - -" Highlight the symbol and its references when holding the cursor. -autocmd CursorHold * silent call CocActionAsync('highlight') - -" Symbol renaming. -nmap rn (coc-rename) - -" Formatting selected code. -xmap f (coc-format-selected) -nmap f (coc-format-selected) - -augroup mygroup - autocmd! - " Setup formatexpr specified filetype(s). - autocmd FileType typescript,json setl formatexpr=CocAction('formatSelected') - " Update signature help on jump placeholder. - autocmd User CocJumpPlaceholder call CocActionAsync('showSignatureHelp') -augroup end - -" Applying codeAction to the selected region. -" Example: `aap` for current paragraph -xmap a (coc-codeaction-selected) -nmap a (coc-codeaction-selected) - -" Remap keys for applying codeAction to the current buffer. -nmap ac (coc-codeaction) -" Apply AutoFix to problem on the current line. -nmap qf (coc-fix-current) - -" Map function and class text objects -" NOTE: Requires 'textDocument.documentSymbol' support from the language server. -xmap if (coc-funcobj-i) -omap if (coc-funcobj-i) -xmap af (coc-funcobj-a) -omap af (coc-funcobj-a) -xmap ic (coc-classobj-i) -omap ic (coc-classobj-i) -xmap ac (coc-classobj-a) -omap ac (coc-classobj-a) - -" Use CTRL-S for selections ranges. -" Requires 'textDocument/selectionRange' support of LS, ex: coc-tsserver -nmap (coc-range-select) -xmap (coc-range-select) - -" Add `:Format` command to format current buffer. -command! -nargs=0 Format :call CocAction('format') - -" Add `:Fold` command to fold current buffer. -command! -nargs=? Fold :call CocAction('fold', ) - -" Add `:OR` command for organize imports of the current buffer. -command! -nargs=0 OR :call CocAction('runCommand', 'editor.action.organizeImport') - -" Add (Neo)Vim's native statusline support. -" NOTE: Please see `:h coc-status` for integrations with external plugins that -" provide custom statusline: lightline.vim, vim-airline. -set statusline^=%{coc#status()}%{get(b:,'coc_current_function','')} - -" Mappings using CoCList: -" Show all diagnostics. -nnoremap a :CocList diagnostics -" Manage extensions. -" nnoremap e :CocList extensions -" Show commands. -nnoremap c :CocList commands -" Find symbol of current document. -" see Vista.vim plugin -" nnoremap o :CocList outline -" Search workspace symbols. -nnoremap s :CocList -I symbols -" Do default action for next item. -nnoremap j :CocNext -" Do default action for previous item. -nnoremap k :CocPrev -" Resume latest coc list. -nnoremap p :CocListResume - -" coc.nvim debug 日志 -" let g:node_client_debug=1 - -" CocList files -" nnoremap :CocList files -" nnoremap @ :CocList outline - - -"============================================================================== -" coc-translator 配置 -"============================================================================== -nmap t (coc-translator-p) -vmap t (coc-translator-pv) - -"============================================================================== -" coc-floaterm 配置 -"============================================================================== -nnoremap ft :CocList floaterm - -"============================================================================== -" coc-java-debug 配置 -"============================================================================== -nmap :CocCommand java.debug.vimspector.start - -" function! JavaStartDebugCallback(err, port) -" execute "cexpr! 'Java debug started on port: " . a:port . "'" -" call vimspector#LaunchWithSettings({ "configuration": "Java Attach", "AdapterPort": a:port }) -" endfunction -" -" function JavaStartDebug() -" call CocActionAsync('runCommand', 'vscode.java.startDebugSession', function('JavaStartDebugCallback')) -" endfunction -" -" nmap :call JavaStartDebug() - - - -"============================================================================== -" asynctasks异步执行任务插件 配置 -"============================================================================== -let g:asyncrun_open = 20 -let g:asyncrun_mode = 'term' -let g:asynctasks_term_pos = 'floaterm' -" 此配置无效(无效变量) -let g:asyncrun_term_pos = 'floaterm' - -" Search workspace tasks. -nnoremap r :CocList tasks - - - -"============================================================================== -" blamer 配置 -"============================================================================== -" default 0 -let g:blamer_enabled = 1 -let g:blamer_delay = 400 -let g:blamer_show_in_visual_modes = 0 -let g:blamer_show_in_insert_modes = 0 -" let g:blamer_prefix = ' > ' -let g:blamer_date_format = '%Y-%m-%d %H:%M:%S' - - -"============================================================================== -" LeaderF 配置 -"============================================================================== -let g:Lf_WindowPosition = 'popup' -let g:Lf_ShortcutF = '' -" 不使用缓存(大型项目不推荐) -let g:Lf_UseCache=0 -let g:Lf_UseMemoryCache=0 - -"============================================================================== -" LeaderF 自定义 配置 -"============================================================================== -" nnoremap : - -" let g:Lf_WildIgnore = { -" \ 'dir': ['.svn','.git','.hg','.wine','.deepinwine','.oh-my-zsh', 'target'], -" \ 'file': ['*.sw?','~$*','*.bak','*.exe','*.o','*.so','*.py[co]', '*.class'] -" \} - -" LeaderF rg -" search word under cursor, the pattern is treated as regex, and enter normal mode directly -noremap :=printf("Leaderf! rg -e %s ", expand("")) - -" search word under cursor, the pattern is treated as regex, -" append the result to previous search results. -" noremap :=printf("Leaderf! rg --append -e %s ", expand("")) - -" search word under cursor literally only in current buffer -" noremap :=printf("Leaderf! rg -F --current-buffer -e %s ", expand("")) - -" search word under cursor literally in all listed buffers -" noremap :=printf("Leaderf! rg -F --all-buffers -e %s ", expand("")) - -" search visually selected text literally, don't quit LeaderF after accepting an entry -" xnoremap gf :=printf("Leaderf! rg -F --stayOpen -e %s ", leaderf#Rg#visual()) -xnoremap :=printf("Leaderf! rg -e %s ", leaderf#Rg#visual()) - -" recall last search. If the result window is closed, reopen it. -noremap go :Leaderf! rg --recall - -" search word under cursor in *.h and *.cpp files. -" noremap a :=printf("Leaderf! rg -e %s -g *.h -g *.cpp", expand("")) -" the same as above -" noremap a :=printf("Leaderf! rg -e %s -g *.{h,cpp}", expand("")) - -" search word under cursor in cpp and java files. -" noremap b :=printf("Leaderf! rg -e %s -t cpp -t java", expand("")) - -" search word under cursor in cpp files, exclude the *.hpp files -" noremap c :=printf("Leaderf! rg -e %s -t cpp -g !*.hpp", expand("")) - - -"============================================================================== -" voldikss/vim-floaterm 配置 -"============================================================================== -let g:floaterm_keymap_new = 't' -nnoremap :FloatermToggle -tnoremap :FloatermToggle - -" Set floaterm window's background to black -" hi Floaterm guibg=black -" -" Set floating window border line color to cyan, and background to orange -" hi FloatermBorder guibg=orange guifg=cyan -" -" Set floaterm window background to gray once the cursor moves out from it -" hi FloatermNC guibg=gray -autocmd User FloatermOpen " triggered after opening a new/existed floaterm - -let g:floaterm_position='bottomright' -let g:floaterm_autoclose=1 -let g:floaterm_wintype='float' -let g:floaterm_width=1.0 -let g:floaterm_height=0.4 -let g:floaterm_rootmarkers=['.project', '.git', '.hg', '.svn', '.root', '.gitignore'] - -"============================================================================== -" puremourning/vimspector 配置 -"============================================================================== -let g:vimspector_enable_mappings = 'VISUAL_STUDIO' - -"============================================================================== -" liuchengxu/vista.vim 配置 -"============================================================================== -nnoremap o :Vista!! - -function! NearestMethodOrFunction() abort - return get(b:, 'vista_nearest_method_or_function', '') -endfunction - -set statusline+=%{NearestMethodOrFunction()} - -" By default vista.vim never run if you don't call it explicitly. -" -" If you want to show the nearest function in your statusline automatically, -" you can add the following line to your vimrc -autocmd VimEnter * call vista#RunForNearestMethodOrFunction() - -" How each level is indented and what to prepend. -" This could make the display more compact or more spacious. -" e.g., more compact: ["▸ ", ""] -" Note: this option only works for the kind renderer, not the tree renderer. -let g:vista_icon_indent = ["╰─▸ ", "├─▸ "] - -" Executive used when opening vista sidebar without specifying it. -" See all the avaliable executives via `:echo g:vista#executives`. -let g:vista_default_executive = 'coc' - - -" To enable fzf's preview window set g:vista_fzf_preview. -" The elements of g:vista_fzf_preview will be passed as arguments to fzf#vim#with_preview() -" For example: -" let g:vista_fzf_preview = ['right:50%'] - - -" Ensure you have installed some decent font to show these pretty symbols, then you can enable icon for the kind. -let g:vista#renderer#enable_icon = 1 - -" The default icons can't be suitable for all the filetypes, you can extend it as you wish. -let g:vista#renderer#icons = { -\ "function": "\uf794", -\ "variable": "\uf71b", -\ } - - -"============================================================================== -" vim-dadbod-ui 配置 -"============================================================================== -let g:db_ui_use_nerd_fonts = 1 - -"============================================================================== -" luochen1990/rainbow 配置 -"============================================================================== -" 彩虹括号不太习惯,暂时关闭 -let g:rainbow_active = 0 - -"============================================================================== -" 自定义配置 -"============================================================================== - -" %bd 删除所有缓冲区, e# 打开最后一个缓冲区, bd# 关闭[No Name] -noremap o :%bd\|e#\|bd# -noremap w :bw - -let g:python_host_prog='/usr/bin/python' -let g:python3_host_prog='/opt/homebrew/bin/python3' - - -"============================================================================== -" nvim-treesitter 配置 -"============================================================================== -lua <', - \ 'previous_key': '', - \ 'accept_key': '', - \ 'reject_key': '', - \ }) - - -let s:popupmenu_renderer = wilder#popupmenu_renderer(wilder#popupmenu_border_theme({ - \ 'highlighter': wilder#basic_highlighter(), - \ 'empty_message': wilder#popupmenu_empty_message_with_spinner(), - \ 'pumblend': 10, - \ 'left': [ - \ ' ', wilder#popupmenu_devicons(), - \ ], - \ 'right': [ - \ ' ', wilder#popupmenu_scrollbar(), - \ ], - \ 'highlights': { - \ 'border': 'Normal', - \ }, - \ 'border': 'rounded', - \ })) - -let s:wildmenu_renderer = wilder#wildmenu_renderer({ - \ 'highlighter': wilder#basic_highlighter(), - \ 'separator': ' | ', - \ 'left': [' ', wilder#wildmenu_spinner(), ' '], - \ 'right': [' ', wilder#wildmenu_index()], - \ }) - -call wilder#set_option('renderer', wilder#renderer_mux({ - \ ':': s:popupmenu_renderer, - \ '/': s:wildmenu_renderer, - \ 'substitute': s:wildmenu_renderer, - \ })) - -"============================================================================== -" nvim-tree 配置 -"============================================================================== - -lua << EOF --- following options are the default --- each of these are documented in `:help nvim-tree.OPTION_NAME` -require'nvim-tree'.setup { - disable_netrw = true, - hijack_netrw = true, - open_on_setup = false, - ignore_ft_on_setup = {}, - auto_close = true, - open_on_tab = false, - hijack_cursor = false, - update_cwd = false, - update_to_buf_dir = { - enable = true, - auto_open = true, - }, - diagnostics = { - enable = false, - icons = { - hint = "", - info = "", - warning = "", - error = "", - } - }, - update_focused_file = { - enable = true, - update_cwd = true, - ignore_list = {} - }, - system_open = { - cmd = nil, - args = {} - }, - filters = { - dotfiles = false, - custom = {} - }, - git = { - enable = true, - ignore = true, - timeout = 500, - }, - view = { - width = 30, - height = 30, - hide_root_folder = true, - side = 'left', - auto_resize = true, - mappings = { - custom_only = false, - list = {} - }, - number = false, - relativenumber = false, - signcolumn = "yes" - }, - trash = { - cmd = "trash", - require_confirm = true - } -} -EOF - -let g:nvim_tree_quit_on_open = 1 "0 by default, closes the tree when you open a file -let g:nvim_tree_indent_markers = 1 "0 by default, this option shows indent markers when folders are open -let g:nvim_tree_git_hl = 1 "0 by default, will enable file highlight for git attributes (can be used without the icons). -let g:nvim_tree_highlight_opened_files = 1 "0 by default, will enable folder and file icon highlight for opened files/directories. -let g:nvim_tree_root_folder_modifier = ':~' "This is the default. See :help filename-modifiers for more options -let g:nvim_tree_add_trailing = 1 "0 by default, append a trailing slash to folder names -let g:nvim_tree_group_empty = 1 " 0 by default, compact folders that only contain a single folder into one node in the file tree -let g:nvim_tree_change_dir_global = 1 "0 by default, use :cd when changing directories. -let g:nvim_tree_disable_window_picker = 1 "0 by default, will disable the window picker. -let g:nvim_tree_icon_padding = ' ' "one space by default, used for rendering the space between the icon and the filename. Use with caution, it could break rendering if you set an empty string depending on your font. -let g:nvim_tree_symlink_arrow = ' >> ' " defaults to ' ➛ '. used as a separator between symlinks' source and target. -let g:nvim_tree_respect_buf_cwd = 1 "0 by default, will change cwd of nvim-tree to that of new buffer's when opening nvim-tree. -let g:nvim_tree_create_in_closed_folder = 0 "1 by default, When creating files, sets the path of a file when cursor is on a closed folder to the parent folder when 0, and inside the folder when 1. -let g:nvim_tree_refresh_wait = 500 "1000 by default, control how often the tree can be refreshed, 1000 means the tree can be refresh once per 1000ms. -let g:nvim_tree_window_picker_exclude = { - \ 'filetype': [ - \ 'notify', - \ 'packer', - \ 'qf' - \ ], - \ 'buftype': [ - \ 'terminal' - \ ] - \ } -" Dictionary of buffer option names mapped to a list of option values that -" indicates to the window picker that the buffer's window should not be -" selectable. -" let g:nvim_tree_special_files = { 'README.md': 1, 'Makefile': 1, 'MAKEFILE': 1 } " List of filenames that gets highlighted with NvimTreeSpecialFile -let g:nvim_tree_special_files = { 'Makefile': 1, 'MAKEFILE': 1 } -let g:nvim_tree_show_icons = { - \ 'git': 1, - \ 'folders': 0, - \ 'files': 0, - \ 'folder_arrows': 0, - \ } -"If 0, do not show the icons for one of 'git' 'folder' and 'files' -"1 by default, notice that if 'files' is 1, it will only display -"if nvim-web-devicons is installed and on your runtimepath. -"if folder is 1, you can also tell folder_arrows 1 to show small arrows next to the folder icons. -"but this will not work when you set indent_markers (because of UI conflict) - -" default will show icon by default if no icon is provided -" default shows no icon by default -let g:nvim_tree_icons = { - \ 'default': '', - \ 'symlink': '', - \ 'git': { - \ 'unstaged': "✗", - \ 'staged': "✓", - \ 'unmerged': "", - \ 'renamed': "➜", - \ 'untracked': "★", - \ 'deleted': "", - \ 'ignored': "◌" - \ }, - \ 'folder': { - \ 'arrow_open': "", - \ 'arrow_closed': "", - \ 'default': "", - \ 'open': "", - \ 'empty': "", - \ 'empty_open': "", - \ 'symlink': "", - \ 'symlink_open': "", - \ } - \ } - -" nnoremap :NvimTreeToggle -" nnoremap r :NvimTreeRefresh -" nnoremap n :NvimTreeFindFile -" NvimTreeOpen, NvimTreeClose, NvimTreeFocus, NvimTreeFindFileToggle, and NvimTreeResize are also available if you need them - -set termguicolors " this variable must be enabled for colors to be applied properly - -" a list of groups can be found at `:help nvim_tree_highlight` -highlight NvimTreeFolderIcon guibg=blue - -nnoremap n :NvimTreeToggle - diff --git a/lua/basic.lua b/lua/basic.lua new file mode 100644 index 00000000..bd7ba230 --- /dev/null +++ b/lua/basic.lua @@ -0,0 +1,66 @@ +-- 行号 +vim.wo.number = true +vim.wo.relativenumber = true + +-- 高亮所在行 +vim.wo.cursorline = true + +-- 右侧参考线,超过表示代码太长了,考虑换行 +vim.wo.colorcolumn = "80" + + +vim.g.encoding = "UTF-8" + +vim.o.fileencoding= "UTF-8" +-- jk移动时光标下上方保留8行 +vim.o.scrolloff = 8 +vim.o.sidescrolloff = 8 + +-- 缩进配置 +vim.o.tabstop=4 +vim.bo.tabstop=4 +vim.o.softtabstop=4 +-- vim.o.softround=true +-- > < 时移动长度 +vim.o.shiftwidth=4 +vim.bo.shiftwidth=4 + +vim.cmd('autocmd Filetype lua setlocal ts=2 sw=2 expandtab') + +-- 新行对齐当前行,空格替代tab +vim.o.expandtab = true +vim.bo.expandtab = true +vim.o.autoindent = true +vim.bo.autoindent = true +vim.o.smartindent = true + + +-- 使用增强状态栏后不再需要 vim 的模式提示 +vim.o.showmode = false + +-- 当文件被外部程序修改时,自动加载 +vim.o.autoread = true +vim.bo.autoread = true + +-- 禁止创建备份文件 +vim.o.backup = false +vim.o.writebackup = false +vim.o.swapfile = false +-- smaller updatetime +vim.o.updatetime = 300 + +-- split window 从下边和右边出现 +vim.o.splitbelow = true +vim.o.splitright = true + +-- 样式 +vim.o.background = "dark" +vim.o.termguicolors = true +vim.opt.termguicolors = true + +-- 补全增强 +vim.o.wildmenu = true + + +-- vim.g.python_host_prog='/opt/homebrew/bin/python3' +vim.g.python3_host_prog='/opt/homebrew/bin/python3' diff --git a/lua/keybindings.lua b/lua/keybindings.lua new file mode 100644 index 00000000..6bca4427 --- /dev/null +++ b/lua/keybindings.lua @@ -0,0 +1,78 @@ +vim.g.mapleader = ";" +vim.g.maplocalleader = ";" + +local map = vim.api.nvim_set_keymap +local opt = {noremap = true, silent = true } + +-- nvimTree +map('n', 'et', ':NvimTreeToggle', opt) +-- n 模式下复制内容到系统剪切板 +map('n', 'c', '"+yy', opt) +-- v 模式下复制内容到系统剪切板 +map('v', 'c', '"+yy', opt) +-- n 模式下粘贴系统剪切板的内容 +map('n', 'v', '"+p', opt) +-- 取消搜索高亮显示 +map('n', '', ':nohlsearch', opt) +-- %bd 删除所有缓冲区, e# 打开最后一个缓冲区, bd# 关闭[No Name] +map('n', 'o', ':%bd|e#|bd#', opt) +map('n', 'w', ':bw', opt) + +local pluginKeys = {} + +-- lsp 回调函数快捷键设置 +pluginKeys.maplsp = function(mapbuf) + + mapbuf('n', 'K', 'lua vim.lsp.buf.hover()', opt) + -- rename + mapbuf('n', 'rn', 'lua vim.lsp.buf.rename()', opt) + -- code action + mapbuf('n', 'ca', 'lua vim.lsp.buf.code_action()', opt) + -- go xx + mapbuf('n', 'gd', 'lua vim.lsp.buf.definition()', opt) + mapbuf('n', 'gh', 'lua vim.lsp.buf.hover()', opt) + mapbuf('n', 'gD', 'lua vim.lsp.buf.declaration()', opt) + mapbuf('n', 'gi', 'lua vim.lsp.buf.implementation()', opt) + mapbuf('n', 'gr', 'lua vim.lsp.buf.references()', opt) + -- diagnostic + mapbuf('n', 'go', 'lua vim.diagnostic.open_float()', opt) + mapbuf('n', 'gp', 'lua vim.diagnostic.goto_prev()', opt) + mapbuf('n', 'gn', 'lua vim.diagnostic.goto_next()', opt) + -- mapbuf('n', 'q', 'lua vim.diagnostic.setloclist()', opt) + -- leader + = + mapbuf('n', '=', 'lua vim.lsp.buf.formatting()', opt) + -- mapbuf('n', '', 'lua vim.lsp.buf.signature_help()', opt) + -- mapbuf('n', 'wa', 'lua vim.lsp.buf.add_workspace_folder()', opt) + -- mapbuf('n', 'wr', 'lua vim.lsp.buf.remove_workspace_folder()', opt) + -- mapbuf('n', 'wl', 'lua print(vim.inspect(vim.lsp.buf.list_workspace_folders()))', opt) + -- mapbuf('n', 'D', 'lua vim.lsp.buf.type_definition()', opt) +end + +-- nvim-cmp 自动补全 +pluginKeys.cmp = function(cmp) + return { + -- 上一个 + [''] = cmp.mapping.select_prev_item(), + -- 下一个 + [''] = cmp.mapping.select_next_item(), + -- 出现补全 + [''] = cmp.mapping(cmp.mapping.complete(), { 'i', 'c' }), + -- 取消 + [''] = cmp.mapping({ + i = cmp.mapping.abort(), + c = cmp.mapping.close(), + }), + -- 确认 + -- Accept currently selected item. If none selected, `select` first item. + -- Set `select` to `false` to only confirm explicitly selected items. + [''] = cmp.mapping.confirm({ + select = true , + behavior = cmp.ConfirmBehavior.Replace + }), + -- [''] = cmp.config.disable, -- Specify `cmp.config.disable` if you want to remove the default `` mapping. + [''] = cmp.mapping(cmp.mapping.scroll_docs(-4), { 'i', 'c' }), + [''] = cmp.mapping(cmp.mapping.scroll_docs(4), { 'i', 'c' }), + } +end + +return pluginKeys diff --git a/lua/lsp/init.lua b/lua/lsp/init.lua new file mode 100644 index 00000000..45efaadc --- /dev/null +++ b/lua/lsp/init.lua @@ -0,0 +1,36 @@ +local lsp_installer = require "nvim-lsp-installer" + +-- 安装列表 +-- https://github.com/williamboman/nvim-lsp-installer#available-lsps +-- { key: 语言 value: 配置文件 } +local servers = { + sumneko_lua = require "lsp.lua", -- /lua/lsp/lua.lua + -- jdtls = require "lsp.java", -- /lua/lsp/jdtls.lua +} + +-- 自动安装 LanguageServers +for name, _ in pairs(servers) do + local server_is_found, server = lsp_installer.get_server(name) + if server_is_found then + if not server:is_installed() then + print("Installing " .. name) + server:install() + end + end +end + +lsp_installer.on_server_ready(function(server) + local opts = servers[server.name] + if opts then + opts.on_attach = function(_, bufnr) + local function buf_set_keymap(...) vim.api.nvim_buf_set_keymap(bufnr, ...) end + -- local function buf_set_option(...) vim.api.nvim_buf_set_option(bufnr, ...) end + -- 绑定快捷键 + require('keybindings').maplsp(buf_set_keymap) + end + opts.flags = { + debounce_text_changes = 150, + } + server:setup(opts) + end +end) diff --git a/lua/lsp/java.lua b/lua/lsp/java.lua new file mode 100644 index 00000000..272ee436 --- /dev/null +++ b/lua/lsp/java.lua @@ -0,0 +1,30 @@ +-- local java_language_server = require "java_language_server" +return { + settings = { + java = { + home = "/Library/Java/JavaVirtualMachines/zulu-11.jdk/Contents/Home", + eclipse = { + downloadSources = true, + }, + server = { + launchMode = "Hybrid", + }, + configuration = { + maven = { + userSettings = "/opt/software/apache-maven-3.6.3/conf/settings.xml", + globalSettings = "/opt/software/apache-maven-3.6.3/conf/settings.xml", + }, + runtimes = { + { + name = "JavaSE-1.8", + path = "/Library/Java/JavaVirtualMachines/zulu-8.jdk/Contents/Home", + }, + { + name = "JavaSE-11", + path = "/Library/Java/JavaVirtualMachines/zulu-11.jdk/Contents/Home", + }, + } + }, + } + } +} diff --git a/lua/lsp/lua.lua b/lua/lsp/lua.lua new file mode 100644 index 00000000..3ca12d2a --- /dev/null +++ b/lua/lsp/lua.lua @@ -0,0 +1,27 @@ +local runtime_path = vim.split(package.path, ';') +table.insert(runtime_path, "lua/?.lua") +table.insert(runtime_path, "lua/?/init.lua") +return { + settings = { + Lua = { + runtime = { + -- Tell the language server which version of Lua you're using (most likely LuaJIT in the case of Neovim) + version = 'LuaJIT', + -- Setup your lua path + path = runtime_path, + }, + diagnostics = { + -- Get the language server to recognize the `vim` global + globals = {'vim'}, + }, + workspace = { + -- Make the server aware of Neovim runtime files + library = vim.api.nvim_get_runtime_file("", true), + }, + -- Do not send telemetry data containing a randomized but unique identifier + telemetry = { + enable = false + }, + }, + }, +} diff --git a/lua/plugins/config/LeaderF.lua b/lua/plugins/config/LeaderF.lua new file mode 100644 index 00000000..b298f172 --- /dev/null +++ b/lua/plugins/config/LeaderF.lua @@ -0,0 +1 @@ +vim.g.Lf_WindowPosition = 'popup' diff --git a/lua/plugins/config/bufferline.lua b/lua/plugins/config/bufferline.lua new file mode 100644 index 00000000..f9462669 --- /dev/null +++ b/lua/plugins/config/bufferline.lua @@ -0,0 +1,14 @@ +vim.opt.termguicolors = true +require("bufferline").setup { + options = { + -- 使用 nvim 内置lsp + diagnostics = "nvim_lsp", + -- 左侧让出 nvim-tree 的位置 + offsets = {{ + filetype = "NvimTree", + text = "File Explorer", + highlight = "Directory", + text_align = "left" + }} + } +} diff --git a/lua/plugins/config/nvim-cmp.lua b/lua/plugins/config/nvim-cmp.lua new file mode 100644 index 00000000..83e9cc89 --- /dev/null +++ b/lua/plugins/config/nvim-cmp.lua @@ -0,0 +1,66 @@ +local lspkind = require('lspkind') +local cmp = require'cmp' + +cmp.setup { + -- 指定 snippet 引擎 + snippet = { + expand = function(args) + -- For `vsnip` users. + vim.fn["vsnip#anonymous"](args.body) + + -- For `luasnip` users. + -- require('luasnip').lsp_expand(args.body) + + -- For `ultisnips` users. + -- vim.fn["UltiSnips#Anon"](args.body) + + -- For `snippy` users. + -- require'snippy'.expand_snippet(args.body) + end, + }, + -- 来源 + sources = cmp.config.sources({ + { name = 'nvim_lsp' }, + -- For vsnip users. + { name = 'vsnip' }, + -- For luasnip users. + -- { name = 'luasnip' }, + --For ultisnips users. + -- { name = 'ultisnips' }, + -- -- For snippy users. + -- { name = 'snippy' }, + }, { { name = 'buffer' }, + { name = 'path' } + }), + + -- 快捷键 + mapping = require'keybindings'.cmp(cmp), + -- 使用lspkind-nvim显示类型图标 + formatting = { + format = lspkind.cmp_format({ + with_text = true, -- do not show text alongside icons + maxwidth = 50, -- prevent the popup from showing more than provided characters (e.g 50 will not show more than 50 characters) + before = function (entry, vim_item) + -- Source 显示提示来源 + vim_item.menu = "["..string.upper(entry.source.name).."]" + return vim_item + end + }) + }, +} + +-- Use buffer source for `/`. +cmp.setup.cmdline('/', { + sources = { + { name = 'buffer' } + } +}) + +-- Use cmdline & path source for ':'. +cmp.setup.cmdline(':', { + sources = cmp.config.sources({ + { name = 'path' } + }, { + { name = 'cmdline' } + }) +}) diff --git a/lua/plugins/config/nvim-tree.lua b/lua/plugins/config/nvim-tree.lua new file mode 100644 index 00000000..195e3934 --- /dev/null +++ b/lua/plugins/config/nvim-tree.lua @@ -0,0 +1,8 @@ +require'nvim-tree'.setup { + -- 关闭文件时不自动关闭 + auto_close = false, + -- 显示 git 状态图标 + git = { + enable = true + } +} diff --git a/lua/plugins/config/nvim-treesitter.lua b/lua/plugins/config/nvim-treesitter.lua new file mode 100644 index 00000000..a0858004 --- /dev/null +++ b/lua/plugins/config/nvim-treesitter.lua @@ -0,0 +1,30 @@ +require'nvim-treesitter.configs'.setup { + -- 安装 language parser + -- :TSInstallInfo 命令查看支持的语言 + ensure_installed = {"html", "css", "vim", "lua", "javascript", "typescript", "tsx", "java", "rust"}, + -- 启用代码高亮功能 + highlight = { + enable = true, + additional_vim_regex_highlighting = false + }, + -- 启用增量选择 + incremental_selection = { + enable = true, + keymaps = { + init_selection = '', + node_incremental = '', + node_decremental = '', + scope_incremental = '', + } + }, + -- 启用基于Treesitter的代码格式化(=) . NOTE: This is an experimental feature. + indent = { + enable = true + } +} +-- 开启 Folding +vim.wo.foldmethod = 'expr' +vim.wo.foldexpr = 'nvim_treesitter#foldexpr()' +-- 默认不要折叠 +-- https://stackoverflow.com/questions/8316139/how-to-set-the-default-to-unfolded-when-you-open-a-file +vim.wo.foldlevel = 99 diff --git a/lua/plugins/init.lua b/lua/plugins/init.lua new file mode 100644 index 00000000..a52c65ab --- /dev/null +++ b/lua/plugins/init.lua @@ -0,0 +1,51 @@ +require('packer').startup(function() + -- Packer can manage itself + use 'wbthomason/packer.nvim' + use {'neovim/nvim-lspconfig', 'williamboman/nvim-lsp-installer'} + + -- nvim-cmp + use 'hrsh7th/cmp-nvim-lsp' -- { name = nvim_lsp } + use 'hrsh7th/cmp-buffer' -- { name = 'buffer' }, + use 'hrsh7th/cmp-path' -- { name = 'path' } + use 'hrsh7th/cmp-cmdline' -- { name = 'cmdline' } + use 'hrsh7th/nvim-cmp' + -- vsnip + use 'hrsh7th/cmp-vsnip' -- { name = 'vsnip' } + use 'hrsh7th/vim-vsnip' + use 'rafamadriz/friendly-snippets' + -- lspkind + use 'onsails/lspkind-nvim' + + -- 主题 + use 'morhetz/gruvbox' + + + use { + 'kyazdani42/nvim-tree.lua', + requires = { + 'kyazdani42/nvim-web-devicons', -- optional, for file icon + } + } + + -- using packer.nvim + use {'akinsho/bufferline.nvim', requires = 'kyazdani42/nvim-web-devicons'} + + + -- treesitter (新增) + use { 'nvim-treesitter/nvim-treesitter', run = ':TSUpdate' } + + -- java + use 'mfussenegger/nvim-jdtls' + + -- git + use 'tpope/vim-fugitive' + + -- LeaderF + use 'Yggdroot/LeaderF' +end) + +require('plugins/config/bufferline') +require('plugins/config/nvim-tree') +require('plugins/config/nvim-treesitter') +require('plugins/config/nvim-cmp') +require('plugins/config/LeaderF') diff --git a/plugin/packer_compiled.lua b/plugin/packer_compiled.lua new file mode 100644 index 00000000..762080da --- /dev/null +++ b/plugin/packer_compiled.lua @@ -0,0 +1,181 @@ +-- Automatically generated packer.nvim plugin loader code + +if vim.api.nvim_call_function('has', {'nvim-0.5'}) ~= 1 then + vim.api.nvim_command('echohl WarningMsg | echom "Invalid Neovim version for packer.nvim! | echohl None"') + return +end + +vim.api.nvim_command('packadd packer.nvim') + +local no_errors, error_msg = pcall(function() + + local time + local profile_info + local should_profile = false + if should_profile then + local hrtime = vim.loop.hrtime + profile_info = {} + time = function(chunk, start) + if start then + profile_info[chunk] = hrtime() + else + profile_info[chunk] = (hrtime() - profile_info[chunk]) / 1e6 + end + end + else + time = function(chunk, start) end + end + +local function save_profiles(threshold) + local sorted_times = {} + for chunk_name, time_taken in pairs(profile_info) do + sorted_times[#sorted_times + 1] = {chunk_name, time_taken} + end + table.sort(sorted_times, function(a, b) return a[2] > b[2] end) + local results = {} + for i, elem in ipairs(sorted_times) do + if not threshold or threshold and elem[2] > threshold then + results[i] = elem[1] .. ' took ' .. elem[2] .. 'ms' + end + end + + _G._packer = _G._packer or {} + _G._packer.profile_output = results +end + +time([[Luarocks path setup]], true) +local package_path_str = "/Users/kailuo/.cache/nvim/packer_hererocks/2.1.0-beta3/share/lua/5.1/?.lua;/Users/kailuo/.cache/nvim/packer_hererocks/2.1.0-beta3/share/lua/5.1/?/init.lua;/Users/kailuo/.cache/nvim/packer_hererocks/2.1.0-beta3/lib/luarocks/rocks-5.1/?.lua;/Users/kailuo/.cache/nvim/packer_hererocks/2.1.0-beta3/lib/luarocks/rocks-5.1/?/init.lua" +local install_cpath_pattern = "/Users/kailuo/.cache/nvim/packer_hererocks/2.1.0-beta3/lib/lua/5.1/?.so" +if not string.find(package.path, package_path_str, 1, true) then + package.path = package.path .. ';' .. package_path_str +end + +if not string.find(package.cpath, install_cpath_pattern, 1, true) then + package.cpath = package.cpath .. ';' .. install_cpath_pattern +end + +time([[Luarocks path setup]], false) +time([[try_loadstring definition]], true) +local function try_loadstring(s, component, name) + local success, result = pcall(loadstring(s), name, _G.packer_plugins[name]) + if not success then + vim.schedule(function() + vim.api.nvim_notify('packer.nvim: Error running ' .. component .. ' for ' .. name .. ': ' .. result, vim.log.levels.ERROR, {}) + end) + end + return result +end + +time([[try_loadstring definition]], false) +time([[Defining packer_plugins]], true) +_G.packer_plugins = { + LeaderF = { + loaded = true, + path = "/Users/kailuo/.local/share/nvim/site/pack/packer/start/LeaderF", + url = "https://github.com/Yggdroot/LeaderF" + }, + ["bufferline.nvim"] = { + loaded = true, + path = "/Users/kailuo/.local/share/nvim/site/pack/packer/start/bufferline.nvim", + url = "https://github.com/akinsho/bufferline.nvim" + }, + ["cmp-buffer"] = { + loaded = true, + path = "/Users/kailuo/.local/share/nvim/site/pack/packer/start/cmp-buffer", + url = "https://github.com/hrsh7th/cmp-buffer" + }, + ["cmp-cmdline"] = { + loaded = true, + path = "/Users/kailuo/.local/share/nvim/site/pack/packer/start/cmp-cmdline", + url = "https://github.com/hrsh7th/cmp-cmdline" + }, + ["cmp-nvim-lsp"] = { + loaded = true, + path = "/Users/kailuo/.local/share/nvim/site/pack/packer/start/cmp-nvim-lsp", + url = "https://github.com/hrsh7th/cmp-nvim-lsp" + }, + ["cmp-path"] = { + loaded = true, + path = "/Users/kailuo/.local/share/nvim/site/pack/packer/start/cmp-path", + url = "https://github.com/hrsh7th/cmp-path" + }, + ["cmp-vsnip"] = { + loaded = true, + path = "/Users/kailuo/.local/share/nvim/site/pack/packer/start/cmp-vsnip", + url = "https://github.com/hrsh7th/cmp-vsnip" + }, + ["friendly-snippets"] = { + loaded = true, + path = "/Users/kailuo/.local/share/nvim/site/pack/packer/start/friendly-snippets", + url = "https://github.com/rafamadriz/friendly-snippets" + }, + gruvbox = { + loaded = true, + path = "/Users/kailuo/.local/share/nvim/site/pack/packer/start/gruvbox", + url = "https://github.com/morhetz/gruvbox" + }, + ["lspkind-nvim"] = { + loaded = true, + path = "/Users/kailuo/.local/share/nvim/site/pack/packer/start/lspkind-nvim", + url = "https://github.com/onsails/lspkind-nvim" + }, + ["nvim-cmp"] = { + loaded = true, + path = "/Users/kailuo/.local/share/nvim/site/pack/packer/start/nvim-cmp", + url = "https://github.com/hrsh7th/nvim-cmp" + }, + ["nvim-jdtls"] = { + loaded = true, + path = "/Users/kailuo/.local/share/nvim/site/pack/packer/start/nvim-jdtls", + url = "https://github.com/mfussenegger/nvim-jdtls" + }, + ["nvim-lsp-installer"] = { + loaded = true, + path = "/Users/kailuo/.local/share/nvim/site/pack/packer/start/nvim-lsp-installer", + url = "https://github.com/williamboman/nvim-lsp-installer" + }, + ["nvim-lspconfig"] = { + loaded = true, + path = "/Users/kailuo/.local/share/nvim/site/pack/packer/start/nvim-lspconfig", + url = "https://github.com/neovim/nvim-lspconfig" + }, + ["nvim-tree.lua"] = { + loaded = true, + path = "/Users/kailuo/.local/share/nvim/site/pack/packer/start/nvim-tree.lua", + url = "https://github.com/kyazdani42/nvim-tree.lua" + }, + ["nvim-treesitter"] = { + loaded = true, + path = "/Users/kailuo/.local/share/nvim/site/pack/packer/start/nvim-treesitter", + url = "https://github.com/nvim-treesitter/nvim-treesitter" + }, + ["nvim-web-devicons"] = { + loaded = true, + path = "/Users/kailuo/.local/share/nvim/site/pack/packer/start/nvim-web-devicons", + url = "https://github.com/kyazdani42/nvim-web-devicons" + }, + ["packer.nvim"] = { + loaded = true, + path = "/Users/kailuo/.local/share/nvim/site/pack/packer/start/packer.nvim", + url = "https://github.com/wbthomason/packer.nvim" + }, + ["vim-fugitive"] = { + loaded = true, + path = "/Users/kailuo/.local/share/nvim/site/pack/packer/start/vim-fugitive", + url = "https://github.com/tpope/vim-fugitive" + }, + ["vim-vsnip"] = { + loaded = true, + path = "/Users/kailuo/.local/share/nvim/site/pack/packer/start/vim-vsnip", + url = "https://github.com/hrsh7th/vim-vsnip" + } +} + +time([[Defining packer_plugins]], false) +if should_profile then save_profiles() end + +end) + +if not no_errors then + vim.api.nvim_command('echohl ErrorMsg | echom "Error in packer_compiled: '..error_msg..'" | echom "Please check your config for correctness" | echohl None') +end From fbe9f0677d0f18898a0db91e93aa5edc79c21ffc Mon Sep 17 00:00:00 2001 From: kaiv2 Date: Wed, 26 Jan 2022 15:43:03 +0800 Subject: [PATCH 0002/1278] add plugin --- lua/plugins/config/LeaderF.lua | 3 ++ lua/plugins/config/gitsigns-nvim.lua | 44 ++++++++++++++++++ lua/plugins/config/nvim-tree.lua | 63 ++++++++++++++++++++++++-- lua/plugins/config/nvim-treesitter.lua | 48 +++++++++++--------- lua/plugins/init.lua | 9 ++++ plugin/packer_compiled.lua | 10 ++++ 6 files changed, 150 insertions(+), 27 deletions(-) create mode 100644 lua/plugins/config/gitsigns-nvim.lua diff --git a/lua/plugins/config/LeaderF.lua b/lua/plugins/config/LeaderF.lua index b298f172..1da10447 100644 --- a/lua/plugins/config/LeaderF.lua +++ b/lua/plugins/config/LeaderF.lua @@ -1 +1,4 @@ vim.g.Lf_WindowPosition = 'popup' +-- 不使用缓存(大型项目不推荐) +vim.g.Lf_UseCache=0 +vim.g.Lf_UseMemoryCache=0 diff --git a/lua/plugins/config/gitsigns-nvim.lua b/lua/plugins/config/gitsigns-nvim.lua new file mode 100644 index 00000000..3a530ccb --- /dev/null +++ b/lua/plugins/config/gitsigns-nvim.lua @@ -0,0 +1,44 @@ + +require('gitsigns').setup { + signs = { + add = {hl = 'GitSignsAdd' , text = '│', numhl='GitSignsAddNr' , linehl='GitSignsAddLn'}, + change = {hl = 'GitSignsChange', text = '│', numhl='GitSignsChangeNr', linehl='GitSignsChangeLn'}, + delete = {hl = 'GitSignsDelete', text = '_', numhl='GitSignsDeleteNr', linehl='GitSignsDeleteLn'}, + topdelete = {hl = 'GitSignsDelete', text = '‾', numhl='GitSignsDeleteNr', linehl='GitSignsDeleteLn'}, + changedelete = {hl = 'GitSignsChange', text = '~', numhl='GitSignsChangeNr', linehl='GitSignsChangeLn'}, + }, + signcolumn = true, -- Toggle with `:Gitsigns toggle_signs` + numhl = false, -- Toggle with `:Gitsigns toggle_numhl` + linehl = false, -- Toggle with `:Gitsigns toggle_linehl` + word_diff = false, -- Toggle with `:Gitsigns toggle_word_diff` + watch_gitdir = { + interval = 1000, + follow_files = true + }, + attach_to_untracked = true, + current_line_blame = true, -- Toggle with `:Gitsigns toggle_current_line_blame` + current_line_blame_opts = { + virt_text = true, + virt_text_pos = 'eol', -- 'eol' | 'overlay' | 'right_align' + delay = 400, + ignore_whitespace = false, + }, + current_line_blame_formatter_opts = { + relative_time = false + }, + sign_priority = 6, + update_debounce = 100, + status_formatter = nil, -- Use default + max_file_length = 40000, + preview_config = { + -- Options passed to nvim_open_win + border = 'single', + style = 'minimal', + relative = 'cursor', + row = 0, + col = 1 + }, + yadm = { + enable = false + }, +} diff --git a/lua/plugins/config/nvim-tree.lua b/lua/plugins/config/nvim-tree.lua index 195e3934..2930e1d0 100644 --- a/lua/plugins/config/nvim-tree.lua +++ b/lua/plugins/config/nvim-tree.lua @@ -1,8 +1,61 @@ require'nvim-tree'.setup { - -- 关闭文件时不自动关闭 - auto_close = false, - -- 显示 git 状态图标 - git = { - enable = true + disable_netrw = true, + hijack_netrw = true, + open_on_setup = false, + ignore_ft_on_setup = {}, + auto_close = true, + open_on_tab = false, + hijack_cursor = false, + update_cwd = false, + update_to_buf_dir = { + enable = true, + auto_open = true, + }, + diagnostics = { + enable = false, + icons = { + hint = "", + info = "", + warning = "", + error = "", } + }, + update_focused_file = { + enable = true, + update_cwd = true, + ignore_list = {} + }, + system_open = { + cmd = nil, + args = {} + }, + filters = { + dotfiles = false, + custom = {} + }, + git = { + enable = true, + ignore = true, + timeout = 500, + }, + view = { + width = 30, + height = 30, + hide_root_folder = true, + side = 'left', + auto_resize = true, + mappings = { + custom_only = false, + list = {} + }, + number = false, + relativenumber = false, + signcolumn = "yes" + }, + trash = { + cmd = "trash", + require_confirm = true + } } + +vim.g.nvim_tree_quit_on_open=1 diff --git a/lua/plugins/config/nvim-treesitter.lua b/lua/plugins/config/nvim-treesitter.lua index a0858004..056314a2 100644 --- a/lua/plugins/config/nvim-treesitter.lua +++ b/lua/plugins/config/nvim-treesitter.lua @@ -1,26 +1,30 @@ require'nvim-treesitter.configs'.setup { - -- 安装 language parser - -- :TSInstallInfo 命令查看支持的语言 - ensure_installed = {"html", "css", "vim", "lua", "javascript", "typescript", "tsx", "java", "rust"}, - -- 启用代码高亮功能 - highlight = { - enable = true, - additional_vim_regex_highlighting = false - }, - -- 启用增量选择 - incremental_selection = { - enable = true, - keymaps = { - init_selection = '', - node_incremental = '', - node_decremental = '', - scope_incremental = '', - } - }, - -- 启用基于Treesitter的代码格式化(=) . NOTE: This is an experimental feature. - indent = { - enable = true - } + -- One of "all", "maintained" (parsers with maintainers), or a list of languages + ensure_installed = "maintained", + + -- Install languages synchronously (only applied to `ensure_installed`) + sync_install = false, + + -- List of parsers to ignore installing + ignore_install = { "javascript" }, + + highlight = { + -- `false` will disable the whole extension + enable = true, + + -- list of language that will be disabled + disable = { "c", "rust" }, + + -- Setting this to true will run `:h syntax` and tree-sitter at the same time. + -- Set this to `true` if you depend on 'syntax' being enabled (like for indentation). + -- Using this option may slow down your editor, and you may see some duplicate highlights. + -- Instead of true it can also be a list of languages + additional_vim_regex_highlighting = false, + }, + matchup = { + enable = true, + disable = { "c", "rust" }, + }, } -- 开启 Folding vim.wo.foldmethod = 'expr' diff --git a/lua/plugins/init.lua b/lua/plugins/init.lua index a52c65ab..0ecb004b 100644 --- a/lua/plugins/init.lua +++ b/lua/plugins/init.lua @@ -42,6 +42,14 @@ require('packer').startup(function() -- LeaderF use 'Yggdroot/LeaderF' + + use { + 'lewis6991/gitsigns.nvim', + requires = { + 'nvim-lua/plenary.nvim' + }, + -- tag = 'release' -- To use the latest release + } end) require('plugins/config/bufferline') @@ -49,3 +57,4 @@ require('plugins/config/nvim-tree') require('plugins/config/nvim-treesitter') require('plugins/config/nvim-cmp') require('plugins/config/LeaderF') +require('plugins/config/gitsigns-nvim') diff --git a/plugin/packer_compiled.lua b/plugin/packer_compiled.lua index 762080da..6d411d9e 100644 --- a/plugin/packer_compiled.lua +++ b/plugin/packer_compiled.lua @@ -109,6 +109,11 @@ _G.packer_plugins = { path = "/Users/kailuo/.local/share/nvim/site/pack/packer/start/friendly-snippets", url = "https://github.com/rafamadriz/friendly-snippets" }, + ["gitsigns.nvim"] = { + loaded = true, + path = "/Users/kailuo/.local/share/nvim/site/pack/packer/start/gitsigns.nvim", + url = "https://github.com/lewis6991/gitsigns.nvim" + }, gruvbox = { loaded = true, path = "/Users/kailuo/.local/share/nvim/site/pack/packer/start/gruvbox", @@ -159,6 +164,11 @@ _G.packer_plugins = { path = "/Users/kailuo/.local/share/nvim/site/pack/packer/start/packer.nvim", url = "https://github.com/wbthomason/packer.nvim" }, + ["plenary.nvim"] = { + loaded = true, + path = "/Users/kailuo/.local/share/nvim/site/pack/packer/start/plenary.nvim", + url = "https://github.com/nvim-lua/plenary.nvim" + }, ["vim-fugitive"] = { loaded = true, path = "/Users/kailuo/.local/share/nvim/site/pack/packer/start/vim-fugitive", From c16a82233fedb9bc473484ba7186477e5d775006 Mon Sep 17 00:00:00 2001 From: kaiv2 Date: Wed, 26 Jan 2022 17:20:26 +0800 Subject: [PATCH 0003/1278] add plugin --- lua/basic.lua | 2 +- lua/keybindings.lua | 18 ++++++++-- lua/plugins/config/asynctasks.lua | 6 ++++ lua/plugins/config/feline.lua | 1 + lua/plugins/config/indent-blankline.lua | 10 ++++++ lua/plugins/config/vim-floaterm.lua | 6 ++++ lua/plugins/init.lua | 30 +++++++++++++++++ plugin/packer_compiled.lua | 45 +++++++++++++++++++++++++ 8 files changed, 114 insertions(+), 4 deletions(-) create mode 100644 lua/plugins/config/asynctasks.lua create mode 100644 lua/plugins/config/feline.lua create mode 100644 lua/plugins/config/indent-blankline.lua create mode 100644 lua/plugins/config/vim-floaterm.lua diff --git a/lua/basic.lua b/lua/basic.lua index bd7ba230..3e4a1fa0 100644 --- a/lua/basic.lua +++ b/lua/basic.lua @@ -6,7 +6,7 @@ vim.wo.relativenumber = true vim.wo.cursorline = true -- 右侧参考线,超过表示代码太长了,考虑换行 -vim.wo.colorcolumn = "80" +-- vim.wo.colorcolumn = "80" vim.g.encoding = "UTF-8" diff --git a/lua/keybindings.lua b/lua/keybindings.lua index 6bca4427..84631fac 100644 --- a/lua/keybindings.lua +++ b/lua/keybindings.lua @@ -5,7 +5,7 @@ local map = vim.api.nvim_set_keymap local opt = {noremap = true, silent = true } -- nvimTree -map('n', 'et', ':NvimTreeToggle', opt) +map('n', 'n', ':NvimTreeToggle', opt) -- n 模式下复制内容到系统剪切板 map('n', 'c', '"+yy', opt) -- v 模式下复制内容到系统剪切板 @@ -17,6 +17,18 @@ map('n', '', ':nohlsearch', opt) -- %bd 删除所有缓冲区, e# 打开最后一个缓冲区, bd# 关闭[No Name] map('n', 'o', ':%bd|e#|bd#', opt) map('n', 'w', ':bw', opt) +-- " 退出 terminal 模式 +map('t', '', '', opt) + +-- Leaderf +vim.g.Lf_ShortcutF = '' +map('n', '', ':=printf("Leaderf! rg -e %s ", expand(""))', {}) +map('v', '', ':=printf("Leaderf! rg -e %s ", leaderf#Rg#visual())', {}) + +-- vim-floaterm +vim.g.floaterm_keymap_new = 't' +map('n', '', ':FloatermToggle', opt) +map('t', ' ', '::FloatermToggle', opt) local pluginKeys = {} @@ -52,9 +64,9 @@ end pluginKeys.cmp = function(cmp) return { -- 上一个 - [''] = cmp.mapping.select_prev_item(), + -- [''] = cmp.mapping.select_prev_item(), -- 下一个 - [''] = cmp.mapping.select_next_item(), + [''] = cmp.mapping.select_next_item(), -- 出现补全 [''] = cmp.mapping(cmp.mapping.complete(), { 'i', 'c' }), -- 取消 diff --git a/lua/plugins/config/asynctasks.lua b/lua/plugins/config/asynctasks.lua new file mode 100644 index 00000000..418c492a --- /dev/null +++ b/lua/plugins/config/asynctasks.lua @@ -0,0 +1,6 @@ +vim.g.asyncrun_open = 20 +vim.g.asyncrun_mode = 'term' +vim.g.asynctasks_term_pos = 'floaterm' +-- 此配置无效(无效变量) +vim.g.asyncrun_term_pos = 'floaterm' + diff --git a/lua/plugins/config/feline.lua b/lua/plugins/config/feline.lua new file mode 100644 index 00000000..8f2fddfd --- /dev/null +++ b/lua/plugins/config/feline.lua @@ -0,0 +1 @@ +require('feline').setup() diff --git a/lua/plugins/config/indent-blankline.lua b/lua/plugins/config/indent-blankline.lua new file mode 100644 index 00000000..a0e18b73 --- /dev/null +++ b/lua/plugins/config/indent-blankline.lua @@ -0,0 +1,10 @@ +vim.opt.list = true +-- vim.opt.listchars:append("space:⋅") +-- vim.opt.listchars:append("eol:↴") + +require("indent_blankline").setup { +-- show_end_of_line = true, +-- space_char_blankline = " ", + show_current_context = true, +-- show_current_context_start = true, +} diff --git a/lua/plugins/config/vim-floaterm.lua b/lua/plugins/config/vim-floaterm.lua new file mode 100644 index 00000000..9ef5fb46 --- /dev/null +++ b/lua/plugins/config/vim-floaterm.lua @@ -0,0 +1,6 @@ +vim.g.floaterm_position='bottomright' +vim.g.floaterm_autoclose=1 +vim.g.floaterm_wintype='float' +vim.g.floaterm_width=0.9 +vim.g.floaterm_height=0.4 +-- vim.g.floaterm_rootmarkers=['.project', '.git', '.hg', '.svn', '.root', '.gitignore'] diff --git a/lua/plugins/init.lua b/lua/plugins/init.lua index 0ecb004b..4e4cf166 100644 --- a/lua/plugins/init.lua +++ b/lua/plugins/init.lua @@ -15,11 +15,15 @@ require('packer').startup(function() use 'rafamadriz/friendly-snippets' -- lspkind use 'onsails/lspkind-nvim' + -- use 'glepnir/lspsaga.nvim' + + -- lsp 相关 -- 主题 use 'morhetz/gruvbox' + -- 文件管理 use { 'kyazdani42/nvim-tree.lua', requires = { @@ -43,6 +47,7 @@ require('packer').startup(function() -- LeaderF use 'Yggdroot/LeaderF' + -- git edit 状态显示插件 use { 'lewis6991/gitsigns.nvim', requires = { @@ -50,6 +55,27 @@ require('packer').startup(function() }, -- tag = 'release' -- To use the latest release } + + -- 异步任务执行插件 + use 'skywind3000/asynctasks.vim' + use 'skywind3000/asyncrun.vim' + + -- 浮动窗口插件 + use 'voldikss/vim-floaterm' + use 'voldikss/LeaderF-floaterm' + + -- 多光标插件 + use 'mg979/vim-visual-multi' + + -- 状态栏插件 + use 'feline-nvim/feline.nvim' + + -- blankline + use "lukas-reineke/indent-blankline.nvim" + + -- <>()等匹配插件 + use 'andymass/vim-matchup' + use 'liuchengxu/vista.vim' end) require('plugins/config/bufferline') @@ -58,3 +84,7 @@ require('plugins/config/nvim-treesitter') require('plugins/config/nvim-cmp') require('plugins/config/LeaderF') require('plugins/config/gitsigns-nvim') +require('plugins/config/vim-floaterm') +require('plugins/config/asynctasks') +require('plugins/config/feline') +require('plugins/config/indent-blankline') diff --git a/plugin/packer_compiled.lua b/plugin/packer_compiled.lua index 6d411d9e..7f964c88 100644 --- a/plugin/packer_compiled.lua +++ b/plugin/packer_compiled.lua @@ -74,6 +74,21 @@ _G.packer_plugins = { path = "/Users/kailuo/.local/share/nvim/site/pack/packer/start/LeaderF", url = "https://github.com/Yggdroot/LeaderF" }, + ["LeaderF-floaterm"] = { + loaded = true, + path = "/Users/kailuo/.local/share/nvim/site/pack/packer/start/LeaderF-floaterm", + url = "https://github.com/voldikss/LeaderF-floaterm" + }, + ["asyncrun.vim"] = { + loaded = true, + path = "/Users/kailuo/.local/share/nvim/site/pack/packer/start/asyncrun.vim", + url = "https://github.com/skywind3000/asyncrun.vim" + }, + ["asynctasks.vim"] = { + loaded = true, + path = "/Users/kailuo/.local/share/nvim/site/pack/packer/start/asynctasks.vim", + url = "https://github.com/skywind3000/asynctasks.vim" + }, ["bufferline.nvim"] = { loaded = true, path = "/Users/kailuo/.local/share/nvim/site/pack/packer/start/bufferline.nvim", @@ -104,6 +119,11 @@ _G.packer_plugins = { path = "/Users/kailuo/.local/share/nvim/site/pack/packer/start/cmp-vsnip", url = "https://github.com/hrsh7th/cmp-vsnip" }, + ["feline.nvim"] = { + loaded = true, + path = "/Users/kailuo/.local/share/nvim/site/pack/packer/start/feline.nvim", + url = "https://github.com/feline-nvim/feline.nvim" + }, ["friendly-snippets"] = { loaded = true, path = "/Users/kailuo/.local/share/nvim/site/pack/packer/start/friendly-snippets", @@ -119,6 +139,11 @@ _G.packer_plugins = { path = "/Users/kailuo/.local/share/nvim/site/pack/packer/start/gruvbox", url = "https://github.com/morhetz/gruvbox" }, + ["indent-blankline.nvim"] = { + loaded = true, + path = "/Users/kailuo/.local/share/nvim/site/pack/packer/start/indent-blankline.nvim", + url = "https://github.com/lukas-reineke/indent-blankline.nvim" + }, ["lspkind-nvim"] = { loaded = true, path = "/Users/kailuo/.local/share/nvim/site/pack/packer/start/lspkind-nvim", @@ -169,15 +194,35 @@ _G.packer_plugins = { path = "/Users/kailuo/.local/share/nvim/site/pack/packer/start/plenary.nvim", url = "https://github.com/nvim-lua/plenary.nvim" }, + ["vim-floaterm"] = { + loaded = true, + path = "/Users/kailuo/.local/share/nvim/site/pack/packer/start/vim-floaterm", + url = "https://github.com/voldikss/vim-floaterm" + }, ["vim-fugitive"] = { loaded = true, path = "/Users/kailuo/.local/share/nvim/site/pack/packer/start/vim-fugitive", url = "https://github.com/tpope/vim-fugitive" }, + ["vim-matchup"] = { + loaded = true, + path = "/Users/kailuo/.local/share/nvim/site/pack/packer/start/vim-matchup", + url = "https://github.com/andymass/vim-matchup" + }, + ["vim-visual-multi"] = { + loaded = true, + path = "/Users/kailuo/.local/share/nvim/site/pack/packer/start/vim-visual-multi", + url = "https://github.com/mg979/vim-visual-multi" + }, ["vim-vsnip"] = { loaded = true, path = "/Users/kailuo/.local/share/nvim/site/pack/packer/start/vim-vsnip", url = "https://github.com/hrsh7th/vim-vsnip" + }, + ["vista.vim"] = { + loaded = true, + path = "/Users/kailuo/.local/share/nvim/site/pack/packer/start/vista.vim", + url = "https://github.com/liuchengxu/vista.vim" } } From ab7b82815f44a546a811dd8cc86bb33d8b5b143e Mon Sep 17 00:00:00 2001 From: kaiv2 Date: Wed, 26 Jan 2022 17:23:44 +0800 Subject: [PATCH 0004/1278] =?UTF-8?q?=E6=A0=BC=E5=BC=8F=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lua/plugins/init.lua | 114 +++++++++++++++++++++---------------------- 1 file changed, 57 insertions(+), 57 deletions(-) diff --git a/lua/plugins/init.lua b/lua/plugins/init.lua index 4e4cf166..44c7d879 100644 --- a/lua/plugins/init.lua +++ b/lua/plugins/init.lua @@ -1,81 +1,81 @@ require('packer').startup(function() - -- Packer can manage itself - use 'wbthomason/packer.nvim' - use {'neovim/nvim-lspconfig', 'williamboman/nvim-lsp-installer'} - - -- nvim-cmp - use 'hrsh7th/cmp-nvim-lsp' -- { name = nvim_lsp } - use 'hrsh7th/cmp-buffer' -- { name = 'buffer' }, - use 'hrsh7th/cmp-path' -- { name = 'path' } - use 'hrsh7th/cmp-cmdline' -- { name = 'cmdline' } - use 'hrsh7th/nvim-cmp' - -- vsnip - use 'hrsh7th/cmp-vsnip' -- { name = 'vsnip' } - use 'hrsh7th/vim-vsnip' - use 'rafamadriz/friendly-snippets' - -- lspkind - use 'onsails/lspkind-nvim' + -- Packer can manage itself + use 'wbthomason/packer.nvim' + use {'neovim/nvim-lspconfig', 'williamboman/nvim-lsp-installer'} + + -- nvim-cmp + use 'hrsh7th/cmp-nvim-lsp' -- { name = nvim_lsp } + use 'hrsh7th/cmp-buffer' -- { name = 'buffer' }, + use 'hrsh7th/cmp-path' -- { name = 'path' } + use 'hrsh7th/cmp-cmdline' -- { name = 'cmdline' } + use 'hrsh7th/nvim-cmp' + -- vsnip + use 'hrsh7th/cmp-vsnip' -- { name = 'vsnip' } + use 'hrsh7th/vim-vsnip' + use 'rafamadriz/friendly-snippets' + -- lspkind + use 'onsails/lspkind-nvim' -- use 'glepnir/lspsaga.nvim' -- lsp 相关 - -- 主题 - use 'morhetz/gruvbox' + -- 主题 + use 'morhetz/gruvbox' -- 文件管理 - use { - 'kyazdani42/nvim-tree.lua', - requires = { - 'kyazdani42/nvim-web-devicons', -- optional, for file icon - } - } + use { + 'kyazdani42/nvim-tree.lua', + requires = { + 'kyazdani42/nvim-web-devicons', -- optional, for file icon + } + } - -- using packer.nvim - use {'akinsho/bufferline.nvim', requires = 'kyazdani42/nvim-web-devicons'} + -- using packer.nvim + use {'akinsho/bufferline.nvim', requires = 'kyazdani42/nvim-web-devicons'} - -- treesitter (新增) - use { 'nvim-treesitter/nvim-treesitter', run = ':TSUpdate' } + -- treesitter (新增) + use { 'nvim-treesitter/nvim-treesitter', run = ':TSUpdate' } - -- java - use 'mfussenegger/nvim-jdtls' + -- java + use 'mfussenegger/nvim-jdtls' - -- git - use 'tpope/vim-fugitive' + -- git + use 'tpope/vim-fugitive' - -- LeaderF - use 'Yggdroot/LeaderF' + -- LeaderF + use 'Yggdroot/LeaderF' - -- git edit 状态显示插件 - use { - 'lewis6991/gitsigns.nvim', - requires = { - 'nvim-lua/plenary.nvim' - }, - -- tag = 'release' -- To use the latest release - } + -- git edit 状态显示插件 + use { + 'lewis6991/gitsigns.nvim', + requires = { + 'nvim-lua/plenary.nvim' + }, + -- tag = 'release' -- To use the latest release + } - -- 异步任务执行插件 - use 'skywind3000/asynctasks.vim' - use 'skywind3000/asyncrun.vim' + -- 异步任务执行插件 + use 'skywind3000/asynctasks.vim' + use 'skywind3000/asyncrun.vim' - -- 浮动窗口插件 - use 'voldikss/vim-floaterm' - use 'voldikss/LeaderF-floaterm' + -- 浮动窗口插件 + use 'voldikss/vim-floaterm' + use 'voldikss/LeaderF-floaterm' - -- 多光标插件 - use 'mg979/vim-visual-multi' + -- 多光标插件 + use 'mg979/vim-visual-multi' - -- 状态栏插件 - use 'feline-nvim/feline.nvim' + -- 状态栏插件 + use 'feline-nvim/feline.nvim' - -- blankline - use "lukas-reineke/indent-blankline.nvim" + -- blankline + use "lukas-reineke/indent-blankline.nvim" - -- <>()等匹配插件 - use 'andymass/vim-matchup' - use 'liuchengxu/vista.vim' + -- <>()等匹配插件 + use 'andymass/vim-matchup' + use 'liuchengxu/vista.vim' end) require('plugins/config/bufferline') From b09db68670b6ba1085fb809b46b068d6d644d430 Mon Sep 17 00:00:00 2001 From: kaiv2 Date: Wed, 26 Jan 2022 21:45:54 +0800 Subject: [PATCH 0005/1278] config --- ftplugin/java.lua | 76 ------------------------------- lua/keybindings.lua | 6 ++- lua/lsp/init.lua | 6 +-- lua/lsp/java.lua | 63 +++++++++++++++++++++++-- lua/plugins/config/asynctasks.lua | 54 ++++++++++++++++++++++ lua/plugins/config/vista.lua | 1 + lua/plugins/init.lua | 2 + 7 files changed, 125 insertions(+), 83 deletions(-) create mode 100644 lua/plugins/config/vista.lua diff --git a/ftplugin/java.lua b/ftplugin/java.lua index 298b64b5..e69de29b 100644 --- a/ftplugin/java.lua +++ b/ftplugin/java.lua @@ -1,76 +0,0 @@ --- If you started neovim within `~/dev/xy/project-1` this would resolve to `project-1` -local project_name = vim.fn.fnamemodify(vim.fn.getcwd(), ':p:h:t') - -local workspace_dir = '/Users/kailuo/jdtls-workspace/' .. project_name - --- See `:help vim.lsp.start_client` for an overview of the supported `config` options. -local config = { - -- The command that starts the language server - -- See: https://github.com/eclipse/eclipse.jdt.ls#running-from-the-command-line - cmd = { - '/Library/Java/JavaVirtualMachines/zulu-11.jdk/Contents/Home/bin/java', -- or '/path/to/java11_or_newer/bin/java' - '-Declipse.application=org.eclipse.jdt.ls.core.id1', - '-Dosgi.bundles.defaultStartLevel=4', - '-Declipse.product=org.eclipse.jdt.ls.core.product', - '-Dlog.protocol=true', - '-Dlog.level=ALL', - '-Xms1g', - '-Xmx2g', - '--add-modules=ALL-SYSTEM', - '--add-opens', 'java.base/java.util=ALL-UNNAMED', - '--add-opens', 'java.base/java.lang=ALL-UNNAMED', - '-jar', '/opt/software/jdtls/plugins/org.eclipse.equinox.launcher_1.6.300.v20210813-1054.jar', - '-configuration', '/opt/software/jdtls/config_mac', - '-data', workspace_dir, - }, - - -- 💀 - -- This is the default if not provided, you can remove it. Or adjust as needed. - -- One dedicated LSP server & client will be started per unique root_dir - -- root_dir = require('jdtls.setup').find_root({'.git', 'mvnw', 'gradlew'}), - - -- Here you can configure eclipse.jdt.ls specific settings - -- See https://github.com/eclipse/eclipse.jdt.ls/wiki/Running-the-JAVA-LS-server-from-the-command-line#initialize-request - -- for a list of options - settings = { - java = { - home = "/Library/Java/JavaVirtualMachines/zulu-11.jdk/Contents/Home", - eclipse = { - downloadSources = true, - }, - server = { - launchMode = "Hybrid", - }, - configuration = { - maven = { - userSettings = "/opt/software/apache-maven-3.6.3/conf/settings.xml", - globalSettings = "/opt/software/apache-maven-3.6.3/conf/settings.xml", - }, - runtimes = { - { - name = "JavaSE-1.8", - path = "/Library/Java/JavaVirtualMachines/zulu-8.jdk/Contents/Home", - }, - { - name = "JavaSE-11", - path = "/Library/Java/JavaVirtualMachines/zulu-11.jdk/Contents/Home", - }, - } - }, - } - }, - - -- Language server `initializationOptions` - -- You need to extend the `bundles` with paths to jar files - -- if you want to use additional eclipse.jdt.ls plugins. - -- - -- See https://github.com/mfussenegger/nvim-jdtls#java-debug-installation - -- - -- If you don't plan on using the debugger or other eclipse.jdt.ls plugins you can remove this - init_options = { - bundles = {} - }, -} --- This starts a new client & server, --- or attaches to an existing client & server depending on the `root_dir`. -require('jdtls').start_or_attach(config) diff --git a/lua/keybindings.lua b/lua/keybindings.lua index 84631fac..1c36c952 100644 --- a/lua/keybindings.lua +++ b/lua/keybindings.lua @@ -24,12 +24,17 @@ map('t', '', '', opt) vim.g.Lf_ShortcutF = '' map('n', '', ':=printf("Leaderf! rg -e %s ", expand(""))', {}) map('v', '', ':=printf("Leaderf! rg -e %s ", leaderf#Rg#visual())', {}) +map('n', 'r', ':Leaderf --nowrap task', {}) -- vim-floaterm vim.g.floaterm_keymap_new = 't' map('n', '', ':FloatermToggle', opt) map('t', ' ', '::FloatermToggle', opt) + +-- vista +map('n', 'o', ':Vista!!', opt) + local pluginKeys = {} -- lsp 回调函数快捷键设置 @@ -79,7 +84,6 @@ pluginKeys.cmp = function(cmp) -- Set `select` to `false` to only confirm explicitly selected items. [''] = cmp.mapping.confirm({ select = true , - behavior = cmp.ConfirmBehavior.Replace }), -- [''] = cmp.config.disable, -- Specify `cmp.config.disable` if you want to remove the default `` mapping. [''] = cmp.mapping(cmp.mapping.scroll_docs(-4), { 'i', 'c' }), diff --git a/lua/lsp/init.lua b/lua/lsp/init.lua index 45efaadc..9064e651 100644 --- a/lua/lsp/init.lua +++ b/lua/lsp/init.lua @@ -5,13 +5,13 @@ local lsp_installer = require "nvim-lsp-installer" -- { key: 语言 value: 配置文件 } local servers = { sumneko_lua = require "lsp.lua", -- /lua/lsp/lua.lua - -- jdtls = require "lsp.java", -- /lua/lsp/jdtls.lua + jdtls = require "lsp.java", -- /lua/lsp/jdtls.lua } -- 自动安装 LanguageServers for name, _ in pairs(servers) do - local server_is_found, server = lsp_installer.get_server(name) - if server_is_found then + local server_available, server = lsp_installer.get_server(name) + if server_available then if not server:is_installed() then print("Installing " .. name) server:install() diff --git a/lua/lsp/java.lua b/lua/lsp/java.lua index 272ee436..61d42c86 100644 --- a/lua/lsp/java.lua +++ b/lua/lsp/java.lua @@ -1,5 +1,40 @@ -- local java_language_server = require "java_language_server" +-- If you started neovim within `~/dev/xy/project-1` this would resolve to `project-1` +local project_name = vim.fn.fnamemodify(vim.fn.getcwd(), ':p:h:t') + +-- local workspace_dir = '/Users/kailuo/jdtls-workspace/' .. project_name +local workspace_dir = '/Users/kailuo/jdtls-workspace/' + +-- See `:help vim.lsp.start_client` for an overview of the supported `config` options. return { + -- The command that starts the language server + -- See: https://github.com/eclipse/eclipse.jdt.ls#running-from-the-command-line + cmd = { + '/Library/Java/JavaVirtualMachines/zulu-11.jdk/Contents/Home/bin/java', -- or '/path/to/java11_or_newer/bin/java' + '-Declipse.application=org.eclipse.jdt.ls.core.id1', + '-Dosgi.bundles.defaultStartLevel=4', + '-Declipse.product=org.eclipse.jdt.ls.core.product', + '-Dlog.protocol=true', + '-Dlog.level=ALL', + '-Xms1g', + '-Xmx2g', + '--add-modules=ALL-SYSTEM', + '--add-opens', 'java.base/java.util=ALL-UNNAMED', + '--add-opens', 'java.base/java.lang=ALL-UNNAMED', + '-jar', '/opt/software/jdtls/plugins/org.eclipse.equinox.launcher_1.6.400.v20210924-0641.jar', + '-configuration', '/opt/software/jdtls/config_mac', + '-data', workspace_dir, + }, + filetypes = { "java" }, + + -- 💀 + -- This is the default if not provided, you can remove it. Or adjust as needed. + -- One dedicated LSP server & client will be started per unique root_dir + -- root_dir = require('jdtls.setup').find_root({'.git', 'mvnw', 'gradlew'}), + + -- Here you can configure eclipse.jdt.ls specific settings + -- See https://github.com/eclipse/eclipse.jdt.ls/wiki/Running-the-JAVA-LS-server-from-the-command-line#initialize-request + -- for a list of options settings = { java = { home = "/Library/Java/JavaVirtualMachines/zulu-11.jdk/Contents/Home", @@ -9,10 +44,16 @@ return { server = { launchMode = "Hybrid", }, + maven = { + downloadSources = true, + updateSnapshots = true, + }, configuration = { maven = { - userSettings = "/opt/software/apache-maven-3.6.3/conf/settings.xml", - globalSettings = "/opt/software/apache-maven-3.6.3/conf/settings.xml", +-- userSettings = "/opt/software/apache-maven-3.6.3/conf/settings.xml", +-- globalSettings = "/opt/software/apache-maven-3.6.3/conf/settings.xml", + userSettings = "/Users/kailuo/workspace/paylabs/maven/settings.xml", + globalSettings = "/Users/kailuo/workspace/paylabs/maven/settings.xml", }, runtimes = { { @@ -26,5 +67,21 @@ return { } }, } - } + }, + + -- Language server `initializationOptions` + -- You need to extend the `bundles` with paths to jar files + -- if you want to use additional eclipse.jdt.ls plugins. + -- + -- See https://github.com/mfussenegger/nvim-jdtls#java-debug-installation + -- + -- If you don't plan on using the debugger or other eclipse.jdt.ls plugins you can remove this + init_options = { + bundles = {}, + workspace = workspace_dir + }, + root_dir = function () + return require('jdtls.setup').find_root({'.git', 'mvnw', 'gradlew'}) + end } + diff --git a/lua/plugins/config/asynctasks.lua b/lua/plugins/config/asynctasks.lua index 418c492a..f850bad6 100644 --- a/lua/plugins/config/asynctasks.lua +++ b/lua/plugins/config/asynctasks.lua @@ -4,3 +4,57 @@ vim.g.asynctasks_term_pos = 'floaterm' -- 此配置无效(无效变量) vim.g.asyncrun_term_pos = 'floaterm' +local result = vim.api.nvim_exec( +[[ +function! s:lf_task_source(...) + let rows = asynctasks#source(&columns * 48 / 100) + let source = [] + for row in rows + let name = row[0] + let source += [name . ' ' . row[1] . ' : ' . row[2] ] + endfor + return source +endfunction + + +function! s:lf_task_accept(line, arg) + let pos = stridx(a:line, '<') + if pos < 0 + return + endif + let name = strpart(a:line, 0, pos) + let name = substitute(name, '^\s*\(.\{-}\)\s*$', '\1', '') + if name != '' + exec "AsyncTask " . name + endif +endfunction + +function! s:lf_task_digest(line, mode) + let pos = stridx(a:line, '<') + if pos < 0 + return [a:line, 0] + endif + let name = strpart(a:line, 0, pos) + return [name, 0] +endfunction + +function! s:lf_win_init(...) + setlocal nonumber + setlocal nowrap +endfunction + + +let g:Lf_Extensions = get(g:, 'Lf_Extensions', {}) +let g:Lf_Extensions.task = { + \ 'source': string(function('s:lf_task_source'))[10:-3], + \ 'accept': string(function('s:lf_task_accept'))[10:-3], + \ 'get_digest': string(function('s:lf_task_digest'))[10:-3], + \ 'highlights_def': { + \ 'Lf_hl_funcScope': '^\S\+', + \ 'Lf_hl_funcDirname': '^\S\+\s*\zs<.*>\ze\s*:', + \ }, + \ 'help' : 'navigate available tasks from asynctasks.vim', + \ } +]], +true) + diff --git a/lua/plugins/config/vista.lua b/lua/plugins/config/vista.lua new file mode 100644 index 00000000..e0ea3ca8 --- /dev/null +++ b/lua/plugins/config/vista.lua @@ -0,0 +1 @@ +vim.g.vista_default_executive = 'nvim_lsp' diff --git a/lua/plugins/init.lua b/lua/plugins/init.lua index 44c7d879..ee5538f0 100644 --- a/lua/plugins/init.lua +++ b/lua/plugins/init.lua @@ -75,6 +75,7 @@ require('packer').startup(function() -- <>()等匹配插件 use 'andymass/vim-matchup' + -- 大纲插件 use 'liuchengxu/vista.vim' end) @@ -88,3 +89,4 @@ require('plugins/config/vim-floaterm') require('plugins/config/asynctasks') require('plugins/config/feline') require('plugins/config/indent-blankline') +require('plugins/config/vista') From d5d52b55c35757d47cc1db310598d016109a388c Mon Sep 17 00:00:00 2001 From: kaiv2 Date: Wed, 26 Jan 2022 22:11:30 +0800 Subject: [PATCH 0006/1278] config --- lua/keybindings.lua | 10 ---------- lua/lsp/init.lua | 4 ++++ 2 files changed, 4 insertions(+), 10 deletions(-) diff --git a/lua/keybindings.lua b/lua/keybindings.lua index 1c36c952..cb419be4 100644 --- a/lua/keybindings.lua +++ b/lua/keybindings.lua @@ -72,22 +72,12 @@ pluginKeys.cmp = function(cmp) -- [''] = cmp.mapping.select_prev_item(), -- 下一个 [''] = cmp.mapping.select_next_item(), - -- 出现补全 - [''] = cmp.mapping(cmp.mapping.complete(), { 'i', 'c' }), - -- 取消 - [''] = cmp.mapping({ - i = cmp.mapping.abort(), - c = cmp.mapping.close(), - }), -- 确认 -- Accept currently selected item. If none selected, `select` first item. -- Set `select` to `false` to only confirm explicitly selected items. [''] = cmp.mapping.confirm({ select = true , }), - -- [''] = cmp.config.disable, -- Specify `cmp.config.disable` if you want to remove the default `` mapping. - [''] = cmp.mapping(cmp.mapping.scroll_docs(-4), { 'i', 'c' }), - [''] = cmp.mapping(cmp.mapping.scroll_docs(4), { 'i', 'c' }), } end diff --git a/lua/lsp/init.lua b/lua/lsp/init.lua index 9064e651..3776abe9 100644 --- a/lua/lsp/init.lua +++ b/lua/lsp/init.lua @@ -19,6 +19,9 @@ for name, _ in pairs(servers) do end end + -- Setup lspconfig. +local capabilities = require('cmp_nvim_lsp').update_capabilities(vim.lsp.protocol.make_client_capabilities()) + lsp_installer.on_server_ready(function(server) local opts = servers[server.name] if opts then @@ -31,6 +34,7 @@ lsp_installer.on_server_ready(function(server) opts.flags = { debounce_text_changes = 150, } + opts.capabilities = capabilities; server:setup(opts) end end) From bfe4de2b70e7c9a3bc9aed68815b107aac1a45f5 Mon Sep 17 00:00:00 2001 From: kaiv2 Date: Wed, 26 Jan 2022 22:47:50 +0800 Subject: [PATCH 0007/1278] config --- lua/keybindings.lua | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lua/keybindings.lua b/lua/keybindings.lua index cb419be4..e5db05d5 100644 --- a/lua/keybindings.lua +++ b/lua/keybindings.lua @@ -44,7 +44,7 @@ pluginKeys.maplsp = function(mapbuf) -- rename mapbuf('n', 'rn', 'lua vim.lsp.buf.rename()', opt) -- code action - mapbuf('n', 'ca', 'lua vim.lsp.buf.code_action()', opt) + mapbuf('n', 'ca', 'lua vim.lsp.buf.code_action()', opt) -- go xx mapbuf('n', 'gd', 'lua vim.lsp.buf.definition()', opt) mapbuf('n', 'gh', 'lua vim.lsp.buf.hover()', opt) @@ -72,6 +72,7 @@ pluginKeys.cmp = function(cmp) -- [''] = cmp.mapping.select_prev_item(), -- 下一个 [''] = cmp.mapping.select_next_item(), + [""] = cmp.mapping.select_prev_item(), -- 确认 -- Accept currently selected item. If none selected, `select` first item. -- Set `select` to `false` to only confirm explicitly selected items. From 1a901f66c5e2868c70b4873783329c46e5d32695 Mon Sep 17 00:00:00 2001 From: kaiv2 Date: Wed, 26 Jan 2022 23:37:43 +0800 Subject: [PATCH 0008/1278] update --- lua/plugins/config/nvim-tree.lua | 3 ++- lua/plugins/init.lua | 1 + 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/lua/plugins/config/nvim-tree.lua b/lua/plugins/config/nvim-tree.lua index 2930e1d0..264cd2e0 100644 --- a/lua/plugins/config/nvim-tree.lua +++ b/lua/plugins/config/nvim-tree.lua @@ -58,4 +58,5 @@ require'nvim-tree'.setup { } } -vim.g.nvim_tree_quit_on_open=1 +vim.g.nvim_tree_quit_on_open = 1 + diff --git a/lua/plugins/init.lua b/lua/plugins/init.lua index ee5538f0..fd7ca1e0 100644 --- a/lua/plugins/init.lua +++ b/lua/plugins/init.lua @@ -77,6 +77,7 @@ require('packer').startup(function() use 'andymass/vim-matchup' -- 大纲插件 use 'liuchengxu/vista.vim' + end) require('plugins/config/bufferline') From 46ae32409b294ede91d8485f41ac534a03af8fb3 Mon Sep 17 00:00:00 2001 From: kaiv2 Date: Thu, 27 Jan 2022 09:20:37 +0800 Subject: [PATCH 0009/1278] lualine --- lua/plugins/config/lualine.lua | 28 ++++++++++++++++++++++++++++ lua/plugins/init.lua | 9 +++++++-- plugin/packer_compiled.lua | 10 +++++----- 3 files changed, 40 insertions(+), 7 deletions(-) create mode 100644 lua/plugins/config/lualine.lua diff --git a/lua/plugins/config/lualine.lua b/lua/plugins/config/lualine.lua new file mode 100644 index 00000000..58b663aa --- /dev/null +++ b/lua/plugins/config/lualine.lua @@ -0,0 +1,28 @@ +require('lualine').setup { + options = { + icons_enabled = true, + theme = 'auto', + component_separators = { left = '', right = ''}, + section_separators = { left = '', right = ''}, + disabled_filetypes = {}, + always_divide_middle = true, + }, + sections = { + lualine_a = {'mode'}, + lualine_b = {'branch', 'diff', 'diagnostics'}, + lualine_c = {'filename'}, + lualine_x = {'encoding', 'fileformat', 'filetype'}, + lualine_y = {'progress'}, + lualine_z = {'location'} + }, + inactive_sections = { + lualine_a = {}, + lualine_b = {}, + lualine_c = {'filename'}, + lualine_x = {'location'}, + lualine_y = {}, + lualine_z = {} + }, + tabline = {}, + extensions = {} +} diff --git a/lua/plugins/init.lua b/lua/plugins/init.lua index fd7ca1e0..d61281a6 100644 --- a/lua/plugins/init.lua +++ b/lua/plugins/init.lua @@ -18,6 +18,7 @@ require('packer').startup(function() -- use 'glepnir/lspsaga.nvim' -- lsp 相关 + -- use 'folke/lsp-colors.nvim' -- 主题 use 'morhetz/gruvbox' @@ -68,7 +69,10 @@ require('packer').startup(function() use 'mg979/vim-visual-multi' -- 状态栏插件 - use 'feline-nvim/feline.nvim' + -- use 'feline-nvim/feline.nvim' + use { + 'nvim-lualine/lualine.nvim', + } -- blankline use "lukas-reineke/indent-blankline.nvim" @@ -88,6 +92,7 @@ require('plugins/config/LeaderF') require('plugins/config/gitsigns-nvim') require('plugins/config/vim-floaterm') require('plugins/config/asynctasks') -require('plugins/config/feline') +-- require('plugins/config/feline') +require('plugins/config/lualine') require('plugins/config/indent-blankline') require('plugins/config/vista') diff --git a/plugin/packer_compiled.lua b/plugin/packer_compiled.lua index 7f964c88..84f5f756 100644 --- a/plugin/packer_compiled.lua +++ b/plugin/packer_compiled.lua @@ -119,11 +119,6 @@ _G.packer_plugins = { path = "/Users/kailuo/.local/share/nvim/site/pack/packer/start/cmp-vsnip", url = "https://github.com/hrsh7th/cmp-vsnip" }, - ["feline.nvim"] = { - loaded = true, - path = "/Users/kailuo/.local/share/nvim/site/pack/packer/start/feline.nvim", - url = "https://github.com/feline-nvim/feline.nvim" - }, ["friendly-snippets"] = { loaded = true, path = "/Users/kailuo/.local/share/nvim/site/pack/packer/start/friendly-snippets", @@ -149,6 +144,11 @@ _G.packer_plugins = { path = "/Users/kailuo/.local/share/nvim/site/pack/packer/start/lspkind-nvim", url = "https://github.com/onsails/lspkind-nvim" }, + ["lualine.nvim"] = { + loaded = true, + path = "/Users/kailuo/.local/share/nvim/site/pack/packer/start/lualine.nvim", + url = "https://github.com/nvim-lualine/lualine.nvim" + }, ["nvim-cmp"] = { loaded = true, path = "/Users/kailuo/.local/share/nvim/site/pack/packer/start/nvim-cmp", From 7efb9e337ff3ef27a43063cc4a7aeba798286bb3 Mon Sep 17 00:00:00 2001 From: kaiv2 Date: Thu, 27 Jan 2022 10:15:56 +0800 Subject: [PATCH 0010/1278] add plugin --- lua/basic.lua | 4 ++++ lua/keybindings.lua | 3 +++ lua/plugins/config/bufferline.lua | 1 - lua/plugins/config/lsp-colors.lua | 7 +++++++ lua/plugins/config/trouble.lua | 5 +++++ lua/plugins/init.lua | 10 +++++++++- plugin/packer_compiled.lua | 10 ++++++++++ 7 files changed, 38 insertions(+), 2 deletions(-) create mode 100644 lua/plugins/config/lsp-colors.lua create mode 100644 lua/plugins/config/trouble.lua diff --git a/lua/basic.lua b/lua/basic.lua index 3e4a1fa0..a6f7ae13 100644 --- a/lua/basic.lua +++ b/lua/basic.lua @@ -26,6 +26,10 @@ vim.o.shiftwidth=4 vim.bo.shiftwidth=4 vim.cmd('autocmd Filetype lua setlocal ts=2 sw=2 expandtab') +vim.cmd('autocmd Filetype js setlocal ts=2 sw=2 expandtab') +vim.cmd('autocmd Filetype json setlocal ts=2 sw=2 expandtab') +vim.cmd('autocmd Filetype css setlocal ts=2 sw=2 expandtab') +vim.cmd('autocmd Filetype html setlocal ts=2 sw=2 expandtab') -- 新行对齐当前行,空格替代tab vim.o.expandtab = true diff --git a/lua/keybindings.lua b/lua/keybindings.lua index e5db05d5..867fb90e 100644 --- a/lua/keybindings.lua +++ b/lua/keybindings.lua @@ -35,6 +35,9 @@ map('t', ' ', '::FloatermToggle', opt) -- vista map('n', 'o', ':Vista!!', opt) +-- trouble.nvim +map('n', 'x', ':Trouble', opt) + local pluginKeys = {} -- lsp 回调函数快捷键设置 diff --git a/lua/plugins/config/bufferline.lua b/lua/plugins/config/bufferline.lua index f9462669..d2f7d568 100644 --- a/lua/plugins/config/bufferline.lua +++ b/lua/plugins/config/bufferline.lua @@ -1,4 +1,3 @@ -vim.opt.termguicolors = true require("bufferline").setup { options = { -- 使用 nvim 内置lsp diff --git a/lua/plugins/config/lsp-colors.lua b/lua/plugins/config/lsp-colors.lua new file mode 100644 index 00000000..aaa0b444 --- /dev/null +++ b/lua/plugins/config/lsp-colors.lua @@ -0,0 +1,7 @@ +-- Lua +require("lsp-colors").setup({ + Error = "#db4b4b", + Warning = "#e0af68", + Information = "#0db9d7", + Hint = "#10B981" +}) diff --git a/lua/plugins/config/trouble.lua b/lua/plugins/config/trouble.lua new file mode 100644 index 00000000..8278e178 --- /dev/null +++ b/lua/plugins/config/trouble.lua @@ -0,0 +1,5 @@ +require("trouble").setup { + -- your configuration comes here + -- or leave it empty to use the default settings + -- refer to the configuration section below +} diff --git a/lua/plugins/init.lua b/lua/plugins/init.lua index d61281a6..ab80fd4f 100644 --- a/lua/plugins/init.lua +++ b/lua/plugins/init.lua @@ -3,12 +3,15 @@ require('packer').startup(function() use 'wbthomason/packer.nvim' use {'neovim/nvim-lspconfig', 'williamboman/nvim-lsp-installer'} + use 'kyazdani42/nvim-web-devicons' + -- nvim-cmp use 'hrsh7th/cmp-nvim-lsp' -- { name = nvim_lsp } use 'hrsh7th/cmp-buffer' -- { name = 'buffer' }, use 'hrsh7th/cmp-path' -- { name = 'path' } use 'hrsh7th/cmp-cmdline' -- { name = 'cmdline' } use 'hrsh7th/nvim-cmp' + -- vsnip use 'hrsh7th/cmp-vsnip' -- { name = 'vsnip' } use 'hrsh7th/vim-vsnip' @@ -18,7 +21,9 @@ require('packer').startup(function() -- use 'glepnir/lspsaga.nvim' -- lsp 相关 - -- use 'folke/lsp-colors.nvim' + use 'folke/lsp-colors.nvim' + use 'folke/trouble.nvim' + -- 主题 use 'morhetz/gruvbox' @@ -96,3 +101,6 @@ require('plugins/config/asynctasks') require('plugins/config/lualine') require('plugins/config/indent-blankline') require('plugins/config/vista') +require('plugins/config/lsp-colors') +require('plugins/config/trouble') + diff --git a/plugin/packer_compiled.lua b/plugin/packer_compiled.lua index 84f5f756..2358d16e 100644 --- a/plugin/packer_compiled.lua +++ b/plugin/packer_compiled.lua @@ -139,6 +139,11 @@ _G.packer_plugins = { path = "/Users/kailuo/.local/share/nvim/site/pack/packer/start/indent-blankline.nvim", url = "https://github.com/lukas-reineke/indent-blankline.nvim" }, + ["lsp-colors.nvim"] = { + loaded = true, + path = "/Users/kailuo/.local/share/nvim/site/pack/packer/start/lsp-colors.nvim", + url = "https://github.com/folke/lsp-colors.nvim" + }, ["lspkind-nvim"] = { loaded = true, path = "/Users/kailuo/.local/share/nvim/site/pack/packer/start/lspkind-nvim", @@ -194,6 +199,11 @@ _G.packer_plugins = { path = "/Users/kailuo/.local/share/nvim/site/pack/packer/start/plenary.nvim", url = "https://github.com/nvim-lua/plenary.nvim" }, + ["trouble.nvim"] = { + loaded = true, + path = "/Users/kailuo/.local/share/nvim/site/pack/packer/start/trouble.nvim", + url = "https://github.com/folke/trouble.nvim" + }, ["vim-floaterm"] = { loaded = true, path = "/Users/kailuo/.local/share/nvim/site/pack/packer/start/vim-floaterm", From 3268ac2fa8456852ad6b7b9230918a631c356114 Mon Sep 17 00:00:00 2001 From: kaiv2 Date: Thu, 27 Jan 2022 11:39:47 +0800 Subject: [PATCH 0011/1278] config --- lua/keybindings.lua | 4 ++-- lua/lsp/init.lua | 2 ++ lua/plugins/config/nvim-notify.lua | 32 ++++++++++++++++++++++++++++++ lua/plugins/init.lua | 4 ++++ plugin/packer_compiled.lua | 5 +++++ 5 files changed, 45 insertions(+), 2 deletions(-) create mode 100644 lua/plugins/config/nvim-notify.lua diff --git a/lua/keybindings.lua b/lua/keybindings.lua index 867fb90e..239a22af 100644 --- a/lua/keybindings.lua +++ b/lua/keybindings.lua @@ -56,8 +56,8 @@ pluginKeys.maplsp = function(mapbuf) mapbuf('n', 'gr', 'lua vim.lsp.buf.references()', opt) -- diagnostic mapbuf('n', 'go', 'lua vim.diagnostic.open_float()', opt) - mapbuf('n', 'gp', 'lua vim.diagnostic.goto_prev()', opt) - mapbuf('n', 'gn', 'lua vim.diagnostic.goto_next()', opt) + mapbuf('n', '[g', 'lua vim.diagnostic.goto_prev()', opt) + mapbuf('n', ']g', 'lua vim.diagnostic.goto_next()', opt) -- mapbuf('n', 'q', 'lua vim.diagnostic.setloclist()', opt) -- leader + = mapbuf('n', '=', 'lua vim.lsp.buf.formatting()', opt) diff --git a/lua/lsp/init.lua b/lua/lsp/init.lua index 3776abe9..38777189 100644 --- a/lua/lsp/init.lua +++ b/lua/lsp/init.lua @@ -21,6 +21,8 @@ end -- Setup lspconfig. local capabilities = require('cmp_nvim_lsp').update_capabilities(vim.lsp.protocol.make_client_capabilities()) +-- 没有确定使用效果参数 +-- capabilities.textDocument.completion.completionItem.snippetSupport = true lsp_installer.on_server_ready(function(server) local opts = servers[server.name] diff --git a/lua/plugins/config/nvim-notify.lua b/lua/plugins/config/nvim-notify.lua new file mode 100644 index 00000000..5d4be356 --- /dev/null +++ b/lua/plugins/config/nvim-notify.lua @@ -0,0 +1,32 @@ +require("notify").setup({ + -- Animation style (see below for details) + stages = "fade_in_slide_out", + + -- Function called when a new window is opened, use for changing win settings/config + on_open = nil, + + -- Function called when a window is closed + on_close = nil, + + -- Render function for notifications. See notify-render() + render = "default", + + -- Default timeout for notifications + timeout = 5000, + + -- For stages that change opacity this is treated as the highlight behind the window + -- Set this to either a highlight group, an RGB hex value e.g. "#000000" or a function returning an RGB code for dynamic values + background_colour = "#000000", + + -- Minimum width for notification windows + minimum_width = 50, + + -- Icons for the different levels + icons = { + ERROR = "", + WARN = "", + INFO = "", + DEBUG = "", + TRACE = "✎", + }, +}) diff --git a/lua/plugins/init.lua b/lua/plugins/init.lua index ab80fd4f..51898c99 100644 --- a/lua/plugins/init.lua +++ b/lua/plugins/init.lua @@ -87,6 +87,9 @@ require('packer').startup(function() -- 大纲插件 use 'liuchengxu/vista.vim' + -- 消息通知 + use 'rcarriga/nvim-notify' + end) require('plugins/config/bufferline') @@ -103,4 +106,5 @@ require('plugins/config/indent-blankline') require('plugins/config/vista') require('plugins/config/lsp-colors') require('plugins/config/trouble') +require('plugins/config/nvim-notify') diff --git a/plugin/packer_compiled.lua b/plugin/packer_compiled.lua index 2358d16e..88d05042 100644 --- a/plugin/packer_compiled.lua +++ b/plugin/packer_compiled.lua @@ -174,6 +174,11 @@ _G.packer_plugins = { path = "/Users/kailuo/.local/share/nvim/site/pack/packer/start/nvim-lspconfig", url = "https://github.com/neovim/nvim-lspconfig" }, + ["nvim-notify"] = { + loaded = true, + path = "/Users/kailuo/.local/share/nvim/site/pack/packer/start/nvim-notify", + url = "https://github.com/rcarriga/nvim-notify" + }, ["nvim-tree.lua"] = { loaded = true, path = "/Users/kailuo/.local/share/nvim/site/pack/packer/start/nvim-tree.lua", From 3e05c791229a7ee8d6880ce76083dd06c89a2ea4 Mon Sep 17 00:00:00 2001 From: kaiv2 Date: Thu, 27 Jan 2022 11:48:07 +0800 Subject: [PATCH 0012/1278] config --- lua/keybindings.lua | 1 + lua/plugins/config/nvim-cmp.lua | 9 ++++++++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/lua/keybindings.lua b/lua/keybindings.lua index 239a22af..58cd40ff 100644 --- a/lua/keybindings.lua +++ b/lua/keybindings.lua @@ -76,6 +76,7 @@ pluginKeys.cmp = function(cmp) -- 下一个 [''] = cmp.mapping.select_next_item(), [""] = cmp.mapping.select_prev_item(), + -- [''] = cmp.mapping.close(), -- 确认 -- Accept currently selected item. If none selected, `select` first item. -- Set `select` to `false` to only confirm explicitly selected items. diff --git a/lua/plugins/config/nvim-cmp.lua b/lua/plugins/config/nvim-cmp.lua index 83e9cc89..a6c96fb5 100644 --- a/lua/plugins/config/nvim-cmp.lua +++ b/lua/plugins/config/nvim-cmp.lua @@ -44,7 +44,14 @@ cmp.setup { -- Source 显示提示来源 vim_item.menu = "["..string.upper(entry.source.name).."]" return vim_item - end + end, + menu = { + nvim_lsp = "[LSP]", + vsnip = "[Vsnip]", + path = "[Path]", + buffer = "[Buffer]", + emoji = "[Emoji]", + }, }) }, } From bba3a46525f345da4949271e86a30fdfb678562b Mon Sep 17 00:00:00 2001 From: kaiv2 Date: Thu, 27 Jan 2022 12:39:51 +0800 Subject: [PATCH 0013/1278] wilder --- lua/plugins/config/nvim-cmp.lua | 24 ++++++++++---------- lua/plugins/config/wilder.lua | 40 +++++++++++++++++++++++++++++++++ lua/plugins/init.lua | 4 ++++ plugin/packer_compiled.lua | 5 +++++ 4 files changed, 61 insertions(+), 12 deletions(-) create mode 100644 lua/plugins/config/wilder.lua diff --git a/lua/plugins/config/nvim-cmp.lua b/lua/plugins/config/nvim-cmp.lua index a6c96fb5..9555b1a4 100644 --- a/lua/plugins/config/nvim-cmp.lua +++ b/lua/plugins/config/nvim-cmp.lua @@ -57,17 +57,17 @@ cmp.setup { } -- Use buffer source for `/`. -cmp.setup.cmdline('/', { - sources = { - { name = 'buffer' } - } -}) +-- cmp.setup.cmdline('/', { +-- sources = { +-- { name = 'buffer' } +-- } +-- }) -- Use cmdline & path source for ':'. -cmp.setup.cmdline(':', { - sources = cmp.config.sources({ - { name = 'path' } - }, { - { name = 'cmdline' } - }) -}) +-- cmp.setup.cmdline(':', { +-- sources = cmp.config.sources({ +-- { name = 'path' } +-- }, { +-- { name = 'cmdline' } +-- }) +-- }) diff --git a/lua/plugins/config/wilder.lua b/lua/plugins/config/wilder.lua new file mode 100644 index 00000000..42a7cd7a --- /dev/null +++ b/lua/plugins/config/wilder.lua @@ -0,0 +1,40 @@ +local result = vim.api.nvim_exec( +[[ +call wilder#setup({ + \ 'modes': [':', '/', '?'], + \ 'next_key': '', + \ 'previous_key': '', + \ 'accept_key': '', + \ 'reject_key': '', + \ }) + + +let s:popupmenu_renderer = wilder#popupmenu_renderer(wilder#popupmenu_border_theme({ + \ 'highlighter': wilder#basic_highlighter(), + \ 'empty_message': wilder#popupmenu_empty_message_with_spinner(), + \ 'pumblend': 20, + \ 'left': [ + \ ' ', wilder#popupmenu_devicons(), + \ ], + \ 'right': [ + \ ' ', wilder#popupmenu_scrollbar(), + \ ], + \ 'highlights': { + \ 'border': 'Normal', + \ }, + \ 'border': 'rounded', + \ })) + +let s:wildmenu_renderer = wilder#wildmenu_renderer({ + \ 'highlighter': wilder#basic_highlighter(), + \ 'separator': ' | ', + \ 'left': [' ', wilder#wildmenu_spinner(), ' '], + \ 'right': [' ', wilder#wildmenu_index()], + \ }) + +call wilder#set_option('renderer', wilder#renderer_mux({ + \ ':': s:popupmenu_renderer, + \ '/': s:wildmenu_renderer, + \ 'substitute': s:wildmenu_renderer, + \ })) +]], true) diff --git a/lua/plugins/init.lua b/lua/plugins/init.lua index 51898c99..c1d3b480 100644 --- a/lua/plugins/init.lua +++ b/lua/plugins/init.lua @@ -90,6 +90,9 @@ require('packer').startup(function() -- 消息通知 use 'rcarriga/nvim-notify' + -- wildmenu 补全美化 + use 'gelguy/wilder.nvim' + end) require('plugins/config/bufferline') @@ -107,4 +110,5 @@ require('plugins/config/vista') require('plugins/config/lsp-colors') require('plugins/config/trouble') require('plugins/config/nvim-notify') +require('plugins/config/wilder') diff --git a/plugin/packer_compiled.lua b/plugin/packer_compiled.lua index 88d05042..4ebe01fb 100644 --- a/plugin/packer_compiled.lua +++ b/plugin/packer_compiled.lua @@ -238,6 +238,11 @@ _G.packer_plugins = { loaded = true, path = "/Users/kailuo/.local/share/nvim/site/pack/packer/start/vista.vim", url = "https://github.com/liuchengxu/vista.vim" + }, + ["wilder.nvim"] = { + loaded = true, + path = "/Users/kailuo/.local/share/nvim/site/pack/packer/start/wilder.nvim", + url = "https://github.com/gelguy/wilder.nvim" } } From 5e56322f906b9f9efd41db8acbe62afaa85a4f5e Mon Sep 17 00:00:00 2001 From: kaiv2 Date: Thu, 27 Jan 2022 15:10:17 +0800 Subject: [PATCH 0014/1278] comment plugin --- lua/plugins/config/comment.lua | 1 + lua/plugins/config/nvim-colorizer.lua | 1 + lua/plugins/config/nvim-notify.lua | 3 ++- lua/plugins/init.lua | 9 +++++++++ plugin/packer_compiled.lua | 10 ++++++++++ 5 files changed, 23 insertions(+), 1 deletion(-) create mode 100644 lua/plugins/config/comment.lua create mode 100644 lua/plugins/config/nvim-colorizer.lua diff --git a/lua/plugins/config/comment.lua b/lua/plugins/config/comment.lua new file mode 100644 index 00000000..a8443238 --- /dev/null +++ b/lua/plugins/config/comment.lua @@ -0,0 +1 @@ +require('Comment').setup() diff --git a/lua/plugins/config/nvim-colorizer.lua b/lua/plugins/config/nvim-colorizer.lua new file mode 100644 index 00000000..ebb8f3bf --- /dev/null +++ b/lua/plugins/config/nvim-colorizer.lua @@ -0,0 +1 @@ + require'colorizer'.setup() diff --git a/lua/plugins/config/nvim-notify.lua b/lua/plugins/config/nvim-notify.lua index 5d4be356..0d31b5c6 100644 --- a/lua/plugins/config/nvim-notify.lua +++ b/lua/plugins/config/nvim-notify.lua @@ -1,4 +1,5 @@ -require("notify").setup({ +vim.notify = require("notify") +vim.notify.setup({ -- Animation style (see below for details) stages = "fade_in_slide_out", diff --git a/lua/plugins/init.lua b/lua/plugins/init.lua index c1d3b480..5b372b7e 100644 --- a/lua/plugins/init.lua +++ b/lua/plugins/init.lua @@ -93,6 +93,13 @@ require('packer').startup(function() -- wildmenu 补全美化 use 'gelguy/wilder.nvim' + -- 颜色显示 + use 'norcalli/nvim-colorizer.lua' + + use { + 'numToStr/Comment.nvim', + } + end) require('plugins/config/bufferline') @@ -111,4 +118,6 @@ require('plugins/config/lsp-colors') require('plugins/config/trouble') require('plugins/config/nvim-notify') require('plugins/config/wilder') +require('plugins/config/nvim-colorizer') +require('plugins/config/comment') diff --git a/plugin/packer_compiled.lua b/plugin/packer_compiled.lua index 4ebe01fb..b6db5c7d 100644 --- a/plugin/packer_compiled.lua +++ b/plugin/packer_compiled.lua @@ -69,6 +69,11 @@ end time([[try_loadstring definition]], false) time([[Defining packer_plugins]], true) _G.packer_plugins = { + ["Comment.nvim"] = { + loaded = true, + path = "/Users/kailuo/.local/share/nvim/site/pack/packer/start/Comment.nvim", + url = "https://github.com/numToStr/Comment.nvim" + }, LeaderF = { loaded = true, path = "/Users/kailuo/.local/share/nvim/site/pack/packer/start/LeaderF", @@ -159,6 +164,11 @@ _G.packer_plugins = { path = "/Users/kailuo/.local/share/nvim/site/pack/packer/start/nvim-cmp", url = "https://github.com/hrsh7th/nvim-cmp" }, + ["nvim-colorizer.lua"] = { + loaded = true, + path = "/Users/kailuo/.local/share/nvim/site/pack/packer/start/nvim-colorizer.lua", + url = "https://github.com/norcalli/nvim-colorizer.lua" + }, ["nvim-jdtls"] = { loaded = true, path = "/Users/kailuo/.local/share/nvim/site/pack/packer/start/nvim-jdtls", From 3c148fe40b273f425557c0309452d5eb0a6e4492 Mon Sep 17 00:00:00 2001 From: kaiv2 Date: Thu, 27 Jan 2022 15:25:16 +0800 Subject: [PATCH 0015/1278] config --- lua/plugins/config/nvim-treesitter.lua | 25 +++++++++++++++++++++++++ lua/plugins/init.lua | 1 + 2 files changed, 26 insertions(+) diff --git a/lua/plugins/config/nvim-treesitter.lua b/lua/plugins/config/nvim-treesitter.lua index 056314a2..614ee9b4 100644 --- a/lua/plugins/config/nvim-treesitter.lua +++ b/lua/plugins/config/nvim-treesitter.lua @@ -25,6 +25,29 @@ require'nvim-treesitter.configs'.setup { enable = true, disable = { "c", "rust" }, }, + textobjects = { + move = { + enable = true, + set_jumps = true, -- whether to set jumps in the jumplist + goto_next_start = { + ["]m"] = "@function.outer", + ["]]"] = "@class.outer", + }, + goto_next_end = { + ["]M"] = "@function.outer", + ["]["] = "@class.outer", + }, + goto_previous_start = { + ["[m"] = "@function.outer", + ["[["] = "@class.outer", + }, + goto_previous_end = { + ["[M"] = "@function.outer", + ["[]"] = "@class.outer", + }, + }, + }, + } -- 开启 Folding vim.wo.foldmethod = 'expr' @@ -32,3 +55,5 @@ vim.wo.foldexpr = 'nvim_treesitter#foldexpr()' -- 默认不要折叠 -- https://stackoverflow.com/questions/8316139/how-to-set-the-default-to-unfolded-when-you-open-a-file vim.wo.foldlevel = 99 + + diff --git a/lua/plugins/init.lua b/lua/plugins/init.lua index 5b372b7e..5117970a 100644 --- a/lua/plugins/init.lua +++ b/lua/plugins/init.lua @@ -43,6 +43,7 @@ require('packer').startup(function() -- treesitter (新增) use { 'nvim-treesitter/nvim-treesitter', run = ':TSUpdate' } + use 'nvim-treesitter/nvim-treesitter-textobjects' -- java use 'mfussenegger/nvim-jdtls' From 80f7057f3e12df80391e9e6fe18cbe801269d515 Mon Sep 17 00:00:00 2001 From: kaiv2 Date: Thu, 27 Jan 2022 15:30:19 +0800 Subject: [PATCH 0016/1278] update config --- lua/plugins/config/nvim-cmp.lua | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/lua/plugins/config/nvim-cmp.lua b/lua/plugins/config/nvim-cmp.lua index 9555b1a4..dec69cab 100644 --- a/lua/plugins/config/nvim-cmp.lua +++ b/lua/plugins/config/nvim-cmp.lua @@ -49,8 +49,7 @@ cmp.setup { nvim_lsp = "[LSP]", vsnip = "[Vsnip]", path = "[Path]", - buffer = "[Buffer]", - emoji = "[Emoji]", + -- buffer = "[Buffer]", }, }) }, From 6761401634ef72b05f455e0608a12f5635d96db7 Mon Sep 17 00:00:00 2001 From: kaiv2 Date: Thu, 27 Jan 2022 15:50:38 +0800 Subject: [PATCH 0017/1278] add plugin --- lua/plugins/init.lua | 2 ++ plugin/packer_compiled.lua | 19 +++++++++++++++++++ 2 files changed, 21 insertions(+) diff --git a/lua/plugins/init.lua b/lua/plugins/init.lua index 5117970a..da13bb0c 100644 --- a/lua/plugins/init.lua +++ b/lua/plugins/init.lua @@ -101,6 +101,8 @@ require('packer').startup(function() 'numToStr/Comment.nvim', } + use {'iamcco/markdown-preview.nvim', run = 'cd app && yarn install', cmd = 'MarkdownPreview'} + end) require('plugins/config/bufferline') diff --git a/plugin/packer_compiled.lua b/plugin/packer_compiled.lua index b6db5c7d..6d92b165 100644 --- a/plugin/packer_compiled.lua +++ b/plugin/packer_compiled.lua @@ -159,6 +159,14 @@ _G.packer_plugins = { path = "/Users/kailuo/.local/share/nvim/site/pack/packer/start/lualine.nvim", url = "https://github.com/nvim-lualine/lualine.nvim" }, + ["markdown-preview.nvim"] = { + commands = { "MarkdownPreview" }, + loaded = false, + needs_bufread = false, + only_cond = false, + path = "/Users/kailuo/.local/share/nvim/site/pack/packer/opt/markdown-preview.nvim", + url = "https://github.com/iamcco/markdown-preview.nvim" + }, ["nvim-cmp"] = { loaded = true, path = "/Users/kailuo/.local/share/nvim/site/pack/packer/start/nvim-cmp", @@ -199,6 +207,11 @@ _G.packer_plugins = { path = "/Users/kailuo/.local/share/nvim/site/pack/packer/start/nvim-treesitter", url = "https://github.com/nvim-treesitter/nvim-treesitter" }, + ["nvim-treesitter-textobjects"] = { + loaded = true, + path = "/Users/kailuo/.local/share/nvim/site/pack/packer/start/nvim-treesitter-textobjects", + url = "https://github.com/nvim-treesitter/nvim-treesitter-textobjects" + }, ["nvim-web-devicons"] = { loaded = true, path = "/Users/kailuo/.local/share/nvim/site/pack/packer/start/nvim-web-devicons", @@ -257,6 +270,12 @@ _G.packer_plugins = { } time([[Defining packer_plugins]], false) + +-- Command lazy-loads +time([[Defining lazy-load commands]], true) +pcall(vim.cmd, [[command -nargs=* -range -bang -complete=file MarkdownPreview lua require("packer.load")({'markdown-preview.nvim'}, { cmd = "MarkdownPreview", l1 = , l2 = , bang = , args = , mods = "" }, _G.packer_plugins)]]) +time([[Defining lazy-load commands]], false) + if should_profile then save_profiles() end end) From 36812480b6ea583bd3d86a53668a607b5fa5dffb Mon Sep 17 00:00:00 2001 From: kaiv2 Date: Thu, 27 Jan 2022 16:24:22 +0800 Subject: [PATCH 0018/1278] config --- lua/plugins/config/gitsigns-nvim.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lua/plugins/config/gitsigns-nvim.lua b/lua/plugins/config/gitsigns-nvim.lua index 3a530ccb..799cbeba 100644 --- a/lua/plugins/config/gitsigns-nvim.lua +++ b/lua/plugins/config/gitsigns-nvim.lua @@ -1,7 +1,7 @@ require('gitsigns').setup { signs = { - add = {hl = 'GitSignsAdd' , text = '│', numhl='GitSignsAddNr' , linehl='GitSignsAddLn'}, + add = {hl = 'GitSignsAdd' , text = '+', numhl='GitSignsAddNr' , linehl='GitSignsAddLn'}, change = {hl = 'GitSignsChange', text = '│', numhl='GitSignsChangeNr', linehl='GitSignsChangeLn'}, delete = {hl = 'GitSignsDelete', text = '_', numhl='GitSignsDeleteNr', linehl='GitSignsDeleteLn'}, topdelete = {hl = 'GitSignsDelete', text = '‾', numhl='GitSignsDeleteNr', linehl='GitSignsDeleteLn'}, From c4e82e584d112644fbfdfbfd89cfb7832fab1999 Mon Sep 17 00:00:00 2001 From: kaiv2 Date: Thu, 27 Jan 2022 16:46:18 +0800 Subject: [PATCH 0019/1278] config --- lua/plugins/config/gitsigns-nvim.lua | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/lua/plugins/config/gitsigns-nvim.lua b/lua/plugins/config/gitsigns-nvim.lua index 799cbeba..6f6b8762 100644 --- a/lua/plugins/config/gitsigns-nvim.lua +++ b/lua/plugins/config/gitsigns-nvim.lua @@ -1,10 +1,10 @@ require('gitsigns').setup { signs = { - add = {hl = 'GitSignsAdd' , text = '+', numhl='GitSignsAddNr' , linehl='GitSignsAddLn'}, - change = {hl = 'GitSignsChange', text = '│', numhl='GitSignsChangeNr', linehl='GitSignsChangeLn'}, - delete = {hl = 'GitSignsDelete', text = '_', numhl='GitSignsDeleteNr', linehl='GitSignsDeleteLn'}, - topdelete = {hl = 'GitSignsDelete', text = '‾', numhl='GitSignsDeleteNr', linehl='GitSignsDeleteLn'}, + add = {hl = 'GitSignsAdd' , text = '█', numhl='GitSignsAddNr' , linehl='GitSignsAddLn'}, + change = {hl = 'GitSignsChange', text = '▓', numhl='GitSignsChangeNr', linehl='GitSignsChangeLn'}, + delete = {hl = 'GitSignsDelete', text = '▄', numhl='GitSignsDeleteNr', linehl='GitSignsDeleteLn'}, + topdelete = {hl = 'GitSignsDelete', text = '▀', numhl='GitSignsDeleteNr', linehl='GitSignsDeleteLn'}, changedelete = {hl = 'GitSignsChange', text = '~', numhl='GitSignsChangeNr', linehl='GitSignsChangeLn'}, }, signcolumn = true, -- Toggle with `:Gitsigns toggle_signs` From fe8653004004ca498b80b735a2dca0f4aacb5f5d Mon Sep 17 00:00:00 2001 From: kaiv2 Date: Thu, 27 Jan 2022 18:03:37 +0800 Subject: [PATCH 0020/1278] config --- lua/basic.lua | 8 ++++++- lua/keybindings.lua | 3 +++ lua/plugins/config/lspsaga.lua | 40 ++++++++++++++++++++++++++++++++++ lua/plugins/init.lua | 1 + 4 files changed, 51 insertions(+), 1 deletion(-) create mode 100644 lua/plugins/config/lspsaga.lua diff --git a/lua/basic.lua b/lua/basic.lua index a6f7ae13..4d1e10c9 100644 --- a/lua/basic.lua +++ b/lua/basic.lua @@ -54,7 +54,7 @@ vim.o.swapfile = false vim.o.updatetime = 300 -- split window 从下边和右边出现 -vim.o.splitbelow = true +vim.o.splitbelow = false vim.o.splitright = true -- 样式 @@ -68,3 +68,9 @@ vim.o.wildmenu = true -- vim.g.python_host_prog='/opt/homebrew/bin/python3' vim.g.python3_host_prog='/opt/homebrew/bin/python3' + +vim.api.nvim_exec([[ +if has("autocmd") + au BufReadPost * if line("'\"") > 1 && line("'\"") <= line("$") | exe "normal! g'\"" | endif +endif +]], true) diff --git a/lua/keybindings.lua b/lua/keybindings.lua index 58cd40ff..14a3c093 100644 --- a/lua/keybindings.lua +++ b/lua/keybindings.lua @@ -38,6 +38,9 @@ map('n', 'o', ':Vista!!', opt) -- trouble.nvim map('n', 'x', ':Trouble', opt) +-- lspsaga +-- map('n', 'K', ':Lspsaga hover_doc', opt) + local pluginKeys = {} -- lsp 回调函数快捷键设置 diff --git a/lua/plugins/config/lspsaga.lua b/lua/plugins/config/lspsaga.lua new file mode 100644 index 00000000..26d50d19 --- /dev/null +++ b/lua/plugins/config/lspsaga.lua @@ -0,0 +1,40 @@ + +local saga = require 'lspsaga' + +-- add your config value here +-- default value +-- use_saga_diagnostic_sign = true +-- error_sign = '', +-- warn_sign = '', +-- hint_sign = '', +-- infor_sign = '', +-- dianostic_header_icon = '  ', +-- code_action_icon = ' ', +-- code_action_prompt = { +-- enable = true, +-- sign = true, +-- sign_priority = 20, +-- virtual_text = true, +-- }, +-- finder_definition_icon = ' ', +-- finder_reference_icon = ' ', +-- max_preview_lines = 10, -- preview lines of lsp_finder and definition preview +-- finder_action_keys = { +-- open = 'o', vsplit = 's',split = 'i',quit = 'q',scroll_down = '', scroll_up = '' -- quit can be a table +-- }, +-- code_action_keys = { +-- quit = 'q',exec = '' +-- }, +-- rename_action_keys = { +-- quit = '',exec = '' -- quit can be a table +-- }, +-- definition_preview_icon = ' ' +-- "single" "double" "round" "plus" +-- border_style = "single" +-- rename_prompt_prefix = '➤', +-- if you don't use nvim-lspconfig you must pass your server name and +-- the related filetypes into this table +-- like server_filetype_map = {metals = {'sbt', 'scala'}} +-- server_filetype_map = {} + +saga.init_lsp_saga() diff --git a/lua/plugins/init.lua b/lua/plugins/init.lua index da13bb0c..0189a721 100644 --- a/lua/plugins/init.lua +++ b/lua/plugins/init.lua @@ -123,4 +123,5 @@ require('plugins/config/nvim-notify') require('plugins/config/wilder') require('plugins/config/nvim-colorizer') require('plugins/config/comment') +-- require('plugins/config/lspsaga') From 1aa03ea8b8856b74a78232bcad9e1402746f1219 Mon Sep 17 00:00:00 2001 From: kaiv2 Date: Thu, 27 Jan 2022 18:26:35 +0800 Subject: [PATCH 0021/1278] format plugin --- lua/lsp/init.lua | 1 + lua/plugins/config/formatter.lua | 20 ++++++++++++++++++++ lua/plugins/init.lua | 6 ++++++ plugin/packer_compiled.lua | 10 ++++++++++ 4 files changed, 37 insertions(+) create mode 100644 lua/plugins/config/formatter.lua diff --git a/lua/lsp/init.lua b/lua/lsp/init.lua index 38777189..03a48e48 100644 --- a/lua/lsp/init.lua +++ b/lua/lsp/init.lua @@ -6,6 +6,7 @@ local lsp_installer = require "nvim-lsp-installer" local servers = { sumneko_lua = require "lsp.lua", -- /lua/lsp/lua.lua jdtls = require "lsp.java", -- /lua/lsp/jdtls.lua + jsonls = {}, } -- 自动安装 LanguageServers diff --git a/lua/plugins/config/formatter.lua b/lua/plugins/config/formatter.lua new file mode 100644 index 00000000..78bc42bf --- /dev/null +++ b/lua/plugins/config/formatter.lua @@ -0,0 +1,20 @@ +local prettierConfig = function() + return { + exe = "prettier", + args = {"--stdin-filepath", vim.fn.shellescape(vim.api.nvim_buf_get_name(0)), "--single-quote"}, + stdin = true + } +end + +require("formatter").setup( + { + filetype = { + -- lua = {function() return {exe = "lua-format", stdin = true} end}, + json = {prettierConfig}, + html = {prettierConfig}, + javascript = {prettierConfig}, + typescript = {prettierConfig}, + typescriptreact = {prettierConfig} + } + } +) diff --git a/lua/plugins/init.lua b/lua/plugins/init.lua index 0189a721..e464a2f0 100644 --- a/lua/plugins/init.lua +++ b/lua/plugins/init.lua @@ -101,8 +101,13 @@ require('packer').startup(function() 'numToStr/Comment.nvim', } + -- mackdown 预览插件 use {'iamcco/markdown-preview.nvim', run = 'cd app && yarn install', cmd = 'MarkdownPreview'} + -- 格式化插件 + -- use 'mhartington/formatter.nvim' + use 'sbdchd/neoformat' + end) require('plugins/config/bufferline') @@ -124,4 +129,5 @@ require('plugins/config/wilder') require('plugins/config/nvim-colorizer') require('plugins/config/comment') -- require('plugins/config/lspsaga') +-- require('plugins/config/formatter') diff --git a/plugin/packer_compiled.lua b/plugin/packer_compiled.lua index 6d92b165..0970a29b 100644 --- a/plugin/packer_compiled.lua +++ b/plugin/packer_compiled.lua @@ -124,6 +124,11 @@ _G.packer_plugins = { path = "/Users/kailuo/.local/share/nvim/site/pack/packer/start/cmp-vsnip", url = "https://github.com/hrsh7th/cmp-vsnip" }, + ["formatter.nvim"] = { + loaded = true, + path = "/Users/kailuo/.local/share/nvim/site/pack/packer/start/formatter.nvim", + url = "https://github.com/mhartington/formatter.nvim" + }, ["friendly-snippets"] = { loaded = true, path = "/Users/kailuo/.local/share/nvim/site/pack/packer/start/friendly-snippets", @@ -167,6 +172,11 @@ _G.packer_plugins = { path = "/Users/kailuo/.local/share/nvim/site/pack/packer/opt/markdown-preview.nvim", url = "https://github.com/iamcco/markdown-preview.nvim" }, + neoformat = { + loaded = true, + path = "/Users/kailuo/.local/share/nvim/site/pack/packer/start/neoformat", + url = "https://github.com/sbdchd/neoformat" + }, ["nvim-cmp"] = { loaded = true, path = "/Users/kailuo/.local/share/nvim/site/pack/packer/start/nvim-cmp", From 195adfc24de924bd1ade8a16284159eefb1e4d5a Mon Sep 17 00:00:00 2001 From: kaiv2 Date: Thu, 27 Jan 2022 18:27:35 +0800 Subject: [PATCH 0022/1278] update --- plugin/packer_compiled.lua | 5 ----- 1 file changed, 5 deletions(-) diff --git a/plugin/packer_compiled.lua b/plugin/packer_compiled.lua index 0970a29b..572473d5 100644 --- a/plugin/packer_compiled.lua +++ b/plugin/packer_compiled.lua @@ -124,11 +124,6 @@ _G.packer_plugins = { path = "/Users/kailuo/.local/share/nvim/site/pack/packer/start/cmp-vsnip", url = "https://github.com/hrsh7th/cmp-vsnip" }, - ["formatter.nvim"] = { - loaded = true, - path = "/Users/kailuo/.local/share/nvim/site/pack/packer/start/formatter.nvim", - url = "https://github.com/mhartington/formatter.nvim" - }, ["friendly-snippets"] = { loaded = true, path = "/Users/kailuo/.local/share/nvim/site/pack/packer/start/friendly-snippets", From 958a9a4b70462c7ae4be206c978e2b56006a7445 Mon Sep 17 00:00:00 2001 From: kaiv2 Date: Thu, 27 Jan 2022 20:15:18 +0800 Subject: [PATCH 0023/1278] add plugin --- lua/plugins/init.lua | 12 ++++++++++++ plugin/packer_compiled.lua | 10 ++++++++++ 2 files changed, 22 insertions(+) diff --git a/lua/plugins/init.lua b/lua/plugins/init.lua index e464a2f0..0e445857 100644 --- a/lua/plugins/init.lua +++ b/lua/plugins/init.lua @@ -108,6 +108,18 @@ require('packer').startup(function() -- use 'mhartington/formatter.nvim' use 'sbdchd/neoformat' + -- Lua + use { + "folke/which-key.nvim", + config = function() + require("which-key").setup { + -- your configuration comes here + -- or leave it empty to use the default settings + -- refer to the configuration section below + } + end + } + end) require('plugins/config/bufferline') diff --git a/plugin/packer_compiled.lua b/plugin/packer_compiled.lua index 572473d5..21696bd7 100644 --- a/plugin/packer_compiled.lua +++ b/plugin/packer_compiled.lua @@ -267,6 +267,12 @@ _G.packer_plugins = { path = "/Users/kailuo/.local/share/nvim/site/pack/packer/start/vista.vim", url = "https://github.com/liuchengxu/vista.vim" }, + ["which-key.nvim"] = { + config = { "\27LJ\2\n;\0\0\3\0\3\0\a6\0\0\0'\2\1\0B\0\2\0029\0\2\0004\2\0\0B\0\2\1K\0\1\0\nsetup\14which-key\frequire\0" }, + loaded = true, + path = "/Users/kailuo/.local/share/nvim/site/pack/packer/start/which-key.nvim", + url = "https://github.com/folke/which-key.nvim" + }, ["wilder.nvim"] = { loaded = true, path = "/Users/kailuo/.local/share/nvim/site/pack/packer/start/wilder.nvim", @@ -275,6 +281,10 @@ _G.packer_plugins = { } time([[Defining packer_plugins]], false) +-- Config for: which-key.nvim +time([[Config for which-key.nvim]], true) +try_loadstring("\27LJ\2\n;\0\0\3\0\3\0\a6\0\0\0'\2\1\0B\0\2\0029\0\2\0004\2\0\0B\0\2\1K\0\1\0\nsetup\14which-key\frequire\0", "config", "which-key.nvim") +time([[Config for which-key.nvim]], false) -- Command lazy-loads time([[Defining lazy-load commands]], true) From fdabfbdf1969c0d1746ec93042cb543fdc77baf4 Mon Sep 17 00:00:00 2001 From: kaiv2 Date: Thu, 27 Jan 2022 20:48:28 +0800 Subject: [PATCH 0024/1278] add plugin --- lua/basic.lua | 4 ++-- lua/keybindings.lua | 6 ++++++ lua/plugins/config/dashboard-nvim.lua | 3 +++ lua/plugins/config/telescope.lua | 30 +++++++++++++++++++++++++++ lua/plugins/init.lua | 12 ++++++++++- plugin/packer_compiled.lua | 15 ++++++++++++++ 6 files changed, 67 insertions(+), 3 deletions(-) create mode 100644 lua/plugins/config/dashboard-nvim.lua create mode 100644 lua/plugins/config/telescope.lua diff --git a/lua/basic.lua b/lua/basic.lua index 4d1e10c9..4d8efd41 100644 --- a/lua/basic.lua +++ b/lua/basic.lua @@ -13,8 +13,8 @@ vim.g.encoding = "UTF-8" vim.o.fileencoding= "UTF-8" -- jk移动时光标下上方保留8行 -vim.o.scrolloff = 8 -vim.o.sidescrolloff = 8 +vim.o.scrolloff = 3 +vim.o.sidescrolloff = 3 -- 缩进配置 vim.o.tabstop=4 diff --git a/lua/keybindings.lua b/lua/keybindings.lua index 14a3c093..fcd2f114 100644 --- a/lua/keybindings.lua +++ b/lua/keybindings.lua @@ -41,6 +41,12 @@ map('n', 'x', ':Trouble', opt) -- lspsaga -- map('n', 'K', ':Lspsaga hover_doc', opt) +-- Telescope +map('n', 'ff', 'Telescope find_files', {}) +map('n', 'fg', 'Telescope live_grep', {}) +map('n', 'fb', 'Telescope buffers', {}) +map('n', 'fh', 'Telescope help_tags', {}) + local pluginKeys = {} -- lsp 回调函数快捷键设置 diff --git a/lua/plugins/config/dashboard-nvim.lua b/lua/plugins/config/dashboard-nvim.lua new file mode 100644 index 00000000..4222b051 --- /dev/null +++ b/lua/plugins/config/dashboard-nvim.lua @@ -0,0 +1,3 @@ +vim.cmd([[ +let g:dashboard_default_executive ='telescope' +]]) diff --git a/lua/plugins/config/telescope.lua b/lua/plugins/config/telescope.lua new file mode 100644 index 00000000..98085316 --- /dev/null +++ b/lua/plugins/config/telescope.lua @@ -0,0 +1,30 @@ +require('telescope').setup{ + defaults = { + -- Default configuration for telescope goes here: + -- config_key = value, + mappings = { + i = { + -- map actions.which_key to (default: ) + -- actions.which_key shows the mappings for your picker, + -- e.g. git_{create, delete, ...}_branch for the git_branches picker + [""] = "which_key" + } + } + }, + pickers = { + -- Default configuration for builtin pickers goes here: + -- picker_name = { + -- picker_config_key = value, + -- ... + -- } + -- Now the picker_config_key will be applied every time you call this + -- builtin picker + }, + extensions = { + -- Your extension configuration goes here: + -- extension_name = { + -- extension_config_key = value, + -- } + -- please take a look at the readme of the extension you want to configure + } +} diff --git a/lua/plugins/init.lua b/lua/plugins/init.lua index 0e445857..594c8e81 100644 --- a/lua/plugins/init.lua +++ b/lua/plugins/init.lua @@ -108,7 +108,6 @@ require('packer').startup(function() -- use 'mhartington/formatter.nvim' use 'sbdchd/neoformat' - -- Lua use { "folke/which-key.nvim", config = function() @@ -120,6 +119,15 @@ require('packer').startup(function() end } + use { + 'nvim-telescope/telescope.nvim', + requires = { {'nvim-lua/plenary.nvim'} } + } + + use { + 'glepnir/dashboard-nvim', + } + end) require('plugins/config/bufferline') @@ -142,4 +150,6 @@ require('plugins/config/nvim-colorizer') require('plugins/config/comment') -- require('plugins/config/lspsaga') -- require('plugins/config/formatter') +require('plugins/config/telescope') +require('plugins/config/dashboard-nvim') diff --git a/plugin/packer_compiled.lua b/plugin/packer_compiled.lua index 21696bd7..417580ce 100644 --- a/plugin/packer_compiled.lua +++ b/plugin/packer_compiled.lua @@ -124,6 +124,12 @@ _G.packer_plugins = { path = "/Users/kailuo/.local/share/nvim/site/pack/packer/start/cmp-vsnip", url = "https://github.com/hrsh7th/cmp-vsnip" }, + ["dashboard-nvim"] = { + config = { "\27LJ\2\n]\0\0\3\0\3\0\0056\0\0\0009\0\1\0'\2\2\0B\0\2\1K\0\1\0> let g:dashboard_default_executive ='telescope'\n \bcmd\bvim\0" }, + loaded = true, + path = "/Users/kailuo/.local/share/nvim/site/pack/packer/start/dashboard-nvim", + url = "https://github.com/glepnir/dashboard-nvim" + }, ["friendly-snippets"] = { loaded = true, path = "/Users/kailuo/.local/share/nvim/site/pack/packer/start/friendly-snippets", @@ -232,6 +238,11 @@ _G.packer_plugins = { path = "/Users/kailuo/.local/share/nvim/site/pack/packer/start/plenary.nvim", url = "https://github.com/nvim-lua/plenary.nvim" }, + ["telescope.nvim"] = { + loaded = true, + path = "/Users/kailuo/.local/share/nvim/site/pack/packer/start/telescope.nvim", + url = "https://github.com/nvim-telescope/telescope.nvim" + }, ["trouble.nvim"] = { loaded = true, path = "/Users/kailuo/.local/share/nvim/site/pack/packer/start/trouble.nvim", @@ -285,6 +296,10 @@ time([[Defining packer_plugins]], false) time([[Config for which-key.nvim]], true) try_loadstring("\27LJ\2\n;\0\0\3\0\3\0\a6\0\0\0'\2\1\0B\0\2\0029\0\2\0004\2\0\0B\0\2\1K\0\1\0\nsetup\14which-key\frequire\0", "config", "which-key.nvim") time([[Config for which-key.nvim]], false) +-- Config for: dashboard-nvim +time([[Config for dashboard-nvim]], true) +try_loadstring("\27LJ\2\n]\0\0\3\0\3\0\0056\0\0\0009\0\1\0'\2\2\0B\0\2\1K\0\1\0> let g:dashboard_default_executive ='telescope'\n \bcmd\bvim\0", "config", "dashboard-nvim") +time([[Config for dashboard-nvim]], false) -- Command lazy-loads time([[Defining lazy-load commands]], true) From 67daa6e38a503d06b9582ffc3e2003f5565e7cd0 Mon Sep 17 00:00:00 2001 From: kaiv2 Date: Thu, 27 Jan 2022 21:50:51 +0800 Subject: [PATCH 0025/1278] config --- lua/keybindings.lua | 6 +++- lua/plugins/config/indent-blankline.lua | 17 +++++++--- lua/plugins/config/nvim-lsputils.lua | 44 +++++++++++++++++++++++++ lua/plugins/config/nvim-notify.lua | 2 +- lua/plugins/config/telescope.lua | 9 ++++- lua/plugins/init.lua | 13 ++++++-- plugin/packer_compiled.lua | 20 ++++++++--- 7 files changed, 96 insertions(+), 15 deletions(-) create mode 100644 lua/plugins/config/nvim-lsputils.lua diff --git a/lua/keybindings.lua b/lua/keybindings.lua index fcd2f114..ab535b4a 100644 --- a/lua/keybindings.lua +++ b/lua/keybindings.lua @@ -36,7 +36,7 @@ map('t', ' ', '::FloatermToggle', opt) map('n', 'o', ':Vista!!', opt) -- trouble.nvim -map('n', 'x', ':Trouble', opt) +map('n', 'x', 'Trouble', opt) -- lspsaga -- map('n', 'K', ':Lspsaga hover_doc', opt) @@ -47,6 +47,10 @@ map('n', 'fg', 'Telescope live_grep', {}) map('n', 'fb', 'Telescope buffers', {}) map('n', 'fh', 'Telescope help_tags', {}) +-- translate +map('n', 't', ':TranslateW --engines=google', opt) +map('v', 't', ':TranslateW --engines=google', opt) + local pluginKeys = {} -- lsp 回调函数快捷键设置 diff --git a/lua/plugins/config/indent-blankline.lua b/lua/plugins/config/indent-blankline.lua index a0e18b73..dbc7620f 100644 --- a/lua/plugins/config/indent-blankline.lua +++ b/lua/plugins/config/indent-blankline.lua @@ -3,8 +3,17 @@ vim.opt.list = true -- vim.opt.listchars:append("eol:↴") require("indent_blankline").setup { --- show_end_of_line = true, --- space_char_blankline = " ", - show_current_context = true, --- show_current_context_start = true, + -- show_end_of_line = true, + -- space_char_blankline = " ", + show_current_context = true, + -- show_current_context_start = true, + disable_with_nolist = true, + -- filetype_exclude = { "help", "terminal", "packer", "NvimTree", "git", "text" }, + filetype_exclude = { "help", "terminal", "packer", "markdown", "git", "text" }, + buftype_exclude = { "terminal" }, + use_treesitter = true, + context_patterns = { + "class", "function", "method", "block", "list_literal", "selector", + "^if", "^table", "if_statement", "while", "for", + }, } diff --git a/lua/plugins/config/nvim-lsputils.lua b/lua/plugins/config/nvim-lsputils.lua new file mode 100644 index 00000000..aa583c8d --- /dev/null +++ b/lua/plugins/config/nvim-lsputils.lua @@ -0,0 +1,44 @@ +if vim.fn.has('nvim-0.5.1') == 1 then + vim.lsp.handlers['textDocument/codeAction'] = require'lsputil.codeAction'.code_action_handler + vim.lsp.handlers['textDocument/references'] = require'lsputil.locations'.references_handler + vim.lsp.handlers['textDocument/definition'] = require'lsputil.locations'.definition_handler + vim.lsp.handlers['textDocument/declaration'] = require'lsputil.locations'.declaration_handler + vim.lsp.handlers['textDocument/typeDefinition'] = require'lsputil.locations'.typeDefinition_handler + vim.lsp.handlers['textDocument/implementation'] = require'lsputil.locations'.implementation_handler + vim.lsp.handlers['textDocument/documentSymbol'] = require'lsputil.symbols'.document_handler + vim.lsp.handlers['workspace/symbol'] = require'lsputil.symbols'.workspace_handler +else + local bufnr = vim.api.nvim_buf_get_number(0) + + vim.lsp.handlers['textDocument/codeAction'] = function(_, _, actions) + require('lsputil.codeAction').code_action_handler(nil, actions, nil, nil, nil) + end + + vim.lsp.handlers['textDocument/references'] = function(_, _, result) + require('lsputil.locations').references_handler(nil, result, { bufnr = bufnr }, nil) + end + + vim.lsp.handlers['textDocument/definition'] = function(_, method, result) + require('lsputil.locations').definition_handler(nil, result, { bufnr = bufnr, method = method }, nil) + end + + vim.lsp.handlers['textDocument/declaration'] = function(_, method, result) + require('lsputil.locations').declaration_handler(nil, result, { bufnr = bufnr, method = method }, nil) + end + + vim.lsp.handlers['textDocument/typeDefinition'] = function(_, method, result) + require('lsputil.locations').typeDefinition_handler(nil, result, { bufnr = bufnr, method = method }, nil) + end + + vim.lsp.handlers['textDocument/implementation'] = function(_, method, result) + require('lsputil.locations').implementation_handler(nil, result, { bufnr = bufnr, method = method }, nil) + end + + vim.lsp.handlers['textDocument/documentSymbol'] = function(_, _, result, _, bufn) + require('lsputil.symbols').document_handler(nil, result, { bufnr = bufn }, nil) + end + + vim.lsp.handlers['textDocument/symbol'] = function(_, _, result, _, bufn) + require('lsputil.symbols').workspace_handler(nil, result, { bufnr = bufn }, nil) + end +end diff --git a/lua/plugins/config/nvim-notify.lua b/lua/plugins/config/nvim-notify.lua index 0d31b5c6..6e4aef70 100644 --- a/lua/plugins/config/nvim-notify.lua +++ b/lua/plugins/config/nvim-notify.lua @@ -13,7 +13,7 @@ vim.notify.setup({ render = "default", -- Default timeout for notifications - timeout = 5000, + timeout = 3000, -- For stages that change opacity this is treated as the highlight behind the window -- Set this to either a highlight group, an RGB hex value e.g. "#000000" or a function returning an RGB code for dynamic values diff --git a/lua/plugins/config/telescope.lua b/lua/plugins/config/telescope.lua index 98085316..3bf1682a 100644 --- a/lua/plugins/config/telescope.lua +++ b/lua/plugins/config/telescope.lua @@ -1,3 +1,5 @@ +local actions = require("telescope.actions") +local trouble = require("trouble.providers.telescope") require('telescope').setup{ defaults = { -- Default configuration for telescope goes here: @@ -7,7 +9,12 @@ require('telescope').setup{ -- map actions.which_key to (default: ) -- actions.which_key shows the mappings for your picker, -- e.g. git_{create, delete, ...}_branch for the git_branches picker - [""] = "which_key" + [""] = "which_key", + -- [""] = actions.close, + -- [""] = trouble.open_with_trouble, + }, + n = { + -- [""] = trouble.open_with_trouble, } } }, diff --git a/lua/plugins/init.lua b/lua/plugins/init.lua index 594c8e81..6e5b60ba 100644 --- a/lua/plugins/init.lua +++ b/lua/plugins/init.lua @@ -108,6 +108,8 @@ require('packer').startup(function() -- use 'mhartington/formatter.nvim' use 'sbdchd/neoformat' + + -- 快捷键查看 use { "folke/which-key.nvim", config = function() @@ -119,15 +121,19 @@ require('packer').startup(function() end } + -- 搜索插件 use { 'nvim-telescope/telescope.nvim', requires = { {'nvim-lua/plenary.nvim'} } } - use { - 'glepnir/dashboard-nvim', - } + -- 仪表盘 + use {'glepnir/dashboard-nvim'} + use 'RishabhRD/popfix' + use 'RishabhRD/nvim-lsputils' + + use 'voldikss/vim-translator' end) require('plugins/config/bufferline') @@ -152,4 +158,5 @@ require('plugins/config/comment') -- require('plugins/config/formatter') require('plugins/config/telescope') require('plugins/config/dashboard-nvim') +require('plugins/config/nvim-lsputils') diff --git a/plugin/packer_compiled.lua b/plugin/packer_compiled.lua index 417580ce..b48a28da 100644 --- a/plugin/packer_compiled.lua +++ b/plugin/packer_compiled.lua @@ -125,7 +125,6 @@ _G.packer_plugins = { url = "https://github.com/hrsh7th/cmp-vsnip" }, ["dashboard-nvim"] = { - config = { "\27LJ\2\n]\0\0\3\0\3\0\0056\0\0\0009\0\1\0'\2\2\0B\0\2\1K\0\1\0> let g:dashboard_default_executive ='telescope'\n \bcmd\bvim\0" }, loaded = true, path = "/Users/kailuo/.local/share/nvim/site/pack/packer/start/dashboard-nvim", url = "https://github.com/glepnir/dashboard-nvim" @@ -203,6 +202,11 @@ _G.packer_plugins = { path = "/Users/kailuo/.local/share/nvim/site/pack/packer/start/nvim-lspconfig", url = "https://github.com/neovim/nvim-lspconfig" }, + ["nvim-lsputils"] = { + loaded = true, + path = "/Users/kailuo/.local/share/nvim/site/pack/packer/start/nvim-lsputils", + url = "https://github.com/RishabhRD/nvim-lsputils" + }, ["nvim-notify"] = { loaded = true, path = "/Users/kailuo/.local/share/nvim/site/pack/packer/start/nvim-notify", @@ -238,6 +242,11 @@ _G.packer_plugins = { path = "/Users/kailuo/.local/share/nvim/site/pack/packer/start/plenary.nvim", url = "https://github.com/nvim-lua/plenary.nvim" }, + popfix = { + loaded = true, + path = "/Users/kailuo/.local/share/nvim/site/pack/packer/start/popfix", + url = "https://github.com/RishabhRD/popfix" + }, ["telescope.nvim"] = { loaded = true, path = "/Users/kailuo/.local/share/nvim/site/pack/packer/start/telescope.nvim", @@ -263,6 +272,11 @@ _G.packer_plugins = { path = "/Users/kailuo/.local/share/nvim/site/pack/packer/start/vim-matchup", url = "https://github.com/andymass/vim-matchup" }, + ["vim-translator"] = { + loaded = true, + path = "/Users/kailuo/.local/share/nvim/site/pack/packer/start/vim-translator", + url = "https://github.com/voldikss/vim-translator" + }, ["vim-visual-multi"] = { loaded = true, path = "/Users/kailuo/.local/share/nvim/site/pack/packer/start/vim-visual-multi", @@ -296,10 +310,6 @@ time([[Defining packer_plugins]], false) time([[Config for which-key.nvim]], true) try_loadstring("\27LJ\2\n;\0\0\3\0\3\0\a6\0\0\0'\2\1\0B\0\2\0029\0\2\0004\2\0\0B\0\2\1K\0\1\0\nsetup\14which-key\frequire\0", "config", "which-key.nvim") time([[Config for which-key.nvim]], false) --- Config for: dashboard-nvim -time([[Config for dashboard-nvim]], true) -try_loadstring("\27LJ\2\n]\0\0\3\0\3\0\0056\0\0\0009\0\1\0'\2\2\0B\0\2\1K\0\1\0> let g:dashboard_default_executive ='telescope'\n \bcmd\bvim\0", "config", "dashboard-nvim") -time([[Config for dashboard-nvim]], false) -- Command lazy-loads time([[Defining lazy-load commands]], true) From 9921fb8716a08f3af0a298adf938352b6962460e Mon Sep 17 00:00:00 2001 From: kaiv2 Date: Thu, 27 Jan 2022 22:17:48 +0800 Subject: [PATCH 0026/1278] add plugin --- lua/keybindings.lua | 14 ++++++++++++-- lua/plugins/init.lua | 18 ++++++++++++------ plugin/packer_compiled.lua | 25 +++++++++++++++---------- 3 files changed, 39 insertions(+), 18 deletions(-) diff --git a/lua/keybindings.lua b/lua/keybindings.lua index ab535b4a..830cd2a2 100644 --- a/lua/keybindings.lua +++ b/lua/keybindings.lua @@ -39,7 +39,8 @@ map('n', 'o', ':Vista!!', opt) map('n', 'x', 'Trouble', opt) -- lspsaga --- map('n', 'K', ':Lspsaga hover_doc', opt) +map('n', 'K', ':Lspsaga hover_doc', opt) +map('n', 'gr', ':Lspsaga lsp_finder', opt) -- Telescope map('n', 'ff', 'Telescope find_files', {}) @@ -51,12 +52,21 @@ map('n', 'fh', 'Telescope help_tags', {}) map('n', 't', ':TranslateW --engines=google', opt) map('v', 't', ':TranslateW --engines=google', opt) +-- vim-easy-align +vim.cmd([[ +" Start interactive EasyAlign in visual mode (e.g. vipga) +xmap ga (EasyAlign) + +" Start interactive EasyAlign for a motion/text object (e.g. gaip) +nmap ga (EasyAlign) +]]) + local pluginKeys = {} -- lsp 回调函数快捷键设置 pluginKeys.maplsp = function(mapbuf) - mapbuf('n', 'K', 'lua vim.lsp.buf.hover()', opt) + -- mapbuf('n', 'K', 'lua vim.lsp.buf.hover()', opt) -- rename mapbuf('n', 'rn', 'lua vim.lsp.buf.rename()', opt) -- code action diff --git a/lua/plugins/init.lua b/lua/plugins/init.lua index 6e5b60ba..f0e064ba 100644 --- a/lua/plugins/init.lua +++ b/lua/plugins/init.lua @@ -18,12 +18,14 @@ require('packer').startup(function() use 'rafamadriz/friendly-snippets' -- lspkind use 'onsails/lspkind-nvim' - -- use 'glepnir/lspsaga.nvim' -- lsp 相关 use 'folke/lsp-colors.nvim' use 'folke/trouble.nvim' + use 'glepnir/lspsaga.nvim' + -- use 'RishabhRD/popfix' + -- use 'RishabhRD/nvim-lsputils' -- 主题 use 'morhetz/gruvbox' @@ -130,10 +132,14 @@ require('packer').startup(function() -- 仪表盘 use {'glepnir/dashboard-nvim'} - use 'RishabhRD/popfix' - use 'RishabhRD/nvim-lsputils' - + -- 翻译插件 use 'voldikss/vim-translator' + + -- 自动对齐插件 + use 'junegunn/vim-easy-align' + + -- 表格模式插件 + use 'dhruvasagar/vim-table-mode' end) require('plugins/config/bufferline') @@ -154,9 +160,9 @@ require('plugins/config/nvim-notify') require('plugins/config/wilder') require('plugins/config/nvim-colorizer') require('plugins/config/comment') --- require('plugins/config/lspsaga') +require('plugins/config/lspsaga') -- require('plugins/config/formatter') require('plugins/config/telescope') require('plugins/config/dashboard-nvim') -require('plugins/config/nvim-lsputils') +-- require('plugins/config/nvim-lsputils') diff --git a/plugin/packer_compiled.lua b/plugin/packer_compiled.lua index b48a28da..c067072f 100644 --- a/plugin/packer_compiled.lua +++ b/plugin/packer_compiled.lua @@ -159,6 +159,11 @@ _G.packer_plugins = { path = "/Users/kailuo/.local/share/nvim/site/pack/packer/start/lspkind-nvim", url = "https://github.com/onsails/lspkind-nvim" }, + ["lspsaga.nvim"] = { + loaded = true, + path = "/Users/kailuo/.local/share/nvim/site/pack/packer/start/lspsaga.nvim", + url = "https://github.com/glepnir/lspsaga.nvim" + }, ["lualine.nvim"] = { loaded = true, path = "/Users/kailuo/.local/share/nvim/site/pack/packer/start/lualine.nvim", @@ -202,11 +207,6 @@ _G.packer_plugins = { path = "/Users/kailuo/.local/share/nvim/site/pack/packer/start/nvim-lspconfig", url = "https://github.com/neovim/nvim-lspconfig" }, - ["nvim-lsputils"] = { - loaded = true, - path = "/Users/kailuo/.local/share/nvim/site/pack/packer/start/nvim-lsputils", - url = "https://github.com/RishabhRD/nvim-lsputils" - }, ["nvim-notify"] = { loaded = true, path = "/Users/kailuo/.local/share/nvim/site/pack/packer/start/nvim-notify", @@ -242,11 +242,6 @@ _G.packer_plugins = { path = "/Users/kailuo/.local/share/nvim/site/pack/packer/start/plenary.nvim", url = "https://github.com/nvim-lua/plenary.nvim" }, - popfix = { - loaded = true, - path = "/Users/kailuo/.local/share/nvim/site/pack/packer/start/popfix", - url = "https://github.com/RishabhRD/popfix" - }, ["telescope.nvim"] = { loaded = true, path = "/Users/kailuo/.local/share/nvim/site/pack/packer/start/telescope.nvim", @@ -257,6 +252,11 @@ _G.packer_plugins = { path = "/Users/kailuo/.local/share/nvim/site/pack/packer/start/trouble.nvim", url = "https://github.com/folke/trouble.nvim" }, + ["vim-easy-align"] = { + loaded = true, + path = "/Users/kailuo/.local/share/nvim/site/pack/packer/start/vim-easy-align", + url = "https://github.com/junegunn/vim-easy-align" + }, ["vim-floaterm"] = { loaded = true, path = "/Users/kailuo/.local/share/nvim/site/pack/packer/start/vim-floaterm", @@ -272,6 +272,11 @@ _G.packer_plugins = { path = "/Users/kailuo/.local/share/nvim/site/pack/packer/start/vim-matchup", url = "https://github.com/andymass/vim-matchup" }, + ["vim-table-mode"] = { + loaded = true, + path = "/Users/kailuo/.local/share/nvim/site/pack/packer/start/vim-table-mode", + url = "https://github.com/dhruvasagar/vim-table-mode" + }, ["vim-translator"] = { loaded = true, path = "/Users/kailuo/.local/share/nvim/site/pack/packer/start/vim-translator", From 4a036880046abf7a9902b16e1e022040db3b5895 Mon Sep 17 00:00:00 2001 From: kaiv2 Date: Thu, 27 Jan 2022 22:32:13 +0800 Subject: [PATCH 0027/1278] add plugin --- lua/plugins/config/nvim-autopairs.lua | 1 + lua/plugins/init.lua | 4 ++++ plugin/packer_compiled.lua | 5 +++++ 3 files changed, 10 insertions(+) create mode 100644 lua/plugins/config/nvim-autopairs.lua diff --git a/lua/plugins/config/nvim-autopairs.lua b/lua/plugins/config/nvim-autopairs.lua new file mode 100644 index 00000000..5b9c03cc --- /dev/null +++ b/lua/plugins/config/nvim-autopairs.lua @@ -0,0 +1 @@ +require('nvim-autopairs').setup{} diff --git a/lua/plugins/init.lua b/lua/plugins/init.lua index f0e064ba..f143e275 100644 --- a/lua/plugins/init.lua +++ b/lua/plugins/init.lua @@ -140,6 +140,9 @@ require('packer').startup(function() -- 表格模式插件 use 'dhruvasagar/vim-table-mode' + + -- () 自动补全 + use 'windwp/nvim-autopairs' end) require('plugins/config/bufferline') @@ -165,4 +168,5 @@ require('plugins/config/lspsaga') require('plugins/config/telescope') require('plugins/config/dashboard-nvim') -- require('plugins/config/nvim-lsputils') +require('plugins/config/nvim-autopairs') diff --git a/plugin/packer_compiled.lua b/plugin/packer_compiled.lua index c067072f..e09ef907 100644 --- a/plugin/packer_compiled.lua +++ b/plugin/packer_compiled.lua @@ -182,6 +182,11 @@ _G.packer_plugins = { path = "/Users/kailuo/.local/share/nvim/site/pack/packer/start/neoformat", url = "https://github.com/sbdchd/neoformat" }, + ["nvim-autopairs"] = { + loaded = true, + path = "/Users/kailuo/.local/share/nvim/site/pack/packer/start/nvim-autopairs", + url = "https://github.com/windwp/nvim-autopairs" + }, ["nvim-cmp"] = { loaded = true, path = "/Users/kailuo/.local/share/nvim/site/pack/packer/start/nvim-cmp", From 53a04b29f3f645353eb18c53a1c22745c08c21cc Mon Sep 17 00:00:00 2001 From: kaiv2 Date: Thu, 27 Jan 2022 22:47:34 +0800 Subject: [PATCH 0028/1278] config --- lua/basic.lua | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/lua/basic.lua b/lua/basic.lua index 4d8efd41..da8df0d7 100644 --- a/lua/basic.lua +++ b/lua/basic.lua @@ -69,8 +69,17 @@ vim.o.wildmenu = true -- vim.g.python_host_prog='/opt/homebrew/bin/python3' vim.g.python3_host_prog='/opt/homebrew/bin/python3' -vim.api.nvim_exec([[ +vim.cmd([[ +if exists('g:neovide') + let g:neovide_cursor_vfx_mode = "railgun" + set guifont=DejaVuSansMono\ Nerd\ Font:h14 + let g:neovide_transparency=0.8 + " let g:neovide_fullscreen=v:true + let g:neovide_remember_window_size = v:true + let g:neovide_input_use_logo=v:true +else +endif if has("autocmd") au BufReadPost * if line("'\"") > 1 && line("'\"") <= line("$") | exe "normal! g'\"" | endif endif -]], true) +]]) From 0ae3bc7ff9476d38ec1f64a15760a532c676c5ee Mon Sep 17 00:00:00 2001 From: kaiv2 Date: Thu, 27 Jan 2022 22:49:10 +0800 Subject: [PATCH 0029/1278] update --- lua/lsp/init.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lua/lsp/init.lua b/lua/lsp/init.lua index 03a48e48..1699450d 100644 --- a/lua/lsp/init.lua +++ b/lua/lsp/init.lua @@ -6,7 +6,7 @@ local lsp_installer = require "nvim-lsp-installer" local servers = { sumneko_lua = require "lsp.lua", -- /lua/lsp/lua.lua jdtls = require "lsp.java", -- /lua/lsp/jdtls.lua - jsonls = {}, + jsonls = {}, } -- 自动安装 LanguageServers From 515fee4ea3cbfacbc258d4b17c103492a60f66c4 Mon Sep 17 00:00:00 2001 From: kaiv2 Date: Thu, 27 Jan 2022 23:04:08 +0800 Subject: [PATCH 0030/1278] config: --- lua/plugins/config/lsp_signature.lua | 11 +++++++++++ lua/plugins/config/lspsaga.lua | 7 ++++++- lua/plugins/init.lua | 3 +++ 3 files changed, 20 insertions(+), 1 deletion(-) create mode 100644 lua/plugins/config/lsp_signature.lua diff --git a/lua/plugins/config/lsp_signature.lua b/lua/plugins/config/lsp_signature.lua new file mode 100644 index 00000000..7b5ebcbe --- /dev/null +++ b/lua/plugins/config/lsp_signature.lua @@ -0,0 +1,11 @@ + +require("lsp_signature").on_attach({ + bind = true, + use_lspsaga = false, + floating_window = true, + fix_pos = true, + hint_enable = true, + hi_parameter = "Search", + handler_opts = {"double"} +}) + diff --git a/lua/plugins/config/lspsaga.lua b/lua/plugins/config/lspsaga.lua index 26d50d19..9a776ded 100644 --- a/lua/plugins/config/lspsaga.lua +++ b/lua/plugins/config/lspsaga.lua @@ -37,4 +37,9 @@ local saga = require 'lspsaga' -- like server_filetype_map = {metals = {'sbt', 'scala'}} -- server_filetype_map = {} -saga.init_lsp_saga() +saga.init_lsp_saga({ + error_sign = '', + warn_sign = '', + hint_sign = '', + infor_sign = '' +}) diff --git a/lua/plugins/init.lua b/lua/plugins/init.lua index f143e275..0437c7bd 100644 --- a/lua/plugins/init.lua +++ b/lua/plugins/init.lua @@ -24,6 +24,8 @@ require('packer').startup(function() use 'folke/trouble.nvim' use 'glepnir/lspsaga.nvim' + -- use 'ray-x/lsp_signature.nvim' + -- use 'RishabhRD/popfix' -- use 'RishabhRD/nvim-lsputils' @@ -169,4 +171,5 @@ require('plugins/config/telescope') require('plugins/config/dashboard-nvim') -- require('plugins/config/nvim-lsputils') require('plugins/config/nvim-autopairs') +-- require('plugins/config/lsp_signature') From 83386436414f514363bfd74fd15d3b2ff4bd2d4f Mon Sep 17 00:00:00 2001 From: kaiv2 Date: Fri, 28 Jan 2022 10:18:50 +0800 Subject: [PATCH 0031/1278] jdtls --- ftplugin/java.lua | 108 ++++++++++++++++++++++++++++++++++++++++++++++ lua/lsp/init.lua | 2 +- lua/lsp/java.lua | 3 ++ 3 files changed, 112 insertions(+), 1 deletion(-) diff --git a/ftplugin/java.lua b/ftplugin/java.lua index e69de29b..c1a99451 100644 --- a/ftplugin/java.lua +++ b/ftplugin/java.lua @@ -0,0 +1,108 @@ +local project_name = vim.fn.fnamemodify(vim.fn.getcwd(), ':p:h:t') + +-- local workspace_dir = '/Users/kailuo/jdtls-workspace/' .. project_name +local workspace_dir = '/Users/kailuo/jdtls-workspace/' + +-- See `:help vim.lsp.start_client` for an overview of the supported `config` options. +local config = { + -- The command that starts the language server + -- See: https://github.com/eclipse/eclipse.jdt.ls#running-from-the-command-line + cmd = { + '/Library/Java/JavaVirtualMachines/zulu-11.jdk/Contents/Home/bin/java', -- or '/path/to/java11_or_newer/bin/java' + '-Declipse.application=org.eclipse.jdt.ls.core.id1', + '-Dosgi.bundles.defaultStartLevel=4', + '-Declipse.product=org.eclipse.jdt.ls.core.product', + '-Dlog.protocol=true', + '-Dlog.level=ALL', + '-Xms1g', + '-Xmx1g', + "-javaagent:/opt/software/lsp/lombok.jar", + '--add-modules=ALL-SYSTEM', + '--add-opens', 'java.base/java.util=ALL-UNNAMED', + '--add-opens', 'java.base/java.lang=ALL-UNNAMED', + '-jar', '/opt/software/jdtls/plugins/org.eclipse.equinox.launcher_1.6.400.v20210924-0641.jar', + '-configuration', '/opt/software/jdtls/config_mac', + '-data', workspace_dir, + }, + + -- 💀 + -- This is the default if not provided, you can remove it. Or adjust as needed. + -- One dedicated LSP server & client will be started per unique root_dir + root_dir = require('jdtls.setup').find_root({'.git', 'mvnw', 'gradlew'}), + + -- Here you can configure eclipse.jdt.ls specific settings + -- See https://github.com/eclipse/eclipse.jdt.ls/wiki/Running-the-JAVA-LS-server-from-the-command-line#initialize-request + -- for a list of options + settings = { + java = { + home = "/Library/Java/JavaVirtualMachines/zulu-11.jdk/Contents/Home", + eclipse = { + downloadSources = true, + }, + server = { + launchMode = "Hybrid", + }, + maven = { + downloadSources = true, + updateSnapshots = true, + }, + configuration = { + maven = { +-- userSettings = "/opt/software/apache-maven-3.6.3/conf/settings.xml", +-- globalSettings = "/opt/software/apache-maven-3.6.3/conf/settings.xml", + userSettings = "/Users/kailuo/workspace/paylabs/maven/settings.xml", + globalSettings = "/Users/kailuo/workspace/paylabs/maven/settings.xml", + }, + runtimes = { + { + name = "JavaSE-1.8", + path = "/Library/Java/JavaVirtualMachines/zulu-8.jdk/Contents/Home", + }, + { + name = "JavaSE-11", + path = "/Library/Java/JavaVirtualMachines/zulu-11.jdk/Contents/Home", + }, + } + }, + } + }, + + -- Language server `initializationOptions` + -- You need to extend the `bundles` with paths to jar files + -- if you want to use additional eclipse.jdt.ls plugins. + -- + -- See https://github.com/mfussenegger/nvim-jdtls#java-debug-installation + -- + -- If you don't plan on using the debugger or other eclipse.jdt.ls plugins you can remove this + init_options = { + bundles = {}, + workspace = workspace_dir + }, +} +local jdtls = require('jdtls') +local capabilities = require('cmp_nvim_lsp').update_capabilities(vim.lsp.protocol.make_client_capabilities()) +config.capabilities = capabilities; +jdtls.start_or_attach(config) + +local map = vim.api.nvim_set_keymap +local opt = {noremap = true, silent = true } + +map('n', 'K', 'lua vim.lsp.buf.hover()', opt) +-- rename +map('n', 'rn', 'lua vim.lsp.buf.rename()', opt) +-- code action +map('n', 'ca', 'lua vim.lsp.buf.code_action()', opt) +-- go xx +map('n', 'gd', 'lua vim.lsp.buf.definition()', opt) +map('n', 'gh', 'lua vim.lsp.buf.hover()', opt) +map('n', 'gD', 'lua vim.lsp.buf.declaration()', opt) +map('n', 'gi', 'lua vim.lsp.buf.implementation()', opt) +map('n', 'gr', 'lua vim.lsp.buf.references()', opt) +-- diagnostic +map('n', 'go', 'lua vim.diagnostic.open_float()', opt) +map('n', '[g', 'lua vim.diagnostic.goto_prev()', opt) +map('n', ']g', 'lua vim.diagnostic.goto_next()', opt) +-- map('n', 'q', 'lua vim.diagnostic.setloclist()', opt) +-- leader + = +map('n', '=', 'lua vim.lsp.buf.formatting()', opt) + diff --git a/lua/lsp/init.lua b/lua/lsp/init.lua index 1699450d..7d7fb4d7 100644 --- a/lua/lsp/init.lua +++ b/lua/lsp/init.lua @@ -5,7 +5,7 @@ local lsp_installer = require "nvim-lsp-installer" -- { key: 语言 value: 配置文件 } local servers = { sumneko_lua = require "lsp.lua", -- /lua/lsp/lua.lua - jdtls = require "lsp.java", -- /lua/lsp/jdtls.lua + -- jdtls = require "lsp.java", -- /lua/lsp/jdtls.lua jsonls = {}, } diff --git a/lua/lsp/java.lua b/lua/lsp/java.lua index 61d42c86..c6755a8f 100644 --- a/lua/lsp/java.lua +++ b/lua/lsp/java.lua @@ -77,6 +77,9 @@ return { -- -- If you don't plan on using the debugger or other eclipse.jdt.ls plugins you can remove this init_options = { + jvm_args = { + 'hello' + }, bundles = {}, workspace = workspace_dir }, From 057a127ba82a2989dc8b49cfcb8aa9abe24de5df Mon Sep 17 00:00:00 2001 From: kaiv2 Date: Fri, 28 Jan 2022 10:31:38 +0800 Subject: [PATCH 0032/1278] remove plugin --- lua/keybindings.lua | 4 ++-- lua/plugins/init.lua | 4 ++-- plugin/packer_compiled.lua | 5 ----- 3 files changed, 4 insertions(+), 9 deletions(-) diff --git a/lua/keybindings.lua b/lua/keybindings.lua index 830cd2a2..f64d3dcf 100644 --- a/lua/keybindings.lua +++ b/lua/keybindings.lua @@ -39,8 +39,8 @@ map('n', 'o', ':Vista!!', opt) map('n', 'x', 'Trouble', opt) -- lspsaga -map('n', 'K', ':Lspsaga hover_doc', opt) -map('n', 'gr', ':Lspsaga lsp_finder', opt) +-- map('n', 'K', ':Lspsaga hover_doc', opt) +-- map('n', 'gr', ':Lspsaga lsp_finder', opt) -- Telescope map('n', 'ff', 'Telescope find_files', {}) diff --git a/lua/plugins/init.lua b/lua/plugins/init.lua index 0437c7bd..4e63d84e 100644 --- a/lua/plugins/init.lua +++ b/lua/plugins/init.lua @@ -22,7 +22,7 @@ require('packer').startup(function() -- lsp 相关 use 'folke/lsp-colors.nvim' use 'folke/trouble.nvim' - use 'glepnir/lspsaga.nvim' + -- use 'glepnir/lspsaga.nvim' -- use 'ray-x/lsp_signature.nvim' @@ -165,7 +165,7 @@ require('plugins/config/nvim-notify') require('plugins/config/wilder') require('plugins/config/nvim-colorizer') require('plugins/config/comment') -require('plugins/config/lspsaga') +-- require('plugins/config/lspsaga') -- require('plugins/config/formatter') require('plugins/config/telescope') require('plugins/config/dashboard-nvim') diff --git a/plugin/packer_compiled.lua b/plugin/packer_compiled.lua index e09ef907..9298ce63 100644 --- a/plugin/packer_compiled.lua +++ b/plugin/packer_compiled.lua @@ -159,11 +159,6 @@ _G.packer_plugins = { path = "/Users/kailuo/.local/share/nvim/site/pack/packer/start/lspkind-nvim", url = "https://github.com/onsails/lspkind-nvim" }, - ["lspsaga.nvim"] = { - loaded = true, - path = "/Users/kailuo/.local/share/nvim/site/pack/packer/start/lspsaga.nvim", - url = "https://github.com/glepnir/lspsaga.nvim" - }, ["lualine.nvim"] = { loaded = true, path = "/Users/kailuo/.local/share/nvim/site/pack/packer/start/lualine.nvim", From c2906d16f1b1d9b01ceeb14a98460568427cbb4c Mon Sep 17 00:00:00 2001 From: kaiv2 Date: Fri, 28 Jan 2022 11:29:43 +0800 Subject: [PATCH 0033/1278] java debug --- ftplugin/java.lua | 54 +++++++++++++++++++++++++++++--- lua/keybindings.lua | 4 +-- lua/plugins/config/telescope.lua | 6 ++++ lua/plugins/init.lua | 4 +++ plugin/packer_compiled.lua | 10 ++++++ 5 files changed, 72 insertions(+), 6 deletions(-) diff --git a/ftplugin/java.lua b/ftplugin/java.lua index c1a99451..dbc0fc82 100644 --- a/ftplugin/java.lua +++ b/ftplugin/java.lua @@ -74,11 +74,34 @@ local config = { -- See https://github.com/mfussenegger/nvim-jdtls#java-debug-installation -- -- If you don't plan on using the debugger or other eclipse.jdt.ls plugins you can remove this - init_options = { - bundles = {}, - workspace = workspace_dir - }, + -- init_options = { + -- bundles = { + -- vim.fn.glob("/opt/software/lsp/java/java-debug/com.microsoft.java.debug.plugin/target/com.microsoft.java.debug.plugin-0.35.0.jar") + -- }, + -- workspace = workspace_dir + -- }, +} + + +-- This bundles definition is the same as in the previous section (java-debug installation) +local bundles = { + vim.fn.glob("/opt/software/lsp/java/java-debug/com.microsoft.java.debug.plugin/target/com.microsoft.java.debug.plugin-*.jar") +}; + +-- /opt/software/lsp/java/vscode-java-test/server +vim.list_extend(bundles, vim.split(vim.fn.glob("/opt/software/lsp/java/vscode-java-test/server/*.jar"), "\n")) +config['init_options'] = { + bundles = bundles; } + +config['on_attach'] = function(client, bufnr) + -- With `hotcodereplace = 'auto' the debug adapter will try to apply code changes + -- you make during a debug session immediately. + -- Remove the option if you do not want that. + require('jdtls').setup_dap({ hotcodereplace = 'auto' }) +end + + local jdtls = require('jdtls') local capabilities = require('cmp_nvim_lsp').update_capabilities(vim.lsp.protocol.make_client_capabilities()) config.capabilities = capabilities; @@ -106,3 +129,26 @@ map('n', ']g', 'lua vim.diagnostic.goto_next()', opt) -- leader + = map('n', '=', 'lua vim.lsp.buf.formatting()', opt) + +vim.cmd([[ +command! -nargs=0 OR :lua require'jdtls'.organize_imports() +command! -nargs=0 Format :lua vim.lsp.buf.formatting() +nnoremap crv lua require('jdtls').extract_variable() +vnoremap crv lua require('jdtls').extract_variable(true) +nnoremap crc lua require('jdtls').extract_constant() +vnoremap crc lua require('jdtls').extract_constant(true) +vnoremap crm lua require('jdtls').extract_method(true) + +command! -nargs=0 TestClass :lua require'jdtls'.test_class() +command! -nargs=0 TestMethod :lua require'jdtls'.test_nearest_method() +nnoremap dc lua require'jdtls'.test_class() +nnoremap dm lua require'jdtls'.test_nearest_method() + +command! -buffer -nargs=? -complete=custom,v:lua.require'jdtls'._complete_compile JdtCompile lua require('jdtls').compile() +command! -buffer -nargs=? -complete=custom,v:lua.require'jdtls'._complete_set_runtime JdtSetRuntime lua require('jdtls').set_runtime() +command! -buffer JdtUpdateConfig lua require('jdtls').update_project_config() +command! -buffer JdtJol lua require('jdtls').jol() +command! -buffer JdtBytecode lua require('jdtls').javap() +command! -buffer JdtJshell lua require('jdtls').jshell() +]]) + diff --git a/lua/keybindings.lua b/lua/keybindings.lua index f64d3dcf..431a4f9b 100644 --- a/lua/keybindings.lua +++ b/lua/keybindings.lua @@ -49,8 +49,8 @@ map('n', 'fb', 'Telescope buffers', {}) map('n', 'fh', 'Telescope help_tags', {}) -- translate -map('n', 't', ':TranslateW --engines=google', opt) -map('v', 't', ':TranslateW --engines=google', opt) +map('n', 'fy', ':TranslateW --engines=google', opt) +map('v', 'fy', ':TranslateW --engines=google', opt) -- vim-easy-align vim.cmd([[ diff --git a/lua/plugins/config/telescope.lua b/lua/plugins/config/telescope.lua index 3bf1682a..5e5de1f9 100644 --- a/lua/plugins/config/telescope.lua +++ b/lua/plugins/config/telescope.lua @@ -33,5 +33,11 @@ require('telescope').setup{ -- extension_config_key = value, -- } -- please take a look at the readme of the extension you want to configure + ["ui-select"] = { + require("telescope.themes").get_dropdown { + -- even more opts + } + } } } +require("telescope").load_extension("ui-select") diff --git a/lua/plugins/init.lua b/lua/plugins/init.lua index 4e63d84e..c3630d4d 100644 --- a/lua/plugins/init.lua +++ b/lua/plugins/init.lua @@ -52,6 +52,9 @@ require('packer').startup(function() -- java use 'mfussenegger/nvim-jdtls' + -- debug + use 'mfussenegger/nvim-dap' + -- git use 'tpope/vim-fugitive' @@ -130,6 +133,7 @@ require('packer').startup(function() 'nvim-telescope/telescope.nvim', requires = { {'nvim-lua/plenary.nvim'} } } + use {'nvim-telescope/telescope-ui-select.nvim' } -- 仪表盘 use {'glepnir/dashboard-nvim'} diff --git a/plugin/packer_compiled.lua b/plugin/packer_compiled.lua index 9298ce63..3bee0525 100644 --- a/plugin/packer_compiled.lua +++ b/plugin/packer_compiled.lua @@ -192,6 +192,11 @@ _G.packer_plugins = { path = "/Users/kailuo/.local/share/nvim/site/pack/packer/start/nvim-colorizer.lua", url = "https://github.com/norcalli/nvim-colorizer.lua" }, + ["nvim-dap"] = { + loaded = true, + path = "/Users/kailuo/.local/share/nvim/site/pack/packer/start/nvim-dap", + url = "https://github.com/mfussenegger/nvim-dap" + }, ["nvim-jdtls"] = { loaded = true, path = "/Users/kailuo/.local/share/nvim/site/pack/packer/start/nvim-jdtls", @@ -242,6 +247,11 @@ _G.packer_plugins = { path = "/Users/kailuo/.local/share/nvim/site/pack/packer/start/plenary.nvim", url = "https://github.com/nvim-lua/plenary.nvim" }, + ["telescope-ui-select.nvim"] = { + loaded = true, + path = "/Users/kailuo/.local/share/nvim/site/pack/packer/start/telescope-ui-select.nvim", + url = "https://github.com/nvim-telescope/telescope-ui-select.nvim" + }, ["telescope.nvim"] = { loaded = true, path = "/Users/kailuo/.local/share/nvim/site/pack/packer/start/telescope.nvim", From e8fd487429234cb2c7ee0415ef78ae9303340789 Mon Sep 17 00:00:00 2001 From: kaiv2 Date: Fri, 28 Jan 2022 11:52:23 +0800 Subject: [PATCH 0034/1278] nvim-dap-ui --- lua/keybindings.lua | 13 +++++++++ lua/plugins/config/nvim-dap.lua | 51 +++++++++++++++++++++++++++++++++ lua/plugins/init.lua | 2 ++ plugin/packer_compiled.lua | 5 ++++ 4 files changed, 71 insertions(+) create mode 100644 lua/plugins/config/nvim-dap.lua diff --git a/lua/keybindings.lua b/lua/keybindings.lua index 431a4f9b..45ebac09 100644 --- a/lua/keybindings.lua +++ b/lua/keybindings.lua @@ -61,6 +61,19 @@ xmap ga (EasyAlign) nmap ga (EasyAlign) ]]) +-- nvim-dap +vim.cmd([[ +nnoremap :lua require'dap'.continue() +nnoremap :lua require'dap'.step_over() +nnoremap :lua require'dap'.step_into() +nnoremap :lua require'dap'.step_out() +nnoremap b :lua require'dap'.toggle_breakpoint() +nnoremap B :lua require'dap'.set_breakpoint(vim.fn.input('Breakpoint condition: ')) +nnoremap lp :lua require'dap'.set_breakpoint(nil, nil, vim.fn.input('Log point message: ')) +nnoremap dr :lua require'dap'.repl.open() +nnoremap dl :lua require'dap'.run_last() +]]) + local pluginKeys = {} -- lsp 回调函数快捷键设置 diff --git a/lua/plugins/config/nvim-dap.lua b/lua/plugins/config/nvim-dap.lua new file mode 100644 index 00000000..9ba1dd9a --- /dev/null +++ b/lua/plugins/config/nvim-dap.lua @@ -0,0 +1,51 @@ +require("dapui").setup({ + icons = { expanded = "▾", collapsed = "▸" }, + mappings = { + -- Use a table to apply multiple mappings + expand = { "", "<2-LeftMouse>" }, + open = "o", + remove = "d", + edit = "e", + repl = "r", + }, + sidebar = { + -- You can change the order of elements in the sidebar + elements = { + -- Provide as ID strings or tables with "id" and "size" keys + { + id = "scopes", + size = 0.25, -- Can be float or integer > 1 + }, + { id = "breakpoints", size = 0.25 }, + { id = "stacks", size = 0.25 }, + { id = "watches", size = 00.25 }, + }, + size = 40, + position = "left", -- Can be "left", "right", "top", "bottom" + }, + tray = { + elements = { "repl" }, + size = 10, + position = "bottom", -- Can be "left", "right", "top", "bottom" + }, + floating = { + max_height = nil, -- These can be integers or a float between 0 and 1. + max_width = nil, -- Floats will be treated as percentage of your screen. + border = "single", -- Border style. Can be "single", "double" or "rounded" + mappings = { + close = { "q", "" }, + }, + }, + windows = { indent = 1 }, +}) + +local dap, dapui = require("dap"), require("dapui") +dap.listeners.after.event_initialized["dapui_config"] = function() + dapui.open() +end +dap.listeners.before.event_terminated["dapui_config"] = function() + dapui.close() +end +dap.listeners.before.event_exited["dapui_config"] = function() + dapui.close() +end diff --git a/lua/plugins/init.lua b/lua/plugins/init.lua index c3630d4d..1ab74e86 100644 --- a/lua/plugins/init.lua +++ b/lua/plugins/init.lua @@ -54,6 +54,7 @@ require('packer').startup(function() -- debug use 'mfussenegger/nvim-dap' + use { "rcarriga/nvim-dap-ui", requires = {"mfussenegger/nvim-dap"} } -- git use 'tpope/vim-fugitive' @@ -176,4 +177,5 @@ require('plugins/config/dashboard-nvim') -- require('plugins/config/nvim-lsputils') require('plugins/config/nvim-autopairs') -- require('plugins/config/lsp_signature') +require('plugins/config/nvim-dap') diff --git a/plugin/packer_compiled.lua b/plugin/packer_compiled.lua index 3bee0525..ecb18be0 100644 --- a/plugin/packer_compiled.lua +++ b/plugin/packer_compiled.lua @@ -197,6 +197,11 @@ _G.packer_plugins = { path = "/Users/kailuo/.local/share/nvim/site/pack/packer/start/nvim-dap", url = "https://github.com/mfussenegger/nvim-dap" }, + ["nvim-dap-ui"] = { + loaded = true, + path = "/Users/kailuo/.local/share/nvim/site/pack/packer/start/nvim-dap-ui", + url = "https://github.com/rcarriga/nvim-dap-ui" + }, ["nvim-jdtls"] = { loaded = true, path = "/Users/kailuo/.local/share/nvim/site/pack/packer/start/nvim-jdtls", From e2f0069268d004542ee47787a034ed77af4c0f6b Mon Sep 17 00:00:00 2001 From: kaiv2 Date: Fri, 28 Jan 2022 11:54:23 +0800 Subject: [PATCH 0035/1278] config --- lua/keybindings.lua | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lua/keybindings.lua b/lua/keybindings.lua index 45ebac09..67dd200d 100644 --- a/lua/keybindings.lua +++ b/lua/keybindings.lua @@ -49,8 +49,8 @@ map('n', 'fb', 'Telescope buffers', {}) map('n', 'fh', 'Telescope help_tags', {}) -- translate -map('n', 'fy', ':TranslateW --engines=google', opt) -map('v', 'fy', ':TranslateW --engines=google', opt) +map('n', 't', ':TranslateW --engines=google', opt) +map('v', 't', ':TranslateW --engines=google', opt) -- vim-easy-align vim.cmd([[ From 52dc0a486f420b6ac27062a9d50f18bc9274236a Mon Sep 17 00:00:00 2001 From: kaiv2 Date: Fri, 28 Jan 2022 13:16:26 +0800 Subject: [PATCH 0036/1278] config --- ftplugin/java.lua | 14 ++++++++++++++ lua/keybindings.lua | 5 +++++ lua/plugins/config/nvim-dap.lua | 2 +- 3 files changed, 20 insertions(+), 1 deletion(-) diff --git a/ftplugin/java.lua b/ftplugin/java.lua index dbc0fc82..61f78734 100644 --- a/ftplugin/java.lua +++ b/ftplugin/java.lua @@ -139,11 +139,25 @@ nnoremap crc lua require('jdtls').extract_constant() vnoremap crc lua require('jdtls').extract_constant(true) vnoremap crm lua require('jdtls').extract_method(true) + +function! s:jdtls_test_class_ui() + lua require'jdtls'.test_class() + lua require'dapui'.open() +endfunction +function! s:jdtls_test_method_ui() + lua require'jdtls'.test_nearest_method() + lua require'dapui'.open() +endfunction command! -nargs=0 TestClass :lua require'jdtls'.test_class() command! -nargs=0 TestMethod :lua require'jdtls'.test_nearest_method() +command! -nargs=0 TestClassUI :call s:jdtls_test_class_ui() +command! -nargs=0 TestMethodUI :call s:jdtls_test_method_ui() nnoremap dc lua require'jdtls'.test_class() nnoremap dm lua require'jdtls'.test_nearest_method() + + + command! -buffer -nargs=? -complete=custom,v:lua.require'jdtls'._complete_compile JdtCompile lua require('jdtls').compile() command! -buffer -nargs=? -complete=custom,v:lua.require'jdtls'._complete_set_runtime JdtSetRuntime lua require('jdtls').set_runtime() command! -buffer JdtUpdateConfig lua require('jdtls').update_project_config() diff --git a/lua/keybindings.lua b/lua/keybindings.lua index 67dd200d..be2cb16b 100644 --- a/lua/keybindings.lua +++ b/lua/keybindings.lua @@ -74,6 +74,11 @@ nnoremap dr :lua require'dap'.repl.open() nnoremap dl :lua require'dap'.run_last() ]]) +-- nvim-dap-ui +vim.cmd([[ +nnoremap dr :lua require("dapui").float_element(vim.Nil, { enter = true}) +]]) + local pluginKeys = {} -- lsp 回调函数快捷键设置 diff --git a/lua/plugins/config/nvim-dap.lua b/lua/plugins/config/nvim-dap.lua index 9ba1dd9a..2b2af602 100644 --- a/lua/plugins/config/nvim-dap.lua +++ b/lua/plugins/config/nvim-dap.lua @@ -41,7 +41,7 @@ require("dapui").setup({ local dap, dapui = require("dap"), require("dapui") dap.listeners.after.event_initialized["dapui_config"] = function() - dapui.open() + --dapui.open() end dap.listeners.before.event_terminated["dapui_config"] = function() dapui.close() From e8ec487fb9c09f9671e8fb7a0bbd6b9896a0cba6 Mon Sep 17 00:00:00 2001 From: kaiv2 Date: Fri, 28 Jan 2022 16:23:24 +0800 Subject: [PATCH 0037/1278] update --- lua/basic.lua | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/lua/basic.lua b/lua/basic.lua index da8df0d7..c72332e5 100644 --- a/lua/basic.lua +++ b/lua/basic.lua @@ -70,6 +70,10 @@ vim.o.wildmenu = true vim.g.python3_host_prog='/opt/homebrew/bin/python3' vim.cmd([[ +" 始终显示符号列 +set signcolumn=yes +" set signcolumn=number +set mouse=n if exists('g:neovide') let g:neovide_cursor_vfx_mode = "railgun" set guifont=DejaVuSansMono\ Nerd\ Font:h14 From 52e0e7397f2e30fef88456a634d7be016d7b44af Mon Sep 17 00:00:00 2001 From: kaiv2 Date: Fri, 28 Jan 2022 16:34:32 +0800 Subject: [PATCH 0038/1278] update config --- ftplugin/java.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ftplugin/java.lua b/ftplugin/java.lua index 61f78734..376bedd6 100644 --- a/ftplugin/java.lua +++ b/ftplugin/java.lua @@ -15,7 +15,7 @@ local config = { '-Dlog.protocol=true', '-Dlog.level=ALL', '-Xms1g', - '-Xmx1g', + '-Xmx2g', "-javaagent:/opt/software/lsp/lombok.jar", '--add-modules=ALL-SYSTEM', '--add-opens', 'java.base/java.util=ALL-UNNAMED', From 1fc20b740382a02ca5872a30252037231d327150 Mon Sep 17 00:00:00 2001 From: kaiv2 Date: Fri, 28 Jan 2022 23:54:39 +0800 Subject: [PATCH 0039/1278] update --- lua/plugins/config/markdown-preview.lua | 92 +++++++++++++++++++++++++ lua/plugins/init.lua | 3 +- plugin/packer_compiled.lua | 13 +--- 3 files changed, 96 insertions(+), 12 deletions(-) create mode 100644 lua/plugins/config/markdown-preview.lua diff --git a/lua/plugins/config/markdown-preview.lua b/lua/plugins/config/markdown-preview.lua new file mode 100644 index 00000000..f0e284c5 --- /dev/null +++ b/lua/plugins/config/markdown-preview.lua @@ -0,0 +1,92 @@ +vim.cmd([[ +" set to 1, nvim will open the preview window after entering the markdown buffer +" default: 0 +let g:mkdp_auto_start = 0 + +" set to 1, the nvim will auto close current preview window when change +" from markdown buffer to another buffer +" default: 1 +let g:mkdp_auto_close = 1 + +" set to 1, the vim will refresh markdown when save the buffer or +" leave from insert mode, default 0 is auto refresh markdown as you edit or +" move the cursor +" default: 0 +let g:mkdp_refresh_slow = 0 + +" set to 1, the MarkdownPreview command can be use for all files, +" by default it can be use in markdown file +" default: 0 +let g:mkdp_command_for_global = 0 + +" set to 1, preview server available to others in your network +" by default, the server listens on localhost (127.0.0.1) +" default: 0 +let g:mkdp_open_to_the_world = 0 + +" use custom IP to open preview page +" useful when you work in remote vim and preview on local browser +" more detail see: https://github.com/iamcco/markdown-preview.nvim/pull/9 +" default empty +let g:mkdp_open_ip = '' + +" specify browser to open preview page +" default: '' +let g:mkdp_browser = '' + +" set to 1, echo preview page url in command line when open preview page +" default is 0 +let g:mkdp_echo_preview_url = 0 + +" a custom vim function name to open preview page +" this function will receive url as param +" default is empty +let g:mkdp_browserfunc = '' + +" options for markdown render +" mkit: markdown-it options for render +" katex: katex options for math +" uml: markdown-it-plantuml options +" maid: mermaid options +" disable_sync_scroll: if disable sync scroll, default 0 +" sync_scroll_type: 'middle', 'top' or 'relative', default value is 'middle' +" middle: mean the cursor position alway show at the middle of the preview page +" top: mean the vim top viewport alway show at the top of the preview page +" relative: mean the cursor position alway show at the relative positon of the preview page +" hide_yaml_meta: if hide yaml metadata, default is 1 +" sequence_diagrams: js-sequence-diagrams options +" content_editable: if enable content editable for preview page, default: v:false +" disable_filename: if disable filename header for preview page, default: 0 +let g:mkdp_preview_options = { + \ 'mkit': {}, + \ 'katex': {}, + \ 'uml': {}, + \ 'maid': {}, + \ 'disable_sync_scroll': 0, + \ 'sync_scroll_type': 'middle', + \ 'hide_yaml_meta': 1, + \ 'sequence_diagrams': {}, + \ 'flowchart_diagrams': {}, + \ 'content_editable': v:false, + \ 'disable_filename': 0 + \ } + +" use a custom markdown style must be absolute path +" like '/Users/username/markdown.css' or expand('~/markdown.css') +let g:mkdp_markdown_css = '' + +" use a custom highlight style must absolute path +" like '/Users/username/highlight.css' or expand('~/highlight.css') +let g:mkdp_highlight_css = '' + +" use a custom port to start server or random for empty +let g:mkdp_port = '' + +" preview page title +" ${name} will be replace with the file name +let g:mkdp_page_title = '「${name}」' + +" recognized filetypes +" these filetypes will have MarkdownPreview... commands +let g:mkdp_filetypes = ['markdown'] +]]) diff --git a/lua/plugins/init.lua b/lua/plugins/init.lua index 1ab74e86..c149fab1 100644 --- a/lua/plugins/init.lua +++ b/lua/plugins/init.lua @@ -110,7 +110,7 @@ require('packer').startup(function() } -- mackdown 预览插件 - use {'iamcco/markdown-preview.nvim', run = 'cd app && yarn install', cmd = 'MarkdownPreview'} + use {'iamcco/markdown-preview.nvim', run = 'cd app && yarn install'} -- 格式化插件 -- use 'mhartington/formatter.nvim' @@ -178,4 +178,5 @@ require('plugins/config/dashboard-nvim') require('plugins/config/nvim-autopairs') -- require('plugins/config/lsp_signature') require('plugins/config/nvim-dap') +require('plugins/config/markdown-preview') diff --git a/plugin/packer_compiled.lua b/plugin/packer_compiled.lua index ecb18be0..0abcb30c 100644 --- a/plugin/packer_compiled.lua +++ b/plugin/packer_compiled.lua @@ -165,11 +165,8 @@ _G.packer_plugins = { url = "https://github.com/nvim-lualine/lualine.nvim" }, ["markdown-preview.nvim"] = { - commands = { "MarkdownPreview" }, - loaded = false, - needs_bufread = false, - only_cond = false, - path = "/Users/kailuo/.local/share/nvim/site/pack/packer/opt/markdown-preview.nvim", + loaded = true, + path = "/Users/kailuo/.local/share/nvim/site/pack/packer/start/markdown-preview.nvim", url = "https://github.com/iamcco/markdown-preview.nvim" }, neoformat = { @@ -330,12 +327,6 @@ time([[Defining packer_plugins]], false) time([[Config for which-key.nvim]], true) try_loadstring("\27LJ\2\n;\0\0\3\0\3\0\a6\0\0\0'\2\1\0B\0\2\0029\0\2\0004\2\0\0B\0\2\1K\0\1\0\nsetup\14which-key\frequire\0", "config", "which-key.nvim") time([[Config for which-key.nvim]], false) - --- Command lazy-loads -time([[Defining lazy-load commands]], true) -pcall(vim.cmd, [[command -nargs=* -range -bang -complete=file MarkdownPreview lua require("packer.load")({'markdown-preview.nvim'}, { cmd = "MarkdownPreview", l1 = , l2 = , bang = , args = , mods = "" }, _G.packer_plugins)]]) -time([[Defining lazy-load commands]], false) - if should_profile then save_profiles() end end) From ac38d6aad5c42c7fe23aca42b6e289e4c769eddd Mon Sep 17 00:00:00 2001 From: kaiv2 Date: Sat, 29 Jan 2022 10:59:01 +0800 Subject: [PATCH 0040/1278] java debug config --- ftplugin/java.lua | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/ftplugin/java.lua b/ftplugin/java.lua index 376bedd6..b43848cf 100644 --- a/ftplugin/java.lua +++ b/ftplugin/java.lua @@ -1,3 +1,15 @@ +local env = { + -- HOME = vim.loop.os_homedir(), + MAVEN_SETTINGS = os.getenv 'MAVEN_SETTINGS', +} + +local maven_settings = "/opt/software/apache-maven-3.6.3/conf/settings.xml" +local function get_maven_settings() + return env.MAVEN_SETTINGS or maven_settings +end + + + local project_name = vim.fn.fnamemodify(vim.fn.getcwd(), ':p:h:t') -- local workspace_dir = '/Users/kailuo/jdtls-workspace/' .. project_name @@ -50,8 +62,8 @@ local config = { maven = { -- userSettings = "/opt/software/apache-maven-3.6.3/conf/settings.xml", -- globalSettings = "/opt/software/apache-maven-3.6.3/conf/settings.xml", - userSettings = "/Users/kailuo/workspace/paylabs/maven/settings.xml", - globalSettings = "/Users/kailuo/workspace/paylabs/maven/settings.xml", + userSettings = get_maven_settings(), + globalSettings = get_maven_settings(), }, runtimes = { { @@ -156,7 +168,7 @@ nnoremap dc lua require'jdtls'.test_class() nnoremap dm lua require'jdtls'.test_nearest_method() - +command! -nargs=0 JdtRefreshDebugConfigs :lua require('jdtls.dap').setup_dap_main_class_configs() command! -buffer -nargs=? -complete=custom,v:lua.require'jdtls'._complete_compile JdtCompile lua require('jdtls').compile() command! -buffer -nargs=? -complete=custom,v:lua.require'jdtls'._complete_set_runtime JdtSetRuntime lua require('jdtls').set_runtime() From cfcecb98c91b7646390a6b6f5ff80dbe2ad31659 Mon Sep 17 00:00:00 2001 From: kaiv2 Date: Sat, 29 Jan 2022 16:10:33 +0800 Subject: [PATCH 0041/1278] update java config --- ftplugin/java.lua | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/ftplugin/java.lua b/ftplugin/java.lua index b43848cf..0d795cf7 100644 --- a/ftplugin/java.lua +++ b/ftplugin/java.lua @@ -13,7 +13,7 @@ end local project_name = vim.fn.fnamemodify(vim.fn.getcwd(), ':p:h:t') -- local workspace_dir = '/Users/kailuo/jdtls-workspace/' .. project_name -local workspace_dir = '/Users/kailuo/jdtls-workspace/' +local workspace_dir = '/Users/kailuo/jdtls-workspace/' .. project_name -- See `:help vim.lsp.start_client` for an overview of the supported `config` options. local config = { @@ -26,9 +26,13 @@ local config = { '-Declipse.product=org.eclipse.jdt.ls.core.product', '-Dlog.protocol=true', '-Dlog.level=ALL', - '-Xms1g', + '-XX:+UseParallelGC', + '-XX:GCTimeRatio=4', + '-XX:AdaptiveSizePolicyWeight=90', + '-Dsun.zip.disableMemoryMapping=true', + '-Xms100m', '-Xmx2g', - "-javaagent:/opt/software/lsp/lombok.jar", + '-javaagent:/opt/software/lsp/lombok.jar', '--add-modules=ALL-SYSTEM', '--add-opens', 'java.base/java.util=ALL-UNNAMED', '--add-opens', 'java.base/java.lang=ALL-UNNAMED', From 739a5df1efc06be3e1febb0f64a5d25d655bdbf7 Mon Sep 17 00:00:00 2001 From: kaiv2 Date: Sat, 29 Jan 2022 20:00:17 +0800 Subject: [PATCH 0042/1278] config --- lua/keybindings.lua | 3 ++- lua/my_tools/init.lua | 28 ++++++++++++++++++++++++++++ 2 files changed, 30 insertions(+), 1 deletion(-) create mode 100644 lua/my_tools/init.lua diff --git a/lua/keybindings.lua b/lua/keybindings.lua index be2cb16b..904fa3e2 100644 --- a/lua/keybindings.lua +++ b/lua/keybindings.lua @@ -15,7 +15,8 @@ map('n', 'v', '"+p', opt) -- 取消搜索高亮显示 map('n', '', ':nohlsearch', opt) -- %bd 删除所有缓冲区, e# 打开最后一个缓冲区, bd# 关闭[No Name] -map('n', 'o', ':%bd|e#|bd#', opt) +-- map('n', 'o', ':%bd|e#|bd#', opt) +map('n', 'o', 'lua require("my_tools").close_other_buf()', opt) map('n', 'w', ':bw', opt) -- " 退出 terminal 模式 map('t', '', '', opt) diff --git a/lua/my_tools/init.lua b/lua/my_tools/init.lua new file mode 100644 index 00000000..c11ab1a3 --- /dev/null +++ b/lua/my_tools/init.lua @@ -0,0 +1,28 @@ + +local M = {} +-- 69 %a "test.lua" 第 6 行 +-- 76 #h "README.md" 第 1 行 +-- 78 h "init.lua" 第 1 行 +M.close_other_buf = function () + -- local cur_winnr = vim.fn.winnr() + local cur_buf = vim.fn.bufnr('%') + if cur_buf == -1 then + return + end + -- local bf_no = vim.fn.winbufnr(cur_winnr) + vim.fn.execute('bn') + local next_buf = vim.fn.bufnr('%') + -- print('cur_buf ' .. cur_buf) + + local count = 999; + while next_buf ~= -1 and cur_buf ~= next_buf and count > 0 do + -- print('next_buf ' .. next_buf) + local bdel = 'bdel ' .. next_buf + vim.fn.execute('bn') + vim.fn.execute(bdel) + next_buf = vim.fn.bufnr('%') + count = count - 1 + end +end + +return M From 0147c95130b556fa46cd271dbe43a8a318eb213b Mon Sep 17 00:00:00 2001 From: kaiv2 Date: Sat, 29 Jan 2022 21:10:20 +0800 Subject: [PATCH 0043/1278] update config --- lua/keybindings.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lua/keybindings.lua b/lua/keybindings.lua index 904fa3e2..8f288c6b 100644 --- a/lua/keybindings.lua +++ b/lua/keybindings.lua @@ -17,7 +17,7 @@ map('n', '', ':nohlsearch', opt) -- %bd 删除所有缓冲区, e# 打开最后一个缓冲区, bd# 关闭[No Name] -- map('n', 'o', ':%bd|e#|bd#', opt) map('n', 'o', 'lua require("my_tools").close_other_buf()', opt) -map('n', 'w', ':bw', opt) +map('n', 'w', ':bdel', opt) -- " 退出 terminal 模式 map('t', '', '', opt) From bd810fc53d32276d24e0801fb33683e6e2611131 Mon Sep 17 00:00:00 2001 From: kaiv2 Date: Sat, 29 Jan 2022 21:32:42 +0800 Subject: [PATCH 0044/1278] config --- lua/keybindings.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lua/keybindings.lua b/lua/keybindings.lua index 8f288c6b..5a90f983 100644 --- a/lua/keybindings.lua +++ b/lua/keybindings.lua @@ -85,7 +85,7 @@ local pluginKeys = {} -- lsp 回调函数快捷键设置 pluginKeys.maplsp = function(mapbuf) - -- mapbuf('n', 'K', 'lua vim.lsp.buf.hover()', opt) + mapbuf('n', 'K', 'lua vim.lsp.buf.hover()', opt) -- rename mapbuf('n', 'rn', 'lua vim.lsp.buf.rename()', opt) -- code action From 623659aab78df72f7ce38b24bf016fc16f6a60ff Mon Sep 17 00:00:00 2001 From: kaiv2 Date: Sat, 29 Jan 2022 23:00:48 +0800 Subject: [PATCH 0045/1278] config --- ftplugin/java.lua | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ftplugin/java.lua b/ftplugin/java.lua index 0d795cf7..6a9d0aba 100644 --- a/ftplugin/java.lua +++ b/ftplugin/java.lua @@ -3,9 +3,9 @@ local env = { MAVEN_SETTINGS = os.getenv 'MAVEN_SETTINGS', } -local maven_settings = "/opt/software/apache-maven-3.6.3/conf/settings.xml" +local maven_settings = '/opt/software/apache-maven-3.6.3/conf/settings.xml' local function get_maven_settings() - return env.MAVEN_SETTINGS or maven_settings + return env.MAVEN_SETTINGS and env.MAVEN_SETTINGS or maven_settings end From a50151b00224bf60a43f7a1f4a83898b084185be Mon Sep 17 00:00:00 2001 From: kaiv2 Date: Fri, 4 Feb 2022 22:36:58 +0800 Subject: [PATCH 0046/1278] add rust-tools --- ftplugin/java.lua | 22 +--------------------- lua/lsp/c.lua | 1 + lua/lsp/init.lua | 2 ++ lua/lsp/rust.lua | 1 + lua/plugins/config/rust-tools.lua | 20 ++++++++++++++++++++ lua/plugins/init.lua | 7 +++++++ plugin/packer_compiled.lua | 10 ++++++++++ 7 files changed, 42 insertions(+), 21 deletions(-) create mode 100644 lua/lsp/c.lua create mode 100644 lua/lsp/rust.lua create mode 100644 lua/plugins/config/rust-tools.lua diff --git a/ftplugin/java.lua b/ftplugin/java.lua index 6a9d0aba..09860d6c 100644 --- a/ftplugin/java.lua +++ b/ftplugin/java.lua @@ -124,27 +124,7 @@ config.capabilities = capabilities; jdtls.start_or_attach(config) local map = vim.api.nvim_set_keymap -local opt = {noremap = true, silent = true } - -map('n', 'K', 'lua vim.lsp.buf.hover()', opt) --- rename -map('n', 'rn', 'lua vim.lsp.buf.rename()', opt) --- code action -map('n', 'ca', 'lua vim.lsp.buf.code_action()', opt) --- go xx -map('n', 'gd', 'lua vim.lsp.buf.definition()', opt) -map('n', 'gh', 'lua vim.lsp.buf.hover()', opt) -map('n', 'gD', 'lua vim.lsp.buf.declaration()', opt) -map('n', 'gi', 'lua vim.lsp.buf.implementation()', opt) -map('n', 'gr', 'lua vim.lsp.buf.references()', opt) --- diagnostic -map('n', 'go', 'lua vim.diagnostic.open_float()', opt) -map('n', '[g', 'lua vim.diagnostic.goto_prev()', opt) -map('n', ']g', 'lua vim.diagnostic.goto_next()', opt) --- map('n', 'q', 'lua vim.diagnostic.setloclist()', opt) --- leader + = -map('n', '=', 'lua vim.lsp.buf.formatting()', opt) - +require('keybindings').maplsp(map) vim.cmd([[ command! -nargs=0 OR :lua require'jdtls'.organize_imports() diff --git a/lua/lsp/c.lua b/lua/lsp/c.lua new file mode 100644 index 00000000..a5647075 --- /dev/null +++ b/lua/lsp/c.lua @@ -0,0 +1 @@ +return {} diff --git a/lua/lsp/init.lua b/lua/lsp/init.lua index 7d7fb4d7..a6473642 100644 --- a/lua/lsp/init.lua +++ b/lua/lsp/init.lua @@ -7,6 +7,8 @@ local servers = { sumneko_lua = require "lsp.lua", -- /lua/lsp/lua.lua -- jdtls = require "lsp.java", -- /lua/lsp/jdtls.lua jsonls = {}, + clangd = require 'lsp.c', + -- rust_analyzer = require 'lsp.rust', } -- 自动安装 LanguageServers diff --git a/lua/lsp/rust.lua b/lua/lsp/rust.lua new file mode 100644 index 00000000..a5647075 --- /dev/null +++ b/lua/lsp/rust.lua @@ -0,0 +1 @@ +return {} diff --git a/lua/plugins/config/rust-tools.lua b/lua/plugins/config/rust-tools.lua new file mode 100644 index 00000000..9c326208 --- /dev/null +++ b/lua/plugins/config/rust-tools.lua @@ -0,0 +1,20 @@ + +-- Update this path +local extension_path = '/Users/kailuo/.vscode/extensions/vadimcn.vscode-lldb-1.6.10/' +local codelldb_path = extension_path .. 'adapter/codelldb' +local liblldb_path = extension_path .. 'lldb/lib/liblldb.dylib' + +local opts = { + -- ... other configs + dap = { + adapter = require('rust-tools.dap').get_codelldb_adapter( + codelldb_path, liblldb_path) + } +} + +-- Normal setup +require('rust-tools').setup(opts) + + +local map = vim.api.nvim_set_keymap +require('keybindings').maplsp(map) diff --git a/lua/plugins/init.lua b/lua/plugins/init.lua index c149fab1..c6c589cd 100644 --- a/lua/plugins/init.lua +++ b/lua/plugins/init.lua @@ -150,6 +150,12 @@ require('packer').startup(function() -- () 自动补全 use 'windwp/nvim-autopairs' + + -- 任务插件 + use 'itchyny/calendar.vim' + + -- rust + use 'simrat39/rust-tools.nvim' end) require('plugins/config/bufferline') @@ -179,4 +185,5 @@ require('plugins/config/nvim-autopairs') -- require('plugins/config/lsp_signature') require('plugins/config/nvim-dap') require('plugins/config/markdown-preview') +require('plugins/config/rust-tools') diff --git a/plugin/packer_compiled.lua b/plugin/packer_compiled.lua index 0abcb30c..efa84742 100644 --- a/plugin/packer_compiled.lua +++ b/plugin/packer_compiled.lua @@ -99,6 +99,11 @@ _G.packer_plugins = { path = "/Users/kailuo/.local/share/nvim/site/pack/packer/start/bufferline.nvim", url = "https://github.com/akinsho/bufferline.nvim" }, + ["calendar.vim"] = { + loaded = true, + path = "/Users/kailuo/.local/share/nvim/site/pack/packer/start/calendar.vim", + url = "https://github.com/itchyny/calendar.vim" + }, ["cmp-buffer"] = { loaded = true, path = "/Users/kailuo/.local/share/nvim/site/pack/packer/start/cmp-buffer", @@ -249,6 +254,11 @@ _G.packer_plugins = { path = "/Users/kailuo/.local/share/nvim/site/pack/packer/start/plenary.nvim", url = "https://github.com/nvim-lua/plenary.nvim" }, + ["rust-tools.nvim"] = { + loaded = true, + path = "/Users/kailuo/.local/share/nvim/site/pack/packer/start/rust-tools.nvim", + url = "https://github.com/simrat39/rust-tools.nvim" + }, ["telescope-ui-select.nvim"] = { loaded = true, path = "/Users/kailuo/.local/share/nvim/site/pack/packer/start/telescope-ui-select.nvim", From 67f0c46f2c406757255e4a206708360104e43120 Mon Sep 17 00:00:00 2001 From: kaiv2 Date: Sun, 6 Feb 2022 20:02:28 +0800 Subject: [PATCH 0047/1278] config --- ftplugin/java.lua | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/ftplugin/java.lua b/ftplugin/java.lua index 09860d6c..f30c6ea6 100644 --- a/ftplugin/java.lua +++ b/ftplugin/java.lua @@ -120,6 +120,15 @@ end local jdtls = require('jdtls') local capabilities = require('cmp_nvim_lsp').update_capabilities(vim.lsp.protocol.make_client_capabilities()) +-- capabilities.experimental = { +-- hoverActions = true, +-- hoverRange = true, +-- serverStatusNotification = true, +-- snippetTextEdit = true, +-- codeActionGroup = true, +-- ssr = true, +-- } + config.capabilities = capabilities; jdtls.start_or_attach(config) From 3027dd0ba4b33156a5ea031f2a5ea21e3e049fda Mon Sep 17 00:00:00 2001 From: kaiv2 Date: Fri, 11 Feb 2022 17:49:04 +0800 Subject: [PATCH 0048/1278] config --- ftplugin/java.lua | 4 ++++ lua/basic.lua | 6 ++++++ 2 files changed, 10 insertions(+) diff --git a/ftplugin/java.lua b/ftplugin/java.lua index f30c6ea6..ef9c28e7 100644 --- a/ftplugin/java.lua +++ b/ftplugin/java.lua @@ -78,6 +78,10 @@ local config = { name = "JavaSE-11", path = "/Library/Java/JavaVirtualMachines/zulu-11.jdk/Contents/Home", }, + { + name = "JavaSE-17", + path = "/Library/Java/JavaVirtualMachines/zulu-17.jdk/Contents/Home", + }, } }, } diff --git a/lua/basic.lua b/lua/basic.lua index c72332e5..f9e83c75 100644 --- a/lua/basic.lua +++ b/lua/basic.lua @@ -8,6 +8,12 @@ vim.wo.cursorline = true -- 右侧参考线,超过表示代码太长了,考虑换行 -- vim.wo.colorcolumn = "80" +-- 边搜索边高亮 +vim.o.incsearch = true +-- 忽悠大小写 +vim.o.ignorecase = true +-- 智能大小写 +vim.o.smartcase = true vim.g.encoding = "UTF-8" From a1a07ddfd71d35851e513778e4679bb2f64bbf2f Mon Sep 17 00:00:00 2001 From: kaiv2 Date: Fri, 11 Feb 2022 20:45:32 +0800 Subject: [PATCH 0049/1278] config --- lua/plugins/config/nvim-tree.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lua/plugins/config/nvim-tree.lua b/lua/plugins/config/nvim-tree.lua index 264cd2e0..dc2a9d4e 100644 --- a/lua/plugins/config/nvim-tree.lua +++ b/lua/plugins/config/nvim-tree.lua @@ -22,7 +22,7 @@ require'nvim-tree'.setup { }, update_focused_file = { enable = true, - update_cwd = true, + update_cwd = false, ignore_list = {} }, system_open = { From ddc579d06714c534bb707215c0f2480acd38690d Mon Sep 17 00:00:00 2001 From: kaiv2 Date: Fri, 11 Feb 2022 21:13:59 +0800 Subject: [PATCH 0050/1278] update --- lua/plugins/config/nvim-tree.lua | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/lua/plugins/config/nvim-tree.lua b/lua/plugins/config/nvim-tree.lua index dc2a9d4e..8ebce8ce 100644 --- a/lua/plugins/config/nvim-tree.lua +++ b/lua/plugins/config/nvim-tree.lua @@ -4,15 +4,21 @@ require'nvim-tree'.setup { open_on_setup = false, ignore_ft_on_setup = {}, auto_close = true, + auto_reload_on_write = true, open_on_tab = false, hijack_cursor = false, update_cwd = false, + actions = { + open_file = { + quit_on_open = true, + }, + }, update_to_buf_dir = { - enable = true, - auto_open = true, + enable = false, + auto_open = false, }, diagnostics = { - enable = false, + enable = true, icons = { hint = "", info = "", @@ -31,7 +37,7 @@ require'nvim-tree'.setup { }, filters = { dotfiles = false, - custom = {} + custom = {".git"} }, git = { enable = true, @@ -58,5 +64,4 @@ require'nvim-tree'.setup { } } -vim.g.nvim_tree_quit_on_open = 1 From d2aaa97910ce0785c14be318fcad4d1621daad93 Mon Sep 17 00:00:00 2001 From: kaiv2 Date: Fri, 11 Feb 2022 21:21:02 +0800 Subject: [PATCH 0051/1278] config --- lua/plugins/config/nvim-tree.lua | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lua/plugins/config/nvim-tree.lua b/lua/plugins/config/nvim-tree.lua index 8ebce8ce..1f5ffd85 100644 --- a/lua/plugins/config/nvim-tree.lua +++ b/lua/plugins/config/nvim-tree.lua @@ -45,8 +45,8 @@ require'nvim-tree'.setup { timeout = 500, }, view = { - width = 30, - height = 30, + width = '40%', + height = '40%', hide_root_folder = true, side = 'left', auto_resize = true, From c9751652521d98d93dbf58de7158d8fdba7a1205 Mon Sep 17 00:00:00 2001 From: kaiv2 Date: Fri, 11 Feb 2022 21:35:19 +0800 Subject: [PATCH 0052/1278] debug key --- lua/keybindings.lua | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lua/keybindings.lua b/lua/keybindings.lua index 5a90f983..a7d7914a 100644 --- a/lua/keybindings.lua +++ b/lua/keybindings.lua @@ -65,9 +65,9 @@ nmap ga (EasyAlign) -- nvim-dap vim.cmd([[ nnoremap :lua require'dap'.continue() -nnoremap :lua require'dap'.step_over() -nnoremap :lua require'dap'.step_into() -nnoremap :lua require'dap'.step_out() +nnoremap :lua require'dap'.step_over() +nnoremap :lua require'dap'.step_into() +nnoremap :lua require'dap'.step_out() nnoremap b :lua require'dap'.toggle_breakpoint() nnoremap B :lua require'dap'.set_breakpoint(vim.fn.input('Breakpoint condition: ')) nnoremap lp :lua require'dap'.set_breakpoint(nil, nil, vim.fn.input('Log point message: ')) From 36bbb67d379ba1b9e2c13633bc64c61c03260c9f Mon Sep 17 00:00:00 2001 From: kaiv2 Date: Fri, 11 Feb 2022 21:53:53 +0800 Subject: [PATCH 0053/1278] bufferline config --- lua/plugins/config/bufferline.lua | 33 ++++++++++++++++++++----------- 1 file changed, 22 insertions(+), 11 deletions(-) diff --git a/lua/plugins/config/bufferline.lua b/lua/plugins/config/bufferline.lua index d2f7d568..622f5aec 100644 --- a/lua/plugins/config/bufferline.lua +++ b/lua/plugins/config/bufferline.lua @@ -1,13 +1,24 @@ require("bufferline").setup { - options = { - -- 使用 nvim 内置lsp - diagnostics = "nvim_lsp", - -- 左侧让出 nvim-tree 的位置 - offsets = {{ - filetype = "NvimTree", - text = "File Explorer", - highlight = "Directory", - text_align = "left" - }} - } + options = { + -- 使用 nvim 内置lsp + diagnostics = "nvim_lsp", + diagnostics_indicator = function(count, level, diagnostics_dict, context) + local s = " " + for e, n in pairs(diagnostics_dict) do + local sym = e == "error" and " " + or (e == "warning" and " " or "" ) + s = s .. n .. sym + end + return s + end, + -- 左侧让出 nvim-tree 的位置 + offsets = {{ + filetype = "NvimTree", + text = function() + return vim.fn.fnamemodify(vim.fn.getcwd(), ':p:h:t') + end, + highlight = "Directory", + text_align = "left" + }} + } } From 279fba6a01ad159e6f6050164f12417c191a3aa6 Mon Sep 17 00:00:00 2001 From: kaiv2 Date: Fri, 11 Feb 2022 22:30:47 +0800 Subject: [PATCH 0054/1278] config --- config/local_tasks.ini | 25 ++++++++++++++ config/task_template.ini | 55 +++++++++++++++++++++++++++++++ lua/plugins/config/asynctasks.lua | 10 ++++-- 3 files changed, 87 insertions(+), 3 deletions(-) create mode 100644 config/local_tasks.ini create mode 100644 config/task_template.ini diff --git a/config/local_tasks.ini b/config/local_tasks.ini new file mode 100644 index 00000000..6f45877f --- /dev/null +++ b/config/local_tasks.ini @@ -0,0 +1,25 @@ +[file-run] +command="$(VIM_FILEPATH)" +command:c,cpp="$(VIM_PATHNOEXT)" +command:go="$(VIM_PATHNOEXT)" +command:python=python "$(VIM_FILENAME)" +command:make=make -f "$(VIM_FILENAME)" run +command:emake=emake -e "$(VIM_FILENAME)" +command:javascript=node "$(VIM_FILENAME)" +command:sh=sh "$(VIM_FILENAME)" +command:lua=lua "$(VIM_FILENAME)" +command:perl=perl "$(VIM_FILENAME)" +command:ruby=ruby "$(VIM_FILENAME)" +command:zsh=zsh "$(VIM_FILENAME)" +command:bash=bash "$(VIM_FILENAME)" +command:fish=fish "$(VIM_FILENAME)" +command:php=php "$(VIM_FILENAME)" +command:erlang=escript "$(VIM_FILENAME)" +command:ps1=powershell -file "$(VIM_FILENAME)" +command:scala=scala "$(VIM_FILENAME)" +command:haskell=ghci "$(VIM_FILENAME)" +command:applescript=osascript "$(VIM_FILENAME)" +command:vim=:source % +output=terminal +cwd=$(VIM_FILEDIR) +save=2 diff --git a/config/task_template.ini b/config/task_template.ini new file mode 100644 index 00000000..d9d8c6c5 --- /dev/null +++ b/config/task_template.ini @@ -0,0 +1,55 @@ +{maven} + +[mvn-compile] +command=mvn clean compile test-compile +cwd=$(VIM_ROOT) +output=terminal +errorformat=%f:%l:%m +save=1 + +[mvn-package-skip-test] +command=mvn clean package -Dmaven.test.skip=true -U +cwd=$(VIM_ROOT) +output=terminal +errorformat=%f:%l:%m +save=1 + +[mvn-install-skip-test] +command=mvn clean install -Dmaven.test.skip=true -U +cwd=$(VIM_ROOT) +output=terminal +errorformat=%f:%l:%m +save=1 + +[mvn-test] +command=mvn test +cwd=$(VIM_ROOT) +output=terminal +errorformat=%f:%l:%m +save=1 + +[mvn-test-class] +command=mvn -Dtest=$(VIM_FILENOEXT) test +cwd=$(VIM_ROOT) +output=terminal +errorformat=%f:%l:%m +save=1 + + +[mvn-test-method] +command=mvn -Dtest=$(VIM_FILENOEXT)#$(VIM_CWORD) test +cwd=$(VIM_ROOT) +output=terminal +errorformat=%f:%l:%m +save=1 + + +{plantuml} + +[plantuml-to-svg] +command=java -jar /opt/emacs-pkg/plantuml/plantuml-1.2021.14.jar -svg $(VIM_RELNAME);open $(VIM_FILENOEXT).svg +cwd=$(VIM_ROOT) +output=terminal +errorformat=%f:%l:%m + + diff --git a/lua/plugins/config/asynctasks.lua b/lua/plugins/config/asynctasks.lua index f850bad6..618ba9ed 100644 --- a/lua/plugins/config/asynctasks.lua +++ b/lua/plugins/config/asynctasks.lua @@ -4,7 +4,7 @@ vim.g.asynctasks_term_pos = 'floaterm' -- 此配置无效(无效变量) vim.g.asyncrun_term_pos = 'floaterm' -local result = vim.api.nvim_exec( +vim.cmd( [[ function! s:lf_task_source(...) let rows = asynctasks#source(&columns * 48 / 100) @@ -55,6 +55,10 @@ let g:Lf_Extensions.task = { \ }, \ 'help' : 'navigate available tasks from asynctasks.vim', \ } -]], -true) +let g:asynctasks_extra_config = [ + \ '~/.config/nvim/config/local_tasks.ini', + \ ] +]]) +-- 未实现 +vim.g.asynctask_template = '~/.config/nvim/template/task_template.ini' From a2ddb6484641b3f373136acdf200ee02a71c1563 Mon Sep 17 00:00:00 2001 From: kaiv2 Date: Fri, 11 Feb 2022 22:33:45 +0800 Subject: [PATCH 0055/1278] path --- lua/plugins/config/asynctasks.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lua/plugins/config/asynctasks.lua b/lua/plugins/config/asynctasks.lua index 618ba9ed..6654d9dd 100644 --- a/lua/plugins/config/asynctasks.lua +++ b/lua/plugins/config/asynctasks.lua @@ -60,5 +60,5 @@ let g:asynctasks_extra_config = [ \ ] ]]) -- 未实现 -vim.g.asynctask_template = '~/.config/nvim/template/task_template.ini' +vim.g.asynctask_template = '~/.config/nvim/config/task_template.ini' From b58109edff2ee5451832a1acc66093925b32cf3a Mon Sep 17 00:00:00 2001 From: kaiv2 Date: Sat, 12 Feb 2022 20:35:33 +0800 Subject: [PATCH 0056/1278] title --- lua/basic.lua | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lua/basic.lua b/lua/basic.lua index f9e83c75..43072464 100644 --- a/lua/basic.lua +++ b/lua/basic.lua @@ -1,3 +1,5 @@ +vim.opt.title = true + -- 行号 vim.wo.number = true vim.wo.relativenumber = true From 56f4356366035de8e9221e23bfda51c9d6ba51cb Mon Sep 17 00:00:00 2001 From: kaiv2 Date: Sat, 12 Feb 2022 21:06:59 +0800 Subject: [PATCH 0057/1278] config --- lua/plugins/config/nvim-tree.lua | 4 ++-- lua/plugins/config/telescope.lua | 2 ++ 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/lua/plugins/config/nvim-tree.lua b/lua/plugins/config/nvim-tree.lua index 1f5ffd85..9b982b84 100644 --- a/lua/plugins/config/nvim-tree.lua +++ b/lua/plugins/config/nvim-tree.lua @@ -40,8 +40,8 @@ require'nvim-tree'.setup { custom = {".git"} }, git = { - enable = true, - ignore = true, + enable = false, + ignore = false, timeout = 500, }, view = { diff --git a/lua/plugins/config/telescope.lua b/lua/plugins/config/telescope.lua index 5e5de1f9..bbbdee63 100644 --- a/lua/plugins/config/telescope.lua +++ b/lua/plugins/config/telescope.lua @@ -27,6 +27,8 @@ require('telescope').setup{ -- Now the picker_config_key will be applied every time you call this -- builtin picker }, + file_ignore_patterns = { "node_modules" }, + path_display = { "truncate" }, extensions = { -- Your extension configuration goes here: -- extension_name = { From 6fbfbd485f8c352e7a1c28570ecbc100e96a7bb6 Mon Sep 17 00:00:00 2001 From: kaiv2 Date: Sat, 12 Feb 2022 21:09:51 +0800 Subject: [PATCH 0058/1278] config --- lua/plugins/config/nvim-tree.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lua/plugins/config/nvim-tree.lua b/lua/plugins/config/nvim-tree.lua index 9b982b84..bf6e331e 100644 --- a/lua/plugins/config/nvim-tree.lua +++ b/lua/plugins/config/nvim-tree.lua @@ -18,7 +18,7 @@ require'nvim-tree'.setup { auto_open = false, }, diagnostics = { - enable = true, + enable = false, icons = { hint = "", info = "", From 2762199d632580124dd387b5fccfc3d287b6a9e8 Mon Sep 17 00:00:00 2001 From: kaiv2 Date: Sat, 12 Feb 2022 21:11:53 +0800 Subject: [PATCH 0059/1278] update --- lua/plugins/config/nvim-tree.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lua/plugins/config/nvim-tree.lua b/lua/plugins/config/nvim-tree.lua index bf6e331e..0f865352 100644 --- a/lua/plugins/config/nvim-tree.lua +++ b/lua/plugins/config/nvim-tree.lua @@ -2,7 +2,7 @@ require'nvim-tree'.setup { disable_netrw = true, hijack_netrw = true, open_on_setup = false, - ignore_ft_on_setup = {}, + ignore_ft_on_setup = { "dashboard" }, auto_close = true, auto_reload_on_write = true, open_on_tab = false, From 392b4d052cec64a0eb1c5c277ef2ba5ea49914af Mon Sep 17 00:00:00 2001 From: kaiv2 Date: Sat, 12 Feb 2022 22:19:00 +0800 Subject: [PATCH 0060/1278] config --- lua/plugins/config/dashboard-nvim.lua | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/lua/plugins/config/dashboard-nvim.lua b/lua/plugins/config/dashboard-nvim.lua index 4222b051..ce309a94 100644 --- a/lua/plugins/config/dashboard-nvim.lua +++ b/lua/plugins/config/dashboard-nvim.lua @@ -1,3 +1,7 @@ -vim.cmd([[ -let g:dashboard_default_executive ='telescope' -]]) +local g = vim.g + +g.dashboard_disable_at_vimenter = 0 +g.dashboard_disable_statusline = 1 +g.dashboard_default_executive = "telescope" +-- g.dashboard_custom_header = { +-- } From d741dffe7e2696fd95d9742ea22719db90b055b0 Mon Sep 17 00:00:00 2001 From: kaiv2 Date: Sat, 12 Feb 2022 22:28:15 +0800 Subject: [PATCH 0061/1278] config --- lua/plugins/config/dashboard-nvim.lua | 4 ++-- lua/plugins/config/indent-blankline.lua | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/lua/plugins/config/dashboard-nvim.lua b/lua/plugins/config/dashboard-nvim.lua index ce309a94..58d72e9a 100644 --- a/lua/plugins/config/dashboard-nvim.lua +++ b/lua/plugins/config/dashboard-nvim.lua @@ -1,7 +1,7 @@ local g = vim.g -g.dashboard_disable_at_vimenter = 0 -g.dashboard_disable_statusline = 1 +-- g.dashboard_disable_at_vimenter = 0 +-- g.dashboard_disable_statusline = 1 g.dashboard_default_executive = "telescope" -- g.dashboard_custom_header = { -- } diff --git a/lua/plugins/config/indent-blankline.lua b/lua/plugins/config/indent-blankline.lua index dbc7620f..6d329c36 100644 --- a/lua/plugins/config/indent-blankline.lua +++ b/lua/plugins/config/indent-blankline.lua @@ -9,7 +9,7 @@ require("indent_blankline").setup { -- show_current_context_start = true, disable_with_nolist = true, -- filetype_exclude = { "help", "terminal", "packer", "NvimTree", "git", "text" }, - filetype_exclude = { "help", "terminal", "packer", "markdown", "git", "text" }, + filetype_exclude = { "help", "terminal", "packer", "markdown", "git", "text", "NvimTree", "dashboard" }, buftype_exclude = { "terminal" }, use_treesitter = true, context_patterns = { From 499f06b0b501cd0243bd8a9932ed9dc3fb8f5486 Mon Sep 17 00:00:00 2001 From: kaiv2 Date: Sat, 12 Feb 2022 22:34:22 +0800 Subject: [PATCH 0062/1278] config --- lua/plugins/config/nvim-treesitter.lua | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lua/plugins/config/nvim-treesitter.lua b/lua/plugins/config/nvim-treesitter.lua index 614ee9b4..e61e757c 100644 --- a/lua/plugins/config/nvim-treesitter.lua +++ b/lua/plugins/config/nvim-treesitter.lua @@ -6,14 +6,14 @@ require'nvim-treesitter.configs'.setup { sync_install = false, -- List of parsers to ignore installing - ignore_install = { "javascript" }, + ignore_install = { }, highlight = { -- `false` will disable the whole extension enable = true, -- list of language that will be disabled - disable = { "c", "rust" }, + disable = { }, -- Setting this to true will run `:h syntax` and tree-sitter at the same time. -- Set this to `true` if you depend on 'syntax' being enabled (like for indentation). @@ -23,7 +23,7 @@ require'nvim-treesitter.configs'.setup { }, matchup = { enable = true, - disable = { "c", "rust" }, + disable = { }, }, textobjects = { move = { From 9110861f76e61a89f2cae0e9d03514a6f6be4858 Mon Sep 17 00:00:00 2001 From: kaiv2 Date: Sat, 12 Feb 2022 22:51:28 +0800 Subject: [PATCH 0063/1278] config --- lua/plugins/config/nvim-tree.lua | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/lua/plugins/config/nvim-tree.lua b/lua/plugins/config/nvim-tree.lua index 0f865352..0958131a 100644 --- a/lua/plugins/config/nvim-tree.lua +++ b/lua/plugins/config/nvim-tree.lua @@ -65,3 +65,20 @@ require'nvim-tree'.setup { } +local g = vim.g + + +g.nvim_tree_indent_markers = 1 + +g.nvim_tree_window_picker_exclude = { + filetype = { "notify", "packer", "qf" }, + buftype = { "terminal" }, +} + +g.nvim_tree_show_icons = { + folders = 1, + files = 1, + git = 1, +} + + From 6bda0f81d92ade07f48166ebb218c51cc6fb6ded Mon Sep 17 00:00:00 2001 From: kaiv2 Date: Sat, 12 Feb 2022 22:58:00 +0800 Subject: [PATCH 0064/1278] config --- lua/plugins/config/gitsigns-nvim.lua | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/lua/plugins/config/gitsigns-nvim.lua b/lua/plugins/config/gitsigns-nvim.lua index 6f6b8762..1baf7e18 100644 --- a/lua/plugins/config/gitsigns-nvim.lua +++ b/lua/plugins/config/gitsigns-nvim.lua @@ -1,11 +1,11 @@ require('gitsigns').setup { signs = { - add = {hl = 'GitSignsAdd' , text = '█', numhl='GitSignsAddNr' , linehl='GitSignsAddLn'}, - change = {hl = 'GitSignsChange', text = '▓', numhl='GitSignsChangeNr', linehl='GitSignsChangeLn'}, - delete = {hl = 'GitSignsDelete', text = '▄', numhl='GitSignsDeleteNr', linehl='GitSignsDeleteLn'}, - topdelete = {hl = 'GitSignsDelete', text = '▀', numhl='GitSignsDeleteNr', linehl='GitSignsDeleteLn'}, - changedelete = {hl = 'GitSignsChange', text = '~', numhl='GitSignsChangeNr', linehl='GitSignsChangeLn'}, + add = { hl = "DiffAdd", text = "│", numhl = "GitSignsAddNr" }, + change = { hl = "DiffChange", text = "│", numhl = "GitSignsChangeNr" }, + delete = { hl = "DiffDelete", text = "", numhl = "GitSignsDeleteNr" }, + topdelete = { hl = "DiffDelete", text = "‾", numhl = "GitSignsDeleteNr" }, + changedelete = { hl = "DiffChangeDelete", text = "~", numhl = "GitSignsChangeNr" }, }, signcolumn = true, -- Toggle with `:Gitsigns toggle_signs` numhl = false, -- Toggle with `:Gitsigns toggle_numhl` From 2913d6e9f8c0330a06de4b2efee9a898587eb641 Mon Sep 17 00:00:00 2001 From: kaiv2 Date: Sat, 12 Feb 2022 23:28:16 +0800 Subject: [PATCH 0065/1278] config --- lua/lsp/init.lua | 40 +++++++++++++++++++++++++++ lua/plugins/config/nvim-autopairs.lua | 7 ++++- lua/plugins/config/nvim-colorizer.lua | 25 ++++++++++++++++- lua/plugins/config/nvim-tree.lua | 4 +-- 4 files changed, 72 insertions(+), 4 deletions(-) diff --git a/lua/lsp/init.lua b/lua/lsp/init.lua index a6473642..a1e318b5 100644 --- a/lua/lsp/init.lua +++ b/lua/lsp/init.lua @@ -43,3 +43,43 @@ lsp_installer.on_server_ready(function(server) server:setup(opts) end end) + +-- LSP 相关美化参考 https://github.com/NvChad/NvChad +local function lspSymbol(name, icon) + local hl = "DiagnosticSign" .. name + vim.fn.sign_define(hl, { text = icon, numhl = hl, texthl = hl }) +end + +lspSymbol("Error", "") +lspSymbol("Info", "") +lspSymbol("Hint", "") +lspSymbol("Warn", "") + +vim.diagnostic.config { + virtual_text = { + prefix = "", + }, + signs = true, + underline = true, + update_in_insert = false, +} + +vim.lsp.handlers["textDocument/hover"] = vim.lsp.with(vim.lsp.handlers.hover, { + border = "single", +}) +vim.lsp.handlers["textDocument/signatureHelp"] = vim.lsp.with(vim.lsp.handlers.signature_help, { + border = "single", +}) + +-- suppress error messages from lang servers +vim.notify = function(msg, log_level) + if msg:match "exit code" then + return + end + if log_level == vim.log.levels.ERROR then + vim.api.nvim_err_writeln(msg) + else + vim.api.nvim_echo({ { msg } }, true, {}) + end +end + diff --git a/lua/plugins/config/nvim-autopairs.lua b/lua/plugins/config/nvim-autopairs.lua index 5b9c03cc..5fd913a5 100644 --- a/lua/plugins/config/nvim-autopairs.lua +++ b/lua/plugins/config/nvim-autopairs.lua @@ -1 +1,6 @@ -require('nvim-autopairs').setup{} +local autopairs = require ("nvim-autopairs") +local cmp_autopairs = require ("nvim-autopairs.completion.cmp") +autopairs.setup({}) +local cmp = require ("cmp") +cmp.event:on("confirm_done", cmp_autopairs.on_confirm_done()) + diff --git a/lua/plugins/config/nvim-colorizer.lua b/lua/plugins/config/nvim-colorizer.lua index ebb8f3bf..046edf63 100644 --- a/lua/plugins/config/nvim-colorizer.lua +++ b/lua/plugins/config/nvim-colorizer.lua @@ -1 +1,24 @@ - require'colorizer'.setup() + +local present, colorizer = pcall(require, "colorizer") +if present then + local default = { + filetypes = { + "*", + }, + user_default_options = { + RGB = true, -- #RGB hex codes + RRGGBB = true, -- #RRGGBB hex codes + names = false, -- "Name" codes like Blue + RRGGBBAA = false, -- #RRGGBBAA hex codes + rgb_fn = false, -- CSS rgb() and rgba() functions + hsl_fn = false, -- CSS hsl() and hsla() functions + css = false, -- Enable all CSS features: rgb_fn, hsl_fn, names, RGB, RRGGBB + css_fn = false, -- Enable all CSS *functions*: rgb_fn, hsl_fn + + -- Available modes: foreground, background + mode = "background", -- Set the display mode. + }, + } + colorizer.setup(default["filetypes"], default["user_default_options"]) +end + diff --git a/lua/plugins/config/nvim-tree.lua b/lua/plugins/config/nvim-tree.lua index 0958131a..39dd3825 100644 --- a/lua/plugins/config/nvim-tree.lua +++ b/lua/plugins/config/nvim-tree.lua @@ -40,8 +40,8 @@ require'nvim-tree'.setup { custom = {".git"} }, git = { - enable = false, - ignore = false, + enable = true, + ignore = true, timeout = 500, }, view = { From 1bc494c201ac4f1001edbde7fe8ebf20d4d01030 Mon Sep 17 00:00:00 2001 From: kaiv2 Date: Sat, 12 Feb 2022 23:43:10 +0800 Subject: [PATCH 0066/1278] remove plugin --- lua/plugins/init.lua | 4 ++-- plugin/packer_compiled.lua | 6 +----- 2 files changed, 3 insertions(+), 7 deletions(-) diff --git a/lua/plugins/init.lua b/lua/plugins/init.lua index c6c589cd..16a18c54 100644 --- a/lua/plugins/init.lua +++ b/lua/plugins/init.lua @@ -20,7 +20,7 @@ require('packer').startup(function() use 'onsails/lspkind-nvim' -- lsp 相关 - use 'folke/lsp-colors.nvim' + -- use 'folke/lsp-colors.nvim' use 'folke/trouble.nvim' -- use 'glepnir/lspsaga.nvim' @@ -170,7 +170,7 @@ require('plugins/config/asynctasks') require('plugins/config/lualine') require('plugins/config/indent-blankline') require('plugins/config/vista') -require('plugins/config/lsp-colors') +-- require('plugins/config/lsp-colors') require('plugins/config/trouble') require('plugins/config/nvim-notify') require('plugins/config/wilder') diff --git a/plugin/packer_compiled.lua b/plugin/packer_compiled.lua index efa84742..edd06850 100644 --- a/plugin/packer_compiled.lua +++ b/plugin/packer_compiled.lua @@ -154,11 +154,6 @@ _G.packer_plugins = { path = "/Users/kailuo/.local/share/nvim/site/pack/packer/start/indent-blankline.nvim", url = "https://github.com/lukas-reineke/indent-blankline.nvim" }, - ["lsp-colors.nvim"] = { - loaded = true, - path = "/Users/kailuo/.local/share/nvim/site/pack/packer/start/lsp-colors.nvim", - url = "https://github.com/folke/lsp-colors.nvim" - }, ["lspkind-nvim"] = { loaded = true, path = "/Users/kailuo/.local/share/nvim/site/pack/packer/start/lspkind-nvim", @@ -342,5 +337,6 @@ if should_profile then save_profiles() end end) if not no_errors then + error_msg = error_msg:gsub('"', '\\"') vim.api.nvim_command('echohl ErrorMsg | echom "Error in packer_compiled: '..error_msg..'" | echom "Please check your config for correctness" | echohl None') end From 1d8fadfd0bb2e922389fe62d7627e929667c1dde Mon Sep 17 00:00:00 2001 From: kaiv2 Date: Sun, 13 Feb 2022 11:01:39 +0800 Subject: [PATCH 0067/1278] icon --- lua/plugins/config/nvim-tree.lua | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/lua/plugins/config/nvim-tree.lua b/lua/plugins/config/nvim-tree.lua index 39dd3825..494bb0db 100644 --- a/lua/plugins/config/nvim-tree.lua +++ b/lua/plugins/config/nvim-tree.lua @@ -20,10 +20,10 @@ require'nvim-tree'.setup { diagnostics = { enable = false, icons = { - hint = "", - info = "", - warning = "", - error = "", + hint = "", + info = "", + warning = "", + error = "", } }, update_focused_file = { From 4d045313ea9526432a67736b5be6c9b80f4b3033 Mon Sep 17 00:00:00 2001 From: kaiv2 Date: Sun, 13 Feb 2022 11:06:20 +0800 Subject: [PATCH 0068/1278] config --- lua/plugins/config/nvim-tree.lua | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lua/plugins/config/nvim-tree.lua b/lua/plugins/config/nvim-tree.lua index 494bb0db..52da8c59 100644 --- a/lua/plugins/config/nvim-tree.lua +++ b/lua/plugins/config/nvim-tree.lua @@ -70,6 +70,8 @@ local g = vim.g g.nvim_tree_indent_markers = 1 +g.nvim_tree_special_files = {} + g.nvim_tree_window_picker_exclude = { filetype = { "notify", "packer", "qf" }, buftype = { "terminal" }, From dcde07a891e0ab2e1eb7696fd01bb48e94578c88 Mon Sep 17 00:00:00 2001 From: kaiv2 Date: Sun, 13 Feb 2022 12:50:18 +0800 Subject: [PATCH 0069/1278] update config --- lua/keybindings.lua | 1 + lua/plugins/config/nvim-lsputils.lua | 35 ++++++++++++++++++++++++++++ lua/plugins/init.lua | 6 ++--- plugin/packer_compiled.lua | 10 ++++++++ 4 files changed, 49 insertions(+), 3 deletions(-) diff --git a/lua/keybindings.lua b/lua/keybindings.lua index a7d7914a..96b98685 100644 --- a/lua/keybindings.lua +++ b/lua/keybindings.lua @@ -96,6 +96,7 @@ pluginKeys.maplsp = function(mapbuf) mapbuf('n', 'gD', 'lua vim.lsp.buf.declaration()', opt) mapbuf('n', 'gi', 'lua vim.lsp.buf.implementation()', opt) mapbuf('n', 'gr', 'lua vim.lsp.buf.references()', opt) + mapbuf('n', 's', 'lua vim.lsp.buf.workspace_symbol()', opt) -- diagnostic mapbuf('n', 'go', 'lua vim.diagnostic.open_float()', opt) mapbuf('n', '[g', 'lua vim.diagnostic.goto_prev()', opt) diff --git a/lua/plugins/config/nvim-lsputils.lua b/lua/plugins/config/nvim-lsputils.lua index aa583c8d..a0635b93 100644 --- a/lua/plugins/config/nvim-lsputils.lua +++ b/lua/plugins/config/nvim-lsputils.lua @@ -42,3 +42,38 @@ else require('lsputil.symbols').workspace_handler(nil, result, { bufnr = bufn }, nil) end end + + +local border_chars = { + TOP_LEFT = '┌', + TOP_RIGHT = '┐', + MID_HORIZONTAL = '─', + MID_VERTICAL = '│', + BOTTOM_LEFT = '└', + BOTTOM_RIGHT = '┘', +} +vim.g.lsp_utils_location_opts = { + height = 24, + mode = 'editor', + preview = { + title = 'Location Preview', + border = true, + border_chars = border_chars + }, + keymaps = { + n = { + [''] = 'j', + [''] = 'k', + } + } +} +vim.g.lsp_utils_symbols_opts = { + height = 24, + mode = 'editor', + preview = { + title = 'Symbols Preview', + border = true, + border_chars = border_chars + }, + prompt = {}, +} diff --git a/lua/plugins/init.lua b/lua/plugins/init.lua index 16a18c54..2ef7fc44 100644 --- a/lua/plugins/init.lua +++ b/lua/plugins/init.lua @@ -26,8 +26,8 @@ require('packer').startup(function() -- use 'ray-x/lsp_signature.nvim' - -- use 'RishabhRD/popfix' - -- use 'RishabhRD/nvim-lsputils' + use 'RishabhRD/popfix' + use 'RishabhRD/nvim-lsputils' -- 主题 use 'morhetz/gruvbox' @@ -180,7 +180,7 @@ require('plugins/config/comment') -- require('plugins/config/formatter') require('plugins/config/telescope') require('plugins/config/dashboard-nvim') --- require('plugins/config/nvim-lsputils') +require('plugins/config/nvim-lsputils') require('plugins/config/nvim-autopairs') -- require('plugins/config/lsp_signature') require('plugins/config/nvim-dap') diff --git a/plugin/packer_compiled.lua b/plugin/packer_compiled.lua index edd06850..7c246869 100644 --- a/plugin/packer_compiled.lua +++ b/plugin/packer_compiled.lua @@ -214,6 +214,11 @@ _G.packer_plugins = { path = "/Users/kailuo/.local/share/nvim/site/pack/packer/start/nvim-lspconfig", url = "https://github.com/neovim/nvim-lspconfig" }, + ["nvim-lsputils"] = { + loaded = true, + path = "/Users/kailuo/.local/share/nvim/site/pack/packer/start/nvim-lsputils", + url = "https://github.com/RishabhRD/nvim-lsputils" + }, ["nvim-notify"] = { loaded = true, path = "/Users/kailuo/.local/share/nvim/site/pack/packer/start/nvim-notify", @@ -249,6 +254,11 @@ _G.packer_plugins = { path = "/Users/kailuo/.local/share/nvim/site/pack/packer/start/plenary.nvim", url = "https://github.com/nvim-lua/plenary.nvim" }, + popfix = { + loaded = true, + path = "/Users/kailuo/.local/share/nvim/site/pack/packer/start/popfix", + url = "https://github.com/RishabhRD/popfix" + }, ["rust-tools.nvim"] = { loaded = true, path = "/Users/kailuo/.local/share/nvim/site/pack/packer/start/rust-tools.nvim", From 8598daff815a78938cc6c3b5e06d1b7291e2012d Mon Sep 17 00:00:00 2001 From: kaiv2 Date: Tue, 15 Feb 2022 11:31:57 +0800 Subject: [PATCH 0070/1278] tsserver --- lua/lsp/init.lua | 1 + 1 file changed, 1 insertion(+) diff --git a/lua/lsp/init.lua b/lua/lsp/init.lua index a1e318b5..f2e81a51 100644 --- a/lua/lsp/init.lua +++ b/lua/lsp/init.lua @@ -8,6 +8,7 @@ local servers = { -- jdtls = require "lsp.java", -- /lua/lsp/jdtls.lua jsonls = {}, clangd = require 'lsp.c', + tsserver = {}, -- rust_analyzer = require 'lsp.rust', } From 768caa4f6ee758e881d03fd5fd113a01e090a041 Mon Sep 17 00:00:00 2001 From: kaiv2 Date: Sat, 19 Feb 2022 23:31:32 +0800 Subject: [PATCH 0071/1278] update --- lua/keybindings.lua | 61 +++++++++++++++++++++++++-------- lua/plugins/config/luasnip.lua | 18 ++++++++++ lua/plugins/config/nvim-cmp.lua | 19 +++++----- lua/plugins/init.lua | 13 +++++-- plugin/packer_compiled.lua | 21 +++++------- 5 files changed, 93 insertions(+), 39 deletions(-) create mode 100644 lua/plugins/config/luasnip.lua diff --git a/lua/keybindings.lua b/lua/keybindings.lua index 96b98685..ed8c02cd 100644 --- a/lua/keybindings.lua +++ b/lua/keybindings.lua @@ -113,20 +113,53 @@ end -- nvim-cmp 自动补全 pluginKeys.cmp = function(cmp) - return { - -- 上一个 - -- [''] = cmp.mapping.select_prev_item(), - -- 下一个 - [''] = cmp.mapping.select_next_item(), - [""] = cmp.mapping.select_prev_item(), - -- [''] = cmp.mapping.close(), - -- 确认 - -- Accept currently selected item. If none selected, `select` first item. - -- Set `select` to `false` to only confirm explicitly selected items. - [''] = cmp.mapping.confirm({ - select = true , - }), - } + +local luasnip = require('luasnip'); +local has_words_before = function() + local line, col = unpack(vim.api.nvim_win_get_cursor(0)) + return col ~= 0 and vim.api.nvim_buf_get_lines(0, line - 1, line, true)[1]:sub(col, col):match("%s") == nil +end +return { + -- 上一个 + -- [''] = cmp.mapping.select_prev_item(), + -- 下一个 + -- [''] = cmp.mapping.select_next_item(), + -- [""] = cmp.mapping.select_prev_item(), + -- [''] = cmp.mapping.close(), + -- 确认 + -- Accept currently selected item. If none selected, `select` first item. + -- Set `select` to `false` to only confirm explicitly selected items. + -- [""] = cmp.mapping.scroll_docs(-4), + -- [""] = cmp.mapping.scroll_docs(4), + [""] = cmp.mapping.complete(), + [""] = cmp.mapping.close(), + [""] = cmp.mapping.confirm { + behavior = cmp.ConfirmBehavior.Replace, + select = true, + }, + + [""] = cmp.mapping(function(fallback) + if cmp.visible() then + cmp.select_next_item() + elseif luasnip.expand_or_jumpable() then + luasnip.expand_or_jump() + elseif has_words_before() then + cmp.complete() + else + fallback() + end + end, { "i", "s" }), + + [""] = cmp.mapping(function(fallback) + if cmp.visible() then + cmp.select_prev_item() + elseif luasnip.jumpable(-1) then + luasnip.jump(-1) + else + fallback() + end + end, { "i", "s" }), +} end return pluginKeys diff --git a/lua/plugins/config/luasnip.lua b/lua/plugins/config/luasnip.lua new file mode 100644 index 00000000..e59efc17 --- /dev/null +++ b/lua/plugins/config/luasnip.lua @@ -0,0 +1,18 @@ +local ls = require("luasnip") +local types = require("luasnip.util.types") + +ls.config.setup({ + ext_opts = { + [types.choiceNode] = { + active = { + virt_text = {{"●", "GruvboxOrange"}} + } + }, + [types.insertNode] = { + active = { + virt_text = {{"●", "GruvboxBlue"}} + } + } + }, +}) +require("luasnip.loaders.from_vscode").load() diff --git a/lua/plugins/config/nvim-cmp.lua b/lua/plugins/config/nvim-cmp.lua index dec69cab..c166e7b9 100644 --- a/lua/plugins/config/nvim-cmp.lua +++ b/lua/plugins/config/nvim-cmp.lua @@ -6,10 +6,10 @@ cmp.setup { snippet = { expand = function(args) -- For `vsnip` users. - vim.fn["vsnip#anonymous"](args.body) + -- vim.fn["vsnip#anonymous"](args.body) -- For `luasnip` users. - -- require('luasnip').lsp_expand(args.body) + require('luasnip').lsp_expand(args.body) -- For `ultisnips` users. -- vim.fn["UltiSnips#Anon"](args.body) @@ -22,16 +22,17 @@ cmp.setup { sources = cmp.config.sources({ { name = 'nvim_lsp' }, -- For vsnip users. - { name = 'vsnip' }, + -- { name = 'vsnip' }, -- For luasnip users. - -- { name = 'luasnip' }, + { name = 'luasnip' }, --For ultisnips users. -- { name = 'ultisnips' }, -- -- For snippy users. -- { name = 'snippy' }, - }, { { name = 'buffer' }, - { name = 'path' } - }), + }, { + { name = 'buffer' }, + { name = 'path' } + }), -- 快捷键 mapping = require'keybindings'.cmp(cmp), @@ -47,9 +48,9 @@ cmp.setup { end, menu = { nvim_lsp = "[LSP]", - vsnip = "[Vsnip]", + luasnip = "[Lsnip]", path = "[Path]", - -- buffer = "[Buffer]", + -- buffer = "[Buffer]", }, }) }, diff --git a/lua/plugins/init.lua b/lua/plugins/init.lua index 2ef7fc44..22fa6bef 100644 --- a/lua/plugins/init.lua +++ b/lua/plugins/init.lua @@ -9,13 +9,18 @@ require('packer').startup(function() use 'hrsh7th/cmp-nvim-lsp' -- { name = nvim_lsp } use 'hrsh7th/cmp-buffer' -- { name = 'buffer' }, use 'hrsh7th/cmp-path' -- { name = 'path' } - use 'hrsh7th/cmp-cmdline' -- { name = 'cmdline' } + -- use 'hrsh7th/cmp-cmdline' -- { name = 'cmdline' } use 'hrsh7th/nvim-cmp' -- vsnip - use 'hrsh7th/cmp-vsnip' -- { name = 'vsnip' } - use 'hrsh7th/vim-vsnip' + -- use 'hrsh7th/cmp-vsnip' -- { name = 'vsnip' } + -- use 'hrsh7th/vim-vsnip' + use 'rafamadriz/friendly-snippets' + -- LuaSnip + use 'L3MON4D3/LuaSnip' + use { 'saadparwaiz1/cmp_luasnip' } + -- lspkind use 'onsails/lspkind-nvim' @@ -161,6 +166,8 @@ end) require('plugins/config/bufferline') require('plugins/config/nvim-tree') require('plugins/config/nvim-treesitter') + +require('plugins/config/luasnip') require('plugins/config/nvim-cmp') require('plugins/config/LeaderF') require('plugins/config/gitsigns-nvim') diff --git a/plugin/packer_compiled.lua b/plugin/packer_compiled.lua index 7c246869..15479c14 100644 --- a/plugin/packer_compiled.lua +++ b/plugin/packer_compiled.lua @@ -84,6 +84,11 @@ _G.packer_plugins = { path = "/Users/kailuo/.local/share/nvim/site/pack/packer/start/LeaderF-floaterm", url = "https://github.com/voldikss/LeaderF-floaterm" }, + LuaSnip = { + loaded = true, + path = "/Users/kailuo/.local/share/nvim/site/pack/packer/start/LuaSnip", + url = "https://github.com/L3MON4D3/LuaSnip" + }, ["asyncrun.vim"] = { loaded = true, path = "/Users/kailuo/.local/share/nvim/site/pack/packer/start/asyncrun.vim", @@ -109,11 +114,6 @@ _G.packer_plugins = { path = "/Users/kailuo/.local/share/nvim/site/pack/packer/start/cmp-buffer", url = "https://github.com/hrsh7th/cmp-buffer" }, - ["cmp-cmdline"] = { - loaded = true, - path = "/Users/kailuo/.local/share/nvim/site/pack/packer/start/cmp-cmdline", - url = "https://github.com/hrsh7th/cmp-cmdline" - }, ["cmp-nvim-lsp"] = { loaded = true, path = "/Users/kailuo/.local/share/nvim/site/pack/packer/start/cmp-nvim-lsp", @@ -124,10 +124,10 @@ _G.packer_plugins = { path = "/Users/kailuo/.local/share/nvim/site/pack/packer/start/cmp-path", url = "https://github.com/hrsh7th/cmp-path" }, - ["cmp-vsnip"] = { + cmp_luasnip = { loaded = true, - path = "/Users/kailuo/.local/share/nvim/site/pack/packer/start/cmp-vsnip", - url = "https://github.com/hrsh7th/cmp-vsnip" + path = "/Users/kailuo/.local/share/nvim/site/pack/packer/start/cmp_luasnip", + url = "https://github.com/saadparwaiz1/cmp_luasnip" }, ["dashboard-nvim"] = { loaded = true, @@ -314,11 +314,6 @@ _G.packer_plugins = { path = "/Users/kailuo/.local/share/nvim/site/pack/packer/start/vim-visual-multi", url = "https://github.com/mg979/vim-visual-multi" }, - ["vim-vsnip"] = { - loaded = true, - path = "/Users/kailuo/.local/share/nvim/site/pack/packer/start/vim-vsnip", - url = "https://github.com/hrsh7th/vim-vsnip" - }, ["vista.vim"] = { loaded = true, path = "/Users/kailuo/.local/share/nvim/site/pack/packer/start/vista.vim", From 2868097d71faa407f9452974fa7855d7a2ea8360 Mon Sep 17 00:00:00 2001 From: kaiv2 Date: Sat, 19 Feb 2022 23:57:35 +0800 Subject: [PATCH 0072/1278] luasnip --- lua/basic.lua | 1 + lua/plugins/config/luasnip.lua | 517 ++++++++++++++++++++++++++++++++- 2 files changed, 516 insertions(+), 2 deletions(-) diff --git a/lua/basic.lua b/lua/basic.lua index 43072464..e04b4eea 100644 --- a/lua/basic.lua +++ b/lua/basic.lua @@ -35,6 +35,7 @@ vim.bo.shiftwidth=4 vim.cmd('autocmd Filetype lua setlocal ts=2 sw=2 expandtab') vim.cmd('autocmd Filetype js setlocal ts=2 sw=2 expandtab') +vim.cmd('autocmd Filetype javascript setlocal ts=2 sw=2 expandtab') vim.cmd('autocmd Filetype json setlocal ts=2 sw=2 expandtab') vim.cmd('autocmd Filetype css setlocal ts=2 sw=2 expandtab') vim.cmd('autocmd Filetype html setlocal ts=2 sw=2 expandtab') diff --git a/lua/plugins/config/luasnip.lua b/lua/plugins/config/luasnip.lua index e59efc17..25fde2c1 100644 --- a/lua/plugins/config/luasnip.lua +++ b/lua/plugins/config/luasnip.lua @@ -1,7 +1,38 @@ local ls = require("luasnip") + +-- some shorthands... +local s = ls.snippet +local sn = ls.snippet_node +local t = ls.text_node +local i = ls.insert_node +local f = ls.function_node +local c = ls.choice_node +local d = ls.dynamic_node +local r = ls.restore_node +local l = require("luasnip.extras").lambda +local rep = require("luasnip.extras").rep +local p = require("luasnip.extras").partial +local m = require("luasnip.extras").match +local n = require("luasnip.extras").nonempty +local dl = require("luasnip.extras").dynamic_lambda +local fmt = require("luasnip.extras.fmt").fmt +local fmta = require("luasnip.extras.fmt").fmta local types = require("luasnip.util.types") +local conds = require("luasnip.extras.expand_conditions") + +-- If you're reading this file for the first time, best skip to around line 190 +-- where the actual snippet-definitions start. -ls.config.setup({ +-- Every unspecified option will be set to the default. +ls.config.set_config({ + history = true, + -- Update more often, :h events for more info. + updateevents = "TextChanged,TextChangedI", + -- Snippets aren't automatically removed if their text is deleted. + -- `delete_check_events` determines on which events (:h events) a check for + -- deleted snippets is performed. + -- This can be especially useful when `history` is enabled. + delete_check_events = "TextChanged", ext_opts = { [types.choiceNode] = { active = { @@ -14,5 +45,487 @@ ls.config.setup({ } } }, + + -- treesitter-hl has 100, use something higher (default is 200). + ext_base_prio = 300, + -- minimal increase in priority. + ext_prio_increase = 1, + enable_autosnippets = true, + -- mapping for cutting selected text so it's usable as SELECT_DEDENT, + -- SELECT_RAW or TM_SELECTED_TEXT (mapped via xmap). + store_selection_keys = "", + -- luasnip uses this function to get the currently active filetype. This + -- is the (rather uninteresting) default, but it's possible to use + -- eg. treesitter for getting the current filetype by setting ft_func to + -- require("luasnip.extras.filetype_functions").from_cursor (requires + -- `nvim-treesitter/nvim-treesitter`). This allows correctly resolving + -- the current filetype in eg. a markdown-code block or `vim.cmd()`. + ft_func = function() + return vim.split(vim.bo.filetype, ".", true) + end, }) -require("luasnip.loaders.from_vscode").load() + +-- args is a table, where 1 is the text in Placeholder 1, 2 the text in +-- placeholder 2,... +local function copy(args) + return args[1] +end + +-- 'recursive' dynamic snippet. Expands to some text followed by itself. +local rec_ls +rec_ls = function() + return sn( + nil, + c(1, { + -- Order is important, sn(...) first would cause infinite loop of expansion. + t(""), + sn(nil, { t({ "", "\t\\item " }), i(1), d(2, rec_ls, {}) }), + }) + ) +end + +-- complicated function for dynamicNode. +local function jdocsnip(args, _, old_state) + -- !!! old_state is used to preserve user-input here. DON'T DO IT THAT WAY! + -- Using a restoreNode instead is much easier. + -- View this only as an example on how old_state functions. + local nodes = { + t({ "/**", " * " }), + i(1, "A short Description"), + t({ "", "" }), + } + + -- These will be merged with the snippet; that way, should the snippet be updated, + -- some user input eg. text can be referred to in the new snippet. + local param_nodes = {} + + if old_state then + nodes[2] = i(1, old_state.descr:get_text()) + end + param_nodes.descr = nodes[2] + + -- At least one param. + if string.find(args[2][1], ", ") then + vim.list_extend(nodes, { t({ " * ", "" }) }) + end + + local insert = 2 + for indx, arg in ipairs(vim.split(args[2][1], ", ", true)) do + -- Get actual name parameter. + arg = vim.split(arg, " ", true)[2] + if arg then + local inode + -- if there was some text in this parameter, use it as static_text for this new snippet. + if old_state and old_state[arg] then + inode = i(insert, old_state["arg" .. arg]:get_text()) + else + inode = i(insert) + end + vim.list_extend( + nodes, + { t({ " * @param " .. arg .. " " }), inode, t({ "", "" }) } + ) + param_nodes["arg" .. arg] = inode + + insert = insert + 1 + end + end + + if args[1][1] ~= "void" then + local inode + if old_state and old_state.ret then + inode = i(insert, old_state.ret:get_text()) + else + inode = i(insert) + end + + vim.list_extend( + nodes, + { t({ " * ", " * @return " }), inode, t({ "", "" }) } + ) + param_nodes.ret = inode + insert = insert + 1 + end + + if vim.tbl_count(args[3]) ~= 1 then + local exc = string.gsub(args[3][2], " throws ", "") + local ins + if old_state and old_state.ex then + ins = i(insert, old_state.ex:get_text()) + else + ins = i(insert) + end + vim.list_extend( + nodes, + { t({ " * ", " * @throws " .. exc .. " " }), ins, t({ "", "" }) } + ) + param_nodes.ex = ins + insert = insert + 1 + end + + vim.list_extend(nodes, { t({ " */" }) }) + + local snip = sn(nil, nodes) + -- Error on attempting overwrite. + snip.old_state = param_nodes + return snip +end + +-- Make sure to not pass an invalid command, as io.popen() may write over nvim-text. +local function bash(_, _, command) + local file = io.popen(command, "r") + local res = {} + for line in file:lines() do + table.insert(res, line) + end + return res +end + +-- Returns a snippet_node wrapped around an insert_node whose initial +-- text value is set to the current date in the desired format. +local date_input = function(args, state, fmt) + local fmt = fmt or "%Y-%m-%d" + return sn(nil, i(1, os.date(fmt))) +end + +ls.snippets = { + -- When trying to expand a snippet, luasnip first searches the tables for + -- each filetype specified in 'filetype' followed by 'all'. + -- If ie. the filetype is 'lua.c' + -- - luasnip.lua + -- - luasnip.c + -- - luasnip.all + -- are searched in that order. + all = { + -- trigger is `fn`, second argument to snippet-constructor are the nodes to insert into the buffer on expansion. + s("fn", { + -- Simple static text. + t("//Parameters: "), + -- function, first parameter is the function, second the Placeholders + -- whose text it gets as input. + f(copy, 2), + t({ "", "function " }), + -- Placeholder/Insert. + i(1), + t("("), + -- Placeholder with initial text. + i(2, "int foo"), + -- Linebreak + t({ ") {", "\t" }), + -- Last Placeholder, exit Point of the snippet. + i(0), + t({ "", "}" }), + }), + s("class", { + -- Choice: Switch between two different Nodes, first parameter is its position, second a list of nodes. + c(1, { + t("public "), + t("private "), + }), + t("class "), + i(2), + t(" "), + c(3, { + t("{"), + -- sn: Nested Snippet. Instead of a trigger, it has a position, just like insert-nodes. !!! These don't expect a 0-node!!!! + -- Inside Choices, Nodes don't need a position as the choice node is the one being jumped to. + sn(nil, { + t("extends "), + -- restoreNode: stores and restores nodes. + -- pass position, store-key and nodes. + r(1, "other_class", i(1)), + t(" {"), + }), + sn(nil, { + t("implements "), + -- no need to define the nodes for a given key a second time. + r(1, "other_class"), + t(" {"), + }), + }), + t({ "", "\t" }), + i(0), + t({ "", "}" }), + }), + -- Alternative printf-like notation for defining snippets. It uses format + -- string with placeholders similar to the ones used with Python's .format(). + s( + "fmt1", + fmt("To {title} {} {}.", { + i(2, "Name"), + i(3, "Surname"), + title = c(1, { t("Mr."), t("Ms.") }), + }) + ), + -- To escape delimiters use double them, e.g. `{}` -> `{{}}`. + -- Multi-line format strings by default have empty first/last line removed. + -- Indent common to all lines is also removed. Use the third `opts` argument + -- to control this behaviour. + s( + "fmt2", + fmt( + [[ + foo({1}, {3}) {{ + return {2} * {4} + }} + ]], + { + i(1, "x"), + rep(1), + i(2, "y"), + rep(2), + } + ) + ), + -- Empty placeholders are numbered automatically starting from 1 or the last + -- value of a numbered placeholder. Named placeholders do not affect numbering. + s( + "fmt3", + fmt("{} {a} {} {1} {}", { + t("1"), + t("2"), + a = t("A"), + }) + ), + -- The delimiters can be changed from the default `{}` to something else. + s( + "fmt4", + fmt("foo() { return []; }", i(1, "x"), { delimiters = "[]" }) + ), + -- `fmta` is a convenient wrapper that uses `<>` instead of `{}`. + s("fmt5", fmta("foo() { return <>; }", i(1, "x"))), + -- By default all args must be used. Use strict=false to disable the check + s( + "fmt6", + fmt("use {} only", { t("this"), t("not this") }, { strict = false }) + ), + -- Use a dynamic_node to interpolate the output of a + -- function (see date_input above) into the initial + -- value of an insert_node. + s("novel", { + t("It was a dark and stormy night on "), + d(1, date_input, {}, "%A, %B %d of %Y"), + t(" and the clocks were striking thirteen."), + }), + -- Parsing snippets: First parameter: Snippet-Trigger, Second: Snippet body. + -- Placeholders are parsed into choices with 1. the placeholder text(as a snippet) and 2. an empty string. + -- This means they are not SELECTed like in other editors/Snippet engines. + ls.parser.parse_snippet( + "lspsyn", + "Wow! This ${1:Stuff} really ${2:works. ${3:Well, a bit.}}" + ), + + -- When wordTrig is set to false, snippets may also expand inside other words. + ls.parser.parse_snippet( + { trig = "te", wordTrig = false }, + "${1:cond} ? ${2:true} : ${3:false}" + ), + + -- When regTrig is set, trig is treated like a pattern, this snippet will expand after any number. + ls.parser.parse_snippet({ trig = "%d", regTrig = true }, "A Number!!"), + -- Using the condition, it's possible to allow expansion only in specific cases. + s("cond", { + t("will only expand in c-style comments"), + }, { + condition = function(line_to_cursor, matched_trigger, captures) + -- optional whitespace followed by // + return line_to_cursor:match("%s*//") + end, + }), + -- there's some built-in conditions in "luasnip.extras.expand_conditions". + s("cond2", { + t("will only expand at the beginning of the line"), + }, { + condition = conds.line_begin, + }), + -- The last entry of args passed to the user-function is the surrounding snippet. + s( + { trig = "a%d", regTrig = true }, + f(function(_, snip) + return "Triggered with " .. snip.trigger .. "." + end, {}) + ), + -- It's possible to use capture-groups inside regex-triggers. + s( + { trig = "b(%d)", regTrig = true }, + f(function(_, snip) + return "Captured Text: " .. snip.captures[1] .. "." + end, {}) + ), + s({ trig = "c(%d+)", regTrig = true }, { + t("will only expand for even numbers"), + }, { + condition = function(line_to_cursor, matched_trigger, captures) + return tonumber(captures[1]) % 2 == 0 + end, + }), + -- Use a function to execute any shell command and print its text. + s("bash", f(bash, {}, "ls")), + -- Short version for applying String transformations using function nodes. + s("transform", { + i(1, "initial text"), + t({ "", "" }), + -- lambda nodes accept an l._1,2,3,4,5, which in turn accept any string transformations. + -- This list will be applied in order to the first node given in the second argument. + l(l._1:match("[^i]*$"):gsub("i", "o"):gsub(" ", "_"):upper(), 1), + }), + s("transform2", { + i(1, "initial text"), + t("::"), + i(2, "replacement for e"), + t({ "", "" }), + -- Lambdas can also apply transforms USING the text of other nodes: + l(l._1:gsub("e", l._2), { 1, 2 }), + }), + s({ trig = "trafo(%d+)", regTrig = true }, { + -- env-variables and captures can also be used: + l(l.CAPTURE1:gsub("1", l.TM_FILENAME), {}), + }), + -- Set store_selection_keys = "" (for example) in your + -- luasnip.config.setup() call to populate + -- TM_SELECTED_TEXT/SELECT_RAW/SELECT_DEDENT. + -- In this case: select a URL, hit Tab, then expand this snippet. + s("link_url", { + t(''), + i(1), + t(""), + i(0), + }), + -- Shorthand for repeating the text in a given node. + s("repeat", { i(1, "text"), t({ "", "" }), rep(1) }), + -- Directly insert the ouput from a function evaluated at runtime. + s("part", p(os.date, "%Y")), + -- use matchNodes (`m(argnode, condition, then, else)`) to insert text + -- based on a pattern/function/lambda-evaluation. + -- It's basically a shortcut for simple functionNodes: + s("mat", { + i(1, { "sample_text" }), + t(": "), + m(1, "%d", "contains a number", "no number :("), + }), + -- The `then`-text defaults to the first capture group/the entire + -- match if there are none. + s("mat2", { + i(1, { "sample_text" }), + t(": "), + m(1, "[abc][abc][abc]"), + }), + -- It is even possible to apply gsubs' or other transformations + -- before matching. + s("mat3", { + i(1, { "sample_text" }), + t(": "), + m( + 1, + l._1:gsub("[123]", ""):match("%d"), + "contains a number that isn't 1, 2 or 3!" + ), + }), + -- `match` also accepts a function in place of the condition, which in + -- turn accepts the usual functionNode-args. + -- The condition is considered true if the function returns any + -- non-nil/false-value. + -- If that value is a string, it is used as the `if`-text if no if is explicitly given. + s("mat4", { + i(1, { "sample_text" }), + t(": "), + m(1, function(args) + -- args is a table of multiline-strings (as usual). + return (#args[1][1] % 2 == 0 and args[1]) or nil + end), + }), + -- The nonempty-node inserts text depending on whether the arg-node is + -- empty. + s("nempty", { + i(1, "sample_text"), + n(1, "i(1) is not empty!"), + }), + -- dynamic lambdas work exactly like regular lambdas, except that they + -- don't return a textNode, but a dynamicNode containing one insertNode. + -- This makes it easier to dynamically set preset-text for insertNodes. + s("dl1", { + i(1, "sample_text"), + t({ ":", "" }), + dl(2, l._1, 1), + }), + -- Obviously, it's also possible to apply transformations, just like lambdas. + s("dl2", { + i(1, "sample_text"), + i(2, "sample_text_2"), + t({ "", "" }), + dl(3, l._1:gsub("\n", " linebreak ") .. l._2, { 1, 2 }), + }), + }, + java = { + -- Very long example for a java class. + s("fn", { + d(6, jdocsnip, { 2, 4, 5 }), + t({ "", "" }), + c(1, { + t("public "), + t("private "), + }), + c(2, { + t("void"), + t("String"), + t("char"), + t("int"), + t("double"), + t("boolean"), + i(nil, ""), + }), + t(" "), + i(3, "myFunc"), + t("("), + i(4), + t(")"), + c(5, { + t(""), + sn(nil, { + t({ "", " throws " }), + i(1), + }), + }), + t({ " {", "\t" }), + i(0), + t({ "", "}" }), + }), + }, + tex = { + -- rec_ls is self-referencing. That makes this snippet 'infinite' eg. have as many + -- \item as necessary by utilizing a choiceNode. + s("ls", { + t({ "\\begin{itemize}", "\t\\item " }), + i(1), + d(2, rec_ls, {}), + t({ "", "\\end{itemize}" }), + }), + }, +} + +-- autotriggered snippets have to be defined in a separate table, luasnip.autosnippets. +ls.autosnippets = { + all = { + s("autotrigger", { + t("autosnippet"), + }), + }, +} + +-- in a lua file: search lua-, then c-, then all-snippets. +ls.filetype_extend("lua", { "c" }) +-- in a cpp file: search c-snippets, then all-snippets only (no cpp-snippets!!). +ls.filetype_set("cpp", { "c" }) + +-- Beside defining your own snippets you can also load snippets from "vscode-like" packages +-- that expose snippets in json files, for example . +-- Mind that this will extend `ls.snippets` so you need to do it after your own snippets or you +-- will need to extend the table yourself instead of setting a new one. + +require("luasnip.loaders.from_vscode").load() -- Load only python snippets From c97f780b8655935aacd1cee38ebae1dccd0a926d Mon Sep 17 00:00:00 2001 From: kaiv2 Date: Sat, 26 Feb 2022 14:52:52 +0800 Subject: [PATCH 0073/1278] lspsaga --- ftplugin/java.lua | 8 +++++++- lua/keybindings.lua | 7 +++++-- lua/plugins/init.lua | 11 ++++++----- plugin/packer_compiled.lua | 20 ++++++++++---------- 4 files changed, 28 insertions(+), 18 deletions(-) diff --git a/ftplugin/java.lua b/ftplugin/java.lua index ef9c28e7..4482b179 100644 --- a/ftplugin/java.lua +++ b/ftplugin/java.lua @@ -40,6 +40,7 @@ local config = { '-configuration', '/opt/software/jdtls/config_mac', '-data', workspace_dir, }, + filetypes = {"java"}, -- 💀 -- This is the default if not provided, you can remove it. Or adjust as needed. @@ -109,7 +110,10 @@ local bundles = { }; -- /opt/software/lsp/java/vscode-java-test/server -vim.list_extend(bundles, vim.split(vim.fn.glob("/opt/software/lsp/java/vscode-java-test/server/*.jar"), "\n")) +vim.list_extend(bundles, vim.split(vim.fn.glob("/opt/software/lsp/java/vscode-java-test/server/*.jar"), "\n")); + +-- /opt/software/lsp/java/vscode-java-dependency/jdtls.ext/ +vim.list_extend(bundles, vim.split(vim.fn.glob("/opt/software/lsp/java/vscode-java-dependency/jdtls.ext/com.microsoft.jdtls.ext.core/target/com.microsoft.jdtls.ext.core-*.jar"), "\n")); config['init_options'] = { bundles = bundles; } @@ -173,5 +177,7 @@ command! -buffer JdtUpdateConfig lua require('jdtls').update_project_config() command! -buffer JdtJol lua require('jdtls').jol() command! -buffer JdtBytecode lua require('jdtls').javap() command! -buffer JdtJshell lua require('jdtls').jshell() + +" nnoremap p call lighttree#plugin#jdt#toggle_win() ]]) diff --git a/lua/keybindings.lua b/lua/keybindings.lua index ed8c02cd..bb8d4d7b 100644 --- a/lua/keybindings.lua +++ b/lua/keybindings.lua @@ -87,15 +87,18 @@ pluginKeys.maplsp = function(mapbuf) mapbuf('n', 'K', 'lua vim.lsp.buf.hover()', opt) -- rename - mapbuf('n', 'rn', 'lua vim.lsp.buf.rename()', opt) + -- mapbuf('n', 'rn', 'lua vim.lsp.buf.rename()', opt) + mapbuf('n', 'rn', 'lua require("lspsaga.rename").rename()', opt) -- code action mapbuf('n', 'ca', 'lua vim.lsp.buf.code_action()', opt) + -- mapbuf('n', 'ca', 'lua require("lspsaga.codeaction").code_action()', opt) -- go xx mapbuf('n', 'gd', 'lua vim.lsp.buf.definition()', opt) mapbuf('n', 'gh', 'lua vim.lsp.buf.hover()', opt) mapbuf('n', 'gD', 'lua vim.lsp.buf.declaration()', opt) mapbuf('n', 'gi', 'lua vim.lsp.buf.implementation()', opt) - mapbuf('n', 'gr', 'lua vim.lsp.buf.references()', opt) + -- mapbuf('n', 'gr', 'lua vim.lsp.buf.references()', opt) + mapbuf('n', 'gr', 'lua require"lspsaga.provider".lsp_finder()', opt) mapbuf('n', 's', 'lua vim.lsp.buf.workspace_symbol()', opt) -- diagnostic mapbuf('n', 'go', 'lua vim.diagnostic.open_float()', opt) diff --git a/lua/plugins/init.lua b/lua/plugins/init.lua index 22fa6bef..b1832af8 100644 --- a/lua/plugins/init.lua +++ b/lua/plugins/init.lua @@ -27,12 +27,12 @@ require('packer').startup(function() -- lsp 相关 -- use 'folke/lsp-colors.nvim' use 'folke/trouble.nvim' - -- use 'glepnir/lspsaga.nvim' + use 'glepnir/lspsaga.nvim' -- use 'ray-x/lsp_signature.nvim' - use 'RishabhRD/popfix' - use 'RishabhRD/nvim-lsputils' + -- use 'RishabhRD/popfix' + -- use 'RishabhRD/nvim-lsputils' -- 主题 use 'morhetz/gruvbox' @@ -56,6 +56,7 @@ require('packer').startup(function() -- java use 'mfussenegger/nvim-jdtls' + use 'NiYanhhhhh/lighttree-java' -- debug use 'mfussenegger/nvim-dap' @@ -183,11 +184,11 @@ require('plugins/config/nvim-notify') require('plugins/config/wilder') require('plugins/config/nvim-colorizer') require('plugins/config/comment') --- require('plugins/config/lspsaga') +require('plugins/config/lspsaga') -- require('plugins/config/formatter') require('plugins/config/telescope') require('plugins/config/dashboard-nvim') -require('plugins/config/nvim-lsputils') +-- require('plugins/config/nvim-lsputils') require('plugins/config/nvim-autopairs') -- require('plugins/config/lsp_signature') require('plugins/config/nvim-dap') diff --git a/plugin/packer_compiled.lua b/plugin/packer_compiled.lua index 15479c14..3db25174 100644 --- a/plugin/packer_compiled.lua +++ b/plugin/packer_compiled.lua @@ -154,11 +154,21 @@ _G.packer_plugins = { path = "/Users/kailuo/.local/share/nvim/site/pack/packer/start/indent-blankline.nvim", url = "https://github.com/lukas-reineke/indent-blankline.nvim" }, + ["lighttree-java"] = { + loaded = true, + path = "/Users/kailuo/.local/share/nvim/site/pack/packer/start/lighttree-java", + url = "https://github.com/NiYanhhhhh/lighttree-java" + }, ["lspkind-nvim"] = { loaded = true, path = "/Users/kailuo/.local/share/nvim/site/pack/packer/start/lspkind-nvim", url = "https://github.com/onsails/lspkind-nvim" }, + ["lspsaga.nvim"] = { + loaded = true, + path = "/Users/kailuo/.local/share/nvim/site/pack/packer/start/lspsaga.nvim", + url = "https://github.com/glepnir/lspsaga.nvim" + }, ["lualine.nvim"] = { loaded = true, path = "/Users/kailuo/.local/share/nvim/site/pack/packer/start/lualine.nvim", @@ -214,11 +224,6 @@ _G.packer_plugins = { path = "/Users/kailuo/.local/share/nvim/site/pack/packer/start/nvim-lspconfig", url = "https://github.com/neovim/nvim-lspconfig" }, - ["nvim-lsputils"] = { - loaded = true, - path = "/Users/kailuo/.local/share/nvim/site/pack/packer/start/nvim-lsputils", - url = "https://github.com/RishabhRD/nvim-lsputils" - }, ["nvim-notify"] = { loaded = true, path = "/Users/kailuo/.local/share/nvim/site/pack/packer/start/nvim-notify", @@ -254,11 +259,6 @@ _G.packer_plugins = { path = "/Users/kailuo/.local/share/nvim/site/pack/packer/start/plenary.nvim", url = "https://github.com/nvim-lua/plenary.nvim" }, - popfix = { - loaded = true, - path = "/Users/kailuo/.local/share/nvim/site/pack/packer/start/popfix", - url = "https://github.com/RishabhRD/popfix" - }, ["rust-tools.nvim"] = { loaded = true, path = "/Users/kailuo/.local/share/nvim/site/pack/packer/start/rust-tools.nvim", From af4df342e92184b532e7486b9fda3a4309650e45 Mon Sep 17 00:00:00 2001 From: kaiv2 Date: Sat, 26 Feb 2022 16:13:33 +0800 Subject: [PATCH 0074/1278] update --- lua/basic.lua | 1 + 1 file changed, 1 insertion(+) diff --git a/lua/basic.lua b/lua/basic.lua index e04b4eea..3a5137a4 100644 --- a/lua/basic.lua +++ b/lua/basic.lua @@ -39,6 +39,7 @@ vim.cmd('autocmd Filetype javascript setlocal ts=2 sw=2 expandtab') vim.cmd('autocmd Filetype json setlocal ts=2 sw=2 expandtab') vim.cmd('autocmd Filetype css setlocal ts=2 sw=2 expandtab') vim.cmd('autocmd Filetype html setlocal ts=2 sw=2 expandtab') +vim.cmd('autocmd Filetype xml setlocal ts=2 sw=2 expandtab') -- 新行对齐当前行,空格替代tab vim.o.expandtab = true From b4bb1191f7ce0d7575f8640c0e56d86b696245b7 Mon Sep 17 00:00:00 2001 From: kaiv2 Date: Sat, 26 Feb 2022 17:54:20 +0800 Subject: [PATCH 0075/1278] update --- lua/plugins/config/lspsaga.lua | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/lua/plugins/config/lspsaga.lua b/lua/plugins/config/lspsaga.lua index 9a776ded..cee61735 100644 --- a/lua/plugins/config/lspsaga.lua +++ b/lua/plugins/config/lspsaga.lua @@ -38,8 +38,11 @@ local saga = require 'lspsaga' -- server_filetype_map = {} saga.init_lsp_saga({ - error_sign = '', - warn_sign = '', - hint_sign = '', - infor_sign = '' + error_sign = '', + warn_sign = '', + hint_sign = '', + infor_sign = '', + code_action_prompt = { + enable = false, + }, }) From 00e3d77dcf49f6dd6f540ba05a4aa715dcd74042 Mon Sep 17 00:00:00 2001 From: kaiv2 Date: Mon, 28 Feb 2022 20:02:36 +0800 Subject: [PATCH 0076/1278] config --- lua/basic.lua | 1 + lua/keybindings.lua | 3 ++- lua/lsp/init.lua | 1 + 3 files changed, 4 insertions(+), 1 deletion(-) diff --git a/lua/basic.lua b/lua/basic.lua index 3a5137a4..055df87f 100644 --- a/lua/basic.lua +++ b/lua/basic.lua @@ -40,6 +40,7 @@ vim.cmd('autocmd Filetype json setlocal ts=2 sw=2 expandtab') vim.cmd('autocmd Filetype css setlocal ts=2 sw=2 expandtab') vim.cmd('autocmd Filetype html setlocal ts=2 sw=2 expandtab') vim.cmd('autocmd Filetype xml setlocal ts=2 sw=2 expandtab') +vim.cmd('autocmd Filetype yaml setlocal ts=2 sw=2 expandtab') -- 新行对齐当前行,空格替代tab vim.o.expandtab = true diff --git a/lua/keybindings.lua b/lua/keybindings.lua index bb8d4d7b..1fb55265 100644 --- a/lua/keybindings.lua +++ b/lua/keybindings.lua @@ -99,7 +99,8 @@ pluginKeys.maplsp = function(mapbuf) mapbuf('n', 'gi', 'lua vim.lsp.buf.implementation()', opt) -- mapbuf('n', 'gr', 'lua vim.lsp.buf.references()', opt) mapbuf('n', 'gr', 'lua require"lspsaga.provider".lsp_finder()', opt) - mapbuf('n', 's', 'lua vim.lsp.buf.workspace_symbol()', opt) + -- mapbuf('n', 's', 'lua vim.lsp.buf.workspace_symbol()', opt) + mapbuf('n', 's', 'lua require"telescope.builtin".lsp_workspace_symbols({ query = vim.fn.input("Query> ") })', opt) -- diagnostic mapbuf('n', 'go', 'lua vim.diagnostic.open_float()', opt) mapbuf('n', '[g', 'lua vim.diagnostic.goto_prev()', opt) diff --git a/lua/lsp/init.lua b/lua/lsp/init.lua index f2e81a51..ec068abd 100644 --- a/lua/lsp/init.lua +++ b/lua/lsp/init.lua @@ -9,6 +9,7 @@ local servers = { jsonls = {}, clangd = require 'lsp.c', tsserver = {}, + html = {}, -- rust_analyzer = require 'lsp.rust', } From ad0e29945c1b84bc2a0d75c6c5d7cfa9daf62f1b Mon Sep 17 00:00:00 2001 From: kaiv2 Date: Tue, 1 Mar 2022 21:12:32 +0800 Subject: [PATCH 0077/1278] del lighttree --- ftplugin/java.lua | 2 +- lua/plugins/init.lua | 2 +- plugin/packer_compiled.lua | 5 ----- 3 files changed, 2 insertions(+), 7 deletions(-) diff --git a/ftplugin/java.lua b/ftplugin/java.lua index 4482b179..14e75d7e 100644 --- a/ftplugin/java.lua +++ b/ftplugin/java.lua @@ -113,7 +113,7 @@ local bundles = { vim.list_extend(bundles, vim.split(vim.fn.glob("/opt/software/lsp/java/vscode-java-test/server/*.jar"), "\n")); -- /opt/software/lsp/java/vscode-java-dependency/jdtls.ext/ -vim.list_extend(bundles, vim.split(vim.fn.glob("/opt/software/lsp/java/vscode-java-dependency/jdtls.ext/com.microsoft.jdtls.ext.core/target/com.microsoft.jdtls.ext.core-*.jar"), "\n")); +-- vim.list_extend(bundles, vim.split(vim.fn.glob("/opt/software/lsp/java/vscode-java-dependency/jdtls.ext/com.microsoft.jdtls.ext.core/target/com.microsoft.jdtls.ext.core-*.jar"), "\n")); config['init_options'] = { bundles = bundles; } diff --git a/lua/plugins/init.lua b/lua/plugins/init.lua index b1832af8..487fb0fe 100644 --- a/lua/plugins/init.lua +++ b/lua/plugins/init.lua @@ -56,7 +56,7 @@ require('packer').startup(function() -- java use 'mfussenegger/nvim-jdtls' - use 'NiYanhhhhh/lighttree-java' + -- use 'NiYanhhhhh/lighttree-java' -- debug use 'mfussenegger/nvim-dap' diff --git a/plugin/packer_compiled.lua b/plugin/packer_compiled.lua index 3db25174..2124801f 100644 --- a/plugin/packer_compiled.lua +++ b/plugin/packer_compiled.lua @@ -154,11 +154,6 @@ _G.packer_plugins = { path = "/Users/kailuo/.local/share/nvim/site/pack/packer/start/indent-blankline.nvim", url = "https://github.com/lukas-reineke/indent-blankline.nvim" }, - ["lighttree-java"] = { - loaded = true, - path = "/Users/kailuo/.local/share/nvim/site/pack/packer/start/lighttree-java", - url = "https://github.com/NiYanhhhhh/lighttree-java" - }, ["lspkind-nvim"] = { loaded = true, path = "/Users/kailuo/.local/share/nvim/site/pack/packer/start/lspkind-nvim", From 8b8556396ce3b397299696ba33d0d1b230afad25 Mon Sep 17 00:00:00 2001 From: kaiv2 Date: Thu, 10 Mar 2022 23:20:31 +0800 Subject: [PATCH 0078/1278] --- lua/keybindings.lua | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lua/keybindings.lua b/lua/keybindings.lua index 1fb55265..aaa93220 100644 --- a/lua/keybindings.lua +++ b/lua/keybindings.lua @@ -1,5 +1,5 @@ -vim.g.mapleader = ";" -vim.g.maplocalleader = ";" +-- vim.g.mapleader = ";" +-- vim.g.maplocalleader = ";" local map = vim.api.nvim_set_keymap local opt = {noremap = true, silent = true } From 84b0d489e74620e70eca5d26dada5d0ab8b626d0 Mon Sep 17 00:00:00 2001 From: kaiv2 Date: Fri, 11 Mar 2022 22:03:16 +0800 Subject: [PATCH 0079/1278] rg --- lua/basic.lua | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/lua/basic.lua b/lua/basic.lua index 055df87f..0f214772 100644 --- a/lua/basic.lua +++ b/lua/basic.lua @@ -97,4 +97,9 @@ endif if has("autocmd") au BufReadPost * if line("'\"") > 1 && line("'\"") <= line("$") | exe "normal! g'\"" | endif endif + +" set grepprg=rg\ --vimgrep +set grepprg=rg\ --vimgrep\ --no-heading\ --smart-case +" set grepformat^=%f:%l:%c:%m +set grepformat=%f:%l:%c:%m,%f:%l:%m ]]) From eb7479cd602eb608193d5c1c02122dc69bf1a891 Mon Sep 17 00:00:00 2001 From: kaiv2 Date: Sat, 12 Mar 2022 18:27:29 +0800 Subject: [PATCH 0080/1278] config --- lua/plugins/config/vista.lua | 3 +++ 1 file changed, 3 insertions(+) diff --git a/lua/plugins/config/vista.lua b/lua/plugins/config/vista.lua index e0ea3ca8..ffbbbd6c 100644 --- a/lua/plugins/config/vista.lua +++ b/lua/plugins/config/vista.lua @@ -1 +1,4 @@ vim.g.vista_default_executive = 'nvim_lsp' + +vim.g.vista_icon_indent = {"╰─▸ ", "├─▸ "} + From 40b0ff125cd0e90a719ba680ba9f496be060b6f7 Mon Sep 17 00:00:00 2001 From: kaiv2 Date: Thu, 17 Mar 2022 10:22:39 +0800 Subject: [PATCH 0081/1278] update task_template --- config/task_template.ini | 43 ++++++++++++++++++++++++++++--- lua/plugins/config/asynctasks.lua | 2 +- 2 files changed, 41 insertions(+), 4 deletions(-) diff --git a/config/task_template.ini b/config/task_template.ini index d9d8c6c5..b426d97a 100644 --- a/config/task_template.ini +++ b/config/task_template.ini @@ -1,21 +1,21 @@ {maven} [mvn-compile] -command=mvn clean compile test-compile +command=mvn clean compile test-compile cwd=$(VIM_ROOT) output=terminal errorformat=%f:%l:%m save=1 [mvn-package-skip-test] -command=mvn clean package -Dmaven.test.skip=true -U +command=mvn clean package -Dmaven.test.skip=true -U cwd=$(VIM_ROOT) output=terminal errorformat=%f:%l:%m save=1 [mvn-install-skip-test] -command=mvn clean install -Dmaven.test.skip=true -U +command=mvn clean install -Dmaven.test.skip=true -U cwd=$(VIM_ROOT) output=terminal errorformat=%f:%l:%m @@ -53,3 +53,40 @@ output=terminal errorformat=%f:%l:%m +{cargo} + +[cargo-run] +command=cargo run +cwd=$(VIM_ROOT) +output=terminal +errorformat=%f:%l:%m +save=1 + +[cargo-fmt] +command=cargo fmt +cwd=$(VIM_ROOT) +output=terminal +errorformat=%f:%l:%m +save=1 + +[cargo-check] +command=cargo check +cwd=$(VIM_ROOT) +output=terminal +errorformat=%f:%l:%m +save=1 + +[cargo-build] +command=cargo build +cwd=$(VIM_ROOT) +output=terminal +errorformat=%f:%l:%m +save=1 + +[cargo-build-release] +command=cargo build --release +cwd=$(VIM_ROOT) +output=terminal +errorformat=%f:%l:%m +save=1 + diff --git a/lua/plugins/config/asynctasks.lua b/lua/plugins/config/asynctasks.lua index 6654d9dd..4068cfea 100644 --- a/lua/plugins/config/asynctasks.lua +++ b/lua/plugins/config/asynctasks.lua @@ -60,5 +60,5 @@ let g:asynctasks_extra_config = [ \ ] ]]) -- 未实现 -vim.g.asynctask_template = '~/.config/nvim/config/task_template.ini' +vim.g.asynctasks_template = '~/.config/nvim/config/task_template.ini' From 301a7b7063187bc2a8078874d1b1ff9f8356cf88 Mon Sep 17 00:00:00 2001 From: kaiv2 Date: Fri, 18 Mar 2022 17:49:10 +0800 Subject: [PATCH 0082/1278] doc --- config/task_template.ini | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/config/task_template.ini b/config/task_template.ini index b426d97a..ab8a44c9 100644 --- a/config/task_template.ini +++ b/config/task_template.ini @@ -90,3 +90,12 @@ output=terminal errorformat=%f:%l:%m save=1 + +{markdown} + +[toc] +command=pandoc -s --toc --toc-depth=4 $(VIM_RELNAME) -o $(VIM_RELNAME) +cwd=$(VIM_ROOT) +output=terminal +errorformat=%f:%l:%m +save=1 From bd5a84fbe0172bc5a2b266728d2601c176f154c7 Mon Sep 17 00:00:00 2001 From: kaiv2 Date: Fri, 18 Mar 2022 18:38:38 +0800 Subject: [PATCH 0083/1278] update java lsp config --- ftplugin/java.lua | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/ftplugin/java.lua b/ftplugin/java.lua index 14e75d7e..95ad7e1a 100644 --- a/ftplugin/java.lua +++ b/ftplugin/java.lua @@ -123,6 +123,8 @@ config['on_attach'] = function(client, bufnr) -- you make during a debug session immediately. -- Remove the option if you do not want that. require('jdtls').setup_dap({ hotcodereplace = 'auto' }) + require('jdtls.setup').add_commands(); + -- require('jdtls.dap').setup_dap_main_class_configs({ verbose = true }) end @@ -169,14 +171,14 @@ nnoremap dc lua require'jdtls'.test_class() nnoremap dm lua require'jdtls'.test_nearest_method() -command! -nargs=0 JdtRefreshDebugConfigs :lua require('jdtls.dap').setup_dap_main_class_configs() - -command! -buffer -nargs=? -complete=custom,v:lua.require'jdtls'._complete_compile JdtCompile lua require('jdtls').compile() -command! -buffer -nargs=? -complete=custom,v:lua.require'jdtls'._complete_set_runtime JdtSetRuntime lua require('jdtls').set_runtime() -command! -buffer JdtUpdateConfig lua require('jdtls').update_project_config() -command! -buffer JdtJol lua require('jdtls').jol() -command! -buffer JdtBytecode lua require('jdtls').javap() -command! -buffer JdtJshell lua require('jdtls').jshell() +" command! -nargs=0 JdtRefreshDebugConfigs :lua require('jdtls.dap').setup_dap_main_class_configs() +" +" command! -buffer -nargs=? -complete=custom,v:lua.require'jdtls'._complete_compile JdtCompile lua require('jdtls').compile() +" command! -buffer -nargs=? -complete=custom,v:lua.require'jdtls'._complete_set_runtime JdtSetRuntime lua require('jdtls').set_runtime() +" command! -buffer JdtUpdateConfig lua require('jdtls').update_project_config() +" command! -buffer JdtJol lua require('jdtls').jol() +" command! -buffer JdtBytecode lua require('jdtls').javap() +" command! -buffer JdtJshell lua require('jdtls').jshell() " nnoremap p call lighttree#plugin#jdt#toggle_win() ]]) From 3116b04da3722914af815b51416d1a504b18a27c Mon Sep 17 00:00:00 2001 From: kaiv2 Date: Fri, 18 Mar 2022 18:49:31 +0800 Subject: [PATCH 0084/1278] notify conf --- lua/lsp/init.lua | 21 ++++++++++----------- 1 file changed, 10 insertions(+), 11 deletions(-) diff --git a/lua/lsp/init.lua b/lua/lsp/init.lua index ec068abd..65dc973e 100644 --- a/lua/lsp/init.lua +++ b/lua/lsp/init.lua @@ -74,14 +74,13 @@ vim.lsp.handlers["textDocument/signatureHelp"] = vim.lsp.with(vim.lsp.handlers.s }) -- suppress error messages from lang servers -vim.notify = function(msg, log_level) - if msg:match "exit code" then - return - end - if log_level == vim.log.levels.ERROR then - vim.api.nvim_err_writeln(msg) - else - vim.api.nvim_echo({ { msg } }, true, {}) - end -end - +-- vim.notify = function(msg, log_level) +-- if msg:match "exit code" then +-- return +-- end +-- if log_level == vim.log.levels.ERROR then +-- vim.api.nvim_err_writeln(msg) +-- else +-- vim.api.nvim_echo({ { msg } }, true, {}) +-- end +-- end From 595fe887c2a7bb8559ee87b5a15fa74c2b398cc2 Mon Sep 17 00:00:00 2001 From: kaiv2 Date: Fri, 18 Mar 2022 21:17:52 +0800 Subject: [PATCH 0085/1278] update --- lua/keybindings.lua | 1 + lua/lsp/c.lua | 7 +++- lua/lsp/html.lua | 6 +++ lua/lsp/init.lua | 15 +++++--- lua/lsp/java.lua | 90 -------------------------------------------- lua/lsp/jsonls.lua | 6 +++ lua/lsp/lua.lua | 7 +++- lua/lsp/pyright.lua | 9 +++++ lua/lsp/rust.lua | 1 - lua/lsp/tsserver.lua | 6 +++ lua/plugins/init.lua | 1 + 11 files changed, 51 insertions(+), 98 deletions(-) create mode 100644 lua/lsp/html.lua delete mode 100644 lua/lsp/java.lua create mode 100644 lua/lsp/jsonls.lua create mode 100644 lua/lsp/pyright.lua delete mode 100644 lua/lsp/rust.lua create mode 100644 lua/lsp/tsserver.lua diff --git a/lua/keybindings.lua b/lua/keybindings.lua index aaa93220..a9b81744 100644 --- a/lua/keybindings.lua +++ b/lua/keybindings.lua @@ -108,6 +108,7 @@ pluginKeys.maplsp = function(mapbuf) -- mapbuf('n', 'q', 'lua vim.diagnostic.setloclist()', opt) -- leader + = mapbuf('n', '=', 'lua vim.lsp.buf.formatting()', opt) + mapbuf('v', '=', 'lua vim.lsp.buf.formatting()', opt) -- mapbuf('n', '', 'lua vim.lsp.buf.signature_help()', opt) -- mapbuf('n', 'wa', 'lua vim.lsp.buf.add_workspace_folder()', opt) -- mapbuf('n', 'wr', 'lua vim.lsp.buf.remove_workspace_folder()', opt) diff --git a/lua/lsp/c.lua b/lua/lsp/c.lua index a5647075..51856df4 100644 --- a/lua/lsp/c.lua +++ b/lua/lsp/c.lua @@ -1 +1,6 @@ -return {} +local M = {} +M.config = { +} +M.on_attach = function (_, _) +end +return M; diff --git a/lua/lsp/html.lua b/lua/lsp/html.lua new file mode 100644 index 00000000..51856df4 --- /dev/null +++ b/lua/lsp/html.lua @@ -0,0 +1,6 @@ +local M = {} +M.config = { +} +M.on_attach = function (_, _) +end +return M; diff --git a/lua/lsp/init.lua b/lua/lsp/init.lua index 65dc973e..c193a4b9 100644 --- a/lua/lsp/init.lua +++ b/lua/lsp/init.lua @@ -6,10 +6,11 @@ local lsp_installer = require "nvim-lsp-installer" local servers = { sumneko_lua = require "lsp.lua", -- /lua/lsp/lua.lua -- jdtls = require "lsp.java", -- /lua/lsp/jdtls.lua - jsonls = {}, + jsonls = require("lsp.jsonls"), clangd = require 'lsp.c', - tsserver = {}, - html = {}, + tsserver = require("lsp.tsserver"), + html = require("lsp.html"), + pyright = require("lsp.pyright") -- rust_analyzer = require 'lsp.rust', } @@ -30,13 +31,17 @@ local capabilities = require('cmp_nvim_lsp').update_capabilities(vim.lsp.protoco -- capabilities.textDocument.completion.completionItem.snippetSupport = true lsp_installer.on_server_ready(function(server) - local opts = servers[server.name] + local m = servers[server.name] + local opts = m.config; if opts then - opts.on_attach = function(_, bufnr) + opts.on_attach = function(client, bufnr) local function buf_set_keymap(...) vim.api.nvim_buf_set_keymap(bufnr, ...) end -- local function buf_set_option(...) vim.api.nvim_buf_set_option(bufnr, ...) end -- 绑定快捷键 require('keybindings').maplsp(buf_set_keymap) + if m.on_attach then + m.on_attach(client, bufnr) + end end opts.flags = { debounce_text_changes = 150, diff --git a/lua/lsp/java.lua b/lua/lsp/java.lua deleted file mode 100644 index c6755a8f..00000000 --- a/lua/lsp/java.lua +++ /dev/null @@ -1,90 +0,0 @@ --- local java_language_server = require "java_language_server" --- If you started neovim within `~/dev/xy/project-1` this would resolve to `project-1` -local project_name = vim.fn.fnamemodify(vim.fn.getcwd(), ':p:h:t') - --- local workspace_dir = '/Users/kailuo/jdtls-workspace/' .. project_name -local workspace_dir = '/Users/kailuo/jdtls-workspace/' - --- See `:help vim.lsp.start_client` for an overview of the supported `config` options. -return { - -- The command that starts the language server - -- See: https://github.com/eclipse/eclipse.jdt.ls#running-from-the-command-line - cmd = { - '/Library/Java/JavaVirtualMachines/zulu-11.jdk/Contents/Home/bin/java', -- or '/path/to/java11_or_newer/bin/java' - '-Declipse.application=org.eclipse.jdt.ls.core.id1', - '-Dosgi.bundles.defaultStartLevel=4', - '-Declipse.product=org.eclipse.jdt.ls.core.product', - '-Dlog.protocol=true', - '-Dlog.level=ALL', - '-Xms1g', - '-Xmx2g', - '--add-modules=ALL-SYSTEM', - '--add-opens', 'java.base/java.util=ALL-UNNAMED', - '--add-opens', 'java.base/java.lang=ALL-UNNAMED', - '-jar', '/opt/software/jdtls/plugins/org.eclipse.equinox.launcher_1.6.400.v20210924-0641.jar', - '-configuration', '/opt/software/jdtls/config_mac', - '-data', workspace_dir, - }, - filetypes = { "java" }, - - -- 💀 - -- This is the default if not provided, you can remove it. Or adjust as needed. - -- One dedicated LSP server & client will be started per unique root_dir - -- root_dir = require('jdtls.setup').find_root({'.git', 'mvnw', 'gradlew'}), - - -- Here you can configure eclipse.jdt.ls specific settings - -- See https://github.com/eclipse/eclipse.jdt.ls/wiki/Running-the-JAVA-LS-server-from-the-command-line#initialize-request - -- for a list of options - settings = { - java = { - home = "/Library/Java/JavaVirtualMachines/zulu-11.jdk/Contents/Home", - eclipse = { - downloadSources = true, - }, - server = { - launchMode = "Hybrid", - }, - maven = { - downloadSources = true, - updateSnapshots = true, - }, - configuration = { - maven = { --- userSettings = "/opt/software/apache-maven-3.6.3/conf/settings.xml", --- globalSettings = "/opt/software/apache-maven-3.6.3/conf/settings.xml", - userSettings = "/Users/kailuo/workspace/paylabs/maven/settings.xml", - globalSettings = "/Users/kailuo/workspace/paylabs/maven/settings.xml", - }, - runtimes = { - { - name = "JavaSE-1.8", - path = "/Library/Java/JavaVirtualMachines/zulu-8.jdk/Contents/Home", - }, - { - name = "JavaSE-11", - path = "/Library/Java/JavaVirtualMachines/zulu-11.jdk/Contents/Home", - }, - } - }, - } - }, - - -- Language server `initializationOptions` - -- You need to extend the `bundles` with paths to jar files - -- if you want to use additional eclipse.jdt.ls plugins. - -- - -- See https://github.com/mfussenegger/nvim-jdtls#java-debug-installation - -- - -- If you don't plan on using the debugger or other eclipse.jdt.ls plugins you can remove this - init_options = { - jvm_args = { - 'hello' - }, - bundles = {}, - workspace = workspace_dir - }, - root_dir = function () - return require('jdtls.setup').find_root({'.git', 'mvnw', 'gradlew'}) - end -} - diff --git a/lua/lsp/jsonls.lua b/lua/lsp/jsonls.lua new file mode 100644 index 00000000..51856df4 --- /dev/null +++ b/lua/lsp/jsonls.lua @@ -0,0 +1,6 @@ +local M = {} +M.config = { +} +M.on_attach = function (_, _) +end +return M; diff --git a/lua/lsp/lua.lua b/lua/lsp/lua.lua index 3ca12d2a..5e1a4788 100644 --- a/lua/lsp/lua.lua +++ b/lua/lsp/lua.lua @@ -1,7 +1,8 @@ local runtime_path = vim.split(package.path, ';') table.insert(runtime_path, "lua/?.lua") table.insert(runtime_path, "lua/?/init.lua") -return { +local M = {} + M.config = { settings = { Lua = { runtime = { @@ -25,3 +26,7 @@ return { }, }, } +M.on_attach = function (_, bufnr) + +end +return M; diff --git a/lua/lsp/pyright.lua b/lua/lsp/pyright.lua new file mode 100644 index 00000000..9170a8f6 --- /dev/null +++ b/lua/lsp/pyright.lua @@ -0,0 +1,9 @@ +local M = {} +M.config = { +} +M.on_attach = function (_, _) + -- vim.cmd[[ + -- command! -nargs=0 OR :lua require'nvim-lsp-installer.extras.pyright'.organize_imports() + -- ]] +end +return M; diff --git a/lua/lsp/rust.lua b/lua/lsp/rust.lua deleted file mode 100644 index a5647075..00000000 --- a/lua/lsp/rust.lua +++ /dev/null @@ -1 +0,0 @@ -return {} diff --git a/lua/lsp/tsserver.lua b/lua/lsp/tsserver.lua new file mode 100644 index 00000000..51856df4 --- /dev/null +++ b/lua/lsp/tsserver.lua @@ -0,0 +1,6 @@ +local M = {} +M.config = { +} +M.on_attach = function (_, _) +end +return M; diff --git a/lua/plugins/init.lua b/lua/plugins/init.lua index 487fb0fe..f2330841 100644 --- a/lua/plugins/init.lua +++ b/lua/plugins/init.lua @@ -195,3 +195,4 @@ require('plugins/config/nvim-dap') require('plugins/config/markdown-preview') require('plugins/config/rust-tools') +require("telescope").load_extension("notify") From 928b737bcc274af07c2d76dc1318e6a16d41098b Mon Sep 17 00:00:00 2001 From: kaiv2 Date: Fri, 18 Mar 2022 21:59:13 +0800 Subject: [PATCH 0086/1278] update --- lua/keybindings.lua | 5 ++++- lua/lsp/pyright.lua | 16 +++++++++++++--- 2 files changed, 17 insertions(+), 4 deletions(-) diff --git a/lua/keybindings.lua b/lua/keybindings.lua index a9b81744..4650d6f0 100644 --- a/lua/keybindings.lua +++ b/lua/keybindings.lua @@ -85,6 +85,8 @@ local pluginKeys = {} -- lsp 回调函数快捷键设置 pluginKeys.maplsp = function(mapbuf) + vim.api.nvim_buf_set_option(mapbuf, 'omnifunc', 'v:lua.vim.lsp.omnifunc') + mapbuf('n', 'K', 'lua vim.lsp.buf.hover()', opt) -- rename -- mapbuf('n', 'rn', 'lua vim.lsp.buf.rename()', opt) @@ -95,7 +97,8 @@ pluginKeys.maplsp = function(mapbuf) -- go xx mapbuf('n', 'gd', 'lua vim.lsp.buf.definition()', opt) mapbuf('n', 'gh', 'lua vim.lsp.buf.hover()', opt) - mapbuf('n', 'gD', 'lua vim.lsp.buf.declaration()', opt) + -- mapbuf('n', 'gD', 'lua vim.lsp.buf.declaration()', opt) + mapbuf('n', 'gD', 'lua vim.lsp.buf.type_definition()', opt) mapbuf('n', 'gi', 'lua vim.lsp.buf.implementation()', opt) -- mapbuf('n', 'gr', 'lua vim.lsp.buf.references()', opt) mapbuf('n', 'gr', 'lua require"lspsaga.provider".lsp_finder()', opt) diff --git a/lua/lsp/pyright.lua b/lua/lsp/pyright.lua index 9170a8f6..eeed529b 100644 --- a/lua/lsp/pyright.lua +++ b/lua/lsp/pyright.lua @@ -1,9 +1,19 @@ local M = {} M.config = { } + +M.organize_imports = function () + local params = { + command = 'pyright.organizeimports', + arguments = { vim.uri_from_bufnr(0) }, + } + vim.lsp.buf.execute_command(params) +end + + M.on_attach = function (_, _) - -- vim.cmd[[ - -- command! -nargs=0 OR :lua require'nvim-lsp-installer.extras.pyright'.organize_imports() - -- ]] + vim.cmd[[ + command! -nargs=0 OR :lua require'lsp.pyright'.organize_imports() + ]] end return M; From 5473f6f8f83d7ef9e7e54eb55acba36ed3570ef7 Mon Sep 17 00:00:00 2001 From: kaiv2 Date: Fri, 18 Mar 2022 22:01:55 +0800 Subject: [PATCH 0087/1278] update --- lua/keybindings.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lua/keybindings.lua b/lua/keybindings.lua index 4650d6f0..0ecdef38 100644 --- a/lua/keybindings.lua +++ b/lua/keybindings.lua @@ -111,7 +111,7 @@ pluginKeys.maplsp = function(mapbuf) -- mapbuf('n', 'q', 'lua vim.diagnostic.setloclist()', opt) -- leader + = mapbuf('n', '=', 'lua vim.lsp.buf.formatting()', opt) - mapbuf('v', '=', 'lua vim.lsp.buf.formatting()', opt) + -- mapbuf('v', '=', 'lua vim.lsp.buf.formatting()', opt) -- mapbuf('n', '', 'lua vim.lsp.buf.signature_help()', opt) -- mapbuf('n', 'wa', 'lua vim.lsp.buf.add_workspace_folder()', opt) -- mapbuf('n', 'wr', 'lua vim.lsp.buf.remove_workspace_folder()', opt) From 2b9136acf8700ea85116ec3b3b0ab3432fed6a92 Mon Sep 17 00:00:00 2001 From: kaiv2 Date: Fri, 18 Mar 2022 22:10:09 +0800 Subject: [PATCH 0088/1278] update --- lua/lsp/init.lua | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lua/lsp/init.lua b/lua/lsp/init.lua index c193a4b9..64248ef5 100644 --- a/lua/lsp/init.lua +++ b/lua/lsp/init.lua @@ -20,6 +20,7 @@ for name, _ in pairs(servers) do if server_available then if not server:is_installed() then print("Installing " .. name) + vim.notify(string.format("Installing [%s] server", name), vim.log.levels.INFO) server:install() end end @@ -42,6 +43,7 @@ lsp_installer.on_server_ready(function(server) if m.on_attach then m.on_attach(client, bufnr) end + vim.notify(string.format("Starting [%s] server", server.name), vim.log.levels.INFO) end opts.flags = { debounce_text_changes = 150, From 4a2ae3382e5ec370ff04f73ca307b749f1335f4f Mon Sep 17 00:00:00 2001 From: kaiv2 Date: Fri, 18 Mar 2022 23:25:19 +0800 Subject: [PATCH 0089/1278] update --- lua/lsp/init.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lua/lsp/init.lua b/lua/lsp/init.lua index 64248ef5..e4812f67 100644 --- a/lua/lsp/init.lua +++ b/lua/lsp/init.lua @@ -43,7 +43,7 @@ lsp_installer.on_server_ready(function(server) if m.on_attach then m.on_attach(client, bufnr) end - vim.notify(string.format("Starting [%s] server", server.name), vim.log.levels.INFO) + -- vim.notify(string.format("Starting [%s] server", server.name), vim.log.levels.INFO) end opts.flags = { debounce_text_changes = 150, From 67dd5b11a6fa40dc88b7dff21784d2ae025a284f Mon Sep 17 00:00:00 2001 From: kaiv2 Date: Sat, 19 Mar 2022 10:25:50 +0800 Subject: [PATCH 0090/1278] update --- lua/plugins/config/lualine.lua | 3 ++- lua/plugins/init.lua | 2 ++ plugin/packer_compiled.lua | 5 +++++ 3 files changed, 9 insertions(+), 1 deletion(-) diff --git a/lua/plugins/config/lualine.lua b/lua/plugins/config/lualine.lua index 58b663aa..7f9b31c8 100644 --- a/lua/plugins/config/lualine.lua +++ b/lua/plugins/config/lualine.lua @@ -10,13 +10,14 @@ require('lualine').setup { sections = { lualine_a = {'mode'}, lualine_b = {'branch', 'diff', 'diagnostics'}, - lualine_c = {'filename'}, + lualine_c = {'filename', 'lsp_progress'}, lualine_x = {'encoding', 'fileformat', 'filetype'}, lualine_y = {'progress'}, lualine_z = {'location'} }, inactive_sections = { lualine_a = {}, + -- lualine_b = {function() return require('lsp-status').status() end}, lualine_b = {}, lualine_c = {'filename'}, lualine_x = {'location'}, diff --git a/lua/plugins/init.lua b/lua/plugins/init.lua index f2330841..9fb2b341 100644 --- a/lua/plugins/init.lua +++ b/lua/plugins/init.lua @@ -28,6 +28,8 @@ require('packer').startup(function() -- use 'folke/lsp-colors.nvim' use 'folke/trouble.nvim' use 'glepnir/lspsaga.nvim' + use 'arkav/lualine-lsp-progress' + -- use 'nvim-lua/lsp-status.nvim' -- use 'ray-x/lsp_signature.nvim' diff --git a/plugin/packer_compiled.lua b/plugin/packer_compiled.lua index 2124801f..9f342cd3 100644 --- a/plugin/packer_compiled.lua +++ b/plugin/packer_compiled.lua @@ -164,6 +164,11 @@ _G.packer_plugins = { path = "/Users/kailuo/.local/share/nvim/site/pack/packer/start/lspsaga.nvim", url = "https://github.com/glepnir/lspsaga.nvim" }, + ["lualine-lsp-progress"] = { + loaded = true, + path = "/Users/kailuo/.local/share/nvim/site/pack/packer/start/lualine-lsp-progress", + url = "https://github.com/arkav/lualine-lsp-progress" + }, ["lualine.nvim"] = { loaded = true, path = "/Users/kailuo/.local/share/nvim/site/pack/packer/start/lualine.nvim", From a68c3b82ebc381982b62c888f0b885d7b38c85f2 Mon Sep 17 00:00:00 2001 From: kaiv2 Date: Sat, 19 Mar 2022 11:25:12 +0800 Subject: [PATCH 0091/1278] update --- lua/lsp/init.lua | 20 ++++++++++++++++++-- lua/lsp/rust_analyzer.lua | 22 ++++++++++++++++++++++ lua/plugins/config/rust-tools.lua | 20 -------------------- lua/plugins/init.lua | 1 - 4 files changed, 40 insertions(+), 23 deletions(-) create mode 100644 lua/lsp/rust_analyzer.lua delete mode 100644 lua/plugins/config/rust-tools.lua diff --git a/lua/lsp/init.lua b/lua/lsp/init.lua index e4812f67..32a6b70d 100644 --- a/lua/lsp/init.lua +++ b/lua/lsp/init.lua @@ -10,8 +10,8 @@ local servers = { clangd = require 'lsp.c', tsserver = require("lsp.tsserver"), html = require("lsp.html"), - pyright = require("lsp.pyright") - -- rust_analyzer = require 'lsp.rust', + pyright = require("lsp.pyright"), + rust_analyzer = require 'lsp.rust_analyzer', } -- 自动安装 LanguageServers @@ -49,6 +49,22 @@ lsp_installer.on_server_ready(function(server) debounce_text_changes = 150, } opts.capabilities = capabilities; + end + + if server.name == "rust_analyzer" then + -- Initialize the LSP via rust-tools instead + require("rust-tools").setup { + -- The "server" property provided in rust-tools setup function are the + -- settings rust-tools will provide to lspconfig during init. -- + -- We merge the necessary settings from nvim-lsp-installer (server:get_default_options()) + -- with the user's own settings (opts). + dap = m.dap, + server = vim.tbl_deep_extend("force", server:get_default_options(), opts), + } + server:attach_buffers() + -- Only if standalone support is needed + require("rust-tools").start_standalone_if_required() + else server:setup(opts) end end) diff --git a/lua/lsp/rust_analyzer.lua b/lua/lsp/rust_analyzer.lua new file mode 100644 index 00000000..8e2457cc --- /dev/null +++ b/lua/lsp/rust_analyzer.lua @@ -0,0 +1,22 @@ +local M = {} + +-- Update this path +local extension_path = '/Users/kailuo/.vscode/extensions/vadimcn.vscode-lldb-1.7.0/' +local codelldb_path = extension_path .. 'adapter/codelldb' +local liblldb_path = extension_path .. 'lldb/lib/liblldb.dylib' + +M.config = { + -- ... other configs +} +M.dap = { + adapter = require('rust-tools.dap').get_codelldb_adapter( + codelldb_path, liblldb_path) +} + + + + +M.on_attach = function (_, _) +end + +return M; diff --git a/lua/plugins/config/rust-tools.lua b/lua/plugins/config/rust-tools.lua deleted file mode 100644 index 9c326208..00000000 --- a/lua/plugins/config/rust-tools.lua +++ /dev/null @@ -1,20 +0,0 @@ - --- Update this path -local extension_path = '/Users/kailuo/.vscode/extensions/vadimcn.vscode-lldb-1.6.10/' -local codelldb_path = extension_path .. 'adapter/codelldb' -local liblldb_path = extension_path .. 'lldb/lib/liblldb.dylib' - -local opts = { - -- ... other configs - dap = { - adapter = require('rust-tools.dap').get_codelldb_adapter( - codelldb_path, liblldb_path) - } -} - --- Normal setup -require('rust-tools').setup(opts) - - -local map = vim.api.nvim_set_keymap -require('keybindings').maplsp(map) diff --git a/lua/plugins/init.lua b/lua/plugins/init.lua index 9fb2b341..a4420c13 100644 --- a/lua/plugins/init.lua +++ b/lua/plugins/init.lua @@ -195,6 +195,5 @@ require('plugins/config/nvim-autopairs') -- require('plugins/config/lsp_signature') require('plugins/config/nvim-dap') require('plugins/config/markdown-preview') -require('plugins/config/rust-tools') require("telescope").load_extension("notify") From 77cd827c3369c2e61d51850edc4b06a1343aba76 Mon Sep 17 00:00:00 2001 From: kaiv2 Date: Tue, 22 Mar 2022 14:49:06 +0800 Subject: [PATCH 0092/1278] update --- init.lua | 2 +- lua/basic.lua | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/init.lua b/init.lua index cc280a9c..162e6d1d 100644 --- a/init.lua +++ b/init.lua @@ -4,5 +4,5 @@ require('lsp') require('keybindings') -- vim.api.nvim_command('colorscheme gruvbox') -vim.cmd("colorscheme gruvbox") vim.cmd("highlight Normal guibg=NONE ctermbg=None") +vim.cmd("colorscheme gruvbox") diff --git a/lua/basic.lua b/lua/basic.lua index 0f214772..ce9abf49 100644 --- a/lua/basic.lua +++ b/lua/basic.lua @@ -86,9 +86,10 @@ set signcolumn=yes " set signcolumn=number set mouse=n if exists('g:neovide') + " let g:neovide_refresh_rate=60 let g:neovide_cursor_vfx_mode = "railgun" set guifont=DejaVuSansMono\ Nerd\ Font:h14 - let g:neovide_transparency=0.8 + let g:neovide_transparency=1 " let g:neovide_fullscreen=v:true let g:neovide_remember_window_size = v:true let g:neovide_input_use_logo=v:true From 1bcc3887ec99809811b804b6065441185380984a Mon Sep 17 00:00:00 2001 From: kaiv2 Date: Tue, 22 Mar 2022 14:57:31 +0800 Subject: [PATCH 0093/1278] update --- init.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/init.lua b/init.lua index 162e6d1d..9324ea34 100644 --- a/init.lua +++ b/init.lua @@ -4,5 +4,5 @@ require('lsp') require('keybindings') -- vim.api.nvim_command('colorscheme gruvbox') -vim.cmd("highlight Normal guibg=NONE ctermbg=None") +-- vim.cmd("highlight Normal guibg=NONE ctermbg=None") vim.cmd("colorscheme gruvbox") From 237b83df59ab95bffe4bffc9e42e7122237a5b31 Mon Sep 17 00:00:00 2001 From: kaiv2 Date: Tue, 22 Mar 2022 15:03:25 +0800 Subject: [PATCH 0094/1278] update --- init.lua | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/init.lua b/init.lua index 9324ea34..18724656 100644 --- a/init.lua +++ b/init.lua @@ -4,5 +4,9 @@ require('lsp') require('keybindings') -- vim.api.nvim_command('colorscheme gruvbox') --- vim.cmd("highlight Normal guibg=NONE ctermbg=None") -vim.cmd("colorscheme gruvbox") +vim.cmd[[ +colorscheme gruvbox +set background=dark +" 丢失配色, 变为透明 +highlight Normal guibg=NONE ctermbg=None +]] From 130263d52873da208f6e6725f9634b8ba9e3034d Mon Sep 17 00:00:00 2001 From: kaiv2 Date: Mon, 28 Mar 2022 10:51:00 +0800 Subject: [PATCH 0095/1278] update --- lua/keybindings.lua | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/lua/keybindings.lua b/lua/keybindings.lua index 0ecdef38..a38c8c27 100644 --- a/lua/keybindings.lua +++ b/lua/keybindings.lua @@ -80,6 +80,19 @@ vim.cmd([[ nnoremap dr :lua require("dapui").float_element(vim.Nil, { enter = true}) ]]) +-- bufferline.nvim +vim.cmd[[ +nnoremap 1 BufferLineGoToBuffer 1 +nnoremap 2 BufferLineGoToBuffer 2 +nnoremap 3 BufferLineGoToBuffer 3 +nnoremap 4 BufferLineGoToBuffer 4 +nnoremap 5 BufferLineGoToBuffer 5 +nnoremap 6 BufferLineGoToBuffer 6 +nnoremap 7 BufferLineGoToBuffer 7 +nnoremap 8 BufferLineGoToBuffer 8 +nnoremap 9 BufferLineGoToBuffer 9 +]] + local pluginKeys = {} -- lsp 回调函数快捷键设置 From abe7a11d7a59c265f30f676280101acb04993fa2 Mon Sep 17 00:00:00 2001 From: kaiv2 Date: Fri, 1 Apr 2022 11:09:34 +0800 Subject: [PATCH 0096/1278] update --- ftplugin/java.lua | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/ftplugin/java.lua b/ftplugin/java.lua index 95ad7e1a..c4853635 100644 --- a/ftplugin/java.lua +++ b/ftplugin/java.lua @@ -15,6 +15,7 @@ local project_name = vim.fn.fnamemodify(vim.fn.getcwd(), ':p:h:t') -- local workspace_dir = '/Users/kailuo/jdtls-workspace/' .. project_name local workspace_dir = '/Users/kailuo/jdtls-workspace/' .. project_name +local jdtls_launcher = vim.fn.glob("/opt/software/lsp/jdtls/plugins/org.eclipse.equinox.launcher_*.jar"); -- See `:help vim.lsp.start_client` for an overview of the supported `config` options. local config = { -- The command that starts the language server @@ -36,8 +37,8 @@ local config = { '--add-modules=ALL-SYSTEM', '--add-opens', 'java.base/java.util=ALL-UNNAMED', '--add-opens', 'java.base/java.lang=ALL-UNNAMED', - '-jar', '/opt/software/jdtls/plugins/org.eclipse.equinox.launcher_1.6.400.v20210924-0641.jar', - '-configuration', '/opt/software/jdtls/config_mac', + '-jar', jdtls_launcher, + '-configuration', '/opt/software/lsp/jdtls/config_mac', '-data', workspace_dir, }, filetypes = {"java"}, From b5d45dae05019b2fe8622a20e9687501487713be Mon Sep 17 00:00:00 2001 From: kaiv2 Date: Tue, 5 Apr 2022 15:50:47 +0800 Subject: [PATCH 0097/1278] nvim-tree auto close feature has been removed --- lua/plugins/config/nvim-tree.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lua/plugins/config/nvim-tree.lua b/lua/plugins/config/nvim-tree.lua index 52da8c59..1bb881e4 100644 --- a/lua/plugins/config/nvim-tree.lua +++ b/lua/plugins/config/nvim-tree.lua @@ -3,7 +3,7 @@ require'nvim-tree'.setup { hijack_netrw = true, open_on_setup = false, ignore_ft_on_setup = { "dashboard" }, - auto_close = true, + -- auto_close = true, auto_reload_on_write = true, open_on_tab = false, hijack_cursor = false, From f45c638f7002d2407cbea699df8cab7ace64aba4 Mon Sep 17 00:00:00 2001 From: kaiv2 Date: Fri, 8 Apr 2022 09:27:09 +0800 Subject: [PATCH 0098/1278] =?UTF-8?q?=E5=8E=BB=E6=8E=89=E9=80=8F=E6=98=8E?= =?UTF-8?q?=E8=83=8C=E6=99=AF=E9=85=8D=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- init.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/init.lua b/init.lua index 18724656..89832c41 100644 --- a/init.lua +++ b/init.lua @@ -8,5 +8,5 @@ vim.cmd[[ colorscheme gruvbox set background=dark " 丢失配色, 变为透明 -highlight Normal guibg=NONE ctermbg=None +" highlight Normal guibg=NONE ctermbg=None ]] From 0a27df8c2efd0dcde1041ae227f3792af442608e Mon Sep 17 00:00:00 2001 From: kaiv2 Date: Fri, 8 Apr 2022 10:09:27 +0800 Subject: [PATCH 0099/1278] update --- lua/keybindings.lua | 8 ++++---- lua/plugins/init.lua | 6 ++++-- plugin/packer_compiled.lua | 5 ----- 3 files changed, 8 insertions(+), 11 deletions(-) diff --git a/lua/keybindings.lua b/lua/keybindings.lua index a38c8c27..dbf23574 100644 --- a/lua/keybindings.lua +++ b/lua/keybindings.lua @@ -102,8 +102,8 @@ pluginKeys.maplsp = function(mapbuf) mapbuf('n', 'K', 'lua vim.lsp.buf.hover()', opt) -- rename - -- mapbuf('n', 'rn', 'lua vim.lsp.buf.rename()', opt) - mapbuf('n', 'rn', 'lua require("lspsaga.rename").rename()', opt) + mapbuf('n', 'rn', 'lua vim.lsp.buf.rename()', opt) + -- mapbuf('n', 'rn', 'lua require("lspsaga.rename").rename()', opt) -- code action mapbuf('n', 'ca', 'lua vim.lsp.buf.code_action()', opt) -- mapbuf('n', 'ca', 'lua require("lspsaga.codeaction").code_action()', opt) @@ -113,8 +113,8 @@ pluginKeys.maplsp = function(mapbuf) -- mapbuf('n', 'gD', 'lua vim.lsp.buf.declaration()', opt) mapbuf('n', 'gD', 'lua vim.lsp.buf.type_definition()', opt) mapbuf('n', 'gi', 'lua vim.lsp.buf.implementation()', opt) - -- mapbuf('n', 'gr', 'lua vim.lsp.buf.references()', opt) - mapbuf('n', 'gr', 'lua require"lspsaga.provider".lsp_finder()', opt) + mapbuf('n', 'gr', 'lua vim.lsp.buf.references()', opt) + -- mapbuf('n', 'gr', 'lua require"lspsaga.provider".lsp_finder()', opt) -- mapbuf('n', 's', 'lua vim.lsp.buf.workspace_symbol()', opt) mapbuf('n', 's', 'lua require"telescope.builtin".lsp_workspace_symbols({ query = vim.fn.input("Query> ") })', opt) -- diagnostic diff --git a/lua/plugins/init.lua b/lua/plugins/init.lua index a4420c13..87394bd4 100644 --- a/lua/plugins/init.lua +++ b/lua/plugins/init.lua @@ -27,7 +27,9 @@ require('packer').startup(function() -- lsp 相关 -- use 'folke/lsp-colors.nvim' use 'folke/trouble.nvim' - use 'glepnir/lspsaga.nvim' + + -- java 不友好 + -- use 'glepnir/lspsaga.nvim' use 'arkav/lualine-lsp-progress' -- use 'nvim-lua/lsp-status.nvim' @@ -186,7 +188,7 @@ require('plugins/config/nvim-notify') require('plugins/config/wilder') require('plugins/config/nvim-colorizer') require('plugins/config/comment') -require('plugins/config/lspsaga') +-- require('plugins/config/lspsaga') -- require('plugins/config/formatter') require('plugins/config/telescope') require('plugins/config/dashboard-nvim') diff --git a/plugin/packer_compiled.lua b/plugin/packer_compiled.lua index 9f342cd3..b695f29a 100644 --- a/plugin/packer_compiled.lua +++ b/plugin/packer_compiled.lua @@ -159,11 +159,6 @@ _G.packer_plugins = { path = "/Users/kailuo/.local/share/nvim/site/pack/packer/start/lspkind-nvim", url = "https://github.com/onsails/lspkind-nvim" }, - ["lspsaga.nvim"] = { - loaded = true, - path = "/Users/kailuo/.local/share/nvim/site/pack/packer/start/lspsaga.nvim", - url = "https://github.com/glepnir/lspsaga.nvim" - }, ["lualine-lsp-progress"] = { loaded = true, path = "/Users/kailuo/.local/share/nvim/site/pack/packer/start/lualine-lsp-progress", From 9e75d0c9b364019c1aaa44d1396a270ea9d13e80 Mon Sep 17 00:00:00 2001 From: kaiv2 Date: Fri, 8 Apr 2022 20:16:04 +0800 Subject: [PATCH 0100/1278] =?UTF-8?q?java=E5=8F=8D=E7=BC=96=E8=AF=91?= =?UTF-8?q?=E6=8F=92=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ftplugin/java.lua | 24 +++++++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) diff --git a/ftplugin/java.lua b/ftplugin/java.lua index c4853635..6bc8843d 100644 --- a/ftplugin/java.lua +++ b/ftplugin/java.lua @@ -5,7 +5,7 @@ local env = { local maven_settings = '/opt/software/apache-maven-3.6.3/conf/settings.xml' local function get_maven_settings() - return env.MAVEN_SETTINGS and env.MAVEN_SETTINGS or maven_settings + return env.MAVEN_SETTINGS and env.MAVEN_SETTINGS or maven_settings end @@ -64,6 +64,25 @@ local config = { downloadSources = true, updateSnapshots = true, }, + signatureHelp = { enabled = true }, + contentProvider = { preferred = 'fernflower' }, + completion = { + favoriteStaticMembers = { + "org.hamcrest.MatcherAssert.assertThat", + "org.hamcrest.Matchers.*", + "org.hamcrest.CoreMatchers.*", + "org.junit.jupiter.api.Assertions.*", + "java.util.Objects.requireNonNull", + "java.util.Objects.requireNonNullElse", + "org.mockito.Mockito.*" + } + }; + sources = { + organizeImports = { + starThreshold = 9999; + staticStarThreshold = 9999; + }, + }, configuration = { maven = { -- userSettings = "/opt/software/apache-maven-3.6.3/conf/settings.xml", @@ -113,6 +132,9 @@ local bundles = { -- /opt/software/lsp/java/vscode-java-test/server vim.list_extend(bundles, vim.split(vim.fn.glob("/opt/software/lsp/java/vscode-java-test/server/*.jar"), "\n")); +-- /opt/software/lsp/java/vscode-java-decompiler/server/ +vim.list_extend(bundles, vim.split(vim.fn.glob("/opt/software/lsp/java/vscode-java-decompiler/server/*.jar"), "\n")); + -- /opt/software/lsp/java/vscode-java-dependency/jdtls.ext/ -- vim.list_extend(bundles, vim.split(vim.fn.glob("/opt/software/lsp/java/vscode-java-dependency/jdtls.ext/com.microsoft.jdtls.ext.core/target/com.microsoft.jdtls.ext.core-*.jar"), "\n")); config['init_options'] = { From e894c4513b006cdf9594b10a5570c419870d8ea9 Mon Sep 17 00:00:00 2001 From: kaiv2 Date: Fri, 8 Apr 2022 20:25:34 +0800 Subject: [PATCH 0101/1278] =?UTF-8?q?=E5=8E=BB=E9=99=A4=E5=8A=A0=E8=BD=BD?= =?UTF-8?q?=E5=A4=B1=E8=B4=A5=E7=9A=84=20jar?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ftplugin/java.lua | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/ftplugin/java.lua b/ftplugin/java.lua index 6bc8843d..a8281822 100644 --- a/ftplugin/java.lua +++ b/ftplugin/java.lua @@ -130,7 +130,12 @@ local bundles = { }; -- /opt/software/lsp/java/vscode-java-test/server -vim.list_extend(bundles, vim.split(vim.fn.glob("/opt/software/lsp/java/vscode-java-test/server/*.jar"), "\n")); +-- vim.list_extend(bundles, vim.split(vim.fn.glob("/opt/software/lsp/java/vscode-java-test/server/*.jar"), "\n")); +for _, bundle in ipairs(vim.split(vim.fn.glob("/opt/software/lsp/java/vscode-java-test/server/*.jar"), "\n")) do + if not vim.endswith(bundle, 'com.microsoft.java.test.runner-jar-with-dependencies.jar') then + table.insert(bundles, bundle) + end +end -- /opt/software/lsp/java/vscode-java-decompiler/server/ vim.list_extend(bundles, vim.split(vim.fn.glob("/opt/software/lsp/java/vscode-java-decompiler/server/*.jar"), "\n")); From 3d5a5c687c88225fe2900544d00f80a05ac8fb1b Mon Sep 17 00:00:00 2001 From: kaiv2 Date: Fri, 8 Apr 2022 20:34:36 +0800 Subject: [PATCH 0102/1278] extendedClientCapabilities --- ftplugin/java.lua | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/ftplugin/java.lua b/ftplugin/java.lua index a8281822..e59e8f79 100644 --- a/ftplugin/java.lua +++ b/ftplugin/java.lua @@ -142,8 +142,15 @@ vim.list_extend(bundles, vim.split(vim.fn.glob("/opt/software/lsp/java/vscode-ja -- /opt/software/lsp/java/vscode-java-dependency/jdtls.ext/ -- vim.list_extend(bundles, vim.split(vim.fn.glob("/opt/software/lsp/java/vscode-java-dependency/jdtls.ext/com.microsoft.jdtls.ext.core/target/com.microsoft.jdtls.ext.core-*.jar"), "\n")); + +local jdtls = require('jdtls') + +local extendedClientCapabilities = jdtls.extendedClientCapabilities; +extendedClientCapabilities.resolveAdditionalTextEditsSupport = true; + config['init_options'] = { bundles = bundles; + extendedClientCapabilities = extendedClientCapabilities; } config['on_attach'] = function(client, bufnr) @@ -156,7 +163,6 @@ config['on_attach'] = function(client, bufnr) end -local jdtls = require('jdtls') local capabilities = require('cmp_nvim_lsp').update_capabilities(vim.lsp.protocol.make_client_capabilities()) -- capabilities.experimental = { -- hoverActions = true, @@ -168,6 +174,8 @@ local capabilities = require('cmp_nvim_lsp').update_capabilities(vim.lsp.protoco -- } config.capabilities = capabilities; + + jdtls.start_or_attach(config) local map = vim.api.nvim_set_keymap From f5a8e1581cbb6a342b3368e23ef7bc69447bd7da Mon Sep 17 00:00:00 2001 From: kaiv2 Date: Fri, 8 Apr 2022 21:46:10 +0800 Subject: [PATCH 0103/1278] Trouble config --- lua/keybindings.lua | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/lua/keybindings.lua b/lua/keybindings.lua index dbf23574..8ba5dcca 100644 --- a/lua/keybindings.lua +++ b/lua/keybindings.lua @@ -37,7 +37,8 @@ map('t', ' ', '::FloatermToggle', opt) map('n', 'o', ':Vista!!', opt) -- trouble.nvim -map('n', 'x', 'Trouble', opt) +-- see lsp map +-- map('n', 'x', 'Trouble', opt) -- lspsaga -- map('n', 'K', ':Lspsaga hover_doc', opt) @@ -113,7 +114,8 @@ pluginKeys.maplsp = function(mapbuf) -- mapbuf('n', 'gD', 'lua vim.lsp.buf.declaration()', opt) mapbuf('n', 'gD', 'lua vim.lsp.buf.type_definition()', opt) mapbuf('n', 'gi', 'lua vim.lsp.buf.implementation()', opt) - mapbuf('n', 'gr', 'lua vim.lsp.buf.references()', opt) + -- mapbuf('n', 'gr', 'lua vim.lsp.buf.references()', opt) + mapbuf('n', 'gr', 'Trouble lsp_references', opt) -- mapbuf('n', 'gr', 'lua require"lspsaga.provider".lsp_finder()', opt) -- mapbuf('n', 's', 'lua vim.lsp.buf.workspace_symbol()', opt) mapbuf('n', 's', 'lua require"telescope.builtin".lsp_workspace_symbols({ query = vim.fn.input("Query> ") })', opt) @@ -130,6 +132,10 @@ pluginKeys.maplsp = function(mapbuf) -- mapbuf('n', 'wr', 'lua vim.lsp.buf.remove_workspace_folder()', opt) -- mapbuf('n', 'wl', 'lua print(vim.inspect(vim.lsp.buf.list_workspace_folders()))', opt) -- mapbuf('n', 'D', 'lua vim.lsp.buf.type_definition()', opt) + mapbuf('n', 'xx', 'Trouble', opt) + mapbuf('n', 'xw', 'Trouble workspace_diagnostics', opt) + mapbuf('n', 'xd', 'Trouble document_diagnostics', opt) + mapbuf('n', 'xq', 'Trouble quickfix', opt) end -- nvim-cmp 自动补全 From 52491ea04dd94f01634c3d21cc4727dfe18f6ae8 Mon Sep 17 00:00:00 2001 From: kaiv2 Date: Fri, 8 Apr 2022 22:02:29 +0800 Subject: [PATCH 0104/1278] Trouble config --- lua/keybindings.lua | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/lua/keybindings.lua b/lua/keybindings.lua index 8ba5dcca..e37287fc 100644 --- a/lua/keybindings.lua +++ b/lua/keybindings.lua @@ -109,11 +109,14 @@ pluginKeys.maplsp = function(mapbuf) mapbuf('n', 'ca', 'lua vim.lsp.buf.code_action()', opt) -- mapbuf('n', 'ca', 'lua require("lspsaga.codeaction").code_action()', opt) -- go xx - mapbuf('n', 'gd', 'lua vim.lsp.buf.definition()', opt) + -- mapbuf('n', 'gd', 'lua vim.lsp.buf.definition()', opt) + mapbuf('n', 'gd', 'Trouble lsp_definitions', opt) mapbuf('n', 'gh', 'lua vim.lsp.buf.hover()', opt) -- mapbuf('n', 'gD', 'lua vim.lsp.buf.declaration()', opt) - mapbuf('n', 'gD', 'lua vim.lsp.buf.type_definition()', opt) - mapbuf('n', 'gi', 'lua vim.lsp.buf.implementation()', opt) + -- mapbuf('n', 'gD', 'lua vim.lsp.buf.type_definition()', opt) + mapbuf('n', 'gD', 'Trouble lsp_type_definitions', opt) + -- mapbuf('n', 'gi', 'lua vim.lsp.buf.implementation()', opt) + mapbuf('n', 'gi', 'Trouble lsp_implementations', opt) -- mapbuf('n', 'gr', 'lua vim.lsp.buf.references()', opt) mapbuf('n', 'gr', 'Trouble lsp_references', opt) -- mapbuf('n', 'gr', 'lua require"lspsaga.provider".lsp_finder()', opt) From f626e90c37c6ae263e0151ba4872d952a896bb65 Mon Sep 17 00:00:00 2001 From: kaiv2 Date: Fri, 8 Apr 2022 22:16:16 +0800 Subject: [PATCH 0105/1278] Telescope lsp --- lua/keybindings.lua | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lua/keybindings.lua b/lua/keybindings.lua index e37287fc..5299a4ef 100644 --- a/lua/keybindings.lua +++ b/lua/keybindings.lua @@ -121,7 +121,9 @@ pluginKeys.maplsp = function(mapbuf) mapbuf('n', 'gr', 'Trouble lsp_references', opt) -- mapbuf('n', 'gr', 'lua require"lspsaga.provider".lsp_finder()', opt) -- mapbuf('n', 's', 'lua vim.lsp.buf.workspace_symbol()', opt) - mapbuf('n', 's', 'lua require"telescope.builtin".lsp_workspace_symbols({ query = vim.fn.input("Query> ") })', opt) + -- mapbuf('n', 's', 'lua require"telescope.builtin".lsp_workspace_symbols({ query = vim.fn.input("Query> ") })', opt) + mapbuf('n', 'sw', 'Telescope lsp_dynamic_workspace_symbols', opt) + mapbuf('n', 'sd', 'Telescope lsp_document_symbols', opt) -- diagnostic mapbuf('n', 'go', 'lua vim.diagnostic.open_float()', opt) mapbuf('n', '[g', 'lua vim.diagnostic.goto_prev()', opt) From 7271f3f437d66edd3c632620d40762eda06a4f45 Mon Sep 17 00:00:00 2001 From: kaiv2 Date: Sat, 9 Apr 2022 19:34:36 +0800 Subject: [PATCH 0106/1278] update readme --- README.md | 28 +++++++++++++++------------- 1 file changed, 15 insertions(+), 13 deletions(-) diff --git a/README.md b/README.md index b857bf94..3d31dfdd 100644 --- a/README.md +++ b/README.md @@ -1,14 +1,16 @@ -# VIM 插件列表 - -| 插件名称 | 插件描述 | 推荐等级 | 备注 | -| ------------------------------------------------------------------ | -------------------------------------------- | -------- | -- | -| [nvim-cmp](https://github.com/hrsh7th/nvim-cmp) | LSP 代码提示插件 | 10 | | -| [lspsaga.nvim](https://github.com/glepnir/lspsaga.nvim) | LSP 代码提示文档等浮动窗口 | 10 | | -| [formatter.nvim](https://github.com/mhartington/formatter.nvim) | 代码格式化插件 | 7 | | -| [telescope.nvim](https://github.com/nvim-telescope/telescope.nvim) | 模糊查找插件,窗口预览 | 8 | | -| [lualine.nvim](https://github.com/nvim-lualine/lualine.nvim) | 状态栏插件 | 8 | | -| [hop.nvim](https://github.com/phaazon/hop.nvim) | 快速跳转插件 | 6 | | -| [vim-table-mode](https://github.com/dhruvasagar/vim-table-mode) | table 模式插件 | 10 | | -| [coc.nvim](https://github.com/neoclide/coc.nvim) | VIM NodeJs 扩展,让 VIM 实现类似 VSCODE 功能 | 10 | | -| [vim-airline](https://github.com/vim-airline/vim-airline) | VIM 插件 | 9 | | +# NVIM IDE +支持 `Java`, `Rust`, `C/C++`, `JavaScript` 等编程语言开发。 + +## Java 配置 + +[NVIM 打造 Java IDE](https://javahello.github.io/dev/tools/NVIM-LSP-Java-IDE.html) + +## VIM 插件列表 + +| 插件名称 | 插件描述 | 推荐等级 | 备注 | +| ------------------------------------------------------------------ | ---------------------- | -------- | ---- | +| [nvim-cmp](https://github.com/hrsh7th/nvim-cmp) | LSP 代码提示插件 | 10 | | +| [telescope.nvim](https://github.com/nvim-telescope/telescope.nvim) | 模糊查找插件,窗口预览 | 8 | | +| [lualine.nvim](https://github.com/nvim-lualine/lualine.nvim) | 状态栏插件 | 8 | | +| [vim-table-mode](https://github.com/dhruvasagar/vim-table-mode) | table 模式插件 | 10 | | From c154c9f7e4488a6b5781d24ae551ce6347730718 Mon Sep 17 00:00:00 2001 From: kaiv2 Date: Sat, 9 Apr 2022 19:54:48 +0800 Subject: [PATCH 0107/1278] update --- README.md | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/README.md b/README.md index 3d31dfdd..6580df23 100644 --- a/README.md +++ b/README.md @@ -6,6 +6,13 @@ [NVIM 打造 Java IDE](https://javahello.github.io/dev/tools/NVIM-LSP-Java-IDE.html) +### 功能演示 + +- 查看引用 + ![001](https://javahello.github.io/dev/nvim-lean/images/java-ref-001.gif) +- 查看实现 + ![002](https://javahello.github.io/dev/nvim-lean/images/java-impl-002.gif) + ## VIM 插件列表 | 插件名称 | 插件描述 | 推荐等级 | 备注 | From 96a3d94391284111ed6339d6d2e183236c8dc538 Mon Sep 17 00:00:00 2001 From: kaiv2 Date: Sat, 9 Apr 2022 20:05:42 +0800 Subject: [PATCH 0108/1278] update --- README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README.md b/README.md index 6580df23..0514fe47 100644 --- a/README.md +++ b/README.md @@ -12,6 +12,8 @@ ![001](https://javahello.github.io/dev/nvim-lean/images/java-ref-001.gif) - 查看实现 ![002](https://javahello.github.io/dev/nvim-lean/images/java-impl-002.gif) +- 搜索`class`,`method`,`field`等 + ![003](https://javahello.github.io/dev/nvim-lean/images/java-impl-002.gif) ## VIM 插件列表 From ece9ad1b4f8001a4c12cbf1928a24860b4d85b2e Mon Sep 17 00:00:00 2001 From: kaiv2 Date: Sat, 9 Apr 2022 20:06:32 +0800 Subject: [PATCH 0109/1278] update --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 0514fe47..425f5453 100644 --- a/README.md +++ b/README.md @@ -13,7 +13,7 @@ - 查看实现 ![002](https://javahello.github.io/dev/nvim-lean/images/java-impl-002.gif) - 搜索`class`,`method`,`field`等 - ![003](https://javahello.github.io/dev/nvim-lean/images/java-impl-002.gif) + ![003](https://javahello.github.io/dev/nvim-lean/images/java-symbols-003.gif) ## VIM 插件列表 From 2cdc452310150225a57a90d9646ab894e8aa171d Mon Sep 17 00:00:00 2001 From: kaiv2 Date: Sat, 9 Apr 2022 20:19:23 +0800 Subject: [PATCH 0110/1278] update --- lua/keybindings.lua | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/lua/keybindings.lua b/lua/keybindings.lua index 5299a4ef..db2300e2 100644 --- a/lua/keybindings.lua +++ b/lua/keybindings.lua @@ -107,7 +107,7 @@ pluginKeys.maplsp = function(mapbuf) -- mapbuf('n', 'rn', 'lua require("lspsaga.rename").rename()', opt) -- code action mapbuf('n', 'ca', 'lua vim.lsp.buf.code_action()', opt) - -- mapbuf('n', 'ca', 'lua require("lspsaga.codeaction").code_action()', opt) + -- mapbuf('n', 'ca', 'lua require("lspsaga.codeaction").code_action()', opt) -- go xx -- mapbuf('n', 'gd', 'lua vim.lsp.buf.definition()', opt) mapbuf('n', 'gd', 'Trouble lsp_definitions', opt) @@ -117,8 +117,10 @@ pluginKeys.maplsp = function(mapbuf) mapbuf('n', 'gD', 'Trouble lsp_type_definitions', opt) -- mapbuf('n', 'gi', 'lua vim.lsp.buf.implementation()', opt) mapbuf('n', 'gi', 'Trouble lsp_implementations', opt) + mapbuf('n', 'gi', 'Telescope lsp_implementations', opt) -- mapbuf('n', 'gr', 'lua vim.lsp.buf.references()', opt) - mapbuf('n', 'gr', 'Trouble lsp_references', opt) + mapbuf('n', 'gr', 'Trouble lsp_references', opt) + mapbuf('n', 'gr', 'Telescope lsp_references', opt) -- mapbuf('n', 'gr', 'lua require"lspsaga.provider".lsp_finder()', opt) -- mapbuf('n', 's', 'lua vim.lsp.buf.workspace_symbol()', opt) -- mapbuf('n', 's', 'lua require"telescope.builtin".lsp_workspace_symbols({ query = vim.fn.input("Query> ") })', opt) From e52a605ebf173836ff649c47662c882e5c60c206 Mon Sep 17 00:00:00 2001 From: kaiv2 Date: Sun, 10 Apr 2022 20:40:40 +0800 Subject: [PATCH 0111/1278] java config --- ftplugin/java.lua | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/ftplugin/java.lua b/ftplugin/java.lua index e59e8f79..503bef88 100644 --- a/ftplugin/java.lua +++ b/ftplugin/java.lua @@ -54,6 +54,26 @@ local config = { settings = { java = { home = "/Library/Java/JavaVirtualMachines/zulu-11.jdk/Contents/Home", + project = { + resourceFilters = { + "node_modules", + ".git", + }, + }, + templates = { + fileHeader = { + "/**", + " * ${type_name}", + " * @author ${user}", + " */", + }, + typeComment = { + "/**", + " * ${type_name}", + " * @author ${user}", + " */", + }, + }, eclipse = { downloadSources = true, }, From 19d619c228491e43f070b75f8162f08696851347 Mon Sep 17 00:00:00 2001 From: kaiv2 Date: Sun, 10 Apr 2022 20:54:24 +0800 Subject: [PATCH 0112/1278] update --- ftplugin/java.lua | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/ftplugin/java.lua b/ftplugin/java.lua index 503bef88..a1d69d2a 100644 --- a/ftplugin/java.lua +++ b/ftplugin/java.lua @@ -60,6 +60,16 @@ local config = { ".git", }, }, + import = { + exclusions = { + "**/node_modules/**", + "**/.metadata/**", + "**/archetype-resources/**", + "**/META-INF/maven/**", + "**/.git/**", + "**/.idea/**", + }, + }, templates = { fileHeader = { "/**", From d907b02cfc4578bd9081e3046836022a9a060ab9 Mon Sep 17 00:00:00 2001 From: kaiv2 Date: Sun, 10 Apr 2022 21:05:37 +0800 Subject: [PATCH 0113/1278] update --- ftplugin/java.lua | 3 +++ 1 file changed, 3 insertions(+) diff --git a/ftplugin/java.lua b/ftplugin/java.lua index a1d69d2a..988e165a 100644 --- a/ftplugin/java.lua +++ b/ftplugin/java.lua @@ -58,6 +58,7 @@ local config = { resourceFilters = { "node_modules", ".git", + ".idea" }, }, import = { @@ -70,6 +71,8 @@ local config = { "**/.idea/**", }, }, + -- referenceCodeLens = { enabled = true }, + -- implementationsCodeLens = { enabled = true }, templates = { fileHeader = { "/**", From 28e7f6f1807d742edad610b8155d884d937df9d9 Mon Sep 17 00:00:00 2001 From: kaiv2 Date: Tue, 12 Apr 2022 21:37:11 +0800 Subject: [PATCH 0114/1278] nvim-treesitter config update --- lua/plugins/config/nvim-treesitter.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lua/plugins/config/nvim-treesitter.lua b/lua/plugins/config/nvim-treesitter.lua index e61e757c..df3cac6b 100644 --- a/lua/plugins/config/nvim-treesitter.lua +++ b/lua/plugins/config/nvim-treesitter.lua @@ -1,6 +1,6 @@ require'nvim-treesitter.configs'.setup { -- One of "all", "maintained" (parsers with maintainers), or a list of languages - ensure_installed = "maintained", + ensure_installed = "all", -- Install languages synchronously (only applied to `ensure_installed`) sync_install = false, From b9e0d1dfec622a62c97370f1d298c19d63724564 Mon Sep 17 00:00:00 2001 From: kaiv2 Date: Tue, 12 Apr 2022 21:39:13 +0800 Subject: [PATCH 0115/1278] md preview name --- lua/plugins/config/markdown-preview.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lua/plugins/config/markdown-preview.lua b/lua/plugins/config/markdown-preview.lua index f0e284c5..13a23f5d 100644 --- a/lua/plugins/config/markdown-preview.lua +++ b/lua/plugins/config/markdown-preview.lua @@ -84,7 +84,7 @@ let g:mkdp_port = '' " preview page title " ${name} will be replace with the file name -let g:mkdp_page_title = '「${name}」' +let g:mkdp_page_title = '${name}' " recognized filetypes " these filetypes will have MarkdownPreview... commands From 2a47187c3acb5d0300cbfec9bbc3df7b7b8e0e9b Mon Sep 17 00:00:00 2001 From: kaiv2 Date: Tue, 12 Apr 2022 22:06:52 +0800 Subject: [PATCH 0116/1278] current_line_blame_formatter --- lua/plugins/config/gitsigns-nvim.lua | 1 + 1 file changed, 1 insertion(+) diff --git a/lua/plugins/config/gitsigns-nvim.lua b/lua/plugins/config/gitsigns-nvim.lua index 1baf7e18..82375cd7 100644 --- a/lua/plugins/config/gitsigns-nvim.lua +++ b/lua/plugins/config/gitsigns-nvim.lua @@ -23,6 +23,7 @@ require('gitsigns').setup { delay = 400, ignore_whitespace = false, }, + current_line_blame_formatter = ', - ', current_line_blame_formatter_opts = { relative_time = false }, From 35252c4743ac29b7f606d359727352682cd1131f Mon Sep 17 00:00:00 2001 From: kaiv2 Date: Wed, 13 Apr 2022 09:15:45 +0800 Subject: [PATCH 0117/1278] config --- lua/plugins/config/nvim-tree.lua | 73 +++++++++++++++++++++++++------- lua/plugins/config/telescope.lua | 53 +++++++++++++++++++++-- 2 files changed, 107 insertions(+), 19 deletions(-) diff --git a/lua/plugins/config/nvim-tree.lua b/lua/plugins/config/nvim-tree.lua index 1bb881e4..500a8d57 100644 --- a/lua/plugins/config/nvim-tree.lua +++ b/lua/plugins/config/nvim-tree.lua @@ -9,14 +9,24 @@ require'nvim-tree'.setup { hijack_cursor = false, update_cwd = false, actions = { + use_system_clipboard = true, + change_dir = { + enable = true, + global = false, + }, open_file = { quit_on_open = true, + resize_window = true, + window_picker = { + enable = true, + chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890", + exclude = { + filetype = { "notify", "packer", "qf", "diff", "fugitive", "fugitiveblame" }, + buftype = { "nofile", "terminal", "help" }, + }, + }, }, }, - update_to_buf_dir = { - enable = false, - auto_open = false, - }, diagnostics = { enable = false, icons = { @@ -37,26 +47,36 @@ require'nvim-tree'.setup { }, filters = { dotfiles = false, - custom = {".git"} + custom = {".git"}, }, git = { enable = true, ignore = true, - timeout = 500, + timeout = 400, }, view = { width = '40%', height = '40%', hide_root_folder = true, side = 'left', - auto_resize = true, + preserve_window_proportions = false, + number = false, + relativenumber = false, + signcolumn = "yes", mappings = { custom_only = false, list = {} }, - number = false, - relativenumber = false, - signcolumn = "yes" + }, + renderer = { + indent_markers = { + enable = true, + icons = { + corner = "└ ", + edge = "│ ", + none = " ", + }, + }, }, trash = { cmd = "trash", @@ -73,14 +93,37 @@ g.nvim_tree_indent_markers = 1 g.nvim_tree_special_files = {} g.nvim_tree_window_picker_exclude = { - filetype = { "notify", "packer", "qf" }, - buftype = { "terminal" }, + filetype = { "notify", "packer", "qf" }, + buftype = { "terminal" }, } +-- g.nvim_tree_icons = { +-- default = "", +-- symlink = "", +-- git = { +-- deleted = "", +-- ignored = "◌", +-- renamed = "➜", +-- staged = "✓", +-- unmerged = "", +-- unstaged = "✗", +-- untracked = "★", +-- }, +-- folder = { +-- default = "", +-- empty = "", +-- empty_open = "", +-- open = "", +-- symlink = "", +-- symlink_open = "", +-- }, +-- } + + g.nvim_tree_show_icons = { - folders = 1, - files = 1, - git = 1, + folders = 1, + files = 1, + git = 1, } diff --git a/lua/plugins/config/telescope.lua b/lua/plugins/config/telescope.lua index bbbdee63..e1b0c437 100644 --- a/lua/plugins/config/telescope.lua +++ b/lua/plugins/config/telescope.lua @@ -2,6 +2,53 @@ local actions = require("telescope.actions") local trouble = require("trouble.providers.telescope") require('telescope').setup{ defaults = { + vimgrep_arguments = { + "rg", + "--color=never", + "--no-heading", + "--with-filename", + "--line-number", + "--column", + "--smart-case", + }, + prompt_prefix = "  ", + selection_caret = " ", + entry_prefix = " ", + initial_mode = "insert", + selection_strategy = "reset", + sorting_strategy = "ascending", + layout_strategy = "horizontal", + layout_config = { + horizontal = { + prompt_position = "top", + preview_width = 0.55, + results_width = 0.8, + }, + vertical = { + mirror = false, + }, + width = 0.87, + height = 0.80, + preview_cutoff = 120, + }, + winblend = 0, + border = {}, + borderchars = { "─", "│", "─", "│", "╭", "╮", "╯", "╰" }, + color_devicons = true, + use_less = true, + -- set_env = { ["COLORTERM"] = "gruvbox" }, -- default = nil, + file_sorter = require("telescope.sorters").get_fuzzy_file, + file_ignore_patterns = { "node_modules" }, + generic_sorter = require("telescope.sorters").get_generic_fuzzy_sorter, + path_display = { "truncate" }, + file_previewer = require("telescope.previewers").vim_buffer_cat.new, + grep_previewer = require("telescope.previewers").vim_buffer_vimgrep.new, + qflist_previewer = require("telescope.previewers").vim_buffer_qflist.new, + -- Developer configurations: Not meant for general override + buffer_previewer_maker = require("telescope.previewers").buffer_previewer_maker, + + + -- Default configuration for telescope goes here: -- config_key = value, mappings = { @@ -11,10 +58,10 @@ require('telescope').setup{ -- e.g. git_{create, delete, ...}_branch for the git_branches picker [""] = "which_key", -- [""] = actions.close, - -- [""] = trouble.open_with_trouble, + -- [""] = trouble.open_with_trouble, }, n = { - -- [""] = trouble.open_with_trouble, + -- [""] = trouble.open_with_trouble, } } }, @@ -27,8 +74,6 @@ require('telescope').setup{ -- Now the picker_config_key will be applied every time you call this -- builtin picker }, - file_ignore_patterns = { "node_modules" }, - path_display = { "truncate" }, extensions = { -- Your extension configuration goes here: -- extension_name = { From b9dd74b33a75dad4bf3bb80ea9348b35e27e9c87 Mon Sep 17 00:00:00 2001 From: kaiv2 Date: Wed, 13 Apr 2022 20:41:06 +0800 Subject: [PATCH 0118/1278] close buf --- lua/keybindings.lua | 2 +- lua/my_tools/init.lua | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/lua/keybindings.lua b/lua/keybindings.lua index db2300e2..da7a59d0 100644 --- a/lua/keybindings.lua +++ b/lua/keybindings.lua @@ -16,7 +16,7 @@ map('n', 'v', '"+p', opt) map('n', '', ':nohlsearch', opt) -- %bd 删除所有缓冲区, e# 打开最后一个缓冲区, bd# 关闭[No Name] -- map('n', 'o', ':%bd|e#|bd#', opt) -map('n', 'o', 'lua require("my_tools").close_other_buf()', opt) +map('n', 'o', 'lua require("my_tools").close_other_bufline()', opt) map('n', 'w', ':bdel', opt) -- " 退出 terminal 模式 map('t', '', '', opt) diff --git a/lua/my_tools/init.lua b/lua/my_tools/init.lua index c11ab1a3..8be7776e 100644 --- a/lua/my_tools/init.lua +++ b/lua/my_tools/init.lua @@ -25,4 +25,8 @@ M.close_other_buf = function () end end +M.close_other_bufline = function () + vim.fn.execute('BufferLineCloseLeft') + vim.fn.execute('BufferLineCloseRight') +end return M From 84468b61f6071971c818ac2a76676fd18e068a6f Mon Sep 17 00:00:00 2001 From: kaiv2 Date: Wed, 13 Apr 2022 20:43:31 +0800 Subject: [PATCH 0119/1278] nvimtree config --- lua/plugins/config/nvim-tree.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lua/plugins/config/nvim-tree.lua b/lua/plugins/config/nvim-tree.lua index 500a8d57..ffacfa22 100644 --- a/lua/plugins/config/nvim-tree.lua +++ b/lua/plugins/config/nvim-tree.lua @@ -6,7 +6,7 @@ require'nvim-tree'.setup { -- auto_close = true, auto_reload_on_write = true, open_on_tab = false, - hijack_cursor = false, + hijack_cursor = true, update_cwd = false, actions = { use_system_clipboard = true, From d3430fba8dba7b07491a50037e82e86ad368db2e Mon Sep 17 00:00:00 2001 From: kaiv2 Date: Wed, 13 Apr 2022 21:09:12 +0800 Subject: [PATCH 0120/1278] config --- lua/plugins/config/autosave.lua | 19 +++++++++++++++++++ lua/plugins/config/bufferline.lua | 10 ++++++++-- lua/plugins/config/lualine.lua | 2 +- lua/plugins/init.lua | 3 +++ plugin/packer_compiled.lua | 5 +++++ 5 files changed, 36 insertions(+), 3 deletions(-) create mode 100644 lua/plugins/config/autosave.lua diff --git a/lua/plugins/config/autosave.lua b/lua/plugins/config/autosave.lua new file mode 100644 index 00000000..661d6e0d --- /dev/null +++ b/lua/plugins/config/autosave.lua @@ -0,0 +1,19 @@ +local autosave = require("autosave") + +autosave.setup( + { + enabled = true, + execution_message = "AutoSave: saved at " .. vim.fn.strftime("%H:%M:%S"), + events = {"InsertLeave", "TextChanged"}, + conditions = { + exists = true, + filename_is_not = {}, + filetype_is_not = {}, + modifiable = true + }, + write_all_buffers = false, + on_off_commands = true, + clean_command_line_interval = 0, + debounce_delay = 135 + } +) diff --git a/lua/plugins/config/bufferline.lua b/lua/plugins/config/bufferline.lua index 622f5aec..81c057f4 100644 --- a/lua/plugins/config/bufferline.lua +++ b/lua/plugins/config/bufferline.lua @@ -17,8 +17,14 @@ require("bufferline").setup { text = function() return vim.fn.fnamemodify(vim.fn.getcwd(), ':p:h:t') end, + padding= 1, highlight = "Directory", text_align = "left" - }} - } + }}, + }, + color_icons = true, + show_buffer_close_icons = true, + show_buffer_default_icon = true, + show_close_icon = false, + show_tab_indicators = true, } diff --git a/lua/plugins/config/lualine.lua b/lua/plugins/config/lualine.lua index 7f9b31c8..bb937cb9 100644 --- a/lua/plugins/config/lualine.lua +++ b/lua/plugins/config/lualine.lua @@ -25,5 +25,5 @@ require('lualine').setup { lualine_z = {} }, tabline = {}, - extensions = {} + extensions = { 'nvim-tree' } } diff --git a/lua/plugins/init.lua b/lua/plugins/init.lua index 87394bd4..9079be85 100644 --- a/lua/plugins/init.lua +++ b/lua/plugins/init.lua @@ -166,6 +166,8 @@ require('packer').startup(function() -- rust use 'simrat39/rust-tools.nvim' + + use "Pocco81/AutoSave.nvim" end) require('plugins/config/bufferline') @@ -197,5 +199,6 @@ require('plugins/config/nvim-autopairs') -- require('plugins/config/lsp_signature') require('plugins/config/nvim-dap') require('plugins/config/markdown-preview') +require('plugins/config/autosave') require("telescope").load_extension("notify") diff --git a/plugin/packer_compiled.lua b/plugin/packer_compiled.lua index b695f29a..0832e803 100644 --- a/plugin/packer_compiled.lua +++ b/plugin/packer_compiled.lua @@ -69,6 +69,11 @@ end time([[try_loadstring definition]], false) time([[Defining packer_plugins]], true) _G.packer_plugins = { + ["AutoSave.nvim"] = { + loaded = true, + path = "/Users/kailuo/.local/share/nvim/site/pack/packer/start/AutoSave.nvim", + url = "https://github.com/Pocco81/AutoSave.nvim" + }, ["Comment.nvim"] = { loaded = true, path = "/Users/kailuo/.local/share/nvim/site/pack/packer/start/Comment.nvim", From 47428bdd9dc6722cb52f94089369be291cb6b717 Mon Sep 17 00:00:00 2001 From: kaiv2 Date: Wed, 13 Apr 2022 21:23:48 +0800 Subject: [PATCH 0121/1278] bd! --- lua/keybindings.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lua/keybindings.lua b/lua/keybindings.lua index da7a59d0..e605dbb3 100644 --- a/lua/keybindings.lua +++ b/lua/keybindings.lua @@ -17,7 +17,7 @@ map('n', '', ':nohlsearch', opt) -- %bd 删除所有缓冲区, e# 打开最后一个缓冲区, bd# 关闭[No Name] -- map('n', 'o', ':%bd|e#|bd#', opt) map('n', 'o', 'lua require("my_tools").close_other_bufline()', opt) -map('n', 'w', ':bdel', opt) +map('n', 'w', ':bdelete!', opt) -- " 退出 terminal 模式 map('t', '', '', opt) From 49f934f077fb37842696e89863db99a94592d82a Mon Sep 17 00:00:00 2001 From: kaiv2 Date: Wed, 13 Apr 2022 21:38:57 +0800 Subject: [PATCH 0122/1278] java config --- ftplugin/java.lua | 254 --------------------------------------------- ftplugin/lua.lua | 2 - lua/lsp/init.lua | 6 ++ lua/lsp/java.lua | 258 ++++++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 264 insertions(+), 256 deletions(-) delete mode 100644 ftplugin/java.lua delete mode 100644 ftplugin/lua.lua create mode 100644 lua/lsp/java.lua diff --git a/ftplugin/java.lua b/ftplugin/java.lua deleted file mode 100644 index 988e165a..00000000 --- a/ftplugin/java.lua +++ /dev/null @@ -1,254 +0,0 @@ -local env = { - -- HOME = vim.loop.os_homedir(), - MAVEN_SETTINGS = os.getenv 'MAVEN_SETTINGS', -} - -local maven_settings = '/opt/software/apache-maven-3.6.3/conf/settings.xml' -local function get_maven_settings() - return env.MAVEN_SETTINGS and env.MAVEN_SETTINGS or maven_settings -end - - - -local project_name = vim.fn.fnamemodify(vim.fn.getcwd(), ':p:h:t') - --- local workspace_dir = '/Users/kailuo/jdtls-workspace/' .. project_name -local workspace_dir = '/Users/kailuo/jdtls-workspace/' .. project_name - -local jdtls_launcher = vim.fn.glob("/opt/software/lsp/jdtls/plugins/org.eclipse.equinox.launcher_*.jar"); --- See `:help vim.lsp.start_client` for an overview of the supported `config` options. -local config = { - -- The command that starts the language server - -- See: https://github.com/eclipse/eclipse.jdt.ls#running-from-the-command-line - cmd = { - '/Library/Java/JavaVirtualMachines/zulu-11.jdk/Contents/Home/bin/java', -- or '/path/to/java11_or_newer/bin/java' - '-Declipse.application=org.eclipse.jdt.ls.core.id1', - '-Dosgi.bundles.defaultStartLevel=4', - '-Declipse.product=org.eclipse.jdt.ls.core.product', - '-Dlog.protocol=true', - '-Dlog.level=ALL', - '-XX:+UseParallelGC', - '-XX:GCTimeRatio=4', - '-XX:AdaptiveSizePolicyWeight=90', - '-Dsun.zip.disableMemoryMapping=true', - '-Xms100m', - '-Xmx2g', - '-javaagent:/opt/software/lsp/lombok.jar', - '--add-modules=ALL-SYSTEM', - '--add-opens', 'java.base/java.util=ALL-UNNAMED', - '--add-opens', 'java.base/java.lang=ALL-UNNAMED', - '-jar', jdtls_launcher, - '-configuration', '/opt/software/lsp/jdtls/config_mac', - '-data', workspace_dir, - }, - filetypes = {"java"}, - - -- 💀 - -- This is the default if not provided, you can remove it. Or adjust as needed. - -- One dedicated LSP server & client will be started per unique root_dir - root_dir = require('jdtls.setup').find_root({'.git', 'mvnw', 'gradlew'}), - - -- Here you can configure eclipse.jdt.ls specific settings - -- See https://github.com/eclipse/eclipse.jdt.ls/wiki/Running-the-JAVA-LS-server-from-the-command-line#initialize-request - -- for a list of options - settings = { - java = { - home = "/Library/Java/JavaVirtualMachines/zulu-11.jdk/Contents/Home", - project = { - resourceFilters = { - "node_modules", - ".git", - ".idea" - }, - }, - import = { - exclusions = { - "**/node_modules/**", - "**/.metadata/**", - "**/archetype-resources/**", - "**/META-INF/maven/**", - "**/.git/**", - "**/.idea/**", - }, - }, - -- referenceCodeLens = { enabled = true }, - -- implementationsCodeLens = { enabled = true }, - templates = { - fileHeader = { - "/**", - " * ${type_name}", - " * @author ${user}", - " */", - }, - typeComment = { - "/**", - " * ${type_name}", - " * @author ${user}", - " */", - }, - }, - eclipse = { - downloadSources = true, - }, - server = { - launchMode = "Hybrid", - }, - maven = { - downloadSources = true, - updateSnapshots = true, - }, - signatureHelp = { enabled = true }, - contentProvider = { preferred = 'fernflower' }, - completion = { - favoriteStaticMembers = { - "org.hamcrest.MatcherAssert.assertThat", - "org.hamcrest.Matchers.*", - "org.hamcrest.CoreMatchers.*", - "org.junit.jupiter.api.Assertions.*", - "java.util.Objects.requireNonNull", - "java.util.Objects.requireNonNullElse", - "org.mockito.Mockito.*" - } - }; - sources = { - organizeImports = { - starThreshold = 9999; - staticStarThreshold = 9999; - }, - }, - configuration = { - maven = { --- userSettings = "/opt/software/apache-maven-3.6.3/conf/settings.xml", --- globalSettings = "/opt/software/apache-maven-3.6.3/conf/settings.xml", - userSettings = get_maven_settings(), - globalSettings = get_maven_settings(), - }, - runtimes = { - { - name = "JavaSE-1.8", - path = "/Library/Java/JavaVirtualMachines/zulu-8.jdk/Contents/Home", - }, - { - name = "JavaSE-11", - path = "/Library/Java/JavaVirtualMachines/zulu-11.jdk/Contents/Home", - }, - { - name = "JavaSE-17", - path = "/Library/Java/JavaVirtualMachines/zulu-17.jdk/Contents/Home", - }, - } - }, - } - }, - - -- Language server `initializationOptions` - -- You need to extend the `bundles` with paths to jar files - -- if you want to use additional eclipse.jdt.ls plugins. - -- - -- See https://github.com/mfussenegger/nvim-jdtls#java-debug-installation - -- - -- If you don't plan on using the debugger or other eclipse.jdt.ls plugins you can remove this - -- init_options = { - -- bundles = { - -- vim.fn.glob("/opt/software/lsp/java/java-debug/com.microsoft.java.debug.plugin/target/com.microsoft.java.debug.plugin-0.35.0.jar") - -- }, - -- workspace = workspace_dir - -- }, -} - - --- This bundles definition is the same as in the previous section (java-debug installation) -local bundles = { - vim.fn.glob("/opt/software/lsp/java/java-debug/com.microsoft.java.debug.plugin/target/com.microsoft.java.debug.plugin-*.jar") -}; - --- /opt/software/lsp/java/vscode-java-test/server --- vim.list_extend(bundles, vim.split(vim.fn.glob("/opt/software/lsp/java/vscode-java-test/server/*.jar"), "\n")); -for _, bundle in ipairs(vim.split(vim.fn.glob("/opt/software/lsp/java/vscode-java-test/server/*.jar"), "\n")) do - if not vim.endswith(bundle, 'com.microsoft.java.test.runner-jar-with-dependencies.jar') then - table.insert(bundles, bundle) - end -end - --- /opt/software/lsp/java/vscode-java-decompiler/server/ -vim.list_extend(bundles, vim.split(vim.fn.glob("/opt/software/lsp/java/vscode-java-decompiler/server/*.jar"), "\n")); - --- /opt/software/lsp/java/vscode-java-dependency/jdtls.ext/ --- vim.list_extend(bundles, vim.split(vim.fn.glob("/opt/software/lsp/java/vscode-java-dependency/jdtls.ext/com.microsoft.jdtls.ext.core/target/com.microsoft.jdtls.ext.core-*.jar"), "\n")); - -local jdtls = require('jdtls') - -local extendedClientCapabilities = jdtls.extendedClientCapabilities; -extendedClientCapabilities.resolveAdditionalTextEditsSupport = true; - -config['init_options'] = { - bundles = bundles; - extendedClientCapabilities = extendedClientCapabilities; -} - -config['on_attach'] = function(client, bufnr) - -- With `hotcodereplace = 'auto' the debug adapter will try to apply code changes - -- you make during a debug session immediately. - -- Remove the option if you do not want that. - require('jdtls').setup_dap({ hotcodereplace = 'auto' }) - require('jdtls.setup').add_commands(); - -- require('jdtls.dap').setup_dap_main_class_configs({ verbose = true }) -end - - -local capabilities = require('cmp_nvim_lsp').update_capabilities(vim.lsp.protocol.make_client_capabilities()) --- capabilities.experimental = { --- hoverActions = true, --- hoverRange = true, --- serverStatusNotification = true, --- snippetTextEdit = true, --- codeActionGroup = true, --- ssr = true, --- } - -config.capabilities = capabilities; - - -jdtls.start_or_attach(config) - -local map = vim.api.nvim_set_keymap -require('keybindings').maplsp(map) - -vim.cmd([[ -command! -nargs=0 OR :lua require'jdtls'.organize_imports() -command! -nargs=0 Format :lua vim.lsp.buf.formatting() -nnoremap crv lua require('jdtls').extract_variable() -vnoremap crv lua require('jdtls').extract_variable(true) -nnoremap crc lua require('jdtls').extract_constant() -vnoremap crc lua require('jdtls').extract_constant(true) -vnoremap crm lua require('jdtls').extract_method(true) - - -function! s:jdtls_test_class_ui() - lua require'jdtls'.test_class() - lua require'dapui'.open() -endfunction -function! s:jdtls_test_method_ui() - lua require'jdtls'.test_nearest_method() - lua require'dapui'.open() -endfunction -command! -nargs=0 TestClass :lua require'jdtls'.test_class() -command! -nargs=0 TestMethod :lua require'jdtls'.test_nearest_method() -command! -nargs=0 TestClassUI :call s:jdtls_test_class_ui() -command! -nargs=0 TestMethodUI :call s:jdtls_test_method_ui() -nnoremap dc lua require'jdtls'.test_class() -nnoremap dm lua require'jdtls'.test_nearest_method() - - -" command! -nargs=0 JdtRefreshDebugConfigs :lua require('jdtls.dap').setup_dap_main_class_configs() -" -" command! -buffer -nargs=? -complete=custom,v:lua.require'jdtls'._complete_compile JdtCompile lua require('jdtls').compile() -" command! -buffer -nargs=? -complete=custom,v:lua.require'jdtls'._complete_set_runtime JdtSetRuntime lua require('jdtls').set_runtime() -" command! -buffer JdtUpdateConfig lua require('jdtls').update_project_config() -" command! -buffer JdtJol lua require('jdtls').jol() -" command! -buffer JdtBytecode lua require('jdtls').javap() -" command! -buffer JdtJshell lua require('jdtls').jshell() - -" nnoremap p call lighttree#plugin#jdt#toggle_win() -]]) - diff --git a/ftplugin/lua.lua b/ftplugin/lua.lua deleted file mode 100644 index 139597f9..00000000 --- a/ftplugin/lua.lua +++ /dev/null @@ -1,2 +0,0 @@ - - diff --git a/lua/lsp/init.lua b/lua/lsp/init.lua index 32a6b70d..15f197aa 100644 --- a/lua/lsp/init.lua +++ b/lua/lsp/init.lua @@ -107,3 +107,9 @@ vim.lsp.handlers["textDocument/signatureHelp"] = vim.lsp.with(vim.lsp.handlers.s -- vim.api.nvim_echo({ { msg } }, true, {}) -- end -- end +vim.cmd[[ +augroup jdtls_lsp + autocmd! + autocmd FileType java lua require'lsp.java'.setup() +augroup end +]] diff --git a/lua/lsp/java.lua b/lua/lsp/java.lua new file mode 100644 index 00000000..812396e5 --- /dev/null +++ b/lua/lsp/java.lua @@ -0,0 +1,258 @@ +local M = {} +local env = { + -- HOME = vim.loop.os_homedir(), + MAVEN_SETTINGS = os.getenv 'MAVEN_SETTINGS', +} + +local maven_settings = '/opt/software/apache-maven-3.6.3/conf/settings.xml' +local function get_maven_settings() + return env.MAVEN_SETTINGS and env.MAVEN_SETTINGS or maven_settings +end + + +M.setup = function () + + local project_name = vim.fn.fnamemodify(vim.fn.getcwd(), ':p:h:t') + + -- local workspace_dir = '/Users/kailuo/jdtls-workspace/' .. project_name + local workspace_dir = '/Users/kailuo/jdtls-workspace/' .. project_name + + local jdtls_launcher = vim.fn.glob("/opt/software/lsp/jdtls/plugins/org.eclipse.equinox.launcher_*.jar"); + -- See `:help vim.lsp.start_client` for an overview of the supported `config` options. + local config = { + -- The command that starts the language server + -- See: https://github.com/eclipse/eclipse.jdt.ls#running-from-the-command-line + cmd = { + '/Library/Java/JavaVirtualMachines/zulu-11.jdk/Contents/Home/bin/java', -- or '/path/to/java11_or_newer/bin/java' + '-Declipse.application=org.eclipse.jdt.ls.core.id1', + '-Dosgi.bundles.defaultStartLevel=4', + '-Declipse.product=org.eclipse.jdt.ls.core.product', + '-Dlog.protocol=true', + '-Dlog.level=ALL', + '-XX:+UseParallelGC', + '-XX:GCTimeRatio=4', + '-XX:AdaptiveSizePolicyWeight=90', + '-Dsun.zip.disableMemoryMapping=true', + '-Xms100m', + '-Xmx2g', + '-javaagent:/opt/software/lsp/lombok.jar', + '--add-modules=ALL-SYSTEM', + '--add-opens', 'java.base/java.util=ALL-UNNAMED', + '--add-opens', 'java.base/java.lang=ALL-UNNAMED', + '-jar', jdtls_launcher, + '-configuration', '/opt/software/lsp/jdtls/config_mac', + '-data', workspace_dir, + }, + filetypes = {"java"}, + + -- 💀 + -- This is the default if not provided, you can remove it. Or adjust as needed. + -- One dedicated LSP server & client will be started per unique root_dir + root_dir = require('jdtls.setup').find_root({'.git', 'mvnw', 'gradlew'}), + + -- Here you can configure eclipse.jdt.ls specific settings + -- See https://github.com/eclipse/eclipse.jdt.ls/wiki/Running-the-JAVA-LS-server-from-the-command-line#initialize-request + -- for a list of options + settings = { + java = { + home = "/Library/Java/JavaVirtualMachines/zulu-11.jdk/Contents/Home", + project = { + resourceFilters = { + "node_modules", + ".git", + ".idea" + }, + }, + import = { + exclusions = { + "**/node_modules/**", + "**/.metadata/**", + "**/archetype-resources/**", + "**/META-INF/maven/**", + "**/.git/**", + "**/.idea/**", + }, + }, + -- referenceCodeLens = { enabled = true }, + -- implementationsCodeLens = { enabled = true }, + templates = { + fileHeader = { + "/**", + " * ${type_name}", + " * @author ${user}", + " */", + }, + typeComment = { + "/**", + " * ${type_name}", + " * @author ${user}", + " */", + }, + }, + eclipse = { + downloadSources = true, + }, + server = { + launchMode = "Hybrid", + }, + maven = { + downloadSources = true, + updateSnapshots = true, + }, + signatureHelp = { enabled = true }, + contentProvider = { preferred = 'fernflower' }, + completion = { + favoriteStaticMembers = { + "org.hamcrest.MatcherAssert.assertThat", + "org.hamcrest.Matchers.*", + "org.hamcrest.CoreMatchers.*", + "org.junit.jupiter.api.Assertions.*", + "java.util.Objects.requireNonNull", + "java.util.Objects.requireNonNullElse", + "org.mockito.Mockito.*" + } + }; + sources = { + organizeImports = { + starThreshold = 9999; + staticStarThreshold = 9999; + }, + }, + configuration = { + maven = { + -- userSettings = "/opt/software/apache-maven-3.6.3/conf/settings.xml", + -- globalSettings = "/opt/software/apache-maven-3.6.3/conf/settings.xml", + userSettings = get_maven_settings(), + globalSettings = get_maven_settings(), + }, + runtimes = { + { + name = "JavaSE-1.8", + path = "/Library/Java/JavaVirtualMachines/zulu-8.jdk/Contents/Home", + }, + { + name = "JavaSE-11", + path = "/Library/Java/JavaVirtualMachines/zulu-11.jdk/Contents/Home", + }, + { + name = "JavaSE-17", + path = "/Library/Java/JavaVirtualMachines/zulu-17.jdk/Contents/Home", + }, + } + }, + } + }, + + -- Language server `initializationOptions` + -- You need to extend the `bundles` with paths to jar files + -- if you want to use additional eclipse.jdt.ls plugins. + -- + -- See https://github.com/mfussenegger/nvim-jdtls#java-debug-installation + -- + -- If you don't plan on using the debugger or other eclipse.jdt.ls plugins you can remove this + -- init_options = { + -- bundles = { + -- vim.fn.glob("/opt/software/lsp/java/java-debug/com.microsoft.java.debug.plugin/target/com.microsoft.java.debug.plugin-0.35.0.jar") + -- }, + -- workspace = workspace_dir + -- }, + } + + + -- This bundles definition is the same as in the previous section (java-debug installation) + local bundles = { + vim.fn.glob("/opt/software/lsp/java/java-debug/com.microsoft.java.debug.plugin/target/com.microsoft.java.debug.plugin-*.jar") + }; + + -- /opt/software/lsp/java/vscode-java-test/server + -- vim.list_extend(bundles, vim.split(vim.fn.glob("/opt/software/lsp/java/vscode-java-test/server/*.jar"), "\n")); + for _, bundle in ipairs(vim.split(vim.fn.glob("/opt/software/lsp/java/vscode-java-test/server/*.jar"), "\n")) do + if not vim.endswith(bundle, 'com.microsoft.java.test.runner-jar-with-dependencies.jar') then + table.insert(bundles, bundle) + end + end + + -- /opt/software/lsp/java/vscode-java-decompiler/server/ + vim.list_extend(bundles, vim.split(vim.fn.glob("/opt/software/lsp/java/vscode-java-decompiler/server/*.jar"), "\n")); + + -- /opt/software/lsp/java/vscode-java-dependency/jdtls.ext/ + -- vim.list_extend(bundles, vim.split(vim.fn.glob("/opt/software/lsp/java/vscode-java-dependency/jdtls.ext/com.microsoft.jdtls.ext.core/target/com.microsoft.jdtls.ext.core-*.jar"), "\n")); + + local jdtls = require('jdtls') + + local extendedClientCapabilities = jdtls.extendedClientCapabilities; + extendedClientCapabilities.resolveAdditionalTextEditsSupport = true; + + config['init_options'] = { + bundles = bundles; + extendedClientCapabilities = extendedClientCapabilities; + } + + config['on_attach'] = function(client, bufnr) + -- With `hotcodereplace = 'auto' the debug adapter will try to apply code changes + -- you make during a debug session immediately. + -- Remove the option if you do not want that. + require('jdtls').setup_dap({ hotcodereplace = 'auto' }) + require('jdtls.setup').add_commands(); + -- require('jdtls.dap').setup_dap_main_class_configs({ verbose = true }) + end + + + local capabilities = require('cmp_nvim_lsp').update_capabilities(vim.lsp.protocol.make_client_capabilities()) + -- capabilities.experimental = { + -- hoverActions = true, + -- hoverRange = true, + -- serverStatusNotification = true, + -- snippetTextEdit = true, + -- codeActionGroup = true, + -- ssr = true, + -- } + + config.capabilities = capabilities; + + + jdtls.start_or_attach(config) + + local map = vim.api.nvim_set_keymap + require('keybindings').maplsp(map) + + vim.cmd([[ + command! -nargs=0 OR :lua require'jdtls'.organize_imports() + command! -nargs=0 Format :lua vim.lsp.buf.formatting() + nnoremap crv lua require('jdtls').extract_variable() + vnoremap crv lua require('jdtls').extract_variable(true) + nnoremap crc lua require('jdtls').extract_constant() + vnoremap crc lua require('jdtls').extract_constant(true) + vnoremap crm lua require('jdtls').extract_method(true) + + + function! s:jdtls_test_class_ui() + lua require'jdtls'.test_class() + lua require'dapui'.open() + endfunction + function! s:jdtls_test_method_ui() + lua require'jdtls'.test_nearest_method() + lua require'dapui'.open() + endfunction + command! -nargs=0 TestClass :lua require'jdtls'.test_class() + command! -nargs=0 TestMethod :lua require'jdtls'.test_nearest_method() + command! -nargs=0 TestClassUI :call s:jdtls_test_class_ui() + command! -nargs=0 TestMethodUI :call s:jdtls_test_method_ui() + nnoremap dc lua require'jdtls'.test_class() + nnoremap dm lua require'jdtls'.test_nearest_method() + + + " command! -nargs=0 JdtRefreshDebugConfigs :lua require('jdtls.dap').setup_dap_main_class_configs() + " + " command! -buffer -nargs=? -complete=custom,v:lua.require'jdtls'._complete_compile JdtCompile lua require('jdtls').compile() + " command! -buffer -nargs=? -complete=custom,v:lua.require'jdtls'._complete_set_runtime JdtSetRuntime lua require('jdtls').set_runtime() + " command! -buffer JdtUpdateConfig lua require('jdtls').update_project_config() + " command! -buffer JdtJol lua require('jdtls').jol() + " command! -buffer JdtBytecode lua require('jdtls').javap() + " command! -buffer JdtJshell lua require('jdtls').jshell() + + " nnoremap p call lighttree#plugin#jdt#toggle_win() + ]]) + + end + return M From 1ba3b579428a2098a37c18dadd546bb95a0c1d33 Mon Sep 17 00:00:00 2001 From: kaiv2 Date: Wed, 13 Apr 2022 21:41:56 +0800 Subject: [PATCH 0123/1278] fmt --- lua/lsp/java.lua | 156 +++++++++++++++++++++++------------------------ 1 file changed, 78 insertions(+), 78 deletions(-) diff --git a/lua/lsp/java.lua b/lua/lsp/java.lua index 812396e5..b70ce765 100644 --- a/lua/lsp/java.lua +++ b/lua/lsp/java.lua @@ -156,103 +156,103 @@ M.setup = function () -- }, -- workspace = workspace_dir -- }, - } + } - -- This bundles definition is the same as in the previous section (java-debug installation) - local bundles = { - vim.fn.glob("/opt/software/lsp/java/java-debug/com.microsoft.java.debug.plugin/target/com.microsoft.java.debug.plugin-*.jar") - }; + -- This bundles definition is the same as in the previous section (java-debug installation) + local bundles = { + vim.fn.glob("/opt/software/lsp/java/java-debug/com.microsoft.java.debug.plugin/target/com.microsoft.java.debug.plugin-*.jar") + }; - -- /opt/software/lsp/java/vscode-java-test/server - -- vim.list_extend(bundles, vim.split(vim.fn.glob("/opt/software/lsp/java/vscode-java-test/server/*.jar"), "\n")); - for _, bundle in ipairs(vim.split(vim.fn.glob("/opt/software/lsp/java/vscode-java-test/server/*.jar"), "\n")) do - if not vim.endswith(bundle, 'com.microsoft.java.test.runner-jar-with-dependencies.jar') then - table.insert(bundles, bundle) - end - end + -- /opt/software/lsp/java/vscode-java-test/server + -- vim.list_extend(bundles, vim.split(vim.fn.glob("/opt/software/lsp/java/vscode-java-test/server/*.jar"), "\n")); + for _, bundle in ipairs(vim.split(vim.fn.glob("/opt/software/lsp/java/vscode-java-test/server/*.jar"), "\n")) do + if not vim.endswith(bundle, 'com.microsoft.java.test.runner-jar-with-dependencies.jar') then + table.insert(bundles, bundle) + end + end - -- /opt/software/lsp/java/vscode-java-decompiler/server/ - vim.list_extend(bundles, vim.split(vim.fn.glob("/opt/software/lsp/java/vscode-java-decompiler/server/*.jar"), "\n")); + -- /opt/software/lsp/java/vscode-java-decompiler/server/ + vim.list_extend(bundles, vim.split(vim.fn.glob("/opt/software/lsp/java/vscode-java-decompiler/server/*.jar"), "\n")); - -- /opt/software/lsp/java/vscode-java-dependency/jdtls.ext/ - -- vim.list_extend(bundles, vim.split(vim.fn.glob("/opt/software/lsp/java/vscode-java-dependency/jdtls.ext/com.microsoft.jdtls.ext.core/target/com.microsoft.jdtls.ext.core-*.jar"), "\n")); + -- /opt/software/lsp/java/vscode-java-dependency/jdtls.ext/ + -- vim.list_extend(bundles, vim.split(vim.fn.glob("/opt/software/lsp/java/vscode-java-dependency/jdtls.ext/com.microsoft.jdtls.ext.core/target/com.microsoft.jdtls.ext.core-*.jar"), "\n")); - local jdtls = require('jdtls') + local jdtls = require('jdtls') - local extendedClientCapabilities = jdtls.extendedClientCapabilities; - extendedClientCapabilities.resolveAdditionalTextEditsSupport = true; + local extendedClientCapabilities = jdtls.extendedClientCapabilities; + extendedClientCapabilities.resolveAdditionalTextEditsSupport = true; - config['init_options'] = { - bundles = bundles; - extendedClientCapabilities = extendedClientCapabilities; - } + config['init_options'] = { + bundles = bundles; + extendedClientCapabilities = extendedClientCapabilities; + } - config['on_attach'] = function(client, bufnr) - -- With `hotcodereplace = 'auto' the debug adapter will try to apply code changes - -- you make during a debug session immediately. - -- Remove the option if you do not want that. - require('jdtls').setup_dap({ hotcodereplace = 'auto' }) - require('jdtls.setup').add_commands(); - -- require('jdtls.dap').setup_dap_main_class_configs({ verbose = true }) - end + config['on_attach'] = function(client, bufnr) + -- With `hotcodereplace = 'auto' the debug adapter will try to apply code changes + -- you make during a debug session immediately. + -- Remove the option if you do not want that. + require('jdtls').setup_dap({ hotcodereplace = 'auto' }) + require('jdtls.setup').add_commands(); + -- require('jdtls.dap').setup_dap_main_class_configs({ verbose = true }) + end - local capabilities = require('cmp_nvim_lsp').update_capabilities(vim.lsp.protocol.make_client_capabilities()) - -- capabilities.experimental = { - -- hoverActions = true, - -- hoverRange = true, - -- serverStatusNotification = true, - -- snippetTextEdit = true, - -- codeActionGroup = true, - -- ssr = true, - -- } + local capabilities = require('cmp_nvim_lsp').update_capabilities(vim.lsp.protocol.make_client_capabilities()) + -- capabilities.experimental = { + -- hoverActions = true, + -- hoverRange = true, + -- serverStatusNotification = true, + -- snippetTextEdit = true, + -- codeActionGroup = true, + -- ssr = true, + -- } - config.capabilities = capabilities; + config.capabilities = capabilities; - jdtls.start_or_attach(config) + jdtls.start_or_attach(config) - local map = vim.api.nvim_set_keymap - require('keybindings').maplsp(map) + local map = vim.api.nvim_set_keymap + require('keybindings').maplsp(map) - vim.cmd([[ - command! -nargs=0 OR :lua require'jdtls'.organize_imports() - command! -nargs=0 Format :lua vim.lsp.buf.formatting() - nnoremap crv lua require('jdtls').extract_variable() - vnoremap crv lua require('jdtls').extract_variable(true) - nnoremap crc lua require('jdtls').extract_constant() - vnoremap crc lua require('jdtls').extract_constant(true) - vnoremap crm lua require('jdtls').extract_method(true) + vim.cmd([[ + command! -nargs=0 OR :lua require'jdtls'.organize_imports() + command! -nargs=0 Format :lua vim.lsp.buf.formatting() + nnoremap crv lua require('jdtls').extract_variable() + vnoremap crv lua require('jdtls').extract_variable(true) + nnoremap crc lua require('jdtls').extract_constant() + vnoremap crc lua require('jdtls').extract_constant(true) + vnoremap crm lua require('jdtls').extract_method(true) - function! s:jdtls_test_class_ui() - lua require'jdtls'.test_class() - lua require'dapui'.open() - endfunction - function! s:jdtls_test_method_ui() - lua require'jdtls'.test_nearest_method() - lua require'dapui'.open() - endfunction - command! -nargs=0 TestClass :lua require'jdtls'.test_class() - command! -nargs=0 TestMethod :lua require'jdtls'.test_nearest_method() - command! -nargs=0 TestClassUI :call s:jdtls_test_class_ui() - command! -nargs=0 TestMethodUI :call s:jdtls_test_method_ui() - nnoremap dc lua require'jdtls'.test_class() - nnoremap dm lua require'jdtls'.test_nearest_method() + function! s:jdtls_test_class_ui() + lua require'jdtls'.test_class() + lua require'dapui'.open() + endfunction + function! s:jdtls_test_method_ui() + lua require'jdtls'.test_nearest_method() + lua require'dapui'.open() + endfunction + command! -nargs=0 TestClass :lua require'jdtls'.test_class() + command! -nargs=0 TestMethod :lua require'jdtls'.test_nearest_method() + command! -nargs=0 TestClassUI :call s:jdtls_test_class_ui() + command! -nargs=0 TestMethodUI :call s:jdtls_test_method_ui() + nnoremap dc lua require'jdtls'.test_class() + nnoremap dm lua require'jdtls'.test_nearest_method() - " command! -nargs=0 JdtRefreshDebugConfigs :lua require('jdtls.dap').setup_dap_main_class_configs() - " - " command! -buffer -nargs=? -complete=custom,v:lua.require'jdtls'._complete_compile JdtCompile lua require('jdtls').compile() - " command! -buffer -nargs=? -complete=custom,v:lua.require'jdtls'._complete_set_runtime JdtSetRuntime lua require('jdtls').set_runtime() - " command! -buffer JdtUpdateConfig lua require('jdtls').update_project_config() - " command! -buffer JdtJol lua require('jdtls').jol() - " command! -buffer JdtBytecode lua require('jdtls').javap() - " command! -buffer JdtJshell lua require('jdtls').jshell() + " command! -nargs=0 JdtRefreshDebugConfigs :lua require('jdtls.dap').setup_dap_main_class_configs() + " + " command! -buffer -nargs=? -complete=custom,v:lua.require'jdtls'._complete_compile JdtCompile lua require('jdtls').compile() + " command! -buffer -nargs=? -complete=custom,v:lua.require'jdtls'._complete_set_runtime JdtSetRuntime lua require('jdtls').set_runtime() + " command! -buffer JdtUpdateConfig lua require('jdtls').update_project_config() + " command! -buffer JdtJol lua require('jdtls').jol() + " command! -buffer JdtBytecode lua require('jdtls').javap() + " command! -buffer JdtJshell lua require('jdtls').jshell() - " nnoremap p call lighttree#plugin#jdt#toggle_win() - ]]) + " nnoremap p call lighttree#plugin#jdt#toggle_win() + ]]) +end - end - return M +return M From 2bf133ba055bf4e33e1ff2a0ad2454152f568ec4 Mon Sep 17 00:00:00 2001 From: kaiv2 Date: Wed, 13 Apr 2022 21:52:50 +0800 Subject: [PATCH 0124/1278] config --- lua/plugins/config/nvim-tree.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lua/plugins/config/nvim-tree.lua b/lua/plugins/config/nvim-tree.lua index ffacfa22..4e993373 100644 --- a/lua/plugins/config/nvim-tree.lua +++ b/lua/plugins/config/nvim-tree.lua @@ -55,7 +55,7 @@ require'nvim-tree'.setup { timeout = 400, }, view = { - width = '40%', + width = '34%', height = '40%', hide_root_folder = true, side = 'left', From 86c81ac445e158fed0a5aa236cd5a903eb6daf86 Mon Sep 17 00:00:00 2001 From: kaiv2 Date: Wed, 13 Apr 2022 21:55:51 +0800 Subject: [PATCH 0125/1278] rm plugin/ --- .gitignore | 1 + plugin/packer_compiled.lua | 347 ------------------------------------- 2 files changed, 1 insertion(+), 347 deletions(-) delete mode 100644 plugin/packer_compiled.lua diff --git a/.gitignore b/.gitignore index a0e76af9..6e6a468f 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,2 @@ .netrwhist +plugin diff --git a/plugin/packer_compiled.lua b/plugin/packer_compiled.lua deleted file mode 100644 index 0832e803..00000000 --- a/plugin/packer_compiled.lua +++ /dev/null @@ -1,347 +0,0 @@ --- Automatically generated packer.nvim plugin loader code - -if vim.api.nvim_call_function('has', {'nvim-0.5'}) ~= 1 then - vim.api.nvim_command('echohl WarningMsg | echom "Invalid Neovim version for packer.nvim! | echohl None"') - return -end - -vim.api.nvim_command('packadd packer.nvim') - -local no_errors, error_msg = pcall(function() - - local time - local profile_info - local should_profile = false - if should_profile then - local hrtime = vim.loop.hrtime - profile_info = {} - time = function(chunk, start) - if start then - profile_info[chunk] = hrtime() - else - profile_info[chunk] = (hrtime() - profile_info[chunk]) / 1e6 - end - end - else - time = function(chunk, start) end - end - -local function save_profiles(threshold) - local sorted_times = {} - for chunk_name, time_taken in pairs(profile_info) do - sorted_times[#sorted_times + 1] = {chunk_name, time_taken} - end - table.sort(sorted_times, function(a, b) return a[2] > b[2] end) - local results = {} - for i, elem in ipairs(sorted_times) do - if not threshold or threshold and elem[2] > threshold then - results[i] = elem[1] .. ' took ' .. elem[2] .. 'ms' - end - end - - _G._packer = _G._packer or {} - _G._packer.profile_output = results -end - -time([[Luarocks path setup]], true) -local package_path_str = "/Users/kailuo/.cache/nvim/packer_hererocks/2.1.0-beta3/share/lua/5.1/?.lua;/Users/kailuo/.cache/nvim/packer_hererocks/2.1.0-beta3/share/lua/5.1/?/init.lua;/Users/kailuo/.cache/nvim/packer_hererocks/2.1.0-beta3/lib/luarocks/rocks-5.1/?.lua;/Users/kailuo/.cache/nvim/packer_hererocks/2.1.0-beta3/lib/luarocks/rocks-5.1/?/init.lua" -local install_cpath_pattern = "/Users/kailuo/.cache/nvim/packer_hererocks/2.1.0-beta3/lib/lua/5.1/?.so" -if not string.find(package.path, package_path_str, 1, true) then - package.path = package.path .. ';' .. package_path_str -end - -if not string.find(package.cpath, install_cpath_pattern, 1, true) then - package.cpath = package.cpath .. ';' .. install_cpath_pattern -end - -time([[Luarocks path setup]], false) -time([[try_loadstring definition]], true) -local function try_loadstring(s, component, name) - local success, result = pcall(loadstring(s), name, _G.packer_plugins[name]) - if not success then - vim.schedule(function() - vim.api.nvim_notify('packer.nvim: Error running ' .. component .. ' for ' .. name .. ': ' .. result, vim.log.levels.ERROR, {}) - end) - end - return result -end - -time([[try_loadstring definition]], false) -time([[Defining packer_plugins]], true) -_G.packer_plugins = { - ["AutoSave.nvim"] = { - loaded = true, - path = "/Users/kailuo/.local/share/nvim/site/pack/packer/start/AutoSave.nvim", - url = "https://github.com/Pocco81/AutoSave.nvim" - }, - ["Comment.nvim"] = { - loaded = true, - path = "/Users/kailuo/.local/share/nvim/site/pack/packer/start/Comment.nvim", - url = "https://github.com/numToStr/Comment.nvim" - }, - LeaderF = { - loaded = true, - path = "/Users/kailuo/.local/share/nvim/site/pack/packer/start/LeaderF", - url = "https://github.com/Yggdroot/LeaderF" - }, - ["LeaderF-floaterm"] = { - loaded = true, - path = "/Users/kailuo/.local/share/nvim/site/pack/packer/start/LeaderF-floaterm", - url = "https://github.com/voldikss/LeaderF-floaterm" - }, - LuaSnip = { - loaded = true, - path = "/Users/kailuo/.local/share/nvim/site/pack/packer/start/LuaSnip", - url = "https://github.com/L3MON4D3/LuaSnip" - }, - ["asyncrun.vim"] = { - loaded = true, - path = "/Users/kailuo/.local/share/nvim/site/pack/packer/start/asyncrun.vim", - url = "https://github.com/skywind3000/asyncrun.vim" - }, - ["asynctasks.vim"] = { - loaded = true, - path = "/Users/kailuo/.local/share/nvim/site/pack/packer/start/asynctasks.vim", - url = "https://github.com/skywind3000/asynctasks.vim" - }, - ["bufferline.nvim"] = { - loaded = true, - path = "/Users/kailuo/.local/share/nvim/site/pack/packer/start/bufferline.nvim", - url = "https://github.com/akinsho/bufferline.nvim" - }, - ["calendar.vim"] = { - loaded = true, - path = "/Users/kailuo/.local/share/nvim/site/pack/packer/start/calendar.vim", - url = "https://github.com/itchyny/calendar.vim" - }, - ["cmp-buffer"] = { - loaded = true, - path = "/Users/kailuo/.local/share/nvim/site/pack/packer/start/cmp-buffer", - url = "https://github.com/hrsh7th/cmp-buffer" - }, - ["cmp-nvim-lsp"] = { - loaded = true, - path = "/Users/kailuo/.local/share/nvim/site/pack/packer/start/cmp-nvim-lsp", - url = "https://github.com/hrsh7th/cmp-nvim-lsp" - }, - ["cmp-path"] = { - loaded = true, - path = "/Users/kailuo/.local/share/nvim/site/pack/packer/start/cmp-path", - url = "https://github.com/hrsh7th/cmp-path" - }, - cmp_luasnip = { - loaded = true, - path = "/Users/kailuo/.local/share/nvim/site/pack/packer/start/cmp_luasnip", - url = "https://github.com/saadparwaiz1/cmp_luasnip" - }, - ["dashboard-nvim"] = { - loaded = true, - path = "/Users/kailuo/.local/share/nvim/site/pack/packer/start/dashboard-nvim", - url = "https://github.com/glepnir/dashboard-nvim" - }, - ["friendly-snippets"] = { - loaded = true, - path = "/Users/kailuo/.local/share/nvim/site/pack/packer/start/friendly-snippets", - url = "https://github.com/rafamadriz/friendly-snippets" - }, - ["gitsigns.nvim"] = { - loaded = true, - path = "/Users/kailuo/.local/share/nvim/site/pack/packer/start/gitsigns.nvim", - url = "https://github.com/lewis6991/gitsigns.nvim" - }, - gruvbox = { - loaded = true, - path = "/Users/kailuo/.local/share/nvim/site/pack/packer/start/gruvbox", - url = "https://github.com/morhetz/gruvbox" - }, - ["indent-blankline.nvim"] = { - loaded = true, - path = "/Users/kailuo/.local/share/nvim/site/pack/packer/start/indent-blankline.nvim", - url = "https://github.com/lukas-reineke/indent-blankline.nvim" - }, - ["lspkind-nvim"] = { - loaded = true, - path = "/Users/kailuo/.local/share/nvim/site/pack/packer/start/lspkind-nvim", - url = "https://github.com/onsails/lspkind-nvim" - }, - ["lualine-lsp-progress"] = { - loaded = true, - path = "/Users/kailuo/.local/share/nvim/site/pack/packer/start/lualine-lsp-progress", - url = "https://github.com/arkav/lualine-lsp-progress" - }, - ["lualine.nvim"] = { - loaded = true, - path = "/Users/kailuo/.local/share/nvim/site/pack/packer/start/lualine.nvim", - url = "https://github.com/nvim-lualine/lualine.nvim" - }, - ["markdown-preview.nvim"] = { - loaded = true, - path = "/Users/kailuo/.local/share/nvim/site/pack/packer/start/markdown-preview.nvim", - url = "https://github.com/iamcco/markdown-preview.nvim" - }, - neoformat = { - loaded = true, - path = "/Users/kailuo/.local/share/nvim/site/pack/packer/start/neoformat", - url = "https://github.com/sbdchd/neoformat" - }, - ["nvim-autopairs"] = { - loaded = true, - path = "/Users/kailuo/.local/share/nvim/site/pack/packer/start/nvim-autopairs", - url = "https://github.com/windwp/nvim-autopairs" - }, - ["nvim-cmp"] = { - loaded = true, - path = "/Users/kailuo/.local/share/nvim/site/pack/packer/start/nvim-cmp", - url = "https://github.com/hrsh7th/nvim-cmp" - }, - ["nvim-colorizer.lua"] = { - loaded = true, - path = "/Users/kailuo/.local/share/nvim/site/pack/packer/start/nvim-colorizer.lua", - url = "https://github.com/norcalli/nvim-colorizer.lua" - }, - ["nvim-dap"] = { - loaded = true, - path = "/Users/kailuo/.local/share/nvim/site/pack/packer/start/nvim-dap", - url = "https://github.com/mfussenegger/nvim-dap" - }, - ["nvim-dap-ui"] = { - loaded = true, - path = "/Users/kailuo/.local/share/nvim/site/pack/packer/start/nvim-dap-ui", - url = "https://github.com/rcarriga/nvim-dap-ui" - }, - ["nvim-jdtls"] = { - loaded = true, - path = "/Users/kailuo/.local/share/nvim/site/pack/packer/start/nvim-jdtls", - url = "https://github.com/mfussenegger/nvim-jdtls" - }, - ["nvim-lsp-installer"] = { - loaded = true, - path = "/Users/kailuo/.local/share/nvim/site/pack/packer/start/nvim-lsp-installer", - url = "https://github.com/williamboman/nvim-lsp-installer" - }, - ["nvim-lspconfig"] = { - loaded = true, - path = "/Users/kailuo/.local/share/nvim/site/pack/packer/start/nvim-lspconfig", - url = "https://github.com/neovim/nvim-lspconfig" - }, - ["nvim-notify"] = { - loaded = true, - path = "/Users/kailuo/.local/share/nvim/site/pack/packer/start/nvim-notify", - url = "https://github.com/rcarriga/nvim-notify" - }, - ["nvim-tree.lua"] = { - loaded = true, - path = "/Users/kailuo/.local/share/nvim/site/pack/packer/start/nvim-tree.lua", - url = "https://github.com/kyazdani42/nvim-tree.lua" - }, - ["nvim-treesitter"] = { - loaded = true, - path = "/Users/kailuo/.local/share/nvim/site/pack/packer/start/nvim-treesitter", - url = "https://github.com/nvim-treesitter/nvim-treesitter" - }, - ["nvim-treesitter-textobjects"] = { - loaded = true, - path = "/Users/kailuo/.local/share/nvim/site/pack/packer/start/nvim-treesitter-textobjects", - url = "https://github.com/nvim-treesitter/nvim-treesitter-textobjects" - }, - ["nvim-web-devicons"] = { - loaded = true, - path = "/Users/kailuo/.local/share/nvim/site/pack/packer/start/nvim-web-devicons", - url = "https://github.com/kyazdani42/nvim-web-devicons" - }, - ["packer.nvim"] = { - loaded = true, - path = "/Users/kailuo/.local/share/nvim/site/pack/packer/start/packer.nvim", - url = "https://github.com/wbthomason/packer.nvim" - }, - ["plenary.nvim"] = { - loaded = true, - path = "/Users/kailuo/.local/share/nvim/site/pack/packer/start/plenary.nvim", - url = "https://github.com/nvim-lua/plenary.nvim" - }, - ["rust-tools.nvim"] = { - loaded = true, - path = "/Users/kailuo/.local/share/nvim/site/pack/packer/start/rust-tools.nvim", - url = "https://github.com/simrat39/rust-tools.nvim" - }, - ["telescope-ui-select.nvim"] = { - loaded = true, - path = "/Users/kailuo/.local/share/nvim/site/pack/packer/start/telescope-ui-select.nvim", - url = "https://github.com/nvim-telescope/telescope-ui-select.nvim" - }, - ["telescope.nvim"] = { - loaded = true, - path = "/Users/kailuo/.local/share/nvim/site/pack/packer/start/telescope.nvim", - url = "https://github.com/nvim-telescope/telescope.nvim" - }, - ["trouble.nvim"] = { - loaded = true, - path = "/Users/kailuo/.local/share/nvim/site/pack/packer/start/trouble.nvim", - url = "https://github.com/folke/trouble.nvim" - }, - ["vim-easy-align"] = { - loaded = true, - path = "/Users/kailuo/.local/share/nvim/site/pack/packer/start/vim-easy-align", - url = "https://github.com/junegunn/vim-easy-align" - }, - ["vim-floaterm"] = { - loaded = true, - path = "/Users/kailuo/.local/share/nvim/site/pack/packer/start/vim-floaterm", - url = "https://github.com/voldikss/vim-floaterm" - }, - ["vim-fugitive"] = { - loaded = true, - path = "/Users/kailuo/.local/share/nvim/site/pack/packer/start/vim-fugitive", - url = "https://github.com/tpope/vim-fugitive" - }, - ["vim-matchup"] = { - loaded = true, - path = "/Users/kailuo/.local/share/nvim/site/pack/packer/start/vim-matchup", - url = "https://github.com/andymass/vim-matchup" - }, - ["vim-table-mode"] = { - loaded = true, - path = "/Users/kailuo/.local/share/nvim/site/pack/packer/start/vim-table-mode", - url = "https://github.com/dhruvasagar/vim-table-mode" - }, - ["vim-translator"] = { - loaded = true, - path = "/Users/kailuo/.local/share/nvim/site/pack/packer/start/vim-translator", - url = "https://github.com/voldikss/vim-translator" - }, - ["vim-visual-multi"] = { - loaded = true, - path = "/Users/kailuo/.local/share/nvim/site/pack/packer/start/vim-visual-multi", - url = "https://github.com/mg979/vim-visual-multi" - }, - ["vista.vim"] = { - loaded = true, - path = "/Users/kailuo/.local/share/nvim/site/pack/packer/start/vista.vim", - url = "https://github.com/liuchengxu/vista.vim" - }, - ["which-key.nvim"] = { - config = { "\27LJ\2\n;\0\0\3\0\3\0\a6\0\0\0'\2\1\0B\0\2\0029\0\2\0004\2\0\0B\0\2\1K\0\1\0\nsetup\14which-key\frequire\0" }, - loaded = true, - path = "/Users/kailuo/.local/share/nvim/site/pack/packer/start/which-key.nvim", - url = "https://github.com/folke/which-key.nvim" - }, - ["wilder.nvim"] = { - loaded = true, - path = "/Users/kailuo/.local/share/nvim/site/pack/packer/start/wilder.nvim", - url = "https://github.com/gelguy/wilder.nvim" - } -} - -time([[Defining packer_plugins]], false) --- Config for: which-key.nvim -time([[Config for which-key.nvim]], true) -try_loadstring("\27LJ\2\n;\0\0\3\0\3\0\a6\0\0\0'\2\1\0B\0\2\0029\0\2\0004\2\0\0B\0\2\1K\0\1\0\nsetup\14which-key\frequire\0", "config", "which-key.nvim") -time([[Config for which-key.nvim]], false) -if should_profile then save_profiles() end - -end) - -if not no_errors then - error_msg = error_msg:gsub('"', '\\"') - vim.api.nvim_command('echohl ErrorMsg | echom "Error in packer_compiled: '..error_msg..'" | echom "Please check your config for correctness" | echohl None') -end From 6b6c574329e7fe8ac1b74125ebd79890a305d265 Mon Sep 17 00:00:00 2001 From: kaiv2 Date: Wed, 13 Apr 2022 21:58:03 +0800 Subject: [PATCH 0126/1278] utils --- lua/keybindings.lua | 2 +- lua/{my_tools => utils}/init.lua | 0 2 files changed, 1 insertion(+), 1 deletion(-) rename lua/{my_tools => utils}/init.lua (100%) diff --git a/lua/keybindings.lua b/lua/keybindings.lua index e605dbb3..96c99903 100644 --- a/lua/keybindings.lua +++ b/lua/keybindings.lua @@ -16,7 +16,7 @@ map('n', 'v', '"+p', opt) map('n', '', ':nohlsearch', opt) -- %bd 删除所有缓冲区, e# 打开最后一个缓冲区, bd# 关闭[No Name] -- map('n', 'o', ':%bd|e#|bd#', opt) -map('n', 'o', 'lua require("my_tools").close_other_bufline()', opt) +map('n', 'o', 'lua require("utils").close_other_bufline()', opt) map('n', 'w', ':bdelete!', opt) -- " 退出 terminal 模式 map('t', '', '', opt) diff --git a/lua/my_tools/init.lua b/lua/utils/init.lua similarity index 100% rename from lua/my_tools/init.lua rename to lua/utils/init.lua From 71633b989525138925b9b69cc37fc84f156fd829 Mon Sep 17 00:00:00 2001 From: kaiv2 Date: Thu, 14 Apr 2022 10:15:15 +0800 Subject: [PATCH 0127/1278] =?UTF-8?q?auto=5Fjump=20=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lua/keybindings.lua | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lua/keybindings.lua b/lua/keybindings.lua index 96c99903..5748a84b 100644 --- a/lua/keybindings.lua +++ b/lua/keybindings.lua @@ -109,8 +109,8 @@ pluginKeys.maplsp = function(mapbuf) mapbuf('n', 'ca', 'lua vim.lsp.buf.code_action()', opt) -- mapbuf('n', 'ca', 'lua require("lspsaga.codeaction").code_action()', opt) -- go xx - -- mapbuf('n', 'gd', 'lua vim.lsp.buf.definition()', opt) - mapbuf('n', 'gd', 'Trouble lsp_definitions', opt) + mapbuf('n', 'gd', 'lua vim.lsp.buf.definition()', opt) + -- mapbuf('n', 'gd', 'Trouble lsp_definitions', opt) mapbuf('n', 'gh', 'lua vim.lsp.buf.hover()', opt) -- mapbuf('n', 'gD', 'lua vim.lsp.buf.declaration()', opt) -- mapbuf('n', 'gD', 'lua vim.lsp.buf.type_definition()', opt) From f196c1b72ab613fa2f46e2049207b3dd62b537f0 Mon Sep 17 00:00:00 2001 From: kaiv2 Date: Thu, 14 Apr 2022 21:03:32 +0800 Subject: [PATCH 0128/1278] config --- lua/plugins/config/lualine.lua | 2 +- lua/plugins/init.lua | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/lua/plugins/config/lualine.lua b/lua/plugins/config/lualine.lua index bb937cb9..383e0aaf 100644 --- a/lua/plugins/config/lualine.lua +++ b/lua/plugins/config/lualine.lua @@ -25,5 +25,5 @@ require('lualine').setup { lualine_z = {} }, tabline = {}, - extensions = { 'nvim-tree' } + extensions = { 'quickfix', 'toggleterm', 'nvim-tree', 'fugitive' } } diff --git a/lua/plugins/init.lua b/lua/plugins/init.lua index 9079be85..a4a5136d 100644 --- a/lua/plugins/init.lua +++ b/lua/plugins/init.lua @@ -168,6 +168,8 @@ require('packer').startup(function() use 'simrat39/rust-tools.nvim' use "Pocco81/AutoSave.nvim" + + -- use "nathom/filetype.nvim" end) require('plugins/config/bufferline') From a433f203cd9e8453d339647ad16c4f2d4f35d098 Mon Sep 17 00:00:00 2001 From: kaiv2 Date: Thu, 14 Apr 2022 21:39:02 +0800 Subject: [PATCH 0129/1278] config --- lua/keybindings.lua | 18 ++++++++++-------- lua/plugins/init.lua | 7 ++++--- 2 files changed, 14 insertions(+), 11 deletions(-) diff --git a/lua/keybindings.lua b/lua/keybindings.lua index 5748a84b..c3277ad2 100644 --- a/lua/keybindings.lua +++ b/lua/keybindings.lua @@ -22,10 +22,10 @@ map('n', 'w', ':bdelete!', opt) map('t', '', '', opt) -- Leaderf -vim.g.Lf_ShortcutF = '' -map('n', '', ':=printf("Leaderf! rg -e %s ", expand(""))', {}) -map('v', '', ':=printf("Leaderf! rg -e %s ", leaderf#Rg#visual())', {}) -map('n', 'r', ':Leaderf --nowrap task', {}) +-- vim.g.Lf_ShortcutF = '' +-- map('n', '', ':=printf("Leaderf! rg -e %s ", expand(""))', {}) +-- map('v', '', ':=printf("Leaderf! rg -e %s ", leaderf#Rg#visual())', {}) +-- map('n', 'r', ':Leaderf --nowrap task', {}) -- vim-floaterm vim.g.floaterm_keymap_new = 't' @@ -45,10 +45,12 @@ map('n', 'o', ':Vista!!', opt) -- map('n', 'gr', ':Lspsaga lsp_finder', opt) -- Telescope -map('n', 'ff', 'Telescope find_files', {}) -map('n', 'fg', 'Telescope live_grep', {}) -map('n', 'fb', 'Telescope buffers', {}) -map('n', 'fh', 'Telescope help_tags', {}) +map('n', 'ff', 'Telescope find_files', opt) +map('n', '', 'Telescope find_files', opt) +map('n', 'fg', 'Telescope live_grep', opt) +map('n', 'fb', 'Telescope buffers', opt) +map('n', 'fh', 'Telescope help_tags', opt) +map('n', 'r', 'Telescope asynctasks all', opt) -- translate map('n', 't', ':TranslateW --engines=google', opt) diff --git a/lua/plugins/init.lua b/lua/plugins/init.lua index a4a5136d..c44171bd 100644 --- a/lua/plugins/init.lua +++ b/lua/plugins/init.lua @@ -70,7 +70,7 @@ require('packer').startup(function() use 'tpope/vim-fugitive' -- LeaderF - use 'Yggdroot/LeaderF' + -- use 'Yggdroot/LeaderF' -- git edit 状态显示插件 use { @@ -87,7 +87,7 @@ require('packer').startup(function() -- 浮动窗口插件 use 'voldikss/vim-floaterm' - use 'voldikss/LeaderF-floaterm' + -- use 'voldikss/LeaderF-floaterm' -- 多光标插件 use 'mg979/vim-visual-multi' @@ -170,6 +170,7 @@ require('packer').startup(function() use "Pocco81/AutoSave.nvim" -- use "nathom/filetype.nvim" + use 'GustavoKatel/telescope-asynctasks.nvim' end) require('plugins/config/bufferline') @@ -178,7 +179,7 @@ require('plugins/config/nvim-treesitter') require('plugins/config/luasnip') require('plugins/config/nvim-cmp') -require('plugins/config/LeaderF') +-- require('plugins/config/LeaderF') require('plugins/config/gitsigns-nvim') require('plugins/config/vim-floaterm') require('plugins/config/asynctasks') From 4e0184b27a3948e484802c0356e424b427b9a0b0 Mon Sep 17 00:00:00 2001 From: kaiv2 Date: Thu, 14 Apr 2022 21:45:38 +0800 Subject: [PATCH 0130/1278] config --- lua/plugins/config/telescope-fzf.lua | 0 lua/plugins/config/telescope.lua | 11 ++++++++++- lua/plugins/init.lua | 1 + 3 files changed, 11 insertions(+), 1 deletion(-) create mode 100644 lua/plugins/config/telescope-fzf.lua diff --git a/lua/plugins/config/telescope-fzf.lua b/lua/plugins/config/telescope-fzf.lua new file mode 100644 index 00000000..e69de29b diff --git a/lua/plugins/config/telescope.lua b/lua/plugins/config/telescope.lua index e1b0c437..360f3972 100644 --- a/lua/plugins/config/telescope.lua +++ b/lua/plugins/config/telescope.lua @@ -84,7 +84,16 @@ require('telescope').setup{ require("telescope.themes").get_dropdown { -- even more opts } + }, + fzf = { + fuzzy = true, -- false will only do exact matching + override_generic_sorter = true, -- override the generic sorter + override_file_sorter = true, -- override the file sorter + case_mode = "smart_case", -- or "ignore_case" or "respect_case" + -- the default case_mode is "smart_case" } - } + }, } require("telescope").load_extension("ui-select") +require('telescope').load_extension('fzf') + diff --git a/lua/plugins/init.lua b/lua/plugins/init.lua index c44171bd..1e57bc6e 100644 --- a/lua/plugins/init.lua +++ b/lua/plugins/init.lua @@ -145,6 +145,7 @@ require('packer').startup(function() requires = { {'nvim-lua/plenary.nvim'} } } use {'nvim-telescope/telescope-ui-select.nvim' } + use {'nvim-telescope/telescope-fzf-native.nvim', run = 'make' } -- 仪表盘 use {'glepnir/dashboard-nvim'} From cc4adce0564107ab581655ac9c6ed0851fddaf33 Mon Sep 17 00:00:00 2001 From: kaiv2 Date: Thu, 14 Apr 2022 22:06:30 +0800 Subject: [PATCH 0131/1278] config --- lua/plugins/config/telescope.lua | 11 +++++++---- lua/plugins/init.lua | 8 +++++++- 2 files changed, 14 insertions(+), 5 deletions(-) diff --git a/lua/plugins/config/telescope.lua b/lua/plugins/config/telescope.lua index 360f3972..62d1ee35 100644 --- a/lua/plugins/config/telescope.lua +++ b/lua/plugins/config/telescope.lua @@ -1,6 +1,7 @@ local actions = require("telescope.actions") local trouble = require("trouble.providers.telescope") -require('telescope').setup{ +local telescope = require('telescope'); +telescope.setup{ defaults = { vimgrep_arguments = { "rg", @@ -94,6 +95,8 @@ require('telescope').setup{ } }, } -require("telescope").load_extension("ui-select") -require('telescope').load_extension('fzf') - +telescope.load_extension('fzf') +telescope.load_extension("ui-select") +telescope.load_extension('gradle') +telescope.load_extension('maven_search') +telescope.load_extension('env') diff --git a/lua/plugins/init.lua b/lua/plugins/init.lua index 1e57bc6e..dbf2f002 100644 --- a/lua/plugins/init.lua +++ b/lua/plugins/init.lua @@ -147,6 +147,13 @@ require('packer').startup(function() use {'nvim-telescope/telescope-ui-select.nvim' } use {'nvim-telescope/telescope-fzf-native.nvim', run = 'make' } + use 'GustavoKatel/telescope-asynctasks.nvim' + use 'aloussase/telescope-gradle.nvim' + use 'aloussase/telescope-mvnsearch' + use { "LinArcX/telescope-env.nvim" } + + + -- 仪表盘 use {'glepnir/dashboard-nvim'} @@ -171,7 +178,6 @@ require('packer').startup(function() use "Pocco81/AutoSave.nvim" -- use "nathom/filetype.nvim" - use 'GustavoKatel/telescope-asynctasks.nvim' end) require('plugins/config/bufferline') From 86d4b5bbf4fc91460c66664f4a390c4073fcbbf2 Mon Sep 17 00:00:00 2001 From: kaiv2 Date: Thu, 14 Apr 2022 22:28:01 +0800 Subject: [PATCH 0132/1278] dap config --- lua/plugins/config/telescope.lua | 1 + lua/plugins/init.lua | 1 + 2 files changed, 2 insertions(+) diff --git a/lua/plugins/config/telescope.lua b/lua/plugins/config/telescope.lua index 62d1ee35..4014da3f 100644 --- a/lua/plugins/config/telescope.lua +++ b/lua/plugins/config/telescope.lua @@ -100,3 +100,4 @@ telescope.load_extension("ui-select") telescope.load_extension('gradle') telescope.load_extension('maven_search') telescope.load_extension('env') +telescope.load_extension('dap') diff --git a/lua/plugins/init.lua b/lua/plugins/init.lua index dbf2f002..6c179de4 100644 --- a/lua/plugins/init.lua +++ b/lua/plugins/init.lua @@ -146,6 +146,7 @@ require('packer').startup(function() } use {'nvim-telescope/telescope-ui-select.nvim' } use {'nvim-telescope/telescope-fzf-native.nvim', run = 'make' } + use {'nvim-telescope/telescope-dap.nvim'} use 'GustavoKatel/telescope-asynctasks.nvim' use 'aloussase/telescope-gradle.nvim' From 752e85095cb5a6584bf57026db523d36ccfc18dc Mon Sep 17 00:00:00 2001 From: kaiv2 Date: Thu, 14 Apr 2022 22:32:56 +0800 Subject: [PATCH 0133/1278] norg --- lua/plugins/config/nvim-neorg.lua | 13 +++++++++++++ lua/plugins/config/telescope.lua | 1 + lua/plugins/init.lua | 6 +++++- 3 files changed, 19 insertions(+), 1 deletion(-) create mode 100644 lua/plugins/config/nvim-neorg.lua diff --git a/lua/plugins/config/nvim-neorg.lua b/lua/plugins/config/nvim-neorg.lua new file mode 100644 index 00000000..0cf76d27 --- /dev/null +++ b/lua/plugins/config/nvim-neorg.lua @@ -0,0 +1,13 @@ +require('neorg').setup { + load = { + ["core.defaults"] = {}, + ["core.norg.dirman"] = { + config = { + workspaces = { + work = "~/notes/work", + home = "~/notes/home", + } + } + } + } +} diff --git a/lua/plugins/config/telescope.lua b/lua/plugins/config/telescope.lua index 4014da3f..7dc76209 100644 --- a/lua/plugins/config/telescope.lua +++ b/lua/plugins/config/telescope.lua @@ -95,6 +95,7 @@ telescope.setup{ } }, } +telescope.load_extension("notify") telescope.load_extension('fzf') telescope.load_extension("ui-select") telescope.load_extension('gradle') diff --git a/lua/plugins/init.lua b/lua/plugins/init.lua index 6c179de4..7be47d6a 100644 --- a/lua/plugins/init.lua +++ b/lua/plugins/init.lua @@ -179,6 +179,10 @@ require('packer').startup(function() use "Pocco81/AutoSave.nvim" -- use "nathom/filetype.nvim" + use { + "nvim-neorg/neorg", + requires = "nvim-lua/plenary.nvim" + } end) require('plugins/config/bufferline') @@ -211,5 +215,5 @@ require('plugins/config/nvim-autopairs') require('plugins/config/nvim-dap') require('plugins/config/markdown-preview') require('plugins/config/autosave') +require('plugins/config/nvim-neorg') -require("telescope").load_extension("notify") From 768fcfed011fbd93eb9507962854592d1ae4e367 Mon Sep 17 00:00:00 2001 From: kaiv2 Date: Thu, 14 Apr 2022 22:35:57 +0800 Subject: [PATCH 0134/1278] del norg --- lua/plugins/init.lua | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/lua/plugins/init.lua b/lua/plugins/init.lua index 7be47d6a..a23d560e 100644 --- a/lua/plugins/init.lua +++ b/lua/plugins/init.lua @@ -179,10 +179,10 @@ require('packer').startup(function() use "Pocco81/AutoSave.nvim" -- use "nathom/filetype.nvim" - use { - "nvim-neorg/neorg", - requires = "nvim-lua/plenary.nvim" - } + -- use { + -- "nvim-neorg/neorg", + -- requires = "nvim-lua/plenary.nvim" + -- } end) require('plugins/config/bufferline') @@ -215,5 +215,5 @@ require('plugins/config/nvim-autopairs') require('plugins/config/nvim-dap') require('plugins/config/markdown-preview') require('plugins/config/autosave') -require('plugins/config/nvim-neorg') +-- require('plugins/config/nvim-neorg') From d4cfafe19f7ee942ead6539d308846acc6e8776a Mon Sep 17 00:00:00 2001 From: kaiv2 Date: Thu, 14 Apr 2022 22:51:56 +0800 Subject: [PATCH 0135/1278] config --- lua/plugins/config/asynctasks.lua | 110 +++++++++++++++--------------- 1 file changed, 55 insertions(+), 55 deletions(-) diff --git a/lua/plugins/config/asynctasks.lua b/lua/plugins/config/asynctasks.lua index 4068cfea..fdc0f065 100644 --- a/lua/plugins/config/asynctasks.lua +++ b/lua/plugins/config/asynctasks.lua @@ -4,61 +4,61 @@ vim.g.asynctasks_term_pos = 'floaterm' -- 此配置无效(无效变量) vim.g.asyncrun_term_pos = 'floaterm' -vim.cmd( -[[ -function! s:lf_task_source(...) - let rows = asynctasks#source(&columns * 48 / 100) - let source = [] - for row in rows - let name = row[0] - let source += [name . ' ' . row[1] . ' : ' . row[2] ] - endfor - return source -endfunction - - -function! s:lf_task_accept(line, arg) - let pos = stridx(a:line, '<') - if pos < 0 - return - endif - let name = strpart(a:line, 0, pos) - let name = substitute(name, '^\s*\(.\{-}\)\s*$', '\1', '') - if name != '' - exec "AsyncTask " . name - endif -endfunction - -function! s:lf_task_digest(line, mode) - let pos = stridx(a:line, '<') - if pos < 0 - return [a:line, 0] - endif - let name = strpart(a:line, 0, pos) - return [name, 0] -endfunction - -function! s:lf_win_init(...) - setlocal nonumber - setlocal nowrap -endfunction - - -let g:Lf_Extensions = get(g:, 'Lf_Extensions', {}) -let g:Lf_Extensions.task = { - \ 'source': string(function('s:lf_task_source'))[10:-3], - \ 'accept': string(function('s:lf_task_accept'))[10:-3], - \ 'get_digest': string(function('s:lf_task_digest'))[10:-3], - \ 'highlights_def': { - \ 'Lf_hl_funcScope': '^\S\+', - \ 'Lf_hl_funcDirname': '^\S\+\s*\zs<.*>\ze\s*:', - \ }, - \ 'help' : 'navigate available tasks from asynctasks.vim', - \ } -let g:asynctasks_extra_config = [ - \ '~/.config/nvim/config/local_tasks.ini', - \ ] -]]) +-- vim.cmd( +-- [[ +-- function! s:lf_task_source(...) +-- let rows = asynctasks#source(&columns * 48 / 100) +-- let source = [] +-- for row in rows +-- let name = row[0] +-- let source += [name . ' ' . row[1] . ' : ' . row[2] ] +-- endfor +-- return source +-- endfunction +-- +-- +-- function! s:lf_task_accept(line, arg) +-- let pos = stridx(a:line, '<') +-- if pos < 0 +-- return +-- endif +-- let name = strpart(a:line, 0, pos) +-- let name = substitute(name, '^\s*\(.\{-}\)\s*$', '\1', '') +-- if name != '' +-- exec "AsyncTask " . name +-- endif +-- endfunction +-- +-- function! s:lf_task_digest(line, mode) +-- let pos = stridx(a:line, '<') +-- if pos < 0 +-- return [a:line, 0] +-- endif +-- let name = strpart(a:line, 0, pos) +-- return [name, 0] +-- endfunction +-- +-- function! s:lf_win_init(...) +-- setlocal nonumber +-- setlocal nowrap +-- endfunction +-- +-- +-- let g:Lf_Extensions = get(g:, 'Lf_Extensions', {}) +-- let g:Lf_Extensions.task = { +-- \ 'source': string(function('s:lf_task_source'))[10:-3], +-- \ 'accept': string(function('s:lf_task_accept'))[10:-3], +-- \ 'get_digest': string(function('s:lf_task_digest'))[10:-3], +-- \ 'highlights_def': { +-- \ 'Lf_hl_funcScope': '^\S\+', +-- \ 'Lf_hl_funcDirname': '^\S\+\s*\zs<.*>\ze\s*:', +-- \ }, +-- \ 'help' : 'navigate available tasks from asynctasks.vim', +-- \ } +-- let g:asynctasks_extra_config = [ +-- \ '~/.config/nvim/config/local_tasks.ini', +-- \ ] +-- ]]) -- 未实现 vim.g.asynctasks_template = '~/.config/nvim/config/task_template.ini' From 06c92dc53967ba03e8cfd63985880c5214bab712 Mon Sep 17 00:00:00 2001 From: kaiv2 Date: Thu, 14 Apr 2022 23:23:59 +0800 Subject: [PATCH 0136/1278] update --- init.lua | 21 +++- lua/{ => core}/basic.lua | 0 lua/{ => core}/keybindings.lua | 0 lua/lsp/init.lua | 2 +- lua/lsp/java.lua | 2 +- lua/plugins/config/nvim-cmp.lua | 2 +- lua/plugins/init.lua | 4 + nvim-c1.log | 164 ++++++++++++++++++++++++++++++++ 8 files changed, 190 insertions(+), 5 deletions(-) rename lua/{ => core}/basic.lua (100%) rename lua/{ => core}/keybindings.lua (100%) create mode 100644 nvim-c1.log diff --git a/init.lua b/init.lua index 89832c41..62247dfb 100644 --- a/init.lua +++ b/init.lua @@ -1,7 +1,24 @@ -require('basic') +local present, impatient = pcall(require, "impatient") + +if present then + impatient.enable_profile() +end + +local core_modules = { + "core.basic", + "core.keybindings", +} + +for _, module in ipairs(core_modules) do + local ok, err = pcall(require, module) + if not ok then + error("Error loading " .. module .. "\n\n" .. err) + end +end + + require('plugins') require('lsp') -require('keybindings') -- vim.api.nvim_command('colorscheme gruvbox') vim.cmd[[ diff --git a/lua/basic.lua b/lua/core/basic.lua similarity index 100% rename from lua/basic.lua rename to lua/core/basic.lua diff --git a/lua/keybindings.lua b/lua/core/keybindings.lua similarity index 100% rename from lua/keybindings.lua rename to lua/core/keybindings.lua diff --git a/lua/lsp/init.lua b/lua/lsp/init.lua index 15f197aa..6ed08d0e 100644 --- a/lua/lsp/init.lua +++ b/lua/lsp/init.lua @@ -39,7 +39,7 @@ lsp_installer.on_server_ready(function(server) local function buf_set_keymap(...) vim.api.nvim_buf_set_keymap(bufnr, ...) end -- local function buf_set_option(...) vim.api.nvim_buf_set_option(bufnr, ...) end -- 绑定快捷键 - require('keybindings').maplsp(buf_set_keymap) + require('core.keybindings').maplsp(buf_set_keymap) if m.on_attach then m.on_attach(client, bufnr) end diff --git a/lua/lsp/java.lua b/lua/lsp/java.lua index b70ce765..b0c4f16a 100644 --- a/lua/lsp/java.lua +++ b/lua/lsp/java.lua @@ -214,7 +214,7 @@ M.setup = function () jdtls.start_or_attach(config) local map = vim.api.nvim_set_keymap - require('keybindings').maplsp(map) + require('core.keybindings').maplsp(map) vim.cmd([[ command! -nargs=0 OR :lua require'jdtls'.organize_imports() diff --git a/lua/plugins/config/nvim-cmp.lua b/lua/plugins/config/nvim-cmp.lua index c166e7b9..575b459e 100644 --- a/lua/plugins/config/nvim-cmp.lua +++ b/lua/plugins/config/nvim-cmp.lua @@ -35,7 +35,7 @@ cmp.setup { }), -- 快捷键 - mapping = require'keybindings'.cmp(cmp), + mapping = require'core.keybindings'.cmp(cmp), -- 使用lspkind-nvim显示类型图标 formatting = { format = lspkind.cmp_format({ diff --git a/lua/plugins/init.lua b/lua/plugins/init.lua index a23d560e..268a901a 100644 --- a/lua/plugins/init.lua +++ b/lua/plugins/init.lua @@ -183,6 +183,10 @@ require('packer').startup(function() -- "nvim-neorg/neorg", -- requires = "nvim-lua/plenary.nvim" -- } + -- + -- Is using a standard Neovim install, i.e. built from source or using a + -- provided appimage. + use 'lewis6991/impatient.nvim' end) require('plugins/config/bufferline') diff --git a/nvim-c1.log b/nvim-c1.log new file mode 100644 index 00000000..6330955a --- /dev/null +++ b/nvim-c1.log @@ -0,0 +1,164 @@ + + +times in msec + clock self+sourced self: sourced script + clock elapsed: other lines + +000.007 000.007: --- NVIM STARTING --- +000.633 000.626: locale set +013.682 013.049: inits 1 +013.704 000.022: window checked +017.381 003.676: parsing arguments +017.689 000.309: expanding arguments +017.761 000.072: inits 2 +018.370 000.609: init highlight +018.373 000.003: waiting for UI +020.423 002.049: done waiting for UI +020.442 000.019: init screen for UI +020.468 000.026: init default mappings +020.622 000.154: init default autocommands +051.048 000.031 000.031: sourcing /Users/kailuo/.local/share/nvim/site/pack/packer/start/nvim-treesitter/autoload/nvim_treesitter.vim +175.818 000.330 000.330: sourcing /Users/kailuo/.local/share/nvim/site/pack/packer/start/wilder.nvim/autoload/wilder.vim +176.010 000.019 000.019: sourcing /Users/kailuo/.local/share/nvim/site/pack/packer/start/wilder.nvim/autoload/wilder/setup.vim +176.206 000.024 000.024: sourcing /Users/kailuo/.local/share/nvim/site/pack/packer/start/wilder.nvim/autoload/wilder/options.vim +176.568 000.104 000.104: sourcing /Users/kailuo/.local/share/nvim/site/pack/packer/start/wilder.nvim/autoload/wilder/highlighter.vim +176.803 000.028 000.028: sourcing /Users/kailuo/.local/share/nvim/site/pack/packer/start/wilder.nvim/autoload/wilder/renderer/component/popupmenu_empty_message_with_spinner.vim +177.002 000.021 000.021: sourcing /Users/kailuo/.local/share/nvim/site/pack/packer/start/wilder.nvim/autoload/wilder/renderer/component/spinner.vim +177.234 000.025 000.025: sourcing /Users/kailuo/.local/share/nvim/site/pack/packer/start/wilder.nvim/autoload/wilder/renderer/component/popupmenu_empty_message.vim +177.575 000.147 000.147: sourcing /Users/kailuo/.local/share/nvim/site/pack/packer/start/wilder.nvim/autoload/wilder/renderer/component/popupmenu_devicons.vim +177.750 000.025 000.025: sourcing /Users/kailuo/.local/share/nvim/site/pack/packer/start/wilder.nvim/autoload/wilder/cache.vim +177.967 000.021 000.021: sourcing /Users/kailuo/.local/share/nvim/site/pack/packer/start/wilder.nvim/autoload/wilder/renderer/component/popupmenu_scrollbar.vim +178.225 000.070 000.070: sourcing /Users/kailuo/.local/share/nvim/site/pack/packer/start/wilder.nvim/autoload/wilder/renderer/popupmenu_border_theme.vim +178.509 000.045 000.045: sourcing /Users/kailuo/.local/share/nvim/site/pack/packer/start/wilder.nvim/autoload/wilder/renderer/component/popupmenu_error_message.vim +178.916 000.226 000.226: sourcing /Users/kailuo/.local/share/nvim/site/pack/packer/start/wilder.nvim/autoload/wilder/renderer/popupmenu.vim +179.153 000.078 000.078: sourcing /Users/kailuo/.local/share/nvim/site/pack/packer/start/wilder.nvim/autoload/wilder/render.vim +179.516 000.094 000.094: sourcing /Users/kailuo/.local/share/nvim/site/pack/packer/start/wilder.nvim/autoload/wilder/highlight.vim +180.559 000.075 000.075: sourcing /Users/kailuo/.local/share/nvim/site/pack/packer/start/wilder.nvim/autoload/wilder/renderer/nvim_api.vim +180.829 000.023 000.023: sourcing /Users/kailuo/.local/share/nvim/site/pack/packer/start/wilder.nvim/autoload/wilder/renderer/component/wildmenu_spinner.vim +181.039 000.016 000.016: sourcing /Users/kailuo/.local/share/nvim/site/pack/packer/start/wilder.nvim/autoload/wilder/renderer/component/wildmenu_index.vim +181.254 000.034 000.034: sourcing /Users/kailuo/.local/share/nvim/site/pack/packer/start/wilder.nvim/autoload/wilder/renderer/wildmenu_float_or_popup.vim +181.528 000.124 000.124: sourcing /Users/kailuo/.local/share/nvim/site/pack/packer/start/wilder.nvim/autoload/wilder/renderer/wildmenu.vim +182.677 000.044 000.044: sourcing /Users/kailuo/.local/share/nvim/site/pack/packer/start/wilder.nvim/autoload/wilder/renderer/mux.vim +190.000 000.044 000.044: sourcing /opt/homebrew/Cellar/neovim/0.6.1/share/nvim/runtime/autoload/provider/pythonx.vim +190.314 000.119 000.119: sourcing /opt/homebrew/Cellar/neovim/0.6.1/share/nvim/runtime/autoload/remote/host.vim +190.362 000.567 000.404: sourcing /opt/homebrew/Cellar/neovim/0.6.1/share/nvim/runtime/autoload/provider/python3.vim +190.603 000.013 000.013: sourcing /opt/homebrew/Cellar/neovim/0.6.1/share/nvim/runtime/autoload/provider.vim +248.229 002.696 002.696: sourcing /Users/kailuo/.local/share/nvim/site/pack/packer/start/gruvbox/colors/gruvbox.vim +252.846 002.392 002.392: sourcing /Users/kailuo/.local/share/nvim/site/pack/packer/start/gruvbox/colors/gruvbox.vim +254.659 233.886 226.613: sourcing /Users/kailuo/.config/nvim/init.lua +254.672 000.164: sourcing vimrc file(s) +257.660 000.011 000.011: sourcing /Users/kailuo/.local/share/nvim/site/pack/packer/start/LuaSnip/ftdetect/snippets.vim +257.873 000.010 000.010: sourcing /Users/kailuo/.local/share/nvim/site/pack/packer/start/nvim-treesitter/ftdetect/cooklang.vim +257.906 000.012 000.012: sourcing /Users/kailuo/.local/share/nvim/site/pack/packer/start/nvim-treesitter/ftdetect/fusion.vim +257.944 000.012 000.012: sourcing /Users/kailuo/.local/share/nvim/site/pack/packer/start/nvim-treesitter/ftdetect/gdresource.vim +257.974 000.010 000.010: sourcing /Users/kailuo/.local/share/nvim/site/pack/packer/start/nvim-treesitter/ftdetect/gdscript.vim +258.005 000.011 000.011: sourcing /Users/kailuo/.local/share/nvim/site/pack/packer/start/nvim-treesitter/ftdetect/glimmer.vim +258.037 000.011 000.011: sourcing /Users/kailuo/.local/share/nvim/site/pack/packer/start/nvim-treesitter/ftdetect/glsl.vim +258.070 000.013 000.013: sourcing /Users/kailuo/.local/share/nvim/site/pack/packer/start/nvim-treesitter/ftdetect/gowork.vim +258.104 000.014 000.014: sourcing /Users/kailuo/.local/share/nvim/site/pack/packer/start/nvim-treesitter/ftdetect/graphql.vim +258.139 000.015 000.015: sourcing /Users/kailuo/.local/share/nvim/site/pack/packer/start/nvim-treesitter/ftdetect/hack.vim +258.176 000.017 000.017: sourcing /Users/kailuo/.local/share/nvim/site/pack/packer/start/nvim-treesitter/ftdetect/hcl.vim +258.208 000.012 000.012: sourcing /Users/kailuo/.local/share/nvim/site/pack/packer/start/nvim-treesitter/ftdetect/heex.vim +258.243 000.013 000.013: sourcing /Users/kailuo/.local/share/nvim/site/pack/packer/start/nvim-treesitter/ftdetect/hjson.vim +258.276 000.013 000.013: sourcing /Users/kailuo/.local/share/nvim/site/pack/packer/start/nvim-treesitter/ftdetect/json5.vim +258.315 000.015 000.015: sourcing /Users/kailuo/.local/share/nvim/site/pack/packer/start/nvim-treesitter/ftdetect/ledger.vim +258.348 000.013 000.013: sourcing /Users/kailuo/.local/share/nvim/site/pack/packer/start/nvim-treesitter/ftdetect/nix.vim +258.381 000.013 000.013: sourcing /Users/kailuo/.local/share/nvim/site/pack/packer/start/nvim-treesitter/ftdetect/prisma.vim +258.414 000.014 000.014: sourcing /Users/kailuo/.local/share/nvim/site/pack/packer/start/nvim-treesitter/ftdetect/pug.vim +258.453 000.015 000.015: sourcing /Users/kailuo/.local/share/nvim/site/pack/packer/start/nvim-treesitter/ftdetect/ql.vim +258.492 000.018 000.018: sourcing /Users/kailuo/.local/share/nvim/site/pack/packer/start/nvim-treesitter/ftdetect/query.vim +258.552 000.016 000.016: sourcing /Users/kailuo/.local/share/nvim/site/pack/packer/start/nvim-treesitter/ftdetect/surface.vim +258.590 000.015 000.015: sourcing /Users/kailuo/.local/share/nvim/site/pack/packer/start/nvim-treesitter/ftdetect/teal.vim +258.625 000.015 000.015: sourcing /Users/kailuo/.local/share/nvim/site/pack/packer/start/nvim-treesitter/ftdetect/tlaplus.vim +258.660 000.015 000.015: sourcing /Users/kailuo/.local/share/nvim/site/pack/packer/start/nvim-treesitter/ftdetect/yang.vim +258.778 000.014 000.014: sourcing /Users/kailuo/.local/share/nvim/site/pack/packer/start/vim-fugitive/ftdetect/fugitive.vim +259.088 004.255 003.919: sourcing /opt/homebrew/Cellar/neovim/0.6.1/share/nvim/runtime/filetype.vim +259.268 000.023 000.023: sourcing /opt/homebrew/Cellar/neovim/0.6.1/share/nvim/runtime/ftplugin.vim +259.436 000.015 000.015: sourcing /opt/homebrew/Cellar/neovim/0.6.1/share/nvim/runtime/indent.vim +259.673 000.037 000.037: sourcing /opt/homebrew/Cellar/neovim/0.6.1/share/nvim/runtime/syntax/synload.vim +259.708 000.231 000.194: sourcing /opt/homebrew/Cellar/neovim/0.6.1/share/nvim/runtime/syntax/syntax.vim +261.113 000.093 000.093: sourcing /opt/homebrew/Cellar/neovim/0.6.1/share/nvim/runtime/plugin/gzip.vim +261.141 000.008 000.008: sourcing /opt/homebrew/Cellar/neovim/0.6.1/share/nvim/runtime/plugin/health.vim +261.193 000.032 000.032: sourcing /opt/homebrew/Cellar/neovim/0.6.1/share/nvim/runtime/plugin/man.vim +261.607 000.114 000.114: sourcing /opt/homebrew/Cellar/neovim/0.6.1/share/nvim/runtime/pack/dist/opt/matchit/plugin/matchit.vim +261.692 000.479 000.365: sourcing /opt/homebrew/Cellar/neovim/0.6.1/share/nvim/runtime/plugin/matchit.vim +261.794 000.081 000.081: sourcing /opt/homebrew/Cellar/neovim/0.6.1/share/nvim/runtime/plugin/matchparen.vim +261.827 000.012 000.012: sourcing /opt/homebrew/Cellar/neovim/0.6.1/share/nvim/runtime/plugin/netrwPlugin.vim +263.684 000.100 000.100: sourcing /opt/homebrew/Cellar/neovim/0.6.1/share/nvim/runtime/autoload/remote/define.vim +264.117 002.186 002.085: sourcing /Users/kailuo/.local/share/nvim/rplugin.vim +264.119 002.273 000.087: sourcing /opt/homebrew/Cellar/neovim/0.6.1/share/nvim/runtime/plugin/rplugin.vim +264.194 000.050 000.050: sourcing /opt/homebrew/Cellar/neovim/0.6.1/share/nvim/runtime/plugin/shada.vim +264.236 000.014 000.014: sourcing /opt/homebrew/Cellar/neovim/0.6.1/share/nvim/runtime/plugin/spellfile.vim +264.322 000.065 000.065: sourcing /opt/homebrew/Cellar/neovim/0.6.1/share/nvim/runtime/plugin/tarPlugin.vim +264.391 000.048 000.048: sourcing /opt/homebrew/Cellar/neovim/0.6.1/share/nvim/runtime/plugin/tohtml.vim +264.427 000.013 000.013: sourcing /opt/homebrew/Cellar/neovim/0.6.1/share/nvim/runtime/plugin/tutor.vim +264.532 000.085 000.085: sourcing /opt/homebrew/Cellar/neovim/0.6.1/share/nvim/runtime/plugin/zipPlugin.vim +265.234 000.595 000.595: sourcing /Users/kailuo/.config/nvim/plugin/packer_compiled.lua +265.594 002.550: loading rtp plugins +266.785 000.614 000.614: sourcing /Users/kailuo/.local/share/nvim/site/pack/packer/start/asyncrun.vim/plugin/asyncrun.vim +266.854 000.041 000.041: sourcing /Users/kailuo/.local/share/nvim/site/pack/packer/start/asyncrun.vim/plugin/script_load.vim +267.674 000.615 000.615: sourcing /Users/kailuo/.local/share/nvim/site/pack/packer/start/asynctasks.vim/plugin/asynctasks.vim +267.784 000.082 000.082: sourcing /Users/kailuo/.local/share/nvim/site/pack/packer/start/asynctasks.vim/plugin/task_help.vim +268.001 000.028 000.028: sourcing /Users/kailuo/.local/share/nvim/site/pack/packer/start/AutoSave.nvim/plugin/ascmds.vim +268.251 000.035 000.035: sourcing /Users/kailuo/.local/share/nvim/site/pack/packer/start/calendar.vim/plugin/calendar.vim +268.768 000.128 000.128: sourcing /Users/kailuo/.local/share/nvim/site/pack/packer/start/dashboard-nvim/plugin/dashboard.vim +269.259 000.143 000.143: sourcing /Users/kailuo/.local/share/nvim/site/pack/packer/start/indent-blankline.nvim/plugin/indent_blankline.vim +269.766 000.209 000.209: sourcing /Users/kailuo/.local/share/nvim/site/pack/packer/start/LuaSnip/plugin/luasnip.vim +270.021 000.083 000.083: sourcing /Users/kailuo/.local/share/nvim/site/pack/packer/start/markdown-preview.nvim/plugin/mkdp.vim +270.200 000.020 000.020: sourcing /Users/kailuo/.local/share/nvim/site/pack/packer/start/neoformat/plugin/neoformat.vim +271.852 001.396 001.396: sourcing /Users/kailuo/.local/share/nvim/site/pack/packer/start/nvim-cmp/plugin/cmp.lua +272.002 000.031 000.031: sourcing /Users/kailuo/.local/share/nvim/site/pack/packer/start/nvim-colorizer.lua/plugin/colorizer.vim +272.288 000.028 000.028: sourcing /Users/kailuo/.local/share/nvim/site/pack/packer/start/nvim-jdtls/plugin/nvim_jdtls.vim +272.522 000.066 000.066: sourcing /Users/kailuo/.local/share/nvim/site/pack/packer/start/nvim-lsp-installer/plugin/nvim-lsp-installer.vim +272.954 000.249 000.249: sourcing /Users/kailuo/.local/share/nvim/site/pack/packer/start/nvim-lspconfig/plugin/lspconfig.vim +273.603 000.339 000.339: sourcing /Users/kailuo/.local/share/nvim/site/pack/packer/start/nvim-treesitter/plugin/nvim-treesitter.vim +274.144 000.362 000.362: sourcing /Users/kailuo/.local/share/nvim/site/pack/packer/start/nvim-treesitter-textobjects/plugin/nvim-treesitter-textobjects.vim +274.367 000.030 000.030: sourcing /Users/kailuo/.local/share/nvim/site/pack/packer/start/nvim-web-devicons/plugin/nvim-web-devicons.vim +274.604 000.031 000.031: sourcing /Users/kailuo/.local/share/nvim/site/pack/packer/start/plenary.nvim/plugin/plenary.vim +274.777 000.021 000.021: sourcing /Users/kailuo/.local/share/nvim/site/pack/packer/start/rust-tools.nvim/plugin/rust-tools.vim +275.347 000.102 000.102: sourcing /Users/kailuo/.local/share/nvim/site/pack/packer/start/telescope.nvim/plugin/telescope.vim +275.557 000.056 000.056: sourcing /Users/kailuo/.local/share/nvim/site/pack/packer/start/trouble.nvim/plugin/trouble.vim +275.789 000.083 000.083: sourcing /Users/kailuo/.local/share/nvim/site/pack/packer/start/vim-easy-align/plugin/easy_align.vim +276.068 000.126 000.126: sourcing /Users/kailuo/.local/share/nvim/site/pack/packer/start/vim-floaterm/plugin/floaterm.vim +276.850 000.627 000.627: sourcing /Users/kailuo/.local/share/nvim/site/pack/packer/start/vim-fugitive/plugin/fugitive.vim +278.656 000.036 000.036: sourcing /Users/kailuo/.local/share/nvim/site/pack/packer/start/vim-matchup/autoload/matchup/unmatchit.vim +278.825 000.009 000.009: sourcing /opt/homebrew/Cellar/neovim/0.6.1/share/nvim/runtime/plugin/matchparen.vim +279.208 000.151 000.151: sourcing /Users/kailuo/.local/share/nvim/site/pack/packer/start/vim-matchup/autoload/matchup.vim +279.407 000.062 000.062: sourcing /Users/kailuo/.local/share/nvim/site/pack/packer/start/vim-matchup/autoload/matchup/perf.vim +279.931 000.260 000.260: sourcing /Users/kailuo/.local/share/nvim/site/pack/packer/start/vim-matchup/autoload/matchup/loader.vim +280.438 000.321 000.321: sourcing /Users/kailuo/.local/share/nvim/site/pack/packer/start/vim-matchup/autoload/matchup/matchparen.vim +280.969 003.960 003.120: sourcing /Users/kailuo/.local/share/nvim/site/pack/packer/start/vim-matchup/plugin/matchup.vim +281.453 000.316 000.316: sourcing /Users/kailuo/.local/share/nvim/site/pack/packer/start/vim-table-mode/plugin/table-mode.vim +281.694 000.089 000.089: sourcing /Users/kailuo/.local/share/nvim/site/pack/packer/start/vim-translator/plugin/translator.vim +282.170 000.124 000.124: sourcing /Users/kailuo/.local/share/nvim/site/pack/packer/start/vim-visual-multi/autoload/vm/plugs.vim +282.676 000.220 000.220: sourcing /Users/kailuo/.local/share/nvim/site/pack/packer/start/vim-visual-multi/autoload/vm/maps.vim +282.921 000.093 000.093: sourcing /Users/kailuo/.local/share/nvim/site/pack/packer/start/vim-visual-multi/autoload/vm/maps/all.vim +283.478 001.632 001.195: sourcing /Users/kailuo/.local/share/nvim/site/pack/packer/start/vim-visual-multi/plugin/visual-multi.vim +283.697 000.059 000.059: sourcing /Users/kailuo/.local/share/nvim/site/pack/packer/start/vista.vim/plugin/vista.vim +283.879 000.023 000.023: sourcing /Users/kailuo/.local/share/nvim/site/pack/packer/start/which-key.nvim/plugin/which-key.vim +284.040 006.822: loading packages +284.416 000.020 000.020: sourcing /Users/kailuo/.local/share/nvim/site/pack/packer/start/vim-matchup/after/plugin/matchit.vim +284.632 000.131 000.131: sourcing /Users/kailuo/.local/share/nvim/site/pack/packer/start/cmp-buffer/after/plugin/cmp_buffer.lua +284.769 000.049 000.049: sourcing /Users/kailuo/.local/share/nvim/site/pack/packer/start/cmp-nvim-lsp/after/plugin/cmp_nvim_lsp.lua +284.920 000.070 000.070: sourcing /Users/kailuo/.local/share/nvim/site/pack/packer/start/cmp-path/after/plugin/cmp_path.lua +285.118 000.090 000.090: sourcing /Users/kailuo/.local/share/nvim/site/pack/packer/start/cmp_luasnip/after/plugin/cmp_luasnip.lua +285.227 000.827: loading after plugins +285.233 000.006: inits 3 +288.038 002.806: reading ShaDa +289.114 000.114 000.114: sourcing /Users/kailuo/.local/share/nvim/site/pack/packer/start/vim-matchup/autoload/matchup/ts_engine.vim +289.742 000.033 000.033: sourcing /Users/kailuo/.local/share/nvim/site/pack/packer/start/vim-matchup/autoload/matchup/re.vim +289.888 001.703: opening buffers +289.990 000.102: BufEnter autocommands +289.991 000.001: editing files in windows +296.564 000.175 000.175: sourcing /Users/kailuo/.local/share/nvim/site/pack/packer/start/dashboard-nvim/autoload/dashboard.vim +297.292 000.159 000.159: sourcing /Users/kailuo/.local/share/nvim/site/pack/packer/start/vim-matchup/autoload/matchup/pos.vim +297.975 000.443 000.443: sourcing /Users/kailuo/.local/share/nvim/site/pack/packer/start/vim-matchup/autoload/matchup/delim.vim +298.315 000.041 000.041: sourcing /Users/kailuo/.local/share/nvim/site/pack/packer/start/dashboard-nvim/autoload/dashboard/utils.vim +298.464 000.052 000.052: sourcing /Users/kailuo/.local/share/nvim/site/pack/packer/start/dashboard-nvim/autoload/dashboard/header.vim +298.800 000.106 000.106: sourcing /Users/kailuo/.local/share/nvim/site/pack/packer/start/dashboard-nvim/autoload/dashboard/section.vim +301.688 000.053 000.053: sourcing /Users/kailuo/.local/share/nvim/site/pack/packer/start/dashboard-nvim/syntax/dashboard.vim +303.017 011.995: VimEnter autocommands +303.018 000.001: UIEnter autocommands +303.019 000.001: before starting main loop +305.884 002.866: first screen update +305.886 000.002: --- NVIM STARTED --- From 56419327213ea4250c50998ef3b5328c0c2ec53c Mon Sep 17 00:00:00 2001 From: kaiv2 Date: Thu, 14 Apr 2022 23:27:58 +0800 Subject: [PATCH 0137/1278] update --- nvim-c1.log | 164 ---------------------------------------------------- 1 file changed, 164 deletions(-) delete mode 100644 nvim-c1.log diff --git a/nvim-c1.log b/nvim-c1.log deleted file mode 100644 index 6330955a..00000000 --- a/nvim-c1.log +++ /dev/null @@ -1,164 +0,0 @@ - - -times in msec - clock self+sourced self: sourced script - clock elapsed: other lines - -000.007 000.007: --- NVIM STARTING --- -000.633 000.626: locale set -013.682 013.049: inits 1 -013.704 000.022: window checked -017.381 003.676: parsing arguments -017.689 000.309: expanding arguments -017.761 000.072: inits 2 -018.370 000.609: init highlight -018.373 000.003: waiting for UI -020.423 002.049: done waiting for UI -020.442 000.019: init screen for UI -020.468 000.026: init default mappings -020.622 000.154: init default autocommands -051.048 000.031 000.031: sourcing /Users/kailuo/.local/share/nvim/site/pack/packer/start/nvim-treesitter/autoload/nvim_treesitter.vim -175.818 000.330 000.330: sourcing /Users/kailuo/.local/share/nvim/site/pack/packer/start/wilder.nvim/autoload/wilder.vim -176.010 000.019 000.019: sourcing /Users/kailuo/.local/share/nvim/site/pack/packer/start/wilder.nvim/autoload/wilder/setup.vim -176.206 000.024 000.024: sourcing /Users/kailuo/.local/share/nvim/site/pack/packer/start/wilder.nvim/autoload/wilder/options.vim -176.568 000.104 000.104: sourcing /Users/kailuo/.local/share/nvim/site/pack/packer/start/wilder.nvim/autoload/wilder/highlighter.vim -176.803 000.028 000.028: sourcing /Users/kailuo/.local/share/nvim/site/pack/packer/start/wilder.nvim/autoload/wilder/renderer/component/popupmenu_empty_message_with_spinner.vim -177.002 000.021 000.021: sourcing /Users/kailuo/.local/share/nvim/site/pack/packer/start/wilder.nvim/autoload/wilder/renderer/component/spinner.vim -177.234 000.025 000.025: sourcing /Users/kailuo/.local/share/nvim/site/pack/packer/start/wilder.nvim/autoload/wilder/renderer/component/popupmenu_empty_message.vim -177.575 000.147 000.147: sourcing /Users/kailuo/.local/share/nvim/site/pack/packer/start/wilder.nvim/autoload/wilder/renderer/component/popupmenu_devicons.vim -177.750 000.025 000.025: sourcing /Users/kailuo/.local/share/nvim/site/pack/packer/start/wilder.nvim/autoload/wilder/cache.vim -177.967 000.021 000.021: sourcing /Users/kailuo/.local/share/nvim/site/pack/packer/start/wilder.nvim/autoload/wilder/renderer/component/popupmenu_scrollbar.vim -178.225 000.070 000.070: sourcing /Users/kailuo/.local/share/nvim/site/pack/packer/start/wilder.nvim/autoload/wilder/renderer/popupmenu_border_theme.vim -178.509 000.045 000.045: sourcing /Users/kailuo/.local/share/nvim/site/pack/packer/start/wilder.nvim/autoload/wilder/renderer/component/popupmenu_error_message.vim -178.916 000.226 000.226: sourcing /Users/kailuo/.local/share/nvim/site/pack/packer/start/wilder.nvim/autoload/wilder/renderer/popupmenu.vim -179.153 000.078 000.078: sourcing /Users/kailuo/.local/share/nvim/site/pack/packer/start/wilder.nvim/autoload/wilder/render.vim -179.516 000.094 000.094: sourcing /Users/kailuo/.local/share/nvim/site/pack/packer/start/wilder.nvim/autoload/wilder/highlight.vim -180.559 000.075 000.075: sourcing /Users/kailuo/.local/share/nvim/site/pack/packer/start/wilder.nvim/autoload/wilder/renderer/nvim_api.vim -180.829 000.023 000.023: sourcing /Users/kailuo/.local/share/nvim/site/pack/packer/start/wilder.nvim/autoload/wilder/renderer/component/wildmenu_spinner.vim -181.039 000.016 000.016: sourcing /Users/kailuo/.local/share/nvim/site/pack/packer/start/wilder.nvim/autoload/wilder/renderer/component/wildmenu_index.vim -181.254 000.034 000.034: sourcing /Users/kailuo/.local/share/nvim/site/pack/packer/start/wilder.nvim/autoload/wilder/renderer/wildmenu_float_or_popup.vim -181.528 000.124 000.124: sourcing /Users/kailuo/.local/share/nvim/site/pack/packer/start/wilder.nvim/autoload/wilder/renderer/wildmenu.vim -182.677 000.044 000.044: sourcing /Users/kailuo/.local/share/nvim/site/pack/packer/start/wilder.nvim/autoload/wilder/renderer/mux.vim -190.000 000.044 000.044: sourcing /opt/homebrew/Cellar/neovim/0.6.1/share/nvim/runtime/autoload/provider/pythonx.vim -190.314 000.119 000.119: sourcing /opt/homebrew/Cellar/neovim/0.6.1/share/nvim/runtime/autoload/remote/host.vim -190.362 000.567 000.404: sourcing /opt/homebrew/Cellar/neovim/0.6.1/share/nvim/runtime/autoload/provider/python3.vim -190.603 000.013 000.013: sourcing /opt/homebrew/Cellar/neovim/0.6.1/share/nvim/runtime/autoload/provider.vim -248.229 002.696 002.696: sourcing /Users/kailuo/.local/share/nvim/site/pack/packer/start/gruvbox/colors/gruvbox.vim -252.846 002.392 002.392: sourcing /Users/kailuo/.local/share/nvim/site/pack/packer/start/gruvbox/colors/gruvbox.vim -254.659 233.886 226.613: sourcing /Users/kailuo/.config/nvim/init.lua -254.672 000.164: sourcing vimrc file(s) -257.660 000.011 000.011: sourcing /Users/kailuo/.local/share/nvim/site/pack/packer/start/LuaSnip/ftdetect/snippets.vim -257.873 000.010 000.010: sourcing /Users/kailuo/.local/share/nvim/site/pack/packer/start/nvim-treesitter/ftdetect/cooklang.vim -257.906 000.012 000.012: sourcing /Users/kailuo/.local/share/nvim/site/pack/packer/start/nvim-treesitter/ftdetect/fusion.vim -257.944 000.012 000.012: sourcing /Users/kailuo/.local/share/nvim/site/pack/packer/start/nvim-treesitter/ftdetect/gdresource.vim -257.974 000.010 000.010: sourcing /Users/kailuo/.local/share/nvim/site/pack/packer/start/nvim-treesitter/ftdetect/gdscript.vim -258.005 000.011 000.011: sourcing /Users/kailuo/.local/share/nvim/site/pack/packer/start/nvim-treesitter/ftdetect/glimmer.vim -258.037 000.011 000.011: sourcing /Users/kailuo/.local/share/nvim/site/pack/packer/start/nvim-treesitter/ftdetect/glsl.vim -258.070 000.013 000.013: sourcing /Users/kailuo/.local/share/nvim/site/pack/packer/start/nvim-treesitter/ftdetect/gowork.vim -258.104 000.014 000.014: sourcing /Users/kailuo/.local/share/nvim/site/pack/packer/start/nvim-treesitter/ftdetect/graphql.vim -258.139 000.015 000.015: sourcing /Users/kailuo/.local/share/nvim/site/pack/packer/start/nvim-treesitter/ftdetect/hack.vim -258.176 000.017 000.017: sourcing /Users/kailuo/.local/share/nvim/site/pack/packer/start/nvim-treesitter/ftdetect/hcl.vim -258.208 000.012 000.012: sourcing /Users/kailuo/.local/share/nvim/site/pack/packer/start/nvim-treesitter/ftdetect/heex.vim -258.243 000.013 000.013: sourcing /Users/kailuo/.local/share/nvim/site/pack/packer/start/nvim-treesitter/ftdetect/hjson.vim -258.276 000.013 000.013: sourcing /Users/kailuo/.local/share/nvim/site/pack/packer/start/nvim-treesitter/ftdetect/json5.vim -258.315 000.015 000.015: sourcing /Users/kailuo/.local/share/nvim/site/pack/packer/start/nvim-treesitter/ftdetect/ledger.vim -258.348 000.013 000.013: sourcing /Users/kailuo/.local/share/nvim/site/pack/packer/start/nvim-treesitter/ftdetect/nix.vim -258.381 000.013 000.013: sourcing /Users/kailuo/.local/share/nvim/site/pack/packer/start/nvim-treesitter/ftdetect/prisma.vim -258.414 000.014 000.014: sourcing /Users/kailuo/.local/share/nvim/site/pack/packer/start/nvim-treesitter/ftdetect/pug.vim -258.453 000.015 000.015: sourcing /Users/kailuo/.local/share/nvim/site/pack/packer/start/nvim-treesitter/ftdetect/ql.vim -258.492 000.018 000.018: sourcing /Users/kailuo/.local/share/nvim/site/pack/packer/start/nvim-treesitter/ftdetect/query.vim -258.552 000.016 000.016: sourcing /Users/kailuo/.local/share/nvim/site/pack/packer/start/nvim-treesitter/ftdetect/surface.vim -258.590 000.015 000.015: sourcing /Users/kailuo/.local/share/nvim/site/pack/packer/start/nvim-treesitter/ftdetect/teal.vim -258.625 000.015 000.015: sourcing /Users/kailuo/.local/share/nvim/site/pack/packer/start/nvim-treesitter/ftdetect/tlaplus.vim -258.660 000.015 000.015: sourcing /Users/kailuo/.local/share/nvim/site/pack/packer/start/nvim-treesitter/ftdetect/yang.vim -258.778 000.014 000.014: sourcing /Users/kailuo/.local/share/nvim/site/pack/packer/start/vim-fugitive/ftdetect/fugitive.vim -259.088 004.255 003.919: sourcing /opt/homebrew/Cellar/neovim/0.6.1/share/nvim/runtime/filetype.vim -259.268 000.023 000.023: sourcing /opt/homebrew/Cellar/neovim/0.6.1/share/nvim/runtime/ftplugin.vim -259.436 000.015 000.015: sourcing /opt/homebrew/Cellar/neovim/0.6.1/share/nvim/runtime/indent.vim -259.673 000.037 000.037: sourcing /opt/homebrew/Cellar/neovim/0.6.1/share/nvim/runtime/syntax/synload.vim -259.708 000.231 000.194: sourcing /opt/homebrew/Cellar/neovim/0.6.1/share/nvim/runtime/syntax/syntax.vim -261.113 000.093 000.093: sourcing /opt/homebrew/Cellar/neovim/0.6.1/share/nvim/runtime/plugin/gzip.vim -261.141 000.008 000.008: sourcing /opt/homebrew/Cellar/neovim/0.6.1/share/nvim/runtime/plugin/health.vim -261.193 000.032 000.032: sourcing /opt/homebrew/Cellar/neovim/0.6.1/share/nvim/runtime/plugin/man.vim -261.607 000.114 000.114: sourcing /opt/homebrew/Cellar/neovim/0.6.1/share/nvim/runtime/pack/dist/opt/matchit/plugin/matchit.vim -261.692 000.479 000.365: sourcing /opt/homebrew/Cellar/neovim/0.6.1/share/nvim/runtime/plugin/matchit.vim -261.794 000.081 000.081: sourcing /opt/homebrew/Cellar/neovim/0.6.1/share/nvim/runtime/plugin/matchparen.vim -261.827 000.012 000.012: sourcing /opt/homebrew/Cellar/neovim/0.6.1/share/nvim/runtime/plugin/netrwPlugin.vim -263.684 000.100 000.100: sourcing /opt/homebrew/Cellar/neovim/0.6.1/share/nvim/runtime/autoload/remote/define.vim -264.117 002.186 002.085: sourcing /Users/kailuo/.local/share/nvim/rplugin.vim -264.119 002.273 000.087: sourcing /opt/homebrew/Cellar/neovim/0.6.1/share/nvim/runtime/plugin/rplugin.vim -264.194 000.050 000.050: sourcing /opt/homebrew/Cellar/neovim/0.6.1/share/nvim/runtime/plugin/shada.vim -264.236 000.014 000.014: sourcing /opt/homebrew/Cellar/neovim/0.6.1/share/nvim/runtime/plugin/spellfile.vim -264.322 000.065 000.065: sourcing /opt/homebrew/Cellar/neovim/0.6.1/share/nvim/runtime/plugin/tarPlugin.vim -264.391 000.048 000.048: sourcing /opt/homebrew/Cellar/neovim/0.6.1/share/nvim/runtime/plugin/tohtml.vim -264.427 000.013 000.013: sourcing /opt/homebrew/Cellar/neovim/0.6.1/share/nvim/runtime/plugin/tutor.vim -264.532 000.085 000.085: sourcing /opt/homebrew/Cellar/neovim/0.6.1/share/nvim/runtime/plugin/zipPlugin.vim -265.234 000.595 000.595: sourcing /Users/kailuo/.config/nvim/plugin/packer_compiled.lua -265.594 002.550: loading rtp plugins -266.785 000.614 000.614: sourcing /Users/kailuo/.local/share/nvim/site/pack/packer/start/asyncrun.vim/plugin/asyncrun.vim -266.854 000.041 000.041: sourcing /Users/kailuo/.local/share/nvim/site/pack/packer/start/asyncrun.vim/plugin/script_load.vim -267.674 000.615 000.615: sourcing /Users/kailuo/.local/share/nvim/site/pack/packer/start/asynctasks.vim/plugin/asynctasks.vim -267.784 000.082 000.082: sourcing /Users/kailuo/.local/share/nvim/site/pack/packer/start/asynctasks.vim/plugin/task_help.vim -268.001 000.028 000.028: sourcing /Users/kailuo/.local/share/nvim/site/pack/packer/start/AutoSave.nvim/plugin/ascmds.vim -268.251 000.035 000.035: sourcing /Users/kailuo/.local/share/nvim/site/pack/packer/start/calendar.vim/plugin/calendar.vim -268.768 000.128 000.128: sourcing /Users/kailuo/.local/share/nvim/site/pack/packer/start/dashboard-nvim/plugin/dashboard.vim -269.259 000.143 000.143: sourcing /Users/kailuo/.local/share/nvim/site/pack/packer/start/indent-blankline.nvim/plugin/indent_blankline.vim -269.766 000.209 000.209: sourcing /Users/kailuo/.local/share/nvim/site/pack/packer/start/LuaSnip/plugin/luasnip.vim -270.021 000.083 000.083: sourcing /Users/kailuo/.local/share/nvim/site/pack/packer/start/markdown-preview.nvim/plugin/mkdp.vim -270.200 000.020 000.020: sourcing /Users/kailuo/.local/share/nvim/site/pack/packer/start/neoformat/plugin/neoformat.vim -271.852 001.396 001.396: sourcing /Users/kailuo/.local/share/nvim/site/pack/packer/start/nvim-cmp/plugin/cmp.lua -272.002 000.031 000.031: sourcing /Users/kailuo/.local/share/nvim/site/pack/packer/start/nvim-colorizer.lua/plugin/colorizer.vim -272.288 000.028 000.028: sourcing /Users/kailuo/.local/share/nvim/site/pack/packer/start/nvim-jdtls/plugin/nvim_jdtls.vim -272.522 000.066 000.066: sourcing /Users/kailuo/.local/share/nvim/site/pack/packer/start/nvim-lsp-installer/plugin/nvim-lsp-installer.vim -272.954 000.249 000.249: sourcing /Users/kailuo/.local/share/nvim/site/pack/packer/start/nvim-lspconfig/plugin/lspconfig.vim -273.603 000.339 000.339: sourcing /Users/kailuo/.local/share/nvim/site/pack/packer/start/nvim-treesitter/plugin/nvim-treesitter.vim -274.144 000.362 000.362: sourcing /Users/kailuo/.local/share/nvim/site/pack/packer/start/nvim-treesitter-textobjects/plugin/nvim-treesitter-textobjects.vim -274.367 000.030 000.030: sourcing /Users/kailuo/.local/share/nvim/site/pack/packer/start/nvim-web-devicons/plugin/nvim-web-devicons.vim -274.604 000.031 000.031: sourcing /Users/kailuo/.local/share/nvim/site/pack/packer/start/plenary.nvim/plugin/plenary.vim -274.777 000.021 000.021: sourcing /Users/kailuo/.local/share/nvim/site/pack/packer/start/rust-tools.nvim/plugin/rust-tools.vim -275.347 000.102 000.102: sourcing /Users/kailuo/.local/share/nvim/site/pack/packer/start/telescope.nvim/plugin/telescope.vim -275.557 000.056 000.056: sourcing /Users/kailuo/.local/share/nvim/site/pack/packer/start/trouble.nvim/plugin/trouble.vim -275.789 000.083 000.083: sourcing /Users/kailuo/.local/share/nvim/site/pack/packer/start/vim-easy-align/plugin/easy_align.vim -276.068 000.126 000.126: sourcing /Users/kailuo/.local/share/nvim/site/pack/packer/start/vim-floaterm/plugin/floaterm.vim -276.850 000.627 000.627: sourcing /Users/kailuo/.local/share/nvim/site/pack/packer/start/vim-fugitive/plugin/fugitive.vim -278.656 000.036 000.036: sourcing /Users/kailuo/.local/share/nvim/site/pack/packer/start/vim-matchup/autoload/matchup/unmatchit.vim -278.825 000.009 000.009: sourcing /opt/homebrew/Cellar/neovim/0.6.1/share/nvim/runtime/plugin/matchparen.vim -279.208 000.151 000.151: sourcing /Users/kailuo/.local/share/nvim/site/pack/packer/start/vim-matchup/autoload/matchup.vim -279.407 000.062 000.062: sourcing /Users/kailuo/.local/share/nvim/site/pack/packer/start/vim-matchup/autoload/matchup/perf.vim -279.931 000.260 000.260: sourcing /Users/kailuo/.local/share/nvim/site/pack/packer/start/vim-matchup/autoload/matchup/loader.vim -280.438 000.321 000.321: sourcing /Users/kailuo/.local/share/nvim/site/pack/packer/start/vim-matchup/autoload/matchup/matchparen.vim -280.969 003.960 003.120: sourcing /Users/kailuo/.local/share/nvim/site/pack/packer/start/vim-matchup/plugin/matchup.vim -281.453 000.316 000.316: sourcing /Users/kailuo/.local/share/nvim/site/pack/packer/start/vim-table-mode/plugin/table-mode.vim -281.694 000.089 000.089: sourcing /Users/kailuo/.local/share/nvim/site/pack/packer/start/vim-translator/plugin/translator.vim -282.170 000.124 000.124: sourcing /Users/kailuo/.local/share/nvim/site/pack/packer/start/vim-visual-multi/autoload/vm/plugs.vim -282.676 000.220 000.220: sourcing /Users/kailuo/.local/share/nvim/site/pack/packer/start/vim-visual-multi/autoload/vm/maps.vim -282.921 000.093 000.093: sourcing /Users/kailuo/.local/share/nvim/site/pack/packer/start/vim-visual-multi/autoload/vm/maps/all.vim -283.478 001.632 001.195: sourcing /Users/kailuo/.local/share/nvim/site/pack/packer/start/vim-visual-multi/plugin/visual-multi.vim -283.697 000.059 000.059: sourcing /Users/kailuo/.local/share/nvim/site/pack/packer/start/vista.vim/plugin/vista.vim -283.879 000.023 000.023: sourcing /Users/kailuo/.local/share/nvim/site/pack/packer/start/which-key.nvim/plugin/which-key.vim -284.040 006.822: loading packages -284.416 000.020 000.020: sourcing /Users/kailuo/.local/share/nvim/site/pack/packer/start/vim-matchup/after/plugin/matchit.vim -284.632 000.131 000.131: sourcing /Users/kailuo/.local/share/nvim/site/pack/packer/start/cmp-buffer/after/plugin/cmp_buffer.lua -284.769 000.049 000.049: sourcing /Users/kailuo/.local/share/nvim/site/pack/packer/start/cmp-nvim-lsp/after/plugin/cmp_nvim_lsp.lua -284.920 000.070 000.070: sourcing /Users/kailuo/.local/share/nvim/site/pack/packer/start/cmp-path/after/plugin/cmp_path.lua -285.118 000.090 000.090: sourcing /Users/kailuo/.local/share/nvim/site/pack/packer/start/cmp_luasnip/after/plugin/cmp_luasnip.lua -285.227 000.827: loading after plugins -285.233 000.006: inits 3 -288.038 002.806: reading ShaDa -289.114 000.114 000.114: sourcing /Users/kailuo/.local/share/nvim/site/pack/packer/start/vim-matchup/autoload/matchup/ts_engine.vim -289.742 000.033 000.033: sourcing /Users/kailuo/.local/share/nvim/site/pack/packer/start/vim-matchup/autoload/matchup/re.vim -289.888 001.703: opening buffers -289.990 000.102: BufEnter autocommands -289.991 000.001: editing files in windows -296.564 000.175 000.175: sourcing /Users/kailuo/.local/share/nvim/site/pack/packer/start/dashboard-nvim/autoload/dashboard.vim -297.292 000.159 000.159: sourcing /Users/kailuo/.local/share/nvim/site/pack/packer/start/vim-matchup/autoload/matchup/pos.vim -297.975 000.443 000.443: sourcing /Users/kailuo/.local/share/nvim/site/pack/packer/start/vim-matchup/autoload/matchup/delim.vim -298.315 000.041 000.041: sourcing /Users/kailuo/.local/share/nvim/site/pack/packer/start/dashboard-nvim/autoload/dashboard/utils.vim -298.464 000.052 000.052: sourcing /Users/kailuo/.local/share/nvim/site/pack/packer/start/dashboard-nvim/autoload/dashboard/header.vim -298.800 000.106 000.106: sourcing /Users/kailuo/.local/share/nvim/site/pack/packer/start/dashboard-nvim/autoload/dashboard/section.vim -301.688 000.053 000.053: sourcing /Users/kailuo/.local/share/nvim/site/pack/packer/start/dashboard-nvim/syntax/dashboard.vim -303.017 011.995: VimEnter autocommands -303.018 000.001: UIEnter autocommands -303.019 000.001: before starting main loop -305.884 002.866: first screen update -305.886 000.002: --- NVIM STARTED --- From 8c995e3edd790e0e505f02a0710f296e3dcb3a26 Mon Sep 17 00:00:00 2001 From: kaiv2 Date: Fri, 15 Apr 2022 09:20:52 +0800 Subject: [PATCH 0138/1278] config --- lua/core/keybindings.lua | 3 +++ 1 file changed, 3 insertions(+) diff --git a/lua/core/keybindings.lua b/lua/core/keybindings.lua index c3277ad2..721cadfd 100644 --- a/lua/core/keybindings.lua +++ b/lua/core/keybindings.lua @@ -18,6 +18,9 @@ map('n', '', ':nohlsearch', opt) -- map('n', 'o', ':%bd|e#|bd#', opt) map('n', 'o', 'lua require("utils").close_other_bufline()', opt) map('n', 'w', ':bdelete!', opt) +map("n", '', ":BufferLineCycleNext ", opt) +map("n", '', ":BufferLineCyclePrev ", opt) + -- " 退出 terminal 模式 map('t', '', '', opt) From 4435b4bb07011e5b103cfb47c7d267678cdc872f Mon Sep 17 00:00:00 2001 From: kaiv2 Date: Fri, 15 Apr 2022 10:07:59 +0800 Subject: [PATCH 0139/1278] nvim --- lua/plugins/config/dashboard-nvim.lua | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/lua/plugins/config/dashboard-nvim.lua b/lua/plugins/config/dashboard-nvim.lua index 58d72e9a..8e8758c8 100644 --- a/lua/plugins/config/dashboard-nvim.lua +++ b/lua/plugins/config/dashboard-nvim.lua @@ -5,3 +5,15 @@ local g = vim.g g.dashboard_default_executive = "telescope" -- g.dashboard_custom_header = { -- } + +local startify_ascii_header = { + ' ▟▙ ', + ' ▝▘ ', + '██▃▅▇█▆▖ ▗▟████▙▖ ▄████▄ ██▄ ▄██ ██ ▗▟█▆▄▄▆█▙▖', + '██▛▔ ▝██ ██▄▄▄▄██ ██▛▔▔▜██ ▝██ ██▘ ██ ██▛▜██▛▜██', + '██ ██ ██▀▀▀▀▀▘ ██▖ ▗██ ▜█▙▟█▛ ██ ██ ██ ██', + '██ ██ ▜█▙▄▄▄▟▊ ▀██▙▟██▀ ▝████▘ ██ ██ ██ ██', + '▀▀ ▀▀ ▝▀▀▀▀▀ ▀▀▀▀ ▀▀ ▀▀ ▀▀ ▀▀ ▀▀', + '', + } +g.dashboard_custom_header = startify_ascii_header From 3412c864bdca297e14481874abd65f8541eb33fa Mon Sep 17 00:00:00 2001 From: kaiv2 Date: Fri, 15 Apr 2022 12:42:55 +0800 Subject: [PATCH 0140/1278] lsp jump --- lua/core/keybindings.lua | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lua/core/keybindings.lua b/lua/core/keybindings.lua index 721cadfd..5e925923 100644 --- a/lua/core/keybindings.lua +++ b/lua/core/keybindings.lua @@ -114,8 +114,8 @@ pluginKeys.maplsp = function(mapbuf) mapbuf('n', 'ca', 'lua vim.lsp.buf.code_action()', opt) -- mapbuf('n', 'ca', 'lua require("lspsaga.codeaction").code_action()', opt) -- go xx - mapbuf('n', 'gd', 'lua vim.lsp.buf.definition()', opt) - -- mapbuf('n', 'gd', 'Trouble lsp_definitions', opt) + -- mapbuf('n', 'gd', 'lua vim.lsp.buf.definition()', opt) + mapbuf('n', 'gd', 'Trouble lsp_definitions', opt) mapbuf('n', 'gh', 'lua vim.lsp.buf.hover()', opt) -- mapbuf('n', 'gD', 'lua vim.lsp.buf.declaration()', opt) -- mapbuf('n', 'gD', 'lua vim.lsp.buf.type_definition()', opt) From 3a67b8fb11466b9b3d4f34aee18b69e0e5a525c2 Mon Sep 17 00:00:00 2001 From: kaiv2 Date: Fri, 15 Apr 2022 22:38:40 +0800 Subject: [PATCH 0141/1278] config --- lua/plugins/init.lua | 9 +++++++-- lua/utils/init.lua | 10 ++++++++++ 2 files changed, 17 insertions(+), 2 deletions(-) diff --git a/lua/plugins/init.lua b/lua/plugins/init.lua index 268a901a..d04cb5f4 100644 --- a/lua/plugins/init.lua +++ b/lua/plugins/init.lua @@ -1,4 +1,4 @@ -require('packer').startup(function() +require('packer').startup({function() -- Packer can manage itself use 'wbthomason/packer.nvim' use {'neovim/nvim-lspconfig', 'williamboman/nvim-lsp-installer'} @@ -187,7 +187,12 @@ require('packer').startup(function() -- Is using a standard Neovim install, i.e. built from source or using a -- provided appimage. use 'lewis6991/impatient.nvim' -end) +end, +config = { + display = { + open_fn = require('packer.util').float, + } +}}) require('plugins/config/bufferline') require('plugins/config/nvim-tree') diff --git a/lua/utils/init.lua b/lua/utils/init.lua index 8be7776e..8dd1f4ad 100644 --- a/lua/utils/init.lua +++ b/lua/utils/init.lua @@ -29,4 +29,14 @@ M.close_other_bufline = function () vim.fn.execute('BufferLineCloseLeft') vim.fn.execute('BufferLineCloseRight') end + +M.packer_lazy_load = function(plugin, timer) + if plugin then + timer = timer or 0 + vim.defer_fn(function() + require("packer").loader(plugin) + end, timer) + end +end + return M From f6249bb7a89cc3ba920f528b5f8220a2c2707bce Mon Sep 17 00:00:00 2001 From: kaiv2 Date: Sat, 16 Apr 2022 16:04:00 +0800 Subject: [PATCH 0142/1278] README --- README.md | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/README.md b/README.md index 425f5453..32e53b95 100644 --- a/README.md +++ b/README.md @@ -2,6 +2,13 @@ 支持 `Java`, `Rust`, `C/C++`, `JavaScript` 等编程语言开发。 +## Packer 插件管理器安装 + +```sh +git clone --depth 1 https://github.com/wbthomason/packer.nvim\ + ~/.local/share/nvim/site/pack/packer/start/packer.nvim +``` + ## Java 配置 [NVIM 打造 Java IDE](https://javahello.github.io/dev/tools/NVIM-LSP-Java-IDE.html) From df9bbaf4e38f8a022a339eadb69543871b76fba4 Mon Sep 17 00:00:00 2001 From: kaiv2 Date: Sat, 16 Apr 2022 16:06:58 +0800 Subject: [PATCH 0143/1278] update --- lua/core/keybindings.lua | 2 +- lua/{ => core}/utils/init.lua | 0 2 files changed, 1 insertion(+), 1 deletion(-) rename lua/{ => core}/utils/init.lua (100%) diff --git a/lua/core/keybindings.lua b/lua/core/keybindings.lua index 5e925923..c974fdba 100644 --- a/lua/core/keybindings.lua +++ b/lua/core/keybindings.lua @@ -16,7 +16,7 @@ map('n', 'v', '"+p', opt) map('n', '', ':nohlsearch', opt) -- %bd 删除所有缓冲区, e# 打开最后一个缓冲区, bd# 关闭[No Name] -- map('n', 'o', ':%bd|e#|bd#', opt) -map('n', 'o', 'lua require("utils").close_other_bufline()', opt) +map('n', 'o', 'lua require("core.utils").close_other_bufline()', opt) map('n', 'w', ':bdelete!', opt) map("n", '', ":BufferLineCycleNext ", opt) map("n", '', ":BufferLineCyclePrev ", opt) diff --git a/lua/utils/init.lua b/lua/core/utils/init.lua similarity index 100% rename from lua/utils/init.lua rename to lua/core/utils/init.lua From 70d5e4194ca5de1521240396bb152d0f2ba8e0b4 Mon Sep 17 00:00:00 2001 From: kaiv2 Date: Sun, 17 Apr 2022 20:30:08 +0800 Subject: [PATCH 0144/1278] http --- lua/core/keybindings.lua | 7 +++++++ lua/plugins/config/rest-nvim.lua | 23 +++++++++++++++++++++++ lua/plugins/init.lua | 6 ++++++ 3 files changed, 36 insertions(+) create mode 100644 lua/plugins/config/rest-nvim.lua diff --git a/lua/core/keybindings.lua b/lua/core/keybindings.lua index c974fdba..f710a84c 100644 --- a/lua/core/keybindings.lua +++ b/lua/core/keybindings.lua @@ -59,6 +59,13 @@ map('n', 'r', 'Telescope asynctasks all', opt) map('n', 't', ':TranslateW --engines=google', opt) map('v', 't', ':TranslateW --engines=google', opt) +-- rest-nvim +vim.cmd[[ + command! -nargs=0 Http :lua require'rest-nvim'.run() + command! -nargs=0 HttpCurl :lua require'rest-nvim'.run(true) + command! -nargs=0 HttpLast :lua require'rest-nvim'.last() +]] + -- vim-easy-align vim.cmd([[ " Start interactive EasyAlign in visual mode (e.g. vipga) diff --git a/lua/plugins/config/rest-nvim.lua b/lua/plugins/config/rest-nvim.lua new file mode 100644 index 00000000..e633ed5d --- /dev/null +++ b/lua/plugins/config/rest-nvim.lua @@ -0,0 +1,23 @@ + +require("rest-nvim").setup({ + -- Open request results in a horizontal split + result_split_horizontal = false, + -- Skip SSL verification, useful for unknown certificates + skip_ssl_verification = false, + -- Highlight request on run + highlight = { + enabled = true, + timeout = 150, + }, + result = { + -- toggle showing URL, HTTP info, headers at top the of result window + show_url = true, + show_http_info = true, + show_headers = true, + }, + -- Jump to request line on run + jump_to_request = false, + env_file = '.env', + custom_dynamic_variables = {}, + yank_dry_run = true, +}) diff --git a/lua/plugins/init.lua b/lua/plugins/init.lua index d04cb5f4..ff557638 100644 --- a/lua/plugins/init.lua +++ b/lua/plugins/init.lua @@ -187,6 +187,11 @@ require('packer').startup({function() -- Is using a standard Neovim install, i.e. built from source or using a -- provided appimage. use 'lewis6991/impatient.nvim' + + use { + "NTBBloodbath/rest.nvim", + requires = { "nvim-lua/plenary.nvim" }, + } end, config = { display = { @@ -225,4 +230,5 @@ require('plugins/config/nvim-dap') require('plugins/config/markdown-preview') require('plugins/config/autosave') -- require('plugins/config/nvim-neorg') +require('plugins/config/rest-nvim') From 55c4ed0a67d6b31dd49b9ec9ddb543e6c9b703c6 Mon Sep 17 00:00:00 2001 From: kaiv2 Date: Sun, 17 Apr 2022 21:08:28 +0800 Subject: [PATCH 0145/1278] nvim 7.0 --- lua/core/keybindings.lua | 2 +- lua/plugins/init.lua | 21 ++++++--------------- 2 files changed, 7 insertions(+), 16 deletions(-) diff --git a/lua/core/keybindings.lua b/lua/core/keybindings.lua index f710a84c..87311f20 100644 --- a/lua/core/keybindings.lua +++ b/lua/core/keybindings.lua @@ -111,7 +111,7 @@ local pluginKeys = {} -- lsp 回调函数快捷键设置 pluginKeys.maplsp = function(mapbuf) - vim.api.nvim_buf_set_option(mapbuf, 'omnifunc', 'v:lua.vim.lsp.omnifunc') + -- vim.api.nvim_buf_set_option(0, 'omnifunc', 'v:lua.vim.lsp.omnifunc') mapbuf('n', 'K', 'lua vim.lsp.buf.hover()', opt) -- rename diff --git a/lua/plugins/init.lua b/lua/plugins/init.lua index ff557638..bfd8570f 100644 --- a/lua/plugins/init.lua +++ b/lua/plugins/init.lua @@ -1,6 +1,12 @@ require('packer').startup({function() + + + use { 'nvim-lua/plenary.nvim' } + use { 'lewis6991/impatient.nvim' } + use { 'nathom/filetype.nvim' } -- Packer can manage itself use 'wbthomason/packer.nvim' + use {'neovim/nvim-lspconfig', 'williamboman/nvim-lsp-installer'} use 'kyazdani42/nvim-web-devicons' @@ -75,10 +81,6 @@ require('packer').startup({function() -- git edit 状态显示插件 use { 'lewis6991/gitsigns.nvim', - requires = { - 'nvim-lua/plenary.nvim' - }, - -- tag = 'release' -- To use the latest release } -- 异步任务执行插件 @@ -142,7 +144,6 @@ require('packer').startup({function() -- 搜索插件 use { 'nvim-telescope/telescope.nvim', - requires = { {'nvim-lua/plenary.nvim'} } } use {'nvim-telescope/telescope-ui-select.nvim' } use {'nvim-telescope/telescope-fzf-native.nvim', run = 'make' } @@ -178,19 +179,9 @@ require('packer').startup({function() use "Pocco81/AutoSave.nvim" - -- use "nathom/filetype.nvim" - -- use { - -- "nvim-neorg/neorg", - -- requires = "nvim-lua/plenary.nvim" - -- } - -- - -- Is using a standard Neovim install, i.e. built from source or using a - -- provided appimage. - use 'lewis6991/impatient.nvim' use { "NTBBloodbath/rest.nvim", - requires = { "nvim-lua/plenary.nvim" }, } end, config = { From 6cfbbf6d7c1a502180cc7a2716bdcda6102f1200 Mon Sep 17 00:00:00 2001 From: kaiv2 Date: Sun, 17 Apr 2022 21:37:00 +0800 Subject: [PATCH 0146/1278] update --- lua/plugins/init.lua | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/lua/plugins/init.lua b/lua/plugins/init.lua index bfd8570f..15ab021e 100644 --- a/lua/plugins/init.lua +++ b/lua/plugins/init.lua @@ -81,6 +81,9 @@ require('packer').startup({function() -- git edit 状态显示插件 use { 'lewis6991/gitsigns.nvim', + requires = { + 'nvim-lua/plenary.nvim' + }, } -- 异步任务执行插件 @@ -144,6 +147,9 @@ require('packer').startup({function() -- 搜索插件 use { 'nvim-telescope/telescope.nvim', + requires = { + 'nvim-lua/plenary.nvim' + }, } use {'nvim-telescope/telescope-ui-select.nvim' } use {'nvim-telescope/telescope-fzf-native.nvim', run = 'make' } @@ -182,6 +188,9 @@ require('packer').startup({function() use { "NTBBloodbath/rest.nvim", + requires = { + 'nvim-lua/plenary.nvim' + }, } end, config = { From 87e5c27c5dabcd30a3ec56cc9c742e758b9e27d6 Mon Sep 17 00:00:00 2001 From: kaiv2 Date: Sun, 17 Apr 2022 22:44:06 +0800 Subject: [PATCH 0147/1278] =?UTF-8?q?=E5=BC=82=E6=AD=A5=E5=8A=A0=E8=BD=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lua/plugins/init.lua | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/lua/plugins/init.lua b/lua/plugins/init.lua index 15ab021e..4aac8528 100644 --- a/lua/plugins/init.lua +++ b/lua/plugins/init.lua @@ -199,7 +199,13 @@ config = { } }}) + require('plugins/config/bufferline') +require('plugins/config/indent-blankline') +require('plugins/config/dashboard-nvim') +require('plugins/config/lualine') +-- 异步加载 +vim.defer_fn(function() require('plugins/config/nvim-tree') require('plugins/config/nvim-treesitter') @@ -210,8 +216,6 @@ require('plugins/config/gitsigns-nvim') require('plugins/config/vim-floaterm') require('plugins/config/asynctasks') -- require('plugins/config/feline') -require('plugins/config/lualine') -require('plugins/config/indent-blankline') require('plugins/config/vista') -- require('plugins/config/lsp-colors') require('plugins/config/trouble') @@ -222,7 +226,6 @@ require('plugins/config/comment') -- require('plugins/config/lspsaga') -- require('plugins/config/formatter') require('plugins/config/telescope') -require('plugins/config/dashboard-nvim') -- require('plugins/config/nvim-lsputils') require('plugins/config/nvim-autopairs') -- require('plugins/config/lsp_signature') @@ -232,3 +235,4 @@ require('plugins/config/autosave') -- require('plugins/config/nvim-neorg') require('plugins/config/rest-nvim') +end, 0) From e68d2acb72d321efd7834cba9493032d2212e9b8 Mon Sep 17 00:00:00 2001 From: kaiv2 Date: Sun, 17 Apr 2022 22:53:49 +0800 Subject: [PATCH 0148/1278] config --- init.lua | 17 ++++------------- lua/core/keybindings.lua | 11 +++++++---- lua/plugins/init.lua | 1 + 3 files changed, 12 insertions(+), 17 deletions(-) diff --git a/init.lua b/init.lua index 62247dfb..cff995ea 100644 --- a/init.lua +++ b/init.lua @@ -4,21 +4,12 @@ if present then impatient.enable_profile() end -local core_modules = { - "core.basic", - "core.keybindings", -} - -for _, module in ipairs(core_modules) do - local ok, err = pcall(require, module) - if not ok then - error("Error loading " .. module .. "\n\n" .. err) - end -end - +require('core.basic') require('plugins') -require('lsp') +vim.defer_fn(function () + require('lsp') +end, 0) -- vim.api.nvim_command('colorscheme gruvbox') vim.cmd[[ diff --git a/lua/core/keybindings.lua b/lua/core/keybindings.lua index 87311f20..e2548e18 100644 --- a/lua/core/keybindings.lua +++ b/lua/core/keybindings.lua @@ -4,6 +4,9 @@ local map = vim.api.nvim_set_keymap local opt = {noremap = true, silent = true } +local M = {} + +M.setup = function () -- nvimTree map('n', 'n', ':NvimTreeToggle', opt) -- n 模式下复制内容到系统剪切板 @@ -106,10 +109,10 @@ nnoremap 8 BufferLineGoToBuffer 8 nnoremap 9 BufferLineGoToBuffer 9 ]] -local pluginKeys = {} +end -- lsp 回调函数快捷键设置 -pluginKeys.maplsp = function(mapbuf) +M.maplsp = function(mapbuf) -- vim.api.nvim_buf_set_option(0, 'omnifunc', 'v:lua.vim.lsp.omnifunc') @@ -158,7 +161,7 @@ pluginKeys.maplsp = function(mapbuf) end -- nvim-cmp 自动补全 -pluginKeys.cmp = function(cmp) +M.cmp = function(cmp) local luasnip = require('luasnip'); local has_words_before = function() @@ -208,4 +211,4 @@ return { } end -return pluginKeys +return M diff --git a/lua/plugins/init.lua b/lua/plugins/init.lua index 4aac8528..18d1ffdd 100644 --- a/lua/plugins/init.lua +++ b/lua/plugins/init.lua @@ -235,4 +235,5 @@ require('plugins/config/autosave') -- require('plugins/config/nvim-neorg') require('plugins/config/rest-nvim') +require('core.keybindings').setup() end, 0) From 726f6b64748a2186433eab61a0ae044988210b17 Mon Sep 17 00:00:00 2001 From: kaiv2 Date: Sun, 17 Apr 2022 23:13:38 +0800 Subject: [PATCH 0149/1278] update --- lua/core/keybindings.lua | 16 ++++++++++------ lua/plugins/init.lua | 12 +++++++++++- 2 files changed, 21 insertions(+), 7 deletions(-) diff --git a/lua/core/keybindings.lua b/lua/core/keybindings.lua index e2548e18..48123082 100644 --- a/lua/core/keybindings.lua +++ b/lua/core/keybindings.lua @@ -62,12 +62,6 @@ map('n', 'r', 'Telescope asynctasks all', opt) map('n', 't', ':TranslateW --engines=google', opt) map('v', 't', ':TranslateW --engines=google', opt) --- rest-nvim -vim.cmd[[ - command! -nargs=0 Http :lua require'rest-nvim'.run() - command! -nargs=0 HttpCurl :lua require'rest-nvim'.run(true) - command! -nargs=0 HttpLast :lua require'rest-nvim'.last() -]] -- vim-easy-align vim.cmd([[ @@ -211,4 +205,14 @@ return { } end + +M.rest_nvim = function () +-- rest-nvim +vim.cmd[[ +command! -nargs=0 Http :lua require'rest-nvim'.run() +command! -nargs=0 HttpCurl :lua require'rest-nvim'.run(true) +command! -nargs=0 HttpLast :lua require'rest-nvim'.last() +]] +end + return M diff --git a/lua/plugins/init.lua b/lua/plugins/init.lua index 18d1ffdd..5b80fb35 100644 --- a/lua/plugins/init.lua +++ b/lua/plugins/init.lua @@ -233,7 +233,17 @@ require('plugins/config/nvim-dap') require('plugins/config/markdown-preview') require('plugins/config/autosave') -- require('plugins/config/nvim-neorg') -require('plugins/config/rest-nvim') + +vim.cmd[[ +function RestNvimLoad() + lua require('plugins/config/rest-nvim') + lua require('core.keybindings').rest_nvim() +endfunction +augroup rest_http + autocmd! + autocmd FileType http :call RestNvimLoad() +augroup end +]] require('core.keybindings').setup() end, 0) From 13f889865def731e29ed8f058516071f27f7f691 Mon Sep 17 00:00:00 2001 From: kaiv2 Date: Sun, 17 Apr 2022 23:56:27 +0800 Subject: [PATCH 0150/1278] update --- lua/core/keybindings.lua | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/lua/core/keybindings.lua b/lua/core/keybindings.lua index 48123082..8f37621a 100644 --- a/lua/core/keybindings.lua +++ b/lua/core/keybindings.lua @@ -62,6 +62,18 @@ map('n', 'r', 'Telescope asynctasks all', opt) map('n', 't', ':TranslateW --engines=google', opt) map('v', 't', ':TranslateW --engines=google', opt) +-- rest-nvim +vim.cmd[[ +function! s:http_rest_key() abort + command! -buffer Http :lua require'rest-nvim'.run() + command! -buffer HttpCurl :lua require'rest-nvim'.run(true) + command! -buffer HttpLast :lua require'rest-nvim'.last() +endfunction +augroup http_rest + autocmd! + autocmd FileType http call s:http_rest_key() +augroup end +]] -- vim-easy-align vim.cmd([[ @@ -205,14 +217,4 @@ return { } end - -M.rest_nvim = function () --- rest-nvim -vim.cmd[[ -command! -nargs=0 Http :lua require'rest-nvim'.run() -command! -nargs=0 HttpCurl :lua require'rest-nvim'.run(true) -command! -nargs=0 HttpLast :lua require'rest-nvim'.last() -]] -end - return M From 86240428be95477356014c7e416fe0ba4ed59235 Mon Sep 17 00:00:00 2001 From: kaiv2 Date: Sun, 17 Apr 2022 23:57:57 +0800 Subject: [PATCH 0151/1278] update --- lua/plugins/init.lua | 12 +----------- 1 file changed, 1 insertion(+), 11 deletions(-) diff --git a/lua/plugins/init.lua b/lua/plugins/init.lua index 5b80fb35..18d1ffdd 100644 --- a/lua/plugins/init.lua +++ b/lua/plugins/init.lua @@ -233,17 +233,7 @@ require('plugins/config/nvim-dap') require('plugins/config/markdown-preview') require('plugins/config/autosave') -- require('plugins/config/nvim-neorg') - -vim.cmd[[ -function RestNvimLoad() - lua require('plugins/config/rest-nvim') - lua require('core.keybindings').rest_nvim() -endfunction -augroup rest_http - autocmd! - autocmd FileType http :call RestNvimLoad() -augroup end -]] +require('plugins/config/rest-nvim') require('core.keybindings').setup() end, 0) From 663aaf03a77811a277583b6d5c2fbc577bb5adb1 Mon Sep 17 00:00:00 2001 From: kaiv2 Date: Mon, 18 Apr 2022 00:03:12 +0800 Subject: [PATCH 0152/1278] update --- lua/plugins/init.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lua/plugins/init.lua b/lua/plugins/init.lua index 18d1ffdd..0ed15fd6 100644 --- a/lua/plugins/init.lua +++ b/lua/plugins/init.lua @@ -204,9 +204,9 @@ require('plugins/config/bufferline') require('plugins/config/indent-blankline') require('plugins/config/dashboard-nvim') require('plugins/config/lualine') +require('plugins/config/nvim-tree') -- 异步加载 vim.defer_fn(function() -require('plugins/config/nvim-tree') require('plugins/config/nvim-treesitter') require('plugins/config/luasnip') From 19296ac51888725658539dae1c04ae1d877bd352 Mon Sep 17 00:00:00 2001 From: kaiv2 Date: Mon, 18 Apr 2022 09:17:50 +0800 Subject: [PATCH 0153/1278] http --- lua/core/keybindings.lua | 21 +++++++++------------ lua/plugins/config/rest-nvim.lua | 1 - lua/plugins/init.lua | 11 ++++++++++- 3 files changed, 19 insertions(+), 14 deletions(-) diff --git a/lua/core/keybindings.lua b/lua/core/keybindings.lua index 8f37621a..3dedc856 100644 --- a/lua/core/keybindings.lua +++ b/lua/core/keybindings.lua @@ -62,18 +62,6 @@ map('n', 'r', 'Telescope asynctasks all', opt) map('n', 't', ':TranslateW --engines=google', opt) map('v', 't', ':TranslateW --engines=google', opt) --- rest-nvim -vim.cmd[[ -function! s:http_rest_key() abort - command! -buffer Http :lua require'rest-nvim'.run() - command! -buffer HttpCurl :lua require'rest-nvim'.run(true) - command! -buffer HttpLast :lua require'rest-nvim'.last() -endfunction -augroup http_rest - autocmd! - autocmd FileType http call s:http_rest_key() -augroup end -]] -- vim-easy-align vim.cmd([[ @@ -217,4 +205,13 @@ return { } end +M.rest_nvim = function () +-- rest-nvim +vim.cmd[[ +command! -buffer Http :lua require'rest-nvim'.run() +command! -buffer HttpCurl :lua require'rest-nvim'.run(true) +command! -buffer HttpLast :lua require'rest-nvim'.last() +]] +end + return M diff --git a/lua/plugins/config/rest-nvim.lua b/lua/plugins/config/rest-nvim.lua index e633ed5d..05064d54 100644 --- a/lua/plugins/config/rest-nvim.lua +++ b/lua/plugins/config/rest-nvim.lua @@ -1,4 +1,3 @@ - require("rest-nvim").setup({ -- Open request results in a horizontal split result_split_horizontal = false, diff --git a/lua/plugins/init.lua b/lua/plugins/init.lua index 0ed15fd6..5252df9a 100644 --- a/lua/plugins/init.lua +++ b/lua/plugins/init.lua @@ -233,7 +233,16 @@ require('plugins/config/nvim-dap') require('plugins/config/markdown-preview') require('plugins/config/autosave') -- require('plugins/config/nvim-neorg') -require('plugins/config/rest-nvim') +vim.cmd[[ +function! s:http_rest_init() abort + lua require('plugins/config/rest-nvim') + lua require('core.keybindings').rest_nvim() +endfunction +augroup http_rest + autocmd! + autocmd FileType http call s:http_rest_init() +augroup end +]] require('core.keybindings').setup() end, 0) From 14aef5821202b7c0fe0d5e9e76ba7c0c4c1d9aed Mon Sep 17 00:00:00 2001 From: kaiv2 Date: Mon, 18 Apr 2022 09:57:34 +0800 Subject: [PATCH 0154/1278] lspmap --- lua/core/keybindings.lua | 44 ++++++++++++++++++++-------------------- lua/lsp/init.lua | 3 +-- lua/lsp/java.lua | 3 +-- 3 files changed, 24 insertions(+), 26 deletions(-) diff --git a/lua/core/keybindings.lua b/lua/core/keybindings.lua index 3dedc856..7aea3adf 100644 --- a/lua/core/keybindings.lua +++ b/lua/core/keybindings.lua @@ -106,52 +106,52 @@ nnoremap 9 BufferLineGoToBuffer 9 end -- lsp 回调函数快捷键设置 -M.maplsp = function(mapbuf) +M.maplsp = function(bufnr) - -- vim.api.nvim_buf_set_option(0, 'omnifunc', 'v:lua.vim.lsp.omnifunc') + vim.api.nvim_buf_set_option(bufnr, 'omnifunc', 'v:lua.vim.lsp.omnifunc') - mapbuf('n', 'K', 'lua vim.lsp.buf.hover()', opt) + map('n', 'K', 'lua vim.lsp.buf.hover()', opt) -- rename - mapbuf('n', 'rn', 'lua vim.lsp.buf.rename()', opt) + map('n', 'rn', 'lua vim.lsp.buf.rename()', opt) -- mapbuf('n', 'rn', 'lua require("lspsaga.rename").rename()', opt) -- code action - mapbuf('n', 'ca', 'lua vim.lsp.buf.code_action()', opt) + map('n', 'ca', 'lua vim.lsp.buf.code_action()', opt) -- mapbuf('n', 'ca', 'lua require("lspsaga.codeaction").code_action()', opt) -- go xx -- mapbuf('n', 'gd', 'lua vim.lsp.buf.definition()', opt) - mapbuf('n', 'gd', 'Trouble lsp_definitions', opt) - mapbuf('n', 'gh', 'lua vim.lsp.buf.hover()', opt) + map('n', 'gd', 'Trouble lsp_definitions', opt) + map('n', 'gh', 'lua vim.lsp.buf.hover()', opt) -- mapbuf('n', 'gD', 'lua vim.lsp.buf.declaration()', opt) -- mapbuf('n', 'gD', 'lua vim.lsp.buf.type_definition()', opt) - mapbuf('n', 'gD', 'Trouble lsp_type_definitions', opt) + map('n', 'gD', 'Trouble lsp_type_definitions', opt) -- mapbuf('n', 'gi', 'lua vim.lsp.buf.implementation()', opt) - mapbuf('n', 'gi', 'Trouble lsp_implementations', opt) - mapbuf('n', 'gi', 'Telescope lsp_implementations', opt) + map('n', 'gi', 'Trouble lsp_implementations', opt) + map('n', 'gi', 'Telescope lsp_implementations', opt) -- mapbuf('n', 'gr', 'lua vim.lsp.buf.references()', opt) - mapbuf('n', 'gr', 'Trouble lsp_references', opt) - mapbuf('n', 'gr', 'Telescope lsp_references', opt) + map('n', 'gr', 'Trouble lsp_references', opt) + map('n', 'gr', 'Telescope lsp_references', opt) -- mapbuf('n', 'gr', 'lua require"lspsaga.provider".lsp_finder()', opt) -- mapbuf('n', 's', 'lua vim.lsp.buf.workspace_symbol()', opt) -- mapbuf('n', 's', 'lua require"telescope.builtin".lsp_workspace_symbols({ query = vim.fn.input("Query> ") })', opt) - mapbuf('n', 'sw', 'Telescope lsp_dynamic_workspace_symbols', opt) - mapbuf('n', 'sd', 'Telescope lsp_document_symbols', opt) + map('n', 'sw', 'Telescope lsp_dynamic_workspace_symbols', opt) + map('n', 'sd', 'Telescope lsp_document_symbols', opt) -- diagnostic - mapbuf('n', 'go', 'lua vim.diagnostic.open_float()', opt) - mapbuf('n', '[g', 'lua vim.diagnostic.goto_prev()', opt) - mapbuf('n', ']g', 'lua vim.diagnostic.goto_next()', opt) + map('n', 'go', 'lua vim.diagnostic.open_float()', opt) + map('n', '[g', 'lua vim.diagnostic.goto_prev()', opt) + map('n', ']g', 'lua vim.diagnostic.goto_next()', opt) -- mapbuf('n', 'q', 'lua vim.diagnostic.setloclist()', opt) -- leader + = - mapbuf('n', '=', 'lua vim.lsp.buf.formatting()', opt) + map('n', '=', 'lua vim.lsp.buf.formatting()', opt) -- mapbuf('v', '=', 'lua vim.lsp.buf.formatting()', opt) -- mapbuf('n', '', 'lua vim.lsp.buf.signature_help()', opt) -- mapbuf('n', 'wa', 'lua vim.lsp.buf.add_workspace_folder()', opt) -- mapbuf('n', 'wr', 'lua vim.lsp.buf.remove_workspace_folder()', opt) -- mapbuf('n', 'wl', 'lua print(vim.inspect(vim.lsp.buf.list_workspace_folders()))', opt) -- mapbuf('n', 'D', 'lua vim.lsp.buf.type_definition()', opt) - mapbuf('n', 'xx', 'Trouble', opt) - mapbuf('n', 'xw', 'Trouble workspace_diagnostics', opt) - mapbuf('n', 'xd', 'Trouble document_diagnostics', opt) - mapbuf('n', 'xq', 'Trouble quickfix', opt) + map('n', 'xx', 'Trouble', opt) + map('n', 'xw', 'Trouble workspace_diagnostics', opt) + map('n', 'xd', 'Trouble document_diagnostics', opt) + map('n', 'xq', 'Trouble quickfix', opt) end -- nvim-cmp 自动补全 diff --git a/lua/lsp/init.lua b/lua/lsp/init.lua index 6ed08d0e..dcb1d033 100644 --- a/lua/lsp/init.lua +++ b/lua/lsp/init.lua @@ -36,10 +36,9 @@ lsp_installer.on_server_ready(function(server) local opts = m.config; if opts then opts.on_attach = function(client, bufnr) - local function buf_set_keymap(...) vim.api.nvim_buf_set_keymap(bufnr, ...) end -- local function buf_set_option(...) vim.api.nvim_buf_set_option(bufnr, ...) end -- 绑定快捷键 - require('core.keybindings').maplsp(buf_set_keymap) + require('core.keybindings').maplsp( bufnr) if m.on_attach then m.on_attach(client, bufnr) end diff --git a/lua/lsp/java.lua b/lua/lsp/java.lua index b0c4f16a..92f71018 100644 --- a/lua/lsp/java.lua +++ b/lua/lsp/java.lua @@ -194,6 +194,7 @@ M.setup = function () -- Remove the option if you do not want that. require('jdtls').setup_dap({ hotcodereplace = 'auto' }) require('jdtls.setup').add_commands(); + require('core.keybindings').maplsp(bufnr) -- require('jdtls.dap').setup_dap_main_class_configs({ verbose = true }) end @@ -213,8 +214,6 @@ M.setup = function () jdtls.start_or_attach(config) - local map = vim.api.nvim_set_keymap - require('core.keybindings').maplsp(map) vim.cmd([[ command! -nargs=0 OR :lua require'jdtls'.organize_imports() From dbcd8ad0812948c523b483918b3069fea3943247 Mon Sep 17 00:00:00 2001 From: kaiv2 Date: Mon, 18 Apr 2022 10:53:51 +0800 Subject: [PATCH 0155/1278] http --- lua/core/basic.lua | 1 + 1 file changed, 1 insertion(+) diff --git a/lua/core/basic.lua b/lua/core/basic.lua index ce9abf49..34eb2aaf 100644 --- a/lua/core/basic.lua +++ b/lua/core/basic.lua @@ -41,6 +41,7 @@ vim.cmd('autocmd Filetype css setlocal ts=2 sw=2 expandtab') vim.cmd('autocmd Filetype html setlocal ts=2 sw=2 expandtab') vim.cmd('autocmd Filetype xml setlocal ts=2 sw=2 expandtab') vim.cmd('autocmd Filetype yaml setlocal ts=2 sw=2 expandtab') +vim.cmd('autocmd Filetype http setlocal ts=2 sw=2 expandtab') -- 新行对齐当前行,空格替代tab vim.o.expandtab = true From f20c5be861c4aa3a728e80bd44766a77b978043c Mon Sep 17 00:00:00 2001 From: kaiv2 Date: Tue, 19 Apr 2022 09:14:28 +0800 Subject: [PATCH 0156/1278] =?UTF-8?q?=E5=8E=BB=E6=8E=89=E9=BB=98?= =?UTF-8?q?=E8=AE=A4=E9=80=89=E6=8B=A9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lua/core/keybindings.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lua/core/keybindings.lua b/lua/core/keybindings.lua index 7aea3adf..aa4aa8a7 100644 --- a/lua/core/keybindings.lua +++ b/lua/core/keybindings.lua @@ -178,7 +178,7 @@ return { [""] = cmp.mapping.close(), [""] = cmp.mapping.confirm { behavior = cmp.ConfirmBehavior.Replace, - select = true, + -- select = true, }, [""] = cmp.mapping(function(fallback) From cb6d4f3132f529d18d9a9c7ccbd471585931aadc Mon Sep 17 00:00:00 2001 From: kaiv2 Date: Tue, 19 Apr 2022 09:41:46 +0800 Subject: [PATCH 0157/1278] update --- README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README.md b/README.md index 32e53b95..53f33526 100644 --- a/README.md +++ b/README.md @@ -30,3 +30,5 @@ git clone --depth 1 https://github.com/wbthomason/packer.nvim\ | [telescope.nvim](https://github.com/nvim-telescope/telescope.nvim) | 模糊查找插件,窗口预览 | 8 | | | [lualine.nvim](https://github.com/nvim-lualine/lualine.nvim) | 状态栏插件 | 8 | | | [vim-table-mode](https://github.com/dhruvasagar/vim-table-mode) | table 模式插件 | 10 | | + +感谢[NvChad](https://github.com/NvChad/NvChad), 部分插件和配置参考了 `NvChad` From 79b16a72eadfc383a3b6c780546cbae329049e66 Mon Sep 17 00:00:00 2001 From: kaiv2 Date: Tue, 19 Apr 2022 10:35:45 +0800 Subject: [PATCH 0158/1278] alpha --- lua/plugins/config/alpha-nvim.lua | 49 +++++++++++++++++++++++++++++++ lua/plugins/init.lua | 9 ++++-- 2 files changed, 56 insertions(+), 2 deletions(-) create mode 100644 lua/plugins/config/alpha-nvim.lua diff --git a/lua/plugins/config/alpha-nvim.lua b/lua/plugins/config/alpha-nvim.lua new file mode 100644 index 00000000..ac0dff0a --- /dev/null +++ b/lua/plugins/config/alpha-nvim.lua @@ -0,0 +1,49 @@ +local alpha = require("alpha") +local dashboard = require("alpha.themes.dashboard") + +dashboard.leader = '\\' +-- Set header +dashboard.section.header.val = { + " ", + " ███╗ ██╗███████╗ ██████╗ ██╗ ██╗██╗███╗ ███╗ ", + " ████╗ ██║██╔════╝██╔═══██╗██║ ██║██║████╗ ████║ ", + " ██╔██╗ ██║█████╗ ██║ ██║██║ ██║██║██╔████╔██║ ", + " ██║╚██╗██║██╔══╝ ██║ ██║╚██╗ ██╔╝██║██║╚██╔╝██║ ", + " ██║ ╚████║███████╗╚██████╔╝ ╚████╔╝ ██║██║ ╚═╝ ██║ ", + " ╚═╝ ╚═══╝╚══════╝ ╚═════╝ ╚═══╝ ╚═╝╚═╝ ╚═╝ ", + " ", +} + +-- Set menu +dashboard.section.buttons.val = { + dashboard.button("\\ ff", " Find File", ":Telescope find_files"), + dashboard.button("\\ fg", " Find Word ", ":Telescope live_grep"), + dashboard.button("\\ fo", " Recent File" , ":Telescope oldfiles"), + dashboard.button("\\ es", " Settings" , ":e $MYVIMRC | :cd %:p:h "), + dashboard.button("\\ q ", " Quit NVIM", ":qa"), +} + +-- Set footer +-- NOTE: This is currently a feature in my fork of alpha-nvim (opened PR #21, will update snippet if added to main) +-- To see test this yourself, add the function as a dependecy in packer and uncomment the footer lines +-- ```init.lua +-- return require('packer').startup(function() +-- use 'wbthomason/packer.nvim' +-- use { +-- 'goolord/alpha-nvim', branch = 'feature/startify-fortune', +-- requires = {'BlakeJC94/alpha-nvim-fortune'}, +-- config = function() require("config.alpha") end +-- } +-- end) +-- ``` +-- local fortune = require("alpha.fortune") +-- dashboard.section.footer.val = fortune() + +-- Send config to alpha +alpha.setup(dashboard.opts) + +-- Disable folding on alpha buffer +vim.cmd([[ + autocmd FileType alpha setlocal nofoldenable +]]) + diff --git a/lua/plugins/init.lua b/lua/plugins/init.lua index 5252df9a..3c58c3c8 100644 --- a/lua/plugins/init.lua +++ b/lua/plugins/init.lua @@ -163,7 +163,11 @@ require('packer').startup({function() -- 仪表盘 - use {'glepnir/dashboard-nvim'} + -- use {'glepnir/dashboard-nvim'} + use { + 'goolord/alpha-nvim', + requires = { 'kyazdani42/nvim-web-devicons' }, + } -- 翻译插件 use 'voldikss/vim-translator' @@ -202,7 +206,8 @@ config = { require('plugins/config/bufferline') require('plugins/config/indent-blankline') -require('plugins/config/dashboard-nvim') +-- require('plugins/config/dashboard-nvim') +require('plugins/config/alpha-nvim') require('plugins/config/lualine') require('plugins/config/nvim-tree') -- 异步加载 From 28a764f1eaf4c86e9ffbe06f2a2fa8c51013626b Mon Sep 17 00:00:00 2001 From: kaiv2 Date: Tue, 19 Apr 2022 10:38:12 +0800 Subject: [PATCH 0159/1278] ignored config alpha --- lua/plugins/config/indent-blankline.lua | 2 +- lua/plugins/config/nvim-tree.lua | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/lua/plugins/config/indent-blankline.lua b/lua/plugins/config/indent-blankline.lua index 6d329c36..60895c71 100644 --- a/lua/plugins/config/indent-blankline.lua +++ b/lua/plugins/config/indent-blankline.lua @@ -9,7 +9,7 @@ require("indent_blankline").setup { -- show_current_context_start = true, disable_with_nolist = true, -- filetype_exclude = { "help", "terminal", "packer", "NvimTree", "git", "text" }, - filetype_exclude = { "help", "terminal", "packer", "markdown", "git", "text", "NvimTree", "dashboard" }, + filetype_exclude = { "help", "terminal", "packer", "markdown", "git", "text", "NvimTree", "dashboard", "alpha" }, buftype_exclude = { "terminal" }, use_treesitter = true, context_patterns = { diff --git a/lua/plugins/config/nvim-tree.lua b/lua/plugins/config/nvim-tree.lua index 4e993373..c89533d9 100644 --- a/lua/plugins/config/nvim-tree.lua +++ b/lua/plugins/config/nvim-tree.lua @@ -2,7 +2,7 @@ require'nvim-tree'.setup { disable_netrw = true, hijack_netrw = true, open_on_setup = false, - ignore_ft_on_setup = { "dashboard" }, + ignore_ft_on_setup = { "dashboard", "alpha" }, -- auto_close = true, auto_reload_on_write = true, open_on_tab = false, From a326f8d0bb2bdfc49f3e1f84a8741ff1deb3f26b Mon Sep 17 00:00:00 2001 From: kaiv2 Date: Wed, 20 Apr 2022 09:13:33 +0800 Subject: [PATCH 0160/1278] config --- init.lua | 5 ++++- lua/core/basic.lua | 1 + 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/init.lua b/init.lua index cff995ea..98fc9603 100644 --- a/init.lua +++ b/init.lua @@ -13,8 +13,11 @@ end, 0) -- vim.api.nvim_command('colorscheme gruvbox') vim.cmd[[ -colorscheme gruvbox set background=dark +" g:gruvbox_contrast_dark=hard +" set background=light +" g:gruvbox_contrast_light=medium +colorscheme gruvbox " 丢失配色, 变为透明 " highlight Normal guibg=NONE ctermbg=None ]] diff --git a/lua/core/basic.lua b/lua/core/basic.lua index 34eb2aaf..b2b7bace 100644 --- a/lua/core/basic.lua +++ b/lua/core/basic.lua @@ -42,6 +42,7 @@ vim.cmd('autocmd Filetype html setlocal ts=2 sw=2 expandtab') vim.cmd('autocmd Filetype xml setlocal ts=2 sw=2 expandtab') vim.cmd('autocmd Filetype yaml setlocal ts=2 sw=2 expandtab') vim.cmd('autocmd Filetype http setlocal ts=2 sw=2 expandtab') +vim.cmd('autocmd Filetype markdown setlocal ts=2 sw=2 expandtab') -- 新行对齐当前行,空格替代tab vim.o.expandtab = true From 582f0c0ae1360c7ae0b34ba6e6b501fb9235b3ba Mon Sep 17 00:00:00 2001 From: kaiv2 Date: Sat, 23 Apr 2022 18:44:20 +0800 Subject: [PATCH 0161/1278] default jdk1.8 --- lua/lsp/java.lua | 1 + 1 file changed, 1 insertion(+) diff --git a/lua/lsp/java.lua b/lua/lsp/java.lua index 92f71018..257d22db 100644 --- a/lua/lsp/java.lua +++ b/lua/lsp/java.lua @@ -129,6 +129,7 @@ M.setup = function () { name = "JavaSE-1.8", path = "/Library/Java/JavaVirtualMachines/zulu-8.jdk/Contents/Home", + default = true, }, { name = "JavaSE-11", From 5d61721bab4de7e52b2114359dacc3a4d0e795d3 Mon Sep 17 00:00:00 2001 From: kaiv2 Date: Tue, 26 Apr 2022 23:53:09 +0800 Subject: [PATCH 0162/1278] keybindings --- lua/core/keybindings.lua | 17 +++++++++++++---- lua/lsp/java.lua | 16 +++++++++++----- 2 files changed, 24 insertions(+), 9 deletions(-) diff --git a/lua/core/keybindings.lua b/lua/core/keybindings.lua index aa4aa8a7..b285c634 100644 --- a/lua/core/keybindings.lua +++ b/lua/core/keybindings.lua @@ -21,11 +21,12 @@ map('n', '', ':nohlsearch', opt) -- map('n', 'o', ':%bd|e#|bd#', opt) map('n', 'o', 'lua require("core.utils").close_other_bufline()', opt) map('n', 'w', ':bdelete!', opt) -map("n", '', ":BufferLineCycleNext ", opt) -map("n", '', ":BufferLineCyclePrev ", opt) +map("n", 'p', ":BufferLineCycleNext ", opt) +map("n", 'n', ":BufferLineCyclePrev ", opt) -- " 退出 terminal 模式 map('t', '', '', opt) +map('t', 'jk', '', opt) -- Leaderf -- vim.g.Lf_ShortcutF = '' @@ -34,7 +35,7 @@ map('t', '', '', opt) -- map('n', 'r', ':Leaderf --nowrap task', {}) -- vim-floaterm -vim.g.floaterm_keymap_new = 't' +-- vim.g.floaterm_keymap_new = 'ft' map('n', '', ':FloatermToggle', opt) map('t', ' ', '::FloatermToggle', opt) @@ -101,6 +102,11 @@ nnoremap 6 BufferLineGoToBuffer 6 nnoremap 7 BufferLineGoToBuffer 7 nnoremap 8 BufferLineGoToBuffer 8 nnoremap 9 BufferLineGoToBuffer 9 + +nnoremap h +nnoremap j +nnoremap k +nnoremap l ]] end @@ -119,7 +125,8 @@ M.maplsp = function(bufnr) -- mapbuf('n', 'ca', 'lua require("lspsaga.codeaction").code_action()', opt) -- go xx -- mapbuf('n', 'gd', 'lua vim.lsp.buf.definition()', opt) - map('n', 'gd', 'Trouble lsp_definitions', opt) + -- map('n', 'gd', 'Trouble lsp_definitions', opt) + map('n', 'gd', 'Telescope lsp_definitions', opt) map('n', 'gh', 'lua vim.lsp.buf.hover()', opt) -- mapbuf('n', 'gD', 'lua vim.lsp.buf.declaration()', opt) -- mapbuf('n', 'gD', 'lua vim.lsp.buf.type_definition()', opt) @@ -174,6 +181,8 @@ return { -- Set `select` to `false` to only confirm explicitly selected items. -- [""] = cmp.mapping.scroll_docs(-4), -- [""] = cmp.mapping.scroll_docs(4), + [""] = cmp.mapping.select_prev_item(), + [""] = cmp.mapping.select_next_item(), [""] = cmp.mapping.complete(), [""] = cmp.mapping.close(), [""] = cmp.mapping.confirm { diff --git a/lua/lsp/java.lua b/lua/lsp/java.lua index 257d22db..c7aae78b 100644 --- a/lua/lsp/java.lua +++ b/lua/lsp/java.lua @@ -27,20 +27,26 @@ M.setup = function () '-Declipse.application=org.eclipse.jdt.ls.core.id1', '-Dosgi.bundles.defaultStartLevel=4', '-Declipse.product=org.eclipse.jdt.ls.core.product', + "-Dosgi.configuration.cascaded=true", + "-Dosgi.sharedConfiguration.area=/opt/software/lsp/jdtls/config_mac", + "-Dosgi.sharedConfiguration.area.readOnly=true", '-Dlog.protocol=true', '-Dlog.level=ALL', - '-XX:+UseParallelGC', - '-XX:GCTimeRatio=4', - '-XX:AdaptiveSizePolicyWeight=90', '-Dsun.zip.disableMemoryMapping=true', - '-Xms100m', + "-noverify", + -- '-XX:+UseParallelGC', + -- '-XX:GCTimeRatio=4', + -- '-XX:AdaptiveSizePolicyWeight=90', + '-XX:+UseG1GC', + '-XX:+UseStringDeduplication', + '-Xms1g', '-Xmx2g', '-javaagent:/opt/software/lsp/lombok.jar', '--add-modules=ALL-SYSTEM', '--add-opens', 'java.base/java.util=ALL-UNNAMED', '--add-opens', 'java.base/java.lang=ALL-UNNAMED', '-jar', jdtls_launcher, - '-configuration', '/opt/software/lsp/jdtls/config_mac', + -- '-configuration', '/opt/software/lsp/jdtls/config_mac', '-data', workspace_dir, }, filetypes = {"java"}, From 7905e1b996d665a02af3a2c15383160f85ade94a Mon Sep 17 00:00:00 2001 From: kaiv2 Date: Wed, 27 Apr 2022 09:49:08 +0800 Subject: [PATCH 0163/1278] update config --- lua/core/keybindings.lua | 4 ++-- lua/plugins/config/nvim-tree.lua | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/lua/core/keybindings.lua b/lua/core/keybindings.lua index b285c634..bca198e7 100644 --- a/lua/core/keybindings.lua +++ b/lua/core/keybindings.lua @@ -21,8 +21,8 @@ map('n', '', ':nohlsearch', opt) -- map('n', 'o', ':%bd|e#|bd#', opt) map('n', 'o', 'lua require("core.utils").close_other_bufline()', opt) map('n', 'w', ':bdelete!', opt) -map("n", 'p', ":BufferLineCycleNext ", opt) -map("n", 'n', ":BufferLineCyclePrev ", opt) +map("n", 'n', ":BufferLineCycleNext ", opt) +map("n", 'p', ":BufferLineCyclePrev ", opt) -- " 退出 terminal 模式 map('t', '', '', opt) diff --git a/lua/plugins/config/nvim-tree.lua b/lua/plugins/config/nvim-tree.lua index c89533d9..337e5edb 100644 --- a/lua/plugins/config/nvim-tree.lua +++ b/lua/plugins/config/nvim-tree.lua @@ -55,8 +55,8 @@ require'nvim-tree'.setup { timeout = 400, }, view = { - width = '34%', - height = '40%', + width = 34, + height = 40, hide_root_folder = true, side = 'left', preserve_window_proportions = false, From cdf1ca610a8ba12201d3452d6368f461d618a7d6 Mon Sep 17 00:00:00 2001 From: kaiv2 Date: Fri, 29 Apr 2022 00:20:17 +0800 Subject: [PATCH 0164/1278] camel_case --- lua/core/keybindings.lua | 2 + lua/core/utils/init.lua | 115 +++++++++++++++++++++++++++++++++++++++ 2 files changed, 117 insertions(+) diff --git a/lua/core/keybindings.lua b/lua/core/keybindings.lua index bca198e7..c47acd90 100644 --- a/lua/core/keybindings.lua +++ b/lua/core/keybindings.lua @@ -63,6 +63,8 @@ map('n', 'r', 'Telescope asynctasks all', opt) map('n', 't', ':TranslateW --engines=google', opt) map('v', 't', ':TranslateW --engines=google', opt) +-- camel_case +require('core.utils').camel_case_init() -- vim-easy-align vim.cmd([[ diff --git a/lua/core/utils/init.lua b/lua/core/utils/init.lua index 8dd1f4ad..d672d541 100644 --- a/lua/core/utils/init.lua +++ b/lua/core/utils/init.lua @@ -39,4 +39,119 @@ M.packer_lazy_load = function(plugin, timer) end end +M.is_upper = function (c) + return c >= 65 and c <= 90 +end + +M.is_lower = function (c) + return c >= 97 and c <= 122 +end +M.char_size = function(c) + local code = c; + if code < 127 then + return 1 + elseif code <= 223 then + return 2 + elseif code <= 239 then + return 3 + elseif code <= 247 then + return 4 + end + return nil +end + +M.camel_case = function (word) + if word:find('_') then + return M.camel_case_c(word) + else + return M.camel_case_u(word) + end +end +M.camel_case_u = function (word) + local result = {} + local len = word:len() + local i = 1 + while i <= len do + local c = word:byte(i) + local cs = M.char_size(c) + if cs == nil then + return word + end + if cs == 1 and M.is_upper(c) and i ~= 1 then + table.insert(result, '_') + end + local e = i + cs; + table.insert(result, word:sub(i, e -1)) + i = e + end + return table.concat(result, ''):upper() +end +M.camel_case_c = function (word) + local w = word:lower() + local result = {} + local sc = 95 + local f = false + local len = word:len() + local i = 1 + while i <= len do + local c = w:byte(i) + local cs = M.char_size(c) + local e = i + cs; + if cs == nil then + return word + end + local cf = f; + if f then + f = false + end + if c == sc then + f = true + else + if cs == 1 and cf then + table.insert(result, string.char(c):upper()) + else + table.insert(result, w:sub(i, e -1)) + end + end + i = e + end + return table.concat(result, '') +end +M.camel_case_start = function (r, l1, l2) + local word + if r == 0 then + word = vim.fn.expand('') + vim.fn.setreg('"', M.camel_case(word)) + elseif l1 == l2 then + word = vim.fn.getline('.') + local ln1 = vim.fn.getpos("'<") + local ln2 = vim.fn.getpos("'>") + local cs = ln1[3] + local ce = ln2[3] + local ecs = M.char_size(word:byte(ce)) + if ecs ~= 1 then + ce = ce + ecs - 1 + end + word = word:sub(cs, ce) + local reg_tmp = vim.fn.getreg('a') + vim.fn.setreg('a', M.camel_case(word)) + vim.cmd('normal! gv"ap') + vim.fn.setreg('a', reg_tmp) + else + vim.notify('请选择单行字符', vim.log.levels.WARN) + end +end +M.test = function (a) + print(a) +end +M.camel_case_init = function () + vim.cmd[[ + " command! -complete=customlist,coreutils#cmdline#complete -nargs=* -bang -range + command! -nargs=* -range + \ CamelCase + \ lua require('core.utils').camel_case_start(, , ) +]] +end +-- print(M.camel_case("helloWorldAaAaAxC")) + return M From 2a8ddd775cbea85aa5048331599edf1eeb07a25e Mon Sep 17 00:00:00 2001 From: kaiv2 Date: Fri, 29 Apr 2022 00:24:46 +0800 Subject: [PATCH 0165/1278] update --- lua/core/utils/init.lua | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/lua/core/utils/init.lua b/lua/core/utils/init.lua index d672d541..fac737a2 100644 --- a/lua/core/utils/init.lua +++ b/lua/core/utils/init.lua @@ -61,6 +61,9 @@ M.char_size = function(c) end M.camel_case = function (word) + if word == '' or word == nil then + return + end if word:find('_') then return M.camel_case_c(word) else @@ -121,7 +124,10 @@ M.camel_case_start = function (r, l1, l2) local word if r == 0 then word = vim.fn.expand('') - vim.fn.setreg('"', M.camel_case(word)) + local cw = M.camel_case(word) + if cw then + vim.fn.setreg('"', M.camel_case(word)) + end elseif l1 == l2 then word = vim.fn.getline('.') local ln1 = vim.fn.getpos("'<") From 0a0e919c3533f26dbc79077bfefc4a8840ee9b0d Mon Sep 17 00:00:00 2001 From: kaiv2 Date: Fri, 29 Apr 2022 12:51:41 +0800 Subject: [PATCH 0166/1278] update --- lua/core/utils/init.lua | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/lua/core/utils/init.lua b/lua/core/utils/init.lua index fac737a2..8a7c2561 100644 --- a/lua/core/utils/init.lua +++ b/lua/core/utils/init.lua @@ -74,14 +74,21 @@ M.camel_case_u = function (word) local result = {} local len = word:len() local i = 1 + local f = true while i <= len do local c = word:byte(i) local cs = M.char_size(c) + local cf = f if cs == nil then return word end - if cs == 1 and M.is_upper(c) and i ~= 1 then - table.insert(result, '_') + if cs == 1 and M.is_upper(c) then + f = false; + if cf and i ~= 1 then + table.insert(result, '_') + end + else + f = true end local e = i + cs; table.insert(result, word:sub(i, e -1)) From 8eacb24390a87101fee19012ad32bdb13bbc4ada Mon Sep 17 00:00:00 2001 From: kaiv2 Date: Mon, 2 May 2022 21:35:22 +0800 Subject: [PATCH 0167/1278] update --- lua/lsp/java.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lua/lsp/java.lua b/lua/lsp/java.lua index c7aae78b..308a6134 100644 --- a/lua/lsp/java.lua +++ b/lua/lsp/java.lua @@ -39,7 +39,7 @@ M.setup = function () -- '-XX:AdaptiveSizePolicyWeight=90', '-XX:+UseG1GC', '-XX:+UseStringDeduplication', - '-Xms1g', + '-Xms512m', '-Xmx2g', '-javaagent:/opt/software/lsp/lombok.jar', '--add-modules=ALL-SYSTEM', From a9ad2f5e2993cfc2b7044f763af3a3e6ed8b2c22 Mon Sep 17 00:00:00 2001 From: kaiv2 Date: Tue, 10 May 2022 09:48:13 +0800 Subject: [PATCH 0168/1278] config env --- lua/lsp/java.lua | 46 +++++++++++++++++++++++++++++++++++++--------- 1 file changed, 37 insertions(+), 9 deletions(-) diff --git a/lua/lsp/java.lua b/lua/lsp/java.lua index 308a6134..f96fa719 100644 --- a/lua/lsp/java.lua +++ b/lua/lsp/java.lua @@ -1,34 +1,62 @@ local M = {} local env = { -- HOME = vim.loop.os_homedir(), - MAVEN_SETTINGS = os.getenv 'MAVEN_SETTINGS', + JAVA_HOME = os.getenv('JAVA_HOME'), + MAVEN_HOME = os.getenv('MAVEN_HOME'), + MAVEN_SETTINGS = os.getenv('MAVEN_SETTINGS'), + JDTLS_HOME = os.getenv('JDTLS_HOME'), + JDTLS_WORKSPACE = os.getenv('JDTLS_WORKSPACE'), + LOMBOK_JAR = os.getenv('LOMBOK_JAR'), } -local maven_settings = '/opt/software/apache-maven-3.6.3/conf/settings.xml' +local function or_default(a, v) + return a and a or v +end + +local maven_settings = env.MAVEN_HOME .. '/conf/settings.xml' local function get_maven_settings() - return env.MAVEN_SETTINGS and env.MAVEN_SETTINGS or maven_settings + return or_default(env.MAVEN_SETTINGS, maven_settings) +end + +local function get_java_home() + return or_default(env.JAVA_HOME, '/Library/Java/JavaVirtualMachines/zulu-11.jdk/Contents/Home') +end +local function get_java() + return get_java_home() .. '/bin/java' end +local jdtls_root = "/Users/kailuo/workspace/JavaProjects/eclipse.jdt.ls/org.eclipse.jdt.ls.product/target/repository" +local function get_jdtls_home() + return or_default(env.JDTLS_HOME, jdtls_root) +end + +local function get_jdtls_workspace() + return or_default(env.JDTLS_WORKSPACE, '/Users/kailuo/jdtls-workspace/') +end + +local function get_lombok_jar() + return or_default(env.LOMBOK_JAR, '/opt/software/lsp/lombok.jar') +end M.setup = function () local project_name = vim.fn.fnamemodify(vim.fn.getcwd(), ':p:h:t') -- local workspace_dir = '/Users/kailuo/jdtls-workspace/' .. project_name - local workspace_dir = '/Users/kailuo/jdtls-workspace/' .. project_name + local workspace_dir = get_jdtls_workspace() .. project_name - local jdtls_launcher = vim.fn.glob("/opt/software/lsp/jdtls/plugins/org.eclipse.equinox.launcher_*.jar"); + local jdtls_launcher = vim.fn.glob(get_jdtls_home() .. "/plugins/org.eclipse.equinox.launcher_*.jar"); -- See `:help vim.lsp.start_client` for an overview of the supported `config` options. local config = { -- The command that starts the language server -- See: https://github.com/eclipse/eclipse.jdt.ls#running-from-the-command-line cmd = { - '/Library/Java/JavaVirtualMachines/zulu-11.jdk/Contents/Home/bin/java', -- or '/path/to/java11_or_newer/bin/java' + get_java(), -- or '/path/to/java11_or_newer/bin/java' '-Declipse.application=org.eclipse.jdt.ls.core.id1', '-Dosgi.bundles.defaultStartLevel=4', '-Declipse.product=org.eclipse.jdt.ls.core.product', "-Dosgi.configuration.cascaded=true", - "-Dosgi.sharedConfiguration.area=/opt/software/lsp/jdtls/config_mac", + "-Dosgi.sharedConfiguration.area=" .. get_jdtls_home() .. "/config_mac", "-Dosgi.sharedConfiguration.area.readOnly=true", '-Dlog.protocol=true', '-Dlog.level=ALL', @@ -41,7 +69,7 @@ M.setup = function () '-XX:+UseStringDeduplication', '-Xms512m', '-Xmx2g', - '-javaagent:/opt/software/lsp/lombok.jar', + '-javaagent:' .. get_lombok_jar(), '--add-modules=ALL-SYSTEM', '--add-opens', 'java.base/java.util=ALL-UNNAMED', '--add-opens', 'java.base/java.lang=ALL-UNNAMED', @@ -61,7 +89,7 @@ M.setup = function () -- for a list of options settings = { java = { - home = "/Library/Java/JavaVirtualMachines/zulu-11.jdk/Contents/Home", + home = get_java_home(), project = { resourceFilters = { "node_modules", From afe6bafde3e96b1e7dea4ac7a00ad6edf2a83a54 Mon Sep 17 00:00:00 2001 From: kaiv2 Date: Tue, 10 May 2022 10:11:13 +0800 Subject: [PATCH 0169/1278] =?UTF-8?q?=E7=BB=9F=E4=B8=80=E7=9B=AE=E5=BD=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lua/lsp/java.lua | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/lua/lsp/java.lua b/lua/lsp/java.lua index f96fa719..8aa4edd9 100644 --- a/lua/lsp/java.lua +++ b/lua/lsp/java.lua @@ -6,6 +6,7 @@ local env = { MAVEN_SETTINGS = os.getenv('MAVEN_SETTINGS'), JDTLS_HOME = os.getenv('JDTLS_HOME'), JDTLS_WORKSPACE = os.getenv('JDTLS_WORKSPACE'), + JDTLS_EXTENSIONS = os.getenv('JDTLS_EXTENSIONS'), LOMBOK_JAR = os.getenv('LOMBOK_JAR'), } @@ -38,6 +39,10 @@ local function get_lombok_jar() return or_default(env.LOMBOK_JAR, '/opt/software/lsp/lombok.jar') end +local function get_jdtls_extensions() + return or_default(env.JDTLS_EXTENSIONS, '/opt/software/lsp/java') +end + M.setup = function () local project_name = vim.fn.fnamemodify(vim.fn.getcwd(), ':p:h:t') @@ -196,19 +201,19 @@ M.setup = function () -- This bundles definition is the same as in the previous section (java-debug installation) local bundles = { - vim.fn.glob("/opt/software/lsp/java/java-debug/com.microsoft.java.debug.plugin/target/com.microsoft.java.debug.plugin-*.jar") + vim.fn.glob(get_jdtls_extensions() .. "/java-debug/com.microsoft.java.debug.plugin/target/com.microsoft.java.debug.plugin-*.jar") }; -- /opt/software/lsp/java/vscode-java-test/server -- vim.list_extend(bundles, vim.split(vim.fn.glob("/opt/software/lsp/java/vscode-java-test/server/*.jar"), "\n")); - for _, bundle in ipairs(vim.split(vim.fn.glob("/opt/software/lsp/java/vscode-java-test/server/*.jar"), "\n")) do + for _, bundle in ipairs(vim.split(vim.fn.glob(get_jdtls_extensions() .. "/vscode-java-test/server/*.jar"), "\n")) do if not vim.endswith(bundle, 'com.microsoft.java.test.runner-jar-with-dependencies.jar') then table.insert(bundles, bundle) end end -- /opt/software/lsp/java/vscode-java-decompiler/server/ - vim.list_extend(bundles, vim.split(vim.fn.glob("/opt/software/lsp/java/vscode-java-decompiler/server/*.jar"), "\n")); + vim.list_extend(bundles, vim.split(vim.fn.glob(get_jdtls_extensions() .. "/vscode-java-decompiler/server/*.jar"), "\n")); -- /opt/software/lsp/java/vscode-java-dependency/jdtls.ext/ -- vim.list_extend(bundles, vim.split(vim.fn.glob("/opt/software/lsp/java/vscode-java-dependency/jdtls.ext/com.microsoft.jdtls.ext.core/target/com.microsoft.jdtls.ext.core-*.jar"), "\n")); From 5eb1dda76f410a7d77a262ae089b562e87619d19 Mon Sep 17 00:00:00 2001 From: kaiv2 Date: Tue, 10 May 2022 21:06:59 +0800 Subject: [PATCH 0170/1278] nvim-lsp-installer config update --- lua/lsp/init.lua | 21 ++++++++++----------- 1 file changed, 10 insertions(+), 11 deletions(-) diff --git a/lua/lsp/init.lua b/lua/lsp/init.lua index dcb1d033..b1923f35 100644 --- a/lua/lsp/init.lua +++ b/lua/lsp/init.lua @@ -1,4 +1,5 @@ -local lsp_installer = require "nvim-lsp-installer" +local lsp_installer = require('nvim-lsp-installer') +local lspconfig = require('lspconfig') -- 安装列表 -- https://github.com/williamboman/nvim-lsp-installer#available-lsps @@ -30,9 +31,8 @@ end local capabilities = require('cmp_nvim_lsp').update_capabilities(vim.lsp.protocol.make_client_capabilities()) -- 没有确定使用效果参数 -- capabilities.textDocument.completion.completionItem.snippetSupport = true - -lsp_installer.on_server_ready(function(server) - local m = servers[server.name] +lsp_installer.setup({}) +for name, m in pairs(servers) do local opts = m.config; if opts then opts.on_attach = function(client, bufnr) @@ -50,24 +50,23 @@ lsp_installer.on_server_ready(function(server) opts.capabilities = capabilities; end - if server.name == "rust_analyzer" then + if name == "rust_analyzer" then -- Initialize the LSP via rust-tools instead require("rust-tools").setup { -- The "server" property provided in rust-tools setup function are the - -- settings rust-tools will provide to lspconfig during init. -- + -- settings rust-tools will provide to lspconfig during init. -- -- We merge the necessary settings from nvim-lsp-installer (server:get_default_options()) -- with the user's own settings (opts). - dap = m.dap, - server = vim.tbl_deep_extend("force", server:get_default_options(), opts), + dap = m.dap, + server = opts, } - server:attach_buffers() -- Only if standalone support is needed require("rust-tools").start_standalone_if_required() else - server:setup(opts) + lspconfig[name].setup(opts) end -end) +end -- LSP 相关美化参考 https://github.com/NvChad/NvChad local function lspSymbol(name, icon) local hl = "DiagnosticSign" .. name From 41fd9805bc6e3e54ec39a16bb9668f3769cfa4ba Mon Sep 17 00:00:00 2001 From: kaiv2 Date: Tue, 10 May 2022 21:22:25 +0800 Subject: [PATCH 0171/1278] update --- lua/lsp/init.lua | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lua/lsp/init.lua b/lua/lsp/init.lua index b1923f35..99502860 100644 --- a/lua/lsp/init.lua +++ b/lua/lsp/init.lua @@ -58,10 +58,10 @@ for name, m in pairs(servers) do -- We merge the necessary settings from nvim-lsp-installer (server:get_default_options()) -- with the user's own settings (opts). dap = m.dap, - server = opts, + server = { on_attach = opts.on_attach }, } -- Only if standalone support is needed - require("rust-tools").start_standalone_if_required() + -- require("rust-tools").start_standalone_if_required() else lspconfig[name].setup(opts) end From 3d45e734c48c59e9c77a57c8ffca9c1370558216 Mon Sep 17 00:00:00 2001 From: kaiv2 Date: Tue, 10 May 2022 21:47:18 +0800 Subject: [PATCH 0172/1278] update --- lua/lsp/init.lua | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/lua/lsp/init.lua b/lua/lsp/init.lua index 99502860..a2003ed3 100644 --- a/lua/lsp/init.lua +++ b/lua/lsp/init.lua @@ -58,7 +58,11 @@ for name, m in pairs(servers) do -- We merge the necessary settings from nvim-lsp-installer (server:get_default_options()) -- with the user's own settings (opts). dap = m.dap, - server = { on_attach = opts.on_attach }, + server = { + on_attach = opts.on_attach, + capabilities = opts.capabilities, + standalone = false, + }, } -- Only if standalone support is needed -- require("rust-tools").start_standalone_if_required() From ed1411bec210282fe4235df1b37a31fb0f80d619 Mon Sep 17 00:00:00 2001 From: kaiv2 Date: Wed, 11 May 2022 09:23:37 +0800 Subject: [PATCH 0173/1278] rust config --- lua/lsp/init.lua | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/lua/lsp/init.lua b/lua/lsp/init.lua index a2003ed3..b8c79177 100644 --- a/lua/lsp/init.lua +++ b/lua/lsp/init.lua @@ -62,6 +62,18 @@ for name, m in pairs(servers) do on_attach = opts.on_attach, capabilities = opts.capabilities, standalone = false, + settings = { + ["rust-analyzer"] = { + completion = { + postfix = { + enable = false + } + }, + checkOnSave = { + command = "clippy" + }, + } + } }, } -- Only if standalone support is needed From 862177148f1a07ba6856fdc3b004216f91f36a4f Mon Sep 17 00:00:00 2001 From: kaiv2 Date: Wed, 11 May 2022 10:16:08 +0800 Subject: [PATCH 0174/1278] update --- lua/core/keybindings.lua | 44 ++++++++++++++++++++-------------------- lua/lsp/init.lua | 2 +- lua/lsp/java.lua | 2 +- 3 files changed, 24 insertions(+), 24 deletions(-) diff --git a/lua/core/keybindings.lua b/lua/core/keybindings.lua index c47acd90..7de2c024 100644 --- a/lua/core/keybindings.lua +++ b/lua/core/keybindings.lua @@ -114,53 +114,53 @@ nnoremap l end -- lsp 回调函数快捷键设置 -M.maplsp = function(bufnr) +M.maplsp = function(client, bufnr) vim.api.nvim_buf_set_option(bufnr, 'omnifunc', 'v:lua.vim.lsp.omnifunc') - map('n', 'K', 'lua vim.lsp.buf.hover()', opt) + vim.api.nvim_buf_set_keymap(bufnr, 'n', 'K', 'lua vim.lsp.buf.hover()', opt) -- rename - map('n', 'rn', 'lua vim.lsp.buf.rename()', opt) + vim.api.nvim_buf_set_keymap(bufnr, 'n', 'rn', 'lua vim.lsp.buf.rename()', opt) -- mapbuf('n', 'rn', 'lua require("lspsaga.rename").rename()', opt) -- code action - map('n', 'ca', 'lua vim.lsp.buf.code_action()', opt) + vim.api.nvim_buf_set_keymap(bufnr, 'n', 'ca', 'lua vim.lsp.buf.code_action()', opt) -- mapbuf('n', 'ca', 'lua require("lspsaga.codeaction").code_action()', opt) -- go xx -- mapbuf('n', 'gd', 'lua vim.lsp.buf.definition()', opt) - -- map('n', 'gd', 'Trouble lsp_definitions', opt) - map('n', 'gd', 'Telescope lsp_definitions', opt) - map('n', 'gh', 'lua vim.lsp.buf.hover()', opt) + -- vim.api.nvim_buf_set_keymap(bufnr, 'n', 'gd', 'Trouble lsp_definitions', opt) + vim.api.nvim_buf_set_keymap(bufnr, 'n', 'gd', 'Telescope lsp_definitions', opt) + vim.api.nvim_buf_set_keymap(bufnr, 'n', 'gh', 'lua vim.lsp.buf.hover()', opt) -- mapbuf('n', 'gD', 'lua vim.lsp.buf.declaration()', opt) -- mapbuf('n', 'gD', 'lua vim.lsp.buf.type_definition()', opt) - map('n', 'gD', 'Trouble lsp_type_definitions', opt) + vim.api.nvim_buf_set_keymap(bufnr, 'n', 'gD', 'Trouble lsp_type_definitions', opt) -- mapbuf('n', 'gi', 'lua vim.lsp.buf.implementation()', opt) - map('n', 'gi', 'Trouble lsp_implementations', opt) - map('n', 'gi', 'Telescope lsp_implementations', opt) + vim.api.nvim_buf_set_keymap(bufnr, 'n', 'gi', 'Trouble lsp_implementations', opt) + vim.api.nvim_buf_set_keymap(bufnr, 'n', 'gi', 'Telescope lsp_implementations', opt) -- mapbuf('n', 'gr', 'lua vim.lsp.buf.references()', opt) - map('n', 'gr', 'Trouble lsp_references', opt) - map('n', 'gr', 'Telescope lsp_references', opt) + vim.api.nvim_buf_set_keymap(bufnr, 'n', 'gr', 'Trouble lsp_references', opt) + vim.api.nvim_buf_set_keymap(bufnr, 'n', 'gr', 'Telescope lsp_references', opt) -- mapbuf('n', 'gr', 'lua require"lspsaga.provider".lsp_finder()', opt) -- mapbuf('n', 's', 'lua vim.lsp.buf.workspace_symbol()', opt) -- mapbuf('n', 's', 'lua require"telescope.builtin".lsp_workspace_symbols({ query = vim.fn.input("Query> ") })', opt) - map('n', 'sw', 'Telescope lsp_dynamic_workspace_symbols', opt) - map('n', 'sd', 'Telescope lsp_document_symbols', opt) + vim.api.nvim_buf_set_keymap(bufnr, 'n', 'sw', 'Telescope lsp_dynamic_workspace_symbols', opt) + vim.api.nvim_buf_set_keymap(bufnr, 'n', 'sd', 'Telescope lsp_document_symbols', opt) -- diagnostic - map('n', 'go', 'lua vim.diagnostic.open_float()', opt) - map('n', '[g', 'lua vim.diagnostic.goto_prev()', opt) - map('n', ']g', 'lua vim.diagnostic.goto_next()', opt) + vim.api.nvim_buf_set_keymap(bufnr, 'n', 'go', 'lua vim.diagnostic.open_float()', opt) + vim.api.nvim_buf_set_keymap(bufnr, 'n', '[g', 'lua vim.diagnostic.goto_prev()', opt) + vim.api.nvim_buf_set_keymap(bufnr, 'n', ']g', 'lua vim.diagnostic.goto_next()', opt) -- mapbuf('n', 'q', 'lua vim.diagnostic.setloclist()', opt) -- leader + = - map('n', '=', 'lua vim.lsp.buf.formatting()', opt) + vim.api.nvim_buf_set_keymap(bufnr, 'n', '=', 'lua vim.lsp.buf.formatting()', opt) -- mapbuf('v', '=', 'lua vim.lsp.buf.formatting()', opt) -- mapbuf('n', '', 'lua vim.lsp.buf.signature_help()', opt) -- mapbuf('n', 'wa', 'lua vim.lsp.buf.add_workspace_folder()', opt) -- mapbuf('n', 'wr', 'lua vim.lsp.buf.remove_workspace_folder()', opt) -- mapbuf('n', 'wl', 'lua print(vim.inspect(vim.lsp.buf.list_workspace_folders()))', opt) -- mapbuf('n', 'D', 'lua vim.lsp.buf.type_definition()', opt) - map('n', 'xx', 'Trouble', opt) - map('n', 'xw', 'Trouble workspace_diagnostics', opt) - map('n', 'xd', 'Trouble document_diagnostics', opt) - map('n', 'xq', 'Trouble quickfix', opt) + vim.api.nvim_buf_set_keymap(bufnr, 'n', 'xx', 'Trouble', opt) + vim.api.nvim_buf_set_keymap(bufnr, 'n', 'xw', 'Trouble workspace_diagnostics', opt) + vim.api.nvim_buf_set_keymap(bufnr, 'n', 'xd', 'Trouble document_diagnostics', opt) + vim.api.nvim_buf_set_keymap(bufnr, 'n', 'xq', 'Trouble quickfix', opt) end -- nvim-cmp 自动补全 diff --git a/lua/lsp/init.lua b/lua/lsp/init.lua index b8c79177..6a3e869d 100644 --- a/lua/lsp/init.lua +++ b/lua/lsp/init.lua @@ -38,7 +38,7 @@ for name, m in pairs(servers) do opts.on_attach = function(client, bufnr) -- local function buf_set_option(...) vim.api.nvim_buf_set_option(bufnr, ...) end -- 绑定快捷键 - require('core.keybindings').maplsp( bufnr) + require('core.keybindings').maplsp(client, bufnr) if m.on_attach then m.on_attach(client, bufnr) end diff --git a/lua/lsp/java.lua b/lua/lsp/java.lua index 8aa4edd9..b56bef68 100644 --- a/lua/lsp/java.lua +++ b/lua/lsp/java.lua @@ -234,7 +234,7 @@ M.setup = function () -- Remove the option if you do not want that. require('jdtls').setup_dap({ hotcodereplace = 'auto' }) require('jdtls.setup').add_commands(); - require('core.keybindings').maplsp(bufnr) + require('core.keybindings').maplsp(client, bufnr) -- require('jdtls.dap').setup_dap_main_class_configs({ verbose = true }) end From 13a21fce92d2bad100e9c89deb30feb28163537d Mon Sep 17 00:00:00 2001 From: kaiv2 Date: Thu, 12 May 2022 11:16:22 +0800 Subject: [PATCH 0175/1278] =?UTF-8?q?=E6=A0=BC=E5=BC=8F=E5=8C=96=E4=BB=A3?= =?UTF-8?q?=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lua/core/keybindings.lua | 337 ++++++++++++++++++++------------------- 1 file changed, 169 insertions(+), 168 deletions(-) diff --git a/lua/core/keybindings.lua b/lua/core/keybindings.lua index 7de2c024..7c54d869 100644 --- a/lua/core/keybindings.lua +++ b/lua/core/keybindings.lua @@ -2,81 +2,81 @@ -- vim.g.maplocalleader = ";" local map = vim.api.nvim_set_keymap -local opt = {noremap = true, silent = true } +local opt = { noremap = true, silent = true } local M = {} -M.setup = function () --- nvimTree -map('n', 'n', ':NvimTreeToggle', opt) --- n 模式下复制内容到系统剪切板 -map('n', 'c', '"+yy', opt) --- v 模式下复制内容到系统剪切板 -map('v', 'c', '"+yy', opt) --- n 模式下粘贴系统剪切板的内容 -map('n', 'v', '"+p', opt) --- 取消搜索高亮显示 -map('n', '', ':nohlsearch', opt) --- %bd 删除所有缓冲区, e# 打开最后一个缓冲区, bd# 关闭[No Name] --- map('n', 'o', ':%bd|e#|bd#', opt) -map('n', 'o', 'lua require("core.utils").close_other_bufline()', opt) -map('n', 'w', ':bdelete!', opt) -map("n", 'n', ":BufferLineCycleNext ", opt) -map("n", 'p', ":BufferLineCyclePrev ", opt) - --- " 退出 terminal 模式 -map('t', '', '', opt) -map('t', 'jk', '', opt) - --- Leaderf --- vim.g.Lf_ShortcutF = '' --- map('n', '', ':=printf("Leaderf! rg -e %s ", expand(""))', {}) --- map('v', '', ':=printf("Leaderf! rg -e %s ", leaderf#Rg#visual())', {}) --- map('n', 'r', ':Leaderf --nowrap task', {}) - --- vim-floaterm --- vim.g.floaterm_keymap_new = 'ft' -map('n', '', ':FloatermToggle', opt) -map('t', ' ', '::FloatermToggle', opt) - - --- vista -map('n', 'o', ':Vista!!', opt) - --- trouble.nvim --- see lsp map --- map('n', 'x', 'Trouble', opt) - --- lspsaga --- map('n', 'K', ':Lspsaga hover_doc', opt) --- map('n', 'gr', ':Lspsaga lsp_finder', opt) - --- Telescope -map('n', 'ff', 'Telescope find_files', opt) -map('n', '', 'Telescope find_files', opt) -map('n', 'fg', 'Telescope live_grep', opt) -map('n', 'fb', 'Telescope buffers', opt) -map('n', 'fh', 'Telescope help_tags', opt) -map('n', 'r', 'Telescope asynctasks all', opt) - --- translate -map('n', 't', ':TranslateW --engines=google', opt) -map('v', 't', ':TranslateW --engines=google', opt) - --- camel_case -require('core.utils').camel_case_init() - --- vim-easy-align -vim.cmd([[ +M.setup = function() + -- nvimTree + map('n', 'n', ':NvimTreeToggle', opt) + -- n 模式下复制内容到系统剪切板 + map('n', 'c', '"+yy', opt) + -- v 模式下复制内容到系统剪切板 + map('v', 'c', '"+yy', opt) + -- n 模式下粘贴系统剪切板的内容 + map('n', 'v', '"+p', opt) + -- 取消搜索高亮显示 + map('n', '', ':nohlsearch', opt) + -- %bd 删除所有缓冲区, e# 打开最后一个缓冲区, bd# 关闭[No Name] + -- map('n', 'o', ':%bd|e#|bd#', opt) + map('n', 'o', 'lua require("core.utils").close_other_bufline()', opt) + map('n', 'w', ':bdelete!', opt) + map("n", 'n', ":BufferLineCycleNext ", opt) + map("n", 'p', ":BufferLineCyclePrev ", opt) + + -- " 退出 terminal 模式 + map('t', '', '', opt) + map('t', 'jk', '', opt) + + -- Leaderf + -- vim.g.Lf_ShortcutF = '' + -- map('n', '', ':=printf("Leaderf! rg -e %s ", expand(""))', {}) + -- map('v', '', ':=printf("Leaderf! rg -e %s ", leaderf#Rg#visual())', {}) + -- map('n', 'r', ':Leaderf --nowrap task', {}) + + -- vim-floaterm + -- vim.g.floaterm_keymap_new = 'ft' + map('n', '', ':FloatermToggle', opt) + map('t', ' ', '::FloatermToggle', opt) + + + -- vista + map('n', 'o', ':Vista!!', opt) + + -- trouble.nvim + -- see lsp map + -- map('n', 'x', 'Trouble', opt) + + -- lspsaga + -- map('n', 'K', ':Lspsaga hover_doc', opt) + -- map('n', 'gr', ':Lspsaga lsp_finder', opt) + + -- Telescope + map('n', 'ff', 'Telescope find_files', opt) + map('n', '', 'Telescope find_files', opt) + map('n', 'fg', 'Telescope live_grep', opt) + map('n', 'fb', 'Telescope buffers', opt) + map('n', 'fh', 'Telescope help_tags', opt) + map('n', 'r', 'Telescope asynctasks all', opt) + + -- translate + map('n', 't', ':TranslateW --engines=google', opt) + map('v', 't', ':TranslateW --engines=google', opt) + + -- camel_case + require('core.utils').camel_case_init() + + -- vim-easy-align + vim.cmd([[ " Start interactive EasyAlign in visual mode (e.g. vipga) xmap ga (EasyAlign) " Start interactive EasyAlign for a motion/text object (e.g. gaip) nmap ga (EasyAlign) -]]) +]] ) --- nvim-dap -vim.cmd([[ + -- nvim-dap + vim.cmd([[ nnoremap :lua require'dap'.continue() nnoremap :lua require'dap'.step_over() nnoremap :lua require'dap'.step_into() @@ -86,15 +86,15 @@ nnoremap B :lua require'dap'.set_breakpoint(vim.fn.input('Break nnoremap lp :lua require'dap'.set_breakpoint(nil, nil, vim.fn.input('Log point message: ')) nnoremap dr :lua require'dap'.repl.open() nnoremap dl :lua require'dap'.run_last() -]]) +]] ) --- nvim-dap-ui -vim.cmd([[ + -- nvim-dap-ui + vim.cmd([[ nnoremap dr :lua require("dapui").float_element(vim.Nil, { enter = true}) -]]) +]] ) --- bufferline.nvim -vim.cmd[[ + -- bufferline.nvim + vim.cmd [[ nnoremap 1 BufferLineGoToBuffer 1 nnoremap 2 BufferLineGoToBuffer 2 nnoremap 3 BufferLineGoToBuffer 3 @@ -116,109 +116,110 @@ end -- lsp 回调函数快捷键设置 M.maplsp = function(client, bufnr) - vim.api.nvim_buf_set_option(bufnr, 'omnifunc', 'v:lua.vim.lsp.omnifunc') - - vim.api.nvim_buf_set_keymap(bufnr, 'n', 'K', 'lua vim.lsp.buf.hover()', opt) - -- rename - vim.api.nvim_buf_set_keymap(bufnr, 'n', 'rn', 'lua vim.lsp.buf.rename()', opt) - -- mapbuf('n', 'rn', 'lua require("lspsaga.rename").rename()', opt) - -- code action - vim.api.nvim_buf_set_keymap(bufnr, 'n', 'ca', 'lua vim.lsp.buf.code_action()', opt) - -- mapbuf('n', 'ca', 'lua require("lspsaga.codeaction").code_action()', opt) - -- go xx - -- mapbuf('n', 'gd', 'lua vim.lsp.buf.definition()', opt) - -- vim.api.nvim_buf_set_keymap(bufnr, 'n', 'gd', 'Trouble lsp_definitions', opt) - vim.api.nvim_buf_set_keymap(bufnr, 'n', 'gd', 'Telescope lsp_definitions', opt) - vim.api.nvim_buf_set_keymap(bufnr, 'n', 'gh', 'lua vim.lsp.buf.hover()', opt) - -- mapbuf('n', 'gD', 'lua vim.lsp.buf.declaration()', opt) - -- mapbuf('n', 'gD', 'lua vim.lsp.buf.type_definition()', opt) - vim.api.nvim_buf_set_keymap(bufnr, 'n', 'gD', 'Trouble lsp_type_definitions', opt) - -- mapbuf('n', 'gi', 'lua vim.lsp.buf.implementation()', opt) - vim.api.nvim_buf_set_keymap(bufnr, 'n', 'gi', 'Trouble lsp_implementations', opt) - vim.api.nvim_buf_set_keymap(bufnr, 'n', 'gi', 'Telescope lsp_implementations', opt) - -- mapbuf('n', 'gr', 'lua vim.lsp.buf.references()', opt) - vim.api.nvim_buf_set_keymap(bufnr, 'n', 'gr', 'Trouble lsp_references', opt) - vim.api.nvim_buf_set_keymap(bufnr, 'n', 'gr', 'Telescope lsp_references', opt) - -- mapbuf('n', 'gr', 'lua require"lspsaga.provider".lsp_finder()', opt) - -- mapbuf('n', 's', 'lua vim.lsp.buf.workspace_symbol()', opt) - -- mapbuf('n', 's', 'lua require"telescope.builtin".lsp_workspace_symbols({ query = vim.fn.input("Query> ") })', opt) - vim.api.nvim_buf_set_keymap(bufnr, 'n', 'sw', 'Telescope lsp_dynamic_workspace_symbols', opt) - vim.api.nvim_buf_set_keymap(bufnr, 'n', 'sd', 'Telescope lsp_document_symbols', opt) - -- diagnostic - vim.api.nvim_buf_set_keymap(bufnr, 'n', 'go', 'lua vim.diagnostic.open_float()', opt) - vim.api.nvim_buf_set_keymap(bufnr, 'n', '[g', 'lua vim.diagnostic.goto_prev()', opt) - vim.api.nvim_buf_set_keymap(bufnr, 'n', ']g', 'lua vim.diagnostic.goto_next()', opt) - -- mapbuf('n', 'q', 'lua vim.diagnostic.setloclist()', opt) - -- leader + = - vim.api.nvim_buf_set_keymap(bufnr, 'n', '=', 'lua vim.lsp.buf.formatting()', opt) - -- mapbuf('v', '=', 'lua vim.lsp.buf.formatting()', opt) - -- mapbuf('n', '', 'lua vim.lsp.buf.signature_help()', opt) - -- mapbuf('n', 'wa', 'lua vim.lsp.buf.add_workspace_folder()', opt) - -- mapbuf('n', 'wr', 'lua vim.lsp.buf.remove_workspace_folder()', opt) - -- mapbuf('n', 'wl', 'lua print(vim.inspect(vim.lsp.buf.list_workspace_folders()))', opt) - -- mapbuf('n', 'D', 'lua vim.lsp.buf.type_definition()', opt) - vim.api.nvim_buf_set_keymap(bufnr, 'n', 'xx', 'Trouble', opt) - vim.api.nvim_buf_set_keymap(bufnr, 'n', 'xw', 'Trouble workspace_diagnostics', opt) - vim.api.nvim_buf_set_keymap(bufnr, 'n', 'xd', 'Trouble document_diagnostics', opt) - vim.api.nvim_buf_set_keymap(bufnr, 'n', 'xq', 'Trouble quickfix', opt) + vim.api.nvim_buf_set_option(bufnr, 'omnifunc', 'v:lua.vim.lsp.omnifunc') + vim.api.nvim_buf_set_option(bufnr, 'formatexpr', 'v:lua.vim.lsp.formatexpr()') + + vim.api.nvim_buf_set_keymap(bufnr, 'n', 'K', 'lua vim.lsp.buf.hover()', opt) + -- rename + vim.api.nvim_buf_set_keymap(bufnr, 'n', 'rn', 'lua vim.lsp.buf.rename()', opt) + -- mapbuf('n', 'rn', 'lua require("lspsaga.rename").rename()', opt) + -- code action + vim.api.nvim_buf_set_keymap(bufnr, 'n', 'ca', 'lua vim.lsp.buf.code_action()', opt) + -- mapbuf('n', 'ca', 'lua require("lspsaga.codeaction").code_action()', opt) + -- go xx + -- mapbuf('n', 'gd', 'lua vim.lsp.buf.definition()', opt) + -- vim.api.nvim_buf_set_keymap(bufnr, 'n', 'gd', 'Trouble lsp_definitions', opt) + vim.api.nvim_buf_set_keymap(bufnr, 'n', 'gd', 'Telescope lsp_definitions', opt) + vim.api.nvim_buf_set_keymap(bufnr, 'n', 'gh', 'lua vim.lsp.buf.hover()', opt) + -- mapbuf('n', 'gD', 'lua vim.lsp.buf.declaration()', opt) + -- mapbuf('n', 'gD', 'lua vim.lsp.buf.type_definition()', opt) + vim.api.nvim_buf_set_keymap(bufnr, 'n', 'gD', 'Trouble lsp_type_definitions', opt) + -- mapbuf('n', 'gi', 'lua vim.lsp.buf.implementation()', opt) + vim.api.nvim_buf_set_keymap(bufnr, 'n', 'gi', 'Trouble lsp_implementations', opt) + vim.api.nvim_buf_set_keymap(bufnr, 'n', 'gi', 'Telescope lsp_implementations', opt) + -- mapbuf('n', 'gr', 'lua vim.lsp.buf.references()', opt) + vim.api.nvim_buf_set_keymap(bufnr, 'n', 'gr', 'Trouble lsp_references', opt) + vim.api.nvim_buf_set_keymap(bufnr, 'n', 'gr', 'Telescope lsp_references', opt) + -- mapbuf('n', 'gr', 'lua require"lspsaga.provider".lsp_finder()', opt) + -- mapbuf('n', 's', 'lua vim.lsp.buf.workspace_symbol()', opt) + -- mapbuf('n', 's', 'lua require"telescope.builtin".lsp_workspace_symbols({ query = vim.fn.input("Query> ") })', opt) + vim.api.nvim_buf_set_keymap(bufnr, 'n', 'sw', 'Telescope lsp_dynamic_workspace_symbols', opt) + vim.api.nvim_buf_set_keymap(bufnr, 'n', 'sd', 'Telescope lsp_document_symbols', opt) + -- diagnostic + vim.api.nvim_buf_set_keymap(bufnr, 'n', 'go', 'lua vim.diagnostic.open_float()', opt) + vim.api.nvim_buf_set_keymap(bufnr, 'n', '[g', 'lua vim.diagnostic.goto_prev()', opt) + vim.api.nvim_buf_set_keymap(bufnr, 'n', ']g', 'lua vim.diagnostic.goto_next()', opt) + -- mapbuf('n', 'q', 'lua vim.diagnostic.setloclist()', opt) + -- leader + = + vim.api.nvim_buf_set_keymap(bufnr, 'n', '=', 'lua vim.lsp.buf.formatting()', opt) + -- mapbuf('v', '=', 'lua vim.lsp.buf.formatting()', opt) + -- mapbuf('n', '', 'lua vim.lsp.buf.signature_help()', opt) + -- mapbuf('n', 'wa', 'lua vim.lsp.buf.add_workspace_folder()', opt) + -- mapbuf('n', 'wr', 'lua vim.lsp.buf.remove_workspace_folder()', opt) + -- mapbuf('n', 'wl', 'lua print(vim.inspect(vim.lsp.buf.list_workspace_folders()))', opt) + -- mapbuf('n', 'D', 'lua vim.lsp.buf.type_definition()', opt) + vim.api.nvim_buf_set_keymap(bufnr, 'n', 'xx', 'Trouble', opt) + vim.api.nvim_buf_set_keymap(bufnr, 'n', 'xw', 'Trouble workspace_diagnostics', opt) + vim.api.nvim_buf_set_keymap(bufnr, 'n', 'xd', 'Trouble document_diagnostics', opt) + vim.api.nvim_buf_set_keymap(bufnr, 'n', 'xq', 'Trouble quickfix', opt) end -- nvim-cmp 自动补全 M.cmp = function(cmp) -local luasnip = require('luasnip'); -local has_words_before = function() - local line, col = unpack(vim.api.nvim_win_get_cursor(0)) - return col ~= 0 and vim.api.nvim_buf_get_lines(0, line - 1, line, true)[1]:sub(col, col):match("%s") == nil -end -return { - -- 上一个 - -- [''] = cmp.mapping.select_prev_item(), - -- 下一个 - -- [''] = cmp.mapping.select_next_item(), - -- [""] = cmp.mapping.select_prev_item(), - -- [''] = cmp.mapping.close(), - -- 确认 - -- Accept currently selected item. If none selected, `select` first item. - -- Set `select` to `false` to only confirm explicitly selected items. - -- [""] = cmp.mapping.scroll_docs(-4), - -- [""] = cmp.mapping.scroll_docs(4), - [""] = cmp.mapping.select_prev_item(), - [""] = cmp.mapping.select_next_item(), - [""] = cmp.mapping.complete(), - [""] = cmp.mapping.close(), - [""] = cmp.mapping.confirm { - behavior = cmp.ConfirmBehavior.Replace, - -- select = true, - }, - - [""] = cmp.mapping(function(fallback) - if cmp.visible() then - cmp.select_next_item() - elseif luasnip.expand_or_jumpable() then - luasnip.expand_or_jump() - elseif has_words_before() then - cmp.complete() - else - fallback() - end - end, { "i", "s" }), - - [""] = cmp.mapping(function(fallback) - if cmp.visible() then - cmp.select_prev_item() - elseif luasnip.jumpable(-1) then - luasnip.jump(-1) - else - fallback() - end - end, { "i", "s" }), -} + local luasnip = require('luasnip'); + local has_words_before = function() + local line, col = unpack(vim.api.nvim_win_get_cursor(0)) + return col ~= 0 and vim.api.nvim_buf_get_lines(0, line - 1, line, true)[1]:sub(col, col):match("%s") == nil + end + return { + -- 上一个 + -- [''] = cmp.mapping.select_prev_item(), + -- 下一个 + -- [''] = cmp.mapping.select_next_item(), + -- [""] = cmp.mapping.select_prev_item(), + -- [''] = cmp.mapping.close(), + -- 确认 + -- Accept currently selected item. If none selected, `select` first item. + -- Set `select` to `false` to only confirm explicitly selected items. + -- [""] = cmp.mapping.scroll_docs(-4), + -- [""] = cmp.mapping.scroll_docs(4), + [""] = cmp.mapping.select_prev_item(), + [""] = cmp.mapping.select_next_item(), + [""] = cmp.mapping.complete(), + [""] = cmp.mapping.close(), + [""] = cmp.mapping.confirm { + behavior = cmp.ConfirmBehavior.Replace, + -- select = true, + }, + + [""] = cmp.mapping(function(fallback) + if cmp.visible() then + cmp.select_next_item() + elseif luasnip.expand_or_jumpable() then + luasnip.expand_or_jump() + elseif has_words_before() then + cmp.complete() + else + fallback() + end + end, { "i", "s" }), + + [""] = cmp.mapping(function(fallback) + if cmp.visible() then + cmp.select_prev_item() + elseif luasnip.jumpable(-1) then + luasnip.jump(-1) + else + fallback() + end + end, { "i", "s" }), + } end -M.rest_nvim = function () --- rest-nvim -vim.cmd[[ +M.rest_nvim = function() + -- rest-nvim + vim.cmd [[ command! -buffer Http :lua require'rest-nvim'.run() command! -buffer HttpCurl :lua require'rest-nvim'.run(true) command! -buffer HttpLast :lua require'rest-nvim'.last() From e4333c9e8501990ad5250ee3e7b6d51c9f5639a4 Mon Sep 17 00:00:00 2001 From: kaiv2 Date: Thu, 12 May 2022 11:56:59 +0800 Subject: [PATCH 0176/1278] =?UTF-8?q?=E6=A0=BC=E5=BC=8F=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lua/core/keybindings.lua | 2 ++ lua/core/utils/init.lua | 77 +++++++++++++++++++++++----------------- lua/lsp/java.lua | 1 - 3 files changed, 46 insertions(+), 34 deletions(-) diff --git a/lua/core/keybindings.lua b/lua/core/keybindings.lua index 7c54d869..cce6e20f 100644 --- a/lua/core/keybindings.lua +++ b/lua/core/keybindings.lua @@ -152,6 +152,8 @@ M.maplsp = function(client, bufnr) -- mapbuf('n', 'q', 'lua vim.diagnostic.setloclist()', opt) -- leader + = vim.api.nvim_buf_set_keymap(bufnr, 'n', '=', 'lua vim.lsp.buf.formatting()', opt) + -- vim.api.nvim_buf_set_keymap(bufnr, 'v', '=', 'lua vim.lsp.buf.range_formatting()', opt) + vim.api.nvim_buf_set_keymap(bufnr, 'v', '=', 'lua require("core.utils").format_range_operator()', opt) -- mapbuf('v', '=', 'lua vim.lsp.buf.formatting()', opt) -- mapbuf('n', '', 'lua vim.lsp.buf.signature_help()', opt) -- mapbuf('n', 'wa', 'lua vim.lsp.buf.add_workspace_folder()', opt) diff --git a/lua/core/utils/init.lua b/lua/core/utils/init.lua index 8a7c2561..816b6274 100644 --- a/lua/core/utils/init.lua +++ b/lua/core/utils/init.lua @@ -1,9 +1,8 @@ - local M = {} -- 69 %a "test.lua" 第 6 行 -- 76 #h "README.md" 第 1 行 -- 78 h "init.lua" 第 1 行 -M.close_other_buf = function () +M.close_other_buf = function() -- local cur_winnr = vim.fn.winnr() local cur_buf = vim.fn.bufnr('%') if cur_buf == -1 then @@ -25,52 +24,52 @@ M.close_other_buf = function () end end -M.close_other_bufline = function () +M.close_other_bufline = function() vim.fn.execute('BufferLineCloseLeft') vim.fn.execute('BufferLineCloseRight') end M.packer_lazy_load = function(plugin, timer) - if plugin then - timer = timer or 0 - vim.defer_fn(function() - require("packer").loader(plugin) - end, timer) - end + if plugin then + timer = timer or 0 + vim.defer_fn(function() + require("packer").loader(plugin) + end, timer) + end end -M.is_upper = function (c) +M.is_upper = function(c) return c >= 65 and c <= 90 end -M.is_lower = function (c) +M.is_lower = function(c) return c >= 97 and c <= 122 end M.char_size = function(c) - local code = c; - if code < 127 then - return 1 - elseif code <= 223 then - return 2 - elseif code <= 239 then - return 3 - elseif code <= 247 then - return 4 - end - return nil + local code = c; + if code < 127 then + return 1 + elseif code <= 223 then + return 2 + elseif code <= 239 then + return 3 + elseif code <= 247 then + return 4 + end + return nil end -M.camel_case = function (word) +M.camel_case = function(word) if word == '' or word == nil then return end - if word:find('_') then + if word:find('_') then return M.camel_case_c(word) else return M.camel_case_u(word) end end -M.camel_case_u = function (word) +M.camel_case_u = function(word) local result = {} local len = word:len() local i = 1 @@ -91,12 +90,12 @@ M.camel_case_u = function (word) f = true end local e = i + cs; - table.insert(result, word:sub(i, e -1)) + table.insert(result, word:sub(i, e - 1)) i = e end return table.concat(result, ''):upper() end -M.camel_case_c = function (word) +M.camel_case_c = function(word) local w = word:lower() local result = {} local sc = 95 @@ -120,14 +119,14 @@ M.camel_case_c = function (word) if cs == 1 and cf then table.insert(result, string.char(c):upper()) else - table.insert(result, w:sub(i, e -1)) + table.insert(result, w:sub(i, e - 1)) end end i = e end return table.concat(result, '') end -M.camel_case_start = function (r, l1, l2) +M.camel_case_start = function(r, l1, l2) local word if r == 0 then word = vim.fn.expand('') @@ -154,17 +153,29 @@ M.camel_case_start = function (r, l1, l2) vim.notify('请选择单行字符', vim.log.levels.WARN) end end -M.test = function (a) +M.test = function(a) print(a) end -M.camel_case_init = function () - vim.cmd[[ +M.camel_case_init = function() + vim.cmd [[ " command! -complete=customlist,coreutils#cmdline#complete -nargs=* -bang -range command! -nargs=* -range \ CamelCase \ lua require('core.utils').camel_case_start(, , ) ]] -end +end -- print(M.camel_case("helloWorldAaAaAxC")) +M.format_range_operator = function() + local old_func = vim.go.operatorfunc + _G.op_func_formatting = function() + local start = vim.api.nvim_buf_get_mark(0, '[') + local finish = vim.api.nvim_buf_get_mark(0, ']') + vim.lsp.buf.range_formatting({}, start, finish) + vim.go.operatorfunc = old_func + _G.op_func_formatting = nil + end + vim.go.operatorfunc = 'v:lua.op_func_formatting' + vim.api.nvim_feedkeys('g@', 'n', false) +end return M diff --git a/lua/lsp/java.lua b/lua/lsp/java.lua index b56bef68..4940853d 100644 --- a/lua/lsp/java.lua +++ b/lua/lsp/java.lua @@ -257,7 +257,6 @@ M.setup = function () vim.cmd([[ command! -nargs=0 OR :lua require'jdtls'.organize_imports() - command! -nargs=0 Format :lua vim.lsp.buf.formatting() nnoremap crv lua require('jdtls').extract_variable() vnoremap crv lua require('jdtls').extract_variable(true) nnoremap crc lua require('jdtls').extract_constant() From 57c96f8109a95abc17fc8421dee0354f4d2c9c69 Mon Sep 17 00:00:00 2001 From: kaiv2 Date: Tue, 24 May 2022 09:21:24 +0000 Subject: [PATCH 0177/1278] =?UTF-8?q?=E6=9B=B4=E6=96=B0=E5=AE=89=E8=A3=85?= =?UTF-8?q?=E6=96=87=E6=A1=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/README.md b/README.md index 53f33526..8fe648f8 100644 --- a/README.md +++ b/README.md @@ -9,8 +9,17 @@ git clone --depth 1 https://github.com/wbthomason/packer.nvim\ ~/.local/share/nvim/site/pack/packer/start/packer.nvim ``` +## 安装 + +```sh +cd ~/.config +git clone https://github.com/JavaHello/nvim.git +``` + ## Java 配置 +> 如果不使用 `Java` 语言开发,无需配置 + [NVIM 打造 Java IDE](https://javahello.github.io/dev/tools/NVIM-LSP-Java-IDE.html) ### 功能演示 From a4355dbf9262b3b212ac3d93113a5554021e7024 Mon Sep 17 00:00:00 2001 From: kaiv2 Date: Wed, 25 May 2022 03:05:37 +0000 Subject: [PATCH 0178/1278] =?UTF-8?q?=E5=AE=89=E8=A3=85=E8=AF=B4=E6=98=8E?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/README.md b/README.md index 8fe648f8..4629dcfc 100644 --- a/README.md +++ b/README.md @@ -4,18 +4,35 @@ ## Packer 插件管理器安装 +### Linux, Mac + ```sh git clone --depth 1 https://github.com/wbthomason/packer.nvim\ ~/.local/share/nvim/site/pack/packer/start/packer.nvim ``` +### Windows + +```sh +git clone https://github.com/wbthomason/packer.nvim "$env:LOCALAPPDATA\nvim-data\site\pack\packer\start\packer.nvim" +``` + ## 安装 +### Linux, Mac + ```sh cd ~/.config git clone https://github.com/JavaHello/nvim.git ``` +# Windows + +```sh +cd $env:LOCALAPPDATA +git clone https://github.com/JavaHello/nvim.git +``` + ## Java 配置 > 如果不使用 `Java` 语言开发,无需配置 From 66ddc550515c11a7a75f7017aba9b0e80f2cb763 Mon Sep 17 00:00:00 2001 From: kaiv2 Date: Wed, 25 May 2022 14:07:44 +0800 Subject: [PATCH 0179/1278] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 4629dcfc..2f7c8f20 100644 --- a/README.md +++ b/README.md @@ -26,7 +26,7 @@ cd ~/.config git clone https://github.com/JavaHello/nvim.git ``` -# Windows +### Windows ```sh cd $env:LOCALAPPDATA From 4664d3beec33535e0d2815ee1b05b696834fc28f Mon Sep 17 00:00:00 2001 From: luokai Date: Sat, 4 Jun 2022 15:18:17 +0800 Subject: [PATCH 0180/1278] =?UTF-8?q?=E9=99=90=E5=AE=9A=E6=94=AF=E6=8C=81?= =?UTF-8?q?=E9=AB=98=E4=BA=AE=E7=9A=84=E8=AF=AD=E8=A8=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lua/plugins/config/nvim-treesitter.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lua/plugins/config/nvim-treesitter.lua b/lua/plugins/config/nvim-treesitter.lua index df3cac6b..a9910517 100644 --- a/lua/plugins/config/nvim-treesitter.lua +++ b/lua/plugins/config/nvim-treesitter.lua @@ -1,6 +1,6 @@ require'nvim-treesitter.configs'.setup { -- One of "all", "maintained" (parsers with maintainers), or a list of languages - ensure_installed = "all", + ensure_installed = {"lua", "java", "javascript", "html", "css", "c", "cpp", "go", "rust", "python"}, -- Install languages synchronously (only applied to `ensure_installed`) sync_install = false, From 3e7a69638f79add510ec14f55bcf022d3d93658a Mon Sep 17 00:00:00 2001 From: luokai Date: Sat, 4 Jun 2022 15:21:21 +0800 Subject: [PATCH 0181/1278] =?UTF-8?q?=E5=8E=BB=E6=8E=89=E9=9D=9E=E5=BF=85?= =?UTF-8?q?=E8=A6=81=E6=8F=92=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lua/plugins/config/telescope.lua | 6 +++--- lua/plugins/init.lua | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/lua/plugins/config/telescope.lua b/lua/plugins/config/telescope.lua index 7dc76209..7a5d1437 100644 --- a/lua/plugins/config/telescope.lua +++ b/lua/plugins/config/telescope.lua @@ -96,9 +96,9 @@ telescope.setup{ }, } telescope.load_extension("notify") -telescope.load_extension('fzf') +-- telescope.load_extension('fzf') telescope.load_extension("ui-select") -telescope.load_extension('gradle') -telescope.load_extension('maven_search') +-- telescope.load_extension('gradle') +-- telescope.load_extension('maven_search') telescope.load_extension('env') telescope.load_extension('dap') diff --git a/lua/plugins/init.lua b/lua/plugins/init.lua index 3c58c3c8..b33ceeb0 100644 --- a/lua/plugins/init.lua +++ b/lua/plugins/init.lua @@ -152,12 +152,12 @@ require('packer').startup({function() }, } use {'nvim-telescope/telescope-ui-select.nvim' } - use {'nvim-telescope/telescope-fzf-native.nvim', run = 'make' } + -- use {'nvim-telescope/telescope-fzf-native.nvim', run = 'make' } use {'nvim-telescope/telescope-dap.nvim'} use 'GustavoKatel/telescope-asynctasks.nvim' - use 'aloussase/telescope-gradle.nvim' - use 'aloussase/telescope-mvnsearch' + -- use 'aloussase/telescope-gradle.nvim' + -- use 'aloussase/telescope-mvnsearch' use { "LinArcX/telescope-env.nvim" } From a76de906d8adf1f2a7427ef46353543758826f9b Mon Sep 17 00:00:00 2001 From: luokai Date: Sat, 4 Jun 2022 16:42:21 +0800 Subject: [PATCH 0182/1278] update --- lua/plugins/config/nvim-treesitter.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lua/plugins/config/nvim-treesitter.lua b/lua/plugins/config/nvim-treesitter.lua index a9910517..f29876a6 100644 --- a/lua/plugins/config/nvim-treesitter.lua +++ b/lua/plugins/config/nvim-treesitter.lua @@ -1,6 +1,6 @@ require'nvim-treesitter.configs'.setup { -- One of "all", "maintained" (parsers with maintainers), or a list of languages - ensure_installed = {"lua", "java", "javascript", "html", "css", "c", "cpp", "go", "rust", "python"}, + ensure_installed = {"lua", "java", "javascript", "html", "css", "c", "cpp", "go", "rust", "python", "vim", "yaml", "http", "bash"}, -- Install languages synchronously (only applied to `ensure_installed`) sync_install = false, From e42d65dc8e0764da7c1951f34cef10896a5fd694 Mon Sep 17 00:00:00 2001 From: luokai Date: Sat, 4 Jun 2022 18:06:47 +0800 Subject: [PATCH 0183/1278] update --- lua/lsp/java.lua | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/lua/lsp/java.lua b/lua/lsp/java.lua index 4940853d..e2913a69 100644 --- a/lua/lsp/java.lua +++ b/lua/lsp/java.lua @@ -20,7 +20,7 @@ local function get_maven_settings() end local function get_java_home() - return or_default(env.JAVA_HOME, '/Library/Java/JavaVirtualMachines/zulu-11.jdk/Contents/Home') + return or_default(env.JAVA_HOME, '/opt/software/java/zulu11.56.19-ca-jdk11.0.15-macosx_aarch64') end local function get_java() return get_java_home() .. '/bin/java' @@ -167,16 +167,16 @@ M.setup = function () runtimes = { { name = "JavaSE-1.8", - path = "/Library/Java/JavaVirtualMachines/zulu-8.jdk/Contents/Home", + path = "/opt/software/java/zulu8.62.0.19-ca-jdk8.0.332-macosx_aarch64", default = true, }, { name = "JavaSE-11", - path = "/Library/Java/JavaVirtualMachines/zulu-11.jdk/Contents/Home", + path = "/opt/software/java/zulu11.56.19-ca-jdk11.0.15-macosx_aarch64", }, { name = "JavaSE-17", - path = "/Library/Java/JavaVirtualMachines/zulu-17.jdk/Contents/Home", + path = "/opt/software/java/zulu17.34.19-ca-jdk17.0.3-macosx_aarch64", }, } }, From 4110b90bd525c6c0b75e7e4eca54a5939309fbb8 Mon Sep 17 00:00:00 2001 From: luokai Date: Sat, 4 Jun 2022 21:08:59 +0800 Subject: [PATCH 0184/1278] keybindings --- lua/core/basic.lua | 1 + lua/core/keybindings.lua | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/lua/core/basic.lua b/lua/core/basic.lua index b2b7bace..225cc924 100644 --- a/lua/core/basic.lua +++ b/lua/core/basic.lua @@ -1,3 +1,4 @@ +vim.g.mapleader = " " vim.opt.title = true -- 行号 diff --git a/lua/core/keybindings.lua b/lua/core/keybindings.lua index cce6e20f..ec4a444c 100644 --- a/lua/core/keybindings.lua +++ b/lua/core/keybindings.lua @@ -8,7 +8,7 @@ local M = {} M.setup = function() -- nvimTree - map('n', 'n', ':NvimTreeToggle', opt) + map('n', 'e', ':NvimTreeToggle', opt) -- n 模式下复制内容到系统剪切板 map('n', 'c', '"+yy', opt) -- v 模式下复制内容到系统剪切板 @@ -57,7 +57,7 @@ M.setup = function() map('n', 'fg', 'Telescope live_grep', opt) map('n', 'fb', 'Telescope buffers', opt) map('n', 'fh', 'Telescope help_tags', opt) - map('n', 'r', 'Telescope asynctasks all', opt) + map('n', 'fr', 'Telescope asynctasks all', opt) -- translate map('n', 't', ':TranslateW --engines=google', opt) From b8058042099994cf4eea5d6511df12809d2375ee Mon Sep 17 00:00:00 2001 From: luokai Date: Sat, 4 Jun 2022 21:14:16 +0800 Subject: [PATCH 0185/1278] update --- lua/plugins/config/alpha-nvim.lua | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/lua/plugins/config/alpha-nvim.lua b/lua/plugins/config/alpha-nvim.lua index ac0dff0a..b25b6644 100644 --- a/lua/plugins/config/alpha-nvim.lua +++ b/lua/plugins/config/alpha-nvim.lua @@ -16,11 +16,11 @@ dashboard.section.header.val = { -- Set menu dashboard.section.buttons.val = { - dashboard.button("\\ ff", " Find File", ":Telescope find_files"), - dashboard.button("\\ fg", " Find Word ", ":Telescope live_grep"), - dashboard.button("\\ fo", " Recent File" , ":Telescope oldfiles"), - dashboard.button("\\ es", " Settings" , ":e $MYVIMRC | :cd %:p:h "), - dashboard.button("\\ q ", " Quit NVIM", ":qa"), + dashboard.button(" ff", " Find File", ":Telescope find_files"), + dashboard.button(" fg", " Find Word ", ":Telescope live_grep"), + dashboard.button(" fo", " Recent File" , ":Telescope oldfiles"), + dashboard.button(" es", " Settings" , ":e $MYVIMRC | :cd %:p:h "), + dashboard.button(" q ", " Quit NVIM", ":qa"), } -- Set footer From aeb291db134cfc062fa3edd1575e1e6ca84197af Mon Sep 17 00:00:00 2001 From: luokai Date: Sat, 4 Jun 2022 21:17:21 +0800 Subject: [PATCH 0186/1278] =?UTF-8?q?=E7=BD=91=E7=BB=9C=E9=97=AE=E9=A2=98?= =?UTF-8?q?=E9=85=8D=E7=BD=AE=E5=8E=BB=E9=99=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lua/lsp/init.lua | 5 ++--- lua/plugins/config/nvim-treesitter.lua | 3 ++- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/lua/lsp/init.lua b/lua/lsp/init.lua index 6a3e869d..2d65df99 100644 --- a/lua/lsp/init.lua +++ b/lua/lsp/init.lua @@ -20,9 +20,8 @@ for name, _ in pairs(servers) do local server_available, server = lsp_installer.get_server(name) if server_available then if not server:is_installed() then - print("Installing " .. name) - vim.notify(string.format("Installing [%s] server", name), vim.log.levels.INFO) - server:install() + vim.notify(string.format("请安装 [%s] LSP server", name), vim.log.levels.WARN) + -- server:install() end end end diff --git a/lua/plugins/config/nvim-treesitter.lua b/lua/plugins/config/nvim-treesitter.lua index f29876a6..7bfd80b6 100644 --- a/lua/plugins/config/nvim-treesitter.lua +++ b/lua/plugins/config/nvim-treesitter.lua @@ -1,6 +1,7 @@ require'nvim-treesitter.configs'.setup { -- One of "all", "maintained" (parsers with maintainers), or a list of languages - ensure_installed = {"lua", "java", "javascript", "html", "css", "c", "cpp", "go", "rust", "python", "vim", "yaml", "http", "bash"}, + -- ensure_installed = {"lua", "java", "javascript", "html", "css", "c", "cpp", "go", "rust", "python", "vim", "yaml", "http", "bash"}, + ensure_installed = {}, -- Install languages synchronously (only applied to `ensure_installed`) sync_install = false, From b16d0319fe67a00923e1f058d32204de96648dbb Mon Sep 17 00:00:00 2001 From: luokai Date: Sun, 5 Jun 2022 08:19:16 +0800 Subject: [PATCH 0187/1278] update --- lua/lsp/java.lua | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/lua/lsp/java.lua b/lua/lsp/java.lua index e2913a69..57351aee 100644 --- a/lua/lsp/java.lua +++ b/lua/lsp/java.lua @@ -26,13 +26,13 @@ local function get_java() return get_java_home() .. '/bin/java' end -local jdtls_root = "/Users/kailuo/workspace/JavaProjects/eclipse.jdt.ls/org.eclipse.jdt.ls.product/target/repository" +local jdtls_root = "/opt/software/lsp/java/jdt-language-server" local function get_jdtls_home() return or_default(env.JDTLS_HOME, jdtls_root) end local function get_jdtls_workspace() - return or_default(env.JDTLS_WORKSPACE, '/Users/kailuo/jdtls-workspace/') + return or_default(env.JDTLS_WORKSPACE, '/Users/luokai/jdtls-workspace/') end local function get_lombok_jar() @@ -47,7 +47,6 @@ M.setup = function () local project_name = vim.fn.fnamemodify(vim.fn.getcwd(), ':p:h:t') - -- local workspace_dir = '/Users/kailuo/jdtls-workspace/' .. project_name local workspace_dir = get_jdtls_workspace() .. project_name local jdtls_launcher = vim.fn.glob(get_jdtls_home() .. "/plugins/org.eclipse.equinox.launcher_*.jar"); From 6a58976f2d053cfce4aa1275565a1dc016256e2b Mon Sep 17 00:00:00 2001 From: luokai Date: Sun, 5 Jun 2022 14:50:36 +0800 Subject: [PATCH 0188/1278] update --- lua/plugins/config/nvim-dap.lua | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/lua/plugins/config/nvim-dap.lua b/lua/plugins/config/nvim-dap.lua index 2b2af602..92b1f0b2 100644 --- a/lua/plugins/config/nvim-dap.lua +++ b/lua/plugins/config/nvim-dap.lua @@ -49,3 +49,9 @@ end dap.listeners.before.event_exited["dapui_config"] = function() dapui.close() end + +vim.fn.sign_define('DapBreakpoint', {text='', texthl='Debug', linehl='', numhl=''}) +-- vim.fn.sign_define("DapBreakpointCondition", { text = "C", texthl = "", linehl = "", numhl = "" }) +-- vim.fn.sign_define('DapBreakpointRejected', {text='R', texthl='', linehl='', numhl=''}) +-- vim.fn.sign_define('DapLogPoint', {text='L', texthl='', linehl='', numhl=''}) +-- vim.fn.sign_define('DapStopped', {text='→', texthl='', linehl='debugPC', numhl=''}) From e718b15b169fd6d80a64c1af913c372c0e83e55b Mon Sep 17 00:00:00 2001 From: luokai Date: Sun, 5 Jun 2022 23:56:50 +0800 Subject: [PATCH 0189/1278] update --- lua/core/keybindings.lua | 1 + 1 file changed, 1 insertion(+) diff --git a/lua/core/keybindings.lua b/lua/core/keybindings.lua index ec4a444c..9faf58e1 100644 --- a/lua/core/keybindings.lua +++ b/lua/core/keybindings.lua @@ -21,6 +21,7 @@ M.setup = function() -- map('n', 'o', ':%bd|e#|bd#', opt) map('n', 'o', 'lua require("core.utils").close_other_bufline()', opt) map('n', 'w', ':bdelete!', opt) + map('n', 'q', ':q', opt) map("n", 'n', ":BufferLineCycleNext ", opt) map("n", 'p', ":BufferLineCyclePrev ", opt) From 2b981aea4bbdecb65a6ac1abc560371bfe46890a Mon Sep 17 00:00:00 2001 From: luokai Date: Mon, 6 Jun 2022 08:49:11 +0800 Subject: [PATCH 0190/1278] =?UTF-8?q?=E5=BF=85=E8=A6=81=E9=AB=98=E4=BA=AE?= =?UTF-8?q?=E8=AF=AD=E8=A8=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lua/plugins/config/nvim-treesitter.lua | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/lua/plugins/config/nvim-treesitter.lua b/lua/plugins/config/nvim-treesitter.lua index 7bfd80b6..f29876a6 100644 --- a/lua/plugins/config/nvim-treesitter.lua +++ b/lua/plugins/config/nvim-treesitter.lua @@ -1,7 +1,6 @@ require'nvim-treesitter.configs'.setup { -- One of "all", "maintained" (parsers with maintainers), or a list of languages - -- ensure_installed = {"lua", "java", "javascript", "html", "css", "c", "cpp", "go", "rust", "python", "vim", "yaml", "http", "bash"}, - ensure_installed = {}, + ensure_installed = {"lua", "java", "javascript", "html", "css", "c", "cpp", "go", "rust", "python", "vim", "yaml", "http", "bash"}, -- Install languages synchronously (only applied to `ensure_installed`) sync_install = false, From 44c1131409030722acca5d1878a96931df75d94a Mon Sep 17 00:00:00 2001 From: luokai Date: Mon, 6 Jun 2022 09:13:38 +0800 Subject: [PATCH 0191/1278] vim-illuminate --- lua/plugins/config/vim-illuminate.lua | 7 +++++++ lua/plugins/init.lua | 4 ++++ 2 files changed, 11 insertions(+) create mode 100644 lua/plugins/config/vim-illuminate.lua diff --git a/lua/plugins/config/vim-illuminate.lua b/lua/plugins/config/vim-illuminate.lua new file mode 100644 index 00000000..c7684168 --- /dev/null +++ b/lua/plugins/config/vim-illuminate.lua @@ -0,0 +1,7 @@ +-- https://github.com/RRethy/vim-illuminate +-- 禁止高亮的文件类型 +vim.g.Illuminate_ftblacklist = { + "NvimTree", + "vista_kind", + "alpha" +} diff --git a/lua/plugins/init.lua b/lua/plugins/init.lua index b33ceeb0..435e209e 100644 --- a/lua/plugins/init.lua +++ b/lua/plugins/init.lua @@ -196,6 +196,9 @@ require('packer').startup({function() 'nvim-lua/plenary.nvim' }, } + + -- 选择高亮插件 + use "RRethy/vim-illuminate" end, config = { display = { @@ -210,6 +213,7 @@ require('plugins/config/indent-blankline') require('plugins/config/alpha-nvim') require('plugins/config/lualine') require('plugins/config/nvim-tree') +require('plugins/config/vim-illuminate') -- 异步加载 vim.defer_fn(function() require('plugins/config/nvim-treesitter') From f23c7c5a1e36bcf54e9d303d8049e180776fdeaf Mon Sep 17 00:00:00 2001 From: luokai Date: Mon, 6 Jun 2022 10:23:16 +0800 Subject: [PATCH 0192/1278] visual selection --- lua/core/keybindings.lua | 8 +++++++- lua/core/utils/init.lua | 17 +++++++++++++++++ 2 files changed, 24 insertions(+), 1 deletion(-) diff --git a/lua/core/keybindings.lua b/lua/core/keybindings.lua index 9faf58e1..6c43dd11 100644 --- a/lua/core/keybindings.lua +++ b/lua/core/keybindings.lua @@ -56,6 +56,12 @@ M.setup = function() map('n', 'ff', 'Telescope find_files', opt) map('n', '', 'Telescope find_files', opt) map('n', 'fg', 'Telescope live_grep', opt) + local keymap = vim.keymap.set + keymap('v', 'fg', function() + local tb = require('telescope.builtin') + local text = require('core.utils').get_visual_selection() + tb.live_grep({ default_text = text }) + end, opt) map('n', 'fb', 'Telescope buffers', opt) map('n', 'fh', 'Telescope help_tags', opt) map('n', 'fr', 'Telescope asynctasks all', opt) @@ -152,7 +158,7 @@ M.maplsp = function(client, bufnr) vim.api.nvim_buf_set_keymap(bufnr, 'n', ']g', 'lua vim.diagnostic.goto_next()', opt) -- mapbuf('n', 'q', 'lua vim.diagnostic.setloclist()', opt) -- leader + = - vim.api.nvim_buf_set_keymap(bufnr, 'n', '=', 'lua vim.lsp.buf.formatting()', opt) + vim.api.nvim_buf_set_keymap(bufnr, 'n', '=', 'lua vim.lsp.buf.format()', opt) -- vim.api.nvim_buf_set_keymap(bufnr, 'v', '=', 'lua vim.lsp.buf.range_formatting()', opt) vim.api.nvim_buf_set_keymap(bufnr, 'v', '=', 'lua require("core.utils").format_range_operator()', opt) -- mapbuf('v', '=', 'lua vim.lsp.buf.formatting()', opt) diff --git a/lua/core/utils/init.lua b/lua/core/utils/init.lua index 816b6274..95caf4b7 100644 --- a/lua/core/utils/init.lua +++ b/lua/core/utils/init.lua @@ -178,4 +178,21 @@ M.format_range_operator = function() vim.go.operatorfunc = 'v:lua.op_func_formatting' vim.api.nvim_feedkeys('g@', 'n', false) end + + + +M.get_visual_selection = function() + vim.cmd('noau normal! "vy"') + local text = vim.fn.getreg('v') + vim.fn.setreg('v', {}) + + text = string.gsub(text, "\n", "") + if #text > 0 then + return text + else + return '' + end +end + + return M From f1db7aa90ce53ffb613b667c4544e53f979f40a5 Mon Sep 17 00:00:00 2001 From: luokai Date: Mon, 6 Jun 2022 13:51:30 +0800 Subject: [PATCH 0193/1278] dap --- lua/plugins/config/nvim-dap.lua | 2 ++ lua/plugins/init.lua | 1 + 2 files changed, 3 insertions(+) diff --git a/lua/plugins/config/nvim-dap.lua b/lua/plugins/config/nvim-dap.lua index 92b1f0b2..6918c1ae 100644 --- a/lua/plugins/config/nvim-dap.lua +++ b/lua/plugins/config/nvim-dap.lua @@ -55,3 +55,5 @@ vim.fn.sign_define('DapBreakpoint', {text='', texthl='Debug', linehl='', numh -- vim.fn.sign_define('DapBreakpointRejected', {text='R', texthl='', linehl='', numhl=''}) -- vim.fn.sign_define('DapLogPoint', {text='L', texthl='', linehl='', numhl=''}) -- vim.fn.sign_define('DapStopped', {text='→', texthl='', linehl='debugPC', numhl=''}) + +require("nvim-dap-virtual-text").setup() diff --git a/lua/plugins/init.lua b/lua/plugins/init.lua index 435e209e..76489ce4 100644 --- a/lua/plugins/init.lua +++ b/lua/plugins/init.lua @@ -71,6 +71,7 @@ require('packer').startup({function() -- debug use 'mfussenegger/nvim-dap' use { "rcarriga/nvim-dap-ui", requires = {"mfussenegger/nvim-dap"} } + use 'theHamsta/nvim-dap-virtual-text' -- git use 'tpope/vim-fugitive' From 0dd43bdbf70e0d62ee5924ab1200850b7a54a11d Mon Sep 17 00:00:00 2001 From: luokai Date: Mon, 6 Jun 2022 13:52:55 +0800 Subject: [PATCH 0194/1278] update --- lua/plugins/config/vim-illuminate.lua | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/lua/plugins/config/vim-illuminate.lua b/lua/plugins/config/vim-illuminate.lua index c7684168..301458ab 100644 --- a/lua/plugins/config/vim-illuminate.lua +++ b/lua/plugins/config/vim-illuminate.lua @@ -1,7 +1,6 @@ -- https://github.com/RRethy/vim-illuminate -- 禁止高亮的文件类型 vim.g.Illuminate_ftblacklist = { - "NvimTree", - "vista_kind", - "alpha" + "vista_kind", + "help", "terminal", "packer", "markdown", "git", "text", "NvimTree", "dashboard", "alpha" } From f4d7dc5f9109f5bc78f196a6b5c5f57d3857cdf5 Mon Sep 17 00:00:00 2001 From: luokai Date: Tue, 7 Jun 2022 09:30:47 +0800 Subject: [PATCH 0195/1278] md --- lua/lsp/init.lua | 3 +++ 1 file changed, 3 insertions(+) diff --git a/lua/lsp/init.lua b/lua/lsp/init.lua index 2d65df99..3fe0876d 100644 --- a/lua/lsp/init.lua +++ b/lua/lsp/init.lua @@ -13,6 +13,9 @@ local servers = { html = require("lsp.html"), pyright = require("lsp.pyright"), rust_analyzer = require 'lsp.rust_analyzer', + prosemd_lsp = { + config = {} + }, } -- 自动安装 LanguageServers From b9c9e3a921d7b7c8c987269386a8a4f6b9d1038a Mon Sep 17 00:00:00 2001 From: luokai Date: Thu, 9 Jun 2022 10:26:59 +0800 Subject: [PATCH 0196/1278] =?UTF-8?q?=E4=BD=BF=E7=94=A8=E7=B3=BB=E7=BB=9F?= =?UTF-8?q?=E5=89=AA=E5=88=87=E6=9D=BF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lua/core/basic.lua | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lua/core/basic.lua b/lua/core/basic.lua index 225cc924..a81c10a8 100644 --- a/lua/core/basic.lua +++ b/lua/core/basic.lua @@ -1,6 +1,8 @@ vim.g.mapleader = " " vim.opt.title = true +vim.opt.clipboard = "unnamedplus" + -- 行号 vim.wo.number = true vim.wo.relativenumber = true From ad5849edad07d0a21b8e6fee0ac38f52411acd4a Mon Sep 17 00:00:00 2001 From: luokai Date: Thu, 9 Jun 2022 22:22:01 +0800 Subject: [PATCH 0197/1278] formatter --- lua/lsp/init.lua | 9 +++------ lua/plugins/config/formatter.lua | 14 ++++++++------ lua/plugins/init.lua | 6 +++--- 3 files changed, 14 insertions(+), 15 deletions(-) diff --git a/lua/lsp/init.lua b/lua/lsp/init.lua index 3fe0876d..ff3acd61 100644 --- a/lua/lsp/init.lua +++ b/lua/lsp/init.lua @@ -7,15 +7,12 @@ local lspconfig = require('lspconfig') local servers = { sumneko_lua = require "lsp.lua", -- /lua/lsp/lua.lua -- jdtls = require "lsp.java", -- /lua/lsp/jdtls.lua - jsonls = require("lsp.jsonls"), + -- jsonls = require("lsp.jsonls"), clangd = require 'lsp.c', tsserver = require("lsp.tsserver"), html = require("lsp.html"), pyright = require("lsp.pyright"), rust_analyzer = require 'lsp.rust_analyzer', - prosemd_lsp = { - config = {} - }, } -- 自动安装 LanguageServers @@ -29,7 +26,7 @@ for name, _ in pairs(servers) do end end - -- Setup lspconfig. +-- Setup lspconfig. local capabilities = require('cmp_nvim_lsp').update_capabilities(vim.lsp.protocol.make_client_capabilities()) -- 没有确定使用效果参数 -- capabilities.textDocument.completion.completionItem.snippetSupport = true @@ -123,7 +120,7 @@ vim.lsp.handlers["textDocument/signatureHelp"] = vim.lsp.with(vim.lsp.handlers.s -- vim.api.nvim_echo({ { msg } }, true, {}) -- end -- end -vim.cmd[[ +vim.cmd [[ augroup jdtls_lsp autocmd! autocmd FileType java lua require'lsp.java'.setup() diff --git a/lua/plugins/config/formatter.lua b/lua/plugins/config/formatter.lua index 78bc42bf..f6bc86ca 100644 --- a/lua/plugins/config/formatter.lua +++ b/lua/plugins/config/formatter.lua @@ -1,7 +1,7 @@ local prettierConfig = function() return { exe = "prettier", - args = {"--stdin-filepath", vim.fn.shellescape(vim.api.nvim_buf_get_name(0)), "--single-quote"}, + args = { "--stdin-filepath", vim.fn.shellescape(vim.api.nvim_buf_get_name(0)), "--single-quote" }, stdin = true } end @@ -10,11 +10,13 @@ require("formatter").setup( { filetype = { -- lua = {function() return {exe = "lua-format", stdin = true} end}, - json = {prettierConfig}, - html = {prettierConfig}, - javascript = {prettierConfig}, - typescript = {prettierConfig}, - typescriptreact = {prettierConfig} + json = { prettierConfig }, + html = { prettierConfig }, + javascript = { prettierConfig }, + typescript = { prettierConfig }, + typescriptreact = { prettierConfig }, + markdown = { prettierConfig }, + sql = { exe = "sql-formatter" } } } ) diff --git a/lua/plugins/init.lua b/lua/plugins/init.lua index 76489ce4..f4e5a2c1 100644 --- a/lua/plugins/init.lua +++ b/lua/plugins/init.lua @@ -129,8 +129,8 @@ require('packer').startup({function() use {'iamcco/markdown-preview.nvim', run = 'cd app && yarn install'} -- 格式化插件 - -- use 'mhartington/formatter.nvim' - use 'sbdchd/neoformat' + use 'mhartington/formatter.nvim' + -- use 'sbdchd/neoformat' -- 快捷键查看 @@ -234,7 +234,7 @@ require('plugins/config/wilder') require('plugins/config/nvim-colorizer') require('plugins/config/comment') -- require('plugins/config/lspsaga') --- require('plugins/config/formatter') +require('plugins/config/formatter') require('plugins/config/telescope') -- require('plugins/config/nvim-lsputils') require('plugins/config/nvim-autopairs') From 0e245da3b1ca2a8fcf8f762eb1d05816d63e8004 Mon Sep 17 00:00:00 2001 From: luokai Date: Fri, 10 Jun 2022 12:43:11 +0800 Subject: [PATCH 0198/1278] fmt --- lua/plugins/config/formatter.lua | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/lua/plugins/config/formatter.lua b/lua/plugins/config/formatter.lua index f6bc86ca..8003d8c5 100644 --- a/lua/plugins/config/formatter.lua +++ b/lua/plugins/config/formatter.lua @@ -16,7 +16,13 @@ require("formatter").setup( typescript = { prettierConfig }, typescriptreact = { prettierConfig }, markdown = { prettierConfig }, - sql = { exe = "sql-formatter" } + sql = { function() + return { + exe = "sql-formatter", + args = { vim.fn.shellescape(vim.api.nvim_buf_get_name(0)) }, + stdin = true, + } + end } } } ) From 75da19968f79e316387e8b5539f90f4d21e70709 Mon Sep 17 00:00:00 2001 From: luokai Date: Fri, 10 Jun 2022 12:43:42 +0800 Subject: [PATCH 0199/1278] update --- lua/lsp/java.lua | 46 +++++++++++++++++++++++++++------------------- 1 file changed, 27 insertions(+), 19 deletions(-) diff --git a/lua/lsp/java.lua b/lua/lsp/java.lua index 57351aee..ab99d18e 100644 --- a/lua/lsp/java.lua +++ b/lua/lsp/java.lua @@ -22,6 +22,7 @@ end local function get_java_home() return or_default(env.JAVA_HOME, '/opt/software/java/zulu11.56.19-ca-jdk11.0.15-macosx_aarch64') end + local function get_java() return get_java_home() .. '/bin/java' end @@ -43,7 +44,7 @@ local function get_jdtls_extensions() return or_default(env.JDTLS_EXTENSIONS, '/opt/software/lsp/java') end -M.setup = function () +M.setup = function() local project_name = vim.fn.fnamemodify(vim.fn.getcwd(), ':p:h:t') @@ -81,12 +82,12 @@ M.setup = function () -- '-configuration', '/opt/software/lsp/jdtls/config_mac', '-data', workspace_dir, }, - filetypes = {"java"}, + filetypes = { "java" }, -- 💀 -- This is the default if not provided, you can remove it. Or adjust as needed. -- One dedicated LSP server & client will be started per unique root_dir - root_dir = require('jdtls.setup').find_root({'.git', 'mvnw', 'gradlew'}), + root_dir = require('jdtls.setup').find_root({ '.git', 'mvnw', 'gradlew' }), -- Here you can configure eclipse.jdt.ls specific settings -- See https://github.com/eclipse/eclipse.jdt.ls/wiki/Running-the-JAVA-LS-server-from-the-command-line#initialize-request @@ -148,7 +149,14 @@ M.setup = function () "java.util.Objects.requireNonNull", "java.util.Objects.requireNonNullElse", "org.mockito.Mockito.*" - } + }, + filteredTypes = { + "com.sun.*", + "io.micrometer.shaded.*", + "java.awt.*", + "jdk.*", + "sun.*", + }, }; sources = { organizeImports = { @@ -190,11 +198,11 @@ M.setup = function () -- -- If you don't plan on using the debugger or other eclipse.jdt.ls plugins you can remove this -- init_options = { - -- bundles = { - -- vim.fn.glob("/opt/software/lsp/java/java-debug/com.microsoft.java.debug.plugin/target/com.microsoft.java.debug.plugin-0.35.0.jar") - -- }, - -- workspace = workspace_dir - -- }, + -- bundles = { + -- vim.fn.glob("/opt/software/lsp/java/java-debug/com.microsoft.java.debug.plugin/target/com.microsoft.java.debug.plugin-0.35.0.jar") + -- }, + -- workspace = workspace_dir + -- }, } @@ -240,21 +248,21 @@ M.setup = function () local capabilities = require('cmp_nvim_lsp').update_capabilities(vim.lsp.protocol.make_client_capabilities()) -- capabilities.experimental = { - -- hoverActions = true, - -- hoverRange = true, - -- serverStatusNotification = true, - -- snippetTextEdit = true, - -- codeActionGroup = true, - -- ssr = true, - -- } + -- hoverActions = true, + -- hoverRange = true, + -- serverStatusNotification = true, + -- snippetTextEdit = true, + -- codeActionGroup = true, + -- ssr = true, + -- } - config.capabilities = capabilities; + config.capabilities = capabilities; - jdtls.start_or_attach(config) + jdtls.start_or_attach(config) - vim.cmd([[ + vim.cmd([[ command! -nargs=0 OR :lua require'jdtls'.organize_imports() nnoremap crv lua require('jdtls').extract_variable() vnoremap crv lua require('jdtls').extract_variable(true) From 5ad9580579d336429228538974d8b150b48f6073 Mon Sep 17 00:00:00 2001 From: luokai Date: Sat, 11 Jun 2022 09:55:02 +0800 Subject: [PATCH 0200/1278] DapBreakpoint --- lua/plugins/config/nvim-dap.lua | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lua/plugins/config/nvim-dap.lua b/lua/plugins/config/nvim-dap.lua index 6918c1ae..e8d13613 100644 --- a/lua/plugins/config/nvim-dap.lua +++ b/lua/plugins/config/nvim-dap.lua @@ -50,7 +50,8 @@ dap.listeners.before.event_exited["dapui_config"] = function() dapui.close() end -vim.fn.sign_define('DapBreakpoint', {text='', texthl='Debug', linehl='', numhl=''}) +vim.fn.sign_define('DapBreakpoint', { text = '🔴', texthl = '', linehl = '', numhl = '' }) +-- vim.fn.sign_define('DapBreakpoint', {text='', texthl='Debug', linehl='', numhl=''}) -- vim.fn.sign_define("DapBreakpointCondition", { text = "C", texthl = "", linehl = "", numhl = "" }) -- vim.fn.sign_define('DapBreakpointRejected', {text='R', texthl='', linehl='', numhl=''}) -- vim.fn.sign_define('DapLogPoint', {text='L', texthl='', linehl='', numhl=''}) From c930a0426bb9be2f28588da181099ec23ea6bca8 Mon Sep 17 00:00:00 2001 From: luokai Date: Sat, 11 Jun 2022 10:12:52 +0800 Subject: [PATCH 0201/1278] udpate --- lua/plugins/config/nvim-dap.lua | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/lua/plugins/config/nvim-dap.lua b/lua/plugins/config/nvim-dap.lua index e8d13613..06149071 100644 --- a/lua/plugins/config/nvim-dap.lua +++ b/lua/plugins/config/nvim-dap.lua @@ -1,3 +1,11 @@ +local dap = require('dap') +-- dap.defaults.fallback.terminal_win_cmd = '50vsplit new' +-- dap.defaults.fallback.focus_terminal = true +-- dap.defaults.fallback.external_terminal = { +-- command = '/opt/homebrew/bin/alacritty'; +-- args = { '-e' }; +-- } + require("dapui").setup({ icons = { expanded = "▾", collapsed = "▸" }, mappings = { @@ -39,7 +47,7 @@ require("dapui").setup({ windows = { indent = 1 }, }) -local dap, dapui = require("dap"), require("dapui") +local dapui = require("dapui") dap.listeners.after.event_initialized["dapui_config"] = function() --dapui.open() end From 452bc9711fecff33adfecdc1a326b873491f8c80 Mon Sep 17 00:00:00 2001 From: luokai Date: Sat, 11 Jun 2022 20:26:08 +0800 Subject: [PATCH 0202/1278] update --- lua/lsp/java.lua | 2 +- lua/plugins/config/nvim-dap.lua | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/lua/lsp/java.lua b/lua/lsp/java.lua index ab99d18e..0d6ffc32 100644 --- a/lua/lsp/java.lua +++ b/lua/lsp/java.lua @@ -183,7 +183,7 @@ M.setup = function() }, { name = "JavaSE-17", - path = "/opt/software/java/zulu17.34.19-ca-jdk17.0.3-macosx_aarch64", + path = "/opt/software/java/graalvm-ce-java17-22.1.0/Contents/Home", }, } }, diff --git a/lua/plugins/config/nvim-dap.lua b/lua/plugins/config/nvim-dap.lua index 06149071..2aa28d7e 100644 --- a/lua/plugins/config/nvim-dap.lua +++ b/lua/plugins/config/nvim-dap.lua @@ -58,8 +58,8 @@ dap.listeners.before.event_exited["dapui_config"] = function() dapui.close() end -vim.fn.sign_define('DapBreakpoint', { text = '🔴', texthl = '', linehl = '', numhl = '' }) --- vim.fn.sign_define('DapBreakpoint', {text='', texthl='Debug', linehl='', numhl=''}) +-- vim.fn.sign_define('DapBreakpoint', { text = '🔴', texthl = '', linehl = '', numhl = '' }) +vim.fn.sign_define('DapBreakpoint', {text='', texthl='Debug', linehl='', numhl=''}) -- vim.fn.sign_define("DapBreakpointCondition", { text = "C", texthl = "", linehl = "", numhl = "" }) -- vim.fn.sign_define('DapBreakpointRejected', {text='R', texthl='', linehl='', numhl=''}) -- vim.fn.sign_define('DapLogPoint', {text='L', texthl='', linehl='', numhl=''}) From 5a41d9bb8cf156961d578445479a73374f969006 Mon Sep 17 00:00:00 2001 From: luokai Date: Sat, 11 Jun 2022 22:31:06 +0800 Subject: [PATCH 0203/1278] toggleterm.nvim --- lua/core/keybindings.lua | 5 ++- lua/plugins/init.lua | 91 ++++++++++++++++++++++------------------ 2 files changed, 54 insertions(+), 42 deletions(-) diff --git a/lua/core/keybindings.lua b/lua/core/keybindings.lua index 6c43dd11..2b2aaa74 100644 --- a/lua/core/keybindings.lua +++ b/lua/core/keybindings.lua @@ -37,8 +37,9 @@ M.setup = function() -- vim-floaterm -- vim.g.floaterm_keymap_new = 'ft' - map('n', '', ':FloatermToggle', opt) - map('t', ' ', '::FloatermToggle', opt) + -- map('n', '', ':FloatermToggle', opt) + -- map('t', ' ', '::FloatermToggle', opt) + map('n', '', ':ToggleTerm', opt) -- vista diff --git a/lua/plugins/init.lua b/lua/plugins/init.lua index f4e5a2c1..14fab76c 100644 --- a/lua/plugins/init.lua +++ b/lua/plugins/init.lua @@ -1,4 +1,4 @@ -require('packer').startup({function() +require('packer').startup({ function() use { 'nvim-lua/plenary.nvim' } @@ -7,14 +7,14 @@ require('packer').startup({function() -- Packer can manage itself use 'wbthomason/packer.nvim' - use {'neovim/nvim-lspconfig', 'williamboman/nvim-lsp-installer'} + use { 'neovim/nvim-lspconfig', 'williamboman/nvim-lsp-installer' } use 'kyazdani42/nvim-web-devicons' -- nvim-cmp use 'hrsh7th/cmp-nvim-lsp' -- { name = nvim_lsp } - use 'hrsh7th/cmp-buffer' -- { name = 'buffer' }, - use 'hrsh7th/cmp-path' -- { name = 'path' } + use 'hrsh7th/cmp-buffer' -- { name = 'buffer' }, + use 'hrsh7th/cmp-path' -- { name = 'path' } -- use 'hrsh7th/cmp-cmdline' -- { name = 'cmdline' } use 'hrsh7th/nvim-cmp' @@ -44,6 +44,14 @@ require('packer').startup({function() -- use 'RishabhRD/popfix' -- use 'RishabhRD/nvim-lsputils' + use({ + "jose-elias-alvarez/null-ls.nvim", + config = function() + require("null-ls").setup() + end, + requires = { "nvim-lua/plenary.nvim" }, + }) + -- 主题 use 'morhetz/gruvbox' @@ -57,7 +65,7 @@ require('packer').startup({function() } -- using packer.nvim - use {'akinsho/bufferline.nvim', requires = 'kyazdani42/nvim-web-devicons'} + use { 'akinsho/bufferline.nvim', requires = 'kyazdani42/nvim-web-devicons' } -- treesitter (新增) @@ -70,7 +78,7 @@ require('packer').startup({function() -- debug use 'mfussenegger/nvim-dap' - use { "rcarriga/nvim-dap-ui", requires = {"mfussenegger/nvim-dap"} } + use { "rcarriga/nvim-dap-ui", requires = { "mfussenegger/nvim-dap" } } use 'theHamsta/nvim-dap-virtual-text' -- git @@ -92,8 +100,11 @@ require('packer').startup({function() use 'skywind3000/asyncrun.vim' -- 浮动窗口插件 - use 'voldikss/vim-floaterm' + -- use 'voldikss/vim-floaterm' -- use 'voldikss/LeaderF-floaterm' + use { "akinsho/toggleterm.nvim", tag = 'v2.*', config = function() + require("toggleterm").setup() + end } -- 多光标插件 use 'mg979/vim-visual-multi' @@ -101,7 +112,7 @@ require('packer').startup({function() -- 状态栏插件 -- use 'feline-nvim/feline.nvim' use { - 'nvim-lualine/lualine.nvim', + 'nvim-lualine/lualine.nvim', } -- blankline @@ -126,7 +137,7 @@ require('packer').startup({function() } -- mackdown 预览插件 - use {'iamcco/markdown-preview.nvim', run = 'cd app && yarn install'} + use { 'iamcco/markdown-preview.nvim', run = 'cd app && yarn install' } -- 格式化插件 use 'mhartington/formatter.nvim' @@ -152,9 +163,9 @@ require('packer').startup({function() 'nvim-lua/plenary.nvim' }, } - use {'nvim-telescope/telescope-ui-select.nvim' } + use { 'nvim-telescope/telescope-ui-select.nvim' } -- use {'nvim-telescope/telescope-fzf-native.nvim', run = 'make' } - use {'nvim-telescope/telescope-dap.nvim'} + use { 'nvim-telescope/telescope-dap.nvim' } use 'GustavoKatel/telescope-asynctasks.nvim' -- use 'aloussase/telescope-gradle.nvim' @@ -205,7 +216,7 @@ config = { display = { open_fn = require('packer.util').float, } -}}) +} }) require('plugins/config/bufferline') @@ -217,33 +228,33 @@ require('plugins/config/nvim-tree') require('plugins/config/vim-illuminate') -- 异步加载 vim.defer_fn(function() -require('plugins/config/nvim-treesitter') - -require('plugins/config/luasnip') -require('plugins/config/nvim-cmp') --- require('plugins/config/LeaderF') -require('plugins/config/gitsigns-nvim') -require('plugins/config/vim-floaterm') -require('plugins/config/asynctasks') --- require('plugins/config/feline') -require('plugins/config/vista') --- require('plugins/config/lsp-colors') -require('plugins/config/trouble') -require('plugins/config/nvim-notify') -require('plugins/config/wilder') -require('plugins/config/nvim-colorizer') -require('plugins/config/comment') --- require('plugins/config/lspsaga') -require('plugins/config/formatter') -require('plugins/config/telescope') --- require('plugins/config/nvim-lsputils') -require('plugins/config/nvim-autopairs') --- require('plugins/config/lsp_signature') -require('plugins/config/nvim-dap') -require('plugins/config/markdown-preview') -require('plugins/config/autosave') --- require('plugins/config/nvim-neorg') -vim.cmd[[ + require('plugins/config/nvim-treesitter') + + require('plugins/config/luasnip') + require('plugins/config/nvim-cmp') + -- require('plugins/config/LeaderF') + require('plugins/config/gitsigns-nvim') + require('plugins/config/vim-floaterm') + require('plugins/config/asynctasks') + -- require('plugins/config/feline') + require('plugins/config/vista') + -- require('plugins/config/lsp-colors') + require('plugins/config/trouble') + require('plugins/config/nvim-notify') + require('plugins/config/wilder') + require('plugins/config/nvim-colorizer') + require('plugins/config/comment') + -- require('plugins/config/lspsaga') + require('plugins/config/formatter') + require('plugins/config/telescope') + -- require('plugins/config/nvim-lsputils') + require('plugins/config/nvim-autopairs') + -- require('plugins/config/lsp_signature') + require('plugins/config/nvim-dap') + require('plugins/config/markdown-preview') + require('plugins/config/autosave') + -- require('plugins/config/nvim-neorg') + vim.cmd [[ function! s:http_rest_init() abort lua require('plugins/config/rest-nvim') lua require('core.keybindings').rest_nvim() @@ -254,5 +265,5 @@ augroup http_rest augroup end ]] -require('core.keybindings').setup() + require('core.keybindings').setup() end, 0) From a3f035b59bef02c89be1e7459cecf7a459bbc502 Mon Sep 17 00:00:00 2001 From: luokai Date: Sat, 11 Jun 2022 23:14:46 +0800 Subject: [PATCH 0204/1278] update --- lua/lsp/java.lua | 6 +++--- lua/plugins/init.lua | 1 + 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/lua/lsp/java.lua b/lua/lsp/java.lua index 0d6ffc32..0a1d4c8f 100644 --- a/lua/lsp/java.lua +++ b/lua/lsp/java.lua @@ -70,9 +70,9 @@ M.setup = function() -- '-XX:+UseParallelGC', -- '-XX:GCTimeRatio=4', -- '-XX:AdaptiveSizePolicyWeight=90', - '-XX:+UseG1GC', - '-XX:+UseStringDeduplication', - '-Xms512m', + -- '-XX:+UseG1GC', + -- '-XX:+UseStringDeduplication', + -- '-Xms512m', '-Xmx2g', '-javaagent:' .. get_lombok_jar(), '--add-modules=ALL-SYSTEM', diff --git a/lua/plugins/init.lua b/lua/plugins/init.lua index 14fab76c..145405a3 100644 --- a/lua/plugins/init.lua +++ b/lua/plugins/init.lua @@ -54,6 +54,7 @@ require('packer').startup({ function() -- 主题 use 'morhetz/gruvbox' + -- use 'sainnhe/gruvbox-material' -- 文件管理 From 0a2a400232d77479bde59908f9f95b044ad7402d Mon Sep 17 00:00:00 2001 From: luokai Date: Sat, 11 Jun 2022 23:22:50 +0800 Subject: [PATCH 0205/1278] close_other_bufline --- lua/core/keybindings.lua | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/lua/core/keybindings.lua b/lua/core/keybindings.lua index 2b2aaa74..4a869fe9 100644 --- a/lua/core/keybindings.lua +++ b/lua/core/keybindings.lua @@ -19,7 +19,10 @@ M.setup = function() map('n', '', ':nohlsearch', opt) -- %bd 删除所有缓冲区, e# 打开最后一个缓冲区, bd# 关闭[No Name] -- map('n', 'o', ':%bd|e#|bd#', opt) - map('n', 'o', 'lua require("core.utils").close_other_bufline()', opt) + -- map('n', 'o', 'lua require("core.utils").close_other_bufline()', opt) + vim.api.nvim_create_user_command("BufferCloseOther", function () + require("core.utils").close_other_bufline() + end, {}) map('n', 'w', ':bdelete!', opt) map('n', 'q', ':q', opt) map("n", 'n', ":BufferLineCycleNext ", opt) From 34b29d86da839bfdddede23f7b84ae621e2bc4e8 Mon Sep 17 00:00:00 2001 From: luokai Date: Sun, 12 Jun 2022 09:41:11 +0800 Subject: [PATCH 0206/1278] hop.nvim --- lua/core/keybindings.lua | 16 +++++++++++++++- lua/plugins/init.lua | 9 +++++++++ 2 files changed, 24 insertions(+), 1 deletion(-) diff --git a/lua/core/keybindings.lua b/lua/core/keybindings.lua index 4a869fe9..e699059f 100644 --- a/lua/core/keybindings.lua +++ b/lua/core/keybindings.lua @@ -20,7 +20,7 @@ M.setup = function() -- %bd 删除所有缓冲区, e# 打开最后一个缓冲区, bd# 关闭[No Name] -- map('n', 'o', ':%bd|e#|bd#', opt) -- map('n', 'o', 'lua require("core.utils").close_other_bufline()', opt) - vim.api.nvim_create_user_command("BufferCloseOther", function () + vim.api.nvim_create_user_command("BufferCloseOther", function() require("core.utils").close_other_bufline() end, {}) map('n', 'w', ':bdelete!', opt) @@ -124,6 +124,20 @@ nnoremap l end +-- hop.nvim +-- place this in one of your configuration file(s) +map('n', 'f', "lua require'hop'.hint_char1({ direction = require'hop.hint'.HintDirection.AFTER_CURSOR, current_line_only = true })", opt) +map('v', 'f', "lua require'hop'.hint_char1({ direction = require'hop.hint'.HintDirection.AFTER_CURSOR, current_line_only = true })", opt) +map('n', 'F', "lua require'hop'.hint_char1({ direction = require'hop.hint'.HintDirection.BEFORE_CURSOR, current_line_only = true })", opt) +map('v', 'F', "lua require'hop'.hint_char1({ direction = require'hop.hint'.HintDirection.BEFORE_CURSOR, current_line_only = true })", opt) +map('o', 'f', "lua require'hop'.hint_char1({ direction = require'hop.hint'.HintDirection.AFTER_CURSOR, current_line_only = true, inclusive_jump = true })", opt) +map('o', 'F', "lua require'hop'.hint_char1({ direction = require'hop.hint'.HintDirection.BEFORE_CURSOR, current_line_only = true, inclusive_jump = true })", opt) +-- map('', 't', "lua require'hop'.hint_char1({ direction = require'hop.hint'.HintDirection.AFTER_CURSOR, current_line_only = true })", opt) +-- map('', 'T', "lua require'hop'.hint_char1({ direction = require'hop.hint'.HintDirection.BEFORE_CURSOR, current_line_only = true })", opt) +-- map('n', 'e', " lua require'hop'.hint_words({ hint_position = require'hop.hint'.HintPosition.END })", opt) +-- map('v', 'e', " lua require'hop'.hint_words({ hint_position = require'hop.hint'.HintPosition.END })", opt) +-- map('o', 'e', " lua require'hop'.hint_words({ hint_position = require'hop.hint'.HintPosition.END, inclusive_jump = true })", opt) + -- lsp 回调函数快捷键设置 M.maplsp = function(client, bufnr) diff --git a/lua/plugins/init.lua b/lua/plugins/init.lua index 145405a3..284c77cc 100644 --- a/lua/plugins/init.lua +++ b/lua/plugins/init.lua @@ -212,6 +212,15 @@ require('packer').startup({ function() -- 选择高亮插件 use "RRethy/vim-illuminate" + + use { + 'phaazon/hop.nvim', + branch = 'v1', -- optional but strongly recommended + config = function() + -- you can configure Hop the way you like here; see :h hop-config + require 'hop'.setup { keys = 'etovxqpdygfblzhckisuran' } + end + } end, config = { display = { From 37fc6dba89e2273d0d1b4a3e48b79a394c0188cb Mon Sep 17 00:00:00 2001 From: luokai Date: Sun, 12 Jun 2022 15:28:37 +0800 Subject: [PATCH 0207/1278] fidget.nvim --- init.lua | 1 + lua/core/basic.lua | 1 + lua/plugins/config/lualine.lua | 3 ++- lua/plugins/init.lua | 9 ++++++++- 4 files changed, 12 insertions(+), 2 deletions(-) diff --git a/init.lua b/init.lua index 98fc9603..85551db9 100644 --- a/init.lua +++ b/init.lua @@ -20,4 +20,5 @@ set background=dark colorscheme gruvbox " 丢失配色, 变为透明 " highlight Normal guibg=NONE ctermbg=None +" autocmd vimenter * hi Normal guibg=#282828 ]] diff --git a/lua/core/basic.lua b/lua/core/basic.lua index a81c10a8..8fb30329 100644 --- a/lua/core/basic.lua +++ b/lua/core/basic.lua @@ -81,6 +81,7 @@ vim.opt.termguicolors = true -- 补全增强 vim.o.wildmenu = true +vim.opt.confirm = true -- vim.g.python_host_prog='/opt/homebrew/bin/python3' vim.g.python3_host_prog='/opt/homebrew/bin/python3' diff --git a/lua/plugins/config/lualine.lua b/lua/plugins/config/lualine.lua index 383e0aaf..f05efecd 100644 --- a/lua/plugins/config/lualine.lua +++ b/lua/plugins/config/lualine.lua @@ -10,7 +10,8 @@ require('lualine').setup { sections = { lualine_a = {'mode'}, lualine_b = {'branch', 'diff', 'diagnostics'}, - lualine_c = {'filename', 'lsp_progress'}, + -- lualine_c = {'filename', 'lsp_progress'}, + lualine_c = {'filename'}, lualine_x = {'encoding', 'fileformat', 'filetype'}, lualine_y = {'progress'}, lualine_z = {'location'} diff --git a/lua/plugins/init.lua b/lua/plugins/init.lua index 284c77cc..739dcb8e 100644 --- a/lua/plugins/init.lua +++ b/lua/plugins/init.lua @@ -36,7 +36,7 @@ require('packer').startup({ function() -- java 不友好 -- use 'glepnir/lspsaga.nvim' - use 'arkav/lualine-lsp-progress' + -- use 'arkav/lualine-lsp-progress' -- use 'nvim-lua/lsp-status.nvim' -- use 'ray-x/lsp_signature.nvim' @@ -221,6 +221,13 @@ require('packer').startup({ function() require 'hop'.setup { keys = 'etovxqpdygfblzhckisuran' } end } + + use { 'j-hui/fidget.nvim', + config = function() + require "fidget".setup {} + end + } + end, config = { display = { From f4e64b921e01d1b45cf496f4b2511c845f2e5052 Mon Sep 17 00:00:00 2001 From: luokai Date: Sun, 12 Jun 2022 16:38:20 +0800 Subject: [PATCH 0208/1278] =?UTF-8?q?=E6=9F=A5=E6=89=BE=E6=9B=BF=E6=8D=A2?= =?UTF-8?q?=E6=8F=92=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lua/core/keybindings.lua | 9 +++++++++ lua/plugins/init.lua | 11 ++++++++++- 2 files changed, 19 insertions(+), 1 deletion(-) diff --git a/lua/core/keybindings.lua b/lua/core/keybindings.lua index e699059f..911f113b 100644 --- a/lua/core/keybindings.lua +++ b/lua/core/keybindings.lua @@ -138,6 +138,15 @@ map('o', 'F', "lua require'hop'.hint_char1({ direction = require'hop.hint'. -- map('v', 'e', " lua require'hop'.hint_words({ hint_position = require'hop.hint'.HintPosition.END })", opt) -- map('o', 'e', " lua require'hop'.hint_words({ hint_position = require'hop.hint'.HintPosition.END, inclusive_jump = true })", opt) +-- nvim-spectre +map('n', 'S', "lua require('spectre').open()", opt) +-- search current word +map('n', 'sw', "lua require('spectre').open_visual({select_word=true})", opt) +map('v', 's', "lua require('spectre').open_visual()", opt) +-- search in current file +map('n', 'sp', "viw:lua require('spectre').open_file_search()", opt) +-- run command :Spectre + -- lsp 回调函数快捷键设置 M.maplsp = function(client, bufnr) diff --git a/lua/plugins/init.lua b/lua/plugins/init.lua index 739dcb8e..a6a4c1e3 100644 --- a/lua/plugins/init.lua +++ b/lua/plugins/init.lua @@ -210,9 +210,10 @@ require('packer').startup({ function() }, } - -- 选择高亮插件 + -- 选中高亮插件 use "RRethy/vim-illuminate" + -- 快速跳转 use { 'phaazon/hop.nvim', branch = 'v1', -- optional but strongly recommended @@ -222,12 +223,20 @@ require('packer').startup({ function() end } + -- LSP 进度 use { 'j-hui/fidget.nvim', config = function() require "fidget".setup {} end } + -- 查找替换 + use { 'windwp/nvim-spectre', + config = function() + require('spectre').setup() + end + } + end, config = { display = { From 5ca1834806cc28d0991cbffa98cfa1ba04b52e1f Mon Sep 17 00:00:00 2001 From: luokai Date: Sun, 12 Jun 2022 21:26:06 +0800 Subject: [PATCH 0209/1278] =?UTF-8?q?ASCII=20=E5=9B=BE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lua/plugins/init.lua | 3 +++ 1 file changed, 3 insertions(+) diff --git a/lua/plugins/init.lua b/lua/plugins/init.lua index a6a4c1e3..e66fb552 100644 --- a/lua/plugins/init.lua +++ b/lua/plugins/init.lua @@ -237,6 +237,9 @@ require('packer').startup({ function() end } + -- ASCII 图 + use 'jbyuki/venn.nvim' + end, config = { display = { From 8579d6fae2182d5a9712d7bad39378300cc7d2c6 Mon Sep 17 00:00:00 2001 From: luokai Date: Sun, 12 Jun 2022 21:50:26 +0800 Subject: [PATCH 0210/1278] colorscheme --- lua/plugins/config/telescope.lua | 27 +++++++++++++++++++-------- lua/plugins/init.lua | 3 ++- 2 files changed, 21 insertions(+), 9 deletions(-) diff --git a/lua/plugins/config/telescope.lua b/lua/plugins/config/telescope.lua index 7a5d1437..d8ed5966 100644 --- a/lua/plugins/config/telescope.lua +++ b/lua/plugins/config/telescope.lua @@ -1,7 +1,7 @@ local actions = require("telescope.actions") local trouble = require("trouble.providers.telescope") local telescope = require('telescope'); -telescope.setup{ +telescope.setup { defaults = { vimgrep_arguments = { "rg", @@ -12,7 +12,8 @@ telescope.setup{ "--column", "--smart-case", }, - prompt_prefix = "  ", + -- prompt_prefix = "  ", + prompt_prefix = "  ", selection_caret = " ", entry_prefix = " ", initial_mode = "insert", @@ -34,7 +35,17 @@ telescope.setup{ }, winblend = 0, border = {}, - borderchars = { "─", "│", "─", "│", "╭", "╮", "╯", "╰" }, + -- borderchars = { "─", "│", "─", "│", "╭", "╮", "╯", "╰" }, + -- borderchars = { + -- prompt = { '▀', '▐', '▄', '▌', '▛', '▜', '▟', '▙' }; + -- results = { '▀', '▐', '▄', '▌', '▛', '▜', '▟', '▙' }; + -- preview = { '▀', '▐', '▄', '▌', '▛', '▜', '▟', '▙' }; + -- }, + borderchars = { + prompt = { '▀', '▐', '▄', '▌', '▛', '▜', '▟', '▙' }; + results = { ' ', '▐', '▄', '▌', '▌', '▐', '▟', '▙' }; + preview = { '▀', '▐', '▄', '▌', '▛', '▜', '▟', '▙' }; + }, color_devicons = true, use_less = true, -- set_env = { ["COLORTERM"] = "gruvbox" }, -- default = nil, @@ -87,11 +98,11 @@ telescope.setup{ } }, fzf = { - fuzzy = true, -- false will only do exact matching - override_generic_sorter = true, -- override the generic sorter - override_file_sorter = true, -- override the file sorter - case_mode = "smart_case", -- or "ignore_case" or "respect_case" - -- the default case_mode is "smart_case" + fuzzy = true, -- false will only do exact matching + override_generic_sorter = true, -- override the generic sorter + override_file_sorter = true, -- override the file sorter + case_mode = "smart_case", -- or "ignore_case" or "respect_case" + -- the default case_mode is "smart_case" } }, } diff --git a/lua/plugins/init.lua b/lua/plugins/init.lua index e66fb552..79756eb6 100644 --- a/lua/plugins/init.lua +++ b/lua/plugins/init.lua @@ -53,7 +53,8 @@ require('packer').startup({ function() }) -- 主题 - use 'morhetz/gruvbox' + -- use 'morhetz/gruvbox' + use { "ellisonleao/gruvbox.nvim" } -- use 'sainnhe/gruvbox-material' From 515e560eea562f2326692137c3055d7fd0d1a771 Mon Sep 17 00:00:00 2001 From: luokai Date: Sun, 12 Jun 2022 22:19:48 +0800 Subject: [PATCH 0211/1278] default --- lua/plugins/config/telescope.lua | 52 ++++++++++++++++---------------- 1 file changed, 26 insertions(+), 26 deletions(-) diff --git a/lua/plugins/config/telescope.lua b/lua/plugins/config/telescope.lua index d8ed5966..bfbcaaa4 100644 --- a/lua/plugins/config/telescope.lua +++ b/lua/plugins/config/telescope.lua @@ -3,15 +3,15 @@ local trouble = require("trouble.providers.telescope") local telescope = require('telescope'); telescope.setup { defaults = { - vimgrep_arguments = { - "rg", - "--color=never", - "--no-heading", - "--with-filename", - "--line-number", - "--column", - "--smart-case", - }, + -- vimgrep_arguments = { + -- "rg", + -- "--color=never", + -- "--no-heading", + -- "--with-filename", + -- "--line-number", + -- "--column", + -- "--smart-case", + -- }, -- prompt_prefix = "  ", prompt_prefix = "  ", selection_caret = " ", @@ -33,8 +33,8 @@ telescope.setup { height = 0.80, preview_cutoff = 120, }, - winblend = 0, - border = {}, + winblend = 20, + -- border = {}, -- borderchars = { "─", "│", "─", "│", "╭", "╮", "╯", "╰" }, -- borderchars = { -- prompt = { '▀', '▐', '▄', '▌', '▛', '▜', '▟', '▙' }; @@ -47,17 +47,17 @@ telescope.setup { preview = { '▀', '▐', '▄', '▌', '▛', '▜', '▟', '▙' }; }, color_devicons = true, - use_less = true, + -- use_less = true, -- set_env = { ["COLORTERM"] = "gruvbox" }, -- default = nil, - file_sorter = require("telescope.sorters").get_fuzzy_file, + -- file_sorter = require("telescope.sorters").get_fuzzy_file, file_ignore_patterns = { "node_modules" }, - generic_sorter = require("telescope.sorters").get_generic_fuzzy_sorter, - path_display = { "truncate" }, - file_previewer = require("telescope.previewers").vim_buffer_cat.new, - grep_previewer = require("telescope.previewers").vim_buffer_vimgrep.new, - qflist_previewer = require("telescope.previewers").vim_buffer_qflist.new, + -- generic_sorter = require("telescope.sorters").get_generic_fuzzy_sorter, + -- path_display = { "truncate" }, + -- file_previewer = require("telescope.previewers").vim_buffer_cat.new, + -- grep_previewer = require("telescope.previewers").vim_buffer_vimgrep.new, + -- qflist_previewer = require("telescope.previewers").vim_buffer_qflist.new, -- Developer configurations: Not meant for general override - buffer_previewer_maker = require("telescope.previewers").buffer_previewer_maker, + -- buffer_previewer_maker = require("telescope.previewers").buffer_previewer_maker, @@ -97,13 +97,13 @@ telescope.setup { -- even more opts } }, - fzf = { - fuzzy = true, -- false will only do exact matching - override_generic_sorter = true, -- override the generic sorter - override_file_sorter = true, -- override the file sorter - case_mode = "smart_case", -- or "ignore_case" or "respect_case" - -- the default case_mode is "smart_case" - } + -- fzf = { + -- fuzzy = true, -- false will only do exact matching + -- override_generic_sorter = true, -- override the generic sorter + -- override_file_sorter = true, -- override the file sorter + -- case_mode = "smart_case", -- or "ignore_case" or "respect_case" + -- -- the default case_mode is "smart_case" + -- } }, } telescope.load_extension("notify") From 5abfe4b6713e51504dd698675557ca38e895cef2 Mon Sep 17 00:00:00 2001 From: luokai Date: Sun, 12 Jun 2022 22:30:12 +0800 Subject: [PATCH 0212/1278] lsp_workspace_symbols --- lua/core/keybindings.lua | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/lua/core/keybindings.lua b/lua/core/keybindings.lua index 911f113b..a35e6b44 100644 --- a/lua/core/keybindings.lua +++ b/lua/core/keybindings.lua @@ -141,8 +141,8 @@ map('o', 'F', "lua require'hop'.hint_char1({ direction = require'hop.hint'. -- nvim-spectre map('n', 'S', "lua require('spectre').open()", opt) -- search current word -map('n', 'sw', "lua require('spectre').open_visual({select_word=true})", opt) -map('v', 's', "lua require('spectre').open_visual()", opt) +map('n', 'sr', "lua require('spectre').open_visual({select_word=true})", opt) +map('v', 'sr', "lua require('spectre').open_visual()", opt) -- search in current file map('n', 'sp', "viw:lua require('spectre').open_file_search()", opt) -- run command :Spectre @@ -178,6 +178,14 @@ M.maplsp = function(client, bufnr) -- mapbuf('n', 's', 'lua vim.lsp.buf.workspace_symbol()', opt) -- mapbuf('n', 's', 'lua require"telescope.builtin".lsp_workspace_symbols({ query = vim.fn.input("Query> ") })', opt) vim.api.nvim_buf_set_keymap(bufnr, 'n', 'sw', 'Telescope lsp_dynamic_workspace_symbols', opt) + local keymap = vim.keymap.set + keymap('v', 'sw', function() + local tb = require('telescope.builtin') + local text = require('core.utils').get_visual_selection() + tb.lsp_workspace_symbols({ default_text = text, query = text }) + end, opt) + + vim.api.nvim_buf_set_keymap(bufnr, 'n', 'sd', 'Telescope lsp_document_symbols', opt) -- diagnostic vim.api.nvim_buf_set_keymap(bufnr, 'n', 'go', 'lua vim.diagnostic.open_float()', opt) From 53f42867460a79391141a868396674ab220f581d Mon Sep 17 00:00:00 2001 From: luokai Date: Sun, 12 Jun 2022 22:54:24 +0800 Subject: [PATCH 0213/1278] default --- lua/plugins/config/telescope.lua | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/lua/plugins/config/telescope.lua b/lua/plugins/config/telescope.lua index bfbcaaa4..8796a498 100644 --- a/lua/plugins/config/telescope.lua +++ b/lua/plugins/config/telescope.lua @@ -41,11 +41,11 @@ telescope.setup { -- results = { '▀', '▐', '▄', '▌', '▛', '▜', '▟', '▙' }; -- preview = { '▀', '▐', '▄', '▌', '▛', '▜', '▟', '▙' }; -- }, - borderchars = { - prompt = { '▀', '▐', '▄', '▌', '▛', '▜', '▟', '▙' }; - results = { ' ', '▐', '▄', '▌', '▌', '▐', '▟', '▙' }; - preview = { '▀', '▐', '▄', '▌', '▛', '▜', '▟', '▙' }; - }, + -- borderchars = { + -- prompt = { '▀', '▐', '▄', '▌', '▛', '▜', '▟', '▙' }; + -- results = { ' ', '▐', '▄', '▌', '▌', '▐', '▟', '▙' }; + -- preview = { '▀', '▐', '▄', '▌', '▛', '▜', '▟', '▙' }; + -- }, color_devicons = true, -- use_less = true, -- set_env = { ["COLORTERM"] = "gruvbox" }, -- default = nil, From d4bcb0f8f465fac50176081dc76b05ce4c630b65 Mon Sep 17 00:00:00 2001 From: luokai Date: Mon, 13 Jun 2022 22:09:03 +0800 Subject: [PATCH 0214/1278] registers --- lua/plugins/init.lua | 1 + 1 file changed, 1 insertion(+) diff --git a/lua/plugins/init.lua b/lua/plugins/init.lua index 79756eb6..0e1bde39 100644 --- a/lua/plugins/init.lua +++ b/lua/plugins/init.lua @@ -241,6 +241,7 @@ require('packer').startup({ function() -- ASCII 图 use 'jbyuki/venn.nvim' + use "tversteeg/registers.nvim" end, config = { display = { From 564d5213d096a00b83dae0b5c2e776117997088b Mon Sep 17 00:00:00 2001 From: luokai Date: Tue, 14 Jun 2022 22:09:25 +0800 Subject: [PATCH 0215/1278] glow --- lua/plugins/init.lua | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lua/plugins/init.lua b/lua/plugins/init.lua index 0e1bde39..76bb696d 100644 --- a/lua/plugins/init.lua +++ b/lua/plugins/init.lua @@ -140,6 +140,8 @@ require('packer').startup({ function() -- mackdown 预览插件 use { 'iamcco/markdown-preview.nvim', run = 'cd app && yarn install' } + -- mackdown cli 预览插件 + use {"ellisonleao/glow.nvim", branch = 'main'} -- 格式化插件 use 'mhartington/formatter.nvim' @@ -265,7 +267,7 @@ vim.defer_fn(function() require('plugins/config/nvim-cmp') -- require('plugins/config/LeaderF') require('plugins/config/gitsigns-nvim') - require('plugins/config/vim-floaterm') + -- require('plugins/config/vim-floaterm') require('plugins/config/asynctasks') -- require('plugins/config/feline') require('plugins/config/vista') From 5c5002ef18b0dde7c3799302e8dea89bbe311769 Mon Sep 17 00:00:00 2001 From: luokai Date: Tue, 14 Jun 2022 23:35:18 +0800 Subject: [PATCH 0216/1278] translate, symbols-outline --- lua/core/keybindings.lua | 10 +++-- lua/plugins/config/symbols-outline.lua | 53 ++++++++++++++++++++++++++ lua/plugins/config/translate.lua | 12 ++++++ lua/plugins/init.lua | 10 +++-- 4 files changed, 78 insertions(+), 7 deletions(-) create mode 100644 lua/plugins/config/symbols-outline.lua create mode 100644 lua/plugins/config/translate.lua diff --git a/lua/core/keybindings.lua b/lua/core/keybindings.lua index a35e6b44..2c794112 100644 --- a/lua/core/keybindings.lua +++ b/lua/core/keybindings.lua @@ -45,8 +45,8 @@ M.setup = function() map('n', '', ':ToggleTerm', opt) - -- vista - map('n', 'o', ':Vista!!', opt) + -- symbols-outline.nvim + map('n', 'o', ':SymbolsOutline', opt) -- trouble.nvim -- see lsp map @@ -71,8 +71,10 @@ M.setup = function() map('n', 'fr', 'Telescope asynctasks all', opt) -- translate - map('n', 't', ':TranslateW --engines=google', opt) - map('v', 't', ':TranslateW --engines=google', opt) + map('n', 'tz', ':Translate ZH -source=EN -parse_after=window -output=floating', opt) + map('v', 'tz', ':Translate ZH -source=EN -parse_after=window -output=floating', opt) + map('n', 'te', ':Translate EN -source=ZH -parse_after=window -output=floating', opt) + map('v', 'te', ':Translate EN -source=ZH -parse_after=window -output=floating', opt) -- camel_case require('core.utils').camel_case_init() diff --git a/lua/plugins/config/symbols-outline.lua b/lua/plugins/config/symbols-outline.lua new file mode 100644 index 00000000..c4013359 --- /dev/null +++ b/lua/plugins/config/symbols-outline.lua @@ -0,0 +1,53 @@ +-- init.lua +vim.g.symbols_outline = { + highlight_hovered_item = true, + show_guides = true, + auto_preview = true, + position = 'right', + relative_width = true, + width = 25, + auto_close = true, + show_numbers = false, + show_relative_numbers = false, + show_symbol_details = true, + preview_bg_highlight = 'Pmenu', + keymaps = { -- These keymaps can be a string or a table for multiple keys + close = {"", "q"}, + goto_location = "", + focus_location = "o", + hover_symbol = "", + toggle_preview = "K", + rename_symbol = "r", + code_actions = "a", + }, + lsp_blacklist = {}, + symbol_blacklist = {}, + symbols = { + File = {icon = "", hl = "TSURI"}, + Module = {icon = "", hl = "TSNamespace"}, + Namespace = {icon = "", hl = "TSNamespace"}, + Package = {icon = "", hl = "TSNamespace"}, + Class = {icon = "𝓒", hl = "TSType"}, + Method = {icon = "ƒ", hl = "TSMethod"}, + Property = {icon = "", hl = "TSMethod"}, + Field = {icon = "", hl = "TSField"}, + Constructor = {icon = "", hl = "TSConstructor"}, + Enum = {icon = "ℰ", hl = "TSType"}, + Interface = {icon = "ﰮ", hl = "TSType"}, + Function = {icon = "", hl = "TSFunction"}, + Variable = {icon = "", hl = "TSConstant"}, + Constant = {icon = "", hl = "TSConstant"}, + String = {icon = "𝓐", hl = "TSString"}, + Number = {icon = "#", hl = "TSNumber"}, + Boolean = {icon = "⊨", hl = "TSBoolean"}, + Array = {icon = "", hl = "TSConstant"}, + Object = {icon = "⦿", hl = "TSType"}, + Key = {icon = "🔐", hl = "TSType"}, + Null = {icon = "NULL", hl = "TSType"}, + EnumMember = {icon = "", hl = "TSField"}, + Struct = {icon = "𝓢", hl = "TSType"}, + Event = {icon = "🗲", hl = "TSType"}, + Operator = {icon = "+", hl = "TSOperator"}, + TypeParameter = {icon = "𝙏", hl = "TSParameter"} + } +} diff --git a/lua/plugins/config/translate.lua b/lua/plugins/config/translate.lua new file mode 100644 index 00000000..a02515bf --- /dev/null +++ b/lua/plugins/config/translate.lua @@ -0,0 +1,12 @@ +require("translate").setup({ + default = { + command = "translate_shell", + }, + preset = { + output = { + split = { + append = true, + }, + }, + }, +}) diff --git a/lua/plugins/init.lua b/lua/plugins/init.lua index 76bb696d..a688f699 100644 --- a/lua/plugins/init.lua +++ b/lua/plugins/init.lua @@ -123,7 +123,8 @@ require('packer').startup({ function() -- <>()等匹配插件 use 'andymass/vim-matchup' -- 大纲插件 - use 'liuchengxu/vista.vim' + -- use 'liuchengxu/vista.vim' + use 'simrat39/symbols-outline.nvim' -- 消息通知 use 'rcarriga/nvim-notify' @@ -186,7 +187,8 @@ require('packer').startup({ function() } -- 翻译插件 - use 'voldikss/vim-translator' + -- use 'voldikss/vim-translator' + use 'uga-rosa/translate.nvim' -- 自动对齐插件 use 'junegunn/vim-easy-align' @@ -270,7 +272,8 @@ vim.defer_fn(function() -- require('plugins/config/vim-floaterm') require('plugins/config/asynctasks') -- require('plugins/config/feline') - require('plugins/config/vista') + -- require('plugins/config/vista') + require('plugins/config/symbols-outline') -- require('plugins/config/lsp-colors') require('plugins/config/trouble') require('plugins/config/nvim-notify') @@ -285,6 +288,7 @@ vim.defer_fn(function() -- require('plugins/config/lsp_signature') require('plugins/config/nvim-dap') require('plugins/config/markdown-preview') + require('plugins/config/translate') require('plugins/config/autosave') -- require('plugins/config/nvim-neorg') vim.cmd [[ From 4102c3079f107a5e2ded4bba81d5bfb1fffee05f Mon Sep 17 00:00:00 2001 From: luokai Date: Wed, 15 Jun 2022 09:26:33 +0800 Subject: [PATCH 0217/1278] =?UTF-8?q?=E6=8F=92=E4=BB=B6=E5=88=97=E8=A1=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 2f7c8f20..f8e8a30b 100644 --- a/README.md +++ b/README.md @@ -48,7 +48,7 @@ git clone https://github.com/JavaHello/nvim.git - 搜索`class`,`method`,`field`等 ![003](https://javahello.github.io/dev/nvim-lean/images/java-symbols-003.gif) -## VIM 插件列表 +## 我的 VIM 插件列表 | 插件名称 | 插件描述 | 推荐等级 | 备注 | | ------------------------------------------------------------------ | ---------------------- | -------- | ---- | @@ -57,4 +57,9 @@ git clone https://github.com/JavaHello/nvim.git | [lualine.nvim](https://github.com/nvim-lualine/lualine.nvim) | 状态栏插件 | 8 | | | [vim-table-mode](https://github.com/dhruvasagar/vim-table-mode) | table 模式插件 | 10 | | -感谢[NvChad](https://github.com/NvChad/NvChad), 部分插件和配置参考了 `NvChad` +## Neovim 插件列表 + +- [yutkat/my-neovim-pluginlist](https://github.com/yutkat/my-neovim-pluginlist) +- [rockerBOO/awesome-neovim](https://github.com/rockerBOO/awesome-neovim) +- [Neovim 精选插件](http://neovimcraft.com/) +- 推荐[NvChad](https://github.com/NvChad/NvChad), 部分插件和配置参考了 `NvChad` From d3ccb1c9f540280ad21dbcdd27f6f57591325492 Mon Sep 17 00:00:00 2001 From: luokai Date: Wed, 15 Jun 2022 16:39:49 +0800 Subject: [PATCH 0218/1278] README --- README.md | 6 +++--- lua/plugins/config/symbols-outline.lua | 4 ++-- lua/plugins/init.lua | 1 + 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index f8e8a30b..7103dbcc 100644 --- a/README.md +++ b/README.md @@ -59,7 +59,7 @@ git clone https://github.com/JavaHello/nvim.git ## Neovim 插件列表 -- [yutkat/my-neovim-pluginlist](https://github.com/yutkat/my-neovim-pluginlist) -- [rockerBOO/awesome-neovim](https://github.com/rockerBOO/awesome-neovim) -- [Neovim 精选插件](http://neovimcraft.com/) +- Neovim 精选插件[yutkat/my-neovim-pluginlist](https://github.com/yutkat/my-neovim-pluginlist) +- Neovim 精选插件[rockerBOO/awesome-neovim](https://github.com/rockerBOO/awesome-neovim) +- Neovim 精选插件[neovimcraft](http://neovimcraft.com/) - 推荐[NvChad](https://github.com/NvChad/NvChad), 部分插件和配置参考了 `NvChad` diff --git a/lua/plugins/config/symbols-outline.lua b/lua/plugins/config/symbols-outline.lua index c4013359..bfc7ea9f 100644 --- a/lua/plugins/config/symbols-outline.lua +++ b/lua/plugins/config/symbols-outline.lua @@ -2,14 +2,14 @@ vim.g.symbols_outline = { highlight_hovered_item = true, show_guides = true, - auto_preview = true, + auto_preview = false, position = 'right', relative_width = true, width = 25, auto_close = true, show_numbers = false, show_relative_numbers = false, - show_symbol_details = true, + show_symbol_details = false, preview_bg_highlight = 'Pmenu', keymaps = { -- These keymaps can be a string or a table for multiple keys close = {"", "q"}, diff --git a/lua/plugins/init.lua b/lua/plugins/init.lua index a688f699..3cf053fa 100644 --- a/lua/plugins/init.lua +++ b/lua/plugins/init.lua @@ -22,6 +22,7 @@ require('packer').startup({ function() -- use 'hrsh7th/cmp-vsnip' -- { name = 'vsnip' } -- use 'hrsh7th/vim-vsnip' + -- 代码片段 use 'rafamadriz/friendly-snippets' -- LuaSnip use 'L3MON4D3/LuaSnip' From 32f802289b29b2a88523654b3cbbf2e595687e72 Mon Sep 17 00:00:00 2001 From: luokai Date: Wed, 15 Jun 2022 20:41:00 +0800 Subject: [PATCH 0219/1278] override config --- lua/plugins/config/symbols-outline.lua | 48 +++++++++++++------------- lua/plugins/init.lua | 2 +- 2 files changed, 25 insertions(+), 25 deletions(-) diff --git a/lua/plugins/config/symbols-outline.lua b/lua/plugins/config/symbols-outline.lua index bfc7ea9f..dfc09386 100644 --- a/lua/plugins/config/symbols-outline.lua +++ b/lua/plugins/config/symbols-outline.lua @@ -23,31 +23,31 @@ vim.g.symbols_outline = { lsp_blacklist = {}, symbol_blacklist = {}, symbols = { - File = {icon = "", hl = "TSURI"}, - Module = {icon = "", hl = "TSNamespace"}, - Namespace = {icon = "", hl = "TSNamespace"}, - Package = {icon = "", hl = "TSNamespace"}, - Class = {icon = "𝓒", hl = "TSType"}, - Method = {icon = "ƒ", hl = "TSMethod"}, - Property = {icon = "", hl = "TSMethod"}, - Field = {icon = "", hl = "TSField"}, - Constructor = {icon = "", hl = "TSConstructor"}, - Enum = {icon = "ℰ", hl = "TSType"}, - Interface = {icon = "ﰮ", hl = "TSType"}, - Function = {icon = "", hl = "TSFunction"}, - Variable = {icon = "", hl = "TSConstant"}, - Constant = {icon = "", hl = "TSConstant"}, - String = {icon = "𝓐", hl = "TSString"}, - Number = {icon = "#", hl = "TSNumber"}, - Boolean = {icon = "⊨", hl = "TSBoolean"}, + File = {icon = "", hl = "TSURI"}, + Module = {icon = "", hl = "TSNamespace"}, + Namespace = {icon = "", hl = "TSNamespace"}, + Package = {icon = "", hl = "TSNamespace"}, + Class = {icon = "ﴯ", hl = "TSType"}, + Method = {icon = "", hl = "TSMethod"}, + Property = {icon = "ﰠ", hl = "TSMethod"}, + Field = {icon = "ﰠ", hl = "TSField"}, + Constructor = {icon = "", hl = "TSConstructor"}, + Enum = {icon = "", hl = "TSType"}, + Interface = {icon = "", hl = "TSType"}, + Function = {icon = "", hl = "TSFunction"}, + Variable = {icon = "", hl = "TSConstant"}, + Constant = {icon = "", hl = "TSConstant"}, + String = {icon = "", hl = "TSString"}, + Number = {icon = "", hl = "TSNumber"}, + Boolean = {icon = "", hl = "TSBoolean"}, Array = {icon = "", hl = "TSConstant"}, - Object = {icon = "⦿", hl = "TSType"}, - Key = {icon = "🔐", hl = "TSType"}, - Null = {icon = "NULL", hl = "TSType"}, + Object = {icon = "", hl = "TSType"}, + Key = {icon = "", hl = "TSType"}, + Null = {icon = "ﳠ", hl = "TSType"}, EnumMember = {icon = "", hl = "TSField"}, - Struct = {icon = "𝓢", hl = "TSType"}, - Event = {icon = "🗲", hl = "TSType"}, - Operator = {icon = "+", hl = "TSOperator"}, - TypeParameter = {icon = "𝙏", hl = "TSParameter"} + Struct = {icon = "פּ", hl = "TSType"}, + Event = {icon = "", hl = "TSType"}, + Operator = {icon = "", hl = "TSOperator"}, + TypeParameter = {icon = "", hl = "TSParameter"} } } diff --git a/lua/plugins/init.lua b/lua/plugins/init.lua index 3cf053fa..83bc2213 100644 --- a/lua/plugins/init.lua +++ b/lua/plugins/init.lua @@ -1,3 +1,4 @@ +require('plugins/config/symbols-outline') require('packer').startup({ function() @@ -274,7 +275,6 @@ vim.defer_fn(function() require('plugins/config/asynctasks') -- require('plugins/config/feline') -- require('plugins/config/vista') - require('plugins/config/symbols-outline') -- require('plugins/config/lsp-colors') require('plugins/config/trouble') require('plugins/config/nvim-notify') From b2486e92256725961cdf4f94734bfe39b04ef6d7 Mon Sep 17 00:00:00 2001 From: luokai Date: Wed, 15 Jun 2022 21:20:50 +0800 Subject: [PATCH 0220/1278] =?UTF-8?q?=E7=BB=86=E8=8A=82=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lua/plugins/config/bufferline.lua | 28 ++++++++++++++++--------- lua/plugins/config/indent-blankline.lua | 2 +- lua/plugins/config/lualine.lua | 4 ++-- lua/plugins/config/symbols-outline.lua | 6 +++--- lua/plugins/config/vim-illuminate.lua | 2 +- 5 files changed, 25 insertions(+), 17 deletions(-) diff --git a/lua/plugins/config/bufferline.lua b/lua/plugins/config/bufferline.lua index 81c057f4..7863ab04 100644 --- a/lua/plugins/config/bufferline.lua +++ b/lua/plugins/config/bufferline.lua @@ -6,21 +6,29 @@ require("bufferline").setup { local s = " " for e, n in pairs(diagnostics_dict) do local sym = e == "error" and " " - or (e == "warning" and " " or "" ) + or (e == "warning" and " " or "") s = s .. n .. sym end return s end, -- 左侧让出 nvim-tree 的位置 - offsets = {{ - filetype = "NvimTree", - text = function() - return vim.fn.fnamemodify(vim.fn.getcwd(), ':p:h:t') - end, - padding= 1, - highlight = "Directory", - text_align = "left" - }}, + offsets = { + { + filetype = "NvimTree", + text = function() + return vim.fn.fnamemodify(vim.fn.getcwd(), ':p:h:t') + end, + padding = 1, + highlight = "Directory", + text_align = "left" + }, { + filetype = "Outline", + text = "Outline", + padding = 1, + highlight = "Directory", + text_align = "left" + }, + }, }, color_icons = true, show_buffer_close_icons = true, diff --git a/lua/plugins/config/indent-blankline.lua b/lua/plugins/config/indent-blankline.lua index 60895c71..9756592c 100644 --- a/lua/plugins/config/indent-blankline.lua +++ b/lua/plugins/config/indent-blankline.lua @@ -9,7 +9,7 @@ require("indent_blankline").setup { -- show_current_context_start = true, disable_with_nolist = true, -- filetype_exclude = { "help", "terminal", "packer", "NvimTree", "git", "text" }, - filetype_exclude = { "help", "terminal", "packer", "markdown", "git", "text", "NvimTree", "dashboard", "alpha" }, + filetype_exclude = { "help", "terminal", "packer", "markdown", "git", "text", "NvimTree", "dashboard", "alpha", "Outline" }, buftype_exclude = { "terminal" }, use_treesitter = true, context_patterns = { diff --git a/lua/plugins/config/lualine.lua b/lua/plugins/config/lualine.lua index f05efecd..45ff9b5b 100644 --- a/lua/plugins/config/lualine.lua +++ b/lua/plugins/config/lualine.lua @@ -1,10 +1,10 @@ require('lualine').setup { options = { icons_enabled = true, - theme = 'auto', + theme = 'gruvbox', component_separators = { left = '', right = ''}, section_separators = { left = '', right = ''}, - disabled_filetypes = {}, + disabled_filetypes = {'Outline'}, always_divide_middle = true, }, sections = { diff --git a/lua/plugins/config/symbols-outline.lua b/lua/plugins/config/symbols-outline.lua index dfc09386..dd51e61a 100644 --- a/lua/plugins/config/symbols-outline.lua +++ b/lua/plugins/config/symbols-outline.lua @@ -4,9 +4,9 @@ vim.g.symbols_outline = { show_guides = true, auto_preview = false, position = 'right', - relative_width = true, - width = 25, - auto_close = true, + relative_width = false, + width = 34, + auto_close = false, show_numbers = false, show_relative_numbers = false, show_symbol_details = false, diff --git a/lua/plugins/config/vim-illuminate.lua b/lua/plugins/config/vim-illuminate.lua index 301458ab..2024c5bf 100644 --- a/lua/plugins/config/vim-illuminate.lua +++ b/lua/plugins/config/vim-illuminate.lua @@ -2,5 +2,5 @@ -- 禁止高亮的文件类型 vim.g.Illuminate_ftblacklist = { "vista_kind", - "help", "terminal", "packer", "markdown", "git", "text", "NvimTree", "dashboard", "alpha" + "help", "terminal", "packer", "markdown", "git", "text", "NvimTree", "dashboard", "alpha", "Outline" } From b9adffbf9e02631b7322825ab098d12ac250d5bd Mon Sep 17 00:00:00 2001 From: luokai Date: Wed, 15 Jun 2022 21:34:30 +0800 Subject: [PATCH 0221/1278] =?UTF-8?q?=E7=BB=86=E8=8A=82=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lua/plugins/config/symbols-outline.lua | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lua/plugins/config/symbols-outline.lua b/lua/plugins/config/symbols-outline.lua index dd51e61a..ef65e582 100644 --- a/lua/plugins/config/symbols-outline.lua +++ b/lua/plugins/config/symbols-outline.lua @@ -1,6 +1,6 @@ -- init.lua vim.g.symbols_outline = { - highlight_hovered_item = true, + highlight_hovered_item = false, show_guides = true, auto_preview = false, position = 'right', @@ -9,7 +9,7 @@ vim.g.symbols_outline = { auto_close = false, show_numbers = false, show_relative_numbers = false, - show_symbol_details = false, + show_symbol_details = true, preview_bg_highlight = 'Pmenu', keymaps = { -- These keymaps can be a string or a table for multiple keys close = {"", "q"}, From a09281ea618582ff3e8bf1a045f5152badc6857c Mon Sep 17 00:00:00 2001 From: luokai Date: Wed, 15 Jun 2022 22:41:50 +0800 Subject: [PATCH 0222/1278] =?UTF-8?q?=E7=BB=86=E8=8A=82=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lua/lsp/init.lua | 1 + lua/plugins/config/aerial.lua | 242 ++++++++++++++++++++++++++++++ lua/plugins/config/bufferline.lua | 4 + lua/plugins/init.lua | 8 +- 4 files changed, 253 insertions(+), 2 deletions(-) create mode 100644 lua/plugins/config/aerial.lua diff --git a/lua/lsp/init.lua b/lua/lsp/init.lua index ff3acd61..35115e9c 100644 --- a/lua/lsp/init.lua +++ b/lua/lsp/init.lua @@ -38,6 +38,7 @@ for name, m in pairs(servers) do -- local function buf_set_option(...) vim.api.nvim_buf_set_option(bufnr, ...) end -- 绑定快捷键 require('core.keybindings').maplsp(client, bufnr) + require("aerial").on_attach(client, bufnr) if m.on_attach then m.on_attach(client, bufnr) end diff --git a/lua/plugins/config/aerial.lua b/lua/plugins/config/aerial.lua new file mode 100644 index 00000000..2ee401c0 --- /dev/null +++ b/lua/plugins/config/aerial.lua @@ -0,0 +1,242 @@ +-- Call the setup function to change the default behavior +require("aerial").setup({ + -- Priority list of preferred backends for aerial. + -- This can be a filetype map (see :help aerial-filetype-map) + backends = { "treesitter", "lsp", "markdown" }, + + -- Enum: persist, close, auto, global + -- persist - aerial window will stay open until closed + -- close - aerial window will close when original file is no longer visible + -- auto - aerial window will stay open as long as there is a visible + -- buffer to attach to + -- global - same as 'persist', and will always show symbols for the current buffer + close_behavior = "auto", + + -- Set to false to remove the default keybindings for the aerial buffer + default_bindings = true, + + -- Enum: prefer_right, prefer_left, right, left, float + -- Determines the default direction to open the aerial window. The 'prefer' + -- options will open the window in the other direction *if* there is a + -- different buffer in the way of the preferred direction + default_direction = "prefer_right", + + -- Disable aerial on files with this many lines + disable_max_lines = 10000, + + -- Disable aerial on files this size or larger (in bytes) + disable_max_size = 2000000, -- Default 2MB + + -- A list of all symbols to display. Set to false to display all symbols. + -- This can be a filetype map (see :help aerial-filetype-map) + -- To see all available values, see :help SymbolKind + filter_kind = { + "Array", + "Boolean", + "Class", + "Constant", + "Constructor", + "Enum", + "EnumMember", + "Event", + "Field", + "File", + "Function", + "Interface", + "Key", + "Method", + "Module", + "Namespace", + "Null", + "Number", + "Object", + "Operator", + "Package", + "Property", + "String", + "Struct", + "TypeParameter", + "Variable", + }, + + -- Enum: split_width, full_width, last, none + -- Determines line highlighting mode when multiple splits are visible. + -- split_width Each open window will have its cursor location marked in the + -- aerial buffer. Each line will only be partially highlighted + -- to indicate which window is at that location. + -- full_width Each open window will have its cursor location marked as a + -- full-width highlight in the aerial buffer. + -- last Only the most-recently focused window will have its location + -- marked in the aerial buffer. + -- none Do not show the cursor locations in the aerial window. + highlight_mode = "split_width", + + -- Highlight the closest symbol if the cursor is not exactly on one. + highlight_closest = true, + + -- Highlight the symbol in the source buffer when cursor is in the aerial win + highlight_on_hover = false, + + -- When jumping to a symbol, highlight the line for this many ms. + -- Set to false to disable + highlight_on_jump = 300, + + -- Define symbol icons. You can also specify "Collapsed" to change the + -- icon when the tree is collapsed at that symbol, or "Collapsed" to specify a + -- default collapsed icon. The default icon set is determined by the + -- "nerd_font" option below. + -- If you have lspkind-nvim installed, it will be the default icon set. + -- This can be a filetype map (see :help aerial-filetype-map) + icons = {}, + + -- Control which windows and buffers aerial should ignore. + -- If close_behavior is "global", focusing an ignored window/buffer will + -- not cause the aerial window to update. + -- If open_automatic is true, focusing an ignored window/buffer will not + -- cause an aerial window to open. + -- If open_automatic is a function, ignore rules have no effect on aerial + -- window opening behavior; it's entirely handled by the open_automatic + -- function. + ignore = { + -- Ignore unlisted buffers. See :help buflisted + unlisted_buffers = true, + + -- List of filetypes to ignore. + filetypes = {}, + + -- Ignored buftypes. + -- Can be one of the following: + -- false or nil - No buftypes are ignored. + -- "special" - All buffers other than normal buffers are ignored. + -- table - A list of buftypes to ignore. See :help buftype for the + -- possible values. + -- function - A function that returns true if the buffer should be + -- ignored or false if it should not be ignored. + -- Takes two arguments, `bufnr` and `buftype`. + buftypes = "special", + + -- Ignored wintypes. + -- Can be one of the following: + -- false or nil - No wintypes are ignored. + -- "special" - All windows other than normal windows are ignored. + -- table - A list of wintypes to ignore. See :help win_gettype() for the + -- possible values. + -- function - A function that returns true if the window should be + -- ignored or false if it should not be ignored. + -- Takes two arguments, `winid` and `wintype`. + wintypes = "special", + }, + + -- When you fold code with za, zo, or zc, update the aerial tree as well. + -- Only works when manage_folds = true + link_folds_to_tree = false, + + -- Fold code when you open/collapse symbols in the tree. + -- Only works when manage_folds = true + link_tree_to_folds = true, + + -- Use symbol tree for folding. Set to true or false to enable/disable + -- 'auto' will manage folds if your previous foldmethod was 'manual' + manage_folds = false, + + -- These control the width of the aerial window. + -- They can be integers or a float between 0 and 1 (e.g. 0.4 for 40%) + -- min_width and max_width can be a list of mixed types. + -- max_width = {40, 0.2} means "the lesser of 40 columns or 20% of total" + max_width = { 40, 0.2 }, + width = nil, + min_width = 32, + + -- Set default symbol icons to use patched font icons (see https://www.nerdfonts.com/) + -- "auto" will set it to true if nvim-web-devicons or lspkind-nvim is installed. + nerd_font = "true", + + -- Call this function when aerial attaches to a buffer. + -- Useful for setting keymaps. Takes a single `bufnr` argument. + on_attach = nil, + + -- Call this function when aerial first sets symbols on a buffer. + -- Takes a single `bufnr` argument. + on_first_symbols = nil, + + -- Automatically open aerial when entering supported buffers. + -- This can be a function (see :help aerial-open-automatic) + open_automatic = false, + + -- Set to true to only open aerial at the far right/left of the editor + -- Default behavior opens aerial relative to current window + placement_editor_edge = false, + + -- Run this command after jumping to a symbol (false will disable) + post_jump_cmd = "normal! zz", + + -- When true, aerial will automatically close after jumping to a symbol + close_on_select = false, + + -- Show box drawing characters for the tree hierarchy + show_guides = false, + + -- The autocmds that trigger symbols update (not used for LSP backend) + update_events = "TextChanged,InsertLeave", + + -- Customize the characters used when show_guides = true + guides = { + -- When the child item has a sibling below it + mid_item = "├─", + -- When the child item is the last in the list + last_item = "└─", + -- When there are nested child guides to the right + nested_top = "│ ", + -- Raw indentation + whitespace = " ", + }, + + -- Options for opening aerial in a floating win + float = { + -- Controls border appearance. Passed to nvim_open_win + border = "rounded", + + -- Enum: cursor, editor, win + -- cursor - Opens float on top of the cursor + -- editor - Opens float centered in the editor + -- win - Opens float centered in the window + relative = "cursor", + + -- These control the height of the floating window. + -- They can be integers or a float between 0 and 1 (e.g. 0.4 for 40%) + -- min_height and max_height can be a list of mixed types. + -- min_height = {8, 0.1} means "the greater of 8 rows or 10% of total" + max_height = 0.9, + height = nil, + min_height = { 8, 0.1 }, + + override = function(conf) + -- This is the config that will be passed to nvim_open_win. + -- Change values here to customize the layout + return conf + end, + }, + + lsp = { + -- Fetch document symbols when LSP diagnostics update. + -- If false, will update on buffer changes. + diagnostics_trigger_update = true, + + -- Set to false to not update the symbols when there are LSP errors + update_when_errors = true, + + -- How long to wait (in ms) after a buffer change before updating + -- Only used when diagnostics_trigger_update = false + update_delay = 300, + }, + + treesitter = { + -- How long to wait (in ms) after a buffer change before updating + update_delay = 300, + }, + + markdown = { + -- How long to wait (in ms) after a buffer change before updating + update_delay = 300, + }, +}) diff --git a/lua/plugins/config/bufferline.lua b/lua/plugins/config/bufferline.lua index 7863ab04..5dad6921 100644 --- a/lua/plugins/config/bufferline.lua +++ b/lua/plugins/config/bufferline.lua @@ -16,10 +16,12 @@ require("bufferline").setup { { filetype = "NvimTree", text = function() + -- return "File Explorer" return vim.fn.fnamemodify(vim.fn.getcwd(), ':p:h:t') end, padding = 1, highlight = "Directory", + -- text_align = "center" text_align = "left" }, { filetype = "Outline", @@ -35,4 +37,6 @@ require("bufferline").setup { show_buffer_default_icon = true, show_close_icon = false, show_tab_indicators = true, + -- separator_style = "slant" | "thick" | "thin" | { 'any', 'any' }, + separator_style = "slant", } diff --git a/lua/plugins/init.lua b/lua/plugins/init.lua index 83bc2213..9a8f7cee 100644 --- a/lua/plugins/init.lua +++ b/lua/plugins/init.lua @@ -69,7 +69,7 @@ require('packer').startup({ function() } -- using packer.nvim - use { 'akinsho/bufferline.nvim', requires = 'kyazdani42/nvim-web-devicons' } + use { 'akinsho/bufferline.nvim', tag = 'v2.*', requires = 'kyazdani42/nvim-web-devicons' } -- treesitter (新增) @@ -127,6 +127,9 @@ require('packer').startup({ function() -- 大纲插件 -- use 'liuchengxu/vista.vim' use 'simrat39/symbols-outline.nvim' + -- use { + -- 'stevearc/aerial.nvim', + -- } -- 消息通知 use 'rcarriga/nvim-notify' @@ -144,7 +147,7 @@ require('packer').startup({ function() -- mackdown 预览插件 use { 'iamcco/markdown-preview.nvim', run = 'cd app && yarn install' } -- mackdown cli 预览插件 - use {"ellisonleao/glow.nvim", branch = 'main'} + use { "ellisonleao/glow.nvim", branch = 'main' } -- 格式化插件 use 'mhartington/formatter.nvim' @@ -275,6 +278,7 @@ vim.defer_fn(function() require('plugins/config/asynctasks') -- require('plugins/config/feline') -- require('plugins/config/vista') + -- require('plugins/config/aerial') -- require('plugins/config/lsp-colors') require('plugins/config/trouble') require('plugins/config/nvim-notify') From fa9e6006d61c3480851f131305dede80265164c3 Mon Sep 17 00:00:00 2001 From: luokai Date: Wed, 15 Jun 2022 22:43:22 +0800 Subject: [PATCH 0223/1278] del aerial --- lua/lsp/init.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lua/lsp/init.lua b/lua/lsp/init.lua index 35115e9c..10315bd2 100644 --- a/lua/lsp/init.lua +++ b/lua/lsp/init.lua @@ -38,7 +38,7 @@ for name, m in pairs(servers) do -- local function buf_set_option(...) vim.api.nvim_buf_set_option(bufnr, ...) end -- 绑定快捷键 require('core.keybindings').maplsp(client, bufnr) - require("aerial").on_attach(client, bufnr) + -- require("aerial").on_attach(client, bufnr) if m.on_attach then m.on_attach(client, bufnr) end From cdbec334e13a2f24d0792b2911d53bdf10bb11be Mon Sep 17 00:00:00 2001 From: luokai Date: Wed, 15 Jun 2022 22:57:36 +0800 Subject: [PATCH 0224/1278] update --- lua/plugins/config/symbols-outline.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lua/plugins/config/symbols-outline.lua b/lua/plugins/config/symbols-outline.lua index ef65e582..f90e0dff 100644 --- a/lua/plugins/config/symbols-outline.lua +++ b/lua/plugins/config/symbols-outline.lua @@ -4,7 +4,7 @@ vim.g.symbols_outline = { show_guides = true, auto_preview = false, position = 'right', - relative_width = false, + relative_width = true, width = 34, auto_close = false, show_numbers = false, From 2cf467b9ef995e25fdb9db44225b29d46c490627 Mon Sep 17 00:00:00 2001 From: luokai Date: Wed, 15 Jun 2022 23:22:40 +0800 Subject: [PATCH 0225/1278] toggletasks --- lua/core/keybindings.lua | 3 ++- lua/plugins/config/telescope.lua | 2 ++ lua/plugins/config/toggletasks.lua | 8 ++++++++ lua/plugins/init.lua | 19 ++++++++++++++----- 4 files changed, 26 insertions(+), 6 deletions(-) create mode 100644 lua/plugins/config/toggletasks.lua diff --git a/lua/core/keybindings.lua b/lua/core/keybindings.lua index 2c794112..efeef76c 100644 --- a/lua/core/keybindings.lua +++ b/lua/core/keybindings.lua @@ -68,7 +68,6 @@ M.setup = function() end, opt) map('n', 'fb', 'Telescope buffers', opt) map('n', 'fh', 'Telescope help_tags', opt) - map('n', 'fr', 'Telescope asynctasks all', opt) -- translate map('n', 'tz', ':Translate ZH -source=EN -parse_after=window -output=floating', opt) @@ -149,6 +148,8 @@ map('v', 'sr', "lua require('spectre').open_visual()", opt) map('n', 'sp', "viw:lua require('spectre').open_file_search()", opt) -- run command :Spectre +-- ToggleTask +map('n', 'ts', 'Telescope toggletasks spawn', opt) -- lsp 回调函数快捷键设置 M.maplsp = function(client, bufnr) diff --git a/lua/plugins/config/telescope.lua b/lua/plugins/config/telescope.lua index 8796a498..d3f9fdb7 100644 --- a/lua/plugins/config/telescope.lua +++ b/lua/plugins/config/telescope.lua @@ -113,3 +113,5 @@ telescope.load_extension("ui-select") -- telescope.load_extension('maven_search') telescope.load_extension('env') telescope.load_extension('dap') + +telescope.load_extension('toggletasks') diff --git a/lua/plugins/config/toggletasks.lua b/lua/plugins/config/toggletasks.lua new file mode 100644 index 00000000..51956a6b --- /dev/null +++ b/lua/plugins/config/toggletasks.lua @@ -0,0 +1,8 @@ +require('toggletasks').setup { + search_paths = { + '.tasks', + '.toggletasks', + '.nvim/toggletasks', + '.nvim/tasks', + }, +} diff --git a/lua/plugins/init.lua b/lua/plugins/init.lua index 9a8f7cee..f2585982 100644 --- a/lua/plugins/init.lua +++ b/lua/plugins/init.lua @@ -100,8 +100,16 @@ require('packer').startup({ function() } -- 异步任务执行插件 - use 'skywind3000/asynctasks.vim' - use 'skywind3000/asyncrun.vim' + -- use 'skywind3000/asynctasks.vim' + -- use 'skywind3000/asyncrun.vim' + use { + 'jedrzejboczar/toggletasks.nvim', + requires = { + 'nvim-lua/plenary.nvim', + 'akinsho/toggleterm.nvim', + 'nvim-telescope/telescope.nvim/', + }, + } -- 浮动窗口插件 -- use 'voldikss/vim-floaterm' @@ -128,7 +136,7 @@ require('packer').startup({ function() -- use 'liuchengxu/vista.vim' use 'simrat39/symbols-outline.nvim' -- use { - -- 'stevearc/aerial.nvim', + -- 'stevearc/aerial.nvim', -- } -- 消息通知 @@ -177,7 +185,7 @@ require('packer').startup({ function() -- use {'nvim-telescope/telescope-fzf-native.nvim', run = 'make' } use { 'nvim-telescope/telescope-dap.nvim' } - use 'GustavoKatel/telescope-asynctasks.nvim' + -- use 'GustavoKatel/telescope-asynctasks.nvim' -- use 'aloussase/telescope-gradle.nvim' -- use 'aloussase/telescope-mvnsearch' use { "LinArcX/telescope-env.nvim" } @@ -275,7 +283,8 @@ vim.defer_fn(function() -- require('plugins/config/LeaderF') require('plugins/config/gitsigns-nvim') -- require('plugins/config/vim-floaterm') - require('plugins/config/asynctasks') + -- require('plugins/config/asynctasks') + require('plugins/config/toggletasks') -- require('plugins/config/feline') -- require('plugins/config/vista') -- require('plugins/config/aerial') From 8d9cfc200410c7788e84b27eb12ae7a871a609cc Mon Sep 17 00:00:00 2001 From: luokai Date: Thu, 16 Jun 2022 19:46:27 +0800 Subject: [PATCH 0226/1278] ff --- lua/core/keybindings.lua | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/lua/core/keybindings.lua b/lua/core/keybindings.lua index efeef76c..1931d8d5 100644 --- a/lua/core/keybindings.lua +++ b/lua/core/keybindings.lua @@ -3,6 +3,7 @@ local map = vim.api.nvim_set_keymap local opt = { noremap = true, silent = true } +local keymap = vim.keymap.set local M = {} @@ -58,9 +59,13 @@ M.setup = function() -- Telescope map('n', 'ff', 'Telescope find_files', opt) + keymap('v', 'ff', function() + local tb = require('telescope.builtin') + local text = require('core.utils').get_visual_selection() + tb.find_files({ default_text = text }) + end, opt) map('n', '', 'Telescope find_files', opt) map('n', 'fg', 'Telescope live_grep', opt) - local keymap = vim.keymap.set keymap('v', 'fg', function() local tb = require('telescope.builtin') local text = require('core.utils').get_visual_selection() @@ -181,7 +186,6 @@ M.maplsp = function(client, bufnr) -- mapbuf('n', 's', 'lua vim.lsp.buf.workspace_symbol()', opt) -- mapbuf('n', 's', 'lua require"telescope.builtin".lsp_workspace_symbols({ query = vim.fn.input("Query> ") })', opt) vim.api.nvim_buf_set_keymap(bufnr, 'n', 'sw', 'Telescope lsp_dynamic_workspace_symbols', opt) - local keymap = vim.keymap.set keymap('v', 'sw', function() local tb = require('telescope.builtin') local text = require('core.utils').get_visual_selection() From 8dd30e1bae6d73ebccb60800a635c2fc871f58a5 Mon Sep 17 00:00:00 2001 From: luokai Date: Fri, 17 Jun 2022 11:22:04 +0800 Subject: [PATCH 0227/1278] update --- README.md | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/README.md b/README.md index 7103dbcc..dd303351 100644 --- a/README.md +++ b/README.md @@ -33,6 +33,17 @@ cd $env:LOCALAPPDATA git clone https://github.com/JavaHello/nvim.git ``` +## 快捷键 + +| 功能 | 按键 | +| :------: | :---------: | +| Outline | `o` | +| 查看实现 | `gi` | +| 查看引用 | `gr` | +| 查看声明 | `gd` | +| Debug | `F5` | +| 断点 | `b` | + ## Java 配置 > 如果不使用 `Java` 语言开发,无需配置 @@ -63,3 +74,7 @@ git clone https://github.com/JavaHello/nvim.git - Neovim 精选插件[rockerBOO/awesome-neovim](https://github.com/rockerBOO/awesome-neovim) - Neovim 精选插件[neovimcraft](http://neovimcraft.com/) - 推荐[NvChad](https://github.com/NvChad/NvChad), 部分插件和配置参考了 `NvChad` + +## 欢迎使用 + +打造一个高效美观的终端环境。欢迎提供各种建议,插件推荐,快捷键定义,主题配色等。 From 48dc2d38c470ab4c18db173a15fb50cbb15db81f Mon Sep 17 00:00:00 2001 From: luokai Date: Fri, 17 Jun 2022 11:23:22 +0800 Subject: [PATCH 0228/1278] =?UTF-8?q?=E6=84=9F=E8=B0=A2=E4=BD=BF=E7=94=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index dd303351..9b24772a 100644 --- a/README.md +++ b/README.md @@ -75,6 +75,6 @@ git clone https://github.com/JavaHello/nvim.git - Neovim 精选插件[neovimcraft](http://neovimcraft.com/) - 推荐[NvChad](https://github.com/NvChad/NvChad), 部分插件和配置参考了 `NvChad` -## 欢迎使用 +## 感谢使用 打造一个高效美观的终端环境。欢迎提供各种建议,插件推荐,快捷键定义,主题配色等。 From 4c263467c8648ed55ec4fea661e1fdecc7e83458 Mon Sep 17 00:00:00 2001 From: luokai Date: Fri, 17 Jun 2022 11:45:43 +0800 Subject: [PATCH 0229/1278] =?UTF-8?q?=E6=9B=B4=E6=96=B0=E5=BF=AB=E6=8D=B7?= =?UTF-8?q?=E9=94=AE=E6=96=87=E6=A1=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 30 ++++++++++++++++++++++-------- 1 file changed, 22 insertions(+), 8 deletions(-) diff --git a/README.md b/README.md index 9b24772a..d7597225 100644 --- a/README.md +++ b/README.md @@ -35,14 +35,28 @@ git clone https://github.com/JavaHello/nvim.git ## 快捷键 -| 功能 | 按键 | -| :------: | :---------: | -| Outline | `o` | -| 查看实现 | `gi` | -| 查看引用 | `gr` | -| 查看声明 | `gd` | -| Debug | `F5` | -| 断点 | `b` | +| 功能 | 按键 | +| :------------------: | :------------------: | +| 文件管理 | `e` | +| 文件搜索 | `ff` | +| 全局搜索 | `fg` | +| 全局搜索替换 | `sr` | +| 格式化(插件提供支持) | `:Format` | +| Git 操作 | `:Git` | +| Outline | `o` | +| 查看实现 | `gi` | +| 查看引用 | `gr` | +| 查看声明 | `gd` | +| 搜索 symbols | `sw` | +| 格式化(LSP 提供支持) | `=` | +| 重命名 | `rn` | +| Code Action | `ca` | +| Debug | `F5`or`:DapContinue` | +| 断点 | `b` | +| 翻译 en->zh | `tz` | +| 翻译 zh->en | `te` | + +更多配置参考 [keybindings](./lua/core/keybindings.lua) 文件 ## Java 配置 From 9744ba5f05983784805b8a46a6c4984d04c76458 Mon Sep 17 00:00:00 2001 From: luokai Date: Fri, 17 Jun 2022 11:49:04 +0800 Subject: [PATCH 0230/1278] ToggleTerm --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index d7597225..6c30ccd1 100644 --- a/README.md +++ b/README.md @@ -55,6 +55,7 @@ git clone https://github.com/JavaHello/nvim.git | 断点 | `b` | | 翻译 en->zh | `tz` | | 翻译 zh->en | `te` | +| 内置终端 | `:ToggleTerm` | 更多配置参考 [keybindings](./lua/core/keybindings.lua) 文件 From 603f8eb13f2049aa8c37cce6a3a4f24b016212f5 Mon Sep 17 00:00:00 2001 From: luokai Date: Fri, 17 Jun 2022 11:55:13 +0800 Subject: [PATCH 0231/1278] =?UTF-8?q?=E8=A1=A5=E5=85=85=E6=8F=92=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index 6c30ccd1..9b3a4b07 100644 --- a/README.md +++ b/README.md @@ -56,6 +56,7 @@ git clone https://github.com/JavaHello/nvim.git | 翻译 en->zh | `tz` | | 翻译 zh->en | `te` | | 内置终端 | `:ToggleTerm` | +| Tasks 列表 | `ts` | 更多配置参考 [keybindings](./lua/core/keybindings.lua) 文件 @@ -76,12 +77,13 @@ git clone https://github.com/JavaHello/nvim.git ## 我的 VIM 插件列表 -| 插件名称 | 插件描述 | 推荐等级 | 备注 | -| ------------------------------------------------------------------ | ---------------------- | -------- | ---- | -| [nvim-cmp](https://github.com/hrsh7th/nvim-cmp) | LSP 代码提示插件 | 10 | | -| [telescope.nvim](https://github.com/nvim-telescope/telescope.nvim) | 模糊查找插件,窗口预览 | 8 | | -| [lualine.nvim](https://github.com/nvim-lualine/lualine.nvim) | 状态栏插件 | 8 | | -| [vim-table-mode](https://github.com/dhruvasagar/vim-table-mode) | table 模式插件 | 10 | | +| 插件名称 | 插件描述 | 推荐等级 | 备注 | +| --------------------------------------------------------------------- | ---------------------- | -------- | ---- | +| [nvim-cmp](https://github.com/hrsh7th/nvim-cmp) | LSP 代码提示插件 | 10 | | +| [telescope.nvim](https://github.com/nvim-telescope/telescope.nvim) | 模糊查找插件,窗口预览 | 10 | | +| [lualine.nvim](https://github.com/nvim-lualine/lualine.nvim) | 状态栏插件 | 8 | | +| [vim-table-mode](https://github.com/dhruvasagar/vim-table-mode) | table 模式插件 | 8 | | +| [toggletasks.nvim](https://github.com/jedrzejboczar/toggletasks.nvim) | 任务执行插件 | 8 | | ## Neovim 插件列表 From db23a29566df0dd739c760870eb8402f92f579e9 Mon Sep 17 00:00:00 2001 From: luokai Date: Fri, 17 Jun 2022 22:28:48 +0800 Subject: [PATCH 0232/1278] config --- lua/plugins/config/lualine.lua | 24 +++++++++++++----------- lua/plugins/config/nvim-dap.lua | 16 ++++++++++------ 2 files changed, 23 insertions(+), 17 deletions(-) diff --git a/lua/plugins/config/lualine.lua b/lua/plugins/config/lualine.lua index 45ff9b5b..c0c6b931 100644 --- a/lua/plugins/config/lualine.lua +++ b/lua/plugins/config/lualine.lua @@ -2,26 +2,28 @@ require('lualine').setup { options = { icons_enabled = true, theme = 'gruvbox', - component_separators = { left = '', right = ''}, - section_separators = { left = '', right = ''}, - disabled_filetypes = {'Outline'}, + component_separators = { left = '', right = '' }, + section_separators = { left = '', right = '' }, + disabled_filetypes = { 'Outline', + -- "dap-repl", "dapui_watches", "dapui_stacks", "dapui_breakpoints", "dapui_scopes" + }, always_divide_middle = true, }, sections = { - lualine_a = {'mode'}, - lualine_b = {'branch', 'diff', 'diagnostics'}, + lualine_a = { 'mode' }, + lualine_b = { 'branch', 'diff', 'diagnostics' }, -- lualine_c = {'filename', 'lsp_progress'}, - lualine_c = {'filename'}, - lualine_x = {'encoding', 'fileformat', 'filetype'}, - lualine_y = {'progress'}, - lualine_z = {'location'} + lualine_c = { 'filename' }, + lualine_x = { 'encoding', 'fileformat', 'filetype' }, + lualine_y = { 'progress' }, + lualine_z = { 'location' } }, inactive_sections = { lualine_a = {}, -- lualine_b = {function() return require('lsp-status').status() end}, lualine_b = {}, - lualine_c = {'filename'}, - lualine_x = {'location'}, + lualine_c = { 'filename' }, + lualine_x = { 'location' }, lualine_y = {}, lualine_z = {} }, diff --git a/lua/plugins/config/nvim-dap.lua b/lua/plugins/config/nvim-dap.lua index 2aa28d7e..fbecec1f 100644 --- a/lua/plugins/config/nvim-dap.lua +++ b/lua/plugins/config/nvim-dap.lua @@ -6,7 +6,8 @@ local dap = require('dap') -- args = { '-e' }; -- } -require("dapui").setup({ +local dapui = require("dapui") +dapui.setup({ icons = { expanded = "▾", collapsed = "▸" }, mappings = { -- Use a table to apply multiple mappings @@ -16,6 +17,7 @@ require("dapui").setup({ edit = "e", repl = "r", }, + expand_lines = true, sidebar = { -- You can change the order of elements in the sidebar elements = { @@ -26,14 +28,14 @@ require("dapui").setup({ }, { id = "breakpoints", size = 0.25 }, { id = "stacks", size = 0.25 }, - { id = "watches", size = 00.25 }, + { id = "watches", size = 0.25 }, }, size = 40, position = "left", -- Can be "left", "right", "top", "bottom" }, tray = { elements = { "repl" }, - size = 10, + size = 12, position = "bottom", -- Can be "left", "right", "top", "bottom" }, floating = { @@ -45,11 +47,13 @@ require("dapui").setup({ }, }, windows = { indent = 1 }, + render = { + max_type_length = nil, -- Can be integer or nil. + } }) -local dapui = require("dapui") dap.listeners.after.event_initialized["dapui_config"] = function() - --dapui.open() + dapui.open() end dap.listeners.before.event_terminated["dapui_config"] = function() dapui.close() @@ -59,7 +63,7 @@ dap.listeners.before.event_exited["dapui_config"] = function() end -- vim.fn.sign_define('DapBreakpoint', { text = '🔴', texthl = '', linehl = '', numhl = '' }) -vim.fn.sign_define('DapBreakpoint', {text='', texthl='Debug', linehl='', numhl=''}) +vim.fn.sign_define('DapBreakpoint', { text = '', texthl = 'Debug', linehl = '', numhl = '' }) -- vim.fn.sign_define("DapBreakpointCondition", { text = "C", texthl = "", linehl = "", numhl = "" }) -- vim.fn.sign_define('DapBreakpointRejected', {text='R', texthl='', linehl='', numhl=''}) -- vim.fn.sign_define('DapLogPoint', {text='L', texthl='', linehl='', numhl=''}) From 9b3fcea1312fb4c356b768f13aa140750895f9bd Mon Sep 17 00:00:00 2001 From: luokai Date: Fri, 17 Jun 2022 22:33:44 +0800 Subject: [PATCH 0233/1278] outline --- lua/plugins/config/lualine.lua | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lua/plugins/config/lualine.lua b/lua/plugins/config/lualine.lua index c0c6b931..46c0a736 100644 --- a/lua/plugins/config/lualine.lua +++ b/lua/plugins/config/lualine.lua @@ -4,7 +4,7 @@ require('lualine').setup { theme = 'gruvbox', component_separators = { left = '', right = '' }, section_separators = { left = '', right = '' }, - disabled_filetypes = { 'Outline', + disabled_filetypes = { -- "dap-repl", "dapui_watches", "dapui_stacks", "dapui_breakpoints", "dapui_scopes" }, always_divide_middle = true, @@ -28,5 +28,5 @@ require('lualine').setup { lualine_z = {} }, tabline = {}, - extensions = { 'quickfix', 'toggleterm', 'nvim-tree', 'fugitive' } + extensions = { 'quickfix', 'toggleterm', 'nvim-tree', 'fugitive', 'symbols-outline' } } From dc7fb95e76a9b2330bffc7499cb7beeeaf6ce0a2 Mon Sep 17 00:00:00 2001 From: luokai Date: Fri, 17 Jun 2022 22:39:02 +0800 Subject: [PATCH 0234/1278] lualine dap ext --- lua/plugins/config/lualine.lua | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/lua/plugins/config/lualine.lua b/lua/plugins/config/lualine.lua index 46c0a736..c569371b 100644 --- a/lua/plugins/config/lualine.lua +++ b/lua/plugins/config/lualine.lua @@ -1,10 +1,19 @@ +local dap = { + sections = { + lualine_a = { 'filename' } + }, + filetypes = { + "dap-repl", "dapui_watches", "dapui_stacks", "dapui_breakpoints", "dapui_scopes" + }, +}; + require('lualine').setup { options = { icons_enabled = true, theme = 'gruvbox', component_separators = { left = '', right = '' }, section_separators = { left = '', right = '' }, - disabled_filetypes = { + disabled_filetypes = { -- "dap-repl", "dapui_watches", "dapui_stacks", "dapui_breakpoints", "dapui_scopes" }, always_divide_middle = true, @@ -28,5 +37,5 @@ require('lualine').setup { lualine_z = {} }, tabline = {}, - extensions = { 'quickfix', 'toggleterm', 'nvim-tree', 'fugitive', 'symbols-outline' } + extensions = { 'quickfix', 'toggleterm', 'nvim-tree', 'fugitive', 'symbols-outline', dap } } From ad133eb4b77118321e9d8c20b6cb2c85229ad0f6 Mon Sep 17 00:00:00 2001 From: luokai Date: Sat, 18 Jun 2022 14:33:13 +0800 Subject: [PATCH 0235/1278] sqls --- lua/lsp/init.lua | 1 + lua/plugins/init.lua | 2 ++ 2 files changed, 3 insertions(+) diff --git a/lua/lsp/init.lua b/lua/lsp/init.lua index 10315bd2..4ba53368 100644 --- a/lua/lsp/init.lua +++ b/lua/lsp/init.lua @@ -13,6 +13,7 @@ local servers = { html = require("lsp.html"), pyright = require("lsp.pyright"), rust_analyzer = require 'lsp.rust_analyzer', + sqls = require 'lsp.sqls', } -- 自动安装 LanguageServers diff --git a/lua/plugins/init.lua b/lua/plugins/init.lua index f2585982..bb07a80d 100644 --- a/lua/plugins/init.lua +++ b/lua/plugins/init.lua @@ -259,6 +259,8 @@ require('packer').startup({ function() use 'jbyuki/venn.nvim' use "tversteeg/registers.nvim" + + use 'nanotee/sqls.nvim' end, config = { display = { From e675201864c40a72272fd9c339e5fbf105a7b2f9 Mon Sep 17 00:00:00 2001 From: luokai Date: Sat, 18 Jun 2022 17:33:44 +0800 Subject: [PATCH 0236/1278] sqls lualine --- lua/lsp/sqls.lua | 8 +++++ lua/plugins/config/lualine.lua | 56 +++++++++++++++++++++++++++------- 2 files changed, 53 insertions(+), 11 deletions(-) create mode 100644 lua/lsp/sqls.lua diff --git a/lua/lsp/sqls.lua b/lua/lsp/sqls.lua new file mode 100644 index 00000000..268b53d5 --- /dev/null +++ b/lua/lsp/sqls.lua @@ -0,0 +1,8 @@ +vim.g.sql_type_default = 'mysql' +local M = {} +M.config = { +} +M.on_attach = function(client, bufnr) + require('sqls').on_attach(client, bufnr) +end +return M; diff --git a/lua/plugins/config/lualine.lua b/lua/plugins/config/lualine.lua index c569371b..20519663 100644 --- a/lua/plugins/config/lualine.lua +++ b/lua/plugins/config/lualine.lua @@ -1,13 +1,4 @@ -local dap = { - sections = { - lualine_a = { 'filename' } - }, - filetypes = { - "dap-repl", "dapui_watches", "dapui_stacks", "dapui_breakpoints", "dapui_scopes" - }, -}; - -require('lualine').setup { +local config = { options = { icons_enabled = true, theme = 'gruvbox', @@ -37,5 +28,48 @@ require('lualine').setup { lualine_z = {} }, tabline = {}, - extensions = { 'quickfix', 'toggleterm', 'nvim-tree', 'fugitive', 'symbols-outline', dap } + extensions = { 'quickfix', 'toggleterm', 'nvim-tree', 'fugitive', 'symbols-outline' } +} + +-- nvim-dap-ui extensions +local dap = { + sections = { + lualine_a = { 'filename' } + }, + filetypes = { + "dap-repl", "dapui_watches", "dapui_stacks", "dapui_breakpoints", "dapui_scopes" + }, +}; + +table.insert(config.extensions, dap) + +-- nvim-sqls extensions +local db_connection_value +local db_database_value = '' +require("sqls.events").add_subscriber("connection_choice", function(event) + local cs = vim.split(event.choice, ' '); + db_connection_value = cs[3] + local db = vim.split(cs[4], '/') + if db[2] then + db_database_value = db[2] + end +end) +require("sqls.events").add_subscriber("database_choice", function(event) + db_database_value = event.choice +end) +local function db_info() + if db_connection_value then + return db_connection_value .. '->' .. db_database_value + end +end + +local sqls = { +} +sqls.sections = vim.deepcopy(config.sections) +table.insert(sqls.sections.lualine_c, db_info) +sqls.filetypes = { + "sql" } +table.insert(config.extensions, sqls) + +require('lualine').setup(config) From f48c6f79511184ef5406629c0b7c926cf51bbb48 Mon Sep 17 00:00:00 2001 From: luokai Date: Sat, 18 Jun 2022 17:40:24 +0800 Subject: [PATCH 0237/1278] default --- lua/plugins/config/lualine.lua | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/lua/plugins/config/lualine.lua b/lua/plugins/config/lualine.lua index 20519663..64e6c2ee 100644 --- a/lua/plugins/config/lualine.lua +++ b/lua/plugins/config/lualine.lua @@ -44,8 +44,8 @@ local dap = { table.insert(config.extensions, dap) -- nvim-sqls extensions -local db_connection_value -local db_database_value = '' +local db_connection_value = 'default' +local db_database_value = 'default' require("sqls.events").add_subscriber("connection_choice", function(event) local cs = vim.split(event.choice, ' '); db_connection_value = cs[3] @@ -58,9 +58,7 @@ require("sqls.events").add_subscriber("database_choice", function(event) db_database_value = event.choice end) local function db_info() - if db_connection_value then - return db_connection_value .. '->' .. db_database_value - end + return db_connection_value .. '->' .. db_database_value end local sqls = { From 06ffe3d60a962b0ab5927266f6c9aaad93ca60c8 Mon Sep 17 00:00:00 2001 From: luokai Date: Sat, 18 Jun 2022 17:54:10 +0800 Subject: [PATCH 0238/1278] change connection db --- lua/plugins/config/lualine.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lua/plugins/config/lualine.lua b/lua/plugins/config/lualine.lua index 64e6c2ee..56608669 100644 --- a/lua/plugins/config/lualine.lua +++ b/lua/plugins/config/lualine.lua @@ -50,7 +50,7 @@ require("sqls.events").add_subscriber("connection_choice", function(event) local cs = vim.split(event.choice, ' '); db_connection_value = cs[3] local db = vim.split(cs[4], '/') - if db[2] then + if db[2] and db_database_value == 'default' then db_database_value = db[2] end end) From 551dc2435af5969dc55b435c25c06fdec7718950 Mon Sep 17 00:00:00 2001 From: luokai Date: Sun, 19 Jun 2022 07:30:23 +0800 Subject: [PATCH 0239/1278] update dap-ui --- lua/plugins/config/lualine.lua | 2 +- lua/plugins/config/nvim-dap.lua | 66 ++++++++++++--------------------- 2 files changed, 24 insertions(+), 44 deletions(-) diff --git a/lua/plugins/config/lualine.lua b/lua/plugins/config/lualine.lua index 56608669..be1e2f2f 100644 --- a/lua/plugins/config/lualine.lua +++ b/lua/plugins/config/lualine.lua @@ -37,7 +37,7 @@ local dap = { lualine_a = { 'filename' } }, filetypes = { - "dap-repl", "dapui_watches", "dapui_stacks", "dapui_breakpoints", "dapui_scopes" + "dap-repl", "dapui_console", "dapui_watches", "dapui_stacks", "dapui_breakpoints", "dapui_scopes" }, }; diff --git a/lua/plugins/config/nvim-dap.lua b/lua/plugins/config/nvim-dap.lua index fbecec1f..47028fa6 100644 --- a/lua/plugins/config/nvim-dap.lua +++ b/lua/plugins/config/nvim-dap.lua @@ -5,52 +5,32 @@ local dap = require('dap') -- command = '/opt/homebrew/bin/alacritty'; -- args = { '-e' }; -- } - -local dapui = require("dapui") -dapui.setup({ - icons = { expanded = "▾", collapsed = "▸" }, - mappings = { - -- Use a table to apply multiple mappings - expand = { "", "<2-LeftMouse>" }, - open = "o", - remove = "d", - edit = "e", - repl = "r", - }, - expand_lines = true, - sidebar = { - -- You can change the order of elements in the sidebar - elements = { - -- Provide as ID strings or tables with "id" and "size" keys +local dapui = require('dapui') +dapui.setup( + { + layouts = { + { + elements = { + 'scopes', + 'breakpoints', + 'stacks', + 'watches', + }, + size = 40, + position = 'left', + }, { - id = "scopes", - size = 0.25, -- Can be float or integer > 1 + elements = { + 'repl', + -- 'console', + }, + size = 12, + position = 'bottom', }, - { id = "breakpoints", size = 0.25 }, - { id = "stacks", size = 0.25 }, - { id = "watches", size = 0.25 }, - }, - size = 40, - position = "left", -- Can be "left", "right", "top", "bottom" - }, - tray = { - elements = { "repl" }, - size = 12, - position = "bottom", -- Can be "left", "right", "top", "bottom" - }, - floating = { - max_height = nil, -- These can be integers or a float between 0 and 1. - max_width = nil, -- Floats will be treated as percentage of your screen. - border = "single", -- Border style. Can be "single", "double" or "rounded" - mappings = { - close = { "q", "" }, - }, - }, - windows = { indent = 1 }, - render = { - max_type_length = nil, -- Can be integer or nil. + } } -}) +) + dap.listeners.after.event_initialized["dapui_config"] = function() dapui.open() From a91163ae7d1b50c8686530351d015686a07b1ff5 Mon Sep 17 00:00:00 2001 From: luokai Date: Tue, 21 Jun 2022 21:05:47 +0800 Subject: [PATCH 0240/1278] lualine nvim-dap-ui ext --- lua/core/keybindings.lua | 2 ++ lua/plugins/config/lualine.lua | 13 +------------ lua/plugins/config/nvim-dap.lua | 1 + 3 files changed, 4 insertions(+), 12 deletions(-) diff --git a/lua/core/keybindings.lua b/lua/core/keybindings.lua index 1931d8d5..41dd7c1a 100644 --- a/lua/core/keybindings.lua +++ b/lua/core/keybindings.lua @@ -8,6 +8,8 @@ local keymap = vim.keymap.set local M = {} M.setup = function() + -- Esc + -- map('i', 'jk', '', opt) -- nvimTree map('n', 'e', ':NvimTreeToggle', opt) -- n 模式下复制内容到系统剪切板 diff --git a/lua/plugins/config/lualine.lua b/lua/plugins/config/lualine.lua index be1e2f2f..79c10be8 100644 --- a/lua/plugins/config/lualine.lua +++ b/lua/plugins/config/lualine.lua @@ -28,20 +28,9 @@ local config = { lualine_z = {} }, tabline = {}, - extensions = { 'quickfix', 'toggleterm', 'nvim-tree', 'fugitive', 'symbols-outline' } + extensions = { 'quickfix', 'toggleterm', 'nvim-tree', 'fugitive', 'symbols-outline', 'nvim-dap-ui' } } --- nvim-dap-ui extensions -local dap = { - sections = { - lualine_a = { 'filename' } - }, - filetypes = { - "dap-repl", "dapui_console", "dapui_watches", "dapui_stacks", "dapui_breakpoints", "dapui_scopes" - }, -}; - -table.insert(config.extensions, dap) -- nvim-sqls extensions local db_connection_value = 'default' diff --git a/lua/plugins/config/nvim-dap.lua b/lua/plugins/config/nvim-dap.lua index 47028fa6..58b360fb 100644 --- a/lua/plugins/config/nvim-dap.lua +++ b/lua/plugins/config/nvim-dap.lua @@ -31,6 +31,7 @@ dapui.setup( } ) +dap.defaults.fallback.terminal_win_cmd = 'belowright 12new' dap.listeners.after.event_initialized["dapui_config"] = function() dapui.open() From c3b8cdff2439658d4b9f9dedb78ef5d4d8df198a Mon Sep 17 00:00:00 2001 From: luokai Date: Tue, 21 Jun 2022 23:15:19 +0800 Subject: [PATCH 0241/1278] dap-terminal --- lua/plugins/config/lualine.lua | 11 +++++++++++ lua/plugins/config/nvim-dap.lua | 2 +- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/lua/plugins/config/lualine.lua b/lua/plugins/config/lualine.lua index 79c10be8..83d23c0a 100644 --- a/lua/plugins/config/lualine.lua +++ b/lua/plugins/config/lualine.lua @@ -31,6 +31,17 @@ local config = { extensions = { 'quickfix', 'toggleterm', 'nvim-tree', 'fugitive', 'symbols-outline', 'nvim-dap-ui' } } +local dap = { +} +dap.sections = { + lualine_a = { + { 'filename', file_status = false } + }, +} +dap.filetypes = { + "dap-terminal" +} +table.insert(config.extensions, dap) -- nvim-sqls extensions local db_connection_value = 'default' diff --git a/lua/plugins/config/nvim-dap.lua b/lua/plugins/config/nvim-dap.lua index 58b360fb..5953f617 100644 --- a/lua/plugins/config/nvim-dap.lua +++ b/lua/plugins/config/nvim-dap.lua @@ -31,7 +31,7 @@ dapui.setup( } ) -dap.defaults.fallback.terminal_win_cmd = 'belowright 12new' +dap.defaults.fallback.terminal_win_cmd = 'belowright 12new | set filetype=dap-terminal' dap.listeners.after.event_initialized["dapui_config"] = function() dapui.open() From be304f3635d11011a661f50f967933272f21ecf4 Mon Sep 17 00:00:00 2001 From: luokai Date: Thu, 23 Jun 2022 10:19:40 +0800 Subject: [PATCH 0242/1278] null-ls --- README.md | 3 +- lua/core/keybindings.lua | 16 +++++----- lua/plugins/config/null-ls.lua | 57 ++++++++++++++++++++++++++++++++++ lua/plugins/init.lua | 22 ++++++------- 4 files changed, 78 insertions(+), 20 deletions(-) create mode 100644 lua/plugins/config/null-ls.lua diff --git a/README.md b/README.md index 9b3a4b07..6ff73be2 100644 --- a/README.md +++ b/README.md @@ -40,8 +40,7 @@ git clone https://github.com/JavaHello/nvim.git | 文件管理 | `e` | | 文件搜索 | `ff` | | 全局搜索 | `fg` | -| 全局搜索替换 | `sr` | -| 格式化(插件提供支持) | `:Format` | +| 全局搜索替换 | `fr` | | Git 操作 | `:Git` | | Outline | `o` | | 查看实现 | `gi` | diff --git a/lua/core/keybindings.lua b/lua/core/keybindings.lua index 41dd7c1a..73b781ef 100644 --- a/lua/core/keybindings.lua +++ b/lua/core/keybindings.lua @@ -26,7 +26,9 @@ M.setup = function() vim.api.nvim_create_user_command("BufferCloseOther", function() require("core.utils").close_other_bufline() end, {}) - map('n', 'w', ':bdelete!', opt) + map('n', 's', ':w', opt) + map('n', 'w', ':bdelete', opt) + map('n', 'W', ':bdelete!', opt) map('n', 'q', ':q', opt) map("n", 'n', ":BufferLineCycleNext ", opt) map("n", 'p', ":BufferLineCyclePrev ", opt) @@ -149,10 +151,10 @@ map('o', 'F', "lua require'hop'.hint_char1({ direction = require'hop.hint'. -- nvim-spectre map('n', 'S', "lua require('spectre').open()", opt) -- search current word -map('n', 'sr', "lua require('spectre').open_visual({select_word=true})", opt) -map('v', 'sr', "lua require('spectre').open_visual()", opt) +map('n', 'fr', "lua require('spectre').open_visual({select_word=true})", opt) +map('v', 'fr', "lua require('spectre').open_visual()", opt) -- search in current file -map('n', 'sp', "viw:lua require('spectre').open_file_search()", opt) +map('n', 'fp', "viw:lua require('spectre').open_file_search()", opt) -- run command :Spectre -- ToggleTask @@ -187,15 +189,15 @@ M.maplsp = function(client, bufnr) -- mapbuf('n', 'gr', 'lua require"lspsaga.provider".lsp_finder()', opt) -- mapbuf('n', 's', 'lua vim.lsp.buf.workspace_symbol()', opt) -- mapbuf('n', 's', 'lua require"telescope.builtin".lsp_workspace_symbols({ query = vim.fn.input("Query> ") })', opt) - vim.api.nvim_buf_set_keymap(bufnr, 'n', 'sw', 'Telescope lsp_dynamic_workspace_symbols', opt) - keymap('v', 'sw', function() + vim.api.nvim_buf_set_keymap(bufnr, 'n', 'fw', 'Telescope lsp_dynamic_workspace_symbols', opt) + keymap('v', 'fw', function() local tb = require('telescope.builtin') local text = require('core.utils').get_visual_selection() tb.lsp_workspace_symbols({ default_text = text, query = text }) end, opt) - vim.api.nvim_buf_set_keymap(bufnr, 'n', 'sd', 'Telescope lsp_document_symbols', opt) + vim.api.nvim_buf_set_keymap(bufnr, 'n', 'fo', 'Telescope lsp_document_symbols', opt) -- diagnostic vim.api.nvim_buf_set_keymap(bufnr, 'n', 'go', 'lua vim.diagnostic.open_float()', opt) vim.api.nvim_buf_set_keymap(bufnr, 'n', '[g', 'lua vim.diagnostic.goto_prev()', opt) diff --git a/lua/plugins/config/null-ls.lua b/lua/plugins/config/null-ls.lua new file mode 100644 index 00000000..fd58d063 --- /dev/null +++ b/lua/plugins/config/null-ls.lua @@ -0,0 +1,57 @@ +local null_ls = require("null-ls") + +-- register any number of sources simultaneously +local sources = { + null_ls.builtins.formatting.prettier.with({ + filetypes = { "html", "json", "javascript", "typescript", "yaml", "markdown" }, + }), + null_ls.builtins.diagnostics.write_good.with({ + method = null_ls.methods.DIAGNOSTICS_ON_SAVE, + }), + null_ls.builtins.code_actions.gitsigns, + null_ls.builtins.formatting.sql_formatter, + -- null_ls.builtins.formatting.google_java_format, + -- null_ls.builtins.diagnostics.semgrep, + null_ls.builtins.diagnostics.semgrep.with({ + method = null_ls.methods.DIAGNOSTICS_ON_SAVE, + extra_args = { "--config", "auto" }, + }), +} + + +local lsp_formatting = function(bufnr) + vim.lsp.buf.format({ + filter = function(client) + -- apply whatever logic you want (in this example, we'll only use null-ls) + return client.name == "null-ls" + end, + bufnr = bufnr, + }) +end + +-- if you want to set up formatting on save, you can use this as a callback +local augroup = vim.api.nvim_create_augroup("LspFormatting", {}) + +-- add to your shared on_attach callback +local on_attach = function(client, bufnr) + if client.supports_method("textDocument/formatting") then + vim.api.nvim_clear_autocmds({ group = augroup, buffer = bufnr }) + vim.api.nvim_create_autocmd("BufWritePre", { + group = augroup, + buffer = bufnr, + callback = function() + lsp_formatting(bufnr) + end, + }) + end +end + + +null_ls.setup({ + sources = sources, + on_attach = function(client, bufnr) + require('core.keybindings').maplsp(client, bufnr) + on_attach(client, bufnr) + end, + -- debug = true, +}) diff --git a/lua/plugins/init.lua b/lua/plugins/init.lua index bb07a80d..dd831455 100644 --- a/lua/plugins/init.lua +++ b/lua/plugins/init.lua @@ -49,7 +49,6 @@ require('packer').startup({ function() use({ "jose-elias-alvarez/null-ls.nvim", config = function() - require("null-ls").setup() end, requires = { "nvim-lua/plenary.nvim" }, }) @@ -157,8 +156,8 @@ require('packer').startup({ function() -- mackdown cli 预览插件 use { "ellisonleao/glow.nvim", branch = 'main' } - -- 格式化插件 - use 'mhartington/formatter.nvim' + -- 格式化插件 -> 使用 null-ls + -- use 'mhartington/formatter.nvim' -- use 'sbdchd/neoformat' @@ -218,7 +217,7 @@ require('packer').startup({ function() -- rust use 'simrat39/rust-tools.nvim' - use "Pocco81/AutoSave.nvim" + -- use "Pocco81/AutoSave.nvim" use { @@ -262,11 +261,11 @@ require('packer').startup({ function() use 'nanotee/sqls.nvim' end, -config = { - display = { - open_fn = require('packer.util').float, - } -} }) + config = { + display = { + open_fn = require('packer.util').float, + } + } }) require('plugins/config/bufferline') @@ -297,7 +296,7 @@ vim.defer_fn(function() require('plugins/config/nvim-colorizer') require('plugins/config/comment') -- require('plugins/config/lspsaga') - require('plugins/config/formatter') + -- require('plugins/config/formatter') require('plugins/config/telescope') -- require('plugins/config/nvim-lsputils') require('plugins/config/nvim-autopairs') @@ -305,8 +304,9 @@ vim.defer_fn(function() require('plugins/config/nvim-dap') require('plugins/config/markdown-preview') require('plugins/config/translate') - require('plugins/config/autosave') + -- require('plugins/config/autosave') -- require('plugins/config/nvim-neorg') + require("plugins/config/null-ls") vim.cmd [[ function! s:http_rest_init() abort lua require('plugins/config/rest-nvim') From 97f1d3f9af3f01bd79a6e947673e5da2e6c15660 Mon Sep 17 00:00:00 2001 From: luokai Date: Thu, 23 Jun 2022 10:20:35 +0800 Subject: [PATCH 0243/1278] keybindings fs --- lua/core/keybindings.lua | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lua/core/keybindings.lua b/lua/core/keybindings.lua index 73b781ef..c685b7ff 100644 --- a/lua/core/keybindings.lua +++ b/lua/core/keybindings.lua @@ -189,8 +189,8 @@ M.maplsp = function(client, bufnr) -- mapbuf('n', 'gr', 'lua require"lspsaga.provider".lsp_finder()', opt) -- mapbuf('n', 's', 'lua vim.lsp.buf.workspace_symbol()', opt) -- mapbuf('n', 's', 'lua require"telescope.builtin".lsp_workspace_symbols({ query = vim.fn.input("Query> ") })', opt) - vim.api.nvim_buf_set_keymap(bufnr, 'n', 'fw', 'Telescope lsp_dynamic_workspace_symbols', opt) - keymap('v', 'fw', function() + vim.api.nvim_buf_set_keymap(bufnr, 'n', 'fs', 'Telescope lsp_dynamic_workspace_symbols', opt) + keymap('v', 'fs', function() local tb = require('telescope.builtin') local text = require('core.utils').get_visual_selection() tb.lsp_workspace_symbols({ default_text = text, query = text }) From b059b3c466dbdc939371ff456516b8b278b901d1 Mon Sep 17 00:00:00 2001 From: luokai Date: Thu, 23 Jun 2022 11:22:21 +0800 Subject: [PATCH 0244/1278] format --- lua/core/keybindings.lua | 33 ++++++++++++++++++++++++++------- lua/core/utils/init.lua | 8 ++++++++ lua/plugins/config/null-ls.lua | 2 +- 3 files changed, 35 insertions(+), 8 deletions(-) diff --git a/lua/core/keybindings.lua b/lua/core/keybindings.lua index c685b7ff..3b65ede1 100644 --- a/lua/core/keybindings.lua +++ b/lua/core/keybindings.lua @@ -136,12 +136,24 @@ end -- hop.nvim -- place this in one of your configuration file(s) -map('n', 'f', "lua require'hop'.hint_char1({ direction = require'hop.hint'.HintDirection.AFTER_CURSOR, current_line_only = true })", opt) -map('v', 'f', "lua require'hop'.hint_char1({ direction = require'hop.hint'.HintDirection.AFTER_CURSOR, current_line_only = true })", opt) -map('n', 'F', "lua require'hop'.hint_char1({ direction = require'hop.hint'.HintDirection.BEFORE_CURSOR, current_line_only = true })", opt) -map('v', 'F', "lua require'hop'.hint_char1({ direction = require'hop.hint'.HintDirection.BEFORE_CURSOR, current_line_only = true })", opt) -map('o', 'f', "lua require'hop'.hint_char1({ direction = require'hop.hint'.HintDirection.AFTER_CURSOR, current_line_only = true, inclusive_jump = true })", opt) -map('o', 'F', "lua require'hop'.hint_char1({ direction = require'hop.hint'.HintDirection.BEFORE_CURSOR, current_line_only = true, inclusive_jump = true })", opt) +map('n', 'f', + "lua require'hop'.hint_char1({ direction = require'hop.hint'.HintDirection.AFTER_CURSOR, current_line_only = true })" + , opt) +map('v', 'f', + "lua require'hop'.hint_char1({ direction = require'hop.hint'.HintDirection.AFTER_CURSOR, current_line_only = true })" + , opt) +map('n', 'F', + "lua require'hop'.hint_char1({ direction = require'hop.hint'.HintDirection.BEFORE_CURSOR, current_line_only = true })" + , opt) +map('v', 'F', + "lua require'hop'.hint_char1({ direction = require'hop.hint'.HintDirection.BEFORE_CURSOR, current_line_only = true })" + , opt) +map('o', 'f', + "lua require'hop'.hint_char1({ direction = require'hop.hint'.HintDirection.AFTER_CURSOR, current_line_only = true, inclusive_jump = true })" + , opt) +map('o', 'F', + "lua require'hop'.hint_char1({ direction = require'hop.hint'.HintDirection.BEFORE_CURSOR, current_line_only = true, inclusive_jump = true })" + , opt) -- map('', 't', "lua require'hop'.hint_char1({ direction = require'hop.hint'.HintDirection.AFTER_CURSOR, current_line_only = true })", opt) -- map('', 'T', "lua require'hop'.hint_char1({ direction = require'hop.hint'.HintDirection.BEFORE_CURSOR, current_line_only = true })", opt) -- map('n', 'e', " lua require'hop'.hint_words({ hint_position = require'hop.hint'.HintPosition.END })", opt) @@ -204,8 +216,15 @@ M.maplsp = function(client, bufnr) vim.api.nvim_buf_set_keymap(bufnr, 'n', ']g', 'lua vim.diagnostic.goto_next()', opt) -- mapbuf('n', 'q', 'lua vim.diagnostic.setloclist()', opt) -- leader + = - vim.api.nvim_buf_set_keymap(bufnr, 'n', '=', 'lua vim.lsp.buf.format()', opt) + -- vim.api.nvim_buf_set_keymap(bufnr, 'n', '=', 'lua vim.lsp.buf.format()', opt) -- vim.api.nvim_buf_set_keymap(bufnr, 'v', '=', 'lua vim.lsp.buf.range_formatting()', opt) + + keymap('n', '=', function() + vim.lsp.buf.format({ + bufnr = bufnr, + filter = require("core.utils").filter_format_lsp_client, + }) + end, opt) vim.api.nvim_buf_set_keymap(bufnr, 'v', '=', 'lua require("core.utils").format_range_operator()', opt) -- mapbuf('v', '=', 'lua vim.lsp.buf.formatting()', opt) -- mapbuf('n', '', 'lua vim.lsp.buf.signature_help()', opt) diff --git a/lua/core/utils/init.lua b/lua/core/utils/init.lua index 95caf4b7..8cb2ff53 100644 --- a/lua/core/utils/init.lua +++ b/lua/core/utils/init.lua @@ -179,6 +179,14 @@ M.format_range_operator = function() vim.api.nvim_feedkeys('g@', 'n', false) end +M.filter_format_lsp_client = function(client) + if client.name == "jdt.ls" then + return true + elseif client.name == "sumneko_lua" then + return true + end + return client.name == "null-ls" +end M.get_visual_selection = function() diff --git a/lua/plugins/config/null-ls.lua b/lua/plugins/config/null-ls.lua index fd58d063..0032a9ce 100644 --- a/lua/plugins/config/null-ls.lua +++ b/lua/plugins/config/null-ls.lua @@ -51,7 +51,7 @@ null_ls.setup({ sources = sources, on_attach = function(client, bufnr) require('core.keybindings').maplsp(client, bufnr) - on_attach(client, bufnr) + -- on_attach(client, bufnr) end, -- debug = true, }) From 55c2bfbc1cb4cb16a29b8f351d31b9faa00e056d Mon Sep 17 00:00:00 2001 From: luokai Date: Thu, 23 Jun 2022 14:39:48 +0800 Subject: [PATCH 0245/1278] markdownlint --- lua/plugins/config/null-ls.lua | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/lua/plugins/config/null-ls.lua b/lua/plugins/config/null-ls.lua index 0032a9ce..c8f6b068 100644 --- a/lua/plugins/config/null-ls.lua +++ b/lua/plugins/config/null-ls.lua @@ -8,13 +8,16 @@ local sources = { null_ls.builtins.diagnostics.write_good.with({ method = null_ls.methods.DIAGNOSTICS_ON_SAVE, }), + null_ls.builtins.diagnostics.markdownlint.with({ + method = null_ls.methods.DIAGNOSTICS_ON_SAVE, + }), null_ls.builtins.code_actions.gitsigns, null_ls.builtins.formatting.sql_formatter, -- null_ls.builtins.formatting.google_java_format, -- null_ls.builtins.diagnostics.semgrep, null_ls.builtins.diagnostics.semgrep.with({ method = null_ls.methods.DIAGNOSTICS_ON_SAVE, - extra_args = { "--config", "auto" }, + extra_args = { "--config", "p/java" }, }), } From 1616130dcecadf72f405655e201081b4ffc50708 Mon Sep 17 00:00:00 2001 From: luokai Date: Thu, 23 Jun 2022 22:01:51 +0800 Subject: [PATCH 0246/1278] =?UTF-8?q?=E6=8C=87=E5=AE=9A=E6=A0=BC=E5=BC=8F?= =?UTF-8?q?=E5=8C=96=20lsp=5Fclient?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lua/core/keybindings.lua | 4 +++- lua/core/utils/init.lua | 13 +++++++++---- 2 files changed, 12 insertions(+), 5 deletions(-) diff --git a/lua/core/keybindings.lua b/lua/core/keybindings.lua index 3b65ede1..cdf7cc02 100644 --- a/lua/core/keybindings.lua +++ b/lua/core/keybindings.lua @@ -222,7 +222,9 @@ M.maplsp = function(client, bufnr) keymap('n', '=', function() vim.lsp.buf.format({ bufnr = bufnr, - filter = require("core.utils").filter_format_lsp_client, + filter = function(c) + return require("core.utils").filter_format_lsp_client(c, bufnr) + end, }) end, opt) vim.api.nvim_buf_set_keymap(bufnr, 'v', '=', 'lua require("core.utils").format_range_operator()', opt) diff --git a/lua/core/utils/init.lua b/lua/core/utils/init.lua index 8cb2ff53..4b9f4286 100644 --- a/lua/core/utils/init.lua +++ b/lua/core/utils/init.lua @@ -179,10 +179,15 @@ M.format_range_operator = function() vim.api.nvim_feedkeys('g@', 'n', false) end -M.filter_format_lsp_client = function(client) - if client.name == "jdt.ls" then - return true - elseif client.name == "sumneko_lua" then +-- 指定格式化 lsp_client +local format_lsp_mapping = {} +format_lsp_mapping["java"] = "jdt.ls" +format_lsp_mapping["lua"] = "sumneko_lua" + +M.filter_format_lsp_client = function(client, bufnr) + local filetype = vim.api.nvim_buf_get_option(bufnr, 'filetype') + local cn = format_lsp_mapping[filetype] + if client.name == cn then return true end return client.name == "null-ls" From d8a6a41a4fb3fd272396b10c872d6072fc518f9f Mon Sep 17 00:00:00 2001 From: luokai Date: Thu, 23 Jun 2022 22:06:12 +0800 Subject: [PATCH 0247/1278] format --- lua/core/utils/init.lua | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lua/core/utils/init.lua b/lua/core/utils/init.lua index 4b9f4286..4e695b1f 100644 --- a/lua/core/utils/init.lua +++ b/lua/core/utils/init.lua @@ -183,6 +183,8 @@ end local format_lsp_mapping = {} format_lsp_mapping["java"] = "jdt.ls" format_lsp_mapping["lua"] = "sumneko_lua" +format_lsp_mapping["markdown"] = "null-ls" +format_lsp_mapping["sql"] = "null-ls" M.filter_format_lsp_client = function(client, bufnr) local filetype = vim.api.nvim_buf_get_option(bufnr, 'filetype') @@ -190,7 +192,6 @@ M.filter_format_lsp_client = function(client, bufnr) if client.name == cn then return true end - return client.name == "null-ls" end From c274f2c8c76e1eb97d36609ec853321962444918 Mon Sep 17 00:00:00 2001 From: luokai Date: Thu, 23 Jun 2022 22:39:24 +0800 Subject: [PATCH 0248/1278] filter_format_lsp_client --- lua/core/keybindings.lua | 5 +++-- lua/core/utils/init.lua | 32 ++++++++++++++++++-------------- 2 files changed, 21 insertions(+), 16 deletions(-) diff --git a/lua/core/keybindings.lua b/lua/core/keybindings.lua index cdf7cc02..b558e35d 100644 --- a/lua/core/keybindings.lua +++ b/lua/core/keybindings.lua @@ -220,10 +220,11 @@ M.maplsp = function(client, bufnr) -- vim.api.nvim_buf_set_keymap(bufnr, 'v', '=', 'lua vim.lsp.buf.range_formatting()', opt) keymap('n', '=', function() + local bfn = vim.api.nvim_get_current_buf() vim.lsp.buf.format({ - bufnr = bufnr, + bufnr = bfn, filter = function(c) - return require("core.utils").filter_format_lsp_client(c, bufnr) + return require("core.utils").filter_format_lsp_client(c, bfn) end, }) end, opt) diff --git a/lua/core/utils/init.lua b/lua/core/utils/init.lua index 4e695b1f..3eeb5ace 100644 --- a/lua/core/utils/init.lua +++ b/lua/core/utils/init.lua @@ -179,20 +179,6 @@ M.format_range_operator = function() vim.api.nvim_feedkeys('g@', 'n', false) end --- 指定格式化 lsp_client -local format_lsp_mapping = {} -format_lsp_mapping["java"] = "jdt.ls" -format_lsp_mapping["lua"] = "sumneko_lua" -format_lsp_mapping["markdown"] = "null-ls" -format_lsp_mapping["sql"] = "null-ls" - -M.filter_format_lsp_client = function(client, bufnr) - local filetype = vim.api.nvim_buf_get_option(bufnr, 'filetype') - local cn = format_lsp_mapping[filetype] - if client.name == cn then - return true - end -end M.get_visual_selection = function() @@ -209,4 +195,22 @@ M.get_visual_selection = function() end +-- 指定格式化 lsp_client +local format_lsp_mapping = {} +format_lsp_mapping["java"] = "jdt.ls" +format_lsp_mapping["lua"] = "sumneko_lua" +format_lsp_mapping["markdown"] = "null-ls" +format_lsp_mapping["sql"] = "null-ls" +format_lsp_mapping["json"] = "null-ls" +format_lsp_mapping["html"] = "null-ls" +format_lsp_mapping["xml"] = "null-ls" +format_lsp_mapping["http"] = "null-ls" +format_lsp_mapping["sh"] = "null-ls" + +M.filter_format_lsp_client = function(client, bufnr) + local filetype = vim.api.nvim_buf_get_option(bufnr, 'filetype') + local cn = format_lsp_mapping[filetype] + return client.name == cn +end + return M From acc13ef2171268298229b414b6e6dc825cb547b0 Mon Sep 17 00:00:00 2001 From: luokai Date: Thu, 23 Jun 2022 22:50:18 +0800 Subject: [PATCH 0249/1278] formatting.xmllint --- lua/plugins/config/null-ls.lua | 1 + 1 file changed, 1 insertion(+) diff --git a/lua/plugins/config/null-ls.lua b/lua/plugins/config/null-ls.lua index c8f6b068..d9113d23 100644 --- a/lua/plugins/config/null-ls.lua +++ b/lua/plugins/config/null-ls.lua @@ -5,6 +5,7 @@ local sources = { null_ls.builtins.formatting.prettier.with({ filetypes = { "html", "json", "javascript", "typescript", "yaml", "markdown" }, }), + null_ls.builtins.formatting.xmllint, null_ls.builtins.diagnostics.write_good.with({ method = null_ls.methods.DIAGNOSTICS_ON_SAVE, }), From 8ed77fc748c1e8222e371104cd8efbbe26dfba0f Mon Sep 17 00:00:00 2001 From: luokai Date: Thu, 23 Jun 2022 23:06:13 +0800 Subject: [PATCH 0250/1278] fmt --- lua/core/utils/init.lua | 23 +++++++++++++++++++++-- lua/plugins/config/null-ls.lua | 4 +++- 2 files changed, 24 insertions(+), 3 deletions(-) diff --git a/lua/core/utils/init.lua b/lua/core/utils/init.lua index 3eeb5ace..a3226668 100644 --- a/lua/core/utils/init.lua +++ b/lua/core/utils/init.lua @@ -199,11 +199,30 @@ end local format_lsp_mapping = {} format_lsp_mapping["java"] = "jdt.ls" format_lsp_mapping["lua"] = "sumneko_lua" -format_lsp_mapping["markdown"] = "null-ls" + +-- sql_formatter format_lsp_mapping["sql"] = "null-ls" -format_lsp_mapping["json"] = "null-ls" +-- prettier +format_lsp_mapping["javascript"] = "null-ls" +format_lsp_mapping["javascriptreact"] = "null-ls" +format_lsp_mapping["typescript"] = "null-ls" +format_lsp_mapping["typescriptreact"] = "null-ls" +format_lsp_mapping["vue"] = "null-ls" +format_lsp_mapping["css"] = "null-ls" +format_lsp_mapping["scss"] = "null-ls" +format_lsp_mapping["less"] = "null-ls" format_lsp_mapping["html"] = "null-ls" +format_lsp_mapping["json"] = "null-ls" +format_lsp_mapping["jsonc"] = "null-ls" +format_lsp_mapping["yaml"] = "null-ls" +format_lsp_mapping["markdown"] = "null-ls" +format_lsp_mapping["graphql"] = "null-ls" +format_lsp_mapping["handlebars"] = "null-ls" + +-- xmllint format_lsp_mapping["xml"] = "null-ls" + + format_lsp_mapping["http"] = "null-ls" format_lsp_mapping["sh"] = "null-ls" diff --git a/lua/plugins/config/null-ls.lua b/lua/plugins/config/null-ls.lua index d9113d23..0364c4bb 100644 --- a/lua/plugins/config/null-ls.lua +++ b/lua/plugins/config/null-ls.lua @@ -3,8 +3,10 @@ local null_ls = require("null-ls") -- register any number of sources simultaneously local sources = { null_ls.builtins.formatting.prettier.with({ - filetypes = { "html", "json", "javascript", "typescript", "yaml", "markdown" }, + filetypes = { "javascript", "javascriptreact", "typescript", "typescriptreact", "vue", "css", "scss", "less", "html", + "json", "jsonc", "yaml", "markdown", "graphql", "handlebars" }, }), + -- null_ls.builtins.formatting.jq, null_ls.builtins.formatting.xmllint, null_ls.builtins.diagnostics.write_good.with({ method = null_ls.methods.DIAGNOSTICS_ON_SAVE, From 851e48d0654ade9af60a53a8b483ca1a6c3b2900 Mon Sep 17 00:00:00 2001 From: luokai Date: Fri, 24 Jun 2022 09:18:53 +0800 Subject: [PATCH 0251/1278] toml,sh --- lua/core/utils/init.lua | 6 +++++- lua/plugins/config/null-ls.lua | 12 +++++++++++- 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/lua/core/utils/init.lua b/lua/core/utils/init.lua index a3226668..7f31fb33 100644 --- a/lua/core/utils/init.lua +++ b/lua/core/utils/init.lua @@ -222,10 +222,14 @@ format_lsp_mapping["handlebars"] = "null-ls" -- xmllint format_lsp_mapping["xml"] = "null-ls" +-- taplo +format_lsp_mapping["toml"] = "null-ls" -format_lsp_mapping["http"] = "null-ls" +-- shfmt format_lsp_mapping["sh"] = "null-ls" +format_lsp_mapping["http"] = "null-ls" + M.filter_format_lsp_client = function(client, bufnr) local filetype = vim.api.nvim_buf_get_option(bufnr, 'filetype') local cn = format_lsp_mapping[filetype] diff --git a/lua/plugins/config/null-ls.lua b/lua/plugins/config/null-ls.lua index 0364c4bb..2e6f1ccb 100644 --- a/lua/plugins/config/null-ls.lua +++ b/lua/plugins/config/null-ls.lua @@ -7,14 +7,24 @@ local sources = { "json", "jsonc", "yaml", "markdown", "graphql", "handlebars" }, }), -- null_ls.builtins.formatting.jq, + -- xml null_ls.builtins.formatting.xmllint, + -- toml + null_ls.builtins.formatting.taplo, + -- sh + null_ls.builtins.code_actions.shellcheck, + null_ls.builtins.diagnostics.shellcheck, + null_ls.builtins.formatting.shellharden, + -- word null_ls.builtins.diagnostics.write_good.with({ method = null_ls.methods.DIAGNOSTICS_ON_SAVE, }), + -- md null_ls.builtins.diagnostics.markdownlint.with({ method = null_ls.methods.DIAGNOSTICS_ON_SAVE, }), - null_ls.builtins.code_actions.gitsigns, + -- null_ls.builtins.code_actions.gitsigns, + -- sql null_ls.builtins.formatting.sql_formatter, -- null_ls.builtins.formatting.google_java_format, -- null_ls.builtins.diagnostics.semgrep, From 3f4800adb7a35a9a1a0e7938ae0eb23ef27c67e8 Mon Sep 17 00:00:00 2001 From: luokai Date: Fri, 24 Jun 2022 22:16:12 +0800 Subject: [PATCH 0252/1278] =?UTF-8?q?=E6=8B=86=E5=88=86=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lua/core/keybindings.lua | 4 ++-- lua/core/utils/init.lua | 52 ---------------------------------------- 2 files changed, 2 insertions(+), 54 deletions(-) diff --git a/lua/core/keybindings.lua b/lua/core/keybindings.lua index b558e35d..2cc768e6 100644 --- a/lua/core/keybindings.lua +++ b/lua/core/keybindings.lua @@ -224,11 +224,11 @@ M.maplsp = function(client, bufnr) vim.lsp.buf.format({ bufnr = bfn, filter = function(c) - return require("core.utils").filter_format_lsp_client(c, bfn) + return require("lsp.utils").filter_format_lsp_client(c, bfn) end, }) end, opt) - vim.api.nvim_buf_set_keymap(bufnr, 'v', '=', 'lua require("core.utils").format_range_operator()', opt) + vim.api.nvim_buf_set_keymap(bufnr, 'v', '=', 'lua require("lsp.utils").format_range_operator()', opt) -- mapbuf('v', '=', 'lua vim.lsp.buf.formatting()', opt) -- mapbuf('n', '', 'lua vim.lsp.buf.signature_help()', opt) -- mapbuf('n', 'wa', 'lua vim.lsp.buf.add_workspace_folder()', opt) diff --git a/lua/core/utils/init.lua b/lua/core/utils/init.lua index 7f31fb33..fd697c3e 100644 --- a/lua/core/utils/init.lua +++ b/lua/core/utils/init.lua @@ -166,18 +166,6 @@ M.camel_case_init = function() end -- print(M.camel_case("helloWorldAaAaAxC")) -M.format_range_operator = function() - local old_func = vim.go.operatorfunc - _G.op_func_formatting = function() - local start = vim.api.nvim_buf_get_mark(0, '[') - local finish = vim.api.nvim_buf_get_mark(0, ']') - vim.lsp.buf.range_formatting({}, start, finish) - vim.go.operatorfunc = old_func - _G.op_func_formatting = nil - end - vim.go.operatorfunc = 'v:lua.op_func_formatting' - vim.api.nvim_feedkeys('g@', 'n', false) -end @@ -195,45 +183,5 @@ M.get_visual_selection = function() end --- 指定格式化 lsp_client -local format_lsp_mapping = {} -format_lsp_mapping["java"] = "jdt.ls" -format_lsp_mapping["lua"] = "sumneko_lua" - --- sql_formatter -format_lsp_mapping["sql"] = "null-ls" --- prettier -format_lsp_mapping["javascript"] = "null-ls" -format_lsp_mapping["javascriptreact"] = "null-ls" -format_lsp_mapping["typescript"] = "null-ls" -format_lsp_mapping["typescriptreact"] = "null-ls" -format_lsp_mapping["vue"] = "null-ls" -format_lsp_mapping["css"] = "null-ls" -format_lsp_mapping["scss"] = "null-ls" -format_lsp_mapping["less"] = "null-ls" -format_lsp_mapping["html"] = "null-ls" -format_lsp_mapping["json"] = "null-ls" -format_lsp_mapping["jsonc"] = "null-ls" -format_lsp_mapping["yaml"] = "null-ls" -format_lsp_mapping["markdown"] = "null-ls" -format_lsp_mapping["graphql"] = "null-ls" -format_lsp_mapping["handlebars"] = "null-ls" - --- xmllint -format_lsp_mapping["xml"] = "null-ls" - --- taplo -format_lsp_mapping["toml"] = "null-ls" - --- shfmt -format_lsp_mapping["sh"] = "null-ls" - -format_lsp_mapping["http"] = "null-ls" - -M.filter_format_lsp_client = function(client, bufnr) - local filetype = vim.api.nvim_buf_get_option(bufnr, 'filetype') - local cn = format_lsp_mapping[filetype] - return client.name == cn -end return M From ed1d36e8081372b7a14010ce4f3fd78c2c9621d7 Mon Sep 17 00:00:00 2001 From: luokai Date: Fri, 24 Jun 2022 22:16:42 +0800 Subject: [PATCH 0253/1278] update --- lua/lsp/utils/init.lua | 61 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 61 insertions(+) create mode 100644 lua/lsp/utils/init.lua diff --git a/lua/lsp/utils/init.lua b/lua/lsp/utils/init.lua new file mode 100644 index 00000000..59adabee --- /dev/null +++ b/lua/lsp/utils/init.lua @@ -0,0 +1,61 @@ +local M = {} + +M.format_range_operator = function() + local old_func = vim.go.operatorfunc + _G.op_func_formatting = function() + local start = vim.api.nvim_buf_get_mark(0, '[') + local finish = vim.api.nvim_buf_get_mark(0, ']') + vim.lsp.buf.range_formatting({}, start, finish) + vim.go.operatorfunc = old_func + _G.op_func_formatting = nil + end + vim.go.operatorfunc = 'v:lua.op_func_formatting' + vim.api.nvim_feedkeys('g@', 'n', false) +end + + + + + +-- 指定格式化 lsp_client +local format_lsp_mapping = {} +format_lsp_mapping["java"] = "jdt.ls" +format_lsp_mapping["lua"] = "sumneko_lua" + +-- sql_formatter +format_lsp_mapping["sql"] = "null-ls" +-- prettier +format_lsp_mapping["javascript"] = "null-ls" +format_lsp_mapping["javascriptreact"] = "null-ls" +format_lsp_mapping["typescript"] = "null-ls" +format_lsp_mapping["typescriptreact"] = "null-ls" +format_lsp_mapping["vue"] = "null-ls" +format_lsp_mapping["css"] = "null-ls" +format_lsp_mapping["scss"] = "null-ls" +format_lsp_mapping["less"] = "null-ls" +format_lsp_mapping["html"] = "null-ls" +format_lsp_mapping["json"] = "null-ls" +format_lsp_mapping["jsonc"] = "null-ls" +format_lsp_mapping["yaml"] = "null-ls" +format_lsp_mapping["markdown"] = "null-ls" +format_lsp_mapping["graphql"] = "null-ls" +format_lsp_mapping["handlebars"] = "null-ls" + +-- xmllint +format_lsp_mapping["xml"] = "null-ls" + +-- taplo +format_lsp_mapping["toml"] = "null-ls" + +-- shfmt +format_lsp_mapping["sh"] = "null-ls" + +format_lsp_mapping["http"] = "null-ls" + +M.filter_format_lsp_client = function(client, bufnr) + local filetype = vim.api.nvim_buf_get_option(bufnr, 'filetype') + local cn = format_lsp_mapping[filetype] + return client.name == cn +end + +return M From 6aa7d6d61454a751fd85120fea79d1b0c658257b Mon Sep 17 00:00:00 2001 From: luokai Date: Sat, 25 Jun 2022 19:18:36 +0800 Subject: [PATCH 0254/1278] stylua fmt --- init.lua | 15 +- lua/core/basic.lua | 39 +- lua/core/keybindings.lua | 485 ++++++++++--------- lua/core/utils/init.lua | 279 ++++++----- lua/lsp/c.lua | 8 +- lua/lsp/html.lua | 8 +- lua/lsp/init.lua | 163 ++++--- lua/lsp/java.lua | 475 +++++++++--------- lua/lsp/jsonls.lua | 8 +- lua/lsp/lua.lua | 54 +-- lua/lsp/pyright.lua | 24 +- lua/lsp/rust_analyzer.lua | 19 +- lua/lsp/sqls.lua | 9 +- lua/lsp/tsserver.lua | 8 +- lua/lsp/utils/init.lua | 33 +- lua/plugins/config/LeaderF.lua | 6 +- lua/plugins/config/aerial.lua | 478 +++++++++--------- lua/plugins/config/alpha-nvim.lua | 29 +- lua/plugins/config/asynctasks.lua | 9 +- lua/plugins/config/autosave.lua | 32 +- lua/plugins/config/bufferline.lua | 84 ++-- lua/plugins/config/comment.lua | 2 +- lua/plugins/config/dashboard-nvim.lua | 18 +- lua/plugins/config/feline.lua | 2 +- lua/plugins/config/formatter.lua | 50 +- lua/plugins/config/gitsigns-nvim.lua | 89 ++-- lua/plugins/config/indent-blankline.lua | 50 +- lua/plugins/config/lsp-colors.lua | 8 +- lua/plugins/config/lsp_signature.lua | 16 +- lua/plugins/config/lspsaga.lua | 17 +- lua/plugins/config/lualine.lua | 98 ++-- lua/plugins/config/luasnip.lua | 51 +- lua/plugins/config/null-ls.lua | 125 ++--- lua/plugins/config/nvim-autopairs.lua | 7 +- lua/plugins/config/nvim-cmp.lua | 104 ++-- lua/plugins/config/nvim-colorizer.lua | 38 +- lua/plugins/config/nvim-dap.lua | 60 ++- lua/plugins/config/nvim-lsputils.lua | 101 ++-- lua/plugins/config/nvim-neorg.lua | 26 +- lua/plugins/config/nvim-notify.lua | 46 +- lua/plugins/config/nvim-tree.lua | 185 ++++--- lua/plugins/config/nvim-treesitter.lua | 112 +++-- lua/plugins/config/rest-nvim.lua | 40 +- lua/plugins/config/symbols-outline.lua | 100 ++-- lua/plugins/config/telescope.lua | 214 ++++---- lua/plugins/config/toggletasks.lua | 16 +- lua/plugins/config/translate.lua | 20 +- lua/plugins/config/trouble.lua | 10 +- lua/plugins/config/vim-floaterm.lua | 10 +- lua/plugins/config/vim-illuminate.lua | 13 +- lua/plugins/config/vista.lua | 5 +- lua/plugins/config/wilder.lua | 6 +- lua/plugins/init.lua | 616 ++++++++++++------------ 53 files changed, 2261 insertions(+), 2259 deletions(-) diff --git a/init.lua b/init.lua index 85551db9..c4270444 100644 --- a/init.lua +++ b/init.lua @@ -1,18 +1,17 @@ local present, impatient = pcall(require, "impatient") if present then - impatient.enable_profile() + impatient.enable_profile() end - -require('core.basic') -require('plugins') -vim.defer_fn(function () - require('lsp') +require("core.basic") +require("plugins") +vim.defer_fn(function() + require("lsp") end, 0) -- vim.api.nvim_command('colorscheme gruvbox') -vim.cmd[[ +vim.cmd([[ set background=dark " g:gruvbox_contrast_dark=hard " set background=light @@ -21,4 +20,4 @@ colorscheme gruvbox " 丢失配色, 变为透明 " highlight Normal guibg=NONE ctermbg=None " autocmd vimenter * hi Normal guibg=#282828 -]] +]]) diff --git a/lua/core/basic.lua b/lua/core/basic.lua index 8fb30329..d14d3bf6 100644 --- a/lua/core/basic.lua +++ b/lua/core/basic.lua @@ -22,30 +22,30 @@ vim.o.smartcase = true vim.g.encoding = "UTF-8" -vim.o.fileencoding= "UTF-8" +vim.o.fileencoding = "UTF-8" -- jk移动时光标下上方保留8行 vim.o.scrolloff = 3 vim.o.sidescrolloff = 3 -- 缩进配置 -vim.o.tabstop=4 -vim.bo.tabstop=4 -vim.o.softtabstop=4 +vim.o.tabstop = 4 +vim.bo.tabstop = 4 +vim.o.softtabstop = 4 -- vim.o.softround=true -- > < 时移动长度 -vim.o.shiftwidth=4 -vim.bo.shiftwidth=4 - -vim.cmd('autocmd Filetype lua setlocal ts=2 sw=2 expandtab') -vim.cmd('autocmd Filetype js setlocal ts=2 sw=2 expandtab') -vim.cmd('autocmd Filetype javascript setlocal ts=2 sw=2 expandtab') -vim.cmd('autocmd Filetype json setlocal ts=2 sw=2 expandtab') -vim.cmd('autocmd Filetype css setlocal ts=2 sw=2 expandtab') -vim.cmd('autocmd Filetype html setlocal ts=2 sw=2 expandtab') -vim.cmd('autocmd Filetype xml setlocal ts=2 sw=2 expandtab') -vim.cmd('autocmd Filetype yaml setlocal ts=2 sw=2 expandtab') -vim.cmd('autocmd Filetype http setlocal ts=2 sw=2 expandtab') -vim.cmd('autocmd Filetype markdown setlocal ts=2 sw=2 expandtab') +vim.o.shiftwidth = 4 +vim.bo.shiftwidth = 4 + +vim.cmd("autocmd Filetype lua setlocal ts=2 sw=2 expandtab") +vim.cmd("autocmd Filetype js setlocal ts=2 sw=2 expandtab") +vim.cmd("autocmd Filetype javascript setlocal ts=2 sw=2 expandtab") +vim.cmd("autocmd Filetype json setlocal ts=2 sw=2 expandtab") +vim.cmd("autocmd Filetype css setlocal ts=2 sw=2 expandtab") +vim.cmd("autocmd Filetype html setlocal ts=2 sw=2 expandtab") +vim.cmd("autocmd Filetype xml setlocal ts=2 sw=2 expandtab") +vim.cmd("autocmd Filetype yaml setlocal ts=2 sw=2 expandtab") +vim.cmd("autocmd Filetype http setlocal ts=2 sw=2 expandtab") +vim.cmd("autocmd Filetype markdown setlocal ts=2 sw=2 expandtab") -- 新行对齐当前行,空格替代tab vim.o.expandtab = true @@ -54,7 +54,6 @@ vim.o.autoindent = true vim.bo.autoindent = true vim.o.smartindent = true - -- 使用增强状态栏后不再需要 vim 的模式提示 vim.o.showmode = false @@ -84,7 +83,7 @@ vim.o.wildmenu = true vim.opt.confirm = true -- vim.g.python_host_prog='/opt/homebrew/bin/python3' -vim.g.python3_host_prog='/opt/homebrew/bin/python3' +vim.g.python3_host_prog = "/opt/homebrew/bin/python3" vim.cmd([[ " 始终显示符号列 @@ -94,7 +93,7 @@ set mouse=n if exists('g:neovide') " let g:neovide_refresh_rate=60 let g:neovide_cursor_vfx_mode = "railgun" - set guifont=DejaVuSansMono\ Nerd\ Font:h14 + set guifont=CaskaydiaCove\ Nerd\ Font\ Mono:h14 let g:neovide_transparency=1 " let g:neovide_fullscreen=v:true let g:neovide_remember_window_size = v:true diff --git a/lua/core/keybindings.lua b/lua/core/keybindings.lua index 2cc768e6..7af680d4 100644 --- a/lua/core/keybindings.lua +++ b/lua/core/keybindings.lua @@ -8,96 +8,95 @@ local keymap = vim.keymap.set local M = {} M.setup = function() - -- Esc - -- map('i', 'jk', '', opt) - -- nvimTree - map('n', 'e', ':NvimTreeToggle', opt) - -- n 模式下复制内容到系统剪切板 - map('n', 'c', '"+yy', opt) - -- v 模式下复制内容到系统剪切板 - map('v', 'c', '"+yy', opt) - -- n 模式下粘贴系统剪切板的内容 - map('n', 'v', '"+p', opt) - -- 取消搜索高亮显示 - map('n', '', ':nohlsearch', opt) - -- %bd 删除所有缓冲区, e# 打开最后一个缓冲区, bd# 关闭[No Name] - -- map('n', 'o', ':%bd|e#|bd#', opt) - -- map('n', 'o', 'lua require("core.utils").close_other_bufline()', opt) - vim.api.nvim_create_user_command("BufferCloseOther", function() - require("core.utils").close_other_bufline() - end, {}) - map('n', 's', ':w', opt) - map('n', 'w', ':bdelete', opt) - map('n', 'W', ':bdelete!', opt) - map('n', 'q', ':q', opt) - map("n", 'n', ":BufferLineCycleNext ", opt) - map("n", 'p', ":BufferLineCyclePrev ", opt) - - -- " 退出 terminal 模式 - map('t', '', '', opt) - map('t', 'jk', '', opt) - - -- Leaderf - -- vim.g.Lf_ShortcutF = '' - -- map('n', '', ':=printf("Leaderf! rg -e %s ", expand(""))', {}) - -- map('v', '', ':=printf("Leaderf! rg -e %s ", leaderf#Rg#visual())', {}) - -- map('n', 'r', ':Leaderf --nowrap task', {}) - - -- vim-floaterm - -- vim.g.floaterm_keymap_new = 'ft' - -- map('n', '', ':FloatermToggle', opt) - -- map('t', ' ', '::FloatermToggle', opt) - map('n', '', ':ToggleTerm', opt) - - - -- symbols-outline.nvim - map('n', 'o', ':SymbolsOutline', opt) - - -- trouble.nvim - -- see lsp map - -- map('n', 'x', 'Trouble', opt) - - -- lspsaga - -- map('n', 'K', ':Lspsaga hover_doc', opt) - -- map('n', 'gr', ':Lspsaga lsp_finder', opt) - - -- Telescope - map('n', 'ff', 'Telescope find_files', opt) - keymap('v', 'ff', function() - local tb = require('telescope.builtin') - local text = require('core.utils').get_visual_selection() - tb.find_files({ default_text = text }) - end, opt) - map('n', '', 'Telescope find_files', opt) - map('n', 'fg', 'Telescope live_grep', opt) - keymap('v', 'fg', function() - local tb = require('telescope.builtin') - local text = require('core.utils').get_visual_selection() - tb.live_grep({ default_text = text }) - end, opt) - map('n', 'fb', 'Telescope buffers', opt) - map('n', 'fh', 'Telescope help_tags', opt) - - -- translate - map('n', 'tz', ':Translate ZH -source=EN -parse_after=window -output=floating', opt) - map('v', 'tz', ':Translate ZH -source=EN -parse_after=window -output=floating', opt) - map('n', 'te', ':Translate EN -source=ZH -parse_after=window -output=floating', opt) - map('v', 'te', ':Translate EN -source=ZH -parse_after=window -output=floating', opt) - - -- camel_case - require('core.utils').camel_case_init() - - -- vim-easy-align - vim.cmd([[ + -- Esc + -- map('i', 'jk', '', opt) + -- nvimTree + map("n", "e", ":NvimTreeToggle", opt) + -- n 模式下复制内容到系统剪切板 + map("n", "c", '"+yy', opt) + -- v 模式下复制内容到系统剪切板 + map("v", "c", '"+yy', opt) + -- n 模式下粘贴系统剪切板的内容 + map("n", "v", '"+p', opt) + -- 取消搜索高亮显示 + map("n", "", ":nohlsearch", opt) + -- %bd 删除所有缓冲区, e# 打开最后一个缓冲区, bd# 关闭[No Name] + -- map('n', 'o', ':%bd|e#|bd#', opt) + -- map('n', 'o', 'lua require("core.utils").close_other_bufline()', opt) + vim.api.nvim_create_user_command("BufferCloseOther", function() + require("core.utils").close_other_bufline() + end, {}) + map("n", "s", ":w", opt) + map("n", "w", ":bdelete", opt) + map("n", "W", ":bdelete!", opt) + map("n", "q", ":q", opt) + map("n", "n", ":BufferLineCycleNext ", opt) + map("n", "p", ":BufferLineCyclePrev ", opt) + + -- " 退出 terminal 模式 + map("t", "", "", opt) + map("t", "jk", "", opt) + + -- Leaderf + -- vim.g.Lf_ShortcutF = '' + -- map('n', '', ':=printf("Leaderf! rg -e %s ", expand(""))', {}) + -- map('v', '', ':=printf("Leaderf! rg -e %s ", leaderf#Rg#visual())', {}) + -- map('n', 'r', ':Leaderf --nowrap task', {}) + + -- vim-floaterm + -- vim.g.floaterm_keymap_new = 'ft' + -- map('n', '', ':FloatermToggle', opt) + -- map('t', ' ', '::FloatermToggle', opt) + map("n", "", ":ToggleTerm", opt) + + -- symbols-outline.nvim + map("n", "o", ":SymbolsOutline", opt) + + -- trouble.nvim + -- see lsp map + -- map('n', 'x', 'Trouble', opt) + + -- lspsaga + -- map('n', 'K', ':Lspsaga hover_doc', opt) + -- map('n', 'gr', ':Lspsaga lsp_finder', opt) + + -- Telescope + map("n", "ff", "Telescope find_files", opt) + keymap("v", "ff", function() + local tb = require("telescope.builtin") + local text = require("core.utils").get_visual_selection() + tb.find_files({ default_text = text }) + end, opt) + map("n", "", "Telescope find_files", opt) + map("n", "fg", "Telescope live_grep", opt) + keymap("v", "fg", function() + local tb = require("telescope.builtin") + local text = require("core.utils").get_visual_selection() + tb.live_grep({ default_text = text }) + end, opt) + map("n", "fb", "Telescope buffers", opt) + map("n", "fh", "Telescope help_tags", opt) + + -- translate + map("n", "tz", ":Translate ZH -source=EN -parse_after=window -output=floating", opt) + map("v", "tz", ":Translate ZH -source=EN -parse_after=window -output=floating", opt) + map("n", "te", ":Translate EN -source=ZH -parse_after=window -output=floating", opt) + map("v", "te", ":Translate EN -source=ZH -parse_after=window -output=floating", opt) + + -- camel_case + require("core.utils").camel_case_init() + + -- vim-easy-align + vim.cmd([[ " Start interactive EasyAlign in visual mode (e.g. vipga) xmap ga (EasyAlign) " Start interactive EasyAlign for a motion/text object (e.g. gaip) nmap ga (EasyAlign) -]] ) +]]) - -- nvim-dap - vim.cmd([[ + -- nvim-dap + vim.cmd([[ nnoremap :lua require'dap'.continue() nnoremap :lua require'dap'.step_over() nnoremap :lua require'dap'.step_into() @@ -107,15 +106,15 @@ nnoremap B :lua require'dap'.set_breakpoint(vim.fn.input('Break nnoremap lp :lua require'dap'.set_breakpoint(nil, nil, vim.fn.input('Log point message: ')) nnoremap dr :lua require'dap'.repl.open() nnoremap dl :lua require'dap'.run_last() -]] ) +]]) - -- nvim-dap-ui - vim.cmd([[ + -- nvim-dap-ui + vim.cmd([[ nnoremap dr :lua require("dapui").float_element(vim.Nil, { enter = true}) -]] ) +]]) - -- bufferline.nvim - vim.cmd [[ + -- bufferline.nvim + vim.cmd([[ nnoremap 1 BufferLineGoToBuffer 1 nnoremap 2 BufferLineGoToBuffer 2 nnoremap 3 BufferLineGoToBuffer 3 @@ -130,30 +129,47 @@ nnoremap h nnoremap j nnoremap k nnoremap l -]] - +]]) end -- hop.nvim -- place this in one of your configuration file(s) -map('n', 'f', - "lua require'hop'.hint_char1({ direction = require'hop.hint'.HintDirection.AFTER_CURSOR, current_line_only = true })" - , opt) -map('v', 'f', - "lua require'hop'.hint_char1({ direction = require'hop.hint'.HintDirection.AFTER_CURSOR, current_line_only = true })" - , opt) -map('n', 'F', - "lua require'hop'.hint_char1({ direction = require'hop.hint'.HintDirection.BEFORE_CURSOR, current_line_only = true })" - , opt) -map('v', 'F', - "lua require'hop'.hint_char1({ direction = require'hop.hint'.HintDirection.BEFORE_CURSOR, current_line_only = true })" - , opt) -map('o', 'f', - "lua require'hop'.hint_char1({ direction = require'hop.hint'.HintDirection.AFTER_CURSOR, current_line_only = true, inclusive_jump = true })" - , opt) -map('o', 'F', - "lua require'hop'.hint_char1({ direction = require'hop.hint'.HintDirection.BEFORE_CURSOR, current_line_only = true, inclusive_jump = true })" - , opt) +map( + "n", + "f", + "lua require'hop'.hint_char1({ direction = require'hop.hint'.HintDirection.AFTER_CURSOR, current_line_only = true })", + opt +) +map( + "v", + "f", + "lua require'hop'.hint_char1({ direction = require'hop.hint'.HintDirection.AFTER_CURSOR, current_line_only = true })", + opt +) +map( + "n", + "F", + "lua require'hop'.hint_char1({ direction = require'hop.hint'.HintDirection.BEFORE_CURSOR, current_line_only = true })", + opt +) +map( + "v", + "F", + "lua require'hop'.hint_char1({ direction = require'hop.hint'.HintDirection.BEFORE_CURSOR, current_line_only = true })", + opt +) +map( + "o", + "f", + "lua require'hop'.hint_char1({ direction = require'hop.hint'.HintDirection.AFTER_CURSOR, current_line_only = true, inclusive_jump = true })", + opt +) +map( + "o", + "F", + "lua require'hop'.hint_char1({ direction = require'hop.hint'.HintDirection.BEFORE_CURSOR, current_line_only = true, inclusive_jump = true })", + opt +) -- map('', 't', "lua require'hop'.hint_char1({ direction = require'hop.hint'.HintDirection.AFTER_CURSOR, current_line_only = true })", opt) -- map('', 'T', "lua require'hop'.hint_char1({ direction = require'hop.hint'.HintDirection.BEFORE_CURSOR, current_line_only = true })", opt) -- map('n', 'e', " lua require'hop'.hint_words({ hint_position = require'hop.hint'.HintPosition.END })", opt) @@ -161,146 +177,149 @@ map('o', 'F', -- map('o', 'e', " lua require'hop'.hint_words({ hint_position = require'hop.hint'.HintPosition.END, inclusive_jump = true })", opt) -- nvim-spectre -map('n', 'S', "lua require('spectre').open()", opt) +map("n", "S", "lua require('spectre').open()", opt) -- search current word -map('n', 'fr', "lua require('spectre').open_visual({select_word=true})", opt) -map('v', 'fr', "lua require('spectre').open_visual()", opt) +map("n", "fr", "lua require('spectre').open_visual({select_word=true})", opt) +map("v", "fr", "lua require('spectre').open_visual()", opt) -- search in current file -map('n', 'fp', "viw:lua require('spectre').open_file_search()", opt) +map("n", "fp", "viw:lua require('spectre').open_file_search()", opt) -- run command :Spectre -- ToggleTask -map('n', 'ts', 'Telescope toggletasks spawn', opt) +map("n", "ts", "Telescope toggletasks spawn", opt) -- lsp 回调函数快捷键设置 M.maplsp = function(client, bufnr) - - vim.api.nvim_buf_set_option(bufnr, 'omnifunc', 'v:lua.vim.lsp.omnifunc') - vim.api.nvim_buf_set_option(bufnr, 'formatexpr', 'v:lua.vim.lsp.formatexpr()') - - vim.api.nvim_buf_set_keymap(bufnr, 'n', 'K', 'lua vim.lsp.buf.hover()', opt) - -- rename - vim.api.nvim_buf_set_keymap(bufnr, 'n', 'rn', 'lua vim.lsp.buf.rename()', opt) - -- mapbuf('n', 'rn', 'lua require("lspsaga.rename").rename()', opt) - -- code action - vim.api.nvim_buf_set_keymap(bufnr, 'n', 'ca', 'lua vim.lsp.buf.code_action()', opt) - -- mapbuf('n', 'ca', 'lua require("lspsaga.codeaction").code_action()', opt) - -- go xx - -- mapbuf('n', 'gd', 'lua vim.lsp.buf.definition()', opt) - -- vim.api.nvim_buf_set_keymap(bufnr, 'n', 'gd', 'Trouble lsp_definitions', opt) - vim.api.nvim_buf_set_keymap(bufnr, 'n', 'gd', 'Telescope lsp_definitions', opt) - vim.api.nvim_buf_set_keymap(bufnr, 'n', 'gh', 'lua vim.lsp.buf.hover()', opt) - -- mapbuf('n', 'gD', 'lua vim.lsp.buf.declaration()', opt) - -- mapbuf('n', 'gD', 'lua vim.lsp.buf.type_definition()', opt) - vim.api.nvim_buf_set_keymap(bufnr, 'n', 'gD', 'Trouble lsp_type_definitions', opt) - -- mapbuf('n', 'gi', 'lua vim.lsp.buf.implementation()', opt) - vim.api.nvim_buf_set_keymap(bufnr, 'n', 'gi', 'Trouble lsp_implementations', opt) - vim.api.nvim_buf_set_keymap(bufnr, 'n', 'gi', 'Telescope lsp_implementations', opt) - -- mapbuf('n', 'gr', 'lua vim.lsp.buf.references()', opt) - vim.api.nvim_buf_set_keymap(bufnr, 'n', 'gr', 'Trouble lsp_references', opt) - vim.api.nvim_buf_set_keymap(bufnr, 'n', 'gr', 'Telescope lsp_references', opt) - -- mapbuf('n', 'gr', 'lua require"lspsaga.provider".lsp_finder()', opt) - -- mapbuf('n', 's', 'lua vim.lsp.buf.workspace_symbol()', opt) - -- mapbuf('n', 's', 'lua require"telescope.builtin".lsp_workspace_symbols({ query = vim.fn.input("Query> ") })', opt) - vim.api.nvim_buf_set_keymap(bufnr, 'n', 'fs', 'Telescope lsp_dynamic_workspace_symbols', opt) - keymap('v', 'fs', function() - local tb = require('telescope.builtin') - local text = require('core.utils').get_visual_selection() - tb.lsp_workspace_symbols({ default_text = text, query = text }) - end, opt) - - - vim.api.nvim_buf_set_keymap(bufnr, 'n', 'fo', 'Telescope lsp_document_symbols', opt) - -- diagnostic - vim.api.nvim_buf_set_keymap(bufnr, 'n', 'go', 'lua vim.diagnostic.open_float()', opt) - vim.api.nvim_buf_set_keymap(bufnr, 'n', '[g', 'lua vim.diagnostic.goto_prev()', opt) - vim.api.nvim_buf_set_keymap(bufnr, 'n', ']g', 'lua vim.diagnostic.goto_next()', opt) - -- mapbuf('n', 'q', 'lua vim.diagnostic.setloclist()', opt) - -- leader + = - -- vim.api.nvim_buf_set_keymap(bufnr, 'n', '=', 'lua vim.lsp.buf.format()', opt) - -- vim.api.nvim_buf_set_keymap(bufnr, 'v', '=', 'lua vim.lsp.buf.range_formatting()', opt) - - keymap('n', '=', function() - local bfn = vim.api.nvim_get_current_buf() - vim.lsp.buf.format({ - bufnr = bfn, - filter = function(c) - return require("lsp.utils").filter_format_lsp_client(c, bfn) - end, - }) - end, opt) - vim.api.nvim_buf_set_keymap(bufnr, 'v', '=', 'lua require("lsp.utils").format_range_operator()', opt) - -- mapbuf('v', '=', 'lua vim.lsp.buf.formatting()', opt) - -- mapbuf('n', '', 'lua vim.lsp.buf.signature_help()', opt) - -- mapbuf('n', 'wa', 'lua vim.lsp.buf.add_workspace_folder()', opt) - -- mapbuf('n', 'wr', 'lua vim.lsp.buf.remove_workspace_folder()', opt) - -- mapbuf('n', 'wl', 'lua print(vim.inspect(vim.lsp.buf.list_workspace_folders()))', opt) - -- mapbuf('n', 'D', 'lua vim.lsp.buf.type_definition()', opt) - vim.api.nvim_buf_set_keymap(bufnr, 'n', 'xx', 'Trouble', opt) - vim.api.nvim_buf_set_keymap(bufnr, 'n', 'xw', 'Trouble workspace_diagnostics', opt) - vim.api.nvim_buf_set_keymap(bufnr, 'n', 'xd', 'Trouble document_diagnostics', opt) - vim.api.nvim_buf_set_keymap(bufnr, 'n', 'xq', 'Trouble quickfix', opt) + vim.api.nvim_buf_set_option(bufnr, "omnifunc", "v:lua.vim.lsp.omnifunc") + vim.api.nvim_buf_set_option(bufnr, "formatexpr", "v:lua.vim.lsp.formatexpr()") + + vim.api.nvim_buf_set_keymap(bufnr, "n", "K", "lua vim.lsp.buf.hover()", opt) + -- rename + vim.api.nvim_buf_set_keymap(bufnr, "n", "rn", "lua vim.lsp.buf.rename()", opt) + -- mapbuf('n', 'rn', 'lua require("lspsaga.rename").rename()', opt) + -- code action + vim.api.nvim_buf_set_keymap(bufnr, "n", "ca", "lua vim.lsp.buf.code_action()", opt) + -- mapbuf('n', 'ca', 'lua require("lspsaga.codeaction").code_action()', opt) + -- go xx + -- mapbuf('n', 'gd', 'lua vim.lsp.buf.definition()', opt) + -- vim.api.nvim_buf_set_keymap(bufnr, 'n', 'gd', 'Trouble lsp_definitions', opt) + vim.api.nvim_buf_set_keymap(bufnr, "n", "gd", "Telescope lsp_definitions", opt) + vim.api.nvim_buf_set_keymap(bufnr, "n", "gh", "lua vim.lsp.buf.hover()", opt) + -- mapbuf('n', 'gD', 'lua vim.lsp.buf.declaration()', opt) + -- mapbuf('n', 'gD', 'lua vim.lsp.buf.type_definition()', opt) + vim.api.nvim_buf_set_keymap(bufnr, "n", "gD", "Trouble lsp_type_definitions", opt) + -- mapbuf('n', 'gi', 'lua vim.lsp.buf.implementation()', opt) + vim.api.nvim_buf_set_keymap(bufnr, "n", "gi", "Trouble lsp_implementations", opt) + vim.api.nvim_buf_set_keymap(bufnr, "n", "gi", "Telescope lsp_implementations", opt) + -- mapbuf('n', 'gr', 'lua vim.lsp.buf.references()', opt) + vim.api.nvim_buf_set_keymap(bufnr, "n", "gr", "Trouble lsp_references", opt) + vim.api.nvim_buf_set_keymap(bufnr, "n", "gr", "Telescope lsp_references", opt) + -- mapbuf('n', 'gr', 'lua require"lspsaga.provider".lsp_finder()', opt) + -- mapbuf('n', 's', 'lua vim.lsp.buf.workspace_symbol()', opt) + -- mapbuf('n', 's', 'lua require"telescope.builtin".lsp_workspace_symbols({ query = vim.fn.input("Query> ") })', opt) + vim.api.nvim_buf_set_keymap(bufnr, "n", "fs", "Telescope lsp_dynamic_workspace_symbols", opt) + keymap("v", "fs", function() + local tb = require("telescope.builtin") + local text = require("core.utils").get_visual_selection() + tb.lsp_workspace_symbols({ default_text = text, query = text }) + end, opt) + + vim.api.nvim_buf_set_keymap(bufnr, "n", "fo", "Telescope lsp_document_symbols", opt) + -- diagnostic + vim.api.nvim_buf_set_keymap(bufnr, "n", "go", "lua vim.diagnostic.open_float()", opt) + vim.api.nvim_buf_set_keymap(bufnr, "n", "[g", "lua vim.diagnostic.goto_prev()", opt) + vim.api.nvim_buf_set_keymap(bufnr, "n", "]g", "lua vim.diagnostic.goto_next()", opt) + -- mapbuf('n', 'q', 'lua vim.diagnostic.setloclist()', opt) + -- leader + = + -- vim.api.nvim_buf_set_keymap(bufnr, 'n', '=', 'lua vim.lsp.buf.format()', opt) + -- vim.api.nvim_buf_set_keymap(bufnr, 'v', '=', 'lua vim.lsp.buf.range_formatting()', opt) + + keymap("n", "=", function() + local bfn = vim.api.nvim_get_current_buf() + vim.lsp.buf.format({ + bufnr = bfn, + filter = function(c) + return require("lsp.utils").filter_format_lsp_client(c, bfn) + end, + }) + end, opt) + vim.api.nvim_buf_set_keymap( + bufnr, + "v", + "=", + 'lua require("lsp.utils").format_range_operator()', + opt + ) + -- mapbuf('v', '=', 'lua vim.lsp.buf.formatting()', opt) + -- mapbuf('n', '', 'lua vim.lsp.buf.signature_help()', opt) + -- mapbuf('n', 'wa', 'lua vim.lsp.buf.add_workspace_folder()', opt) + -- mapbuf('n', 'wr', 'lua vim.lsp.buf.remove_workspace_folder()', opt) + -- mapbuf('n', 'wl', 'lua print(vim.inspect(vim.lsp.buf.list_workspace_folders()))', opt) + -- mapbuf('n', 'D', 'lua vim.lsp.buf.type_definition()', opt) + vim.api.nvim_buf_set_keymap(bufnr, "n", "xx", "Trouble", opt) + vim.api.nvim_buf_set_keymap(bufnr, "n", "xw", "Trouble workspace_diagnostics", opt) + vim.api.nvim_buf_set_keymap(bufnr, "n", "xd", "Trouble document_diagnostics", opt) + vim.api.nvim_buf_set_keymap(bufnr, "n", "xq", "Trouble quickfix", opt) end -- nvim-cmp 自动补全 M.cmp = function(cmp) - - local luasnip = require('luasnip'); - local has_words_before = function() - local line, col = unpack(vim.api.nvim_win_get_cursor(0)) - return col ~= 0 and vim.api.nvim_buf_get_lines(0, line - 1, line, true)[1]:sub(col, col):match("%s") == nil - end - return { - -- 上一个 - -- [''] = cmp.mapping.select_prev_item(), - -- 下一个 - -- [''] = cmp.mapping.select_next_item(), - -- [""] = cmp.mapping.select_prev_item(), - -- [''] = cmp.mapping.close(), - -- 确认 - -- Accept currently selected item. If none selected, `select` first item. - -- Set `select` to `false` to only confirm explicitly selected items. - -- [""] = cmp.mapping.scroll_docs(-4), - -- [""] = cmp.mapping.scroll_docs(4), - [""] = cmp.mapping.select_prev_item(), - [""] = cmp.mapping.select_next_item(), - [""] = cmp.mapping.complete(), - [""] = cmp.mapping.close(), - [""] = cmp.mapping.confirm { - behavior = cmp.ConfirmBehavior.Replace, - -- select = true, - }, - - [""] = cmp.mapping(function(fallback) - if cmp.visible() then - cmp.select_next_item() - elseif luasnip.expand_or_jumpable() then - luasnip.expand_or_jump() - elseif has_words_before() then - cmp.complete() - else - fallback() - end - end, { "i", "s" }), - - [""] = cmp.mapping(function(fallback) - if cmp.visible() then - cmp.select_prev_item() - elseif luasnip.jumpable(-1) then - luasnip.jump(-1) - else - fallback() - end - end, { "i", "s" }), - } + local luasnip = require("luasnip") + local has_words_before = function() + local line, col = unpack(vim.api.nvim_win_get_cursor(0)) + return col ~= 0 and vim.api.nvim_buf_get_lines(0, line - 1, line, true)[1]:sub(col, col):match("%s") == nil + end + return { + -- 上一个 + -- [''] = cmp.mapping.select_prev_item(), + -- 下一个 + -- [''] = cmp.mapping.select_next_item(), + -- [""] = cmp.mapping.select_prev_item(), + -- [''] = cmp.mapping.close(), + -- 确认 + -- Accept currently selected item. If none selected, `select` first item. + -- Set `select` to `false` to only confirm explicitly selected items. + -- [""] = cmp.mapping.scroll_docs(-4), + -- [""] = cmp.mapping.scroll_docs(4), + [""] = cmp.mapping.select_prev_item(), + [""] = cmp.mapping.select_next_item(), + [""] = cmp.mapping.complete(), + [""] = cmp.mapping.close(), + [""] = cmp.mapping.confirm({ + behavior = cmp.ConfirmBehavior.Replace, + -- select = true, + }), + + [""] = cmp.mapping(function(fallback) + if cmp.visible() then + cmp.select_next_item() + elseif luasnip.expand_or_jumpable() then + luasnip.expand_or_jump() + elseif has_words_before() then + cmp.complete() + else + fallback() + end + end, { "i", "s" }), + + [""] = cmp.mapping(function(fallback) + if cmp.visible() then + cmp.select_prev_item() + elseif luasnip.jumpable(-1) then + luasnip.jump(-1) + else + fallback() + end + end, { "i", "s" }), + } end M.rest_nvim = function() - -- rest-nvim - vim.cmd [[ + -- rest-nvim + vim.cmd([[ command! -buffer Http :lua require'rest-nvim'.run() command! -buffer HttpCurl :lua require'rest-nvim'.run(true) command! -buffer HttpLast :lua require'rest-nvim'.last() -]] +]]) end return M diff --git a/lua/core/utils/init.lua b/lua/core/utils/init.lua index fd697c3e..5f951099 100644 --- a/lua/core/utils/init.lua +++ b/lua/core/utils/init.lua @@ -3,185 +3,180 @@ local M = {} -- 76 #h "README.md" 第 1 行 -- 78 h "init.lua" 第 1 行 M.close_other_buf = function() - -- local cur_winnr = vim.fn.winnr() - local cur_buf = vim.fn.bufnr('%') - if cur_buf == -1 then - return - end - -- local bf_no = vim.fn.winbufnr(cur_winnr) - vim.fn.execute('bn') - local next_buf = vim.fn.bufnr('%') - -- print('cur_buf ' .. cur_buf) + -- local cur_winnr = vim.fn.winnr() + local cur_buf = vim.fn.bufnr("%") + if cur_buf == -1 then + return + end + -- local bf_no = vim.fn.winbufnr(cur_winnr) + vim.fn.execute("bn") + local next_buf = vim.fn.bufnr("%") + -- print('cur_buf ' .. cur_buf) - local count = 999; - while next_buf ~= -1 and cur_buf ~= next_buf and count > 0 do - -- print('next_buf ' .. next_buf) - local bdel = 'bdel ' .. next_buf - vim.fn.execute('bn') - vim.fn.execute(bdel) - next_buf = vim.fn.bufnr('%') - count = count - 1 - end + local count = 999 + while next_buf ~= -1 and cur_buf ~= next_buf and count > 0 do + -- print('next_buf ' .. next_buf) + local bdel = "bdel " .. next_buf + vim.fn.execute("bn") + vim.fn.execute(bdel) + next_buf = vim.fn.bufnr("%") + count = count - 1 + end end M.close_other_bufline = function() - vim.fn.execute('BufferLineCloseLeft') - vim.fn.execute('BufferLineCloseRight') + vim.fn.execute("BufferLineCloseLeft") + vim.fn.execute("BufferLineCloseRight") end M.packer_lazy_load = function(plugin, timer) - if plugin then - timer = timer or 0 - vim.defer_fn(function() - require("packer").loader(plugin) - end, timer) - end + if plugin then + timer = timer or 0 + vim.defer_fn(function() + require("packer").loader(plugin) + end, timer) + end end M.is_upper = function(c) - return c >= 65 and c <= 90 + return c >= 65 and c <= 90 end M.is_lower = function(c) - return c >= 97 and c <= 122 + return c >= 97 and c <= 122 end M.char_size = function(c) - local code = c; - if code < 127 then - return 1 - elseif code <= 223 then - return 2 - elseif code <= 239 then - return 3 - elseif code <= 247 then - return 4 - end - return nil + local code = c + if code < 127 then + return 1 + elseif code <= 223 then + return 2 + elseif code <= 239 then + return 3 + elseif code <= 247 then + return 4 + end + return nil end M.camel_case = function(word) - if word == '' or word == nil then - return - end - if word:find('_') then - return M.camel_case_c(word) - else - return M.camel_case_u(word) - end + if word == "" or word == nil then + return + end + if word:find("_") then + return M.camel_case_c(word) + else + return M.camel_case_u(word) + end end M.camel_case_u = function(word) - local result = {} - local len = word:len() - local i = 1 - local f = true - while i <= len do - local c = word:byte(i) - local cs = M.char_size(c) - local cf = f - if cs == nil then - return word - end - if cs == 1 and M.is_upper(c) then - f = false; - if cf and i ~= 1 then - table.insert(result, '_') - end - else - f = true - end - local e = i + cs; - table.insert(result, word:sub(i, e - 1)) - i = e - end - return table.concat(result, ''):upper() + local result = {} + local len = word:len() + local i = 1 + local f = true + while i <= len do + local c = word:byte(i) + local cs = M.char_size(c) + local cf = f + if cs == nil then + return word + end + if cs == 1 and M.is_upper(c) then + f = false + if cf and i ~= 1 then + table.insert(result, "_") + end + else + f = true + end + local e = i + cs + table.insert(result, word:sub(i, e - 1)) + i = e + end + return table.concat(result, ""):upper() end M.camel_case_c = function(word) - local w = word:lower() - local result = {} - local sc = 95 - local f = false - local len = word:len() - local i = 1 - while i <= len do - local c = w:byte(i) - local cs = M.char_size(c) - local e = i + cs; - if cs == nil then - return word - end - local cf = f; - if f then - f = false - end - if c == sc then - f = true - else - if cs == 1 and cf then - table.insert(result, string.char(c):upper()) - else - table.insert(result, w:sub(i, e - 1)) - end - end - i = e - end - return table.concat(result, '') + local w = word:lower() + local result = {} + local sc = 95 + local f = false + local len = word:len() + local i = 1 + while i <= len do + local c = w:byte(i) + local cs = M.char_size(c) + local e = i + cs + if cs == nil then + return word + end + local cf = f + if f then + f = false + end + if c == sc then + f = true + else + if cs == 1 and cf then + table.insert(result, string.char(c):upper()) + else + table.insert(result, w:sub(i, e - 1)) + end + end + i = e + end + return table.concat(result, "") end M.camel_case_start = function(r, l1, l2) - local word - if r == 0 then - word = vim.fn.expand('') - local cw = M.camel_case(word) - if cw then - vim.fn.setreg('"', M.camel_case(word)) - end - elseif l1 == l2 then - word = vim.fn.getline('.') - local ln1 = vim.fn.getpos("'<") - local ln2 = vim.fn.getpos("'>") - local cs = ln1[3] - local ce = ln2[3] - local ecs = M.char_size(word:byte(ce)) - if ecs ~= 1 then - ce = ce + ecs - 1 - end - word = word:sub(cs, ce) - local reg_tmp = vim.fn.getreg('a') - vim.fn.setreg('a', M.camel_case(word)) - vim.cmd('normal! gv"ap') - vim.fn.setreg('a', reg_tmp) - else - vim.notify('请选择单行字符', vim.log.levels.WARN) - end + local word + if r == 0 then + word = vim.fn.expand("") + local cw = M.camel_case(word) + if cw then + vim.fn.setreg('"', M.camel_case(word)) + end + elseif l1 == l2 then + word = vim.fn.getline(".") + local ln1 = vim.fn.getpos("'<") + local ln2 = vim.fn.getpos("'>") + local cs = ln1[3] + local ce = ln2[3] + local ecs = M.char_size(word:byte(ce)) + if ecs ~= 1 then + ce = ce + ecs - 1 + end + word = word:sub(cs, ce) + local reg_tmp = vim.fn.getreg("a") + vim.fn.setreg("a", M.camel_case(word)) + vim.cmd('normal! gv"ap') + vim.fn.setreg("a", reg_tmp) + else + vim.notify("请选择单行字符", vim.log.levels.WARN) + end end M.test = function(a) - print(a) + print(a) end M.camel_case_init = function() - vim.cmd [[ + vim.cmd([[ " command! -complete=customlist,coreutils#cmdline#complete -nargs=* -bang -range command! -nargs=* -range \ CamelCase \ lua require('core.utils').camel_case_start(, , ) -]] +]]) end -- print(M.camel_case("helloWorldAaAaAxC")) - - - M.get_visual_selection = function() - vim.cmd('noau normal! "vy"') - local text = vim.fn.getreg('v') - vim.fn.setreg('v', {}) + vim.cmd('noau normal! "vy"') + local text = vim.fn.getreg("v") + vim.fn.setreg("v", {}) - text = string.gsub(text, "\n", "") - if #text > 0 then - return text - else - return '' - end + text = string.gsub(text, "\n", "") + if #text > 0 then + return text + else + return "" + end end - - return M diff --git a/lua/lsp/c.lua b/lua/lsp/c.lua index 51856df4..460b2206 100644 --- a/lua/lsp/c.lua +++ b/lua/lsp/c.lua @@ -1,6 +1,4 @@ local M = {} -M.config = { -} -M.on_attach = function (_, _) -end -return M; +M.config = {} +M.on_attach = function(_, _) end +return M diff --git a/lua/lsp/html.lua b/lua/lsp/html.lua index 51856df4..460b2206 100644 --- a/lua/lsp/html.lua +++ b/lua/lsp/html.lua @@ -1,6 +1,4 @@ local M = {} -M.config = { -} -M.on_attach = function (_, _) -end -return M; +M.config = {} +M.on_attach = function(_, _) end +return M diff --git a/lua/lsp/init.lua b/lua/lsp/init.lua index 4ba53368..e8244644 100644 --- a/lua/lsp/init.lua +++ b/lua/lsp/init.lua @@ -1,93 +1,92 @@ -local lsp_installer = require('nvim-lsp-installer') -local lspconfig = require('lspconfig') +local lsp_installer = require("nvim-lsp-installer") +local lspconfig = require("lspconfig") -- 安装列表 -- https://github.com/williamboman/nvim-lsp-installer#available-lsps -- { key: 语言 value: 配置文件 } local servers = { - sumneko_lua = require "lsp.lua", -- /lua/lsp/lua.lua - -- jdtls = require "lsp.java", -- /lua/lsp/jdtls.lua - -- jsonls = require("lsp.jsonls"), - clangd = require 'lsp.c', - tsserver = require("lsp.tsserver"), - html = require("lsp.html"), - pyright = require("lsp.pyright"), - rust_analyzer = require 'lsp.rust_analyzer', - sqls = require 'lsp.sqls', + sumneko_lua = require("lsp.lua"), -- /lua/lsp/lua.lua + -- jdtls = require "lsp.java", -- /lua/lsp/jdtls.lua + -- jsonls = require("lsp.jsonls"), + clangd = require("lsp.c"), + tsserver = require("lsp.tsserver"), + html = require("lsp.html"), + pyright = require("lsp.pyright"), + rust_analyzer = require("lsp.rust_analyzer"), + sqls = require("lsp.sqls"), } -- 自动安装 LanguageServers for name, _ in pairs(servers) do - local server_available, server = lsp_installer.get_server(name) - if server_available then - if not server:is_installed() then - vim.notify(string.format("请安装 [%s] LSP server", name), vim.log.levels.WARN) - -- server:install() - end - end + local server_available, server = lsp_installer.get_server(name) + if server_available then + if not server:is_installed() then + vim.notify(string.format("请安装 [%s] LSP server", name), vim.log.levels.WARN) + -- server:install() + end + end end -- Setup lspconfig. -local capabilities = require('cmp_nvim_lsp').update_capabilities(vim.lsp.protocol.make_client_capabilities()) +local capabilities = require("cmp_nvim_lsp").update_capabilities(vim.lsp.protocol.make_client_capabilities()) -- 没有确定使用效果参数 -- capabilities.textDocument.completion.completionItem.snippetSupport = true lsp_installer.setup({}) for name, m in pairs(servers) do - local opts = m.config; - if opts then - opts.on_attach = function(client, bufnr) - -- local function buf_set_option(...) vim.api.nvim_buf_set_option(bufnr, ...) end - -- 绑定快捷键 - require('core.keybindings').maplsp(client, bufnr) - -- require("aerial").on_attach(client, bufnr) - if m.on_attach then - m.on_attach(client, bufnr) - end - -- vim.notify(string.format("Starting [%s] server", server.name), vim.log.levels.INFO) - end - opts.flags = { - debounce_text_changes = 150, - } - opts.capabilities = capabilities; - end - - if name == "rust_analyzer" then - -- Initialize the LSP via rust-tools instead - require("rust-tools").setup { - -- The "server" property provided in rust-tools setup function are the - -- settings rust-tools will provide to lspconfig during init. -- - -- We merge the necessary settings from nvim-lsp-installer (server:get_default_options()) - -- with the user's own settings (opts). - dap = m.dap, - server = { - on_attach = opts.on_attach, - capabilities = opts.capabilities, - standalone = false, - settings = { - ["rust-analyzer"] = { - completion = { - postfix = { - enable = false - } - }, - checkOnSave = { - command = "clippy" - }, - } - } - }, - } - -- Only if standalone support is needed - -- require("rust-tools").start_standalone_if_required() - else - lspconfig[name].setup(opts) - end + local opts = m.config + if opts then + opts.on_attach = function(client, bufnr) + -- local function buf_set_option(...) vim.api.nvim_buf_set_option(bufnr, ...) end + -- 绑定快捷键 + require("core.keybindings").maplsp(client, bufnr) + -- require("aerial").on_attach(client, bufnr) + if m.on_attach then + m.on_attach(client, bufnr) + end + -- vim.notify(string.format("Starting [%s] server", server.name), vim.log.levels.INFO) + end + opts.flags = { + debounce_text_changes = 150, + } + opts.capabilities = capabilities + end + if name == "rust_analyzer" then + -- Initialize the LSP via rust-tools instead + require("rust-tools").setup({ + -- The "server" property provided in rust-tools setup function are the + -- settings rust-tools will provide to lspconfig during init. -- + -- We merge the necessary settings from nvim-lsp-installer (server:get_default_options()) + -- with the user's own settings (opts). + dap = m.dap, + server = { + on_attach = opts.on_attach, + capabilities = opts.capabilities, + standalone = false, + settings = { + ["rust-analyzer"] = { + completion = { + postfix = { + enable = false, + }, + }, + checkOnSave = { + command = "clippy", + }, + }, + }, + }, + }) + -- Only if standalone support is needed + -- require("rust-tools").start_standalone_if_required() + else + lspconfig[name].setup(opts) + end end -- LSP 相关美化参考 https://github.com/NvChad/NvChad local function lspSymbol(name, icon) - local hl = "DiagnosticSign" .. name - vim.fn.sign_define(hl, { text = icon, numhl = hl, texthl = hl }) + local hl = "DiagnosticSign" .. name + vim.fn.sign_define(hl, { text = icon, numhl = hl, texthl = hl }) end lspSymbol("Error", "") @@ -95,20 +94,20 @@ lspSymbol("Info", "") lspSymbol("Hint", "") lspSymbol("Warn", "") -vim.diagnostic.config { - virtual_text = { - prefix = "", - }, - signs = true, - underline = true, - update_in_insert = false, -} +vim.diagnostic.config({ + virtual_text = { + prefix = "", + }, + signs = true, + underline = true, + update_in_insert = false, +}) vim.lsp.handlers["textDocument/hover"] = vim.lsp.with(vim.lsp.handlers.hover, { - border = "single", + border = "single", }) vim.lsp.handlers["textDocument/signatureHelp"] = vim.lsp.with(vim.lsp.handlers.signature_help, { - border = "single", + border = "single", }) -- suppress error messages from lang servers @@ -122,9 +121,9 @@ vim.lsp.handlers["textDocument/signatureHelp"] = vim.lsp.with(vim.lsp.handlers.s -- vim.api.nvim_echo({ { msg } }, true, {}) -- end -- end -vim.cmd [[ +vim.cmd([[ augroup jdtls_lsp autocmd! autocmd FileType java lua require'lsp.java'.setup() augroup end -]] +]]) diff --git a/lua/lsp/java.lua b/lua/lsp/java.lua index 0a1d4c8f..132a7a45 100644 --- a/lua/lsp/java.lua +++ b/lua/lsp/java.lua @@ -1,268 +1,273 @@ local M = {} local env = { - -- HOME = vim.loop.os_homedir(), - JAVA_HOME = os.getenv('JAVA_HOME'), - MAVEN_HOME = os.getenv('MAVEN_HOME'), - MAVEN_SETTINGS = os.getenv('MAVEN_SETTINGS'), - JDTLS_HOME = os.getenv('JDTLS_HOME'), - JDTLS_WORKSPACE = os.getenv('JDTLS_WORKSPACE'), - JDTLS_EXTENSIONS = os.getenv('JDTLS_EXTENSIONS'), - LOMBOK_JAR = os.getenv('LOMBOK_JAR'), + -- HOME = vim.loop.os_homedir(), + JAVA_HOME = os.getenv("JAVA_HOME"), + MAVEN_HOME = os.getenv("MAVEN_HOME"), + MAVEN_SETTINGS = os.getenv("MAVEN_SETTINGS"), + JDTLS_HOME = os.getenv("JDTLS_HOME"), + JDTLS_WORKSPACE = os.getenv("JDTLS_WORKSPACE"), + JDTLS_EXTENSIONS = os.getenv("JDTLS_EXTENSIONS"), + LOMBOK_JAR = os.getenv("LOMBOK_JAR"), } local function or_default(a, v) - return a and a or v + return a and a or v end -local maven_settings = env.MAVEN_HOME .. '/conf/settings.xml' +local maven_settings = env.MAVEN_HOME .. "/conf/settings.xml" local function get_maven_settings() - return or_default(env.MAVEN_SETTINGS, maven_settings) + return or_default(env.MAVEN_SETTINGS, maven_settings) end local function get_java_home() - return or_default(env.JAVA_HOME, '/opt/software/java/zulu11.56.19-ca-jdk11.0.15-macosx_aarch64') + return or_default(env.JAVA_HOME, "/opt/software/java/zulu11.56.19-ca-jdk11.0.15-macosx_aarch64") end local function get_java() - return get_java_home() .. '/bin/java' + return get_java_home() .. "/bin/java" end local jdtls_root = "/opt/software/lsp/java/jdt-language-server" local function get_jdtls_home() - return or_default(env.JDTLS_HOME, jdtls_root) + return or_default(env.JDTLS_HOME, jdtls_root) end local function get_jdtls_workspace() - return or_default(env.JDTLS_WORKSPACE, '/Users/luokai/jdtls-workspace/') + return or_default(env.JDTLS_WORKSPACE, "/Users/luokai/jdtls-workspace/") end local function get_lombok_jar() - return or_default(env.LOMBOK_JAR, '/opt/software/lsp/lombok.jar') + return or_default(env.LOMBOK_JAR, "/opt/software/lsp/lombok.jar") end local function get_jdtls_extensions() - return or_default(env.JDTLS_EXTENSIONS, '/opt/software/lsp/java') + return or_default(env.JDTLS_EXTENSIONS, "/opt/software/lsp/java") end M.setup = function() - - local project_name = vim.fn.fnamemodify(vim.fn.getcwd(), ':p:h:t') - - local workspace_dir = get_jdtls_workspace() .. project_name - - local jdtls_launcher = vim.fn.glob(get_jdtls_home() .. "/plugins/org.eclipse.equinox.launcher_*.jar"); - -- See `:help vim.lsp.start_client` for an overview of the supported `config` options. - local config = { - -- The command that starts the language server - -- See: https://github.com/eclipse/eclipse.jdt.ls#running-from-the-command-line - cmd = { - get_java(), -- or '/path/to/java11_or_newer/bin/java' - '-Declipse.application=org.eclipse.jdt.ls.core.id1', - '-Dosgi.bundles.defaultStartLevel=4', - '-Declipse.product=org.eclipse.jdt.ls.core.product', - "-Dosgi.configuration.cascaded=true", - "-Dosgi.sharedConfiguration.area=" .. get_jdtls_home() .. "/config_mac", - "-Dosgi.sharedConfiguration.area.readOnly=true", - '-Dlog.protocol=true', - '-Dlog.level=ALL', - '-Dsun.zip.disableMemoryMapping=true', - "-noverify", - -- '-XX:+UseParallelGC', - -- '-XX:GCTimeRatio=4', - -- '-XX:AdaptiveSizePolicyWeight=90', - -- '-XX:+UseG1GC', - -- '-XX:+UseStringDeduplication', - -- '-Xms512m', - '-Xmx2g', - '-javaagent:' .. get_lombok_jar(), - '--add-modules=ALL-SYSTEM', - '--add-opens', 'java.base/java.util=ALL-UNNAMED', - '--add-opens', 'java.base/java.lang=ALL-UNNAMED', - '-jar', jdtls_launcher, - -- '-configuration', '/opt/software/lsp/jdtls/config_mac', - '-data', workspace_dir, - }, - filetypes = { "java" }, - - -- 💀 - -- This is the default if not provided, you can remove it. Or adjust as needed. - -- One dedicated LSP server & client will be started per unique root_dir - root_dir = require('jdtls.setup').find_root({ '.git', 'mvnw', 'gradlew' }), - - -- Here you can configure eclipse.jdt.ls specific settings - -- See https://github.com/eclipse/eclipse.jdt.ls/wiki/Running-the-JAVA-LS-server-from-the-command-line#initialize-request - -- for a list of options - settings = { - java = { - home = get_java_home(), - project = { - resourceFilters = { - "node_modules", - ".git", - ".idea" - }, - }, - import = { - exclusions = { - "**/node_modules/**", - "**/.metadata/**", - "**/archetype-resources/**", - "**/META-INF/maven/**", - "**/.git/**", - "**/.idea/**", - }, - }, - -- referenceCodeLens = { enabled = true }, - -- implementationsCodeLens = { enabled = true }, - templates = { - fileHeader = { - "/**", - " * ${type_name}", - " * @author ${user}", - " */", - }, - typeComment = { - "/**", - " * ${type_name}", - " * @author ${user}", - " */", - }, - }, - eclipse = { - downloadSources = true, - }, - server = { - launchMode = "Hybrid", - }, - maven = { - downloadSources = true, - updateSnapshots = true, - }, - signatureHelp = { enabled = true }, - contentProvider = { preferred = 'fernflower' }, - completion = { - favoriteStaticMembers = { - "org.hamcrest.MatcherAssert.assertThat", - "org.hamcrest.Matchers.*", - "org.hamcrest.CoreMatchers.*", - "org.junit.jupiter.api.Assertions.*", - "java.util.Objects.requireNonNull", - "java.util.Objects.requireNonNullElse", - "org.mockito.Mockito.*" - }, - filteredTypes = { - "com.sun.*", - "io.micrometer.shaded.*", - "java.awt.*", - "jdk.*", - "sun.*", - }, - }; - sources = { - organizeImports = { - starThreshold = 9999; - staticStarThreshold = 9999; - }, - }, - configuration = { - maven = { - -- userSettings = "/opt/software/apache-maven-3.6.3/conf/settings.xml", - -- globalSettings = "/opt/software/apache-maven-3.6.3/conf/settings.xml", - userSettings = get_maven_settings(), - globalSettings = get_maven_settings(), - }, - runtimes = { - { - name = "JavaSE-1.8", - path = "/opt/software/java/zulu8.62.0.19-ca-jdk8.0.332-macosx_aarch64", - default = true, - }, - { - name = "JavaSE-11", - path = "/opt/software/java/zulu11.56.19-ca-jdk11.0.15-macosx_aarch64", - }, - { - name = "JavaSE-17", - path = "/opt/software/java/graalvm-ce-java17-22.1.0/Contents/Home", - }, - } - }, - } - }, - - -- Language server `initializationOptions` - -- You need to extend the `bundles` with paths to jar files - -- if you want to use additional eclipse.jdt.ls plugins. - -- - -- See https://github.com/mfussenegger/nvim-jdtls#java-debug-installation - -- - -- If you don't plan on using the debugger or other eclipse.jdt.ls plugins you can remove this - -- init_options = { - -- bundles = { - -- vim.fn.glob("/opt/software/lsp/java/java-debug/com.microsoft.java.debug.plugin/target/com.microsoft.java.debug.plugin-0.35.0.jar") - -- }, - -- workspace = workspace_dir - -- }, - } - - - -- This bundles definition is the same as in the previous section (java-debug installation) - local bundles = { - vim.fn.glob(get_jdtls_extensions() .. "/java-debug/com.microsoft.java.debug.plugin/target/com.microsoft.java.debug.plugin-*.jar") - }; - - -- /opt/software/lsp/java/vscode-java-test/server - -- vim.list_extend(bundles, vim.split(vim.fn.glob("/opt/software/lsp/java/vscode-java-test/server/*.jar"), "\n")); - for _, bundle in ipairs(vim.split(vim.fn.glob(get_jdtls_extensions() .. "/vscode-java-test/server/*.jar"), "\n")) do - if not vim.endswith(bundle, 'com.microsoft.java.test.runner-jar-with-dependencies.jar') then - table.insert(bundles, bundle) - end - end - - -- /opt/software/lsp/java/vscode-java-decompiler/server/ - vim.list_extend(bundles, vim.split(vim.fn.glob(get_jdtls_extensions() .. "/vscode-java-decompiler/server/*.jar"), "\n")); - - -- /opt/software/lsp/java/vscode-java-dependency/jdtls.ext/ - -- vim.list_extend(bundles, vim.split(vim.fn.glob("/opt/software/lsp/java/vscode-java-dependency/jdtls.ext/com.microsoft.jdtls.ext.core/target/com.microsoft.jdtls.ext.core-*.jar"), "\n")); - - local jdtls = require('jdtls') - - local extendedClientCapabilities = jdtls.extendedClientCapabilities; - extendedClientCapabilities.resolveAdditionalTextEditsSupport = true; - - config['init_options'] = { - bundles = bundles; - extendedClientCapabilities = extendedClientCapabilities; - } - - config['on_attach'] = function(client, bufnr) - -- With `hotcodereplace = 'auto' the debug adapter will try to apply code changes - -- you make during a debug session immediately. - -- Remove the option if you do not want that. - require('jdtls').setup_dap({ hotcodereplace = 'auto' }) - require('jdtls.setup').add_commands(); - require('core.keybindings').maplsp(client, bufnr) - -- require('jdtls.dap').setup_dap_main_class_configs({ verbose = true }) - end - - - local capabilities = require('cmp_nvim_lsp').update_capabilities(vim.lsp.protocol.make_client_capabilities()) - -- capabilities.experimental = { - -- hoverActions = true, - -- hoverRange = true, - -- serverStatusNotification = true, - -- snippetTextEdit = true, - -- codeActionGroup = true, - -- ssr = true, - -- } - - config.capabilities = capabilities; - - - jdtls.start_or_attach(config) - - - vim.cmd([[ + local project_name = vim.fn.fnamemodify(vim.fn.getcwd(), ":p:h:t") + + local workspace_dir = get_jdtls_workspace() .. project_name + + local jdtls_launcher = vim.fn.glob(get_jdtls_home() .. "/plugins/org.eclipse.equinox.launcher_*.jar") + -- See `:help vim.lsp.start_client` for an overview of the supported `config` options. + local config = { + -- The command that starts the language server + -- See: https://github.com/eclipse/eclipse.jdt.ls#running-from-the-command-line + cmd = { + get_java(), -- or '/path/to/java11_or_newer/bin/java' + "-Declipse.application=org.eclipse.jdt.ls.core.id1", + "-Dosgi.bundles.defaultStartLevel=4", + "-Declipse.product=org.eclipse.jdt.ls.core.product", + "-Dosgi.configuration.cascaded=true", + "-Dosgi.sharedConfiguration.area=" .. get_jdtls_home() .. "/config_mac", + "-Dosgi.sharedConfiguration.area.readOnly=true", + "-Dlog.protocol=true", + "-Dlog.level=ALL", + "-Dsun.zip.disableMemoryMapping=true", + "-noverify", + -- '-XX:+UseParallelGC', + -- '-XX:GCTimeRatio=4', + -- '-XX:AdaptiveSizePolicyWeight=90', + -- '-XX:+UseG1GC', + -- '-XX:+UseStringDeduplication', + -- '-Xms512m', + "-Xmx2g", + "-javaagent:" .. get_lombok_jar(), + "--add-modules=ALL-SYSTEM", + "--add-opens", + "java.base/java.util=ALL-UNNAMED", + "--add-opens", + "java.base/java.lang=ALL-UNNAMED", + "-jar", + jdtls_launcher, + -- '-configuration', '/opt/software/lsp/jdtls/config_mac', + "-data", + workspace_dir, + }, + filetypes = { "java" }, + + -- 💀 + -- This is the default if not provided, you can remove it. Or adjust as needed. + -- One dedicated LSP server & client will be started per unique root_dir + root_dir = require("jdtls.setup").find_root({ ".git", "mvnw", "gradlew" }), + + -- Here you can configure eclipse.jdt.ls specific settings + -- See https://github.com/eclipse/eclipse.jdt.ls/wiki/Running-the-JAVA-LS-server-from-the-command-line#initialize-request + -- for a list of options + settings = { + java = { + home = get_java_home(), + project = { + resourceFilters = { + "node_modules", + ".git", + ".idea", + }, + }, + import = { + exclusions = { + "**/node_modules/**", + "**/.metadata/**", + "**/archetype-resources/**", + "**/META-INF/maven/**", + "**/.git/**", + "**/.idea/**", + }, + }, + -- referenceCodeLens = { enabled = true }, + -- implementationsCodeLens = { enabled = true }, + templates = { + fileHeader = { + "/**", + " * ${type_name}", + " * @author ${user}", + " */", + }, + typeComment = { + "/**", + " * ${type_name}", + " * @author ${user}", + " */", + }, + }, + eclipse = { + downloadSources = true, + }, + server = { + launchMode = "Hybrid", + }, + maven = { + downloadSources = true, + updateSnapshots = true, + }, + signatureHelp = { enabled = true }, + contentProvider = { preferred = "fernflower" }, + completion = { + favoriteStaticMembers = { + "org.hamcrest.MatcherAssert.assertThat", + "org.hamcrest.Matchers.*", + "org.hamcrest.CoreMatchers.*", + "org.junit.jupiter.api.Assertions.*", + "java.util.Objects.requireNonNull", + "java.util.Objects.requireNonNullElse", + "org.mockito.Mockito.*", + }, + filteredTypes = { + "com.sun.*", + "io.micrometer.shaded.*", + "java.awt.*", + "jdk.*", + "sun.*", + }, + }, + sources = { + organizeImports = { + starThreshold = 9999, + staticStarThreshold = 9999, + }, + }, + configuration = { + maven = { + -- userSettings = "/opt/software/apache-maven-3.6.3/conf/settings.xml", + -- globalSettings = "/opt/software/apache-maven-3.6.3/conf/settings.xml", + userSettings = get_maven_settings(), + globalSettings = get_maven_settings(), + }, + runtimes = { + { + name = "JavaSE-1.8", + path = "/opt/software/java/zulu8.62.0.19-ca-jdk8.0.332-macosx_aarch64", + default = true, + }, + { + name = "JavaSE-11", + path = "/opt/software/java/zulu11.56.19-ca-jdk11.0.15-macosx_aarch64", + }, + { + name = "JavaSE-17", + path = "/opt/software/java/graalvm-ce-java17-22.1.0/Contents/Home", + }, + }, + }, + }, + }, + + -- Language server `initializationOptions` + -- You need to extend the `bundles` with paths to jar files + -- if you want to use additional eclipse.jdt.ls plugins. + -- + -- See https://github.com/mfussenegger/nvim-jdtls#java-debug-installation + -- + -- If you don't plan on using the debugger or other eclipse.jdt.ls plugins you can remove this + -- init_options = { + -- bundles = { + -- vim.fn.glob("/opt/software/lsp/java/java-debug/com.microsoft.java.debug.plugin/target/com.microsoft.java.debug.plugin-0.35.0.jar") + -- }, + -- workspace = workspace_dir + -- }, + } + + -- This bundles definition is the same as in the previous section (java-debug installation) + local bundles = { + vim.fn.glob( + get_jdtls_extensions() + .. "/java-debug/com.microsoft.java.debug.plugin/target/com.microsoft.java.debug.plugin-*.jar" + ), + } + + -- /opt/software/lsp/java/vscode-java-test/server + -- vim.list_extend(bundles, vim.split(vim.fn.glob("/opt/software/lsp/java/vscode-java-test/server/*.jar"), "\n")); + for _, bundle in ipairs(vim.split(vim.fn.glob(get_jdtls_extensions() .. "/vscode-java-test/server/*.jar"), "\n")) do + if not vim.endswith(bundle, "com.microsoft.java.test.runner-jar-with-dependencies.jar") then + table.insert(bundles, bundle) + end + end + + -- /opt/software/lsp/java/vscode-java-decompiler/server/ + vim.list_extend( + bundles, + vim.split(vim.fn.glob(get_jdtls_extensions() .. "/vscode-java-decompiler/server/*.jar"), "\n") + ) + + -- /opt/software/lsp/java/vscode-java-dependency/jdtls.ext/ + -- vim.list_extend(bundles, vim.split(vim.fn.glob("/opt/software/lsp/java/vscode-java-dependency/jdtls.ext/com.microsoft.jdtls.ext.core/target/com.microsoft.jdtls.ext.core-*.jar"), "\n")); + + local jdtls = require("jdtls") + + local extendedClientCapabilities = jdtls.extendedClientCapabilities + extendedClientCapabilities.resolveAdditionalTextEditsSupport = true + + config["init_options"] = { + bundles = bundles, + extendedClientCapabilities = extendedClientCapabilities, + } + + config["on_attach"] = function(client, bufnr) + -- With `hotcodereplace = 'auto' the debug adapter will try to apply code changes + -- you make during a debug session immediately. + -- Remove the option if you do not want that. + require("jdtls").setup_dap({ hotcodereplace = "auto" }) + require("jdtls.setup").add_commands() + require("core.keybindings").maplsp(client, bufnr) + -- require('jdtls.dap').setup_dap_main_class_configs({ verbose = true }) + end + + local capabilities = require("cmp_nvim_lsp").update_capabilities(vim.lsp.protocol.make_client_capabilities()) + -- capabilities.experimental = { + -- hoverActions = true, + -- hoverRange = true, + -- serverStatusNotification = true, + -- snippetTextEdit = true, + -- codeActionGroup = true, + -- ssr = true, + -- } + + config.capabilities = capabilities + + jdtls.start_or_attach(config) + + vim.cmd([[ command! -nargs=0 OR :lua require'jdtls'.organize_imports() nnoremap crv lua require('jdtls').extract_variable() vnoremap crv lua require('jdtls').extract_variable(true) diff --git a/lua/lsp/jsonls.lua b/lua/lsp/jsonls.lua index 51856df4..460b2206 100644 --- a/lua/lsp/jsonls.lua +++ b/lua/lsp/jsonls.lua @@ -1,6 +1,4 @@ local M = {} -M.config = { -} -M.on_attach = function (_, _) -end -return M; +M.config = {} +M.on_attach = function(_, _) end +return M diff --git a/lua/lsp/lua.lua b/lua/lsp/lua.lua index 5e1a4788..5913e7ca 100644 --- a/lua/lsp/lua.lua +++ b/lua/lsp/lua.lua @@ -1,32 +1,30 @@ -local runtime_path = vim.split(package.path, ';') +local runtime_path = vim.split(package.path, ";") table.insert(runtime_path, "lua/?.lua") table.insert(runtime_path, "lua/?/init.lua") local M = {} - M.config = { - settings = { - Lua = { - runtime = { - -- Tell the language server which version of Lua you're using (most likely LuaJIT in the case of Neovim) - version = 'LuaJIT', - -- Setup your lua path - path = runtime_path, - }, - diagnostics = { - -- Get the language server to recognize the `vim` global - globals = {'vim'}, - }, - workspace = { - -- Make the server aware of Neovim runtime files - library = vim.api.nvim_get_runtime_file("", true), - }, - -- Do not send telemetry data containing a randomized but unique identifier - telemetry = { - enable = false - }, - }, - }, +M.config = { + settings = { + Lua = { + runtime = { + -- Tell the language server which version of Lua you're using (most likely LuaJIT in the case of Neovim) + version = "LuaJIT", + -- Setup your lua path + path = runtime_path, + }, + diagnostics = { + -- Get the language server to recognize the `vim` global + globals = { "vim" }, + }, + workspace = { + -- Make the server aware of Neovim runtime files + library = vim.api.nvim_get_runtime_file("", true), + }, + -- Do not send telemetry data containing a randomized but unique identifier + telemetry = { + enable = false, + }, + }, + }, } -M.on_attach = function (_, bufnr) - -end -return M; +M.on_attach = function(_, bufnr) end +return M diff --git a/lua/lsp/pyright.lua b/lua/lsp/pyright.lua index eeed529b..11ebaa4f 100644 --- a/lua/lsp/pyright.lua +++ b/lua/lsp/pyright.lua @@ -1,19 +1,17 @@ local M = {} -M.config = { -} +M.config = {} -M.organize_imports = function () - local params = { - command = 'pyright.organizeimports', - arguments = { vim.uri_from_bufnr(0) }, - } - vim.lsp.buf.execute_command(params) +M.organize_imports = function() + local params = { + command = "pyright.organizeimports", + arguments = { vim.uri_from_bufnr(0) }, + } + vim.lsp.buf.execute_command(params) end - -M.on_attach = function (_, _) - vim.cmd[[ +M.on_attach = function(_, _) + vim.cmd([[ command! -nargs=0 OR :lua require'lsp.pyright'.organize_imports() - ]] + ]]) end -return M; +return M diff --git a/lua/lsp/rust_analyzer.lua b/lua/lsp/rust_analyzer.lua index 8e2457cc..b9d2cca8 100644 --- a/lua/lsp/rust_analyzer.lua +++ b/lua/lsp/rust_analyzer.lua @@ -1,22 +1,17 @@ local M = {} -- Update this path -local extension_path = '/Users/kailuo/.vscode/extensions/vadimcn.vscode-lldb-1.7.0/' -local codelldb_path = extension_path .. 'adapter/codelldb' -local liblldb_path = extension_path .. 'lldb/lib/liblldb.dylib' +local extension_path = "/Users/kailuo/.vscode/extensions/vadimcn.vscode-lldb-1.7.0/" +local codelldb_path = extension_path .. "adapter/codelldb" +local liblldb_path = extension_path .. "lldb/lib/liblldb.dylib" M.config = { - -- ... other configs + -- ... other configs } M.dap = { - adapter = require('rust-tools.dap').get_codelldb_adapter( - codelldb_path, liblldb_path) + adapter = require("rust-tools.dap").get_codelldb_adapter(codelldb_path, liblldb_path), } +M.on_attach = function(_, _) end - - -M.on_attach = function (_, _) -end - -return M; +return M diff --git a/lua/lsp/sqls.lua b/lua/lsp/sqls.lua index 268b53d5..2ef9b72f 100644 --- a/lua/lsp/sqls.lua +++ b/lua/lsp/sqls.lua @@ -1,8 +1,7 @@ -vim.g.sql_type_default = 'mysql' +vim.g.sql_type_default = "mysql" local M = {} -M.config = { -} +M.config = {} M.on_attach = function(client, bufnr) - require('sqls').on_attach(client, bufnr) + require("sqls").on_attach(client, bufnr) end -return M; +return M diff --git a/lua/lsp/tsserver.lua b/lua/lsp/tsserver.lua index 51856df4..460b2206 100644 --- a/lua/lsp/tsserver.lua +++ b/lua/lsp/tsserver.lua @@ -1,6 +1,4 @@ local M = {} -M.config = { -} -M.on_attach = function (_, _) -end -return M; +M.config = {} +M.on_attach = function(_, _) end +return M diff --git a/lua/lsp/utils/init.lua b/lua/lsp/utils/init.lua index 59adabee..35b4dda4 100644 --- a/lua/lsp/utils/init.lua +++ b/lua/lsp/utils/init.lua @@ -1,26 +1,21 @@ local M = {} M.format_range_operator = function() - local old_func = vim.go.operatorfunc - _G.op_func_formatting = function() - local start = vim.api.nvim_buf_get_mark(0, '[') - local finish = vim.api.nvim_buf_get_mark(0, ']') - vim.lsp.buf.range_formatting({}, start, finish) - vim.go.operatorfunc = old_func - _G.op_func_formatting = nil - end - vim.go.operatorfunc = 'v:lua.op_func_formatting' - vim.api.nvim_feedkeys('g@', 'n', false) + local old_func = vim.go.operatorfunc + _G.op_func_formatting = function() + local start = vim.api.nvim_buf_get_mark(0, "[") + local finish = vim.api.nvim_buf_get_mark(0, "]") + vim.lsp.buf.range_formatting({}, start, finish) + vim.go.operatorfunc = old_func + _G.op_func_formatting = nil + end + vim.go.operatorfunc = "v:lua.op_func_formatting" + vim.api.nvim_feedkeys("g@", "n", false) end - - - - -- 指定格式化 lsp_client local format_lsp_mapping = {} format_lsp_mapping["java"] = "jdt.ls" -format_lsp_mapping["lua"] = "sumneko_lua" -- sql_formatter format_lsp_mapping["sql"] = "null-ls" @@ -49,13 +44,15 @@ format_lsp_mapping["toml"] = "null-ls" -- shfmt format_lsp_mapping["sh"] = "null-ls" +-- stylua +format_lsp_mapping["lua"] = "null-ls" format_lsp_mapping["http"] = "null-ls" M.filter_format_lsp_client = function(client, bufnr) - local filetype = vim.api.nvim_buf_get_option(bufnr, 'filetype') - local cn = format_lsp_mapping[filetype] - return client.name == cn + local filetype = vim.api.nvim_buf_get_option(bufnr, "filetype") + local cn = format_lsp_mapping[filetype] + return client.name == cn end return M diff --git a/lua/plugins/config/LeaderF.lua b/lua/plugins/config/LeaderF.lua index 1da10447..fbc56afe 100644 --- a/lua/plugins/config/LeaderF.lua +++ b/lua/plugins/config/LeaderF.lua @@ -1,4 +1,4 @@ -vim.g.Lf_WindowPosition = 'popup' +vim.g.Lf_WindowPosition = "popup" -- 不使用缓存(大型项目不推荐) -vim.g.Lf_UseCache=0 -vim.g.Lf_UseMemoryCache=0 +vim.g.Lf_UseCache = 0 +vim.g.Lf_UseMemoryCache = 0 diff --git a/lua/plugins/config/aerial.lua b/lua/plugins/config/aerial.lua index 2ee401c0..378673f9 100644 --- a/lua/plugins/config/aerial.lua +++ b/lua/plugins/config/aerial.lua @@ -1,242 +1,242 @@ -- Call the setup function to change the default behavior require("aerial").setup({ - -- Priority list of preferred backends for aerial. - -- This can be a filetype map (see :help aerial-filetype-map) - backends = { "treesitter", "lsp", "markdown" }, - - -- Enum: persist, close, auto, global - -- persist - aerial window will stay open until closed - -- close - aerial window will close when original file is no longer visible - -- auto - aerial window will stay open as long as there is a visible - -- buffer to attach to - -- global - same as 'persist', and will always show symbols for the current buffer - close_behavior = "auto", - - -- Set to false to remove the default keybindings for the aerial buffer - default_bindings = true, - - -- Enum: prefer_right, prefer_left, right, left, float - -- Determines the default direction to open the aerial window. The 'prefer' - -- options will open the window in the other direction *if* there is a - -- different buffer in the way of the preferred direction - default_direction = "prefer_right", - - -- Disable aerial on files with this many lines - disable_max_lines = 10000, - - -- Disable aerial on files this size or larger (in bytes) - disable_max_size = 2000000, -- Default 2MB - - -- A list of all symbols to display. Set to false to display all symbols. - -- This can be a filetype map (see :help aerial-filetype-map) - -- To see all available values, see :help SymbolKind - filter_kind = { - "Array", - "Boolean", - "Class", - "Constant", - "Constructor", - "Enum", - "EnumMember", - "Event", - "Field", - "File", - "Function", - "Interface", - "Key", - "Method", - "Module", - "Namespace", - "Null", - "Number", - "Object", - "Operator", - "Package", - "Property", - "String", - "Struct", - "TypeParameter", - "Variable", - }, - - -- Enum: split_width, full_width, last, none - -- Determines line highlighting mode when multiple splits are visible. - -- split_width Each open window will have its cursor location marked in the - -- aerial buffer. Each line will only be partially highlighted - -- to indicate which window is at that location. - -- full_width Each open window will have its cursor location marked as a - -- full-width highlight in the aerial buffer. - -- last Only the most-recently focused window will have its location - -- marked in the aerial buffer. - -- none Do not show the cursor locations in the aerial window. - highlight_mode = "split_width", - - -- Highlight the closest symbol if the cursor is not exactly on one. - highlight_closest = true, - - -- Highlight the symbol in the source buffer when cursor is in the aerial win - highlight_on_hover = false, - - -- When jumping to a symbol, highlight the line for this many ms. - -- Set to false to disable - highlight_on_jump = 300, - - -- Define symbol icons. You can also specify "Collapsed" to change the - -- icon when the tree is collapsed at that symbol, or "Collapsed" to specify a - -- default collapsed icon. The default icon set is determined by the - -- "nerd_font" option below. - -- If you have lspkind-nvim installed, it will be the default icon set. - -- This can be a filetype map (see :help aerial-filetype-map) - icons = {}, - - -- Control which windows and buffers aerial should ignore. - -- If close_behavior is "global", focusing an ignored window/buffer will - -- not cause the aerial window to update. - -- If open_automatic is true, focusing an ignored window/buffer will not - -- cause an aerial window to open. - -- If open_automatic is a function, ignore rules have no effect on aerial - -- window opening behavior; it's entirely handled by the open_automatic - -- function. - ignore = { - -- Ignore unlisted buffers. See :help buflisted - unlisted_buffers = true, - - -- List of filetypes to ignore. - filetypes = {}, - - -- Ignored buftypes. - -- Can be one of the following: - -- false or nil - No buftypes are ignored. - -- "special" - All buffers other than normal buffers are ignored. - -- table - A list of buftypes to ignore. See :help buftype for the - -- possible values. - -- function - A function that returns true if the buffer should be - -- ignored or false if it should not be ignored. - -- Takes two arguments, `bufnr` and `buftype`. - buftypes = "special", - - -- Ignored wintypes. - -- Can be one of the following: - -- false or nil - No wintypes are ignored. - -- "special" - All windows other than normal windows are ignored. - -- table - A list of wintypes to ignore. See :help win_gettype() for the - -- possible values. - -- function - A function that returns true if the window should be - -- ignored or false if it should not be ignored. - -- Takes two arguments, `winid` and `wintype`. - wintypes = "special", - }, - - -- When you fold code with za, zo, or zc, update the aerial tree as well. - -- Only works when manage_folds = true - link_folds_to_tree = false, - - -- Fold code when you open/collapse symbols in the tree. - -- Only works when manage_folds = true - link_tree_to_folds = true, - - -- Use symbol tree for folding. Set to true or false to enable/disable - -- 'auto' will manage folds if your previous foldmethod was 'manual' - manage_folds = false, - - -- These control the width of the aerial window. - -- They can be integers or a float between 0 and 1 (e.g. 0.4 for 40%) - -- min_width and max_width can be a list of mixed types. - -- max_width = {40, 0.2} means "the lesser of 40 columns or 20% of total" - max_width = { 40, 0.2 }, - width = nil, - min_width = 32, - - -- Set default symbol icons to use patched font icons (see https://www.nerdfonts.com/) - -- "auto" will set it to true if nvim-web-devicons or lspkind-nvim is installed. - nerd_font = "true", - - -- Call this function when aerial attaches to a buffer. - -- Useful for setting keymaps. Takes a single `bufnr` argument. - on_attach = nil, - - -- Call this function when aerial first sets symbols on a buffer. - -- Takes a single `bufnr` argument. - on_first_symbols = nil, - - -- Automatically open aerial when entering supported buffers. - -- This can be a function (see :help aerial-open-automatic) - open_automatic = false, - - -- Set to true to only open aerial at the far right/left of the editor - -- Default behavior opens aerial relative to current window - placement_editor_edge = false, - - -- Run this command after jumping to a symbol (false will disable) - post_jump_cmd = "normal! zz", - - -- When true, aerial will automatically close after jumping to a symbol - close_on_select = false, - - -- Show box drawing characters for the tree hierarchy - show_guides = false, - - -- The autocmds that trigger symbols update (not used for LSP backend) - update_events = "TextChanged,InsertLeave", - - -- Customize the characters used when show_guides = true - guides = { - -- When the child item has a sibling below it - mid_item = "├─", - -- When the child item is the last in the list - last_item = "└─", - -- When there are nested child guides to the right - nested_top = "│ ", - -- Raw indentation - whitespace = " ", - }, - - -- Options for opening aerial in a floating win - float = { - -- Controls border appearance. Passed to nvim_open_win - border = "rounded", - - -- Enum: cursor, editor, win - -- cursor - Opens float on top of the cursor - -- editor - Opens float centered in the editor - -- win - Opens float centered in the window - relative = "cursor", - - -- These control the height of the floating window. - -- They can be integers or a float between 0 and 1 (e.g. 0.4 for 40%) - -- min_height and max_height can be a list of mixed types. - -- min_height = {8, 0.1} means "the greater of 8 rows or 10% of total" - max_height = 0.9, - height = nil, - min_height = { 8, 0.1 }, - - override = function(conf) - -- This is the config that will be passed to nvim_open_win. - -- Change values here to customize the layout - return conf - end, - }, - - lsp = { - -- Fetch document symbols when LSP diagnostics update. - -- If false, will update on buffer changes. - diagnostics_trigger_update = true, - - -- Set to false to not update the symbols when there are LSP errors - update_when_errors = true, - - -- How long to wait (in ms) after a buffer change before updating - -- Only used when diagnostics_trigger_update = false - update_delay = 300, - }, - - treesitter = { - -- How long to wait (in ms) after a buffer change before updating - update_delay = 300, - }, - - markdown = { - -- How long to wait (in ms) after a buffer change before updating - update_delay = 300, - }, + -- Priority list of preferred backends for aerial. + -- This can be a filetype map (see :help aerial-filetype-map) + backends = { "treesitter", "lsp", "markdown" }, + + -- Enum: persist, close, auto, global + -- persist - aerial window will stay open until closed + -- close - aerial window will close when original file is no longer visible + -- auto - aerial window will stay open as long as there is a visible + -- buffer to attach to + -- global - same as 'persist', and will always show symbols for the current buffer + close_behavior = "auto", + + -- Set to false to remove the default keybindings for the aerial buffer + default_bindings = true, + + -- Enum: prefer_right, prefer_left, right, left, float + -- Determines the default direction to open the aerial window. The 'prefer' + -- options will open the window in the other direction *if* there is a + -- different buffer in the way of the preferred direction + default_direction = "prefer_right", + + -- Disable aerial on files with this many lines + disable_max_lines = 10000, + + -- Disable aerial on files this size or larger (in bytes) + disable_max_size = 2000000, -- Default 2MB + + -- A list of all symbols to display. Set to false to display all symbols. + -- This can be a filetype map (see :help aerial-filetype-map) + -- To see all available values, see :help SymbolKind + filter_kind = { + "Array", + "Boolean", + "Class", + "Constant", + "Constructor", + "Enum", + "EnumMember", + "Event", + "Field", + "File", + "Function", + "Interface", + "Key", + "Method", + "Module", + "Namespace", + "Null", + "Number", + "Object", + "Operator", + "Package", + "Property", + "String", + "Struct", + "TypeParameter", + "Variable", + }, + + -- Enum: split_width, full_width, last, none + -- Determines line highlighting mode when multiple splits are visible. + -- split_width Each open window will have its cursor location marked in the + -- aerial buffer. Each line will only be partially highlighted + -- to indicate which window is at that location. + -- full_width Each open window will have its cursor location marked as a + -- full-width highlight in the aerial buffer. + -- last Only the most-recently focused window will have its location + -- marked in the aerial buffer. + -- none Do not show the cursor locations in the aerial window. + highlight_mode = "split_width", + + -- Highlight the closest symbol if the cursor is not exactly on one. + highlight_closest = true, + + -- Highlight the symbol in the source buffer when cursor is in the aerial win + highlight_on_hover = false, + + -- When jumping to a symbol, highlight the line for this many ms. + -- Set to false to disable + highlight_on_jump = 300, + + -- Define symbol icons. You can also specify "Collapsed" to change the + -- icon when the tree is collapsed at that symbol, or "Collapsed" to specify a + -- default collapsed icon. The default icon set is determined by the + -- "nerd_font" option below. + -- If you have lspkind-nvim installed, it will be the default icon set. + -- This can be a filetype map (see :help aerial-filetype-map) + icons = {}, + + -- Control which windows and buffers aerial should ignore. + -- If close_behavior is "global", focusing an ignored window/buffer will + -- not cause the aerial window to update. + -- If open_automatic is true, focusing an ignored window/buffer will not + -- cause an aerial window to open. + -- If open_automatic is a function, ignore rules have no effect on aerial + -- window opening behavior; it's entirely handled by the open_automatic + -- function. + ignore = { + -- Ignore unlisted buffers. See :help buflisted + unlisted_buffers = true, + + -- List of filetypes to ignore. + filetypes = {}, + + -- Ignored buftypes. + -- Can be one of the following: + -- false or nil - No buftypes are ignored. + -- "special" - All buffers other than normal buffers are ignored. + -- table - A list of buftypes to ignore. See :help buftype for the + -- possible values. + -- function - A function that returns true if the buffer should be + -- ignored or false if it should not be ignored. + -- Takes two arguments, `bufnr` and `buftype`. + buftypes = "special", + + -- Ignored wintypes. + -- Can be one of the following: + -- false or nil - No wintypes are ignored. + -- "special" - All windows other than normal windows are ignored. + -- table - A list of wintypes to ignore. See :help win_gettype() for the + -- possible values. + -- function - A function that returns true if the window should be + -- ignored or false if it should not be ignored. + -- Takes two arguments, `winid` and `wintype`. + wintypes = "special", + }, + + -- When you fold code with za, zo, or zc, update the aerial tree as well. + -- Only works when manage_folds = true + link_folds_to_tree = false, + + -- Fold code when you open/collapse symbols in the tree. + -- Only works when manage_folds = true + link_tree_to_folds = true, + + -- Use symbol tree for folding. Set to true or false to enable/disable + -- 'auto' will manage folds if your previous foldmethod was 'manual' + manage_folds = false, + + -- These control the width of the aerial window. + -- They can be integers or a float between 0 and 1 (e.g. 0.4 for 40%) + -- min_width and max_width can be a list of mixed types. + -- max_width = {40, 0.2} means "the lesser of 40 columns or 20% of total" + max_width = { 40, 0.2 }, + width = nil, + min_width = 32, + + -- Set default symbol icons to use patched font icons (see https://www.nerdfonts.com/) + -- "auto" will set it to true if nvim-web-devicons or lspkind-nvim is installed. + nerd_font = "true", + + -- Call this function when aerial attaches to a buffer. + -- Useful for setting keymaps. Takes a single `bufnr` argument. + on_attach = nil, + + -- Call this function when aerial first sets symbols on a buffer. + -- Takes a single `bufnr` argument. + on_first_symbols = nil, + + -- Automatically open aerial when entering supported buffers. + -- This can be a function (see :help aerial-open-automatic) + open_automatic = false, + + -- Set to true to only open aerial at the far right/left of the editor + -- Default behavior opens aerial relative to current window + placement_editor_edge = false, + + -- Run this command after jumping to a symbol (false will disable) + post_jump_cmd = "normal! zz", + + -- When true, aerial will automatically close after jumping to a symbol + close_on_select = false, + + -- Show box drawing characters for the tree hierarchy + show_guides = false, + + -- The autocmds that trigger symbols update (not used for LSP backend) + update_events = "TextChanged,InsertLeave", + + -- Customize the characters used when show_guides = true + guides = { + -- When the child item has a sibling below it + mid_item = "├─", + -- When the child item is the last in the list + last_item = "└─", + -- When there are nested child guides to the right + nested_top = "│ ", + -- Raw indentation + whitespace = " ", + }, + + -- Options for opening aerial in a floating win + float = { + -- Controls border appearance. Passed to nvim_open_win + border = "rounded", + + -- Enum: cursor, editor, win + -- cursor - Opens float on top of the cursor + -- editor - Opens float centered in the editor + -- win - Opens float centered in the window + relative = "cursor", + + -- These control the height of the floating window. + -- They can be integers or a float between 0 and 1 (e.g. 0.4 for 40%) + -- min_height and max_height can be a list of mixed types. + -- min_height = {8, 0.1} means "the greater of 8 rows or 10% of total" + max_height = 0.9, + height = nil, + min_height = { 8, 0.1 }, + + override = function(conf) + -- This is the config that will be passed to nvim_open_win. + -- Change values here to customize the layout + return conf + end, + }, + + lsp = { + -- Fetch document symbols when LSP diagnostics update. + -- If false, will update on buffer changes. + diagnostics_trigger_update = true, + + -- Set to false to not update the symbols when there are LSP errors + update_when_errors = true, + + -- How long to wait (in ms) after a buffer change before updating + -- Only used when diagnostics_trigger_update = false + update_delay = 300, + }, + + treesitter = { + -- How long to wait (in ms) after a buffer change before updating + update_delay = 300, + }, + + markdown = { + -- How long to wait (in ms) after a buffer change before updating + update_delay = 300, + }, }) diff --git a/lua/plugins/config/alpha-nvim.lua b/lua/plugins/config/alpha-nvim.lua index b25b6644..847d79e7 100644 --- a/lua/plugins/config/alpha-nvim.lua +++ b/lua/plugins/config/alpha-nvim.lua @@ -1,26 +1,26 @@ local alpha = require("alpha") local dashboard = require("alpha.themes.dashboard") -dashboard.leader = '\\' +dashboard.leader = "\\" -- Set header dashboard.section.header.val = { - " ", - " ███╗ ██╗███████╗ ██████╗ ██╗ ██╗██╗███╗ ███╗ ", - " ████╗ ██║██╔════╝██╔═══██╗██║ ██║██║████╗ ████║ ", - " ██╔██╗ ██║█████╗ ██║ ██║██║ ██║██║██╔████╔██║ ", - " ██║╚██╗██║██╔══╝ ██║ ██║╚██╗ ██╔╝██║██║╚██╔╝██║ ", - " ██║ ╚████║███████╗╚██████╔╝ ╚████╔╝ ██║██║ ╚═╝ ██║ ", - " ╚═╝ ╚═══╝╚══════╝ ╚═════╝ ╚═══╝ ╚═╝╚═╝ ╚═╝ ", - " ", + " ", + " ███╗ ██╗███████╗ ██████╗ ██╗ ██╗██╗███╗ ███╗ ", + " ████╗ ██║██╔════╝██╔═══██╗██║ ██║██║████╗ ████║ ", + " ██╔██╗ ██║█████╗ ██║ ██║██║ ██║██║██╔████╔██║ ", + " ██║╚██╗██║██╔══╝ ██║ ██║╚██╗ ██╔╝██║██║╚██╔╝██║ ", + " ██║ ╚████║███████╗╚██████╔╝ ╚████╔╝ ██║██║ ╚═╝ ██║ ", + " ╚═╝ ╚═══╝╚══════╝ ╚═════╝ ╚═══╝ ╚═╝╚═╝ ╚═╝ ", + " ", } -- Set menu dashboard.section.buttons.val = { - dashboard.button(" ff", " Find File", ":Telescope find_files"), - dashboard.button(" fg", " Find Word ", ":Telescope live_grep"), - dashboard.button(" fo", " Recent File" , ":Telescope oldfiles"), - dashboard.button(" es", " Settings" , ":e $MYVIMRC | :cd %:p:h "), - dashboard.button(" q ", " Quit NVIM", ":qa"), + dashboard.button(" ff", " Find File", ":Telescope find_files"), + dashboard.button(" fg", " Find Word ", ":Telescope live_grep"), + dashboard.button(" fo", " Recent File", ":Telescope oldfiles"), + dashboard.button(" es", " Settings", ":e $MYVIMRC | :cd %:p:h "), + dashboard.button(" q ", " Quit NVIM", ":qa"), } -- Set footer @@ -46,4 +46,3 @@ alpha.setup(dashboard.opts) vim.cmd([[ autocmd FileType alpha setlocal nofoldenable ]]) - diff --git a/lua/plugins/config/asynctasks.lua b/lua/plugins/config/asynctasks.lua index fdc0f065..1d8fb44e 100644 --- a/lua/plugins/config/asynctasks.lua +++ b/lua/plugins/config/asynctasks.lua @@ -1,8 +1,8 @@ vim.g.asyncrun_open = 20 -vim.g.asyncrun_mode = 'term' -vim.g.asynctasks_term_pos = 'floaterm' +vim.g.asyncrun_mode = "term" +vim.g.asynctasks_term_pos = "floaterm" -- 此配置无效(无效变量) -vim.g.asyncrun_term_pos = 'floaterm' +vim.g.asyncrun_term_pos = "floaterm" -- vim.cmd( -- [[ @@ -60,5 +60,4 @@ vim.g.asyncrun_term_pos = 'floaterm' -- \ ] -- ]]) -- 未实现 -vim.g.asynctasks_template = '~/.config/nvim/config/task_template.ini' - +vim.g.asynctasks_template = "~/.config/nvim/config/task_template.ini" diff --git a/lua/plugins/config/autosave.lua b/lua/plugins/config/autosave.lua index 661d6e0d..46febbcf 100644 --- a/lua/plugins/config/autosave.lua +++ b/lua/plugins/config/autosave.lua @@ -1,19 +1,17 @@ local autosave = require("autosave") -autosave.setup( - { - enabled = true, - execution_message = "AutoSave: saved at " .. vim.fn.strftime("%H:%M:%S"), - events = {"InsertLeave", "TextChanged"}, - conditions = { - exists = true, - filename_is_not = {}, - filetype_is_not = {}, - modifiable = true - }, - write_all_buffers = false, - on_off_commands = true, - clean_command_line_interval = 0, - debounce_delay = 135 - } -) +autosave.setup({ + enabled = true, + execution_message = "AutoSave: saved at " .. vim.fn.strftime("%H:%M:%S"), + events = { "InsertLeave", "TextChanged" }, + conditions = { + exists = true, + filename_is_not = {}, + filetype_is_not = {}, + modifiable = true, + }, + write_all_buffers = false, + on_off_commands = true, + clean_command_line_interval = 0, + debounce_delay = 135, +}) diff --git a/lua/plugins/config/bufferline.lua b/lua/plugins/config/bufferline.lua index 5dad6921..039efd52 100644 --- a/lua/plugins/config/bufferline.lua +++ b/lua/plugins/config/bufferline.lua @@ -1,42 +1,42 @@ -require("bufferline").setup { - options = { - -- 使用 nvim 内置lsp - diagnostics = "nvim_lsp", - diagnostics_indicator = function(count, level, diagnostics_dict, context) - local s = " " - for e, n in pairs(diagnostics_dict) do - local sym = e == "error" and " " - or (e == "warning" and " " or "") - s = s .. n .. sym - end - return s - end, - -- 左侧让出 nvim-tree 的位置 - offsets = { - { - filetype = "NvimTree", - text = function() - -- return "File Explorer" - return vim.fn.fnamemodify(vim.fn.getcwd(), ':p:h:t') - end, - padding = 1, - highlight = "Directory", - -- text_align = "center" - text_align = "left" - }, { - filetype = "Outline", - text = "Outline", - padding = 1, - highlight = "Directory", - text_align = "left" - }, - }, - }, - color_icons = true, - show_buffer_close_icons = true, - show_buffer_default_icon = true, - show_close_icon = false, - show_tab_indicators = true, - -- separator_style = "slant" | "thick" | "thin" | { 'any', 'any' }, - separator_style = "slant", -} +require("bufferline").setup({ + options = { + -- 使用 nvim 内置lsp + diagnostics = "nvim_lsp", + diagnostics_indicator = function(count, level, diagnostics_dict, context) + local s = " " + for e, n in pairs(diagnostics_dict) do + local sym = e == "error" and " " or (e == "warning" and " " or "") + s = s .. n .. sym + end + return s + end, + -- 左侧让出 nvim-tree 的位置 + offsets = { + { + filetype = "NvimTree", + text = function() + -- return "File Explorer" + return vim.fn.fnamemodify(vim.fn.getcwd(), ":p:h:t") + end, + padding = 1, + highlight = "Directory", + -- text_align = "center" + text_align = "left", + }, + { + filetype = "Outline", + text = "Outline", + padding = 1, + highlight = "Directory", + text_align = "left", + }, + }, + }, + color_icons = true, + show_buffer_close_icons = true, + show_buffer_default_icon = true, + show_close_icon = false, + show_tab_indicators = true, + -- separator_style = "slant" | "thick" | "thin" | { 'any', 'any' }, + separator_style = "slant", +}) diff --git a/lua/plugins/config/comment.lua b/lua/plugins/config/comment.lua index a8443238..bd47faf7 100644 --- a/lua/plugins/config/comment.lua +++ b/lua/plugins/config/comment.lua @@ -1 +1 @@ -require('Comment').setup() +require("Comment").setup() diff --git a/lua/plugins/config/dashboard-nvim.lua b/lua/plugins/config/dashboard-nvim.lua index 8e8758c8..fb56a4dd 100644 --- a/lua/plugins/config/dashboard-nvim.lua +++ b/lua/plugins/config/dashboard-nvim.lua @@ -7,13 +7,13 @@ g.dashboard_default_executive = "telescope" -- } local startify_ascii_header = { - ' ▟▙ ', - ' ▝▘ ', - '██▃▅▇█▆▖ ▗▟████▙▖ ▄████▄ ██▄ ▄██ ██ ▗▟█▆▄▄▆█▙▖', - '██▛▔ ▝██ ██▄▄▄▄██ ██▛▔▔▜██ ▝██ ██▘ ██ ██▛▜██▛▜██', - '██ ██ ██▀▀▀▀▀▘ ██▖ ▗██ ▜█▙▟█▛ ██ ██ ██ ██', - '██ ██ ▜█▙▄▄▄▟▊ ▀██▙▟██▀ ▝████▘ ██ ██ ██ ██', - '▀▀ ▀▀ ▝▀▀▀▀▀ ▀▀▀▀ ▀▀ ▀▀ ▀▀ ▀▀ ▀▀', - '', - } + " ▟▙ ", + " ▝▘ ", + "██▃▅▇█▆▖ ▗▟████▙▖ ▄████▄ ██▄ ▄██ ██ ▗▟█▆▄▄▆█▙▖", + "██▛▔ ▝██ ██▄▄▄▄██ ██▛▔▔▜██ ▝██ ██▘ ██ ██▛▜██▛▜██", + "██ ██ ██▀▀▀▀▀▘ ██▖ ▗██ ▜█▙▟█▛ ██ ██ ██ ██", + "██ ██ ▜█▙▄▄▄▟▊ ▀██▙▟██▀ ▝████▘ ██ ██ ██ ██", + "▀▀ ▀▀ ▝▀▀▀▀▀ ▀▀▀▀ ▀▀ ▀▀ ▀▀ ▀▀ ▀▀", + "", +} g.dashboard_custom_header = startify_ascii_header diff --git a/lua/plugins/config/feline.lua b/lua/plugins/config/feline.lua index 8f2fddfd..30516e42 100644 --- a/lua/plugins/config/feline.lua +++ b/lua/plugins/config/feline.lua @@ -1 +1 @@ -require('feline').setup() +require("feline").setup() diff --git a/lua/plugins/config/formatter.lua b/lua/plugins/config/formatter.lua index 8003d8c5..c1163c5f 100644 --- a/lua/plugins/config/formatter.lua +++ b/lua/plugins/config/formatter.lua @@ -1,28 +1,28 @@ local prettierConfig = function() - return { - exe = "prettier", - args = { "--stdin-filepath", vim.fn.shellescape(vim.api.nvim_buf_get_name(0)), "--single-quote" }, - stdin = true - } + return { + exe = "prettier", + args = { "--stdin-filepath", vim.fn.shellescape(vim.api.nvim_buf_get_name(0)), "--single-quote" }, + stdin = true, + } end -require("formatter").setup( - { - filetype = { - -- lua = {function() return {exe = "lua-format", stdin = true} end}, - json = { prettierConfig }, - html = { prettierConfig }, - javascript = { prettierConfig }, - typescript = { prettierConfig }, - typescriptreact = { prettierConfig }, - markdown = { prettierConfig }, - sql = { function() - return { - exe = "sql-formatter", - args = { vim.fn.shellescape(vim.api.nvim_buf_get_name(0)) }, - stdin = true, - } - end } - } - } -) +require("formatter").setup({ + filetype = { + -- lua = {function() return {exe = "lua-format", stdin = true} end}, + json = { prettierConfig }, + html = { prettierConfig }, + javascript = { prettierConfig }, + typescript = { prettierConfig }, + typescriptreact = { prettierConfig }, + markdown = { prettierConfig }, + sql = { + function() + return { + exe = "sql-formatter", + args = { vim.fn.shellescape(vim.api.nvim_buf_get_name(0)) }, + stdin = true, + } + end, + }, + }, +}) diff --git a/lua/plugins/config/gitsigns-nvim.lua b/lua/plugins/config/gitsigns-nvim.lua index 82375cd7..e8ceaffe 100644 --- a/lua/plugins/config/gitsigns-nvim.lua +++ b/lua/plugins/config/gitsigns-nvim.lua @@ -1,45 +1,44 @@ - -require('gitsigns').setup { - signs = { - add = { hl = "DiffAdd", text = "│", numhl = "GitSignsAddNr" }, - change = { hl = "DiffChange", text = "│", numhl = "GitSignsChangeNr" }, - delete = { hl = "DiffDelete", text = "", numhl = "GitSignsDeleteNr" }, - topdelete = { hl = "DiffDelete", text = "‾", numhl = "GitSignsDeleteNr" }, - changedelete = { hl = "DiffChangeDelete", text = "~", numhl = "GitSignsChangeNr" }, - }, - signcolumn = true, -- Toggle with `:Gitsigns toggle_signs` - numhl = false, -- Toggle with `:Gitsigns toggle_numhl` - linehl = false, -- Toggle with `:Gitsigns toggle_linehl` - word_diff = false, -- Toggle with `:Gitsigns toggle_word_diff` - watch_gitdir = { - interval = 1000, - follow_files = true - }, - attach_to_untracked = true, - current_line_blame = true, -- Toggle with `:Gitsigns toggle_current_line_blame` - current_line_blame_opts = { - virt_text = true, - virt_text_pos = 'eol', -- 'eol' | 'overlay' | 'right_align' - delay = 400, - ignore_whitespace = false, - }, - current_line_blame_formatter = ', - ', - current_line_blame_formatter_opts = { - relative_time = false - }, - sign_priority = 6, - update_debounce = 100, - status_formatter = nil, -- Use default - max_file_length = 40000, - preview_config = { - -- Options passed to nvim_open_win - border = 'single', - style = 'minimal', - relative = 'cursor', - row = 0, - col = 1 - }, - yadm = { - enable = false - }, -} +require("gitsigns").setup({ + signs = { + add = { hl = "DiffAdd", text = "│", numhl = "GitSignsAddNr" }, + change = { hl = "DiffChange", text = "│", numhl = "GitSignsChangeNr" }, + delete = { hl = "DiffDelete", text = "", numhl = "GitSignsDeleteNr" }, + topdelete = { hl = "DiffDelete", text = "‾", numhl = "GitSignsDeleteNr" }, + changedelete = { hl = "DiffChangeDelete", text = "~", numhl = "GitSignsChangeNr" }, + }, + signcolumn = true, -- Toggle with `:Gitsigns toggle_signs` + numhl = false, -- Toggle with `:Gitsigns toggle_numhl` + linehl = false, -- Toggle with `:Gitsigns toggle_linehl` + word_diff = false, -- Toggle with `:Gitsigns toggle_word_diff` + watch_gitdir = { + interval = 1000, + follow_files = true, + }, + attach_to_untracked = true, + current_line_blame = true, -- Toggle with `:Gitsigns toggle_current_line_blame` + current_line_blame_opts = { + virt_text = true, + virt_text_pos = "eol", -- 'eol' | 'overlay' | 'right_align' + delay = 400, + ignore_whitespace = false, + }, + current_line_blame_formatter = ", - ", + current_line_blame_formatter_opts = { + relative_time = false, + }, + sign_priority = 6, + update_debounce = 100, + status_formatter = nil, -- Use default + max_file_length = 40000, + preview_config = { + -- Options passed to nvim_open_win + border = "single", + style = "minimal", + relative = "cursor", + row = 0, + col = 1, + }, + yadm = { + enable = false, + }, +}) diff --git a/lua/plugins/config/indent-blankline.lua b/lua/plugins/config/indent-blankline.lua index 9756592c..9fdd7ed0 100644 --- a/lua/plugins/config/indent-blankline.lua +++ b/lua/plugins/config/indent-blankline.lua @@ -2,18 +2,38 @@ vim.opt.list = true -- vim.opt.listchars:append("space:⋅") -- vim.opt.listchars:append("eol:↴") -require("indent_blankline").setup { - -- show_end_of_line = true, - -- space_char_blankline = " ", - show_current_context = true, - -- show_current_context_start = true, - disable_with_nolist = true, - -- filetype_exclude = { "help", "terminal", "packer", "NvimTree", "git", "text" }, - filetype_exclude = { "help", "terminal", "packer", "markdown", "git", "text", "NvimTree", "dashboard", "alpha", "Outline" }, - buftype_exclude = { "terminal" }, - use_treesitter = true, - context_patterns = { - "class", "function", "method", "block", "list_literal", "selector", - "^if", "^table", "if_statement", "while", "for", - }, -} +require("indent_blankline").setup({ + -- show_end_of_line = true, + -- space_char_blankline = " ", + show_current_context = true, + -- show_current_context_start = true, + disable_with_nolist = true, + -- filetype_exclude = { "help", "terminal", "packer", "NvimTree", "git", "text" }, + filetype_exclude = { + "help", + "terminal", + "packer", + "markdown", + "git", + "text", + "NvimTree", + "dashboard", + "alpha", + "Outline", + }, + buftype_exclude = { "terminal" }, + use_treesitter = true, + context_patterns = { + "class", + "function", + "method", + "block", + "list_literal", + "selector", + "^if", + "^table", + "if_statement", + "while", + "for", + }, +}) diff --git a/lua/plugins/config/lsp-colors.lua b/lua/plugins/config/lsp-colors.lua index aaa0b444..3d0ac0e6 100644 --- a/lua/plugins/config/lsp-colors.lua +++ b/lua/plugins/config/lsp-colors.lua @@ -1,7 +1,7 @@ -- Lua require("lsp-colors").setup({ - Error = "#db4b4b", - Warning = "#e0af68", - Information = "#0db9d7", - Hint = "#10B981" + Error = "#db4b4b", + Warning = "#e0af68", + Information = "#0db9d7", + Hint = "#10B981", }) diff --git a/lua/plugins/config/lsp_signature.lua b/lua/plugins/config/lsp_signature.lua index 7b5ebcbe..ffc3ee51 100644 --- a/lua/plugins/config/lsp_signature.lua +++ b/lua/plugins/config/lsp_signature.lua @@ -1,11 +1,9 @@ - require("lsp_signature").on_attach({ - bind = true, - use_lspsaga = false, - floating_window = true, - fix_pos = true, - hint_enable = true, - hi_parameter = "Search", - handler_opts = {"double"} + bind = true, + use_lspsaga = false, + floating_window = true, + fix_pos = true, + hint_enable = true, + hi_parameter = "Search", + handler_opts = { "double" }, }) - diff --git a/lua/plugins/config/lspsaga.lua b/lua/plugins/config/lspsaga.lua index cee61735..d0453813 100644 --- a/lua/plugins/config/lspsaga.lua +++ b/lua/plugins/config/lspsaga.lua @@ -1,5 +1,4 @@ - -local saga = require 'lspsaga' +local saga = require("lspsaga") -- add your config value here -- default value @@ -38,11 +37,11 @@ local saga = require 'lspsaga' -- server_filetype_map = {} saga.init_lsp_saga({ - error_sign = '', - warn_sign = '', - hint_sign = '', - infor_sign = '', - code_action_prompt = { - enable = false, - }, + error_sign = "", + warn_sign = "", + hint_sign = "", + infor_sign = "", + code_action_prompt = { + enable = false, + }, }) diff --git a/lua/plugins/config/lualine.lua b/lua/plugins/config/lualine.lua index 83d23c0a..5df14faa 100644 --- a/lua/plugins/config/lualine.lua +++ b/lua/plugins/config/lualine.lua @@ -1,73 +1,71 @@ local config = { - options = { - icons_enabled = true, - theme = 'gruvbox', - component_separators = { left = '', right = '' }, - section_separators = { left = '', right = '' }, - disabled_filetypes = { - -- "dap-repl", "dapui_watches", "dapui_stacks", "dapui_breakpoints", "dapui_scopes" - }, - always_divide_middle = true, - }, - sections = { - lualine_a = { 'mode' }, - lualine_b = { 'branch', 'diff', 'diagnostics' }, - -- lualine_c = {'filename', 'lsp_progress'}, - lualine_c = { 'filename' }, - lualine_x = { 'encoding', 'fileformat', 'filetype' }, - lualine_y = { 'progress' }, - lualine_z = { 'location' } - }, - inactive_sections = { - lualine_a = {}, - -- lualine_b = {function() return require('lsp-status').status() end}, - lualine_b = {}, - lualine_c = { 'filename' }, - lualine_x = { 'location' }, - lualine_y = {}, - lualine_z = {} - }, - tabline = {}, - extensions = { 'quickfix', 'toggleterm', 'nvim-tree', 'fugitive', 'symbols-outline', 'nvim-dap-ui' } + options = { + icons_enabled = true, + theme = "gruvbox", + component_separators = { left = "", right = "" }, + section_separators = { left = "", right = "" }, + disabled_filetypes = { + -- "dap-repl", "dapui_watches", "dapui_stacks", "dapui_breakpoints", "dapui_scopes" + }, + always_divide_middle = true, + }, + sections = { + lualine_a = { "mode" }, + lualine_b = { "branch", "diff", "diagnostics" }, + -- lualine_c = {'filename', 'lsp_progress'}, + lualine_c = { "filename" }, + lualine_x = { "encoding", "fileformat", "filetype" }, + lualine_y = { "progress" }, + lualine_z = { "location" }, + }, + inactive_sections = { + lualine_a = {}, + -- lualine_b = {function() return require('lsp-status').status() end}, + lualine_b = {}, + lualine_c = { "filename" }, + lualine_x = { "location" }, + lualine_y = {}, + lualine_z = {}, + }, + tabline = {}, + extensions = { "quickfix", "toggleterm", "nvim-tree", "fugitive", "symbols-outline", "nvim-dap-ui" }, } -local dap = { -} +local dap = {} dap.sections = { - lualine_a = { - { 'filename', file_status = false } - }, + lualine_a = { + { "filename", file_status = false }, + }, } dap.filetypes = { - "dap-terminal" + "dap-terminal", } table.insert(config.extensions, dap) -- nvim-sqls extensions -local db_connection_value = 'default' -local db_database_value = 'default' +local db_connection_value = "default" +local db_database_value = "default" require("sqls.events").add_subscriber("connection_choice", function(event) - local cs = vim.split(event.choice, ' '); - db_connection_value = cs[3] - local db = vim.split(cs[4], '/') - if db[2] and db_database_value == 'default' then - db_database_value = db[2] - end + local cs = vim.split(event.choice, " ") + db_connection_value = cs[3] + local db = vim.split(cs[4], "/") + if db[2] and db_database_value == "default" then + db_database_value = db[2] + end end) require("sqls.events").add_subscriber("database_choice", function(event) - db_database_value = event.choice + db_database_value = event.choice end) local function db_info() - return db_connection_value .. '->' .. db_database_value + return db_connection_value .. "->" .. db_database_value end -local sqls = { -} +local sqls = {} sqls.sections = vim.deepcopy(config.sections) table.insert(sqls.sections.lualine_c, db_info) sqls.filetypes = { - "sql" + "sql", } table.insert(config.extensions, sqls) -require('lualine').setup(config) +require("lualine").setup(config) diff --git a/lua/plugins/config/luasnip.lua b/lua/plugins/config/luasnip.lua index 25fde2c1..f26b07c6 100644 --- a/lua/plugins/config/luasnip.lua +++ b/lua/plugins/config/luasnip.lua @@ -36,14 +36,14 @@ ls.config.set_config({ ext_opts = { [types.choiceNode] = { active = { - virt_text = {{"●", "GruvboxOrange"}} - } + virt_text = { { "●", "GruvboxOrange" } }, + }, }, [types.insertNode] = { active = { - virt_text = {{"●", "GruvboxBlue"}} - } - } + virt_text = { { "●", "GruvboxBlue" } }, + }, + }, }, -- treesitter-hl has 100, use something higher (default is 200). @@ -121,10 +121,7 @@ local function jdocsnip(args, _, old_state) else inode = i(insert) end - vim.list_extend( - nodes, - { t({ " * @param " .. arg .. " " }), inode, t({ "", "" }) } - ) + vim.list_extend(nodes, { t({ " * @param " .. arg .. " " }), inode, t({ "", "" }) }) param_nodes["arg" .. arg] = inode insert = insert + 1 @@ -139,10 +136,7 @@ local function jdocsnip(args, _, old_state) inode = i(insert) end - vim.list_extend( - nodes, - { t({ " * ", " * @return " }), inode, t({ "", "" }) } - ) + vim.list_extend(nodes, { t({ " * ", " * @return " }), inode, t({ "", "" }) }) param_nodes.ret = inode insert = insert + 1 end @@ -155,10 +149,7 @@ local function jdocsnip(args, _, old_state) else ins = i(insert) end - vim.list_extend( - nodes, - { t({ " * ", " * @throws " .. exc .. " " }), ins, t({ "", "" }) } - ) + vim.list_extend(nodes, { t({ " * ", " * @throws " .. exc .. " " }), ins, t({ "", "" }) }) param_nodes.ex = ins insert = insert + 1 end @@ -288,17 +279,11 @@ ls.snippets = { }) ), -- The delimiters can be changed from the default `{}` to something else. - s( - "fmt4", - fmt("foo() { return []; }", i(1, "x"), { delimiters = "[]" }) - ), + s("fmt4", fmt("foo() { return []; }", i(1, "x"), { delimiters = "[]" })), -- `fmta` is a convenient wrapper that uses `<>` instead of `{}`. s("fmt5", fmta("foo() { return <>; }", i(1, "x"))), -- By default all args must be used. Use strict=false to disable the check - s( - "fmt6", - fmt("use {} only", { t("this"), t("not this") }, { strict = false }) - ), + s("fmt6", fmt("use {} only", { t("this"), t("not this") }, { strict = false })), -- Use a dynamic_node to interpolate the output of a -- function (see date_input above) into the initial -- value of an insert_node. @@ -310,16 +295,10 @@ ls.snippets = { -- Parsing snippets: First parameter: Snippet-Trigger, Second: Snippet body. -- Placeholders are parsed into choices with 1. the placeholder text(as a snippet) and 2. an empty string. -- This means they are not SELECTed like in other editors/Snippet engines. - ls.parser.parse_snippet( - "lspsyn", - "Wow! This ${1:Stuff} really ${2:works. ${3:Well, a bit.}}" - ), + ls.parser.parse_snippet("lspsyn", "Wow! This ${1:Stuff} really ${2:works. ${3:Well, a bit.}}"), -- When wordTrig is set to false, snippets may also expand inside other words. - ls.parser.parse_snippet( - { trig = "te", wordTrig = false }, - "${1:cond} ? ${2:true} : ${3:false}" - ), + ls.parser.parse_snippet({ trig = "te", wordTrig = false }, "${1:cond} ? ${2:true} : ${3:false}"), -- When regTrig is set, trig is treated like a pattern, this snippet will expand after any number. ls.parser.parse_snippet({ trig = "%d", regTrig = true }, "A Number!!"), @@ -421,11 +400,7 @@ ls.snippets = { s("mat3", { i(1, { "sample_text" }), t(": "), - m( - 1, - l._1:gsub("[123]", ""):match("%d"), - "contains a number that isn't 1, 2 or 3!" - ), + m(1, l._1:gsub("[123]", ""):match("%d"), "contains a number that isn't 1, 2 or 3!"), }), -- `match` also accepts a function in place of the condition, which in -- turn accepts the usual functionNode-args. diff --git a/lua/plugins/config/null-ls.lua b/lua/plugins/config/null-ls.lua index 2e6f1ccb..87ab010a 100644 --- a/lua/plugins/config/null-ls.lua +++ b/lua/plugins/config/null-ls.lua @@ -2,47 +2,63 @@ local null_ls = require("null-ls") -- register any number of sources simultaneously local sources = { - null_ls.builtins.formatting.prettier.with({ - filetypes = { "javascript", "javascriptreact", "typescript", "typescriptreact", "vue", "css", "scss", "less", "html", - "json", "jsonc", "yaml", "markdown", "graphql", "handlebars" }, - }), - -- null_ls.builtins.formatting.jq, - -- xml - null_ls.builtins.formatting.xmllint, - -- toml - null_ls.builtins.formatting.taplo, - -- sh - null_ls.builtins.code_actions.shellcheck, - null_ls.builtins.diagnostics.shellcheck, - null_ls.builtins.formatting.shellharden, - -- word - null_ls.builtins.diagnostics.write_good.with({ - method = null_ls.methods.DIAGNOSTICS_ON_SAVE, - }), - -- md - null_ls.builtins.diagnostics.markdownlint.with({ - method = null_ls.methods.DIAGNOSTICS_ON_SAVE, - }), - -- null_ls.builtins.code_actions.gitsigns, - -- sql - null_ls.builtins.formatting.sql_formatter, - -- null_ls.builtins.formatting.google_java_format, - -- null_ls.builtins.diagnostics.semgrep, - null_ls.builtins.diagnostics.semgrep.with({ - method = null_ls.methods.DIAGNOSTICS_ON_SAVE, - extra_args = { "--config", "p/java" }, - }), + null_ls.builtins.formatting.prettier.with({ + filetypes = { + "javascript", + "javascriptreact", + "typescript", + "typescriptreact", + "vue", + "css", + "scss", + "less", + "html", + "json", + "jsonc", + "yaml", + "markdown", + "graphql", + "handlebars", + }, + }), + -- null_ls.builtins.formatting.jq, + -- xml + null_ls.builtins.formatting.xmllint, + -- toml + null_ls.builtins.formatting.taplo, + -- sh + null_ls.builtins.code_actions.shellcheck, + null_ls.builtins.diagnostics.shellcheck, + null_ls.builtins.formatting.shellharden, + -- lua + null_ls.builtins.formatting.stylua, + -- word + null_ls.builtins.diagnostics.write_good.with({ + method = null_ls.methods.DIAGNOSTICS_ON_SAVE, + }), + -- md + null_ls.builtins.diagnostics.markdownlint.with({ + method = null_ls.methods.DIAGNOSTICS_ON_SAVE, + }), + -- null_ls.builtins.code_actions.gitsigns, + -- sql + null_ls.builtins.formatting.sql_formatter, + -- null_ls.builtins.formatting.google_java_format, + -- null_ls.builtins.diagnostics.semgrep, + null_ls.builtins.diagnostics.semgrep.with({ + method = null_ls.methods.DIAGNOSTICS_ON_SAVE, + extra_args = { "--config", "p/java" }, + }), } - local lsp_formatting = function(bufnr) - vim.lsp.buf.format({ - filter = function(client) - -- apply whatever logic you want (in this example, we'll only use null-ls) - return client.name == "null-ls" - end, - bufnr = bufnr, - }) + vim.lsp.buf.format({ + filter = function(client) + -- apply whatever logic you want (in this example, we'll only use null-ls) + return client.name == "null-ls" + end, + bufnr = bufnr, + }) end -- if you want to set up formatting on save, you can use this as a callback @@ -50,24 +66,23 @@ local augroup = vim.api.nvim_create_augroup("LspFormatting", {}) -- add to your shared on_attach callback local on_attach = function(client, bufnr) - if client.supports_method("textDocument/formatting") then - vim.api.nvim_clear_autocmds({ group = augroup, buffer = bufnr }) - vim.api.nvim_create_autocmd("BufWritePre", { - group = augroup, - buffer = bufnr, - callback = function() - lsp_formatting(bufnr) - end, - }) - end + if client.supports_method("textDocument/formatting") then + vim.api.nvim_clear_autocmds({ group = augroup, buffer = bufnr }) + vim.api.nvim_create_autocmd("BufWritePre", { + group = augroup, + buffer = bufnr, + callback = function() + lsp_formatting(bufnr) + end, + }) + end end - null_ls.setup({ - sources = sources, - on_attach = function(client, bufnr) - require('core.keybindings').maplsp(client, bufnr) - -- on_attach(client, bufnr) - end, - -- debug = true, + sources = sources, + on_attach = function(client, bufnr) + require("core.keybindings").maplsp(client, bufnr) + -- on_attach(client, bufnr) + end, + -- debug = true, }) diff --git a/lua/plugins/config/nvim-autopairs.lua b/lua/plugins/config/nvim-autopairs.lua index 5fd913a5..bdc3eaf3 100644 --- a/lua/plugins/config/nvim-autopairs.lua +++ b/lua/plugins/config/nvim-autopairs.lua @@ -1,6 +1,5 @@ -local autopairs = require ("nvim-autopairs") -local cmp_autopairs = require ("nvim-autopairs.completion.cmp") +local autopairs = require("nvim-autopairs") +local cmp_autopairs = require("nvim-autopairs.completion.cmp") autopairs.setup({}) -local cmp = require ("cmp") +local cmp = require("cmp") cmp.event:on("confirm_done", cmp_autopairs.on_confirm_done()) - diff --git a/lua/plugins/config/nvim-cmp.lua b/lua/plugins/config/nvim-cmp.lua index 575b459e..04b19584 100644 --- a/lua/plugins/config/nvim-cmp.lua +++ b/lua/plugins/config/nvim-cmp.lua @@ -1,60 +1,60 @@ -local lspkind = require('lspkind') -local cmp = require'cmp' +local lspkind = require("lspkind") +local cmp = require("cmp") -cmp.setup { - -- 指定 snippet 引擎 - snippet = { - expand = function(args) - -- For `vsnip` users. - -- vim.fn["vsnip#anonymous"](args.body) +cmp.setup({ + -- 指定 snippet 引擎 + snippet = { + expand = function(args) + -- For `vsnip` users. + -- vim.fn["vsnip#anonymous"](args.body) - -- For `luasnip` users. - require('luasnip').lsp_expand(args.body) + -- For `luasnip` users. + require("luasnip").lsp_expand(args.body) - -- For `ultisnips` users. - -- vim.fn["UltiSnips#Anon"](args.body) + -- For `ultisnips` users. + -- vim.fn["UltiSnips#Anon"](args.body) - -- For `snippy` users. - -- require'snippy'.expand_snippet(args.body) - end, - }, - -- 来源 - sources = cmp.config.sources({ - { name = 'nvim_lsp' }, - -- For vsnip users. - -- { name = 'vsnip' }, - -- For luasnip users. - { name = 'luasnip' }, - --For ultisnips users. - -- { name = 'ultisnips' }, - -- -- For snippy users. - -- { name = 'snippy' }, - }, { - { name = 'buffer' }, - { name = 'path' } - }), + -- For `snippy` users. + -- require'snippy'.expand_snippet(args.body) + end, + }, + -- 来源 + sources = cmp.config.sources({ + { name = "nvim_lsp" }, + -- For vsnip users. + -- { name = 'vsnip' }, + -- For luasnip users. + { name = "luasnip" }, + --For ultisnips users. + -- { name = 'ultisnips' }, + -- -- For snippy users. + -- { name = 'snippy' }, + }, { + { name = "buffer" }, + { name = "path" }, + }), - -- 快捷键 - mapping = require'core.keybindings'.cmp(cmp), - -- 使用lspkind-nvim显示类型图标 - formatting = { - format = lspkind.cmp_format({ - with_text = true, -- do not show text alongside icons - maxwidth = 50, -- prevent the popup from showing more than provided characters (e.g 50 will not show more than 50 characters) - before = function (entry, vim_item) - -- Source 显示提示来源 - vim_item.menu = "["..string.upper(entry.source.name).."]" - return vim_item - end, - menu = { - nvim_lsp = "[LSP]", - luasnip = "[Lsnip]", - path = "[Path]", - -- buffer = "[Buffer]", - }, - }) - }, -} + -- 快捷键 + mapping = require("core.keybindings").cmp(cmp), + -- 使用lspkind-nvim显示类型图标 + formatting = { + format = lspkind.cmp_format({ + with_text = true, -- do not show text alongside icons + maxwidth = 50, -- prevent the popup from showing more than provided characters (e.g 50 will not show more than 50 characters) + before = function(entry, vim_item) + -- Source 显示提示来源 + vim_item.menu = "[" .. string.upper(entry.source.name) .. "]" + return vim_item + end, + menu = { + nvim_lsp = "[LSP]", + luasnip = "[Lsnip]", + path = "[Path]", + -- buffer = "[Buffer]", + }, + }), + }, +}) -- Use buffer source for `/`. -- cmp.setup.cmdline('/', { diff --git a/lua/plugins/config/nvim-colorizer.lua b/lua/plugins/config/nvim-colorizer.lua index 046edf63..cf5503d1 100644 --- a/lua/plugins/config/nvim-colorizer.lua +++ b/lua/plugins/config/nvim-colorizer.lua @@ -1,24 +1,22 @@ - local present, colorizer = pcall(require, "colorizer") if present then - local default = { - filetypes = { - "*", - }, - user_default_options = { - RGB = true, -- #RGB hex codes - RRGGBB = true, -- #RRGGBB hex codes - names = false, -- "Name" codes like Blue - RRGGBBAA = false, -- #RRGGBBAA hex codes - rgb_fn = false, -- CSS rgb() and rgba() functions - hsl_fn = false, -- CSS hsl() and hsla() functions - css = false, -- Enable all CSS features: rgb_fn, hsl_fn, names, RGB, RRGGBB - css_fn = false, -- Enable all CSS *functions*: rgb_fn, hsl_fn + local default = { + filetypes = { + "*", + }, + user_default_options = { + RGB = true, -- #RGB hex codes + RRGGBB = true, -- #RRGGBB hex codes + names = false, -- "Name" codes like Blue + RRGGBBAA = false, -- #RRGGBBAA hex codes + rgb_fn = false, -- CSS rgb() and rgba() functions + hsl_fn = false, -- CSS hsl() and hsla() functions + css = false, -- Enable all CSS features: rgb_fn, hsl_fn, names, RGB, RRGGBB + css_fn = false, -- Enable all CSS *functions*: rgb_fn, hsl_fn - -- Available modes: foreground, background - mode = "background", -- Set the display mode. - }, - } - colorizer.setup(default["filetypes"], default["user_default_options"]) + -- Available modes: foreground, background + mode = "background", -- Set the display mode. + }, + } + colorizer.setup(default["filetypes"], default["user_default_options"]) end - diff --git a/lua/plugins/config/nvim-dap.lua b/lua/plugins/config/nvim-dap.lua index 5953f617..24b0ef37 100644 --- a/lua/plugins/config/nvim-dap.lua +++ b/lua/plugins/config/nvim-dap.lua @@ -1,50 +1,48 @@ -local dap = require('dap') +local dap = require("dap") -- dap.defaults.fallback.terminal_win_cmd = '50vsplit new' -- dap.defaults.fallback.focus_terminal = true -- dap.defaults.fallback.external_terminal = { -- command = '/opt/homebrew/bin/alacritty'; -- args = { '-e' }; -- } -local dapui = require('dapui') -dapui.setup( - { - layouts = { - { - elements = { - 'scopes', - 'breakpoints', - 'stacks', - 'watches', - }, - size = 40, - position = 'left', - }, - { - elements = { - 'repl', - -- 'console', - }, - size = 12, - position = 'bottom', - }, - } - } -) +local dapui = require("dapui") +dapui.setup({ + layouts = { + { + elements = { + "scopes", + "breakpoints", + "stacks", + "watches", + }, + size = 40, + position = "left", + }, + { + elements = { + "repl", + -- 'console', + }, + size = 12, + position = "bottom", + }, + }, +}) -dap.defaults.fallback.terminal_win_cmd = 'belowright 12new | set filetype=dap-terminal' +dap.defaults.fallback.terminal_win_cmd = "belowright 12new | set filetype=dap-terminal" dap.listeners.after.event_initialized["dapui_config"] = function() - dapui.open() + dapui.open() end dap.listeners.before.event_terminated["dapui_config"] = function() - dapui.close() + dapui.close() end dap.listeners.before.event_exited["dapui_config"] = function() - dapui.close() + dapui.close() end -- vim.fn.sign_define('DapBreakpoint', { text = '🔴', texthl = '', linehl = '', numhl = '' }) -vim.fn.sign_define('DapBreakpoint', { text = '', texthl = 'Debug', linehl = '', numhl = '' }) +vim.fn.sign_define("DapBreakpoint", { text = "", texthl = "Debug", linehl = "", numhl = "" }) -- vim.fn.sign_define("DapBreakpointCondition", { text = "C", texthl = "", linehl = "", numhl = "" }) -- vim.fn.sign_define('DapBreakpointRejected', {text='R', texthl='', linehl='', numhl=''}) -- vim.fn.sign_define('DapLogPoint', {text='L', texthl='', linehl='', numhl=''}) diff --git a/lua/plugins/config/nvim-lsputils.lua b/lua/plugins/config/nvim-lsputils.lua index a0635b93..85a506e1 100644 --- a/lua/plugins/config/nvim-lsputils.lua +++ b/lua/plugins/config/nvim-lsputils.lua @@ -1,79 +1,78 @@ -if vim.fn.has('nvim-0.5.1') == 1 then - vim.lsp.handlers['textDocument/codeAction'] = require'lsputil.codeAction'.code_action_handler - vim.lsp.handlers['textDocument/references'] = require'lsputil.locations'.references_handler - vim.lsp.handlers['textDocument/definition'] = require'lsputil.locations'.definition_handler - vim.lsp.handlers['textDocument/declaration'] = require'lsputil.locations'.declaration_handler - vim.lsp.handlers['textDocument/typeDefinition'] = require'lsputil.locations'.typeDefinition_handler - vim.lsp.handlers['textDocument/implementation'] = require'lsputil.locations'.implementation_handler - vim.lsp.handlers['textDocument/documentSymbol'] = require'lsputil.symbols'.document_handler - vim.lsp.handlers['workspace/symbol'] = require'lsputil.symbols'.workspace_handler +if vim.fn.has("nvim-0.5.1") == 1 then + vim.lsp.handlers["textDocument/codeAction"] = require("lsputil.codeAction").code_action_handler + vim.lsp.handlers["textDocument/references"] = require("lsputil.locations").references_handler + vim.lsp.handlers["textDocument/definition"] = require("lsputil.locations").definition_handler + vim.lsp.handlers["textDocument/declaration"] = require("lsputil.locations").declaration_handler + vim.lsp.handlers["textDocument/typeDefinition"] = require("lsputil.locations").typeDefinition_handler + vim.lsp.handlers["textDocument/implementation"] = require("lsputil.locations").implementation_handler + vim.lsp.handlers["textDocument/documentSymbol"] = require("lsputil.symbols").document_handler + vim.lsp.handlers["workspace/symbol"] = require("lsputil.symbols").workspace_handler else - local bufnr = vim.api.nvim_buf_get_number(0) + local bufnr = vim.api.nvim_buf_get_number(0) - vim.lsp.handlers['textDocument/codeAction'] = function(_, _, actions) - require('lsputil.codeAction').code_action_handler(nil, actions, nil, nil, nil) - end + vim.lsp.handlers["textDocument/codeAction"] = function(_, _, actions) + require("lsputil.codeAction").code_action_handler(nil, actions, nil, nil, nil) + end - vim.lsp.handlers['textDocument/references'] = function(_, _, result) - require('lsputil.locations').references_handler(nil, result, { bufnr = bufnr }, nil) - end + vim.lsp.handlers["textDocument/references"] = function(_, _, result) + require("lsputil.locations").references_handler(nil, result, { bufnr = bufnr }, nil) + end - vim.lsp.handlers['textDocument/definition'] = function(_, method, result) - require('lsputil.locations').definition_handler(nil, result, { bufnr = bufnr, method = method }, nil) - end + vim.lsp.handlers["textDocument/definition"] = function(_, method, result) + require("lsputil.locations").definition_handler(nil, result, { bufnr = bufnr, method = method }, nil) + end - vim.lsp.handlers['textDocument/declaration'] = function(_, method, result) - require('lsputil.locations').declaration_handler(nil, result, { bufnr = bufnr, method = method }, nil) - end + vim.lsp.handlers["textDocument/declaration"] = function(_, method, result) + require("lsputil.locations").declaration_handler(nil, result, { bufnr = bufnr, method = method }, nil) + end - vim.lsp.handlers['textDocument/typeDefinition'] = function(_, method, result) - require('lsputil.locations').typeDefinition_handler(nil, result, { bufnr = bufnr, method = method }, nil) - end + vim.lsp.handlers["textDocument/typeDefinition"] = function(_, method, result) + require("lsputil.locations").typeDefinition_handler(nil, result, { bufnr = bufnr, method = method }, nil) + end - vim.lsp.handlers['textDocument/implementation'] = function(_, method, result) - require('lsputil.locations').implementation_handler(nil, result, { bufnr = bufnr, method = method }, nil) - end + vim.lsp.handlers["textDocument/implementation"] = function(_, method, result) + require("lsputil.locations").implementation_handler(nil, result, { bufnr = bufnr, method = method }, nil) + end - vim.lsp.handlers['textDocument/documentSymbol'] = function(_, _, result, _, bufn) - require('lsputil.symbols').document_handler(nil, result, { bufnr = bufn }, nil) - end + vim.lsp.handlers["textDocument/documentSymbol"] = function(_, _, result, _, bufn) + require("lsputil.symbols").document_handler(nil, result, { bufnr = bufn }, nil) + end - vim.lsp.handlers['textDocument/symbol'] = function(_, _, result, _, bufn) - require('lsputil.symbols').workspace_handler(nil, result, { bufnr = bufn }, nil) - end + vim.lsp.handlers["textDocument/symbol"] = function(_, _, result, _, bufn) + require("lsputil.symbols").workspace_handler(nil, result, { bufnr = bufn }, nil) + end end - local border_chars = { - TOP_LEFT = '┌', - TOP_RIGHT = '┐', - MID_HORIZONTAL = '─', - MID_VERTICAL = '│', - BOTTOM_LEFT = '└', - BOTTOM_RIGHT = '┘', + TOP_LEFT = "┌", + TOP_RIGHT = "┐", + MID_HORIZONTAL = "─", + MID_VERTICAL = "│", + BOTTOM_LEFT = "└", + BOTTOM_RIGHT = "┘", } vim.g.lsp_utils_location_opts = { height = 24, - mode = 'editor', + mode = "editor", preview = { - title = 'Location Preview', + title = "Location Preview", border = true, - border_chars = border_chars + border_chars = border_chars, }, keymaps = { n = { - [''] = 'j', - [''] = 'k', - } - } + [""] = "j", + [""] = "k", + }, + }, } vim.g.lsp_utils_symbols_opts = { height = 24, - mode = 'editor', + mode = "editor", preview = { - title = 'Symbols Preview', + title = "Symbols Preview", border = true, - border_chars = border_chars + border_chars = border_chars, }, prompt = {}, } diff --git a/lua/plugins/config/nvim-neorg.lua b/lua/plugins/config/nvim-neorg.lua index 0cf76d27..60f35bf6 100644 --- a/lua/plugins/config/nvim-neorg.lua +++ b/lua/plugins/config/nvim-neorg.lua @@ -1,13 +1,13 @@ -require('neorg').setup { - load = { - ["core.defaults"] = {}, - ["core.norg.dirman"] = { - config = { - workspaces = { - work = "~/notes/work", - home = "~/notes/home", - } - } - } - } -} +require("neorg").setup({ + load = { + ["core.defaults"] = {}, + ["core.norg.dirman"] = { + config = { + workspaces = { + work = "~/notes/work", + home = "~/notes/home", + }, + }, + }, + }, +}) diff --git a/lua/plugins/config/nvim-notify.lua b/lua/plugins/config/nvim-notify.lua index 6e4aef70..a8aef35a 100644 --- a/lua/plugins/config/nvim-notify.lua +++ b/lua/plugins/config/nvim-notify.lua @@ -1,33 +1,33 @@ vim.notify = require("notify") vim.notify.setup({ - -- Animation style (see below for details) - stages = "fade_in_slide_out", + -- Animation style (see below for details) + stages = "fade_in_slide_out", - -- Function called when a new window is opened, use for changing win settings/config - on_open = nil, + -- Function called when a new window is opened, use for changing win settings/config + on_open = nil, - -- Function called when a window is closed - on_close = nil, + -- Function called when a window is closed + on_close = nil, - -- Render function for notifications. See notify-render() - render = "default", + -- Render function for notifications. See notify-render() + render = "default", - -- Default timeout for notifications - timeout = 3000, + -- Default timeout for notifications + timeout = 3000, - -- For stages that change opacity this is treated as the highlight behind the window - -- Set this to either a highlight group, an RGB hex value e.g. "#000000" or a function returning an RGB code for dynamic values - background_colour = "#000000", + -- For stages that change opacity this is treated as the highlight behind the window + -- Set this to either a highlight group, an RGB hex value e.g. "#000000" or a function returning an RGB code for dynamic values + background_colour = "#000000", - -- Minimum width for notification windows - minimum_width = 50, + -- Minimum width for notification windows + minimum_width = 50, - -- Icons for the different levels - icons = { - ERROR = "", - WARN = "", - INFO = "", - DEBUG = "", - TRACE = "✎", - }, + -- Icons for the different levels + icons = { + ERROR = "", + WARN = "", + INFO = "", + DEBUG = "", + TRACE = "✎", + }, }) diff --git a/lua/plugins/config/nvim-tree.lua b/lua/plugins/config/nvim-tree.lua index 337e5edb..32442dd9 100644 --- a/lua/plugins/config/nvim-tree.lua +++ b/lua/plugins/config/nvim-tree.lua @@ -1,100 +1,98 @@ -require'nvim-tree'.setup { - disable_netrw = true, - hijack_netrw = true, - open_on_setup = false, - ignore_ft_on_setup = { "dashboard", "alpha" }, - -- auto_close = true, - auto_reload_on_write = true, - open_on_tab = false, - hijack_cursor = true, - update_cwd = false, - actions = { - use_system_clipboard = true, - change_dir = { - enable = true, - global = false, - }, - open_file = { - quit_on_open = true, - resize_window = true, - window_picker = { - enable = true, - chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890", - exclude = { - filetype = { "notify", "packer", "qf", "diff", "fugitive", "fugitiveblame" }, - buftype = { "nofile", "terminal", "help" }, - }, - }, - }, - }, - diagnostics = { - enable = false, - icons = { - hint = "", - info = "", - warning = "", - error = "", - } - }, - update_focused_file = { - enable = true, - update_cwd = false, - ignore_list = {} - }, - system_open = { - cmd = nil, - args = {} - }, - filters = { - dotfiles = false, - custom = {".git"}, - }, - git = { - enable = true, - ignore = true, - timeout = 400, - }, - view = { - width = 34, - height = 40, - hide_root_folder = true, - side = 'left', - preserve_window_proportions = false, - number = false, - relativenumber = false, - signcolumn = "yes", - mappings = { - custom_only = false, - list = {} - }, - }, - renderer = { - indent_markers = { - enable = true, - icons = { - corner = "└ ", - edge = "│ ", - none = " ", - }, - }, - }, - trash = { - cmd = "trash", - require_confirm = true - } -} - +require("nvim-tree").setup({ + disable_netrw = true, + hijack_netrw = true, + open_on_setup = false, + ignore_ft_on_setup = { "dashboard", "alpha" }, + -- auto_close = true, + auto_reload_on_write = true, + open_on_tab = false, + hijack_cursor = true, + update_cwd = false, + actions = { + use_system_clipboard = true, + change_dir = { + enable = true, + global = false, + }, + open_file = { + quit_on_open = true, + resize_window = true, + window_picker = { + enable = true, + chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890", + exclude = { + filetype = { "notify", "packer", "qf", "diff", "fugitive", "fugitiveblame" }, + buftype = { "nofile", "terminal", "help" }, + }, + }, + }, + }, + diagnostics = { + enable = false, + icons = { + hint = "", + info = "", + warning = "", + error = "", + }, + }, + update_focused_file = { + enable = true, + update_cwd = false, + ignore_list = {}, + }, + system_open = { + cmd = nil, + args = {}, + }, + filters = { + dotfiles = false, + custom = { ".git" }, + }, + git = { + enable = true, + ignore = true, + timeout = 400, + }, + view = { + width = 34, + height = 40, + hide_root_folder = true, + side = "left", + preserve_window_proportions = false, + number = false, + relativenumber = false, + signcolumn = "yes", + mappings = { + custom_only = false, + list = {}, + }, + }, + renderer = { + indent_markers = { + enable = true, + icons = { + corner = "└ ", + edge = "│ ", + none = " ", + }, + }, + }, + trash = { + cmd = "trash", + require_confirm = true, + }, +}) local g = vim.g - g.nvim_tree_indent_markers = 1 g.nvim_tree_special_files = {} g.nvim_tree_window_picker_exclude = { - filetype = { "notify", "packer", "qf" }, - buftype = { "terminal" }, + filetype = { "notify", "packer", "qf" }, + buftype = { "terminal" }, } -- g.nvim_tree_icons = { @@ -119,11 +117,8 @@ g.nvim_tree_window_picker_exclude = { -- }, -- } - g.nvim_tree_show_icons = { - folders = 1, - files = 1, - git = 1, + folders = 1, + files = 1, + git = 1, } - - diff --git a/lua/plugins/config/nvim-treesitter.lua b/lua/plugins/config/nvim-treesitter.lua index f29876a6..b4d0946a 100644 --- a/lua/plugins/config/nvim-treesitter.lua +++ b/lua/plugins/config/nvim-treesitter.lua @@ -1,59 +1,71 @@ -require'nvim-treesitter.configs'.setup { - -- One of "all", "maintained" (parsers with maintainers), or a list of languages - ensure_installed = {"lua", "java", "javascript", "html", "css", "c", "cpp", "go", "rust", "python", "vim", "yaml", "http", "bash"}, +require("nvim-treesitter.configs").setup({ + -- One of "all", "maintained" (parsers with maintainers), or a list of languages + ensure_installed = { + "lua", + "java", + "javascript", + "html", + "css", + "c", + "cpp", + "go", + "rust", + "python", + "vim", + "yaml", + "http", + "bash", + }, - -- Install languages synchronously (only applied to `ensure_installed`) - sync_install = false, + -- Install languages synchronously (only applied to `ensure_installed`) + sync_install = false, - -- List of parsers to ignore installing - ignore_install = { }, + -- List of parsers to ignore installing + ignore_install = {}, - highlight = { - -- `false` will disable the whole extension - enable = true, + highlight = { + -- `false` will disable the whole extension + enable = true, - -- list of language that will be disabled - disable = { }, + -- list of language that will be disabled + disable = {}, - -- Setting this to true will run `:h syntax` and tree-sitter at the same time. - -- Set this to `true` if you depend on 'syntax' being enabled (like for indentation). - -- Using this option may slow down your editor, and you may see some duplicate highlights. - -- Instead of true it can also be a list of languages - additional_vim_regex_highlighting = false, - }, - matchup = { - enable = true, - disable = { }, - }, - textobjects = { - move = { - enable = true, - set_jumps = true, -- whether to set jumps in the jumplist - goto_next_start = { - ["]m"] = "@function.outer", - ["]]"] = "@class.outer", - }, - goto_next_end = { - ["]M"] = "@function.outer", - ["]["] = "@class.outer", - }, - goto_previous_start = { - ["[m"] = "@function.outer", - ["[["] = "@class.outer", - }, - goto_previous_end = { - ["[M"] = "@function.outer", - ["[]"] = "@class.outer", - }, - }, - }, - -} + -- Setting this to true will run `:h syntax` and tree-sitter at the same time. + -- Set this to `true` if you depend on 'syntax' being enabled (like for indentation). + -- Using this option may slow down your editor, and you may see some duplicate highlights. + -- Instead of true it can also be a list of languages + additional_vim_regex_highlighting = false, + }, + matchup = { + enable = true, + disable = {}, + }, + textobjects = { + move = { + enable = true, + set_jumps = true, -- whether to set jumps in the jumplist + goto_next_start = { + ["]m"] = "@function.outer", + ["]]"] = "@class.outer", + }, + goto_next_end = { + ["]M"] = "@function.outer", + ["]["] = "@class.outer", + }, + goto_previous_start = { + ["[m"] = "@function.outer", + ["[["] = "@class.outer", + }, + goto_previous_end = { + ["[M"] = "@function.outer", + ["[]"] = "@class.outer", + }, + }, + }, +}) -- 开启 Folding -vim.wo.foldmethod = 'expr' -vim.wo.foldexpr = 'nvim_treesitter#foldexpr()' +vim.wo.foldmethod = "expr" +vim.wo.foldexpr = "nvim_treesitter#foldexpr()" -- 默认不要折叠 -- https://stackoverflow.com/questions/8316139/how-to-set-the-default-to-unfolded-when-you-open-a-file vim.wo.foldlevel = 99 - - diff --git a/lua/plugins/config/rest-nvim.lua b/lua/plugins/config/rest-nvim.lua index 05064d54..290edb25 100644 --- a/lua/plugins/config/rest-nvim.lua +++ b/lua/plugins/config/rest-nvim.lua @@ -1,22 +1,22 @@ require("rest-nvim").setup({ - -- Open request results in a horizontal split - result_split_horizontal = false, - -- Skip SSL verification, useful for unknown certificates - skip_ssl_verification = false, - -- Highlight request on run - highlight = { - enabled = true, - timeout = 150, - }, - result = { - -- toggle showing URL, HTTP info, headers at top the of result window - show_url = true, - show_http_info = true, - show_headers = true, - }, - -- Jump to request line on run - jump_to_request = false, - env_file = '.env', - custom_dynamic_variables = {}, - yank_dry_run = true, + -- Open request results in a horizontal split + result_split_horizontal = false, + -- Skip SSL verification, useful for unknown certificates + skip_ssl_verification = false, + -- Highlight request on run + highlight = { + enabled = true, + timeout = 150, + }, + result = { + -- toggle showing URL, HTTP info, headers at top the of result window + show_url = true, + show_http_info = true, + show_headers = true, + }, + -- Jump to request line on run + jump_to_request = false, + env_file = ".env", + custom_dynamic_variables = {}, + yank_dry_run = true, }) diff --git a/lua/plugins/config/symbols-outline.lua b/lua/plugins/config/symbols-outline.lua index f90e0dff..0cbc05e2 100644 --- a/lua/plugins/config/symbols-outline.lua +++ b/lua/plugins/config/symbols-outline.lua @@ -1,53 +1,53 @@ -- init.lua vim.g.symbols_outline = { - highlight_hovered_item = false, - show_guides = true, - auto_preview = false, - position = 'right', - relative_width = true, - width = 34, - auto_close = false, - show_numbers = false, - show_relative_numbers = false, - show_symbol_details = true, - preview_bg_highlight = 'Pmenu', - keymaps = { -- These keymaps can be a string or a table for multiple keys - close = {"", "q"}, - goto_location = "", - focus_location = "o", - hover_symbol = "", - toggle_preview = "K", - rename_symbol = "r", - code_actions = "a", - }, - lsp_blacklist = {}, - symbol_blacklist = {}, - symbols = { - File = {icon = "", hl = "TSURI"}, - Module = {icon = "", hl = "TSNamespace"}, - Namespace = {icon = "", hl = "TSNamespace"}, - Package = {icon = "", hl = "TSNamespace"}, - Class = {icon = "ﴯ", hl = "TSType"}, - Method = {icon = "", hl = "TSMethod"}, - Property = {icon = "ﰠ", hl = "TSMethod"}, - Field = {icon = "ﰠ", hl = "TSField"}, - Constructor = {icon = "", hl = "TSConstructor"}, - Enum = {icon = "", hl = "TSType"}, - Interface = {icon = "", hl = "TSType"}, - Function = {icon = "", hl = "TSFunction"}, - Variable = {icon = "", hl = "TSConstant"}, - Constant = {icon = "", hl = "TSConstant"}, - String = {icon = "", hl = "TSString"}, - Number = {icon = "", hl = "TSNumber"}, - Boolean = {icon = "", hl = "TSBoolean"}, - Array = {icon = "", hl = "TSConstant"}, - Object = {icon = "", hl = "TSType"}, - Key = {icon = "", hl = "TSType"}, - Null = {icon = "ﳠ", hl = "TSType"}, - EnumMember = {icon = "", hl = "TSField"}, - Struct = {icon = "פּ", hl = "TSType"}, - Event = {icon = "", hl = "TSType"}, - Operator = {icon = "", hl = "TSOperator"}, - TypeParameter = {icon = "", hl = "TSParameter"} - } + highlight_hovered_item = false, + show_guides = true, + auto_preview = false, + position = "right", + relative_width = true, + width = 34, + auto_close = false, + show_numbers = false, + show_relative_numbers = false, + show_symbol_details = true, + preview_bg_highlight = "Pmenu", + keymaps = { -- These keymaps can be a string or a table for multiple keys + close = { "", "q" }, + goto_location = "", + focus_location = "o", + hover_symbol = "", + toggle_preview = "K", + rename_symbol = "r", + code_actions = "a", + }, + lsp_blacklist = {}, + symbol_blacklist = {}, + symbols = { + File = { icon = "", hl = "TSURI" }, + Module = { icon = "", hl = "TSNamespace" }, + Namespace = { icon = "", hl = "TSNamespace" }, + Package = { icon = "", hl = "TSNamespace" }, + Class = { icon = "ﴯ", hl = "TSType" }, + Method = { icon = "", hl = "TSMethod" }, + Property = { icon = "ﰠ", hl = "TSMethod" }, + Field = { icon = "ﰠ", hl = "TSField" }, + Constructor = { icon = "", hl = "TSConstructor" }, + Enum = { icon = "", hl = "TSType" }, + Interface = { icon = "", hl = "TSType" }, + Function = { icon = "", hl = "TSFunction" }, + Variable = { icon = "", hl = "TSConstant" }, + Constant = { icon = "", hl = "TSConstant" }, + String = { icon = "", hl = "TSString" }, + Number = { icon = "", hl = "TSNumber" }, + Boolean = { icon = "", hl = "TSBoolean" }, + Array = { icon = "", hl = "TSConstant" }, + Object = { icon = "", hl = "TSType" }, + Key = { icon = "", hl = "TSType" }, + Null = { icon = "ﳠ", hl = "TSType" }, + EnumMember = { icon = "", hl = "TSField" }, + Struct = { icon = "פּ", hl = "TSType" }, + Event = { icon = "", hl = "TSType" }, + Operator = { icon = "", hl = "TSOperator" }, + TypeParameter = { icon = "", hl = "TSParameter" }, + }, } diff --git a/lua/plugins/config/telescope.lua b/lua/plugins/config/telescope.lua index d3f9fdb7..e784eae0 100644 --- a/lua/plugins/config/telescope.lua +++ b/lua/plugins/config/telescope.lua @@ -1,117 +1,115 @@ local actions = require("telescope.actions") local trouble = require("trouble.providers.telescope") -local telescope = require('telescope'); -telescope.setup { - defaults = { - -- vimgrep_arguments = { - -- "rg", - -- "--color=never", - -- "--no-heading", - -- "--with-filename", - -- "--line-number", - -- "--column", - -- "--smart-case", - -- }, - -- prompt_prefix = "  ", - prompt_prefix = "  ", - selection_caret = " ", - entry_prefix = " ", - initial_mode = "insert", - selection_strategy = "reset", - sorting_strategy = "ascending", - layout_strategy = "horizontal", - layout_config = { - horizontal = { - prompt_position = "top", - preview_width = 0.55, - results_width = 0.8, - }, - vertical = { - mirror = false, - }, - width = 0.87, - height = 0.80, - preview_cutoff = 120, - }, - winblend = 20, - -- border = {}, - -- borderchars = { "─", "│", "─", "│", "╭", "╮", "╯", "╰" }, - -- borderchars = { - -- prompt = { '▀', '▐', '▄', '▌', '▛', '▜', '▟', '▙' }; - -- results = { '▀', '▐', '▄', '▌', '▛', '▜', '▟', '▙' }; - -- preview = { '▀', '▐', '▄', '▌', '▛', '▜', '▟', '▙' }; - -- }, - -- borderchars = { - -- prompt = { '▀', '▐', '▄', '▌', '▛', '▜', '▟', '▙' }; - -- results = { ' ', '▐', '▄', '▌', '▌', '▐', '▟', '▙' }; - -- preview = { '▀', '▐', '▄', '▌', '▛', '▜', '▟', '▙' }; - -- }, - color_devicons = true, - -- use_less = true, - -- set_env = { ["COLORTERM"] = "gruvbox" }, -- default = nil, - -- file_sorter = require("telescope.sorters").get_fuzzy_file, - file_ignore_patterns = { "node_modules" }, - -- generic_sorter = require("telescope.sorters").get_generic_fuzzy_sorter, - -- path_display = { "truncate" }, - -- file_previewer = require("telescope.previewers").vim_buffer_cat.new, - -- grep_previewer = require("telescope.previewers").vim_buffer_vimgrep.new, - -- qflist_previewer = require("telescope.previewers").vim_buffer_qflist.new, - -- Developer configurations: Not meant for general override - -- buffer_previewer_maker = require("telescope.previewers").buffer_previewer_maker, +local telescope = require("telescope") +telescope.setup({ + defaults = { + -- vimgrep_arguments = { + -- "rg", + -- "--color=never", + -- "--no-heading", + -- "--with-filename", + -- "--line-number", + -- "--column", + -- "--smart-case", + -- }, + -- prompt_prefix = "  ", + prompt_prefix = "  ", + selection_caret = " ", + entry_prefix = " ", + initial_mode = "insert", + selection_strategy = "reset", + sorting_strategy = "ascending", + layout_strategy = "horizontal", + layout_config = { + horizontal = { + prompt_position = "top", + preview_width = 0.55, + results_width = 0.8, + }, + vertical = { + mirror = false, + }, + width = 0.87, + height = 0.80, + preview_cutoff = 120, + }, + winblend = 20, + -- border = {}, + -- borderchars = { "─", "│", "─", "│", "╭", "╮", "╯", "╰" }, + -- borderchars = { + -- prompt = { '▀', '▐', '▄', '▌', '▛', '▜', '▟', '▙' }; + -- results = { '▀', '▐', '▄', '▌', '▛', '▜', '▟', '▙' }; + -- preview = { '▀', '▐', '▄', '▌', '▛', '▜', '▟', '▙' }; + -- }, + -- borderchars = { + -- prompt = { '▀', '▐', '▄', '▌', '▛', '▜', '▟', '▙' }; + -- results = { ' ', '▐', '▄', '▌', '▌', '▐', '▟', '▙' }; + -- preview = { '▀', '▐', '▄', '▌', '▛', '▜', '▟', '▙' }; + -- }, + color_devicons = true, + -- use_less = true, + -- set_env = { ["COLORTERM"] = "gruvbox" }, -- default = nil, + -- file_sorter = require("telescope.sorters").get_fuzzy_file, + file_ignore_patterns = { "node_modules" }, + -- generic_sorter = require("telescope.sorters").get_generic_fuzzy_sorter, + -- path_display = { "truncate" }, + -- file_previewer = require("telescope.previewers").vim_buffer_cat.new, + -- grep_previewer = require("telescope.previewers").vim_buffer_vimgrep.new, + -- qflist_previewer = require("telescope.previewers").vim_buffer_qflist.new, + -- Developer configurations: Not meant for general override + -- buffer_previewer_maker = require("telescope.previewers").buffer_previewer_maker, - - - -- Default configuration for telescope goes here: - -- config_key = value, - mappings = { - i = { - -- map actions.which_key to (default: ) - -- actions.which_key shows the mappings for your picker, - -- e.g. git_{create, delete, ...}_branch for the git_branches picker - [""] = "which_key", - -- [""] = actions.close, - -- [""] = trouble.open_with_trouble, - }, - n = { - -- [""] = trouble.open_with_trouble, - } - } - }, - pickers = { - -- Default configuration for builtin pickers goes here: - -- picker_name = { - -- picker_config_key = value, - -- ... - -- } - -- Now the picker_config_key will be applied every time you call this - -- builtin picker - }, - extensions = { - -- Your extension configuration goes here: - -- extension_name = { - -- extension_config_key = value, - -- } - -- please take a look at the readme of the extension you want to configure - ["ui-select"] = { - require("telescope.themes").get_dropdown { - -- even more opts - } - }, - -- fzf = { - -- fuzzy = true, -- false will only do exact matching - -- override_generic_sorter = true, -- override the generic sorter - -- override_file_sorter = true, -- override the file sorter - -- case_mode = "smart_case", -- or "ignore_case" or "respect_case" - -- -- the default case_mode is "smart_case" - -- } - }, -} + -- Default configuration for telescope goes here: + -- config_key = value, + mappings = { + i = { + -- map actions.which_key to (default: ) + -- actions.which_key shows the mappings for your picker, + -- e.g. git_{create, delete, ...}_branch for the git_branches picker + [""] = "which_key", + -- [""] = actions.close, + -- [""] = trouble.open_with_trouble, + }, + n = { + -- [""] = trouble.open_with_trouble, + }, + }, + }, + pickers = { + -- Default configuration for builtin pickers goes here: + -- picker_name = { + -- picker_config_key = value, + -- ... + -- } + -- Now the picker_config_key will be applied every time you call this + -- builtin picker + }, + extensions = { + -- Your extension configuration goes here: + -- extension_name = { + -- extension_config_key = value, + -- } + -- please take a look at the readme of the extension you want to configure + ["ui-select"] = { + require("telescope.themes").get_dropdown({ + -- even more opts + }), + }, + -- fzf = { + -- fuzzy = true, -- false will only do exact matching + -- override_generic_sorter = true, -- override the generic sorter + -- override_file_sorter = true, -- override the file sorter + -- case_mode = "smart_case", -- or "ignore_case" or "respect_case" + -- -- the default case_mode is "smart_case" + -- } + }, +}) telescope.load_extension("notify") -- telescope.load_extension('fzf') telescope.load_extension("ui-select") -- telescope.load_extension('gradle') -- telescope.load_extension('maven_search') -telescope.load_extension('env') -telescope.load_extension('dap') +telescope.load_extension("env") +telescope.load_extension("dap") -telescope.load_extension('toggletasks') +telescope.load_extension("toggletasks") diff --git a/lua/plugins/config/toggletasks.lua b/lua/plugins/config/toggletasks.lua index 51956a6b..eae485e0 100644 --- a/lua/plugins/config/toggletasks.lua +++ b/lua/plugins/config/toggletasks.lua @@ -1,8 +1,8 @@ -require('toggletasks').setup { - search_paths = { - '.tasks', - '.toggletasks', - '.nvim/toggletasks', - '.nvim/tasks', - }, -} +require("toggletasks").setup({ + search_paths = { + ".tasks", + ".toggletasks", + ".nvim/toggletasks", + ".nvim/tasks", + }, +}) diff --git a/lua/plugins/config/translate.lua b/lua/plugins/config/translate.lua index a02515bf..d00f6269 100644 --- a/lua/plugins/config/translate.lua +++ b/lua/plugins/config/translate.lua @@ -1,12 +1,12 @@ require("translate").setup({ - default = { - command = "translate_shell", - }, - preset = { - output = { - split = { - append = true, - }, - }, - }, + default = { + command = "translate_shell", + }, + preset = { + output = { + split = { + append = true, + }, + }, + }, }) diff --git a/lua/plugins/config/trouble.lua b/lua/plugins/config/trouble.lua index 8278e178..e0c75772 100644 --- a/lua/plugins/config/trouble.lua +++ b/lua/plugins/config/trouble.lua @@ -1,5 +1,5 @@ -require("trouble").setup { - -- your configuration comes here - -- or leave it empty to use the default settings - -- refer to the configuration section below -} +require("trouble").setup({ + -- your configuration comes here + -- or leave it empty to use the default settings + -- refer to the configuration section below +}) diff --git a/lua/plugins/config/vim-floaterm.lua b/lua/plugins/config/vim-floaterm.lua index 9ef5fb46..cf1f7798 100644 --- a/lua/plugins/config/vim-floaterm.lua +++ b/lua/plugins/config/vim-floaterm.lua @@ -1,6 +1,6 @@ -vim.g.floaterm_position='bottomright' -vim.g.floaterm_autoclose=1 -vim.g.floaterm_wintype='float' -vim.g.floaterm_width=0.9 -vim.g.floaterm_height=0.4 +vim.g.floaterm_position = "bottomright" +vim.g.floaterm_autoclose = 1 +vim.g.floaterm_wintype = "float" +vim.g.floaterm_width = 0.9 +vim.g.floaterm_height = 0.4 -- vim.g.floaterm_rootmarkers=['.project', '.git', '.hg', '.svn', '.root', '.gitignore'] diff --git a/lua/plugins/config/vim-illuminate.lua b/lua/plugins/config/vim-illuminate.lua index 2024c5bf..06f1aa92 100644 --- a/lua/plugins/config/vim-illuminate.lua +++ b/lua/plugins/config/vim-illuminate.lua @@ -1,6 +1,15 @@ -- https://github.com/RRethy/vim-illuminate -- 禁止高亮的文件类型 vim.g.Illuminate_ftblacklist = { - "vista_kind", - "help", "terminal", "packer", "markdown", "git", "text", "NvimTree", "dashboard", "alpha", "Outline" + "vista_kind", + "help", + "terminal", + "packer", + "markdown", + "git", + "text", + "NvimTree", + "dashboard", + "alpha", + "Outline", } diff --git a/lua/plugins/config/vista.lua b/lua/plugins/config/vista.lua index ffbbbd6c..b708fb52 100644 --- a/lua/plugins/config/vista.lua +++ b/lua/plugins/config/vista.lua @@ -1,4 +1,3 @@ -vim.g.vista_default_executive = 'nvim_lsp' - -vim.g.vista_icon_indent = {"╰─▸ ", "├─▸ "} +vim.g.vista_default_executive = "nvim_lsp" +vim.g.vista_icon_indent = { "╰─▸ ", "├─▸ " } diff --git a/lua/plugins/config/wilder.lua b/lua/plugins/config/wilder.lua index 42a7cd7a..ec982bc5 100644 --- a/lua/plugins/config/wilder.lua +++ b/lua/plugins/config/wilder.lua @@ -1,5 +1,5 @@ local result = vim.api.nvim_exec( -[[ + [[ call wilder#setup({ \ 'modes': [':', '/', '?'], \ 'next_key': '', @@ -37,4 +37,6 @@ call wilder#set_option('renderer', wilder#renderer_mux({ \ '/': s:wildmenu_renderer, \ 'substitute': s:wildmenu_renderer, \ })) -]], true) +]], + true +) diff --git a/lua/plugins/init.lua b/lua/plugins/init.lua index dd831455..a3ae3028 100644 --- a/lua/plugins/init.lua +++ b/lua/plugins/init.lua @@ -1,313 +1,311 @@ -require('plugins/config/symbols-outline') -require('packer').startup({ function() - - - use { 'nvim-lua/plenary.nvim' } - use { 'lewis6991/impatient.nvim' } - use { 'nathom/filetype.nvim' } - -- Packer can manage itself - use 'wbthomason/packer.nvim' - - use { 'neovim/nvim-lspconfig', 'williamboman/nvim-lsp-installer' } - - use 'kyazdani42/nvim-web-devicons' - - -- nvim-cmp - use 'hrsh7th/cmp-nvim-lsp' -- { name = nvim_lsp } - use 'hrsh7th/cmp-buffer' -- { name = 'buffer' }, - use 'hrsh7th/cmp-path' -- { name = 'path' } - -- use 'hrsh7th/cmp-cmdline' -- { name = 'cmdline' } - use 'hrsh7th/nvim-cmp' - - -- vsnip - -- use 'hrsh7th/cmp-vsnip' -- { name = 'vsnip' } - -- use 'hrsh7th/vim-vsnip' - - -- 代码片段 - use 'rafamadriz/friendly-snippets' - -- LuaSnip - use 'L3MON4D3/LuaSnip' - use { 'saadparwaiz1/cmp_luasnip' } - - -- lspkind - use 'onsails/lspkind-nvim' - - -- lsp 相关 - -- use 'folke/lsp-colors.nvim' - use 'folke/trouble.nvim' - - -- java 不友好 - -- use 'glepnir/lspsaga.nvim' - -- use 'arkav/lualine-lsp-progress' - -- use 'nvim-lua/lsp-status.nvim' - - -- use 'ray-x/lsp_signature.nvim' - - -- use 'RishabhRD/popfix' - -- use 'RishabhRD/nvim-lsputils' - - use({ - "jose-elias-alvarez/null-ls.nvim", - config = function() - end, - requires = { "nvim-lua/plenary.nvim" }, - }) - - -- 主题 - -- use 'morhetz/gruvbox' - use { "ellisonleao/gruvbox.nvim" } - -- use 'sainnhe/gruvbox-material' - - - -- 文件管理 - use { - 'kyazdani42/nvim-tree.lua', - requires = { - 'kyazdani42/nvim-web-devicons', -- optional, for file icon - } - } - - -- using packer.nvim - use { 'akinsho/bufferline.nvim', tag = 'v2.*', requires = 'kyazdani42/nvim-web-devicons' } - - - -- treesitter (新增) - use { 'nvim-treesitter/nvim-treesitter', run = ':TSUpdate' } - use 'nvim-treesitter/nvim-treesitter-textobjects' - - -- java - use 'mfussenegger/nvim-jdtls' - -- use 'NiYanhhhhh/lighttree-java' - - -- debug - use 'mfussenegger/nvim-dap' - use { "rcarriga/nvim-dap-ui", requires = { "mfussenegger/nvim-dap" } } - use 'theHamsta/nvim-dap-virtual-text' - - -- git - use 'tpope/vim-fugitive' - - -- LeaderF - -- use 'Yggdroot/LeaderF' - - -- git edit 状态显示插件 - use { - 'lewis6991/gitsigns.nvim', - requires = { - 'nvim-lua/plenary.nvim' - }, - } - - -- 异步任务执行插件 - -- use 'skywind3000/asynctasks.vim' - -- use 'skywind3000/asyncrun.vim' - use { - 'jedrzejboczar/toggletasks.nvim', - requires = { - 'nvim-lua/plenary.nvim', - 'akinsho/toggleterm.nvim', - 'nvim-telescope/telescope.nvim/', - }, - } - - -- 浮动窗口插件 - -- use 'voldikss/vim-floaterm' - -- use 'voldikss/LeaderF-floaterm' - use { "akinsho/toggleterm.nvim", tag = 'v2.*', config = function() - require("toggleterm").setup() - end } - - -- 多光标插件 - use 'mg979/vim-visual-multi' - - -- 状态栏插件 - -- use 'feline-nvim/feline.nvim' - use { - 'nvim-lualine/lualine.nvim', - } - - -- blankline - use "lukas-reineke/indent-blankline.nvim" - - -- <>()等匹配插件 - use 'andymass/vim-matchup' - -- 大纲插件 - -- use 'liuchengxu/vista.vim' - use 'simrat39/symbols-outline.nvim' - -- use { - -- 'stevearc/aerial.nvim', - -- } - - -- 消息通知 - use 'rcarriga/nvim-notify' - - -- wildmenu 补全美化 - use 'gelguy/wilder.nvim' - - -- 颜色显示 - use 'norcalli/nvim-colorizer.lua' - - use { - 'numToStr/Comment.nvim', - } - - -- mackdown 预览插件 - use { 'iamcco/markdown-preview.nvim', run = 'cd app && yarn install' } - -- mackdown cli 预览插件 - use { "ellisonleao/glow.nvim", branch = 'main' } - - -- 格式化插件 -> 使用 null-ls - -- use 'mhartington/formatter.nvim' - -- use 'sbdchd/neoformat' - - - -- 快捷键查看 - use { - "folke/which-key.nvim", - config = function() - require("which-key").setup { - -- your configuration comes here - -- or leave it empty to use the default settings - -- refer to the configuration section below - } - end - } - - -- 搜索插件 - use { - 'nvim-telescope/telescope.nvim', - requires = { - 'nvim-lua/plenary.nvim' - }, - } - use { 'nvim-telescope/telescope-ui-select.nvim' } - -- use {'nvim-telescope/telescope-fzf-native.nvim', run = 'make' } - use { 'nvim-telescope/telescope-dap.nvim' } - - -- use 'GustavoKatel/telescope-asynctasks.nvim' - -- use 'aloussase/telescope-gradle.nvim' - -- use 'aloussase/telescope-mvnsearch' - use { "LinArcX/telescope-env.nvim" } - - - - -- 仪表盘 - -- use {'glepnir/dashboard-nvim'} - use { - 'goolord/alpha-nvim', - requires = { 'kyazdani42/nvim-web-devicons' }, - } - - -- 翻译插件 - -- use 'voldikss/vim-translator' - use 'uga-rosa/translate.nvim' - - -- 自动对齐插件 - use 'junegunn/vim-easy-align' - - -- 表格模式插件 - use 'dhruvasagar/vim-table-mode' - - -- () 自动补全 - use 'windwp/nvim-autopairs' - - -- 任务插件 - use 'itchyny/calendar.vim' - - -- rust - use 'simrat39/rust-tools.nvim' - - -- use "Pocco81/AutoSave.nvim" - - - use { - "NTBBloodbath/rest.nvim", - requires = { - 'nvim-lua/plenary.nvim' - }, - } - - -- 选中高亮插件 - use "RRethy/vim-illuminate" - - -- 快速跳转 - use { - 'phaazon/hop.nvim', - branch = 'v1', -- optional but strongly recommended - config = function() - -- you can configure Hop the way you like here; see :h hop-config - require 'hop'.setup { keys = 'etovxqpdygfblzhckisuran' } - end - } - - -- LSP 进度 - use { 'j-hui/fidget.nvim', - config = function() - require "fidget".setup {} - end - } - - -- 查找替换 - use { 'windwp/nvim-spectre', - config = function() - require('spectre').setup() - end - } - - -- ASCII 图 - use 'jbyuki/venn.nvim' - - use "tversteeg/registers.nvim" - - use 'nanotee/sqls.nvim' -end, - config = { - display = { - open_fn = require('packer.util').float, - } - } }) - - -require('plugins/config/bufferline') -require('plugins/config/indent-blankline') +require("plugins/config/symbols-outline") +require("packer").startup({ + function() + use({ "nvim-lua/plenary.nvim" }) + use({ "lewis6991/impatient.nvim" }) + use({ "nathom/filetype.nvim" }) + -- Packer can manage itself + use("wbthomason/packer.nvim") + + use({ "neovim/nvim-lspconfig", "williamboman/nvim-lsp-installer" }) + + use("kyazdani42/nvim-web-devicons") + + -- nvim-cmp + use("hrsh7th/cmp-nvim-lsp") -- { name = nvim_lsp } + use("hrsh7th/cmp-buffer") -- { name = 'buffer' }, + use("hrsh7th/cmp-path") -- { name = 'path' } + -- use 'hrsh7th/cmp-cmdline' -- { name = 'cmdline' } + use("hrsh7th/nvim-cmp") + + -- vsnip + -- use 'hrsh7th/cmp-vsnip' -- { name = 'vsnip' } + -- use 'hrsh7th/vim-vsnip' + + -- 代码片段 + use("rafamadriz/friendly-snippets") + -- LuaSnip + use("L3MON4D3/LuaSnip") + use({ "saadparwaiz1/cmp_luasnip" }) + + -- lspkind + use("onsails/lspkind-nvim") + + -- lsp 相关 + -- use 'folke/lsp-colors.nvim' + use("folke/trouble.nvim") + + -- java 不友好 + -- use 'glepnir/lspsaga.nvim' + -- use 'arkav/lualine-lsp-progress' + -- use 'nvim-lua/lsp-status.nvim' + + -- use 'ray-x/lsp_signature.nvim' + + -- use 'RishabhRD/popfix' + -- use 'RishabhRD/nvim-lsputils' + + use({ + "jose-elias-alvarez/null-ls.nvim", + config = function() end, + requires = { "nvim-lua/plenary.nvim" }, + }) + + -- 主题 + -- use 'morhetz/gruvbox' + use({ "ellisonleao/gruvbox.nvim" }) + -- use 'sainnhe/gruvbox-material' + + -- 文件管理 + use({ + "kyazdani42/nvim-tree.lua", + requires = { + "kyazdani42/nvim-web-devicons", -- optional, for file icon + }, + }) + + -- using packer.nvim + use({ "akinsho/bufferline.nvim", tag = "v2.*", requires = "kyazdani42/nvim-web-devicons" }) + + -- treesitter (新增) + use({ "nvim-treesitter/nvim-treesitter", run = ":TSUpdate" }) + use("nvim-treesitter/nvim-treesitter-textobjects") + + -- java + use("mfussenegger/nvim-jdtls") + -- use 'NiYanhhhhh/lighttree-java' + + -- debug + use("mfussenegger/nvim-dap") + use({ "rcarriga/nvim-dap-ui", requires = { "mfussenegger/nvim-dap" } }) + use("theHamsta/nvim-dap-virtual-text") + + -- git + use("tpope/vim-fugitive") + + -- LeaderF + -- use 'Yggdroot/LeaderF' + + -- git edit 状态显示插件 + use({ + "lewis6991/gitsigns.nvim", + requires = { + "nvim-lua/plenary.nvim", + }, + }) + + -- 异步任务执行插件 + -- use 'skywind3000/asynctasks.vim' + -- use 'skywind3000/asyncrun.vim' + use({ + "jedrzejboczar/toggletasks.nvim", + requires = { + "nvim-lua/plenary.nvim", + "akinsho/toggleterm.nvim", + "nvim-telescope/telescope.nvim/", + }, + }) + + -- 浮动窗口插件 + -- use 'voldikss/vim-floaterm' + -- use 'voldikss/LeaderF-floaterm' + use({ + "akinsho/toggleterm.nvim", + tag = "v2.*", + config = function() + require("toggleterm").setup() + end, + }) + + -- 多光标插件 + use("mg979/vim-visual-multi") + + -- 状态栏插件 + -- use 'feline-nvim/feline.nvim' + use({ + "nvim-lualine/lualine.nvim", + }) + + -- blankline + use("lukas-reineke/indent-blankline.nvim") + + -- <>()等匹配插件 + use("andymass/vim-matchup") + -- 大纲插件 + -- use 'liuchengxu/vista.vim' + use("simrat39/symbols-outline.nvim") + -- use { + -- 'stevearc/aerial.nvim', + -- } + + -- 消息通知 + use("rcarriga/nvim-notify") + + -- wildmenu 补全美化 + use("gelguy/wilder.nvim") + + -- 颜色显示 + use("norcalli/nvim-colorizer.lua") + + use({ + "numToStr/Comment.nvim", + }) + + -- mackdown 预览插件 + use({ "iamcco/markdown-preview.nvim", run = "cd app && yarn install" }) + -- mackdown cli 预览插件 + use({ "ellisonleao/glow.nvim", branch = "main" }) + + -- 格式化插件 -> 使用 null-ls + -- use 'mhartington/formatter.nvim' + -- use 'sbdchd/neoformat' + + -- 快捷键查看 + use({ + "folke/which-key.nvim", + config = function() + require("which-key").setup({ + -- your configuration comes here + -- or leave it empty to use the default settings + -- refer to the configuration section below + }) + end, + }) + + -- 搜索插件 + use({ + "nvim-telescope/telescope.nvim", + requires = { + "nvim-lua/plenary.nvim", + }, + }) + use({ "nvim-telescope/telescope-ui-select.nvim" }) + -- use {'nvim-telescope/telescope-fzf-native.nvim', run = 'make' } + use({ "nvim-telescope/telescope-dap.nvim" }) + + -- use 'GustavoKatel/telescope-asynctasks.nvim' + -- use 'aloussase/telescope-gradle.nvim' + -- use 'aloussase/telescope-mvnsearch' + use({ "LinArcX/telescope-env.nvim" }) + + -- 仪表盘 + -- use {'glepnir/dashboard-nvim'} + use({ + "goolord/alpha-nvim", + requires = { "kyazdani42/nvim-web-devicons" }, + }) + + -- 翻译插件 + -- use 'voldikss/vim-translator' + use("uga-rosa/translate.nvim") + + -- 自动对齐插件 + use("junegunn/vim-easy-align") + + -- 表格模式插件 + use("dhruvasagar/vim-table-mode") + + -- () 自动补全 + use("windwp/nvim-autopairs") + + -- 任务插件 + use("itchyny/calendar.vim") + + -- rust + use("simrat39/rust-tools.nvim") + + -- use "Pocco81/AutoSave.nvim" + + use({ + "NTBBloodbath/rest.nvim", + requires = { + "nvim-lua/plenary.nvim", + }, + }) + + -- 选中高亮插件 + use("RRethy/vim-illuminate") + + -- 快速跳转 + use({ + "phaazon/hop.nvim", + branch = "v1", -- optional but strongly recommended + config = function() + -- you can configure Hop the way you like here; see :h hop-config + require("hop").setup({ keys = "etovxqpdygfblzhckisuran" }) + end, + }) + + -- LSP 进度 + use({ + "j-hui/fidget.nvim", + config = function() + require("fidget").setup({}) + end, + }) + + -- 查找替换 + use({ + "windwp/nvim-spectre", + config = function() + require("spectre").setup() + end, + }) + + -- ASCII 图 + use("jbyuki/venn.nvim") + + use("tversteeg/registers.nvim") + + use("nanotee/sqls.nvim") + end, + config = { + display = { + open_fn = require("packer.util").float, + }, + }, +}) + +require("plugins/config/bufferline") +require("plugins/config/indent-blankline") -- require('plugins/config/dashboard-nvim') -require('plugins/config/alpha-nvim') -require('plugins/config/lualine') -require('plugins/config/nvim-tree') -require('plugins/config/vim-illuminate') +require("plugins/config/alpha-nvim") +require("plugins/config/lualine") +require("plugins/config/nvim-tree") +require("plugins/config/vim-illuminate") -- 异步加载 vim.defer_fn(function() - require('plugins/config/nvim-treesitter') - - require('plugins/config/luasnip') - require('plugins/config/nvim-cmp') - -- require('plugins/config/LeaderF') - require('plugins/config/gitsigns-nvim') - -- require('plugins/config/vim-floaterm') - -- require('plugins/config/asynctasks') - require('plugins/config/toggletasks') - -- require('plugins/config/feline') - -- require('plugins/config/vista') - -- require('plugins/config/aerial') - -- require('plugins/config/lsp-colors') - require('plugins/config/trouble') - require('plugins/config/nvim-notify') - require('plugins/config/wilder') - require('plugins/config/nvim-colorizer') - require('plugins/config/comment') - -- require('plugins/config/lspsaga') - -- require('plugins/config/formatter') - require('plugins/config/telescope') - -- require('plugins/config/nvim-lsputils') - require('plugins/config/nvim-autopairs') - -- require('plugins/config/lsp_signature') - require('plugins/config/nvim-dap') - require('plugins/config/markdown-preview') - require('plugins/config/translate') - -- require('plugins/config/autosave') - -- require('plugins/config/nvim-neorg') - require("plugins/config/null-ls") - vim.cmd [[ + require("plugins/config/nvim-treesitter") + + require("plugins/config/luasnip") + require("plugins/config/nvim-cmp") + -- require('plugins/config/LeaderF') + require("plugins/config/gitsigns-nvim") + -- require('plugins/config/vim-floaterm') + -- require('plugins/config/asynctasks') + require("plugins/config/toggletasks") + -- require('plugins/config/feline') + -- require('plugins/config/vista') + -- require('plugins/config/aerial') + -- require('plugins/config/lsp-colors') + require("plugins/config/trouble") + require("plugins/config/nvim-notify") + require("plugins/config/wilder") + require("plugins/config/nvim-colorizer") + require("plugins/config/comment") + -- require('plugins/config/lspsaga') + -- require('plugins/config/formatter') + require("plugins/config/telescope") + -- require('plugins/config/nvim-lsputils') + require("plugins/config/nvim-autopairs") + -- require('plugins/config/lsp_signature') + require("plugins/config/nvim-dap") + require("plugins/config/markdown-preview") + require("plugins/config/translate") + -- require('plugins/config/autosave') + -- require('plugins/config/nvim-neorg') + require("plugins/config/null-ls") + vim.cmd([[ function! s:http_rest_init() abort lua require('plugins/config/rest-nvim') lua require('core.keybindings').rest_nvim() @@ -316,7 +314,7 @@ augroup http_rest autocmd! autocmd FileType http call s:http_rest_init() augroup end -]] +]]) - require('core.keybindings').setup() + require("core.keybindings").setup() end, 0) From c84658f3d4679d937cc5680de034c68765cbc0f9 Mon Sep 17 00:00:00 2001 From: luokai Date: Sat, 25 Jun 2022 21:14:19 +0800 Subject: [PATCH 0255/1278] =?UTF-8?q?=E7=BB=86=E8=8A=82=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lua/core/basic.lua | 7 ++++--- lua/plugins/config/bufferline.lua | 14 ++++++++++++-- lua/plugins/config/lualine.lua | 13 ++++++++++++- 3 files changed, 28 insertions(+), 6 deletions(-) diff --git a/lua/core/basic.lua b/lua/core/basic.lua index d14d3bf6..b8186037 100644 --- a/lua/core/basic.lua +++ b/lua/core/basic.lua @@ -91,13 +91,14 @@ set signcolumn=yes " set signcolumn=number set mouse=n if exists('g:neovide') - " let g:neovide_refresh_rate=60 + let g:neovide_refresh_rate=60 let g:neovide_cursor_vfx_mode = "railgun" set guifont=CaskaydiaCove\ Nerd\ Font\ Mono:h14 let g:neovide_transparency=1 - " let g:neovide_fullscreen=v:true - let g:neovide_remember_window_size = v:true + let g:neovide_fullscreen=v:true + " let g:neovide_remember_window_size = v:true let g:neovide_input_use_logo=v:true + let g:neovide_profiler = v:false else endif if has("autocmd") diff --git a/lua/plugins/config/bufferline.lua b/lua/plugins/config/bufferline.lua index 039efd52..715593e0 100644 --- a/lua/plugins/config/bufferline.lua +++ b/lua/plugins/config/bufferline.lua @@ -16,7 +16,17 @@ require("bufferline").setup({ filetype = "NvimTree", text = function() -- return "File Explorer" - return vim.fn.fnamemodify(vim.fn.getcwd(), ":p:h:t") + -- git symbolic-ref --short -q HEAD + -- git --no-pager rev-parse --show-toplevel --absolute-git-dir --abbrev-ref HEAD + -- git --no-pager rev-parse --short HEAD + -- local b = vim.fn.trim(vim.fn.system("git symbolic-ref --short -q HEAD")) + -- if string.match(b, "fatal") then + -- b = "" + -- else + -- b = "  " .. b + -- end + -- return vim.fn.fnamemodify(vim.fn.getcwd(), ":p:h:t") .. b + return "File Explorer" end, padding = 1, highlight = "Directory", @@ -25,7 +35,7 @@ require("bufferline").setup({ }, { filetype = "Outline", - text = "Outline", + text = " Outline", padding = 1, highlight = "Directory", text_align = "left", diff --git a/lua/plugins/config/lualine.lua b/lua/plugins/config/lualine.lua index 5df14faa..11c8a616 100644 --- a/lua/plugins/config/lualine.lua +++ b/lua/plugins/config/lualine.lua @@ -28,7 +28,7 @@ local config = { lualine_z = {}, }, tabline = {}, - extensions = { "quickfix", "toggleterm", "nvim-tree", "fugitive", "symbols-outline", "nvim-dap-ui" }, + extensions = { "quickfix", "toggleterm", "fugitive", "symbols-outline", "nvim-dap-ui" }, } local dap = {} @@ -42,6 +42,17 @@ dap.filetypes = { } table.insert(config.extensions, dap) +-- NvimTree +local nerdtree = require("lualine.extensions.nerdtree") + +local nvim_tree = {} +nvim_tree.sections = vim.deepcopy(nerdtree.sections) +nvim_tree.sections.lualine_b = { "branch" } +nvim_tree.filetypes = { + "NvimTree", +} +table.insert(config.extensions, nvim_tree) + -- nvim-sqls extensions local db_connection_value = "default" local db_database_value = "default" From d349e37c0a859cbe67fc499e16ef433b3aa2d358 Mon Sep 17 00:00:00 2001 From: luokai Date: Sun, 26 Jun 2022 09:51:52 +0800 Subject: [PATCH 0256/1278] update --- lua/core/basic.lua | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lua/core/basic.lua b/lua/core/basic.lua index b8186037..96c57863 100644 --- a/lua/core/basic.lua +++ b/lua/core/basic.lua @@ -91,11 +91,11 @@ set signcolumn=yes " set signcolumn=number set mouse=n if exists('g:neovide') - let g:neovide_refresh_rate=60 + " let g:neovide_refresh_rate=60 let g:neovide_cursor_vfx_mode = "railgun" set guifont=CaskaydiaCove\ Nerd\ Font\ Mono:h14 - let g:neovide_transparency=1 - let g:neovide_fullscreen=v:true + " let g:neovide_transparency=1 + " let g:neovide_fullscreen=v:true " let g:neovide_remember_window_size = v:true let g:neovide_input_use_logo=v:true let g:neovide_profiler = v:false From 85c7eb289267643861274ea9aa482ee7300ad071 Mon Sep 17 00:00:00 2001 From: luokai Date: Sun, 26 Jun 2022 09:56:54 +0800 Subject: [PATCH 0257/1278] update gui font --- lua/core/basic.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lua/core/basic.lua b/lua/core/basic.lua index 96c57863..b6c51b93 100644 --- a/lua/core/basic.lua +++ b/lua/core/basic.lua @@ -93,7 +93,7 @@ set mouse=n if exists('g:neovide') " let g:neovide_refresh_rate=60 let g:neovide_cursor_vfx_mode = "railgun" - set guifont=CaskaydiaCove\ Nerd\ Font\ Mono:h14 + set guifont=CaskaydiaCove\ Nerd\ Font\ Mono,Cascadia\ Mono\ PL:h14 " let g:neovide_transparency=1 " let g:neovide_fullscreen=v:true " let g:neovide_remember_window_size = v:true From 9d7882059dd4d06cc409bca5b48b8488f2b068db Mon Sep 17 00:00:00 2001 From: luokai Date: Sun, 26 Jun 2022 12:14:50 +0800 Subject: [PATCH 0258/1278] =?UTF-8?q?=E6=9B=B4=E6=96=B0=E4=BD=BF=E7=94=A8?= =?UTF-8?q?=E6=BC=94=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/README.md b/README.md index 6ff73be2..02b85895 100644 --- a/README.md +++ b/README.md @@ -67,6 +67,18 @@ git clone https://github.com/JavaHello/nvim.git ### 功能演示 +- 启动页 + ![home](https://javahello.github.io/dev/nvim-lean/images/home.png) +- 查找文件 + ![find-file](https://javahello.github.io/dev/nvim-lean/images/find-file.gif) +- 全局搜索 + ![find-word](https://javahello.github.io/dev/nvim-lean/images/find-word.gif) +- 全局搜索替换 + ![fr](https://javahello.github.io/dev/nvim-lean/images/fr.gif) +- 文件管理 + ![file-tree](https://javahello.github.io/dev/nvim-lean/images/file-tree.gif) +- 大纲 + ![Outline](https://javahello.github.io/dev/nvim-lean/images/outline.gif) - 查看引用 ![001](https://javahello.github.io/dev/nvim-lean/images/java-ref-001.gif) - 查看实现 From 53c170787bebd5d1455c447196e7e80dc8b5964b Mon Sep 17 00:00:00 2001 From: luokai Date: Sun, 26 Jun 2022 12:17:23 +0800 Subject: [PATCH 0259/1278] update --- README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README.md b/README.md index 02b85895..aa66a018 100644 --- a/README.md +++ b/README.md @@ -85,6 +85,8 @@ git clone https://github.com/JavaHello/nvim.git ![002](https://javahello.github.io/dev/nvim-lean/images/java-impl-002.gif) - 搜索`class`,`method`,`field`等 ![003](https://javahello.github.io/dev/nvim-lean/images/java-symbols-003.gif) +- Debug + ![Debug](https://javahello.github.io/dev/nvim-lean/images/debug.gif) ## 我的 VIM 插件列表 From 9dac399c7418da0399119119b9002388d0d4f71d Mon Sep 17 00:00:00 2001 From: luokai Date: Sun, 26 Jun 2022 12:26:51 +0800 Subject: [PATCH 0260/1278] test --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index aa66a018..3336f72e 100644 --- a/README.md +++ b/README.md @@ -86,7 +86,7 @@ git clone https://github.com/JavaHello/nvim.git - 搜索`class`,`method`,`field`等 ![003](https://javahello.github.io/dev/nvim-lean/images/java-symbols-003.gif) - Debug - ![Debug](https://javahello.github.io/dev/nvim-lean/images/debug.gif) + ![Debug001](https://javahello.github.io/dev/nvim-lean/images/debug.gif) ## 我的 VIM 插件列表 From efbe42b4fb519986a9d43ec03d6f9f08090aa961 Mon Sep 17 00:00:00 2001 From: luokai Date: Mon, 27 Jun 2022 09:58:06 +0800 Subject: [PATCH 0261/1278] null-ls --- lua/lsp/utils/init.lua | 3 +++ lua/plugins/config/null-ls.lua | 1 + 2 files changed, 4 insertions(+) diff --git a/lua/lsp/utils/init.lua b/lua/lsp/utils/init.lua index 35b4dda4..ee38c15d 100644 --- a/lua/lsp/utils/init.lua +++ b/lua/lsp/utils/init.lua @@ -47,6 +47,9 @@ format_lsp_mapping["sh"] = "null-ls" -- stylua format_lsp_mapping["lua"] = "null-ls" +-- rustfmt +format_lsp_mapping["rust"] = "null-ls" + format_lsp_mapping["http"] = "null-ls" M.filter_format_lsp_client = function(client, bufnr) diff --git a/lua/plugins/config/null-ls.lua b/lua/plugins/config/null-ls.lua index 87ab010a..bc9dd7ea 100644 --- a/lua/plugins/config/null-ls.lua +++ b/lua/plugins/config/null-ls.lua @@ -45,6 +45,7 @@ local sources = { null_ls.builtins.formatting.sql_formatter, -- null_ls.builtins.formatting.google_java_format, -- null_ls.builtins.diagnostics.semgrep, + null_ls.builtins.formatting.rustfmt, null_ls.builtins.diagnostics.semgrep.with({ method = null_ls.methods.DIAGNOSTICS_ON_SAVE, extra_args = { "--config", "p/java" }, From 296ac4f4dd842803b836235bf41786edfb3ed44c Mon Sep 17 00:00:00 2001 From: luokai Date: Wed, 29 Jun 2022 00:24:17 +0800 Subject: [PATCH 0262/1278] plantuml --- init.lua | 2 + lua/core/utils/init.lua | 4 ++ lua/core/utils/plantuml.lua | 75 +++++++++++++++++++++++++++++++++++++ 3 files changed, 81 insertions(+) create mode 100644 lua/core/utils/plantuml.lua diff --git a/init.lua b/init.lua index c4270444..560ce9fc 100644 --- a/init.lua +++ b/init.lua @@ -8,6 +8,8 @@ require("core.basic") require("plugins") vim.defer_fn(function() require("lsp") + + require("core.utils.plantuml").setup() end, 0) -- vim.api.nvim_command('colorscheme gruvbox') diff --git a/lua/core/utils/init.lua b/lua/core/utils/init.lua index 5f951099..56f8d650 100644 --- a/lua/core/utils/init.lua +++ b/lua/core/utils/init.lua @@ -179,4 +179,8 @@ M.get_visual_selection = function() end end +M.run_cmd = function(cmd) + return vim.fn.system(cmd) +end + return M diff --git a/lua/core/utils/plantuml.lua b/lua/core/utils/plantuml.lua new file mode 100644 index 00000000..dc1f1470 --- /dev/null +++ b/lua/core/utils/plantuml.lua @@ -0,0 +1,75 @@ +local utils = require("core.utils") +local M = {} +M.config = {} + +M.config.jar_path = "/opt/software/puml/plantuml.jar" +M.config.cmd = "java -jar " .. M.config.jar_path +M.config.defaultTo = "svg" +M.types = {} +M.types["png"] = true +M.types["svg"] = true +M.types["eps"] = true +M.types["pdf"] = true +M.types["vdx"] = true +M.types["xmi"] = true +M.types["scxml"] = true +M.types["html"] = true +M.types["txt"] = true +M.types["utxt"] = true +M.types["latex"] = true +M.types["latex:nopreamble"] = true + +local function to_type(type) + if M.types[type] then + return "-t" .. type + end + return "-t" .. M.config.defaultTo +end + +local function exec(cmd) + if not vim.fn.filereadable(M.config.jar_path) then + vim.notify("Plantuml: 没有文件 " .. M.config.jar_path, vim.log.levels.ERROR) + return + end + if not vim.fn.executable("java") then + vim.notify("Plantuml: 没有 java 环境", vim.log.levels.ERROR) + return + end + local p = vim.fn.expand("%:p:h") + local res = utils.run_cmd("cd " .. p .. " && " .. cmd) + if vim.fn.trim(res) == "" then + vim.notify("Plantuml: export success", vim.log.levels.INFO) + else + vim.notify("Plantuml: export error, " .. res, vim.log.levels.WARN) + end +end + +M.run_export_opt = function(filename, args) + exec(M.config.cmd .. " " .. args .. " " .. filename) +end + +M.run_export_to = function(filename, type) + exec(M.config.cmd .. " " .. to_type(type) .. " " .. filename) +end + +local function init() + local group = vim.api.nvim_create_augroup("plantuml_export", { clear = true }) + vim.api.nvim_create_autocmd({ "FileType" }, { + group = group, + pattern = { "puml" }, + desc = "Export Plantuml file", + callback = function(o) + vim.api.nvim_buf_create_user_command(o.buf, "Plantuml", function(opts) + M.run_export_to(vim.fn.expand("%"), opts.args) + end, {}) + end, + }) +end + +M.setup = function(config) + if config then + M.config = vim.tbl_deep_extend("force", M.config, config) + end + init() +end +return M From ba7a7bb6767cb499c25e6f215df1ee9b059589d3 Mon Sep 17 00:00:00 2001 From: luokai Date: Wed, 29 Jun 2022 00:24:25 +0800 Subject: [PATCH 0263/1278] del java null-ls --- lua/plugins/config/null-ls.lua | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/lua/plugins/config/null-ls.lua b/lua/plugins/config/null-ls.lua index bc9dd7ea..ef998d98 100644 --- a/lua/plugins/config/null-ls.lua +++ b/lua/plugins/config/null-ls.lua @@ -46,10 +46,10 @@ local sources = { -- null_ls.builtins.formatting.google_java_format, -- null_ls.builtins.diagnostics.semgrep, null_ls.builtins.formatting.rustfmt, - null_ls.builtins.diagnostics.semgrep.with({ - method = null_ls.methods.DIAGNOSTICS_ON_SAVE, - extra_args = { "--config", "p/java" }, - }), + -- null_ls.builtins.diagnostics.semgrep.with({ + -- method = null_ls.methods.DIAGNOSTICS_ON_SAVE, + -- extra_args = { "--config", "p/java" }, + -- }), } local lsp_formatting = function(bufnr) From 67043e13ad95bb22dc118b9fd489be706cc3ab5a Mon Sep 17 00:00:00 2001 From: luokai Date: Wed, 29 Jun 2022 14:16:10 +0800 Subject: [PATCH 0264/1278] gitsigns-nvim --- lua/plugins/config/gitsigns-nvim.lua | 50 ++++++++++++++++++++++++++++ 1 file changed, 50 insertions(+) diff --git a/lua/plugins/config/gitsigns-nvim.lua b/lua/plugins/config/gitsigns-nvim.lua index e8ceaffe..c905b0c8 100644 --- a/lua/plugins/config/gitsigns-nvim.lua +++ b/lua/plugins/config/gitsigns-nvim.lua @@ -41,4 +41,54 @@ require("gitsigns").setup({ yadm = { enable = false, }, + on_attach = function(bufnr) + local gs = package.loaded.gitsigns + + local function map(mode, l, r, opts) + opts = opts or {} + opts.buffer = bufnr + vim.keymap.set(mode, l, r, opts) + end + + -- Navigation + map("n", "]c", function() + if vim.wo.diff then + return "]c" + end + vim.schedule(function() + gs.next_hunk() + end) + return "" + end, { expr = true }) + + map("n", "[c", function() + if vim.wo.diff then + return "[c" + end + vim.schedule(function() + gs.prev_hunk() + end) + return "" + end, { expr = true }) + + -- Actions + map({ "n", "v" }, "hs", ":Gitsigns stage_hunk") + map({ "n", "v" }, "hr", ":Gitsigns reset_hunk") + map("n", "hS", gs.stage_buffer) + map("n", "hu", gs.undo_stage_hunk) + map("n", "hR", gs.reset_buffer) + map("n", "hp", gs.preview_hunk) + map("n", "hb", function() + gs.blame_line({ full = true }) + end) + map("n", "tb", gs.toggle_current_line_blame) + map("n", "hd", gs.diffthis) + map("n", "hD", function() + gs.diffthis("~") + end) + map("n", "td", gs.toggle_deleted) + + -- Text object + map({ "o", "x" }, "ih", ":Gitsigns select_hunk") + end, }) From 8b5c5c49989d0aab82d17287400d50e5bdebaaf1 Mon Sep 17 00:00:00 2001 From: luokai Date: Wed, 29 Jun 2022 14:52:45 +0800 Subject: [PATCH 0265/1278] =?UTF-8?q?=E5=8E=BB=E6=8E=89=E8=BF=87=E6=9C=9F?= =?UTF-8?q?=E5=8F=82=E6=95=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lua/lsp/java.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lua/lsp/java.lua b/lua/lsp/java.lua index 132a7a45..782fee49 100644 --- a/lua/lsp/java.lua +++ b/lua/lsp/java.lua @@ -65,7 +65,7 @@ M.setup = function() "-Dlog.protocol=true", "-Dlog.level=ALL", "-Dsun.zip.disableMemoryMapping=true", - "-noverify", + -- "-noverify", -- '-XX:+UseParallelGC', -- '-XX:GCTimeRatio=4', -- '-XX:AdaptiveSizePolicyWeight=90', From 80b4c060724f46c9969e6041f73fadcfe024bd0a Mon Sep 17 00:00:00 2001 From: luokai Date: Wed, 29 Jun 2022 15:06:06 +0800 Subject: [PATCH 0266/1278] java config --- lua/lsp/java.lua | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/lua/lsp/java.lua b/lua/lsp/java.lua index 782fee49..6f0810b2 100644 --- a/lua/lsp/java.lua +++ b/lua/lsp/java.lua @@ -59,9 +59,9 @@ M.setup = function() "-Declipse.application=org.eclipse.jdt.ls.core.id1", "-Dosgi.bundles.defaultStartLevel=4", "-Declipse.product=org.eclipse.jdt.ls.core.product", - "-Dosgi.configuration.cascaded=true", - "-Dosgi.sharedConfiguration.area=" .. get_jdtls_home() .. "/config_mac", - "-Dosgi.sharedConfiguration.area.readOnly=true", + -- "-Dosgi.configuration.cascaded=true", + -- "-Dosgi.sharedConfiguration.area=" .. get_jdtls_home() .. "/config_mac", + -- "-Dosgi.sharedConfiguration.area.readOnly=true", "-Dlog.protocol=true", "-Dlog.level=ALL", "-Dsun.zip.disableMemoryMapping=true", @@ -73,6 +73,7 @@ M.setup = function() -- '-XX:+UseStringDeduplication', -- '-Xms512m', "-Xmx2g", + -- "-Xbootclasspath/a:" .. get_lombok_jar(), "-javaagent:" .. get_lombok_jar(), "--add-modules=ALL-SYSTEM", "--add-opens", @@ -81,7 +82,8 @@ M.setup = function() "java.base/java.lang=ALL-UNNAMED", "-jar", jdtls_launcher, - -- '-configuration', '/opt/software/lsp/jdtls/config_mac', + "-configuration", + get_jdtls_home() .. "/config_mac", "-data", workspace_dir, }, From 4daaa7510097915a56ac8ac56169de6751f92f30 Mon Sep 17 00:00:00 2001 From: luokai Date: Wed, 29 Jun 2022 20:10:43 +0800 Subject: [PATCH 0267/1278] lsp config --- lua/core/utils/init.lua | 3 ++ lua/lsp/gopls.lua | 5 +++ lua/lsp/init.lua | 69 ++++++++++++++++++++--------------------- lua/lsp/java.lua | 2 +- 4 files changed, 42 insertions(+), 37 deletions(-) create mode 100644 lua/lsp/gopls.lua diff --git a/lua/core/utils/init.lua b/lua/core/utils/init.lua index 56f8d650..06035d48 100644 --- a/lua/core/utils/init.lua +++ b/lua/core/utils/init.lua @@ -183,4 +183,7 @@ M.run_cmd = function(cmd) return vim.fn.system(cmd) end +M.or_default = function(a, v) + return a and a or v +end return M diff --git a/lua/lsp/gopls.lua b/lua/lsp/gopls.lua new file mode 100644 index 00000000..6d470959 --- /dev/null +++ b/lua/lsp/gopls.lua @@ -0,0 +1,5 @@ +local M = {} +M.config = { +} +M.on_attach = function(_, _) end +return M diff --git a/lua/lsp/init.lua b/lua/lsp/init.lua index e8244644..8559ae65 100644 --- a/lua/lsp/init.lua +++ b/lua/lsp/init.lua @@ -1,10 +1,22 @@ local lsp_installer = require("nvim-lsp-installer") local lspconfig = require("lspconfig") +lsp_installer.setup({ + ensure_installed = { + "sumneko_lua", + "clangd", + "tsserver", + "html", + "pyright", + "rust_analyzer", + "sqls", + "gopls", + }, +}) -- 安装列表 -- https://github.com/williamboman/nvim-lsp-installer#available-lsps -- { key: 语言 value: 配置文件 } -local servers = { +local server_configs = { sumneko_lua = require("lsp.lua"), -- /lua/lsp/lua.lua -- jdtls = require "lsp.java", -- /lua/lsp/jdtls.lua -- jsonls = require("lsp.jsonls"), @@ -14,54 +26,34 @@ local servers = { pyright = require("lsp.pyright"), rust_analyzer = require("lsp.rust_analyzer"), sqls = require("lsp.sqls"), + gopls = require("lsp.gopls"), } --- 自动安装 LanguageServers -for name, _ in pairs(servers) do - local server_available, server = lsp_installer.get_server(name) - if server_available then - if not server:is_installed() then - vim.notify(string.format("请安装 [%s] LSP server", name), vim.log.levels.WARN) - -- server:install() - end - end -end - -- Setup lspconfig. local capabilities = require("cmp_nvim_lsp").update_capabilities(vim.lsp.protocol.make_client_capabilities()) -- 没有确定使用效果参数 -- capabilities.textDocument.completion.completionItem.snippetSupport = true -lsp_installer.setup({}) -for name, m in pairs(servers) do - local opts = m.config - if opts then - opts.on_attach = function(client, bufnr) - -- local function buf_set_option(...) vim.api.nvim_buf_set_option(bufnr, ...) end - -- 绑定快捷键 - require("core.keybindings").maplsp(client, bufnr) - -- require("aerial").on_attach(client, bufnr) - if m.on_attach then - m.on_attach(client, bufnr) - end - -- vim.notify(string.format("Starting [%s] server", server.name), vim.log.levels.INFO) +for _, server in ipairs(lsp_installer.get_installed_servers()) do + local cfg = require("core.utils").or_default(server_configs[server.name], {}) + local on_attach = function(client, bufnr) + -- 绑定快捷键 + require("core.keybindings").maplsp(client, bufnr) + if cfg.on_attach then + cfg.on_attach(client, bufnr) end - opts.flags = { - debounce_text_changes = 150, - } - opts.capabilities = capabilities end - if name == "rust_analyzer" then + if server.name == "rust_analyzer" then -- Initialize the LSP via rust-tools instead require("rust-tools").setup({ -- The "server" property provided in rust-tools setup function are the -- settings rust-tools will provide to lspconfig during init. -- -- We merge the necessary settings from nvim-lsp-installer (server:get_default_options()) -- with the user's own settings (opts). - dap = m.dap, + dap = cfg.dap, server = { - on_attach = opts.on_attach, - capabilities = opts.capabilities, + on_attach = on_attach, + capabilities = capabilities, standalone = false, settings = { ["rust-analyzer"] = { @@ -77,12 +69,17 @@ for name, m in pairs(servers) do }, }, }) - -- Only if standalone support is needed - -- require("rust-tools").start_standalone_if_required() else - lspconfig[name].setup(opts) + lspconfig[server.name].setup({ + on_attach = on_attach, + flags = { + debounce_text_changes = 150, + }, + capabilities = capabilities, + }) end end + -- LSP 相关美化参考 https://github.com/NvChad/NvChad local function lspSymbol(name, icon) local hl = "DiagnosticSign" .. name diff --git a/lua/lsp/java.lua b/lua/lsp/java.lua index 6f0810b2..054e7989 100644 --- a/lua/lsp/java.lua +++ b/lua/lsp/java.lua @@ -11,7 +11,7 @@ local env = { } local function or_default(a, v) - return a and a or v + return require("core.utils").or_default(a, v) end local maven_settings = env.MAVEN_HOME .. "/conf/settings.xml" From c03cb38f62aa219b35727b846bdc9bdf306c9ac8 Mon Sep 17 00:00:00 2001 From: luokai Date: Wed, 29 Jun 2022 20:32:57 +0800 Subject: [PATCH 0268/1278] =?UTF-8?q?=E7=BB=93=E6=9E=84=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lua/lsp/c.lua | 4 --- lua/lsp/clangd.lua | 1 + lua/lsp/gopls.lua | 6 +--- lua/lsp/html.lua | 5 +-- lua/lsp/init.lua | 50 ++++++++-------------------- lua/lsp/jsonls.lua | 5 +-- lua/lsp/pyright.lua | 27 +++++++-------- lua/lsp/rust_analyzer.lua | 28 ++++++++++------ lua/lsp/sqls.lua | 11 +++--- lua/lsp/{lua.lua => sumneko_lua.lua} | 5 +-- lua/lsp/tsserver.lua | 5 +-- 11 files changed, 53 insertions(+), 94 deletions(-) delete mode 100644 lua/lsp/c.lua create mode 100644 lua/lsp/clangd.lua rename lua/lsp/{lua.lua => sumneko_lua.lua} (91%) diff --git a/lua/lsp/c.lua b/lua/lsp/c.lua deleted file mode 100644 index 460b2206..00000000 --- a/lua/lsp/c.lua +++ /dev/null @@ -1,4 +0,0 @@ -local M = {} -M.config = {} -M.on_attach = function(_, _) end -return M diff --git a/lua/lsp/clangd.lua b/lua/lsp/clangd.lua new file mode 100644 index 00000000..a5647075 --- /dev/null +++ b/lua/lsp/clangd.lua @@ -0,0 +1 @@ +return {} diff --git a/lua/lsp/gopls.lua b/lua/lsp/gopls.lua index 6d470959..a5647075 100644 --- a/lua/lsp/gopls.lua +++ b/lua/lsp/gopls.lua @@ -1,5 +1 @@ -local M = {} -M.config = { -} -M.on_attach = function(_, _) end -return M +return {} diff --git a/lua/lsp/html.lua b/lua/lsp/html.lua index 460b2206..a5647075 100644 --- a/lua/lsp/html.lua +++ b/lua/lsp/html.lua @@ -1,4 +1 @@ -local M = {} -M.config = {} -M.on_attach = function(_, _) end -return M +return {} diff --git a/lua/lsp/init.lua b/lua/lsp/init.lua index 8559ae65..22788787 100644 --- a/lua/lsp/init.lua +++ b/lua/lsp/init.lua @@ -17,10 +17,10 @@ lsp_installer.setup({ -- https://github.com/williamboman/nvim-lsp-installer#available-lsps -- { key: 语言 value: 配置文件 } local server_configs = { - sumneko_lua = require("lsp.lua"), -- /lua/lsp/lua.lua + sumneko_lua = require("lsp.sumneko_lua"), -- /lua/lsp/lua.lua -- jdtls = require "lsp.java", -- /lua/lsp/jdtls.lua -- jsonls = require("lsp.jsonls"), - clangd = require("lsp.c"), + clangd = require("lsp.clangd"), tsserver = require("lsp.tsserver"), html = require("lsp.html"), pyright = require("lsp.pyright"), @@ -35,48 +35,24 @@ local capabilities = require("cmp_nvim_lsp").update_capabilities(vim.lsp.protoco -- capabilities.textDocument.completion.completionItem.snippetSupport = true for _, server in ipairs(lsp_installer.get_installed_servers()) do local cfg = require("core.utils").or_default(server_configs[server.name], {}) - local on_attach = function(client, bufnr) + local on_attach = cfg.on_attach + local opts = vim.tbl_deep_extend("force", server:get_default_options(), cfg) + opts.on_attach = function(client, bufnr) -- 绑定快捷键 require("core.keybindings").maplsp(client, bufnr) - if cfg.on_attach then - cfg.on_attach(client, bufnr) + if on_attach then + on_attach(client, bufnr) end end - + opts.flags = { + debounce_text_changes = 150, + } + opts.capabilities = capabilities if server.name == "rust_analyzer" then -- Initialize the LSP via rust-tools instead - require("rust-tools").setup({ - -- The "server" property provided in rust-tools setup function are the - -- settings rust-tools will provide to lspconfig during init. -- - -- We merge the necessary settings from nvim-lsp-installer (server:get_default_options()) - -- with the user's own settings (opts). - dap = cfg.dap, - server = { - on_attach = on_attach, - capabilities = capabilities, - standalone = false, - settings = { - ["rust-analyzer"] = { - completion = { - postfix = { - enable = false, - }, - }, - checkOnSave = { - command = "clippy", - }, - }, - }, - }, - }) + require("rust-tools").setup(opts) else - lspconfig[server.name].setup({ - on_attach = on_attach, - flags = { - debounce_text_changes = 150, - }, - capabilities = capabilities, - }) + lspconfig[server.name].setup(opts) end end diff --git a/lua/lsp/jsonls.lua b/lua/lsp/jsonls.lua index 460b2206..a5647075 100644 --- a/lua/lsp/jsonls.lua +++ b/lua/lsp/jsonls.lua @@ -1,4 +1 @@ -local M = {} -M.config = {} -M.on_attach = function(_, _) end -return M +return {} diff --git a/lua/lsp/pyright.lua b/lua/lsp/pyright.lua index 11ebaa4f..96c84582 100644 --- a/lua/lsp/pyright.lua +++ b/lua/lsp/pyright.lua @@ -1,17 +1,14 @@ -local M = {} -M.config = {} - -M.organize_imports = function() - local params = { - command = "pyright.organizeimports", - arguments = { vim.uri_from_bufnr(0) }, - } - vim.lsp.buf.execute_command(params) -end - -M.on_attach = function(_, _) - vim.cmd([[ +return { + organize_imports = function() + local params = { + command = "pyright.organizeimports", + arguments = { vim.uri_from_bufnr(0) }, + } + vim.lsp.buf.execute_command(params) + end, + on_attach = function(_, _) + vim.cmd([[ command! -nargs=0 OR :lua require'lsp.pyright'.organize_imports() ]]) -end -return M + end, +} diff --git a/lua/lsp/rust_analyzer.lua b/lua/lsp/rust_analyzer.lua index b9d2cca8..a861c46b 100644 --- a/lua/lsp/rust_analyzer.lua +++ b/lua/lsp/rust_analyzer.lua @@ -1,17 +1,23 @@ -local M = {} - -- Update this path local extension_path = "/Users/kailuo/.vscode/extensions/vadimcn.vscode-lldb-1.7.0/" local codelldb_path = extension_path .. "adapter/codelldb" local liblldb_path = extension_path .. "lldb/lib/liblldb.dylib" -M.config = { - -- ... other configs -} -M.dap = { - adapter = require("rust-tools.dap").get_codelldb_adapter(codelldb_path, liblldb_path), +return { + dap = { adapter = require("rust-tools.dap").get_codelldb_adapter(codelldb_path, liblldb_path) }, + server = { + standalone = false, + settings = { + ["rust-analyzer"] = { + completion = { + postfix = { + enable = false, + }, + }, + checkOnSave = { + command = "clippy", + }, + }, + }, + }, } - -M.on_attach = function(_, _) end - -return M diff --git a/lua/lsp/sqls.lua b/lua/lsp/sqls.lua index 2ef9b72f..54acaec6 100644 --- a/lua/lsp/sqls.lua +++ b/lua/lsp/sqls.lua @@ -1,7 +1,6 @@ vim.g.sql_type_default = "mysql" -local M = {} -M.config = {} -M.on_attach = function(client, bufnr) - require("sqls").on_attach(client, bufnr) -end -return M +return { + on_attach = function(client, bufnr) + require("sqls").on_attach(client, bufnr) + end, +} diff --git a/lua/lsp/lua.lua b/lua/lsp/sumneko_lua.lua similarity index 91% rename from lua/lsp/lua.lua rename to lua/lsp/sumneko_lua.lua index 5913e7ca..fcdfc83a 100644 --- a/lua/lsp/lua.lua +++ b/lua/lsp/sumneko_lua.lua @@ -1,8 +1,7 @@ local runtime_path = vim.split(package.path, ";") table.insert(runtime_path, "lua/?.lua") table.insert(runtime_path, "lua/?/init.lua") -local M = {} -M.config = { +return { settings = { Lua = { runtime = { @@ -26,5 +25,3 @@ M.config = { }, }, } -M.on_attach = function(_, bufnr) end -return M diff --git a/lua/lsp/tsserver.lua b/lua/lsp/tsserver.lua index 460b2206..a5647075 100644 --- a/lua/lsp/tsserver.lua +++ b/lua/lsp/tsserver.lua @@ -1,4 +1 @@ -local M = {} -M.config = {} -M.on_attach = function(_, _) end -return M +return {} From c2a1b3289c7e0aac3c8b1869d15be673f6d8d324 Mon Sep 17 00:00:00 2001 From: luokai Date: Wed, 29 Jun 2022 21:22:23 +0800 Subject: [PATCH 0269/1278] update --- lua/lsp/init.lua | 22 +++++++++++++-------- lua/lsp/pyright.lua | 22 +++++++++++---------- lua/lsp/rust_analyzer.lua | 4 +++- lua/lsp/sqls.lua | 8 +++++--- lua/lsp/sumneko_lua.lua | 40 ++++++++++++++++++++------------------- 5 files changed, 55 insertions(+), 41 deletions(-) diff --git a/lua/lsp/init.lua b/lua/lsp/init.lua index 22788787..e73f2f1d 100644 --- a/lua/lsp/init.lua +++ b/lua/lsp/init.lua @@ -33,26 +33,32 @@ local server_configs = { local capabilities = require("cmp_nvim_lsp").update_capabilities(vim.lsp.protocol.make_client_capabilities()) -- 没有确定使用效果参数 -- capabilities.textDocument.completion.completionItem.snippetSupport = true +local utils = require("core.utils") for _, server in ipairs(lsp_installer.get_installed_servers()) do - local cfg = require("core.utils").or_default(server_configs[server.name], {}) - local on_attach = cfg.on_attach - local opts = vim.tbl_deep_extend("force", server:get_default_options(), cfg) - opts.on_attach = function(client, bufnr) + -- tools config + local cfg = utils.or_default(server_configs[server.name], {}) + + -- lspconfig + local scfg = utils.or_default(cfg.server, {}) + scfg = vim.tbl_deep_extend("force", server:get_default_options(), scfg) + local on_attach = scfg.on_attach + scfg.on_attach = function(client, bufnr) -- 绑定快捷键 require("core.keybindings").maplsp(client, bufnr) if on_attach then on_attach(client, bufnr) end end - opts.flags = { + scfg.flags = { debounce_text_changes = 150, } - opts.capabilities = capabilities + scfg.capabilities = capabilities if server.name == "rust_analyzer" then -- Initialize the LSP via rust-tools instead - require("rust-tools").setup(opts) + cfg.server = scfg + require("rust-tools").setup(cfg) else - lspconfig[server.name].setup(opts) + lspconfig[server.name].setup(scfg) end end diff --git a/lua/lsp/pyright.lua b/lua/lsp/pyright.lua index 96c84582..64aea068 100644 --- a/lua/lsp/pyright.lua +++ b/lua/lsp/pyright.lua @@ -1,14 +1,16 @@ return { - organize_imports = function() - local params = { - command = "pyright.organizeimports", - arguments = { vim.uri_from_bufnr(0) }, - } - vim.lsp.buf.execute_command(params) - end, - on_attach = function(_, _) - vim.cmd([[ + server = { + organize_imports = function() + local params = { + command = "pyright.organizeimports", + arguments = { vim.uri_from_bufnr(0) }, + } + vim.lsp.buf.execute_command(params) + end, + on_attach = function(_, _) + vim.cmd([[ command! -nargs=0 OR :lua require'lsp.pyright'.organize_imports() ]]) - end, + end, + }, } diff --git a/lua/lsp/rust_analyzer.lua b/lua/lsp/rust_analyzer.lua index a861c46b..6ec824b6 100644 --- a/lua/lsp/rust_analyzer.lua +++ b/lua/lsp/rust_analyzer.lua @@ -4,7 +4,9 @@ local codelldb_path = extension_path .. "adapter/codelldb" local liblldb_path = extension_path .. "lldb/lib/liblldb.dylib" return { - dap = { adapter = require("rust-tools.dap").get_codelldb_adapter(codelldb_path, liblldb_path) }, + dap = { + adapter = require("rust-tools.dap").get_codelldb_adapter(codelldb_path, liblldb_path), + }, server = { standalone = false, settings = { diff --git a/lua/lsp/sqls.lua b/lua/lsp/sqls.lua index 54acaec6..41f17bdc 100644 --- a/lua/lsp/sqls.lua +++ b/lua/lsp/sqls.lua @@ -1,6 +1,8 @@ vim.g.sql_type_default = "mysql" return { - on_attach = function(client, bufnr) - require("sqls").on_attach(client, bufnr) - end, + server = { + on_attach = function(client, bufnr) + require("sqls").on_attach(client, bufnr) + end, + }, } diff --git a/lua/lsp/sumneko_lua.lua b/lua/lsp/sumneko_lua.lua index fcdfc83a..f2053901 100644 --- a/lua/lsp/sumneko_lua.lua +++ b/lua/lsp/sumneko_lua.lua @@ -2,25 +2,27 @@ local runtime_path = vim.split(package.path, ";") table.insert(runtime_path, "lua/?.lua") table.insert(runtime_path, "lua/?/init.lua") return { - settings = { - Lua = { - runtime = { - -- Tell the language server which version of Lua you're using (most likely LuaJIT in the case of Neovim) - version = "LuaJIT", - -- Setup your lua path - path = runtime_path, - }, - diagnostics = { - -- Get the language server to recognize the `vim` global - globals = { "vim" }, - }, - workspace = { - -- Make the server aware of Neovim runtime files - library = vim.api.nvim_get_runtime_file("", true), - }, - -- Do not send telemetry data containing a randomized but unique identifier - telemetry = { - enable = false, + server = { + settings = { + Lua = { + runtime = { + -- Tell the language server which version of Lua you're using (most likely LuaJIT in the case of Neovim) + version = "LuaJIT", + -- Setup your lua path + path = runtime_path, + }, + diagnostics = { + -- Get the language server to recognize the `vim` global + globals = { "vim" }, + }, + workspace = { + -- Make the server aware of Neovim runtime files + library = vim.api.nvim_get_runtime_file("", true), + }, + -- Do not send telemetry data containing a randomized but unique identifier + telemetry = { + enable = false, + }, }, }, }, From d9ac9bce4e252a24ceade7a96c3e545b89a5189d Mon Sep 17 00:00:00 2001 From: luokai Date: Wed, 29 Jun 2022 21:29:21 +0800 Subject: [PATCH 0270/1278] gruvbox --- init.lua | 1 + lua/plugins/config/gruvbox.lua | 15 +++++++++++++++ 2 files changed, 16 insertions(+) create mode 100644 lua/plugins/config/gruvbox.lua diff --git a/init.lua b/init.lua index 560ce9fc..8f737efa 100644 --- a/init.lua +++ b/init.lua @@ -4,6 +4,7 @@ if present then impatient.enable_profile() end +require("plugins.config.gruvbox") require("core.basic") require("plugins") vim.defer_fn(function() diff --git a/lua/plugins/config/gruvbox.lua b/lua/plugins/config/gruvbox.lua new file mode 100644 index 00000000..cfeffeff --- /dev/null +++ b/lua/plugins/config/gruvbox.lua @@ -0,0 +1,15 @@ +-- setup must be called before loading the colorscheme +-- Default options: +require("gruvbox").setup({ + undercurl = true, + underline = true, + bold = true, + italic = true, -- will make italic comments and special strings + inverse = true, -- invert background for search, diffs, statuslines and errors + invert_selection = false, + invert_signs = false, + invert_tabline = false, + invert_intend_guides = false, + contrast = "soft", -- can be "hard" or "soft" + overrides = {}, +}) From ae76c13d9806ecff24b8b099ba36112552419aa8 Mon Sep 17 00:00:00 2001 From: luokai Date: Wed, 29 Jun 2022 21:48:39 +0800 Subject: [PATCH 0271/1278] color --- lua/plugins/config/gruvbox.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lua/plugins/config/gruvbox.lua b/lua/plugins/config/gruvbox.lua index cfeffeff..27ea51de 100644 --- a/lua/plugins/config/gruvbox.lua +++ b/lua/plugins/config/gruvbox.lua @@ -10,6 +10,6 @@ require("gruvbox").setup({ invert_signs = false, invert_tabline = false, invert_intend_guides = false, - contrast = "soft", -- can be "hard" or "soft" + contrast = "", -- can be "hard" or "soft" overrides = {}, }) From 0c18f86b3d1e0af4eafb1e07fd12da2eb8ce451f Mon Sep 17 00:00:00 2001 From: luokai Date: Thu, 30 Jun 2022 19:27:06 +0800 Subject: [PATCH 0272/1278] neogit --- lua/plugins/init.lua | 1 + 1 file changed, 1 insertion(+) diff --git a/lua/plugins/init.lua b/lua/plugins/init.lua index a3ae3028..d510bed1 100644 --- a/lua/plugins/init.lua +++ b/lua/plugins/init.lua @@ -82,6 +82,7 @@ require("packer").startup({ -- git use("tpope/vim-fugitive") + use({ "TimUntersberger/neogit", requires = "nvim-lua/plenary.nvim" }) -- LeaderF -- use 'Yggdroot/LeaderF' From ecb88a3cbead461b2eb195cead6039334f501a26 Mon Sep 17 00:00:00 2001 From: luokai Date: Thu, 30 Jun 2022 20:00:23 +0800 Subject: [PATCH 0273/1278] diffview-nvim --- lua/plugins/config/diffview-nvim.lua | 118 +++++++++++++++++++++++++++ lua/plugins/init.lua | 2 + 2 files changed, 120 insertions(+) create mode 100644 lua/plugins/config/diffview-nvim.lua diff --git a/lua/plugins/config/diffview-nvim.lua b/lua/plugins/config/diffview-nvim.lua new file mode 100644 index 00000000..000adfd0 --- /dev/null +++ b/lua/plugins/config/diffview-nvim.lua @@ -0,0 +1,118 @@ +-- Lua +local actions = require("diffview.actions") + +require("diffview").setup({ + diff_binaries = false, -- Show diffs for binaries + enhanced_diff_hl = false, -- See ':h diffview-config-enhanced_diff_hl' + git_cmd = { "git" }, -- The git executable followed by default args. + use_icons = true, -- Requires nvim-web-devicons + icons = { -- Only applies when use_icons is true. + folder_closed = "", + folder_open = "", + }, + signs = { + fold_closed = "", + fold_open = "", + }, + file_panel = { + listing_style = "tree", -- One of 'list' or 'tree' + tree_options = { -- Only applies when listing_style is 'tree' + flatten_dirs = true, -- Flatten dirs that only contain one single dir + folder_statuses = "only_folded", -- One of 'never', 'only_folded' or 'always'. + }, + win_config = { -- See ':h diffview-config-win_config' + position = "left", + width = 35, + }, + }, + file_history_panel = { + log_options = { -- See ':h diffview-config-log_options' + single_file = { + diff_merges = "combined", + }, + multi_file = { + diff_merges = "first-parent", + }, + }, + win_config = { -- See ':h diffview-config-win_config' + position = "bottom", + height = 16, + }, + }, + commit_log_panel = { + win_config = {}, -- See ':h diffview-config-win_config' + }, + default_args = { -- Default args prepended to the arg-list for the listed commands + DiffviewOpen = {}, + DiffviewFileHistory = {}, + }, + hooks = {}, -- See ':h diffview-config-hooks' + keymaps = { + disable_defaults = false, -- Disable the default keymaps + view = { + -- The `view` bindings are active in the diff buffers, only when the current + -- tabpage is a Diffview. + [""] = actions.select_next_entry, -- Open the diff for the next file + [""] = actions.select_prev_entry, -- Open the diff for the previous file + ["gf"] = actions.goto_file, -- Open the file in a new split in the previous tabpage + [""] = actions.goto_file_split, -- Open the file in a new split + ["gf"] = actions.goto_file_tab, -- Open the file in a new tabpage + ["e"] = actions.focus_files, -- Bring focus to the files panel + ["b"] = actions.toggle_files, -- Toggle the files panel. + }, + file_panel = { + ["j"] = actions.next_entry, -- Bring the cursor to the next file entry + [""] = actions.next_entry, + ["k"] = actions.prev_entry, -- Bring the cursor to the previous file entry. + [""] = actions.prev_entry, + [""] = actions.select_entry, -- Open the diff for the selected entry. + ["o"] = actions.select_entry, + ["<2-LeftMouse>"] = actions.select_entry, + ["-"] = actions.toggle_stage_entry, -- Stage / unstage the selected entry. + ["S"] = actions.stage_all, -- Stage all entries. + ["U"] = actions.unstage_all, -- Unstage all entries. + ["X"] = actions.restore_entry, -- Restore entry to the state on the left side. + ["R"] = actions.refresh_files, -- Update stats and entries in the file list. + ["L"] = actions.open_commit_log, -- Open the commit log panel. + [""] = actions.scroll_view(-0.25), -- Scroll the view up + [""] = actions.scroll_view(0.25), -- Scroll the view down + [""] = actions.select_next_entry, + [""] = actions.select_prev_entry, + ["gf"] = actions.goto_file, + [""] = actions.goto_file_split, + ["gf"] = actions.goto_file_tab, + ["i"] = actions.listing_style, -- Toggle between 'list' and 'tree' views + ["f"] = actions.toggle_flatten_dirs, -- Flatten empty subdirectories in tree listing style. + ["e"] = actions.focus_files, + ["b"] = actions.toggle_files, + }, + file_history_panel = { + ["g!"] = actions.options, -- Open the option panel + [""] = actions.open_in_diffview, -- Open the entry under the cursor in a diffview + ["y"] = actions.copy_hash, -- Copy the commit hash of the entry under the cursor + ["L"] = actions.open_commit_log, + ["zR"] = actions.open_all_folds, + ["zM"] = actions.close_all_folds, + ["j"] = actions.next_entry, + [""] = actions.next_entry, + ["k"] = actions.prev_entry, + [""] = actions.prev_entry, + [""] = actions.select_entry, + ["o"] = actions.select_entry, + ["<2-LeftMouse>"] = actions.select_entry, + [""] = actions.scroll_view(-0.25), + [""] = actions.scroll_view(0.25), + [""] = actions.select_next_entry, + [""] = actions.select_prev_entry, + ["gf"] = actions.goto_file, + [""] = actions.goto_file_split, + ["gf"] = actions.goto_file_tab, + ["e"] = actions.focus_files, + ["b"] = actions.toggle_files, + }, + option_panel = { + [""] = actions.select_entry, + ["q"] = actions.close, + }, + }, +}) diff --git a/lua/plugins/init.lua b/lua/plugins/init.lua index d510bed1..2ba017be 100644 --- a/lua/plugins/init.lua +++ b/lua/plugins/init.lua @@ -82,6 +82,7 @@ require("packer").startup({ -- git use("tpope/vim-fugitive") + use("sindrets/diffview.nvim") use({ "TimUntersberger/neogit", requires = "nvim-lua/plenary.nvim" }) -- LeaderF @@ -306,6 +307,7 @@ vim.defer_fn(function() -- require('plugins/config/autosave') -- require('plugins/config/nvim-neorg') require("plugins/config/null-ls") + require("plugins/config/diffview-nvim") vim.cmd([[ function! s:http_rest_init() abort lua require('plugins/config/rest-nvim') From 58373f60ab3b5a923f65913ffdbb52c45a41ca48 Mon Sep 17 00:00:00 2001 From: luokai Date: Thu, 30 Jun 2022 21:14:40 +0800 Subject: [PATCH 0274/1278] config neogit/diffview --- lua/plugins/config/bufferline.lua | 10 +++++ lua/plugins/config/lualine.lua | 12 +++++ lua/plugins/config/neogit.lua | 74 +++++++++++++++++++++++++++++++ lua/plugins/init.lua | 1 + 4 files changed, 97 insertions(+) create mode 100644 lua/plugins/config/neogit.lua diff --git a/lua/plugins/config/bufferline.lua b/lua/plugins/config/bufferline.lua index 715593e0..3f83c70d 100644 --- a/lua/plugins/config/bufferline.lua +++ b/lua/plugins/config/bufferline.lua @@ -33,6 +33,16 @@ require("bufferline").setup({ -- text_align = "center" text_align = "left", }, + { + filetype = "DiffviewFiles", + text = function() + return "DiffviewFilePanel" + end, + padding = 1, + highlight = "Directory", + -- text_align = "center" + text_align = "left", + }, { filetype = "Outline", text = " Outline", diff --git a/lua/plugins/config/lualine.lua b/lua/plugins/config/lualine.lua index 11c8a616..89ac7bb6 100644 --- a/lua/plugins/config/lualine.lua +++ b/lua/plugins/config/lualine.lua @@ -79,4 +79,16 @@ sqls.filetypes = { } table.insert(config.extensions, sqls) +-- DiffviewFilePanel +local diffview = {} +diffview.sections = { + lualine_a = { + { "filename", file_status = false }, + }, +} +diffview.filetypes = { + "DiffviewFiles", +} +table.insert(config.extensions, diffview) + require("lualine").setup(config) diff --git a/lua/plugins/config/neogit.lua b/lua/plugins/config/neogit.lua new file mode 100644 index 00000000..ce7fae02 --- /dev/null +++ b/lua/plugins/config/neogit.lua @@ -0,0 +1,74 @@ +local neogit = require("neogit") + +neogit.setup({ + disable_signs = false, + disable_hint = false, + disable_context_highlighting = false, + disable_commit_confirmation = false, + -- Neogit refreshes its internal state after specific events, which can be expensive depending on the repository size. + -- Disabling `auto_refresh` will make it so you have to manually refresh the status after you open it. + auto_refresh = true, + disable_builtin_notifications = false, + use_magit_keybindings = false, + commit_popup = { + kind = "split", + }, + -- Change the default way of opening neogit + kind = "tab", + -- customize displayed signs + signs = { + -- { CLOSED, OPENED } + section = { ">", "v" }, + item = { ">", "v" }, + hunk = { "", "" }, + }, + integrations = { + -- Neogit only provides inline diffs. If you want a more traditional way to look at diffs, you can use `sindrets/diffview.nvim`. + -- The diffview integration enables the diff popup, which is a wrapper around `sindrets/diffview.nvim`. + -- + -- Requires you to have `sindrets/diffview.nvim` installed. + -- use { + -- 'TimUntersberger/neogit', + -- requires = { + -- 'nvim-lua/plenary.nvim', + -- 'sindrets/diffview.nvim' + -- } + -- } + -- + diffview = true, + }, + -- Setting any section to `false` will make the section not render at all + sections = { + untracked = { + folded = true, + }, + unstaged = { + folded = true, + }, + staged = { + folded = true, + }, + stashes = { + folded = true, + }, + unpulled = { + folded = true, + }, + unmerged = { + folded = true, + }, + recent = { + folded = true, + }, + }, + -- override/add mappings + mappings = { + -- modify status buffer mappings + status = { + -- Adds a mapping with "B" as key that does the "BranchPopup" command + ["B"] = "BranchPopup", + -- Removes the default mapping of "s" + ["s"] = "", + }, + }, +}) diff --git a/lua/plugins/init.lua b/lua/plugins/init.lua index 2ba017be..442dd44d 100644 --- a/lua/plugins/init.lua +++ b/lua/plugins/init.lua @@ -308,6 +308,7 @@ vim.defer_fn(function() -- require('plugins/config/nvim-neorg') require("plugins/config/null-ls") require("plugins/config/diffview-nvim") + require("plugins/config/neogit") vim.cmd([[ function! s:http_rest_init() abort lua require('plugins/config/rest-nvim') From 171936be9771ecb8964a30e9006157904b18439d Mon Sep 17 00:00:00 2001 From: luokai Date: Thu, 30 Jun 2022 21:15:53 +0800 Subject: [PATCH 0275/1278] update --- lua/plugins/config/neogit.lua | 2 -- 1 file changed, 2 deletions(-) diff --git a/lua/plugins/config/neogit.lua b/lua/plugins/config/neogit.lua index ce7fae02..b65c4b68 100644 --- a/lua/plugins/config/neogit.lua +++ b/lua/plugins/config/neogit.lua @@ -67,8 +67,6 @@ neogit.setup({ status = { -- Adds a mapping with "B" as key that does the "BranchPopup" command ["B"] = "BranchPopup", - -- Removes the default mapping of "s" - ["s"] = "", }, }, }) From e2cc791ef38995f6b58abf1a405b4ea7dab6d38a Mon Sep 17 00:00:00 2001 From: luokai Date: Thu, 30 Jun 2022 21:19:19 +0800 Subject: [PATCH 0276/1278] update --- lua/plugins/config/neogit.lua | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/lua/plugins/config/neogit.lua b/lua/plugins/config/neogit.lua index b65c4b68..b8d622b5 100644 --- a/lua/plugins/config/neogit.lua +++ b/lua/plugins/config/neogit.lua @@ -40,13 +40,13 @@ neogit.setup({ -- Setting any section to `false` will make the section not render at all sections = { untracked = { - folded = true, + folded = false, }, unstaged = { - folded = true, + folded = false, }, staged = { - folded = true, + folded = false, }, stashes = { folded = true, @@ -55,7 +55,7 @@ neogit.setup({ folded = true, }, unmerged = { - folded = true, + folded = false, }, recent = { folded = true, From aa165f77a6d12f610be18b18432ddba96cbc54a8 Mon Sep 17 00:00:00 2001 From: luokai Date: Fri, 1 Jul 2022 09:51:39 +0800 Subject: [PATCH 0277/1278] zgc --- lua/lsp/java.lua | 1 + 1 file changed, 1 insertion(+) diff --git a/lua/lsp/java.lua b/lua/lsp/java.lua index 054e7989..03efefce 100644 --- a/lua/lsp/java.lua +++ b/lua/lsp/java.lua @@ -72,6 +72,7 @@ M.setup = function() -- '-XX:+UseG1GC', -- '-XX:+UseStringDeduplication', -- '-Xms512m', + "-XX:+UseZGC", "-Xmx2g", -- "-Xbootclasspath/a:" .. get_lombok_jar(), "-javaagent:" .. get_lombok_jar(), From 05f27ee1651d853ee620db388c51857e1b45869f Mon Sep 17 00:00:00 2001 From: luokai Date: Fri, 1 Jul 2022 15:11:47 +0800 Subject: [PATCH 0278/1278] packer_bootstrap --- init.lua | 1 - lua/packer_bootstrap.lua | 15 +++++++++++++++ lua/plugins/config/bufferline.lua | 4 ++-- lua/plugins/init.lua | 9 +++++++-- 4 files changed, 24 insertions(+), 5 deletions(-) create mode 100644 lua/packer_bootstrap.lua diff --git a/init.lua b/init.lua index 8f737efa..560ce9fc 100644 --- a/init.lua +++ b/init.lua @@ -4,7 +4,6 @@ if present then impatient.enable_profile() end -require("plugins.config.gruvbox") require("core.basic") require("plugins") vim.defer_fn(function() diff --git a/lua/packer_bootstrap.lua b/lua/packer_bootstrap.lua new file mode 100644 index 00000000..7fdb05a8 --- /dev/null +++ b/lua/packer_bootstrap.lua @@ -0,0 +1,15 @@ +local fn = vim.fn +local install_path = fn.stdpath("data") .. "/site/pack/packer/start/packer.nvim" +local packer_bootstrap = false +if fn.empty(fn.glob(install_path)) > 0 then + vim.notify(install_path, vim.log.levels.INFO) + packer_bootstrap = fn.system({ + "git", + "clone", + "--depth", + "1", + "https://github.com/wbthomason/packer.nvim", + install_path, + }) +end +return packer_bootstrap diff --git a/lua/plugins/config/bufferline.lua b/lua/plugins/config/bufferline.lua index 3f83c70d..94958e2b 100644 --- a/lua/plugins/config/bufferline.lua +++ b/lua/plugins/config/bufferline.lua @@ -55,8 +55,8 @@ require("bufferline").setup({ color_icons = true, show_buffer_close_icons = true, show_buffer_default_icon = true, - show_close_icon = false, + show_close_icon = true, show_tab_indicators = true, -- separator_style = "slant" | "thick" | "thin" | { 'any', 'any' }, - separator_style = "slant", + separator_style = "padded_slant", }) diff --git a/lua/plugins/init.lua b/lua/plugins/init.lua index 442dd44d..85ec3c96 100644 --- a/lua/plugins/init.lua +++ b/lua/plugins/init.lua @@ -1,6 +1,6 @@ -require("plugins/config/symbols-outline") +local bootstrap = require("packer_bootstrap") require("packer").startup({ - function() + function(use) use({ "nvim-lua/plenary.nvim" }) use({ "lewis6991/impatient.nvim" }) use({ "nathom/filetype.nvim" }) @@ -260,6 +260,9 @@ require("packer").startup({ use("tversteeg/registers.nvim") use("nanotee/sqls.nvim") + if bootstrap then + require("packer").sync() + end end, config = { display = { @@ -268,6 +271,7 @@ require("packer").startup({ }, }) +require("plugins/config/gruvbox") require("plugins/config/bufferline") require("plugins/config/indent-blankline") -- require('plugins/config/dashboard-nvim') @@ -275,6 +279,7 @@ require("plugins/config/alpha-nvim") require("plugins/config/lualine") require("plugins/config/nvim-tree") require("plugins/config/vim-illuminate") +require("plugins/config/symbols-outline") -- 异步加载 vim.defer_fn(function() require("plugins/config/nvim-treesitter") From 28fdfc2b4e6eaf8a30efe2c3c83572ee8b03761c Mon Sep 17 00:00:00 2001 From: luokai Date: Fri, 1 Jul 2022 16:50:52 +0800 Subject: [PATCH 0279/1278] =?UTF-8?q?=E9=A1=BA=E5=BA=8F=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lua/plugins/init.lua | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lua/plugins/init.lua b/lua/plugins/init.lua index 85ec3c96..77c1da0f 100644 --- a/lua/plugins/init.lua +++ b/lua/plugins/init.lua @@ -1,15 +1,15 @@ local bootstrap = require("packer_bootstrap") require("packer").startup({ function(use) + -- Packer can manage itself + use("wbthomason/packer.nvim") use({ "nvim-lua/plenary.nvim" }) use({ "lewis6991/impatient.nvim" }) use({ "nathom/filetype.nvim" }) - -- Packer can manage itself - use("wbthomason/packer.nvim") + use("kyazdani42/nvim-web-devicons") use({ "neovim/nvim-lspconfig", "williamboman/nvim-lsp-installer" }) - use("kyazdani42/nvim-web-devicons") -- nvim-cmp use("hrsh7th/cmp-nvim-lsp") -- { name = nvim_lsp } From 259f8f90bb86e22c04b2f47d89bee6529c0aedb8 Mon Sep 17 00:00:00 2001 From: luokai Date: Fri, 1 Jul 2022 17:01:22 +0800 Subject: [PATCH 0280/1278] recent_commit_count --- lua/plugins/config/neogit.lua | 3 +++ 1 file changed, 3 insertions(+) diff --git a/lua/plugins/config/neogit.lua b/lua/plugins/config/neogit.lua index b8d622b5..ca9d3d81 100644 --- a/lua/plugins/config/neogit.lua +++ b/lua/plugins/config/neogit.lua @@ -69,4 +69,7 @@ neogit.setup({ ["B"] = "BranchPopup", }, }, + status = { + recent_commit_count = 40, + }, }) From 09a3a112e5fe7ba13a97700e6701a9cdd50c341a Mon Sep 17 00:00:00 2001 From: luokai Date: Fri, 1 Jul 2022 20:28:10 +0800 Subject: [PATCH 0281/1278] gruvbox --- init.lua | 12 ------------ lua/plugins/config/gruvbox.lua | 11 +++++++++++ 2 files changed, 11 insertions(+), 12 deletions(-) diff --git a/init.lua b/init.lua index 560ce9fc..a6deaa34 100644 --- a/init.lua +++ b/init.lua @@ -11,15 +11,3 @@ vim.defer_fn(function() require("core.utils.plantuml").setup() end, 0) - --- vim.api.nvim_command('colorscheme gruvbox') -vim.cmd([[ -set background=dark -" g:gruvbox_contrast_dark=hard -" set background=light -" g:gruvbox_contrast_light=medium -colorscheme gruvbox -" 丢失配色, 变为透明 -" highlight Normal guibg=NONE ctermbg=None -" autocmd vimenter * hi Normal guibg=#282828 -]]) diff --git a/lua/plugins/config/gruvbox.lua b/lua/plugins/config/gruvbox.lua index 27ea51de..b13cc8c6 100644 --- a/lua/plugins/config/gruvbox.lua +++ b/lua/plugins/config/gruvbox.lua @@ -13,3 +13,14 @@ require("gruvbox").setup({ contrast = "", -- can be "hard" or "soft" overrides = {}, }) +-- vim.api.nvim_command('colorscheme gruvbox') +vim.cmd([[ +set background=dark +" g:gruvbox_contrast_dark=hard +" set background=light +" g:gruvbox_contrast_light=medium +colorscheme gruvbox +" 丢失配色, 变为透明 +" highlight Normal guibg=NONE ctermbg=None +" autocmd vimenter * hi Normal guibg=#282828 +]]) From 5fc3523c126f665779c5febb447499c6803cb145 Mon Sep 17 00:00:00 2001 From: luokai Date: Fri, 1 Jul 2022 20:44:31 +0800 Subject: [PATCH 0282/1278] bufferline --- lua/plugins/config/bufferline.lua | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/lua/plugins/config/bufferline.lua b/lua/plugins/config/bufferline.lua index 94958e2b..793b2a38 100644 --- a/lua/plugins/config/bufferline.lua +++ b/lua/plugins/config/bufferline.lua @@ -51,12 +51,12 @@ require("bufferline").setup({ text_align = "left", }, }, + color_icons = true, + show_buffer_close_icons = true, + show_buffer_default_icon = true, + show_close_icon = false, + show_tab_indicators = true, + -- separator_style = "slant" | "thick" | "thin" | { 'any', 'any' }, + separator_style = "slant", }, - color_icons = true, - show_buffer_close_icons = true, - show_buffer_default_icon = true, - show_close_icon = true, - show_tab_indicators = true, - -- separator_style = "slant" | "thick" | "thin" | { 'any', 'any' }, - separator_style = "padded_slant", }) From 040ecc087fb8b7fd607d8a1b61b51d6adca96b8c Mon Sep 17 00:00:00 2001 From: luokai Date: Fri, 1 Jul 2022 23:25:40 +0800 Subject: [PATCH 0283/1278] bw --- lua/core/keybindings.lua | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lua/core/keybindings.lua b/lua/core/keybindings.lua index 7af680d4..083dd85a 100644 --- a/lua/core/keybindings.lua +++ b/lua/core/keybindings.lua @@ -27,8 +27,8 @@ M.setup = function() require("core.utils").close_other_bufline() end, {}) map("n", "s", ":w", opt) - map("n", "w", ":bdelete", opt) - map("n", "W", ":bdelete!", opt) + map("n", "w", ":bwipeout", opt) + map("n", "W", ":%bwipeout", opt) map("n", "q", ":q", opt) map("n", "n", ":BufferLineCycleNext ", opt) map("n", "p", ":BufferLineCyclePrev ", opt) From ab63feb40d67f8c6e432a75635ca9542dac07002 Mon Sep 17 00:00:00 2001 From: luokai Date: Fri, 1 Jul 2022 23:34:46 +0800 Subject: [PATCH 0284/1278] -Xmx4g --- lua/lsp/java.lua | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lua/lsp/java.lua b/lua/lsp/java.lua index 03efefce..4be821bd 100644 --- a/lua/lsp/java.lua +++ b/lua/lsp/java.lua @@ -20,7 +20,7 @@ local function get_maven_settings() end local function get_java_home() - return or_default(env.JAVA_HOME, "/opt/software/java/zulu11.56.19-ca-jdk11.0.15-macosx_aarch64") + return or_default(env.JAVA_HOME, "/opt/software/java/zulu17.34.19-ca-jdk17.0.3-macosx_aarch64") end local function get_java() @@ -73,7 +73,7 @@ M.setup = function() -- '-XX:+UseStringDeduplication', -- '-Xms512m', "-XX:+UseZGC", - "-Xmx2g", + "-Xmx4g", -- "-Xbootclasspath/a:" .. get_lombok_jar(), "-javaagent:" .. get_lombok_jar(), "--add-modules=ALL-SYSTEM", From e32621d1290bc8e000d1c8cd2ab43bf13d4103d4 Mon Sep 17 00:00:00 2001 From: luokai Date: Sun, 3 Jul 2022 22:13:51 +0800 Subject: [PATCH 0285/1278] dap --- init.lua | 1 + lua/dap-cfg/codelldb.lua | 79 ++++++++++++++++++++++++++++++++++++++++ lua/dap-cfg/init.lua | 1 + 3 files changed, 81 insertions(+) create mode 100644 lua/dap-cfg/codelldb.lua create mode 100644 lua/dap-cfg/init.lua diff --git a/init.lua b/init.lua index a6deaa34..973bfb40 100644 --- a/init.lua +++ b/init.lua @@ -8,6 +8,7 @@ require("core.basic") require("plugins") vim.defer_fn(function() require("lsp") + require("dap-cfg") require("core.utils.plantuml").setup() end, 0) diff --git a/lua/dap-cfg/codelldb.lua b/lua/dap-cfg/codelldb.lua new file mode 100644 index 00000000..7f5b8ea1 --- /dev/null +++ b/lua/dap-cfg/codelldb.lua @@ -0,0 +1,79 @@ +local M = {} +local extension_path = "/Users/luokai/.vscode/extensions/vadimcn.vscode-lldb-1.7.0" +M.config = {} +M.config.codelldb_path = extension_path .. "/adapter/codelldb" + +M.setup = function(config) + if config then + M.config = vim.tbl_deep_extend("force", M.config, config) + end + local dap = require("dap") + dap.adapters.codelldb = function(on_adapter) + -- This asks the system for a free port + local tcp = vim.loop.new_tcp() + tcp:bind("127.0.0.1", 0) + local port = tcp:getsockname().port + tcp:shutdown() + tcp:close() + + -- Start codelldb with the port + local stdout = vim.loop.new_pipe(false) + local stderr = vim.loop.new_pipe(false) + local opts = { + stdio = { nil, stdout, stderr }, + args = { "--port", tostring(port) }, + } + local handle + local pid_or_err + handle, pid_or_err = vim.loop.spawn(M.config.codelldb_path, opts, function(code) + stdout:close() + stderr:close() + handle:close() + if code ~= 0 then + print("codelldb exited with code", code) + end + end) + if not handle then + vim.notify("Error running codelldb: " .. tostring(pid_or_err), vim.log.levels.ERROR) + stdout:close() + stderr:close() + return + end + vim.notify("codelldb started. pid=" .. pid_or_err) + stderr:read_start(function(err, chunk) + assert(not err, err) + if chunk then + vim.schedule(function() + require("dap.repl").append(chunk) + end) + end + end) + local adapter = { + type = "server", + host = "127.0.0.1", + port = port, + } + -- 💀 + -- Wait for codelldb to get ready and start listening before telling nvim-dap to connect + -- If you get connect errors, try to increase 500 to a higher value, or check the stderr (Open the REPL) + vim.defer_fn(function() + on_adapter(adapter) + end, 500) + end + + dap.configurations.cpp = { + { + name = "Launch file", + type = "codelldb", + request = "launch", + program = function() + return vim.fn.input("Path to executable: ", vim.fn.getcwd() .. "/", "file") + end, + cwd = "${workspaceFolder}", + stopOnEntry = true, + }, + } + dap.configurations.c = dap.configurations.cpp + dap.configurations.rust = dap.configurations.cpp +end +return M diff --git a/lua/dap-cfg/init.lua b/lua/dap-cfg/init.lua new file mode 100644 index 00000000..8f03e0ff --- /dev/null +++ b/lua/dap-cfg/init.lua @@ -0,0 +1 @@ +require("dap-cfg.codelldb").setup() From 9d7ed12b3f62bc3b19a9f9aed53e2a77cd19836d Mon Sep 17 00:00:00 2001 From: luokai Date: Mon, 4 Jul 2022 09:31:07 +0800 Subject: [PATCH 0286/1278] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E5=91=BD=E5=90=8D?= =?UTF-8?q?=E7=A9=BA=E9=97=B4=EF=BC=8C=E9=98=B2=E6=AD=A2=E5=92=8C=E6=8F=92?= =?UTF-8?q?=E4=BB=B6=E5=86=B2=E7=AA=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- init.lua | 10 ++-- lua/dap-cfg/init.lua | 1 - lua/{ => kide}/core/basic.lua | 0 lua/{ => kide}/core/keybindings.lua | 12 ++-- lua/{ => kide}/core/utils/init.lua | 0 lua/{ => kide}/core/utils/plantuml.lua | 2 +- lua/{dap-cfg => kide/dap}/codelldb.lua | 0 lua/kide/dap/init.lua | 1 + lua/{ => kide}/lsp/clangd.lua | 0 lua/{ => kide}/lsp/gopls.lua | 0 lua/{ => kide}/lsp/html.lua | 0 lua/{ => kide}/lsp/init.lua | 20 +++---- lua/{ => kide}/lsp/java.lua | 4 +- lua/{ => kide}/lsp/jsonls.lua | 0 lua/{ => kide}/lsp/pyright.lua | 0 lua/{ => kide}/lsp/rust_analyzer.lua | 0 lua/{ => kide}/lsp/sqls.lua | 0 lua/{ => kide}/lsp/sumneko_lua.lua | 0 lua/{ => kide}/lsp/tsserver.lua | 0 lua/{ => kide}/lsp/utils/init.lua | 0 lua/{ => kide}/plugins/config/LeaderF.lua | 0 lua/{ => kide}/plugins/config/aerial.lua | 0 lua/{ => kide}/plugins/config/alpha-nvim.lua | 0 lua/{ => kide}/plugins/config/asynctasks.lua | 0 lua/{ => kide}/plugins/config/autosave.lua | 0 lua/{ => kide}/plugins/config/bufferline.lua | 0 lua/{ => kide}/plugins/config/comment.lua | 0 .../plugins/config/dashboard-nvim.lua | 0 .../plugins/config/diffview-nvim.lua | 0 lua/{ => kide}/plugins/config/feline.lua | 0 lua/{ => kide}/plugins/config/formatter.lua | 0 .../plugins/config/gitsigns-nvim.lua | 0 lua/{ => kide}/plugins/config/gruvbox.lua | 0 .../plugins/config/indent-blankline.lua | 0 lua/{ => kide}/plugins/config/lsp-colors.lua | 0 .../plugins/config/lsp_signature.lua | 0 lua/{ => kide}/plugins/config/lspsaga.lua | 0 lua/{ => kide}/plugins/config/lualine.lua | 0 lua/{ => kide}/plugins/config/luasnip.lua | 0 .../plugins/config/markdown-preview.lua | 0 lua/{ => kide}/plugins/config/neogit.lua | 0 lua/{ => kide}/plugins/config/null-ls.lua | 2 +- .../plugins/config/nvim-autopairs.lua | 0 lua/{ => kide}/plugins/config/nvim-cmp.lua | 2 +- .../plugins/config/nvim-colorizer.lua | 0 lua/{ => kide}/plugins/config/nvim-dap.lua | 0 .../plugins/config/nvim-lsputils.lua | 0 lua/{ => kide}/plugins/config/nvim-neorg.lua | 0 lua/{ => kide}/plugins/config/nvim-notify.lua | 0 lua/{ => kide}/plugins/config/nvim-tree.lua | 0 .../plugins/config/nvim-treesitter.lua | 0 lua/{ => kide}/plugins/config/rest-nvim.lua | 0 .../plugins/config/symbols-outline.lua | 0 .../plugins/config/telescope-fzf.lua | 0 lua/{ => kide}/plugins/config/telescope.lua | 0 lua/{ => kide}/plugins/config/toggletasks.lua | 0 lua/{ => kide}/plugins/config/translate.lua | 0 lua/{ => kide}/plugins/config/trouble.lua | 0 .../plugins/config/vim-floaterm.lua | 0 .../plugins/config/vim-illuminate.lua | 0 lua/{ => kide}/plugins/config/vista.lua | 0 lua/{ => kide}/plugins/config/wilder.lua | 0 lua/{ => kide}/plugins/init.lua | 56 +++++++++---------- 63 files changed, 55 insertions(+), 55 deletions(-) delete mode 100644 lua/dap-cfg/init.lua rename lua/{ => kide}/core/basic.lua (100%) rename lua/{ => kide}/core/keybindings.lua (97%) rename lua/{ => kide}/core/utils/init.lua (100%) rename lua/{ => kide}/core/utils/plantuml.lua (97%) rename lua/{dap-cfg => kide/dap}/codelldb.lua (100%) create mode 100644 lua/kide/dap/init.lua rename lua/{ => kide}/lsp/clangd.lua (100%) rename lua/{ => kide}/lsp/gopls.lua (100%) rename lua/{ => kide}/lsp/html.lua (100%) rename lua/{ => kide}/lsp/init.lua (85%) rename lua/{ => kide}/lsp/java.lua (98%) rename lua/{ => kide}/lsp/jsonls.lua (100%) rename lua/{ => kide}/lsp/pyright.lua (100%) rename lua/{ => kide}/lsp/rust_analyzer.lua (100%) rename lua/{ => kide}/lsp/sqls.lua (100%) rename lua/{ => kide}/lsp/sumneko_lua.lua (100%) rename lua/{ => kide}/lsp/tsserver.lua (100%) rename lua/{ => kide}/lsp/utils/init.lua (100%) rename lua/{ => kide}/plugins/config/LeaderF.lua (100%) rename lua/{ => kide}/plugins/config/aerial.lua (100%) rename lua/{ => kide}/plugins/config/alpha-nvim.lua (100%) rename lua/{ => kide}/plugins/config/asynctasks.lua (100%) rename lua/{ => kide}/plugins/config/autosave.lua (100%) rename lua/{ => kide}/plugins/config/bufferline.lua (100%) rename lua/{ => kide}/plugins/config/comment.lua (100%) rename lua/{ => kide}/plugins/config/dashboard-nvim.lua (100%) rename lua/{ => kide}/plugins/config/diffview-nvim.lua (100%) rename lua/{ => kide}/plugins/config/feline.lua (100%) rename lua/{ => kide}/plugins/config/formatter.lua (100%) rename lua/{ => kide}/plugins/config/gitsigns-nvim.lua (100%) rename lua/{ => kide}/plugins/config/gruvbox.lua (100%) rename lua/{ => kide}/plugins/config/indent-blankline.lua (100%) rename lua/{ => kide}/plugins/config/lsp-colors.lua (100%) rename lua/{ => kide}/plugins/config/lsp_signature.lua (100%) rename lua/{ => kide}/plugins/config/lspsaga.lua (100%) rename lua/{ => kide}/plugins/config/lualine.lua (100%) rename lua/{ => kide}/plugins/config/luasnip.lua (100%) rename lua/{ => kide}/plugins/config/markdown-preview.lua (100%) rename lua/{ => kide}/plugins/config/neogit.lua (100%) rename lua/{ => kide}/plugins/config/null-ls.lua (97%) rename lua/{ => kide}/plugins/config/nvim-autopairs.lua (100%) rename lua/{ => kide}/plugins/config/nvim-cmp.lua (96%) rename lua/{ => kide}/plugins/config/nvim-colorizer.lua (100%) rename lua/{ => kide}/plugins/config/nvim-dap.lua (100%) rename lua/{ => kide}/plugins/config/nvim-lsputils.lua (100%) rename lua/{ => kide}/plugins/config/nvim-neorg.lua (100%) rename lua/{ => kide}/plugins/config/nvim-notify.lua (100%) rename lua/{ => kide}/plugins/config/nvim-tree.lua (100%) rename lua/{ => kide}/plugins/config/nvim-treesitter.lua (100%) rename lua/{ => kide}/plugins/config/rest-nvim.lua (100%) rename lua/{ => kide}/plugins/config/symbols-outline.lua (100%) rename lua/{ => kide}/plugins/config/telescope-fzf.lua (100%) rename lua/{ => kide}/plugins/config/telescope.lua (100%) rename lua/{ => kide}/plugins/config/toggletasks.lua (100%) rename lua/{ => kide}/plugins/config/translate.lua (100%) rename lua/{ => kide}/plugins/config/trouble.lua (100%) rename lua/{ => kide}/plugins/config/vim-floaterm.lua (100%) rename lua/{ => kide}/plugins/config/vim-illuminate.lua (100%) rename lua/{ => kide}/plugins/config/vista.lua (100%) rename lua/{ => kide}/plugins/config/wilder.lua (100%) rename lua/{ => kide}/plugins/init.lua (84%) diff --git a/init.lua b/init.lua index 973bfb40..551714d3 100644 --- a/init.lua +++ b/init.lua @@ -4,11 +4,11 @@ if present then impatient.enable_profile() end -require("core.basic") -require("plugins") +require("kide.core.basic") +require("kide.plugins") vim.defer_fn(function() - require("lsp") - require("dap-cfg") + require("kide.lsp") + require("kide.dap") - require("core.utils.plantuml").setup() + require("kide.core.utils.plantuml").setup() end, 0) diff --git a/lua/dap-cfg/init.lua b/lua/dap-cfg/init.lua deleted file mode 100644 index 8f03e0ff..00000000 --- a/lua/dap-cfg/init.lua +++ /dev/null @@ -1 +0,0 @@ -require("dap-cfg.codelldb").setup() diff --git a/lua/core/basic.lua b/lua/kide/core/basic.lua similarity index 100% rename from lua/core/basic.lua rename to lua/kide/core/basic.lua diff --git a/lua/core/keybindings.lua b/lua/kide/core/keybindings.lua similarity index 97% rename from lua/core/keybindings.lua rename to lua/kide/core/keybindings.lua index 083dd85a..cec47daa 100644 --- a/lua/core/keybindings.lua +++ b/lua/kide/core/keybindings.lua @@ -22,9 +22,9 @@ M.setup = function() map("n", "", ":nohlsearch", opt) -- %bd 删除所有缓冲区, e# 打开最后一个缓冲区, bd# 关闭[No Name] -- map('n', 'o', ':%bd|e#|bd#', opt) - -- map('n', 'o', 'lua require("core.utils").close_other_bufline()', opt) + -- map('n', 'o', 'lua require("kide.core.utils").close_other_bufline()', opt) vim.api.nvim_create_user_command("BufferCloseOther", function() - require("core.utils").close_other_bufline() + require("kide.core.utils").close_other_bufline() end, {}) map("n", "s", ":w", opt) map("n", "w", ":bwipeout", opt) @@ -64,14 +64,14 @@ M.setup = function() map("n", "ff", "Telescope find_files", opt) keymap("v", "ff", function() local tb = require("telescope.builtin") - local text = require("core.utils").get_visual_selection() + local text = require("kide.core.utils").get_visual_selection() tb.find_files({ default_text = text }) end, opt) map("n", "", "Telescope find_files", opt) map("n", "fg", "Telescope live_grep", opt) keymap("v", "fg", function() local tb = require("telescope.builtin") - local text = require("core.utils").get_visual_selection() + local text = require("kide.core.utils").get_visual_selection() tb.live_grep({ default_text = text }) end, opt) map("n", "fb", "Telescope buffers", opt) @@ -84,7 +84,7 @@ M.setup = function() map("v", "te", ":Translate EN -source=ZH -parse_after=window -output=floating", opt) -- camel_case - require("core.utils").camel_case_init() + require("kide.core.utils").camel_case_init() -- vim-easy-align vim.cmd([[ @@ -219,7 +219,7 @@ M.maplsp = function(client, bufnr) vim.api.nvim_buf_set_keymap(bufnr, "n", "fs", "Telescope lsp_dynamic_workspace_symbols", opt) keymap("v", "fs", function() local tb = require("telescope.builtin") - local text = require("core.utils").get_visual_selection() + local text = require("kide.core.utils").get_visual_selection() tb.lsp_workspace_symbols({ default_text = text, query = text }) end, opt) diff --git a/lua/core/utils/init.lua b/lua/kide/core/utils/init.lua similarity index 100% rename from lua/core/utils/init.lua rename to lua/kide/core/utils/init.lua diff --git a/lua/core/utils/plantuml.lua b/lua/kide/core/utils/plantuml.lua similarity index 97% rename from lua/core/utils/plantuml.lua rename to lua/kide/core/utils/plantuml.lua index dc1f1470..0c3a4a37 100644 --- a/lua/core/utils/plantuml.lua +++ b/lua/kide/core/utils/plantuml.lua @@ -1,4 +1,4 @@ -local utils = require("core.utils") +local utils = require("kide.core.utils") local M = {} M.config = {} diff --git a/lua/dap-cfg/codelldb.lua b/lua/kide/dap/codelldb.lua similarity index 100% rename from lua/dap-cfg/codelldb.lua rename to lua/kide/dap/codelldb.lua diff --git a/lua/kide/dap/init.lua b/lua/kide/dap/init.lua new file mode 100644 index 00000000..690cb028 --- /dev/null +++ b/lua/kide/dap/init.lua @@ -0,0 +1 @@ +require("kide.dap.codelldb").setup() diff --git a/lua/lsp/clangd.lua b/lua/kide/lsp/clangd.lua similarity index 100% rename from lua/lsp/clangd.lua rename to lua/kide/lsp/clangd.lua diff --git a/lua/lsp/gopls.lua b/lua/kide/lsp/gopls.lua similarity index 100% rename from lua/lsp/gopls.lua rename to lua/kide/lsp/gopls.lua diff --git a/lua/lsp/html.lua b/lua/kide/lsp/html.lua similarity index 100% rename from lua/lsp/html.lua rename to lua/kide/lsp/html.lua diff --git a/lua/lsp/init.lua b/lua/kide/lsp/init.lua similarity index 85% rename from lua/lsp/init.lua rename to lua/kide/lsp/init.lua index e73f2f1d..3f2439ed 100644 --- a/lua/lsp/init.lua +++ b/lua/kide/lsp/init.lua @@ -17,23 +17,23 @@ lsp_installer.setup({ -- https://github.com/williamboman/nvim-lsp-installer#available-lsps -- { key: 语言 value: 配置文件 } local server_configs = { - sumneko_lua = require("lsp.sumneko_lua"), -- /lua/lsp/lua.lua + sumneko_lua = require("kide.lsp.sumneko_lua"), -- /lua/lsp/lua.lua -- jdtls = require "lsp.java", -- /lua/lsp/jdtls.lua -- jsonls = require("lsp.jsonls"), - clangd = require("lsp.clangd"), - tsserver = require("lsp.tsserver"), - html = require("lsp.html"), - pyright = require("lsp.pyright"), - rust_analyzer = require("lsp.rust_analyzer"), - sqls = require("lsp.sqls"), - gopls = require("lsp.gopls"), + clangd = require("kide.lsp.clangd"), + tsserver = require("kide.lsp.tsserver"), + html = require("kide.lsp.html"), + pyright = require("kide.lsp.pyright"), + rust_analyzer = require("kide.lsp.rust_analyzer"), + sqls = require("kide.lsp.sqls"), + gopls = require("kide.lsp.gopls"), } -- Setup lspconfig. local capabilities = require("cmp_nvim_lsp").update_capabilities(vim.lsp.protocol.make_client_capabilities()) -- 没有确定使用效果参数 -- capabilities.textDocument.completion.completionItem.snippetSupport = true -local utils = require("core.utils") +local utils = require("kide.core.utils") for _, server in ipairs(lsp_installer.get_installed_servers()) do -- tools config local cfg = utils.or_default(server_configs[server.name], {}) @@ -44,7 +44,7 @@ for _, server in ipairs(lsp_installer.get_installed_servers()) do local on_attach = scfg.on_attach scfg.on_attach = function(client, bufnr) -- 绑定快捷键 - require("core.keybindings").maplsp(client, bufnr) + require("kide.core.keybindings").maplsp(client, bufnr) if on_attach then on_attach(client, bufnr) end diff --git a/lua/lsp/java.lua b/lua/kide/lsp/java.lua similarity index 98% rename from lua/lsp/java.lua rename to lua/kide/lsp/java.lua index 4be821bd..7bf8faa1 100644 --- a/lua/lsp/java.lua +++ b/lua/kide/lsp/java.lua @@ -11,7 +11,7 @@ local env = { } local function or_default(a, v) - return require("core.utils").or_default(a, v) + return require("kide.core.utils").or_default(a, v) end local maven_settings = env.MAVEN_HOME .. "/conf/settings.xml" @@ -252,7 +252,7 @@ M.setup = function() -- Remove the option if you do not want that. require("jdtls").setup_dap({ hotcodereplace = "auto" }) require("jdtls.setup").add_commands() - require("core.keybindings").maplsp(client, bufnr) + require("kide.core.keybindings").maplsp(client, bufnr) -- require('jdtls.dap').setup_dap_main_class_configs({ verbose = true }) end diff --git a/lua/lsp/jsonls.lua b/lua/kide/lsp/jsonls.lua similarity index 100% rename from lua/lsp/jsonls.lua rename to lua/kide/lsp/jsonls.lua diff --git a/lua/lsp/pyright.lua b/lua/kide/lsp/pyright.lua similarity index 100% rename from lua/lsp/pyright.lua rename to lua/kide/lsp/pyright.lua diff --git a/lua/lsp/rust_analyzer.lua b/lua/kide/lsp/rust_analyzer.lua similarity index 100% rename from lua/lsp/rust_analyzer.lua rename to lua/kide/lsp/rust_analyzer.lua diff --git a/lua/lsp/sqls.lua b/lua/kide/lsp/sqls.lua similarity index 100% rename from lua/lsp/sqls.lua rename to lua/kide/lsp/sqls.lua diff --git a/lua/lsp/sumneko_lua.lua b/lua/kide/lsp/sumneko_lua.lua similarity index 100% rename from lua/lsp/sumneko_lua.lua rename to lua/kide/lsp/sumneko_lua.lua diff --git a/lua/lsp/tsserver.lua b/lua/kide/lsp/tsserver.lua similarity index 100% rename from lua/lsp/tsserver.lua rename to lua/kide/lsp/tsserver.lua diff --git a/lua/lsp/utils/init.lua b/lua/kide/lsp/utils/init.lua similarity index 100% rename from lua/lsp/utils/init.lua rename to lua/kide/lsp/utils/init.lua diff --git a/lua/plugins/config/LeaderF.lua b/lua/kide/plugins/config/LeaderF.lua similarity index 100% rename from lua/plugins/config/LeaderF.lua rename to lua/kide/plugins/config/LeaderF.lua diff --git a/lua/plugins/config/aerial.lua b/lua/kide/plugins/config/aerial.lua similarity index 100% rename from lua/plugins/config/aerial.lua rename to lua/kide/plugins/config/aerial.lua diff --git a/lua/plugins/config/alpha-nvim.lua b/lua/kide/plugins/config/alpha-nvim.lua similarity index 100% rename from lua/plugins/config/alpha-nvim.lua rename to lua/kide/plugins/config/alpha-nvim.lua diff --git a/lua/plugins/config/asynctasks.lua b/lua/kide/plugins/config/asynctasks.lua similarity index 100% rename from lua/plugins/config/asynctasks.lua rename to lua/kide/plugins/config/asynctasks.lua diff --git a/lua/plugins/config/autosave.lua b/lua/kide/plugins/config/autosave.lua similarity index 100% rename from lua/plugins/config/autosave.lua rename to lua/kide/plugins/config/autosave.lua diff --git a/lua/plugins/config/bufferline.lua b/lua/kide/plugins/config/bufferline.lua similarity index 100% rename from lua/plugins/config/bufferline.lua rename to lua/kide/plugins/config/bufferline.lua diff --git a/lua/plugins/config/comment.lua b/lua/kide/plugins/config/comment.lua similarity index 100% rename from lua/plugins/config/comment.lua rename to lua/kide/plugins/config/comment.lua diff --git a/lua/plugins/config/dashboard-nvim.lua b/lua/kide/plugins/config/dashboard-nvim.lua similarity index 100% rename from lua/plugins/config/dashboard-nvim.lua rename to lua/kide/plugins/config/dashboard-nvim.lua diff --git a/lua/plugins/config/diffview-nvim.lua b/lua/kide/plugins/config/diffview-nvim.lua similarity index 100% rename from lua/plugins/config/diffview-nvim.lua rename to lua/kide/plugins/config/diffview-nvim.lua diff --git a/lua/plugins/config/feline.lua b/lua/kide/plugins/config/feline.lua similarity index 100% rename from lua/plugins/config/feline.lua rename to lua/kide/plugins/config/feline.lua diff --git a/lua/plugins/config/formatter.lua b/lua/kide/plugins/config/formatter.lua similarity index 100% rename from lua/plugins/config/formatter.lua rename to lua/kide/plugins/config/formatter.lua diff --git a/lua/plugins/config/gitsigns-nvim.lua b/lua/kide/plugins/config/gitsigns-nvim.lua similarity index 100% rename from lua/plugins/config/gitsigns-nvim.lua rename to lua/kide/plugins/config/gitsigns-nvim.lua diff --git a/lua/plugins/config/gruvbox.lua b/lua/kide/plugins/config/gruvbox.lua similarity index 100% rename from lua/plugins/config/gruvbox.lua rename to lua/kide/plugins/config/gruvbox.lua diff --git a/lua/plugins/config/indent-blankline.lua b/lua/kide/plugins/config/indent-blankline.lua similarity index 100% rename from lua/plugins/config/indent-blankline.lua rename to lua/kide/plugins/config/indent-blankline.lua diff --git a/lua/plugins/config/lsp-colors.lua b/lua/kide/plugins/config/lsp-colors.lua similarity index 100% rename from lua/plugins/config/lsp-colors.lua rename to lua/kide/plugins/config/lsp-colors.lua diff --git a/lua/plugins/config/lsp_signature.lua b/lua/kide/plugins/config/lsp_signature.lua similarity index 100% rename from lua/plugins/config/lsp_signature.lua rename to lua/kide/plugins/config/lsp_signature.lua diff --git a/lua/plugins/config/lspsaga.lua b/lua/kide/plugins/config/lspsaga.lua similarity index 100% rename from lua/plugins/config/lspsaga.lua rename to lua/kide/plugins/config/lspsaga.lua diff --git a/lua/plugins/config/lualine.lua b/lua/kide/plugins/config/lualine.lua similarity index 100% rename from lua/plugins/config/lualine.lua rename to lua/kide/plugins/config/lualine.lua diff --git a/lua/plugins/config/luasnip.lua b/lua/kide/plugins/config/luasnip.lua similarity index 100% rename from lua/plugins/config/luasnip.lua rename to lua/kide/plugins/config/luasnip.lua diff --git a/lua/plugins/config/markdown-preview.lua b/lua/kide/plugins/config/markdown-preview.lua similarity index 100% rename from lua/plugins/config/markdown-preview.lua rename to lua/kide/plugins/config/markdown-preview.lua diff --git a/lua/plugins/config/neogit.lua b/lua/kide/plugins/config/neogit.lua similarity index 100% rename from lua/plugins/config/neogit.lua rename to lua/kide/plugins/config/neogit.lua diff --git a/lua/plugins/config/null-ls.lua b/lua/kide/plugins/config/null-ls.lua similarity index 97% rename from lua/plugins/config/null-ls.lua rename to lua/kide/plugins/config/null-ls.lua index ef998d98..77446958 100644 --- a/lua/plugins/config/null-ls.lua +++ b/lua/kide/plugins/config/null-ls.lua @@ -82,7 +82,7 @@ end null_ls.setup({ sources = sources, on_attach = function(client, bufnr) - require("core.keybindings").maplsp(client, bufnr) + require("kide.core.keybindings").maplsp(client, bufnr) -- on_attach(client, bufnr) end, -- debug = true, diff --git a/lua/plugins/config/nvim-autopairs.lua b/lua/kide/plugins/config/nvim-autopairs.lua similarity index 100% rename from lua/plugins/config/nvim-autopairs.lua rename to lua/kide/plugins/config/nvim-autopairs.lua diff --git a/lua/plugins/config/nvim-cmp.lua b/lua/kide/plugins/config/nvim-cmp.lua similarity index 96% rename from lua/plugins/config/nvim-cmp.lua rename to lua/kide/plugins/config/nvim-cmp.lua index 04b19584..e7baf797 100644 --- a/lua/plugins/config/nvim-cmp.lua +++ b/lua/kide/plugins/config/nvim-cmp.lua @@ -35,7 +35,7 @@ cmp.setup({ }), -- 快捷键 - mapping = require("core.keybindings").cmp(cmp), + mapping = require("kide.core.keybindings").cmp(cmp), -- 使用lspkind-nvim显示类型图标 formatting = { format = lspkind.cmp_format({ diff --git a/lua/plugins/config/nvim-colorizer.lua b/lua/kide/plugins/config/nvim-colorizer.lua similarity index 100% rename from lua/plugins/config/nvim-colorizer.lua rename to lua/kide/plugins/config/nvim-colorizer.lua diff --git a/lua/plugins/config/nvim-dap.lua b/lua/kide/plugins/config/nvim-dap.lua similarity index 100% rename from lua/plugins/config/nvim-dap.lua rename to lua/kide/plugins/config/nvim-dap.lua diff --git a/lua/plugins/config/nvim-lsputils.lua b/lua/kide/plugins/config/nvim-lsputils.lua similarity index 100% rename from lua/plugins/config/nvim-lsputils.lua rename to lua/kide/plugins/config/nvim-lsputils.lua diff --git a/lua/plugins/config/nvim-neorg.lua b/lua/kide/plugins/config/nvim-neorg.lua similarity index 100% rename from lua/plugins/config/nvim-neorg.lua rename to lua/kide/plugins/config/nvim-neorg.lua diff --git a/lua/plugins/config/nvim-notify.lua b/lua/kide/plugins/config/nvim-notify.lua similarity index 100% rename from lua/plugins/config/nvim-notify.lua rename to lua/kide/plugins/config/nvim-notify.lua diff --git a/lua/plugins/config/nvim-tree.lua b/lua/kide/plugins/config/nvim-tree.lua similarity index 100% rename from lua/plugins/config/nvim-tree.lua rename to lua/kide/plugins/config/nvim-tree.lua diff --git a/lua/plugins/config/nvim-treesitter.lua b/lua/kide/plugins/config/nvim-treesitter.lua similarity index 100% rename from lua/plugins/config/nvim-treesitter.lua rename to lua/kide/plugins/config/nvim-treesitter.lua diff --git a/lua/plugins/config/rest-nvim.lua b/lua/kide/plugins/config/rest-nvim.lua similarity index 100% rename from lua/plugins/config/rest-nvim.lua rename to lua/kide/plugins/config/rest-nvim.lua diff --git a/lua/plugins/config/symbols-outline.lua b/lua/kide/plugins/config/symbols-outline.lua similarity index 100% rename from lua/plugins/config/symbols-outline.lua rename to lua/kide/plugins/config/symbols-outline.lua diff --git a/lua/plugins/config/telescope-fzf.lua b/lua/kide/plugins/config/telescope-fzf.lua similarity index 100% rename from lua/plugins/config/telescope-fzf.lua rename to lua/kide/plugins/config/telescope-fzf.lua diff --git a/lua/plugins/config/telescope.lua b/lua/kide/plugins/config/telescope.lua similarity index 100% rename from lua/plugins/config/telescope.lua rename to lua/kide/plugins/config/telescope.lua diff --git a/lua/plugins/config/toggletasks.lua b/lua/kide/plugins/config/toggletasks.lua similarity index 100% rename from lua/plugins/config/toggletasks.lua rename to lua/kide/plugins/config/toggletasks.lua diff --git a/lua/plugins/config/translate.lua b/lua/kide/plugins/config/translate.lua similarity index 100% rename from lua/plugins/config/translate.lua rename to lua/kide/plugins/config/translate.lua diff --git a/lua/plugins/config/trouble.lua b/lua/kide/plugins/config/trouble.lua similarity index 100% rename from lua/plugins/config/trouble.lua rename to lua/kide/plugins/config/trouble.lua diff --git a/lua/plugins/config/vim-floaterm.lua b/lua/kide/plugins/config/vim-floaterm.lua similarity index 100% rename from lua/plugins/config/vim-floaterm.lua rename to lua/kide/plugins/config/vim-floaterm.lua diff --git a/lua/plugins/config/vim-illuminate.lua b/lua/kide/plugins/config/vim-illuminate.lua similarity index 100% rename from lua/plugins/config/vim-illuminate.lua rename to lua/kide/plugins/config/vim-illuminate.lua diff --git a/lua/plugins/config/vista.lua b/lua/kide/plugins/config/vista.lua similarity index 100% rename from lua/plugins/config/vista.lua rename to lua/kide/plugins/config/vista.lua diff --git a/lua/plugins/config/wilder.lua b/lua/kide/plugins/config/wilder.lua similarity index 100% rename from lua/plugins/config/wilder.lua rename to lua/kide/plugins/config/wilder.lua diff --git a/lua/plugins/init.lua b/lua/kide/plugins/init.lua similarity index 84% rename from lua/plugins/init.lua rename to lua/kide/plugins/init.lua index 77c1da0f..83f5a12f 100644 --- a/lua/plugins/init.lua +++ b/lua/kide/plugins/init.lua @@ -271,53 +271,53 @@ require("packer").startup({ }, }) -require("plugins/config/gruvbox") -require("plugins/config/bufferline") -require("plugins/config/indent-blankline") +require("kide.plugins.config.gruvbox") +require("kide.plugins.config.bufferline") +require("kide.plugins.config.indent-blankline") -- require('plugins/config/dashboard-nvim') -require("plugins/config/alpha-nvim") -require("plugins/config/lualine") -require("plugins/config/nvim-tree") -require("plugins/config/vim-illuminate") -require("plugins/config/symbols-outline") +require("kide.plugins.config.alpha-nvim") +require("kide.plugins.config.lualine") +require("kide.plugins.config.nvim-tree") +require("kide.plugins.config.vim-illuminate") +require("kide.plugins.config.symbols-outline") -- 异步加载 vim.defer_fn(function() - require("plugins/config/nvim-treesitter") + require("kide.plugins.config.nvim-treesitter") - require("plugins/config/luasnip") - require("plugins/config/nvim-cmp") + require("kide.plugins.config.luasnip") + require("kide.plugins.config.nvim-cmp") -- require('plugins/config/LeaderF') - require("plugins/config/gitsigns-nvim") + require("kide.plugins.config.gitsigns-nvim") -- require('plugins/config/vim-floaterm') -- require('plugins/config/asynctasks') - require("plugins/config/toggletasks") + require("kide.plugins.config.toggletasks") -- require('plugins/config/feline') -- require('plugins/config/vista') -- require('plugins/config/aerial') -- require('plugins/config/lsp-colors') - require("plugins/config/trouble") - require("plugins/config/nvim-notify") - require("plugins/config/wilder") - require("plugins/config/nvim-colorizer") - require("plugins/config/comment") + require("kide.plugins.config.trouble") + require("kide.plugins.config.nvim-notify") + require("kide.plugins.config.wilder") + require("kide.plugins.config.nvim-colorizer") + require("kide.plugins.config.comment") -- require('plugins/config/lspsaga') -- require('plugins/config/formatter') - require("plugins/config/telescope") + require("kide.plugins.config.telescope") -- require('plugins/config/nvim-lsputils') - require("plugins/config/nvim-autopairs") + require("kide.plugins.config.nvim-autopairs") -- require('plugins/config/lsp_signature') - require("plugins/config/nvim-dap") - require("plugins/config/markdown-preview") - require("plugins/config/translate") + require("kide.plugins.config.nvim-dap") + require("kide.plugins.config.markdown-preview") + require("kide.plugins.config.translate") -- require('plugins/config/autosave') -- require('plugins/config/nvim-neorg') - require("plugins/config/null-ls") - require("plugins/config/diffview-nvim") - require("plugins/config/neogit") + require("kide.plugins.config.null-ls") + require("kide.plugins.config.diffview-nvim") + require("kide.plugins.config.neogit") vim.cmd([[ function! s:http_rest_init() abort lua require('plugins/config/rest-nvim') - lua require('core.keybindings').rest_nvim() + lua require('kide.core.keybindings').rest_nvim() endfunction augroup http_rest autocmd! @@ -325,5 +325,5 @@ augroup http_rest augroup end ]]) - require("core.keybindings").setup() + require("kide.core.keybindings").setup() end, 0) From de6b0074506b6e59068d2d4ef6754ed15051a9b1 Mon Sep 17 00:00:00 2001 From: luokai Date: Mon, 4 Jul 2022 09:51:32 +0800 Subject: [PATCH 0287/1278] =?UTF-8?q?=E4=BD=BF=E7=94=A8=E8=AF=B4=E6=98=8E?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 17 ++--------------- 1 file changed, 2 insertions(+), 15 deletions(-) diff --git a/README.md b/README.md index 3336f72e..ab034e72 100644 --- a/README.md +++ b/README.md @@ -2,21 +2,6 @@ 支持 `Java`, `Rust`, `C/C++`, `JavaScript` 等编程语言开发。 -## Packer 插件管理器安装 - -### Linux, Mac - -```sh -git clone --depth 1 https://github.com/wbthomason/packer.nvim\ - ~/.local/share/nvim/site/pack/packer/start/packer.nvim -``` - -### Windows - -```sh -git clone https://github.com/wbthomason/packer.nvim "$env:LOCALAPPDATA\nvim-data\site\pack\packer\start\packer.nvim" -``` - ## 安装 ### Linux, Mac @@ -65,6 +50,8 @@ git clone https://github.com/JavaHello/nvim.git [NVIM 打造 Java IDE](https://javahello.github.io/dev/tools/NVIM-LSP-Java-IDE.html) +如果使用长时间后感觉卡顿,关闭下所有`buffer`, `:%bw` 。 + ### 功能演示 - 启动页 From 9c0d7081b64135c5db8ea98750c4e2dff91f1c1e Mon Sep 17 00:00:00 2001 From: luokai Date: Mon, 4 Jul 2022 09:51:45 +0800 Subject: [PATCH 0288/1278] =?UTF-8?q?=E5=91=BD=E5=90=8D=E7=A9=BA=E9=97=B4?= =?UTF-8?q?=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lua/kide/core/keybindings.lua | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lua/kide/core/keybindings.lua b/lua/kide/core/keybindings.lua index cec47daa..50fa0482 100644 --- a/lua/kide/core/keybindings.lua +++ b/lua/kide/core/keybindings.lua @@ -238,7 +238,7 @@ M.maplsp = function(client, bufnr) vim.lsp.buf.format({ bufnr = bfn, filter = function(c) - return require("lsp.utils").filter_format_lsp_client(c, bfn) + return require("kide.lsp.utils").filter_format_lsp_client(c, bfn) end, }) end, opt) @@ -246,7 +246,7 @@ M.maplsp = function(client, bufnr) bufnr, "v", "=", - 'lua require("lsp.utils").format_range_operator()', + 'lua require("kide.lsp.utils").format_range_operator()', opt ) -- mapbuf('v', '=', 'lua vim.lsp.buf.formatting()', opt) From 9601cacd2a13ce6c8ef2485e5347a8fba15f69e7 Mon Sep 17 00:00:00 2001 From: luokai Date: Mon, 4 Jul 2022 10:50:56 +0800 Subject: [PATCH 0289/1278] =?UTF-8?q?=E5=91=BD=E5=90=8D=E7=A9=BA=E9=97=B4?= =?UTF-8?q?=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lua/kide/lsp/init.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lua/kide/lsp/init.lua b/lua/kide/lsp/init.lua index 3f2439ed..1f15ab6e 100644 --- a/lua/kide/lsp/init.lua +++ b/lua/kide/lsp/init.lua @@ -103,6 +103,6 @@ vim.lsp.handlers["textDocument/signatureHelp"] = vim.lsp.with(vim.lsp.handlers.s vim.cmd([[ augroup jdtls_lsp autocmd! - autocmd FileType java lua require'lsp.java'.setup() + autocmd FileType java lua require"kide.lsp.java".setup() augroup end ]]) From 515325acc143840b578da0e9bbce7177c3dbb530 Mon Sep 17 00:00:00 2001 From: luokai Date: Mon, 4 Jul 2022 16:11:55 +0800 Subject: [PATCH 0290/1278] =?UTF-8?q?=E5=91=BD=E5=90=8D=E7=A9=BA=E9=97=B4?= =?UTF-8?q?=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lua/kide/plugins/init.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lua/kide/plugins/init.lua b/lua/kide/plugins/init.lua index 83f5a12f..da729590 100644 --- a/lua/kide/plugins/init.lua +++ b/lua/kide/plugins/init.lua @@ -316,7 +316,7 @@ vim.defer_fn(function() require("kide.plugins.config.neogit") vim.cmd([[ function! s:http_rest_init() abort - lua require('plugins/config/rest-nvim') + lua require('kide.plugins/config/rest-nvim') lua require('kide.core.keybindings').rest_nvim() endfunction augroup http_rest From 7ec2337fe0e811281d2be992728f1759cc759fe6 Mon Sep 17 00:00:00 2001 From: luokai Date: Mon, 4 Jul 2022 17:52:51 +0800 Subject: [PATCH 0291/1278] project.nvim --- lua/kide/core/keybindings.lua | 2 +- lua/kide/plugins/config/alpha-nvim.lua | 10 ++++++---- lua/kide/plugins/config/telescope.lua | 2 ++ lua/kide/plugins/init.lua | 8 +++++++- 4 files changed, 16 insertions(+), 6 deletions(-) diff --git a/lua/kide/core/keybindings.lua b/lua/kide/core/keybindings.lua index 50fa0482..e4ea18c2 100644 --- a/lua/kide/core/keybindings.lua +++ b/lua/kide/core/keybindings.lua @@ -182,7 +182,7 @@ map("n", "S", "lua require('spectre').open()", opt) map("n", "fr", "lua require('spectre').open_visual({select_word=true})", opt) map("v", "fr", "lua require('spectre').open_visual()", opt) -- search in current file -map("n", "fp", "viw:lua require('spectre').open_file_search()", opt) +-- map("n", "fp", "viw:lua require('spectre').open_file_search()", opt) -- run command :Spectre -- ToggleTask diff --git a/lua/kide/plugins/config/alpha-nvim.lua b/lua/kide/plugins/config/alpha-nvim.lua index 847d79e7..6e3db4cf 100644 --- a/lua/kide/plugins/config/alpha-nvim.lua +++ b/lua/kide/plugins/config/alpha-nvim.lua @@ -14,12 +14,14 @@ dashboard.section.header.val = { " ", } +local opt = { noremap = true, silent = true } -- Set menu dashboard.section.buttons.val = { - dashboard.button(" ff", " Find File", ":Telescope find_files"), - dashboard.button(" fg", " Find Word ", ":Telescope live_grep"), - dashboard.button(" fo", " Recent File", ":Telescope oldfiles"), - dashboard.button(" es", " Settings", ":e $MYVIMRC | :cd %:p:h "), + dashboard.button(" ff", " Find File", ":Telescope find_files", opt), + dashboard.button(" fg", " Find Word ", ":Telescope live_grep", opt), + dashboard.button(" fp", " Recent Projects", ":Telescope projects", opt), + dashboard.button(" fo", " Recent File", ":Telescope oldfiles", opt), + dashboard.button(" es", " Settings", ":e $MYVIMRC | :cd %:p:h ", opt), dashboard.button(" q ", " Quit NVIM", ":qa"), } diff --git a/lua/kide/plugins/config/telescope.lua b/lua/kide/plugins/config/telescope.lua index e784eae0..90637ff9 100644 --- a/lua/kide/plugins/config/telescope.lua +++ b/lua/kide/plugins/config/telescope.lua @@ -113,3 +113,5 @@ telescope.load_extension("env") telescope.load_extension("dap") telescope.load_extension("toggletasks") + +telescope.load_extension('projects') diff --git a/lua/kide/plugins/init.lua b/lua/kide/plugins/init.lua index da729590..49fa6d6a 100644 --- a/lua/kide/plugins/init.lua +++ b/lua/kide/plugins/init.lua @@ -10,7 +10,6 @@ require("packer").startup({ use("kyazdani42/nvim-web-devicons") use({ "neovim/nvim-lspconfig", "williamboman/nvim-lsp-installer" }) - -- nvim-cmp use("hrsh7th/cmp-nvim-lsp") -- { name = nvim_lsp } use("hrsh7th/cmp-buffer") -- { name = 'buffer' }, @@ -263,6 +262,13 @@ require("packer").startup({ if bootstrap then require("packer").sync() end + -- 项目管理 + use({ + "ahmedkhalf/project.nvim", + config = function() + require("project_nvim").setup({}) + end, + }) end, config = { display = { From 93901f67030796e2793b6f3884a9a8fe41967094 Mon Sep 17 00:00:00 2001 From: luokai Date: Mon, 4 Jul 2022 19:57:11 +0800 Subject: [PATCH 0292/1278] =?UTF-8?q?=E9=9A=8F=E6=9C=BA=E5=90=AF=E5=8A=A8?= =?UTF-8?q?=E9=A1=B5=E5=9B=BE=E5=83=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- init.lua | 1 + lua/kide/plugins/config/alpha-nvim.lua | 15 +- lua/kide/plugins/config/ascli-header.lua | 685 +++++++++++++++++++++++ 3 files changed, 689 insertions(+), 12 deletions(-) create mode 100644 lua/kide/plugins/config/ascli-header.lua diff --git a/init.lua b/init.lua index 551714d3..be8631f0 100644 --- a/init.lua +++ b/init.lua @@ -1,3 +1,4 @@ +math.randomseed(os.time()) local present, impatient = pcall(require, "impatient") if present then diff --git a/lua/kide/plugins/config/alpha-nvim.lua b/lua/kide/plugins/config/alpha-nvim.lua index 6e3db4cf..bb49129b 100644 --- a/lua/kide/plugins/config/alpha-nvim.lua +++ b/lua/kide/plugins/config/alpha-nvim.lua @@ -1,19 +1,10 @@ local alpha = require("alpha") local dashboard = require("alpha.themes.dashboard") +local ascli = require('kide.plugins.config.ascli-header') dashboard.leader = "\\" -- Set header -dashboard.section.header.val = { - " ", - " ███╗ ██╗███████╗ ██████╗ ██╗ ██╗██╗███╗ ███╗ ", - " ████╗ ██║██╔════╝██╔═══██╗██║ ██║██║████╗ ████║ ", - " ██╔██╗ ██║█████╗ ██║ ██║██║ ██║██║██╔████╔██║ ", - " ██║╚██╗██║██╔══╝ ██║ ██║╚██╗ ██╔╝██║██║╚██╔╝██║ ", - " ██║ ╚████║███████╗╚██████╔╝ ╚████╔╝ ██║██║ ╚═╝ ██║ ", - " ╚═╝ ╚═══╝╚══════╝ ╚═════╝ ╚═══╝ ╚═╝╚═╝ ╚═╝ ", - " ", -} - +dashboard.section.header.val = ascli[math.random(0, #ascli)] local opt = { noremap = true, silent = true } -- Set menu dashboard.section.buttons.val = { @@ -22,7 +13,7 @@ dashboard.section.buttons.val = { dashboard.button(" fp", " Recent Projects", ":Telescope projects", opt), dashboard.button(" fo", " Recent File", ":Telescope oldfiles", opt), dashboard.button(" es", " Settings", ":e $MYVIMRC | :cd %:p:h ", opt), - dashboard.button(" q ", " Quit NVIM", ":qa"), + dashboard.button(" q ", " Quit NVIM", ":qa", opt), } -- Set footer diff --git a/lua/kide/plugins/config/ascli-header.lua b/lua/kide/plugins/config/ascli-header.lua new file mode 100644 index 00000000..3d334ee2 --- /dev/null +++ b/lua/kide/plugins/config/ascli-header.lua @@ -0,0 +1,685 @@ +local M = {} +M[0] = { + " ▄█ █ █▄ ", + " ▐██ ▄█ ███ █▄ ██▌ ", + " ▐██▌ ██████████████ ▐██▌ ", + " ████ ████████████████ ████ ", + " ▐█████ ██████████████████ █████▌ ", + " ████████████████████████████████ ", + " ███████▀▀████████████▀▀███████ ", + " █████▌ ▄▄ ▀████▀ ▄▄ ▐█████ ", + " ▄▄██████▄ ▀▀ ████ ▀▀ ▄██████▄▄ ", + " ██████████████████████████████████ ", + " ████████████████████████████████████ ", + " ██████ ███████▀▄██▄▀███████ ██████▌ ", + "▐█████ ██████████████████ █████▌ ", + " ▐█████ ██████▀ ▀██████ █████▌ ", + " █████▄ ███ ███ ▄█████ ", + " ██████ █ █ ██████ ", + " █████ █████ ", + " █████ █████ ", + " ████ ▄ ▄ ████ ", + " ████ ██ ██ ████ ", + " ████████ ▄██▄ ████████ ", + " ████████████████████████ ", + " ████████████████████████ ", + " ▀█████████▀▀█████████▀ ", + " ▀███▀ ▀███▀ ", +} + +M[1] = { + " ███████████████████████████ ", + " ███████▀▀▀░░░░░░░▀▀▀███████ ", + " ████▀░░░░░░░░░░░░░░░░░▀████ ", + " ███│░░░░░░░░░░░░░░░░░░░│███ ", + " ██▌│░░░░░░░░░░░░░░░░░░░│▐██ ", + " ██░└┐░░░░░░░░░░░░░░░░░┌┘░██ ", + " ██░░└┐░░░░░░░░░░░░░░░┌┘░░██ ", + " ██░░┌┘▄▄▄▄▄░░░░░▄▄▄▄▄└┐░░██ ", + " ██▌░│██████▌░░░▐██████│░▐██ ", + " ███░│▐███▀▀░░▄░░▀▀███▌│░███ ", + " ██▀─┘░░░░░░░▐█▌░░░░░░░└─▀██ ", + " ██▄░░░▄▄▄▓░░▀█▀░░▓▄▄▄░░░▄██ ", + " ████▄─┘██▌░░░░░░░▐██└─▄████ ", + " █████░░▐█─┬┬┬┬┬┬┬─█▌░░█████ ", + " ████▌░░░▀┬┼┼┼┼┼┼┼┬▀░░░▐████ ", + " █████▄░░░└┴┴┴┴┴┴┴┘░░░▄█████ ", + " ███████▄░░░░░░░░░░░▄███████ ", + " ██████████▄▄▄▄▄▄▄██████████ ", +} + +M[2] = { + " ▄▄▄▄▄███████████████████▄▄▄▄▄ ", + " ▄██████████▀▀▀▀▀▀▀▀▀▀██████▀████▄ ", + " █▀████████▄ ▀▀████ ▀██▄ ", + " █▄▄██████████████████▄▄▄ ▄██▀ ", + " ▀█████████████████████████▄ ▄██▀ ", + " ▀████▀▀▀▀▀▀▀▀▀▀▀▀█████████▄▄██▀ ", + " ▀███▄ ▀██████▀ ", + " ▀██████▄ ▄████▀ ", + " ▀█████▄▄▄▄▄▄▄███▀ ", + " ▀████▀▀▀████▀ ", + " ▀███▄███▀ ", + " ▀█▀ ", +} + +M[3] = { + " ⠀⠀⠀⠀⠀⠀⠀⡴⠞⠉⢉⣭⣿⣿⠿⣳⣤⠴⠖⠛⣛⣿⣿⡷⠖⣶⣤⡀⠀⠀⠀ ", + " ⠀⠀⠀⠀⠀⠀⠀⣼⠁⢀⣶⢻⡟⠿⠋⣴⠿⢻⣧⡴⠟⠋⠿⠛⠠⠾⢛⣵⣿⠀⠀⠀⠀ ", + " ⣼⣿⡿⢶⣄⠀⢀⡇⢀⡿⠁⠈⠀⠀⣀⣉⣀⠘⣿⠀⠀⣀⣀⠀⠀⠀⠛⡹⠋⠀⠀⠀⠀ ", + " ⣭⣤⡈⢑⣼⣻⣿⣧⡌⠁⠀⢀⣴⠟⠋⠉⠉⠛⣿⣴⠟⠋⠙⠻⣦⡰⣞⠁⢀⣤⣦⣤⠀ ", + " ⠀⠀⣰⢫⣾⠋⣽⠟⠑⠛⢠⡟⠁⠀⠀⠀⠀⠀⠈⢻⡄⠀⠀⠀⠘⣷⡈⠻⣍⠤⢤⣌⣀ ", + " ⢀⡞⣡⡌⠁⠀⠀⠀⠀⢀⣿⠁⠀⠀⠀⠀⠀⠀⠀⠀⢿⡀⠀⠀⠀⠸⣇⠀⢾⣷⢤⣬⣉ ", + " ⡞⣼⣿⣤⣄⠀⠀⠀⠀⢸⡇⠀⠀⠀⠀⠀⠀⠀⠀⠀⢸⡇⠀⠀⠀⠀⣿⠀⠸⣿⣇⠈⠻ ", + " ⢰⣿⡿⢹⠃⠀⣠⠤⠶⣼⡇⠀⠀⠀⠀⠀⠀⠀⠀⠀⢸⡇⠀⠀⠀⠀⣿⠀⠀⣿⠛⡄⠀ ", + " ⠈⠉⠁⠀⠀⠀⡟⡀⠀⠈⡗⠲⠶⠦⢤⣤⣤⣄⣀⣀⣸⣧⣤⣤⠤⠤⣿⣀⡀⠉⣼⡇⠀ ", + " ⣿⣴⣴⡆⠀⠀⠻⣄⠀⠀⠡⠀⠀⠀⠈⠛⠋⠀⠀⠀⡈⠀⠻⠟⠀⢀⠋⠉⠙⢷⡿⡇⠀ ", + " ⣻⡿⠏⠁⠀⠀⢠⡟⠀⠀⠀⠣⡀⠀⠀⠀⠀⠀⢀⣄⠀⠀⠀⠀⢀⠈⠀⢀⣀⡾⣴⠃⠀ ", + " ⢿⠛⠀⠀⠀⠀⢸⠁⠀⠀⠀⠀⠈⠢⠄⣀⠠⠼⣁⠀⡱⠤⠤⠐⠁⠀⠀⣸⠋⢻⡟⠀⠀ ", + " ⠈⢧⣀⣤⣶⡄⠘⣆⠀⠀⠀⠀⠀⠀⠀⢀⣤⠖⠛⠻⣄⠀⠀⠀⢀⣠⡾⠋⢀⡞⠀⠀⠀ ", + " ⠀⠀⠻⣿⣿⡇⠀⠈⠓⢦⣤⣤⣤⡤⠞⠉⠀⠀⠀⠀⠈⠛⠒⠚⢩⡅⣠⡴⠋⠀⠀⠀⠀ ", + " ⠀⠀⠀⠈⠻⢧⣀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠐⣻⠿⠋⠀⠀⠀⠀⠀⠀ ", + " ⠀⠀⠀⠀⠀⠀⠉⠓⠶⣤⣄⣀⡀⠀⠀⠀⠀⠀⢀⣀⣠⡴⠖⠋⠁⠀⠀⠀⠀⠀⠀⠀⠀ ", +} + +M[4] = { + " ⠀⠀⠀⠀⠀⠀⠀⠀⢀⣠⣤⣴⣶⣶⣶⣶⣶⠶⣶⣤⣤⣀⠀⠀⠀⠀⠀⠀ ", + " ⠀⠀⠀⠀⠀⠀⠀⢀⣤⣾⣿⣿⣿⠁⠀⢀⠈⢿⢀⣀⠀⠹⣿⣿⣿⣦⣄⠀⠀⠀ ", + " ⠀⠀⠀⠀⠀⠀⣴⣿⣿⣿⣿⣿⠿⠀⠀⣟⡇⢘⣾⣽⠀⠀⡏⠉⠙⢛⣿⣷⡖⠀ ", + " ⠀⠀⠀⠀⠀⣾⣿⣿⡿⠿⠷⠶⠤⠙⠒⠀⠒⢻⣿⣿⡷⠋⠀⠴⠞⠋⠁⢙⣿⣄ ", + " ⠀⠀⠀⠀⢸⣿⣿⣯⣤⣤⣤⣤⣤⡄⠀⠀⠀⠀⠉⢹⡄⠀⠀⠀⠛⠛⠋⠉⠹⡇ ", + " ⠀⠀⠀⠀⢸⣿⣿⠀⠀⠀⣀⣠⣤⣤⣤⣤⣤⣤⣤⣼⣇⣀⣀⣀⣛⣛⣒⣲⢾⡷ ", + " ⢀⠤⠒⠒⢼⣿⣿⠶⠞⢻⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⡿⠁⠀⣼⠃ ", + " ⢮⠀⠀⠀⠀⣿⣿⣆⠀⠀⠻⣿⡿⠛⠉⠉⠁⠀⠉⠉⠛⠿⣿⣿⠟⠁⠀⣼⠃⠀ ", + " ⠈⠓⠶⣶⣾⣿⣿⣿⣧⡀⠀⠈⠒⢤⣀⣀⡀⠀⠀⣀⣀⡠⠚⠁⠀⢀⡼⠃⠀⠀ ", + " ⠀⠀⠀⠈⢿⣿⣿⣿⣿⣿⣷⣤⣤⣤⣤⣭⣭⣭⣭⣭⣥⣤⣤⣤⣴⣟⠁ ", +} + +M[5] = { + " ▄▄▄▄▄▄▄▄▄ ", + " ▄█████████████▄ ", + " █████ █████████████████ █████ ", + " ▐████▌ ▀███▄ ▄███▀ ▐████▌ ", + " █████▄ ▀███▄ ▄███▀ ▄█████ ", + " ▐██▀███▄ ▀███▄███▀ ▄███▀██▌ ", + " ███▄▀███▄ ▀███▀ ▄███▀▄███ ", + " ▐█▄▀█▄▀███ ▄ ▀ ▄ ███▀▄█▀▄█▌ ", + " ███▄▀█▄██ ██▄██ ██▄█▀▄███ ", + " ▀███▄▀██ █████ ██▀▄███▀ ", + " █▄ ▀█████ █████ █████▀ ▄█ ", + " ███ ███ ███ ", + " ███▄ ▄█ ███ █▄ ▄███ ", + " █████ ▄███ ███ ███▄ █████ ", + " █████ ████ ███ ████ █████ ", + " █████ ████▄▄▄▄▄████ █████ ", + " ▀███ █████████████ ███▀ ", + " ▀█ ███ ▄▄▄▄▄ ███ █▀ ", + " ▀█▌▐█████▌▐█▀ ", + " ███████ ", +} + +M[6] = { + " ████ ████ ", + " ███ ███ ", + " ███ ███ ", + " ███ ███ ", + " ███ ███ ", + "████ ████ ", + "████ ████ ", + "██████ ███████ ██████ ", + "█████████████████████████████████ ", + " ███████████████████████████████ ", + " ████ ███████████████████ ████ ", + " ███▀███████████▀███ ", + " ████──▀███████▀──████ ", + " █████───█████───█████ ", + " ███████████████████ ", + " █████████████████ ", + " ███████████████ ", + " █████████████ ", + " ███████████ ", + " ███──▀▀▀──███ ", + " ███─█████─███ ", + " ███─███─███ ", + " █████████ ", +} + +M[7] = { + " ▄█ ", + " ▄██░█ ", + " ██ ██░░░░█ ", + " ██░░█ █░░░░░░█ ", + " ▄█░░░███░░░░░██ ", + " █░░░░█░░░░░░██████████▀ ", + " █░░░░▄▄▄▄▄░░░░░░░░░░█ ", + " ▀███████░▐░░░░░░░░░▌░░░░░█ ", + " ██░░░░▐░░▄██████████▄░█ ", + " █░░░░▌▄███████▀▀▀▀█▀█▀ ", + " ██░░▄▄████████░░░░▌░██ ", + " █▐██████▌███▌░░░░▐░░██ ", + " ██▌████▐██▐░░░░░▐░░░░██ ", + " █▐█▐▌█▀███▀▀░░░░░▐░░░░░██ ", + " █░░██▐█░░▄░░░▄█░░░▐░░░░░░██ ", + " █░░░▐▌█▌▀▀░░░█░█▌░░▐░░░░████ ", + " █░░░░▐▀▀░░░░▄█░░█▌░░▌░░███ ", + " ▄██░░░░░▌░░░▄██░▄██▌░▐░███ ", + " ██░░░▐░░▀█▄░▄███▌░▐░░█ ", + " ███░░█░░░██▀▀░█░░▌░░░█ ", + " █░░░▌░░▐█████░▐░░░░██ ", + " █░░░░░▀▄▄░░░░░█░░░░░░██ ", + " ██░░░░░░░░▀▄▄▄▀░░████████▄ ", + " █░█████░░░░░█░░░░█ ", + " ██ ██░░░░██░░░█ ", + " █ █░░░█ ███░░█ ", + " █░░░█ ██░█ ", + " █░░░█ ██ ", + " █░█ ", +} + +M[8] = { + " ▄▄██████████▄▄ ", + " ▀▀▀ ██ ▀▀▀ ", + " ▄██▄ ▄▄████████████▄▄ ▄██▄ ", + " ▄███▀ ▄████▀▀▀ ▀▀▀████▄ ▀███▄ ", + " ████▄ ▄███▀ ▀███▄ ▄████ ", + " ███▀█████▀▄████▄ ▄████▄▀█████▀███ ", + " ██▀ ███▀ ██████ ██████ ▀███ ▀██ ", + " ▀ ▄██▀ ▀████▀ ▄▄ ▀████▀ ▀██▄ ▀ ", + " ███ ▀▀ ███ ", + " ██████████████████████████████ ", + " ▄█ ▀██ ███ ██ ██ ███ ██▀ █▄ ", + " ███ ███ ███ ██ ██ ███▄███ ███ ", + " ▀██▄████████ ██ ██ ████████▄██▀ ", + " ▀███▀ ▀████ ██ ██ ████▀ ▀███▀ ", + " ▀███▄ ▀███████ ███████▀ ▄███▀ ", + " ▀███ ▀▀██████████▀▀▀ ███▀ ", + " ▀ ▄▄▄ ██ ▄▄▄ ▀ ", + " ▀████████████▀ ", +} + +M[9] = { + " ▄▄▀▀▀▀▀▀▀▀▄▄ ", + " ▄▀▀ ▀▄▄ ", + " ▄▀ ▀▄ ", + " ▌ ▀▄ ▀▀▄ ", + " ▌ ▀▌ ▌ ", + " ▐ ▌ ▐ ", + " ▌▐ ▐ ▐ ▌ ▌ ", + " ▐ ▌ ▌ ▐ ▌ ▐ ▌▐ ▐ ", + " ▐ ▌ ▌▄▄▀▀▌▌ ▐▀▌▀▌▄ ▐ ▌ ▌ ", + " ▌▌ ▐▀▄▌▌▐▐ ▐▐▐ ▐ ▌▌ ▐ ▌▄▐ ", + " ▄▀▄▐ ▌▌▄▀▄▐ ▌▌ ▐ ▌▄▀▄ ▐ ▐ ▌ ▀▄ ", + " ▀▄▀ ▌ ▄▀ ▌█▐ ▐▐▀ ▌█▐ ▀▄▐ ▌▌ ▀ ", + " ▀▀▄▄▐ ▀▄▀ ▀▄▀ ▀▄▀▄▀ ▌ ▐ ", + " ▀▐▀▄ ▀▄ ▐ ▀▌▐ ", + " ▌ ▌▐ ▀ ▐ ▐ ", + " ▐ ▐ ▌ ▄▄▀▀▀▀▄ ▌ ▐ ", + " ▌▐ ▐▄ ▐ ▌ ▄▀ ▐ ", + " ▐ ▌▐▐▀▄ ▀▄▄▄▀ ▄▀▐ ▐ ", + " ▌▌ ▌▐ ▌ ▀▄▄ ▄▌▐ ▌ ▐ ", + " ▐ ▐ ▐▐ ▌ ▀▀▄▀▌▐ ▌ ▌ ", + " ▌ ▌▐ ▌ ▐▀▄▌ ▐ ", +} + +M[10] = { + " ▀████▀▄▄ ▄█ ", + " █▀ ▀▀▄▄▄▄▄ ▄▄▀▀█ ", + " ▄ █ ▀▀▀▀▄ ▄▀ ", + " ▄▀ ▀▄ ▀▄ ▀▄▀ ", + " ▄▀ █ █▀ ▄█▀▄ ▄█ ", + " ▀▄ ▀▄ █ ▀██▀ ██▄█ ", + " ▀▄ ▄▀ █ ▄██▄ ▄ ▄ ▀▀ █ ", + " █ ▄▀ █ ▀██▀ ▀▀ ▀▀ ▄▀ ", + " █ █ █ ▄▄ ▄▀ ", +} + +M[11] = { + " ▄████████▄ ", + " ▄█▀▒▒▒▒▒▒▒▀██▄ ", + " ▄█▀▒▒▒▒▒▒▄▒▒▒▒▒▒▐█▌ ", + " ▄█▒▒▒▒▒▒▒▒▒▒▀█▒▒▒▄██ ", + " ▄█▒▒▒▒▒▒▒▒▒▒▒▒▒▒██▀▒▒▒█▄ ", + " ▄█▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒█▄ ", + " ▄█▒▒▒▄██████▄▒▒▒▒▄█████▄▒▒▒▒█ ", + " █▒▒▒█▀░░░░░▀█ ▒▒▒█▀░░░░▀█▒▒▒█ ", + " █▒▒▒█░░▄░░░░▀████▀░░░▄░░█▒▒▒█ ", + " ▄███▄▒█▄░▐▀▄░░░░░░░░░▄▀▌░▄█▒▒███▄", + " █▀░░█▄▒█░▐▐▀▀▄▄▄ ▄▄▄▀▀▌▌░█▒▒█░░▀█", + " █░░░░█▒█░▐▐ ▄▄ █ ▄▄ ▌▌░█▒█░░░░█", + " █░▄░░█▒█░▐▐▄ ▀▀ █ ▀▀ ▄▌▌░█▒█░░▄░█", + " █░░█░█▒█░░▌▄█▄▄▀ ▀▄▄█▄▐░░█▒█░█░░█", + " █▄░█████████▀░░▀▄▀░░▀█████████░▄█", + " ██▀░░▄▀░░▀░░▀▄░░░▄▀░░▀░░▀▄░░▀██ ", + " ██░░░░░░░░░░░░░░░░░░░░░░░░░░░░░██", + " █░▄░░░░░░░░░░░░░░░░░░░░░░░░░░░▄░█", + " █░▀█▄░░░░░░░░░░░░░░░░░░░░░░░▄█▀░█", + " █░░█▀███████████████████████▀█░░█", + " █░░█ █ █ █ █ █ █░░█", + " █░░░▀█▄▄█▄▄▄█▄▄▄█▄▄▄█▄▄▄█▄▄█▀░░░█", + " ▀█░░▀█▄█ █ █ █ █▄█▀░░░█▀ ", + " ▀█░░░▀▀█▄▄ █ █ █▄▄█▀▀░░░░█▀ ", + " ▀█░░░░░▀▀█████████▀▀░░░░░░█▀ ", + " ▀█░░░░░░░▄░░░░░░░▄░░░░░░█▀ ", + " ▀██▄░░░▀▀▀▀▀▀▀▀▀░░░▄██▀ ", + " ▀██▄▄░░░░░░░▄▄██▀ ", + " ▀▀███████▀▀ ", +} + +M[12] = { + " ⠀⠀⠀⠀⠀⠀⠀⠀⠀⣠⠤⠖⠚⢉⣩⣭⡭⠛⠓⠲⠦⣄⡀⠀⠀⠀⠀⠀⠀⠀ ", + " ⠀⠀⠀⠀⠀⠀⢀⡴⠋⠁⠀⠀⠊⠀⠀⠀⠀⠀⠀⠀⠀⠀⠉⠳⢦⡀⠀⠀⠀⠀ ", + " ⠀⠀⠀⠀⢀⡴⠃⢀⡴⢳⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠙⣆⠀⠀⠀ ", + " ⠀⠀⠀⠀⡾⠁⣠⠋⠀⠈⢧⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠈⢧⠀⠀ ", + " ⠀⠀⠀⣸⠁⢰⠃⠀⠀⠀⠈⢣⡀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠈⣇⠀ ", + " ⠀⠀⠀⡇⠀⡾⡀⠀⠀⠀⠀⣀⣹⣆⡀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢹⠀ ", + " ⠀⠀⢸⠃⢀⣇⡈⠀⠀⠀⠀⠀⠀⢀⡑⢄⡀⢀⡀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢸⡇ ", + " ⠀⠀⢸⠀⢻⡟⡻⢶⡆⠀⠀⠀⠀⡼⠟⡳⢿⣦⡑⢄⠀⠀⠀⠀⠀⠀⠀⠀⢸⡇ ", + " ⠀⠀⣸⠀⢸⠃⡇⢀⠇⠀⠀⠀⠀⠀⡼⠀⠀⠈⣿⡗⠂⠀⠀⠀⠀⠀⠀⠀⢸⠁ ", + " ⠀⠀⡏⠀⣼⠀⢳⠊⠀⠀⠀⠀⠀⠀⠱⣀⣀⠔⣸⠁⠀⠀⠀⠀⠀⠀⠀⢠⡟⠀ ", + " ⠀⠀⡇⢀⡇⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠠⠀⡇⠀⠀⠀⠀⠀⠀⠀⠀⢸⠃⠀ ", + " ⠀⢸⠃⠘⡇⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢸⠁⠀⠀⢀⠀⠀⠀⠀⠀⣾⠀⠀ ", + " ⠀⣸⠀⠀⠹⡄⠀⠀⠈⠁⠀⠀⠀⠀⠀⠀⠀⡞⠀⠀⠀⠸⠀⠀⠀⠀⠀⡇⠀⠀ ", + " ⠀⡏⠀⠀⠀⠙⣆⠀⠀⠀⠀⠀⠀⠀⢀⣠⢶⡇⠀⠀⢰⡀⠀⠀⠀⠀⠀⡇⠀⠀ ", + " ⢰⠇⡄⠀⠀⠀⡿⢣⣀⣀⣀⡤⠴⡞⠉⠀⢸⠀⠀⠀⣿⡇⠀⠀⠀⠀⠀⣧⠀⠀ ", + " ⣸⠀⡇⠀⠀⠀⠀⠀⠀⠉⠀⠀⠀⢹⠀⠀⢸⠀⠀⢀⣿⠇⠀⠀⠀⠁⠀⢸⠀⠀ ", + " ⣿⠀⡇⠀⠀⠀⠀⠀⢀⡤⠤⠶⠶⠾⠤⠄⢸⠀⡀⠸⣿⣀⠀⠀⠀⠀⠀⠈⣇⠀ ", + " ⡇⠀⡇⠀⠀⡀⠀⡴⠋⠀⠀⠀⠀⠀⠀⠀⠸⡌⣵⡀⢳⡇⠀⠀⠀⠀⠀⠀⢹⡀ ", + " ⡇⠀⠇⠀⠀⡇⡸⠁⠀⠀⠀⠀⠀⠀⠀⠀⠀⠙⠮⢧⣀⣻⢂⠀⠀⠀⠀⠀⠀⢧ ", + " ⣇⠀⢠⠀⠀⢳⠇⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠈⡎⣆⠀⠀⠀⠀⠀⠘ ", +} + +M[13] = { + "⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢀⡀⠀⠀⠀⠀⢀⡀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀ ", + "⠀⠀⠀⠀⠀⠀⠀⠀⠀⣠⡖⠁⠀⠀⠀⠀⠀⠀⠈⢲⣄⠀⠀⠀⠀⠀⠀⠀⠀⠀ ", + "⠀⠀⠀⠀⠀⠀⠀⠀⣼⡏⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢹⣧⠀⠀⠀⠀⠀⠀⠀⠀ ", + "⠀⠀⠀⠀⠀⠀⠀⣸⣿⠁⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠈⣿⣇⠀⠀⠀⠀⠀⠀⠀ ", + "⠀⠀⠀⠀⠀⠀⠀⣿⣿⡇⠀⢀⣀⣤⣤⣤⣤⣀⡀⠀⢸⣿⣿⠀⠀⠀⠀⠀⠀⠀ ", + "⠀⠀⠀⠀⠀⠀⠀⢻⣿⣿⣔⢿⡿⠟⠛⠛⠻⢿⡿⣢⣿⣿⡟⠀⠀⠀⠀⠀⠀⠀ ", + "⠀⠀⠀⠀⣀⣤⣶⣾⣿⣿⣿⣷⣤⣀⡀⢀⣀⣤⣾⣿⣿⣿⣷⣶⣤⡀⠀⠀⠀⠀ ", + "⠀⠀⢠⣾⣿⡿⠿⠿⠿⣿⣿⣿⣿⡿⠏⠻⢿⣿⣿⣿⣿⠿⠿⠿⢿⣿⣷⡀⠀⠀ ", + "⠀⢠⡿⠋⠁⠀⠀⢸⣿⡇⠉⠻⣿⠇⠀⠀⠸⣿⡿⠋⢰⣿⡇⠀⠀⠈⠙⢿⡄⠀ ", + "⠀⡿⠁⠀⠀⠀⠀⠘⣿⣷⡀⠀⠰⣿⣶⣶⣿⡎⠀⢀⣾⣿⠇⠀⠀⠀⠀⠈⢿⠀ ", + "⠀⡇⠀⠀⠀⠀⠀⠀⠹⣿⣷⣄⠀⣿⣿⣿⣿⠀⣠⣾⣿⠏⠀⠀⠀⠀⠀⠀⢸⠀ ", + "⠀⠁⠀⠀⠀⠀⠀⠀⠀⠈⠻⢿⢇⣿⣿⣿⣿⡸⣿⠟⠁⠀⠀⠀⠀⠀⠀⠀⠈⠀ ", + "⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢀⣼⣿⣿⣿⣿⣧⡀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀ ", + "⠀⠀⠀⠐⢤⣀⣀⢀⣀⣠⣴⣿⣿⠿⠋⠙⠿⣿⣿⣦⣄⣀⠀⠀⣀⡠⠂⠀⠀⠀ ", + "⠀⠀⠀⠀⠀⠈⠉⠛⠛⠛⠛⠉⠀⠀⠀⠀⠀⠈⠉⠛⠛⠛⠛⠋⠁⠀⠀⠀⠀⠀ ", +} + +M[14] = { + "", + "⠀⠀⠀⠀⠀⠀⠀⠀⠀⢀⣀⣠⣤⣤⣴⣦⣤⣤⣄⣀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀ ", + "⠀⠀⠀⠀⠀⠀⢀⣤⣾⣿⣿⣿⣿⠿⠿⠿⠿⣿⣿⣿⣿⣶⣤⡀⠀⠀⠀⠀⠀⠀ ", + "⠀⠀⠀⠀⣠⣾⣿⣿⡿⠛⠉⠀⠀⠀⠀⠀⠀⠀⠀⠉⠛⢿⣿⣿⣶⡀⠀⠀⠀⠀ ", + "⠀⠀⠀⣴⣿⣿⠟⠁⠀⠀⠀⣶⣶⣶⣶⡆⠀⠀⠀⠀⠀⠀⠈⠻⣿⣿⣦⠀⠀⠀ ", + "⠀⠀⣼⣿⣿⠋⠀⠀⠀⠀⠀⠛⠛⢻⣿⣿⡀⠀⠀⠀⠀⠀⠀⠀⠙⣿⣿⣧⠀⠀ ", + "⠀⢸⣿⣿⠃⠀⠀⠀⠀⠀⠀⠀⠀⢀⣿⣿⣷⠀⠀⠀⠀⠀⠀⠀⠀⠸⣿⣿⡇⠀ ", + "⠀⣿⣿⡿⠀⠀⠀⠀⠀⠀⠀⠀⢀⣾⣿⣿⣿⣇⠀⠀⠀⠀⠀⠀⠀⠀⣿⣿⣿⠀ ", + "⠀⣿⣿⡇⠀⠀⠀⠀⠀⠀⠀⢠⣿⣿⡟⢹⣿⣿⡆⠀⠀⠀⠀⠀⠀⠀⣹⣿⣿⠀ ", + "⠀⣿⣿⣷⠀⠀⠀⠀⠀⠀⣰⣿⣿⠏⠀⠀⢻⣿⣿⡄⠀⠀⠀⠀⠀⠀⣿⣿⡿⠀ ", + "⠀⢸⣿⣿⡆⠀⠀⠀⠀⣴⣿⡿⠃⠀⠀⠀⠈⢿⣿⣷⣤⣤⡆⠀⠀⣰⣿⣿⠇⠀ ", + "⠀⠀⢻⣿⣿⣄⠀⠀⠾⠿⠿⠁⠀⠀⠀⠀⠀⠘⣿⣿⡿⠿⠛⠀⣰⣿⣿⡟⠀⠀ ", + "⠀⠀⠀⠻⣿⣿⣧⣄⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣠⣾⣿⣿⠏⠀⠀⠀ ", + "⠀⠀⠀⠀⠈⠻⣿⣿⣷⣤⣄⡀⠀⠀⠀⠀⠀⠀⢀⣠⣴⣾⣿⣿⠟⠁⠀⠀⠀⠀ ", + "⠀⠀⠀⠀⠀⠀⠈⠛⠿⣿⣿⣿⣿⣿⣶⣶⣿⣿⣿⣿⣿⠿⠋⠁⠀⠀⠀⠀⠀⠀ ", + "⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠉⠉⠛⠛⠛⠛⠛⠛⠉⠉⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀ ", +} + +M[15] = { + " ⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢀⡴⣪⣭⣿⣷⣶⣄⠀⠀⠀⠀⠀⠀⠀⠀ ", + " ⠀⠀⠀⠀⠀⠀⠀⠀⠀⢀⣀⠤⢤⢔⡾⣹⣿⣿⣿⣿⣿⣿⣷⡄⠀⠀⠀⠀⠀⠀ ", + " ⠀⠀⠀⠀⠀⠀⠀⠀⠀⠁⠀⢰⢳⣿⣿⣿⠋⣻⣿⣿⣿⣿⣿⣿⣾⣿⠟⠀⠀⠀ ", + " ⠀⠀⠀⠀⠀⢀⠔⠁⠀⠀⠀⢸⣼⣷⣻⣧⣴⣿⣏⣿⣿⣿⣿⣿⣿⣿⣶⣶⣦⠤ ", + " ⠀⠀⠀⠀⢠⠇⠀⠀⠀⠀⠀⠈⢿⣿⣷⣿⣏⡿⣿⣿⣿⣿⣿⣿⣿⡿⠿⠛⠁⠀ ", + " ⠀⠀⠀⢀⠇⠀⠀⠀⠀⠀⠀⠀⠀⠹⢿⣿⣿⣿⣝⣿⣯⣾⠋⣇⠀⠀⠀⠀⠀⠀ ", + " ⠀⠀⢠⠀⠀⠀⠀⠀⠀⠀⠀⠀⢠⡄⠀⠀⠙⣽⣝⠋⢡⣯⣀⠘⢦⡀⠀⠀⠀⠀ ", + " ⠀⠀⡷⡁⠀⡄⠀⢠⠻⠀⠀⠀⢸⠙⠀⠀⠀⠙⡇⢹⣧⠛⠂⠀⢤⣉⠢⡀⠀⠀ ", + " ⡠⢊⠚⢇⣰⢣⠀⡞⠒⠣⠀⠀⠘⡄⠘⠓⠲⢆⣳⠀⠀⣠⣄⣀⣀⠙⢯⣾⡄⠀ ", + " ⣇⣇⡌⠈⡜⡌⢳⣧⣤⣄⡑⠄⣀⣳⢀⣠⣤⣴⣾⡆⠀⣿⠖⣠⣮⠀⠀⣿⠇⠀ ", + " ⠈⠛⢇⠀⠿⠷⡘⣿⢙⠿⡏⠀⠈⠉⢻⣻⣿⡏⢹⡟⣢⣿⣟⡻⠋⢀⡴⠁⠀⠀ ", + " ⠀⠀⠈⠢⢤⣀⣋⡿⢮⡉⠁⠀⠀⠀⠈⢉⣙⠷⠛⠺⣿⣙⣛⠭⠝⠋⠀⠀⠀⠀ ", + " ⠀⠀⠀⠀⠀⠀⠀⠀⠀⠈⡩⠒⠶⠲⠞⠓⢦⡀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀ ", + " ⠀⠀⠀⠀⠀⠀⠀⠀⠀⣰⣵⣕⣉⣫⣿⣦⠀⠱⡀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀ ", + " ⠀⠀⠀⠀⠀⠀⠀⠀⢠⣿⡾⡿⡟⣻⣿⡏⠱⣮⣿⣦⡀⠀⠀⠀⠀⠀⠀⠀⠀⠀ ", + " ⠀⠀⠀⠀⠀⠀⠀⣰⢿⡛⣿⣾⣜⣾⣿⣿⣿⣿⣿⣿⣿⣆⠀⠀⠀⠀⠀⠀⠀⠀ ", + " ⠀⠀⠀⠀⢀⣴⣿⣾⣿⣿⣿⣿⣿⣿⣾⡏⣿⣿⣿⣿⣿⣿⣆⠀⠀⠀⠀⠀⠀⠀ ", + " ⠀⠀⠀⠀⢀⣵⣿⣿⣿⣿⣿⣿⣿⡿⣿⣿⣿⣿⣿⣯⣿⣿⠟⠃⠀⠀⠀⠀⠀⠀ ", + " ⠀⠀⠀⠀⠀⠀⠈⢻⣿⣿⣶⣿⣿⣿⣿⣿⣿⣿⣿⠿⠿⠟⠀⠀⠀⠀⠀⠀⠀⠀ ", + " ⠀⠀⠀⠀⠀⠀⠀⠈⠻⠿⠿⣿⣿⣿⣿⣿⣿⡿⠃⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀ ", + " ⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠘⣿⣽⣿⠇⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀ ", +} + +M[16] = { + "", + " ████▌█████▌█ ████████▐▀██▀ ", + " ▄█████ █████▌ █ ▀██████▌█▄▄▀▄ ", + " ▌███▌█ ▐███▌▌ ▄▄ ▌█▌███▐███ ▀ ", + " ▐ ▐██ ▄▄▐▀█ ▐▄█▀▌█▐███▐█ ", + " ███ ▌▄█▌ ▀ ▀██ ▀██████▌ ", + " ▀█▌▀██▀ ▄ ███▐███ ", + " ██▌ ▐███████▌ ", + " ███ ▀█▀ ▐██▐███▀▌ ", + " ▌█▌█▄ ▄▄████▀ ▀ ", + " █▀██▄▄▄ ▄▄▀▀▒█▀█ ", + "", +} + +M[17] = { + "", + "", + " ⢀⣴⡾⠃⠄⠄⠄⠄⠄⠈⠺⠟⠛⠛⠛⠛⠻⢿⣿⣿⣿⣿⣶⣤⡀ ", + " ⢀⣴⣿⡿⠁⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⣸⣿⣿⣿⣿⣿⣿⣿⣷ ", + " ⣴⣿⡿⡟⡼⢹⣷⢲⡶⣖⣾⣶⢄⠄⠄⠄⠄⠄⢀⣼⣿⢿⣿⣿⣿⣿⣿⣿⣿ ", + " ⣾⣿⡟⣾⡸⢠⡿⢳⡿⠍⣼⣿⢏⣿⣷⢄⡀⠄⢠⣾⢻⣿⣸⣿⣿⣿⣿⣿⣿⣿ ", + " ⣡⣿⣿⡟⡼⡁⠁⣰⠂⡾⠉⢨⣿⠃⣿⡿⠍⣾⣟⢤⣿⢇⣿⢇⣿⣿⢿⣿⣿⣿⣿⣿ ", + " ⣱⣿⣿⡟⡐⣰⣧⡷⣿⣴⣧⣤⣼⣯⢸⡿⠁⣰⠟⢀⣼⠏⣲⠏⢸⣿⡟⣿⣿⣿⣿⣿⣿ ", + " ⣿⣿⡟⠁⠄⠟⣁⠄⢡⣿⣿⣿⣿⣿⣿⣦⣼⢟⢀⡼⠃⡹⠃⡀⢸⡿⢸⣿⣿⣿⣿⣿⡟ ", + " ⣿⣿⠃⠄⢀⣾⠋⠓⢰⣿⣿⣿⣿⣿⣿⠿⣿⣿⣾⣅⢔⣕⡇⡇⡼⢁⣿⣿⣿⣿⣿⣿⢣ ", + " ⣿⡟⠄⠄⣾⣇⠷⣢⣿⣿⣿⣿⣿⣿⣿⣭⣀⡈⠙⢿⣿⣿⡇⡧⢁⣾⣿⣿⣿⣿⣿⢏⣾ ", + " ⣿⡇⠄⣼⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⠟⢻⠇⠄⠄⢿⣿⡇⢡⣾⣿⣿⣿⣿⣿⣏⣼⣿ ", + " ⣿⣷⢰⣿⣿⣾⣿⣿⣿⣿⣿⣿⣿⣿⣿⢰⣧⣀⡄⢀⠘⡿⣰⣿⣿⣿⣿⣿⣿⠟⣼⣿⣿ ", + " ⢹⣿⢸⣿⣿⠟⠻⢿⣿⣿⣿⣿⣿⣿⣿⣶⣭⣉⣤⣿⢈⣼⣿⣿⣿⣿⣿⣿⠏⣾⣹⣿⣿ ", + " ⢸⠇⡜⣿⡟⠄⠄⠄⠈⠙⣿⣿⣿⣿⣿⣿⣿⣿⠟⣱⣻⣿⣿⣿⣿⣿⠟⠁⢳⠃⣿⣿⣿ ", + " ⣰⡗⠹⣿⣄⠄⠄⠄⢀⣿⣿⣿⣿⣿⣿⠟⣅⣥⣿⣿⣿⣿⠿⠋ ⣾⡌⢠⣿⡿⠃ ", + " ⠜⠋⢠⣷⢻⣿⣿⣶⣾⣿⣿⣿⣿⠿⣛⣥⣾⣿⠿⠟⠛⠉ ", + "", + "", +} + +M[18] = { + "", + " ⣿⡇⣿⣿⣿⠛⠁⣴⣿⡿⠿⠧⠹⠿⠘⣿⣿⣿⡇⢸⡻⣿⣿⣿⣿⣿⣿⣿ ", + " ⢹⡇⣿⣿⣿⠄⣞⣯⣷⣾⣿⣿⣧⡹⡆⡀⠉⢹⡌⠐⢿⣿⣿⣿⡞⣿⣿⣿ ", + " ⣾⡇⣿⣿⡇⣾⣿⣿⣿⣿⣿⣿⣿⣿⣄⢻⣦⡀⠁⢸⡌⠻⣿⣿⣿⡽⣿⣿ ", + " ⡇⣿⠹⣿⡇⡟⠛⣉⠁⠉⠉⠻⡿⣿⣿⣿⣿⣿⣦⣄⡉⠂⠈⠙⢿⣿⣝⣿ ", + " ⠤⢿⡄⠹⣧⣷⣸⡇⠄⠄⠲⢰⣌⣾⣿⣿⣿⣿⣿⣿⣶⣤⣤⡀⠄⠈⠻⢮ ", + " ⣧⠄⢘⢻⣿⡇⢀⣀⠄⣸⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣧⡀⠄⢀ ", + " ⣿⡆⢸⣿⣿⣿⣬⣭⣴⣿⣿⣿⣿⣿⣿⣿⣯⠝⠛⠛⠙⢿⡿⠃⠄⢸ ", + " ⢿⣿⡀⣿⣿⣿⣾⣿⣿⣿⣿⣿⣿⣿⣿⣿⣷⣿⣿⣿⣿⡾⠁⢠⡇⢀ ", + " ⢸⣿⡇⠻⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣏⣫⣻⡟⢀⠄⣿⣷⣾ ", + " ⢸⣿⡇⠄⠈⠙⠿⣿⣿⣿⣮⣿⣿⣿⣿⣿⣿⣿⣿⡿⢠⠊⢀⡇⣿⣿ ", + " ⣿⡇⢀⡲⠄⠄⠈⠙⠻⢿⣿⣿⠿⠿⠟⠛⠋⠁⣰⠇ ⢸⣿⣿⣿ ", + " ⣿⡇⢬⡻⡇⡄⠄⠄⠄⡰⢖⠔⠉⠄⠄⠄⠄⣼⠏ ⢸⣿⣿⣿ ", + " ⣿⡇⠄⠙⢌⢷⣆⡀⡾⡣⠃⠄⠄⠄⠄⠄⣼⡟ ⢿⣿⣿ ", + "", +} + +M[19] = { + "", + " ⢰⣧⣼⣯⠄⣸⣠⣶⣶⣦⣾⠄⠄⠄⠄⡀⠄⢀⣿⣿⠄⠄⠄⢸⡇⠄⠄ ", + " ⣾⣿⠿⠿⠶⠿⢿⣿⣿⣿⣿⣦⣤⣄⢀⡅⢠⣾⣛⡉⠄⠄⠄⠸⢀⣿⠄ ", + " ⢀⡋⣡⣴⣶⣶⡀⠄⠄⠙⢿⣿⣿⣿⣿⣿⣴⣿⣿⣿⢃⣤⣄⣀⣥⣿⣿⠄ ", + " ⢸⣇⠻⣿⣿⣿⣧⣀⢀⣠⡌⢻⣿⣿⣿⣿⣿⣿⣿⣿⣿⠿⠿⠿⣿⣿⣿⠄ ", + " ⢀⢸⣿⣷⣤⣤⣤⣬⣙⣛⢿⣿⣿⣿⣿⣿⣿⡿⣿⣿⡍⠄⠄⢀⣤⣄⠉⠋⣰ ", + " ⣼⣖⣿⣿⣿⣿⣿⣿⣿⣿⣿⢿⣿⣿⣿⣿⣿⢇⣿⣿⡷⠶⠶⢿⣿⣿⠇⢀⣤ ", + " ⠘⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣽⣿⣿⣿⡇⣿⣿⣿⣿⣿⣿⣷⣶⣥⣴⣿⡗ ", + " ⢀⠈⢿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⡟ ", + " ⢸⣿⣦⣌⣛⣻⣿⣿⣧⠙⠛⠛⡭⠅⠒⠦⠭⣭⡻⣿⣿⣿⣿⣿⣿⣿⣿⡿⠃ ", + " ⠘⣿⣿⣿⣿⣿⣿⣿⣿⡆⠄⠄⠄⠄⠄⠄⠄⠄⠹⠈⢋⣽⣿⣿⣿⣿⣵⣾⠃ ", + " ⠘⣿⣿⣿⣿⣿⣿⣿⣿⠄⣴⣿⣶⣄⠄⣴⣶⠄⢀⣾⣿⣿⣿⣿⣿⣿⠃ ", + " ⠈⠻⣿⣿⣿⣿⣿⣿⡄⢻⣿⣿⣿⠄⣿⣿⡀⣾⣿⣿⣿⣿⣛⠛⠁ ", + " ⠈⠛⢿⣿⣿⣿⠁⠞⢿⣿⣿⡄⢿⣿⡇⣸⣿⣿⠿⠛⠁ ", + " ⠉⠻⣿⣿⣾⣦⡙⠻⣷⣾⣿⠃⠿⠋⠁ ⢀⣠⣴ ", + " ⣿⣿⣿⣶⣶⣮⣥⣒⠲⢮⣝⡿⣿⣿⡆⣿⡿⠃⠄⠄⠄⠄⠄⠄⠄⣠⣴⣿⣿⣿ ", + "", +} + +M[20] = { + "", + " ⣿⢸⣿⣿⣿⣿⣿⢹⣿⣿⣿⣿⣿⢿⣿⡇⡇⣿⣿⡇⢹⣿⣿⣿⣿⣿⣿⠄⢸⣿ ", + " ⡟⢸⣿⣿⣭⣭⡭⣼⣶⣿⣿⣿⣿⢸⣧⣇⠇⢸⣿⣿⠈⣿⣿⣿⣿⣿⣿⡆⠘⣿ ", + " ⡇⢸⣿⣿⣿⣿⡇⣻⡿⣿⣿⡟⣿⢸⣿⣿⠇⡆⣝⠿⡌⣸⣿⣿⣿⣿⣿⡇⠄⣿ ", + " ⢣⢾⣾⣷⣾⣽⣻⣿⣇⣿⣿⣧⣿⢸⣿⣿⡆⢸⣹⣿⣆⢥⢛⡿⣿⣿⣿⡇⠄⣿ ", + " ⣛⡓⣉⠉⠙⠻⢿⣿⣿⣟⣻⠿⣹⡏⣿⣿⣧⢸⣧⣿⣿⣨⡟⣿⣿⣿⣿⡇⠄⣿ ", + " ⠸⣷⣹⣿⠄⠄⠄⠄⠘⢿⣿⣿⣯⣳⣿⣭⣽⢼⣿⣜⣿⣇⣷⡹⣿⣿⣿⠁⢰⣿ ", + " ⢻⣷⣿⡄⢈⠿⠇⢸⣿⣿⣿⣿⣿⣿⣟⠛⠲⢯⣿⣒⡾⣼⣷⡹⣿⣿⠄⣼⣿ ", + " ⡄⢸⣿⣿⣷⣬⣽⣯⣾⣿⣿⣿⣿⣿⣿⣿⣿⡀⠄⢀⠉⠙⠛⠛⠳⠽⠿⢠⣿⣿ ", + " ⡇⣼⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣷⢄⣹⡿⠃⠄⠄⣰⠎⡈⣾⣿⣿ ", + " ⡇⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣾⣭⣽⣖⣄⣴⣯⣾⢷⣿⣿⣿ ", + " ⣧⠸⣿⣿⣿⣿⣿⣿⠯⠊⠙⢻⢿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣏⣾⣿⣿⣿ ", + " ⣿⣦⠹⣿⣿⣿⣿⣿⠄⢀⣴⢾⣼⣻⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⡟⣾⣿⣿⣿⣿ ", + " ⣿⣿⣇⢽⣿⣿⣿⡏⣿⣿⣿⣿⣿⡇⣿⣿⣿⣿⡿⣿⣛⣻⠿⣟⣼⣿⣿⣿⣿⢃ ", + " ⣿⣿⣿⡎⣷⣽⠻⣇⣿⣿⣿⡿⣟⣵⣿⣟⣽⣾⣿⣿⣿⣿⢯⣾⣿⣿⣿⠟⠱⡟ ", + " ⣿⣿⣿⣿⢹⣿⣿⢮⣚⡛⠒⠛⢛⣋⣶⣿⣿⣿⣿⣿⣟⣱⠿⣿⣿⠟⣡⣺⢿ ", + "", +} + +M[21] = { + "", + " ⣇⣿⠘⣿⣿⣿⡿⡿⣟⣟⢟⢟⢝⠵⡝⣿⡿⢂⣼⣿⣷⣌⠩⡫⡻⣝⠹⢿⣿⣷ ", + " ⡆⣿⣆⠱⣝⡵⣝⢅⠙⣿⢕⢕⢕⢕⢝⣥⢒⠅⣿⣿⣿⡿⣳⣌⠪⡪⣡⢑⢝⣇ ", + " ⡆⣿⣿⣦⠹⣳⣳⣕⢅⠈⢗⢕⢕⢕⢕⢕⢈⢆⠟⠋⠉⠁⠉⠉⠁⠈⠼⢐⢕⢽ ", + " ⡗⢰⣶⣶⣦⣝⢝⢕⢕⠅⡆⢕⢕⢕⢕⢕⣴⠏⣠⡶⠛⡉⡉⡛⢶⣦⡀⠐⣕⢕ ", + " ⡝⡄⢻⢟⣿⣿⣷⣕⣕⣅⣿⣔⣕⣵⣵⣿⣿⢠⣿⢠⣮⡈⣌⠨⠅⠹⣷⡀⢱⢕ ", + " ⡝⡵⠟⠈⢀⣀⣀⡀⠉⢿⣿⣿⣿⣿⣿⣿⣿⣼⣿⢈⡋⠴⢿⡟⣡⡇⣿⡇⡀⢕ ", + " ⡝⠁⣠⣾⠟⡉⡉⡉⠻⣦⣻⣿⣿⣿⣿⣿⣿⣿⣿⣧⠸⣿⣦⣥⣿⡇⡿⣰⢗⢄ ", + " ⠁⢰⣿⡏⣴⣌⠈⣌⠡⠈⢻⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣬⣉⣉⣁⣄⢖⢕⢕⢕ ", + " ⡀⢻⣿⡇⢙⠁⠴⢿⡟⣡⡆⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣷⣵⣵⣿ ", + " ⡻⣄⣻⣿⣌⠘⢿⣷⣥⣿⠇⣿⣿⣿⣿⣿⣿⠛⠻⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿ ", + " ⣷⢄⠻⣿⣟⠿⠦⠍⠉⣡⣾⣿⣿⣿⣿⣿⣿⢸⣿⣦⠙⣿⣿⣿⣿⣿⣿⣿⣿⠟ ", + " ⡕⡑⣑⣈⣻⢗⢟⢞⢝⣻⣿⣿⣿⣿⣿⣿⣿⠸⣿⠿⠃⣿⣿⣿⣿⣿⣿⡿⠁⣠ ", + " ⡝⡵⡈⢟⢕⢕⢕⢕⣵⣿⣿⣿⣿⣿⣿⣿⣿⣿⣶⣶⣿⣿⣿⣿⣿⠿⠋⣀⣈⠙ ", + " ⡝⡵⡕⡀⠑⠳⠿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⠿⠛⢉⡠⡲⡫⡪⡪⡣ ", + "", +} + +M[22] = { + "", + " ⣿⣿⣷⡁⢆⠈⠕⢕⢂⢕⢂⢕⢂⢔⢂⢕⢄⠂⣂⠂⠆⢂⢕⢂⢕⢂⢕⢂⢕⢂ ", + " ⣿⣿⣿⡷⠊⡢⡹⣦⡑⢂⢕⢂⢕⢂⢕⢂⠕⠔⠌⠝⠛⠶⠶⢶⣦⣄⢂⢕⢂⢕ ", + " ⣿⣿⠏⣠⣾⣦⡐⢌⢿⣷⣦⣅⡑⠕⠡⠐⢿⠿⣛⠟⠛⠛⠛⠛⠡⢷⡈⢂⢕⢂ ", + " ⠟⣡⣾⣿⣿⣿⣿⣦⣑⠝⢿⣿⣿⣿⣿⣿⡵⢁⣤⣶⣶⣿⢿⢿⢿⡟⢻⣤⢑⢂ ", + " ⣾⣿⣿⡿⢟⣛⣻⣿⣿⣿⣦⣬⣙⣻⣿⣿⣷⣿⣿⢟⢝⢕⢕⢕⢕⢽⣿⣿⣷⣔ ", + " ⣿⣿⠵⠚⠉⢀⣀⣀⣈⣿⣿⣿⣿⣿⣿⣿⣿⣿⣗⢕⢕⢕⢕⢕⢕⣽⣿⣿⣿⣿ ", + " ⢷⣂⣠⣴⣾⡿⡿⡻⡻⣿⣿⣴⣿⣿⣿⣿⣿⣿⣷⣵⣵⣵⣷⣿⣿⣿⣿⣿⣿⡿ ", + " ⢌⠻⣿⡿⡫⡪⡪⡪⡪⣺⣿⣿⣿⣿⣿⠿⠿⢿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⠃ ", + " ⠣⡁⠹⡪⡪⡪⡪⣪⣾⣿⣿⣿⣿⠋⠐⢉⢍⢄⢌⠻⣿⣿⣿⣿⣿⣿⣿⣿⠏⠈ ", + " ⡣⡘⢄⠙⣾⣾⣾⣿⣿⣿⣿⣿⣿⡀⢐⢕⢕⢕⢕⢕⡘⣿⣿⣿⣿⣿⣿⠏⠠⠈ ", + " ⠌⢊⢂⢣⠹⣿⣿⣿⣿⣿⣿⣿⣿⣧⢐⢕⢕⢕⢕⢕⢅⣿⣿⣿⣿⡿⢋⢜⠠⠈ ", + " ⠄⠁⠕⢝⡢⠈⠻⣿⣿⣿⣿⣿⣿⣿⣷⣕⣑⣑⣑⣵⣿⣿⣿⡿⢋⢔⢕⣿⠠⠈ ", + " ⠨⡂⡀⢑⢕⡅⠂⠄⠉⠛⠻⠿⢿⣿⣿⣿⣿⣿⣿⣿⣿⡿⢋⢔⢕⢕⣿⣿⠠⠈ ", + " ⠄⠪⣂⠁⢕⠆⠄⠂⠄⠁⡀⠂⡀⠄⢈⠉⢍⢛⢛⢛⢋⢔⢕⢕⢕⣽⣿⣿⠠⠈ ", + "", +} + +M[23] = { + "", + "⠀⠀⠀⠀⠀⠀⠀⡀⠀⠀⣀⣀⣀⡀⠀⢀⡀⠀⢀⣀⣀⣀⠀⡀⠀⠀⠀⠀⠀⠀", + "⠀⠀⠀⠀⠀⣠⣎⣀⣀⣠⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣶⡄⠀⠀⠀⠀", + "⠀⠀⠀⠀⣰⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣆⠀⠀⠀", + "⠀⠀⠀⢰⣿⣿⣿⣿⣿⣿⣿⣿⣿⡿⡿⠏⠿⠿⠿⠿⠿⣿⣿⣿⣿⣿⣿⡆⠀⠀", + "⠀⠀⠀⣿⣿⣿⣿⣿⣿⡿⢿⠋⠉⠀⠀⠀⠀⠀⡀⠀⠀⠘⢿⣿⣿⣿⣿⣧⠀⠀", + "⠀⠀⢰⣿⣿⣿⣿⠟⢁⠀⠀⠀⠀⠀⠀⠀⠀⠀⠇⠀⠀⡈⠀⠻⣿⣿⣿⣿⠀⠀", + "⠀⠀⣼⣿⣿⡿⠁⠀⢸⠀⠈⢳⣶⣤⣄⠀⠈⠀⠁⠀⠀⠀⢀⠀⠹⣿⣿⡟⠀⠀", + "⠀⠀⣿⣿⣿⠀⠀⠈⣼⡇⠀⠘⠻⠟⠁⠀⠀⠀⠀⢤⣀⡀⠌⠀⠀⣿⣿⠃⠀⠀", + "⠀⠀⣿⣿⣿⡀⠀⠀⡏⡇⠀⠀⠀⠀⠀⠀⠀⠀⠀⠸⣿⡿⠋⢰⢠⣿⡏⠀⠀⠀", + "⠀⠀⣿⣿⣿⡇⠀⠀⢷⡃⠀⠀⢀⡀⠀⠀⠀⠀⠀⠀⠀⠀⣴⣯⣾⡟⠀⠀⠀⠀", + "⠀⠀⣿⣿⣿⡿⠀⠀⣼⣿⡄⠀⠈⠀⢑⠶⠀⠀⠀⠀⢀⣾⣿⣿⣿⡇⠀⠀⠀⠀", + "⠀⠀⣿⣿⣿⠁⠀⠀⣿⣿⠁⠀⠀⠀⢀⣀⣠⣤⣤⣴⠟⣿⣿⣿⣿⡇⠀⠀⠀⠀", + "⠀⠀⠙⢿⠃⠀⠀⢸⣿⣟⠀⠀⢀⣤⣾⣿⣿⣿⠟⠁⢰⣿⣿⣿⣿⠃⠀⠀⠀⠀", + "⠀⠀⠠⠴⠀⠀⠀⠿⠿⠿⠧⠾⠿⠿⠿⠿⠿⠃⠀⠀⠾⠿⠿⠟⠁⠀ ", + "", +} + +M[24] = { + "", + "⣿⣯⣿⣟⣟⡼⣿⡼⡿⣷⣿⣿⣿⠽⡟⢋⣿⣿⠘⣼⣷⡟⠻⡿⣷⡼⣝⡿⡾⣿", + "⣿⣿⣿⣿⢁⣵⡇⡟⠀⣿⣿⣿⠇⠀⡇⣴⣿⣿⣧⣿⣿⡇⠀⢣⣿⣷⣀⡏⢻⣿", + "⣿⣿⠿⣿⣿⣿⠷⠁⠀⠛⠛⠋⠀⠂⠹⠿⠿⠿⠿⠿⠉⠁⠀⠘⠛⠛⠛⠃⢸⣯", + "⣿⡇⠀⣄⣀⣀⣈⣁⠈⠉⠃⠀⠀⠀⠀⠀⠀⠀⠀⠠⠎⠈⠀⣀⣁⣀⣀⡠⠈⠉", + "⣿⣯⣽⡿⢟⡿⠿⠛⠛⠿⣶⣄⠀⠀⠀⠀⠀⠀⠈⢠⣴⣾⠛⠛⠿⠻⠛⠿⣷⣶", + "⣿⣿⣿⠀⠀⠀⣿⡿⣶⣿⣫⠉⠀⠀⠀⠀⠀⠀⠀⠈⠰⣿⠿⠾⣿⡇⠀⠀⢺⣿", + "⣿⣿⠻⡀⠀⠀⠙⠏⠒⡻⠃⠀⠀⠀⠀⣀⠀⠀⠀⠀⠀⠐⡓⢚⠟⠁⠀⠀⡾⢫", + "⣿⣿⠀⠀⡀⠀⠀⡈⣉⡀⡠⣐⣅⣽⣺⣿⣯⡡⣴⣴⣔⣠⣀⣀⡀⢀⡀⡀⠀⣸", + "⣿⣿⣷⣿⣟⣿⡿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⢻⢾⣷⣿", + "⣿⣿⣟⠫⡾⠟⠫⢾⠯⡻⢟⡽⢶⢿⣿⣿⡛⠕⠎⠻⠝⠪⢖⠝⠟⢫⠾⠜⢿⣿", + "⣿⣿⣿⠉⠀⠀⠀⠀⠈⠀⠀⠀⠀⣰⣋⣀⣈⣢⠀⠀⠀⠀⠀⠀⠀⠀⠀⣐⢸⣿", + "⣿⣿⣿⣆⠀⠀⠀⠀⠀⠀⠀⠀⢰⣿⣿⣿⣿⣿⣧⠀⠀⠀⠀⠀⠀⠀⠀⢀⣾⣿", + "⣿⣿⣿⣿⣦⡔⠀⠀⠀⠀⠀⠀⢻⣿⡿⣿⣿⢽⣿⠀⠀⠀⠀⠀⠀⠀⣠⣾⣿⣿", + "⣿⣿⣿⣿⣿⣿⣶⣤⣀⠀⠀⠀⠘⠛⢅⣙⣙⠿⠉⠀⠀⠀⢀⣠⣴⣿⣿⣿⣿⣿", + "⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣶⣤⣄⣅⠀⠓⠀⠀⣀⣠⣴⣺⣿⣿⣿⣿⣿⣿⣿⣿", + "", +} + +M[25] = { + "", + " ⡿⠉⠄⠄⠄⠄⠈⠙⠿⠟⠛⠉⠉⠉⠄⠄⠄⠈⠉⠉⠉⠛⠛⠻⢿⣿⣿⣿⣿⣿ ", + " ⠁⠄⠄⠄⢀⡴⣋⣵⣮⠇⡀⠄⠄⠄⠄⠄⠄⢀⠄⠄⠄⡀⠄⠄⠄⠈⠛⠿⠋⠉ ", + " ⠄⠄⠄⢠⣯⣾⣿⡿⣳⡟⣰⣿⣠⣂⡀⢀⠄⢸⡄⠄⢀⣈⢆⣱⣤⡀⢄⠄⠄⠄ ", + " ⠄⠄⠄⣼⣿⣿⡟⣹⡿⣸⣿⢳⣿⣿⣿⣿⣴⣾⢻⣆⣿⣿⣯⢿⣿⣿⣷⣧⣀⣤ ", + " ⠄⠄⣼⡟⣿⠏⢀⣿⣇⣿⣏⣿⣿⣿⣿⣿⣿⣿⢸⡇⣿⣿⣿⣟⣿⣿⣿⣿⣏⠋ ", + " ⡆⣸⡟⣼⣯⠏⣾⣿⢸⣿⢸⣿⣿⣿⣿⣿⣿⡟⠸⠁⢹⡿⣿⣿⢻⣿⣿⣿⣿⠄ ", + " ⡇⡟⣸⢟⣫⡅⣶⢆⡶⡆⣿⣿⣿⣿⣿⢿⣛⠃⠰⠆⠈⠁⠈⠙⠈⠻⣿⢹⡏⠄ ", + " ⣧⣱⡷⣱⠿⠟⠛⠼⣇⠇⣿⣿⣿⣿⣿⣿⠃⣰⣿⣿⡆⠄⠄⠄⠄⠄⠉⠈⠄⠄ ", + " ⡏⡟⢑⠃⡠⠂⠄⠄⠈⣾⢻⣿⣿⡿⡹⡳⠋⠉⠁⠉⠙⠄⢀⠄⠄⠄⠄⠄⠂⠄ ", + " ⡇⠁⢈⢰⡇⠄⠄⡙⠂⣿⣿⣿⣿⣱⣿⡗⠄⠄⠄⢀⡀⠄⠈⢰⠄⠄⠄⠐⠄⠄ ", + " ⠄⠄⠘⣿⣧⠴⣄⣡⢄⣿⣿⣿⣷⣿⣿⡇⢀⠄⠤⠈⠁⣠⣠⣸⢠⠄⠄⠄⠄⠄ ", + " ⢀⠄⠄⣿⣿⣷⣬⣵⣿⣿⣿⣿⣿⣿⣿⣷⣟⢷⡶⢗⡰⣿⣿⠇⠘⠄⠄⠄⠄⠄ ", + " ⣿⠄⠄⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣷⣶⣾⣿⣿⡟⢀⠃⠄⢸⡄⠁⣸ ", + " ⣿⠄⠄⠘⢿⣿⣿⣿⣿⣿⣿⢛⣿⣿⣿⣿⣿⣿⣿⣿⣿⣟⢄⡆⠄⢀⣪⡆⠄⣿ ", + " ⡟⠄⠄⠄⠄⣾⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⡿⢿⣟⣻⣩⣾⣃⣴⣿⣿⡇⠸⢾ ", + "", +} + +M[26] = { + "", + "⡆⣐⢕⢕⢕⢕⢕⢕⢕⢕⠅⢗⢕⢕⢕⢕⢕⢕⢕⠕⠕⢕⢕⢕⢕⢕⢕⢕⢕⢕", + "⢐⢕⢕⢕⢕⢕⣕⢕⢕⠕⠁⢕⢕⢕⢕⢕⢕⢕⢕⠅⡄⢕⢕⢕⢕⢕⢕⢕⢕⢕", + "⢕⢕⢕⢕⢕⠅⢗⢕⠕⣠⠄⣗⢕⢕⠕⢕⢕⢕⠕⢠⣿⠐⢕⢕⢕⠑⢕⢕⠵⢕", + "⢕⢕⢕⢕⠁⢜⠕⢁⣴⣿⡇⢓⢕⢵⢐⢕⢕⠕⢁⣾⢿⣧⠑⢕⢕⠄⢑⢕⠅⢕", + "⢕⢕⠵⢁⠔⢁⣤⣤⣶⣶⣶⡐⣕⢽⠐⢕⠕⣡⣾⣶⣶⣶⣤⡁⢓⢕⠄⢑⢅⢑", + "⠍⣧⠄⣶⣾⣿⣿⣿⣿⣿⣿⣷⣔⢕⢄⢡⣾⣿⣿⣿⣿⣿⣿⣿⣦⡑⢕⢤⠱⢐", + "⢠⢕⠅⣾⣿⠋⢿⣿⣿⣿⠉⣿⣿⣷⣦⣶⣽⣿⣿⠈⣿⣿⣿⣿⠏⢹⣷⣷⡅⢐", + "⣔⢕⢥⢻⣿⡀⠈⠛⠛⠁⢠⣿⣿⣿⣿⣿⣿⣿⣿⡀⠈⠛⠛⠁⠄⣼⣿⣿⡇⢔", + "⢕⢕⢽⢸⢟⢟⢖⢖⢤⣶⡟⢻⣿⡿⠻⣿⣿⡟⢀⣿⣦⢤⢤⢔⢞⢿⢿⣿⠁⢕", + "⢕⢕⠅⣐⢕⢕⢕⢕⢕⣿⣿⡄⠛⢀⣦⠈⠛⢁⣼⣿⢗⢕⢕⢕⢕⢕⢕⡏⣘⢕", + "⢕⢕⠅⢓⣕⣕⣕⣕⣵⣿⣿⣿⣾⣿⣿⣿⣿⣿⣿⣿⣷⣕⢕⢕⢕⢕⡵⢀⢕⢕", + "⢑⢕⠃⡈⢿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⢃⢕⢕⢕", + "⣆⢕⠄⢱⣄⠛⢿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⠿⢁⢕⢕⠕⢁", + "⣿⣦⡀⣿⣿⣷⣶⣬⣍⣛⣛⣛⡛⠿⠿⠿⠛⠛⢛⣛⣉⣭⣤⣂⢜⠕⢑⣡⣴⣿", + "", +} + +M[27] = { + "", + "⡿⠋⠄⣀⣀⣤⣴⣶⣾⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣦⣌⠻⣿⣿", + "⣴⣾⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣦⠹⣿", + "⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣧⠹", + "⣿⣿⡟⢹⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⡛⢿⣿⣿⣿⣮⠛⣿⣿⣿⣿⣿⣿⡆", + "⡟⢻⡇⢸⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣣⠄⡀⢬⣭⣻⣷⡌⢿⣿⣿⣿⣿⣿", + "⠃⣸⡀⠈⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣧⠈⣆⢹⣿⣿⣿⡈⢿⣿⣿⣿⣿", + "⠄⢻⡇⠄⢛⣛⣻⣿⣿⣿⣿⣿⣿⣿⣿⡆⠹⣿⣆⠸⣆⠙⠛⠛⠃⠘⣿⣿⣿⣿", + "⠄⠸⣡⠄⡈⣿⣿⣿⣿⣿⣿⣿⣿⠿⠟⠁⣠⣉⣤⣴⣿⣿⠿⠿⠿⡇⢸⣿⣿⣿", + "⠄⡄⢿⣆⠰⡘⢿⣿⠿⢛⣉⣥⣴⣶⣿⣿⣿⣿⣻⠟⣉⣤⣶⣶⣾⣿⡄⣿⡿⢸", + "⠄⢰⠸⣿⠄⢳⣠⣤⣾⣿⣿⣿⣿⣿⣿⣿⣿⣿⣧⣼⣿⣿⣿⣿⣿⣿⡇⢻⡇⢸", + "⢷⡈⢣⣡⣶⠿⠟⠛⠓⣚⣻⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣇⢸⠇⠘", + "⡀⣌⠄⠻⣧⣴⣾⣿⣿⣿⣿⣿⣿⣿⣿⡿⠟⠛⠛⠛⢿⣿⣿⣿⣿⣿⡟⠘⠄⠄", + "⣷⡘⣷⡀⠘⣿⣿⣿⣿⣿⣿⣿⣿⡋⢀⣠⣤⣶⣶⣾⡆⣿⣿⣿⠟⠁⠄⠄⠄⠄", + "⣿⣷⡘⣿⡀⢻⣿⣿⣿⣿⣿⣿⣿⣧⠸⣿⣿⣿⣿⣿⣷⡿⠟⠉⠄⠄⠄⠄⡄⢀", + "⣿⣿⣷⡈⢷⡀⠙⠛⠻⠿⠿⠿⠿⠿⠷⠾⠿⠟⣛⣋⣥⣶⣄⠄⢀⣄⠹⣦⢹⣿", + "", +} + +M[28] = { + "", + "⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⡿⣿⡿⠿⢿⣿⣿⣿⣿⣿⣿", + "⣿⣿⣿⣿⣿⣿⣿⣿⣿⡿⠿⠛⠛⠉⠉⠉⠙⠻⣅⠀⠈⢧⠀⠈⠛⠉⠉⢻⣿⣿", + "⣿⣿⣿⣿⣿⣿⠿⠋⠀⠀⠀⠀⠀⠀⠀⠀⣤⡶⠟⠀⠀⣈⠓⢤⣶⡶⠿⠛⠻⣿", + "⣿⣿⣿⣿⣿⢣⠂⠀⠀⠀⠀⠀⠀⠀⠀⠀⢿⣀⣴⠶⠿⠿⢷⡄⠀⠀⢀⣤⣾⣿", + "⣿⣿⣿⣿⣡⠁⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠸⣦⣤⣤⡀⠀⢷⡀⠀⠀⣻⣿⣿", + "⣿⣿⣿⣿⠇⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⡈⠛⠶⠛⠃⠈⠈⢿⣿⣿", + "⣿⣿⠟⠘⠀⠀⠀⠀⠀⠀⠀⠀⢀⡆⠀⠀⠀⠀⠀⠀⣧⠀⠀⠀⠀⠀⠀⠈⣿⣿", + "⣿⠏⠀⠁⠀⠀⠀⠀⠀⠀⠀⢀⣶⡄⠀⠀⠀⠀⠀⠀⣡⣄⣿⡆⠀⠀⠀⠀⣿⣿", + "⡏⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠚⠛⠛⢛⣲⣶⣿⣷⣉⠉⢉⣥⡄⠀⠀⠀⠨⣿⣿", + "⡇⢠⡆⠀⠀⢰⠀⠀⠀⠀⢸⣿⣧⣠⣿⣿⣿⣿⣿⣿⣷⣾⣿⡅⠀⠀⡄⠠⢸⣿", + "⣧⠸⣇⠀⠀⠘⣤⡀⠀⠀⠘⣿⣿⣿⣿⣿⠟⠛⠻⣿⣿⣿⡿⢁⠀⠀⢰⠀⢸⣿", + "⣿⣷⣽⣦⠀⠀⠙⢷⡀⠀⠀⠙⠻⠿⢿⣷⣾⣿⣶⠾⢟⣥⣾⣿⣧⠀⠂⢀⣿⣿", + "⣿⣿⣿⣿⣷⣆⣠⣤⣤⣤⣀⣀⡀⠀⠒⢻⣶⣾⣿⣿⣿⣿⣿⣿⣿⢀⣀⣾⣿⣿", + "", +} + +M[29] = { + "", + "⣿⣿⣿⣿⣯⣿⣿⠄⢠⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⡟⠈⣿⣿⣿⣿⣿⣿⣆⠄", + "⢻⣿⣿⣿⣾⣿⢿⣢⣞⣿⣿⣿⣿⣷⣶⣿⣯⣟⣿⢿⡇⢃⢻⣿⣿⣿⣿⣿⢿⡄", + "⠄⢿⣿⣯⣏⣿⣿⣿⡟⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣷⣧⣾⢿⣮⣿⣿⣿⣿⣾⣷", + "⠄⣈⣽⢾⣿⣿⣿⣟⣄⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣷⣝⣯⢿⣿⣿⣿⣿", + "⣿⠟⣫⢸⣿⢿⣿⣾⣿⢿⣿⣿⢻⣿⣿⣿⢿⣿⣿⣿⢸⣿⣼⣿⣿⣿⣿⣿⣿⣿", + "⡟⢸⣟⢸⣿⠸⣷⣝⢻⠘⣿⣿⢸⢿⣿⣿⠄⣿⣿⣿⡆⢿⣿⣼⣿⣿⣿⣿⢹⣿", + "⡇⣿⡿⣿⣿⢟⠛⠛⠿⡢⢻⣿⣾⣞⣿⡏⠖⢸⣿⢣⣷⡸⣇⣿⣿⣿⢼⡿⣿⣿", + "⣡⢿⡷⣿⣿⣾⣿⣷⣶⣮⣄⣿⣏⣸⣻⣃⠭⠄⠛⠙⠛⠳⠋⣿⣿⣇⠙⣿⢸⣿", + "⠫⣿⣧⣿⣿⣿⣿⣿⣿⣿⣿⣿⠻⣿⣾⣿⣿⣿⣿⣿⣿⣿⣷⣿⣿⣹⢷⣿⡼⠋", + " ⠸⣿⣿⣿⣿⣿⣿⣿⣿⣿⣷⣦⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⡟⣿⣿⣿ ", + " ⢻⢹⣿⠸⣿⣿⣿⣿⣿⣷⣿⣿⣿⣿⣿⣿⣿⣿⣿⡿⣼⣿⣿⣿⣿⡟ ", + " ⠈⢸⣿ ⠙⢿⣿⣿⣹⣿⣿⣿⣿⣟⡃⣽⣿⣿⡟⠁⣿⣿⢻⣿⣿⢿ ", + " ⠘⣿⡄ ⠙⢿⣿⣿⣾⣿⣷⣿⣿⣿⠟⠁ ⣿⣿⣾⣿⡟⣿ ", + " ⢻⡇⠸⣆ ⠈⠻⣿⡿⠿⠛⠉ ⢸⣿⣇⣿⣿⢿⣿ ", + "", +} + +M[30] = { + "", + "⣿⠟⣽⣿⣿⣿⣿⣿⢣⠟⠋⡜⠄⢸⣿⣿⡟⣬⢁⠠⠁⣤⠄⢰⠄⠇⢻⢸", + "⢏⣾⣿⣿⣿⠿⣟⢁⡴⡀⡜⣠⣶⢸⣿⣿⢃⡇⠂⢁⣶⣦⣅⠈⠇⠄⢸⢸", + "⣹⣿⣿⣿⡗⣾⡟⡜⣵⠃⣴⣿⣿⢸⣿⣿⢸⠘⢰⣿⣿⣿⣿⡀⢱⠄⠨⢸", + "⣿⣿⣿⣿⡇⣿⢁⣾⣿⣾⣿⣿⣿⣿⣸⣿⡎⠐⠒⠚⠛⠛⠿⢧⠄⠄⢠⣼", + "⣿⣿⣿⣿⠃⠿⢸⡿⠭⠭⢽⣿⣿⣿⢂⣿⠃⣤⠄⠄⠄⠄⠄⠄⠄⠄⣿⡾", + "⣼⠏⣿⡏⠄⠄⢠⣤⣶⣶⣾⣿⣿⣟⣾⣾⣼⣿⠒⠄⠄⠄⡠⣴⡄⢠⣿⣵", + "⣳⠄⣿⠄⠄⢣⠸⣹⣿⡟⣻⣿⣿⣿⣿⣿⣿⡿⡻⡖⠦⢤⣔⣯⡅⣼⡿⣹", + "⡿⣼⢸⠄⠄⣷⣷⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣕⡜⡌⡝⡸⠙⣼⠟⢱⠏", + "⡇⣿⣧⡰⡄⣿⣿⣿⣿⡿⠿⠿⠿⣿⣿⣿⣿⣿⣿⣿⣿⣷⣋⣪⣥⢠⠏⠄", + "⣧⢻⣿⣷⣧⢻⣿⣿⣿⡇⠄⢀⣀⣀⡙⣿⣿⣿⣿⣿⣿⣿⣿⣿⡇⠂⠄⠄", + "⢹⣼⣿⣿⣿⣧⡻⣿⣿⣇⣴⣿⣿⣿⣷⢸⣿⣿⣿⣿⣿⣿⣿⣿⣰⠄⠄⠄", + "⣼⡟⡟⣿⢸⣿⣿⣝⢿⣿⣾⣿⣿⣿⢟⣾⣿⣿⣿⣿⣿⣿⣿⣿⠟⠄⡀⡀", + "⣿⢰⣿⢹⢸⣿⣿⣿⣷⣝⢿⣿⣿⣿⣿⣿⣿⣿⣿⡿⠿⠛⠉⠄⠄⣸⢰⡇", + "⣿⣾⣹⣏⢸⣿⣿⣿⣿⣿⣷⣍⡻⣛⣛⣛⡉⠁⠄⠄⠄⠄⠄⠄⢀⢇⡏⠄", + "", +} + +M[31] = { + "", + "⢰⡟⣡⡟⣱⣿⡿⠡⢛⣋⣥⣴⣌⢿⣿⣿⣿⣿⣷⣌⠻⢿⣿⣿⣿⣿⣿⣿", + "⠏⢼⡿⣰⡿⠿⠡⠿⠿⢯⣉⠿⣿⣿⣿⣿⣿⣿⣷⣶⣿⣦⣍⠻⢿⣿⣿⣿", + "⣼⣷⢠⠀⠀⢠⣴⡖⠀⠀⠈⠻⣿⡿⣿⣿⣿⣿⣿⣛⣯⣝⣻⣿⣶⣿⣿⣿", + "⣿⡇⣿⡷⠂⠈⡉⠀⠀⠀⣠⣴⣾⣿⣿⣿⣿⣿⣍⡤⣤⣤⣤⡀⠀⠉⠛⠿", + "⣿⢸⣿⡅⣠⣬⣥⣤⣴⣴⣿⣿⢿⣿⣿⣿⣿⣿⣟⡭⡄⣀⣉⡀⠀⠀⠀⠀", + "⡟⣿⣿⢰⣿⣿⣿⣿⣿⣿⣿⣿⣾⣿⣿⣿⣿⣿⣿⣿⣶⣦⣈⠀⠀⠀⢀⣶", + "⡧⣿⡇⣼⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣶⣶⣾⣿", + "⡇⣿⠃⣿⣿⣿⣿⣿⠛⠛⢫⣿⣿⣻⣻⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⢿⣿", + "⡇⣿⠘⡇⢻⣿⣿⣿⡆⠀⠀⠀⠀⠈⠉⠙⠻⠏⠛⠻⣿⣿⣿⣿⣿⣭⡾⢁", + "⡇⣿⠀⠘⢿⣿⣿⣿⣧⢠⣤⠀⡤⢀⣠⣀⣀⠀⠀⣼⣿⣿⣿⣿⣿⠟⣁⠉", + "⣧⢻⠀⡄⠀⠹⣿⣿⣿⡸⣿⣾⡆⣿⣿⣿⠿⣡⣾⣿⣿⣿⣿⡿⠋⠐⢡⣶", + "⣿⡘⠈⣷⠀⠀⠈⠻⣿⣷⣎⠐⠿⢟⣋⣤⣾⣿⣿⣿⡿⠟⣩⠖⢠⡬⠈⠀", + "⣿⣧⠁⢻⡇⠀⠀⠀⠈⠻⣿⣿⣿⣿⣿⣿⠿⠟⠋⠁⢀⠈⢀⡴⠈⠁⠀⠀", + "⠻⣿⣆⠘⣿⠀⠀ ⠀⠈⠙⠛⠋⠉⠀⠀⠀⠀⡀⠤⠚⠁ ", + "", +} + +M[32] = { + "", + " ⣴⣶⣤⡤⠦⣤⣀⣤⠆ ⣈⣭⣭⣿⣶⣿⣦⣼⣆ ", + " ⠉⠻⢿⣿⠿⣿⣿⣶⣦⠤⠄⡠⢾⣿⣿⡿⠋⠉⠉⠻⣿⣿⡛⣦ ", + " ⠈⢿⣿⣟⠦ ⣾⣿⣿⣷⠄⠄⠄⠄⠻⠿⢿⣿⣧⣄ ", + " ⣸⣿⣿⢧ ⢻⠻⣿⣿⣷⣄⣀⠄⠢⣀⡀⠈⠙⠿⠄ ", + " ⢠⣿⣿⣿⠈ ⠡⠌⣻⣿⣿⣿⣿⣿⣿⣿⣛⣳⣤⣀⣀ ", + " ⢠⣧⣶⣥⡤⢄ ⣸⣿⣿⠘⠄ ⢀⣴⣿⣿⡿⠛⣿⣿⣧⠈⢿⠿⠟⠛⠻⠿⠄ ", + " ⣰⣿⣿⠛⠻⣿⣿⡦⢹⣿⣷ ⢊⣿⣿⡏ ⢸⣿⣿⡇ ⢀⣠⣄⣾⠄ ", + " ⣠⣿⠿⠛⠄⢀⣿⣿⣷⠘⢿⣿⣦⡀ ⢸⢿⣿⣿⣄ ⣸⣿⣿⡇⣪⣿⡿⠿⣿⣷⡄ ", + " ⠙⠃ ⣼⣿⡟ ⠈⠻⣿⣿⣦⣌⡇⠻⣿⣿⣷⣿⣿⣿ ⣿⣿⡇⠄⠛⠻⢷⣄ ", + " ⢻⣿⣿⣄ ⠈⠻⣿⣿⣿⣷⣿⣿⣿⣿⣿⡟ ⠫⢿⣿⡆ ", + " ⠻⣿⣿⣿⣿⣶⣶⣾⣿⣿⣿⣿⣿⣿⣿⣿⡟⢀⣀⣤⣾⡿⠃ ", + " ⢰⣶ ⣶ ⢶⣆⢀⣶⠂⣶⡶⠶⣦⡄⢰⣶⠶⢶⣦ ⣴⣶ ", + " ⢸⣿⠶⠶⣿ ⠈⢻⣿⠁ ⣿⡇ ⢸⣿⢸⣿⢶⣾⠏ ⣸⣟⣹⣧ ", + " ⠸⠿ ⠿ ⠸⠿ ⠿⠷⠶⠿⠃⠸⠿⠄⠙⠷⠤⠿⠉⠉⠿⠆ ", + "", +} + +M[33] = { + " ███╗ ██╗ ███████╗ ██████╗ ██╗ ██╗ ██╗ ███╗ ███╗", + " ████╗ ██║ ██╔════╝██╔═══██╗ ██║ ██║ ██║ ████╗ ████║", + " ██╔██╗ ██║ █████╗ ██║ ██║ ██║ ██║ ██║ ██╔████╔██║", + " ██║╚██╗██║ ██╔══╝ ██║ ██║ ╚██╗ ██╔╝ ██║ ██║╚██╔╝██║", + " ██║ ╚████║ ███████╗╚██████╔╝ ╚████╔╝ ██║ ██║ ╚═╝ ██║", + " ╚═╝ ╚═══╝ ╚══════╝ ╚═════╝ ╚═══╝ ╚═╝ ╚═╝ ╚═╝", +} +return M From 4c6818c8642c503edb48b362f0fbecc52331df0f Mon Sep 17 00:00:00 2001 From: luokai Date: Mon, 4 Jul 2022 23:05:16 +0800 Subject: [PATCH 0293/1278] lspsaga --- lua/kide/plugins/config/lspsaga.lua | 9 +++------ lua/kide/plugins/init.lua | 2 +- 2 files changed, 4 insertions(+), 7 deletions(-) diff --git a/lua/kide/plugins/config/lspsaga.lua b/lua/kide/plugins/config/lspsaga.lua index d0453813..3ba89453 100644 --- a/lua/kide/plugins/config/lspsaga.lua +++ b/lua/kide/plugins/config/lspsaga.lua @@ -37,11 +37,8 @@ local saga = require("lspsaga") -- server_filetype_map = {} saga.init_lsp_saga({ - error_sign = "", - warn_sign = "", - hint_sign = "", - infor_sign = "", - code_action_prompt = { - enable = false, + diagnostic_header = { " ", " ", " ", " " }, + server_filetype_map = { + metals = { "java" }, }, }) diff --git a/lua/kide/plugins/init.lua b/lua/kide/plugins/init.lua index 49fa6d6a..64caf9a8 100644 --- a/lua/kide/plugins/init.lua +++ b/lua/kide/plugins/init.lua @@ -306,7 +306,7 @@ vim.defer_fn(function() require("kide.plugins.config.wilder") require("kide.plugins.config.nvim-colorizer") require("kide.plugins.config.comment") - -- require('plugins/config/lspsaga') + -- require('kide.plugins.config.lspsaga') -- require('plugins/config/formatter') require("kide.plugins.config.telescope") -- require('plugins/config/nvim-lsputils') From b6e669c0289925e6c0a89e8fbed979618f7cdbff Mon Sep 17 00:00:00 2001 From: luokai Date: Tue, 5 Jul 2022 17:16:55 +0800 Subject: [PATCH 0294/1278] telescope theme --- lua/kide/plugins/config/gruvbox.lua | 7 +++- lua/kide/plugins/config/telescope.lua | 2 +- lua/kide/theme/gruvbox.lua | 12 ++++++ lua/kide/theme/telescope.lua | 55 +++++++++++++++++++++++++++ 4 files changed, 74 insertions(+), 2 deletions(-) create mode 100644 lua/kide/theme/gruvbox.lua create mode 100644 lua/kide/theme/telescope.lua diff --git a/lua/kide/plugins/config/gruvbox.lua b/lua/kide/plugins/config/gruvbox.lua index b13cc8c6..3226b59f 100644 --- a/lua/kide/plugins/config/gruvbox.lua +++ b/lua/kide/plugins/config/gruvbox.lua @@ -1,5 +1,9 @@ -- setup must be called before loading the colorscheme -- Default options: + +local overrides = {} + +overrides = vim.tbl_extend("force", overrides, require("kide.theme.telescope")) require("gruvbox").setup({ undercurl = true, underline = true, @@ -11,8 +15,9 @@ require("gruvbox").setup({ invert_tabline = false, invert_intend_guides = false, contrast = "", -- can be "hard" or "soft" - overrides = {}, + overrides = overrides, }) + -- vim.api.nvim_command('colorscheme gruvbox') vim.cmd([[ set background=dark diff --git a/lua/kide/plugins/config/telescope.lua b/lua/kide/plugins/config/telescope.lua index 90637ff9..aae58342 100644 --- a/lua/kide/plugins/config/telescope.lua +++ b/lua/kide/plugins/config/telescope.lua @@ -33,7 +33,7 @@ telescope.setup({ height = 0.80, preview_cutoff = 120, }, - winblend = 20, + winblend = 0, -- border = {}, -- borderchars = { "─", "│", "─", "│", "╭", "╮", "╯", "╰" }, -- borderchars = { diff --git a/lua/kide/theme/gruvbox.lua b/lua/kide/theme/gruvbox.lua new file mode 100644 index 00000000..02b66881 --- /dev/null +++ b/lua/kide/theme/gruvbox.lua @@ -0,0 +1,12 @@ +local colors = require("gruvbox.palette") +return { + white = "#ebdbb2", + darker_black = "#232323", + black = "#282828", + black2 = "#2e2e2e", + black3 = "#313131", + grey = "#464646", + red = colors.bright_red, + green = colors.bright_green, + yellow = colors.bright_yellow, +} diff --git a/lua/kide/theme/telescope.lua b/lua/kide/theme/telescope.lua new file mode 100644 index 00000000..ac7a8ce2 --- /dev/null +++ b/lua/kide/theme/telescope.lua @@ -0,0 +1,55 @@ +local colors = require("kide.theme.gruvbox") +return { + + TelescopeBorder = { + fg = colors.darker_black, + bg = colors.darker_black, + }, + + TelescopePromptTitle = { + fg = colors.black, + bg = colors.red, + }, + TelescopePromptPrefix = { + fg = colors.red, + bg = colors.darker_black, + }, + TelescopePromptBorder = { + fg = colors.darker_black, + bg = colors.darker_black, + }, + TelescopePromptNormal = { + fg = colors.white, + bg = colors.darker_black, + }, + + TelescopeResultsTitle = { + fg = colors.black2, + bg = colors.black2, + }, + TelescopeResultsBorder = { + fg = colors.black2, + bg = colors.black2, + }, + TelescopeResultsNormal = { + fg = colors.white, + bg = colors.black2, + }, + + TelescopeNormal = { bg = colors.darker_black }, + + TelescopePreviewTitle = { + fg = colors.black3, + bg = colors.green, + }, + TelescopePreviewBorder = { + fg = colors.black3, + bg = colors.black3, + }, + TelescopePreviewNormal = { + fg = colors.black3, + bg = colors.black3, + }, + + TelescopeSelection = { bg = colors.black2, fg = colors.yellow }, +} From 40ce9611c982e40fbc7c34def33026ee3af16441 Mon Sep 17 00:00:00 2001 From: luokai Date: Tue, 5 Jul 2022 17:23:47 +0800 Subject: [PATCH 0295/1278] update --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index ab034e72..27ca1dbe 100644 --- a/README.md +++ b/README.md @@ -57,7 +57,7 @@ git clone https://github.com/JavaHello/nvim.git - 启动页 ![home](https://javahello.github.io/dev/nvim-lean/images/home.png) - 查找文件 - ![find-file](https://javahello.github.io/dev/nvim-lean/images/find-file.gif) + ![find-file](https://javahello.github.io/dev/nvim-lean/images/telescope-theme-1.png) - 全局搜索 ![find-word](https://javahello.github.io/dev/nvim-lean/images/find-word.gif) - 全局搜索替换 From f24aa7affa4f534209b6becd5ee09e0660cb9393 Mon Sep 17 00:00:00 2001 From: luokai Date: Tue, 5 Jul 2022 22:30:10 +0800 Subject: [PATCH 0296/1278] fmt --- .tasks.json | 8 ++++++++ stylua.toml | 6 ++++++ 2 files changed, 14 insertions(+) create mode 100644 .tasks.json create mode 100644 stylua.toml diff --git a/.tasks.json b/.tasks.json new file mode 100644 index 00000000..8031ce41 --- /dev/null +++ b/.tasks.json @@ -0,0 +1,8 @@ +{ + "tasks": [ + { + "name": "fmt", + "cmd": "stylua --config-path ./stylua.toml **/*.lua" + } + ] +} diff --git a/stylua.toml b/stylua.toml new file mode 100644 index 00000000..6090f425 --- /dev/null +++ b/stylua.toml @@ -0,0 +1,6 @@ +column_width = 120 +line_endings = "Unix" +indent_type = "Spaces" +indent_width = 2 +quote_style = "AutoPreferDouble" +call_parentheses = "Always" From 00cd651d5d76286aa92b2b97e1956b57975e8f31 Mon Sep 17 00:00:00 2001 From: luokai Date: Tue, 5 Jul 2022 22:30:26 +0800 Subject: [PATCH 0297/1278] fmt --- init.lua | 8 +- lua/kide/core/keybindings.lua | 430 +++---- lua/kide/core/utils/init.lua | 276 ++--- lua/kide/core/utils/plantuml.lua | 72 +- lua/kide/dap/codelldb.lua | 138 +-- lua/kide/lsp/init.lua | 108 +- lua/kide/lsp/java.lua | 482 ++++---- lua/kide/lsp/pyright.lua | 24 +- lua/kide/lsp/rust_analyzer.lua | 36 +- lua/kide/lsp/sqls.lua | 10 +- lua/kide/lsp/sumneko_lua.lua | 48 +- lua/kide/lsp/utils/init.lua | 26 +- lua/kide/plugins/config/aerial.lua | 478 +++---- lua/kide/plugins/config/alpha-nvim.lua | 14 +- lua/kide/plugins/config/ascli-header.lua | 1164 +++++++++--------- lua/kide/plugins/config/autosave.lua | 26 +- lua/kide/plugins/config/bufferline.lua | 120 +- lua/kide/plugins/config/dashboard-nvim.lua | 16 +- lua/kide/plugins/config/diffview-nvim.lua | 226 ++-- lua/kide/plugins/config/formatter.lua | 46 +- lua/kide/plugins/config/gitsigns-nvim.lua | 174 +-- lua/kide/plugins/config/gruvbox.lua | 22 +- lua/kide/plugins/config/indent-blankline.lua | 66 +- lua/kide/plugins/config/lsp-colors.lua | 8 +- lua/kide/plugins/config/lsp_signature.lua | 14 +- lua/kide/plugins/config/lspsaga.lua | 8 +- lua/kide/plugins/config/lualine.lua | 96 +- lua/kide/plugins/config/luasnip.lua | 838 ++++++------- lua/kide/plugins/config/neogit.lua | 142 +-- lua/kide/plugins/config/null-ls.lua | 142 +-- lua/kide/plugins/config/nvim-cmp.lua | 96 +- lua/kide/plugins/config/nvim-colorizer.lua | 36 +- lua/kide/plugins/config/nvim-dap.lua | 46 +- lua/kide/plugins/config/nvim-lsputils.lua | 120 +- lua/kide/plugins/config/nvim-neorg.lua | 22 +- lua/kide/plugins/config/nvim-notify.lua | 46 +- lua/kide/plugins/config/nvim-tree.lua | 176 +-- lua/kide/plugins/config/nvim-treesitter.lua | 116 +- lua/kide/plugins/config/rest-nvim.lua | 40 +- lua/kide/plugins/config/symbols-outline.lua | 100 +- lua/kide/plugins/config/telescope.lua | 202 +-- lua/kide/plugins/config/toggletasks.lua | 12 +- lua/kide/plugins/config/translate.lua | 20 +- lua/kide/plugins/config/trouble.lua | 6 +- lua/kide/plugins/config/vim-illuminate.lua | 22 +- lua/kide/plugins/config/wilder.lua | 4 +- lua/kide/plugins/init.lua | 618 +++++----- lua/kide/theme/gruvbox.lua | 12 +- lua/kide/theme/telescope.lua | 92 +- lua/packer_bootstrap.lua | 18 +- 50 files changed, 3531 insertions(+), 3531 deletions(-) diff --git a/init.lua b/init.lua index be8631f0..6d239398 100644 --- a/init.lua +++ b/init.lua @@ -2,14 +2,14 @@ math.randomseed(os.time()) local present, impatient = pcall(require, "impatient") if present then - impatient.enable_profile() + impatient.enable_profile() end require("kide.core.basic") require("kide.plugins") vim.defer_fn(function() - require("kide.lsp") - require("kide.dap") + require("kide.lsp") + require("kide.dap") - require("kide.core.utils.plantuml").setup() + require("kide.core.utils.plantuml").setup() end, 0) diff --git a/lua/kide/core/keybindings.lua b/lua/kide/core/keybindings.lua index e4ea18c2..16c18351 100644 --- a/lua/kide/core/keybindings.lua +++ b/lua/kide/core/keybindings.lua @@ -8,86 +8,86 @@ local keymap = vim.keymap.set local M = {} M.setup = function() - -- Esc - -- map('i', 'jk', '', opt) - -- nvimTree - map("n", "e", ":NvimTreeToggle", opt) - -- n 模式下复制内容到系统剪切板 - map("n", "c", '"+yy', opt) - -- v 模式下复制内容到系统剪切板 - map("v", "c", '"+yy', opt) - -- n 模式下粘贴系统剪切板的内容 - map("n", "v", '"+p', opt) - -- 取消搜索高亮显示 - map("n", "", ":nohlsearch", opt) - -- %bd 删除所有缓冲区, e# 打开最后一个缓冲区, bd# 关闭[No Name] - -- map('n', 'o', ':%bd|e#|bd#', opt) - -- map('n', 'o', 'lua require("kide.core.utils").close_other_bufline()', opt) - vim.api.nvim_create_user_command("BufferCloseOther", function() - require("kide.core.utils").close_other_bufline() - end, {}) - map("n", "s", ":w", opt) - map("n", "w", ":bwipeout", opt) - map("n", "W", ":%bwipeout", opt) - map("n", "q", ":q", opt) - map("n", "n", ":BufferLineCycleNext ", opt) - map("n", "p", ":BufferLineCyclePrev ", opt) + -- Esc + -- map('i', 'jk', '', opt) + -- nvimTree + map("n", "e", ":NvimTreeToggle", opt) + -- n 模式下复制内容到系统剪切板 + map("n", "c", '"+yy', opt) + -- v 模式下复制内容到系统剪切板 + map("v", "c", '"+yy', opt) + -- n 模式下粘贴系统剪切板的内容 + map("n", "v", '"+p', opt) + -- 取消搜索高亮显示 + map("n", "", ":nohlsearch", opt) + -- %bd 删除所有缓冲区, e# 打开最后一个缓冲区, bd# 关闭[No Name] + -- map('n', 'o', ':%bd|e#|bd#', opt) + -- map('n', 'o', 'lua require("kide.core.utils").close_other_bufline()', opt) + vim.api.nvim_create_user_command("BufferCloseOther", function() + require("kide.core.utils").close_other_bufline() + end, {}) + map("n", "s", ":w", opt) + map("n", "w", ":bwipeout", opt) + map("n", "W", ":%bwipeout", opt) + map("n", "q", ":q", opt) + map("n", "n", ":BufferLineCycleNext ", opt) + map("n", "p", ":BufferLineCyclePrev ", opt) - -- " 退出 terminal 模式 - map("t", "", "", opt) - map("t", "jk", "", opt) + -- " 退出 terminal 模式 + map("t", "", "", opt) + map("t", "jk", "", opt) - -- Leaderf - -- vim.g.Lf_ShortcutF = '' - -- map('n', '', ':=printf("Leaderf! rg -e %s ", expand(""))', {}) - -- map('v', '', ':=printf("Leaderf! rg -e %s ", leaderf#Rg#visual())', {}) - -- map('n', 'r', ':Leaderf --nowrap task', {}) + -- Leaderf + -- vim.g.Lf_ShortcutF = '' + -- map('n', '', ':=printf("Leaderf! rg -e %s ", expand(""))', {}) + -- map('v', '', ':=printf("Leaderf! rg -e %s ", leaderf#Rg#visual())', {}) + -- map('n', 'r', ':Leaderf --nowrap task', {}) - -- vim-floaterm - -- vim.g.floaterm_keymap_new = 'ft' - -- map('n', '', ':FloatermToggle', opt) - -- map('t', ' ', '::FloatermToggle', opt) - map("n", "", ":ToggleTerm", opt) + -- vim-floaterm + -- vim.g.floaterm_keymap_new = 'ft' + -- map('n', '', ':FloatermToggle', opt) + -- map('t', ' ', '::FloatermToggle', opt) + map("n", "", ":ToggleTerm", opt) - -- symbols-outline.nvim - map("n", "o", ":SymbolsOutline", opt) + -- symbols-outline.nvim + map("n", "o", ":SymbolsOutline", opt) - -- trouble.nvim - -- see lsp map - -- map('n', 'x', 'Trouble', opt) + -- trouble.nvim + -- see lsp map + -- map('n', 'x', 'Trouble', opt) - -- lspsaga - -- map('n', 'K', ':Lspsaga hover_doc', opt) - -- map('n', 'gr', ':Lspsaga lsp_finder', opt) + -- lspsaga + -- map('n', 'K', ':Lspsaga hover_doc', opt) + -- map('n', 'gr', ':Lspsaga lsp_finder', opt) - -- Telescope - map("n", "ff", "Telescope find_files", opt) - keymap("v", "ff", function() - local tb = require("telescope.builtin") - local text = require("kide.core.utils").get_visual_selection() - tb.find_files({ default_text = text }) - end, opt) - map("n", "", "Telescope find_files", opt) - map("n", "fg", "Telescope live_grep", opt) - keymap("v", "fg", function() - local tb = require("telescope.builtin") - local text = require("kide.core.utils").get_visual_selection() - tb.live_grep({ default_text = text }) - end, opt) - map("n", "fb", "Telescope buffers", opt) - map("n", "fh", "Telescope help_tags", opt) + -- Telescope + map("n", "ff", "Telescope find_files", opt) + keymap("v", "ff", function() + local tb = require("telescope.builtin") + local text = require("kide.core.utils").get_visual_selection() + tb.find_files({ default_text = text }) + end, opt) + map("n", "", "Telescope find_files", opt) + map("n", "fg", "Telescope live_grep", opt) + keymap("v", "fg", function() + local tb = require("telescope.builtin") + local text = require("kide.core.utils").get_visual_selection() + tb.live_grep({ default_text = text }) + end, opt) + map("n", "fb", "Telescope buffers", opt) + map("n", "fh", "Telescope help_tags", opt) - -- translate - map("n", "tz", ":Translate ZH -source=EN -parse_after=window -output=floating", opt) - map("v", "tz", ":Translate ZH -source=EN -parse_after=window -output=floating", opt) - map("n", "te", ":Translate EN -source=ZH -parse_after=window -output=floating", opt) - map("v", "te", ":Translate EN -source=ZH -parse_after=window -output=floating", opt) + -- translate + map("n", "tz", ":Translate ZH -source=EN -parse_after=window -output=floating", opt) + map("v", "tz", ":Translate ZH -source=EN -parse_after=window -output=floating", opt) + map("n", "te", ":Translate EN -source=ZH -parse_after=window -output=floating", opt) + map("v", "te", ":Translate EN -source=ZH -parse_after=window -output=floating", opt) - -- camel_case - require("kide.core.utils").camel_case_init() + -- camel_case + require("kide.core.utils").camel_case_init() - -- vim-easy-align - vim.cmd([[ + -- vim-easy-align + vim.cmd([[ " Start interactive EasyAlign in visual mode (e.g. vipga) xmap ga (EasyAlign) @@ -95,8 +95,8 @@ xmap ga (EasyAlign) nmap ga (EasyAlign) ]]) - -- nvim-dap - vim.cmd([[ + -- nvim-dap + vim.cmd([[ nnoremap :lua require'dap'.continue() nnoremap :lua require'dap'.step_over() nnoremap :lua require'dap'.step_into() @@ -108,13 +108,13 @@ nnoremap dr :lua require'dap'.repl.open() nnoremap dl :lua require'dap'.run_last() ]]) - -- nvim-dap-ui - vim.cmd([[ + -- nvim-dap-ui + vim.cmd([[ nnoremap dr :lua require("dapui").float_element(vim.Nil, { enter = true}) ]]) - -- bufferline.nvim - vim.cmd([[ + -- bufferline.nvim + vim.cmd([[ nnoremap 1 BufferLineGoToBuffer 1 nnoremap 2 BufferLineGoToBuffer 2 nnoremap 3 BufferLineGoToBuffer 3 @@ -135,40 +135,40 @@ end -- hop.nvim -- place this in one of your configuration file(s) map( - "n", - "f", - "lua require'hop'.hint_char1({ direction = require'hop.hint'.HintDirection.AFTER_CURSOR, current_line_only = true })", - opt + "n", + "f", + "lua require'hop'.hint_char1({ direction = require'hop.hint'.HintDirection.AFTER_CURSOR, current_line_only = true })", + opt ) map( - "v", - "f", - "lua require'hop'.hint_char1({ direction = require'hop.hint'.HintDirection.AFTER_CURSOR, current_line_only = true })", - opt + "v", + "f", + "lua require'hop'.hint_char1({ direction = require'hop.hint'.HintDirection.AFTER_CURSOR, current_line_only = true })", + opt ) map( - "n", - "F", - "lua require'hop'.hint_char1({ direction = require'hop.hint'.HintDirection.BEFORE_CURSOR, current_line_only = true })", - opt + "n", + "F", + "lua require'hop'.hint_char1({ direction = require'hop.hint'.HintDirection.BEFORE_CURSOR, current_line_only = true })", + opt ) map( - "v", - "F", - "lua require'hop'.hint_char1({ direction = require'hop.hint'.HintDirection.BEFORE_CURSOR, current_line_only = true })", - opt + "v", + "F", + "lua require'hop'.hint_char1({ direction = require'hop.hint'.HintDirection.BEFORE_CURSOR, current_line_only = true })", + opt ) map( - "o", - "f", - "lua require'hop'.hint_char1({ direction = require'hop.hint'.HintDirection.AFTER_CURSOR, current_line_only = true, inclusive_jump = true })", - opt + "o", + "f", + "lua require'hop'.hint_char1({ direction = require'hop.hint'.HintDirection.AFTER_CURSOR, current_line_only = true, inclusive_jump = true })", + opt ) map( - "o", - "F", - "lua require'hop'.hint_char1({ direction = require'hop.hint'.HintDirection.BEFORE_CURSOR, current_line_only = true, inclusive_jump = true })", - opt + "o", + "F", + "lua require'hop'.hint_char1({ direction = require'hop.hint'.HintDirection.BEFORE_CURSOR, current_line_only = true, inclusive_jump = true })", + opt ) -- map('', 't', "lua require'hop'.hint_char1({ direction = require'hop.hint'.HintDirection.AFTER_CURSOR, current_line_only = true })", opt) -- map('', 'T', "lua require'hop'.hint_char1({ direction = require'hop.hint'.HintDirection.BEFORE_CURSOR, current_line_only = true })", opt) @@ -189,133 +189,133 @@ map("v", "fr", "lua require('spectre').open_visual()", opt) map("n", "ts", "Telescope toggletasks spawn", opt) -- lsp 回调函数快捷键设置 M.maplsp = function(client, bufnr) - vim.api.nvim_buf_set_option(bufnr, "omnifunc", "v:lua.vim.lsp.omnifunc") - vim.api.nvim_buf_set_option(bufnr, "formatexpr", "v:lua.vim.lsp.formatexpr()") + vim.api.nvim_buf_set_option(bufnr, "omnifunc", "v:lua.vim.lsp.omnifunc") + vim.api.nvim_buf_set_option(bufnr, "formatexpr", "v:lua.vim.lsp.formatexpr()") - vim.api.nvim_buf_set_keymap(bufnr, "n", "K", "lua vim.lsp.buf.hover()", opt) - -- rename - vim.api.nvim_buf_set_keymap(bufnr, "n", "rn", "lua vim.lsp.buf.rename()", opt) - -- mapbuf('n', 'rn', 'lua require("lspsaga.rename").rename()', opt) - -- code action - vim.api.nvim_buf_set_keymap(bufnr, "n", "ca", "lua vim.lsp.buf.code_action()", opt) - -- mapbuf('n', 'ca', 'lua require("lspsaga.codeaction").code_action()', opt) - -- go xx - -- mapbuf('n', 'gd', 'lua vim.lsp.buf.definition()', opt) - -- vim.api.nvim_buf_set_keymap(bufnr, 'n', 'gd', 'Trouble lsp_definitions', opt) - vim.api.nvim_buf_set_keymap(bufnr, "n", "gd", "Telescope lsp_definitions", opt) - vim.api.nvim_buf_set_keymap(bufnr, "n", "gh", "lua vim.lsp.buf.hover()", opt) - -- mapbuf('n', 'gD', 'lua vim.lsp.buf.declaration()', opt) - -- mapbuf('n', 'gD', 'lua vim.lsp.buf.type_definition()', opt) - vim.api.nvim_buf_set_keymap(bufnr, "n", "gD", "Trouble lsp_type_definitions", opt) - -- mapbuf('n', 'gi', 'lua vim.lsp.buf.implementation()', opt) - vim.api.nvim_buf_set_keymap(bufnr, "n", "gi", "Trouble lsp_implementations", opt) - vim.api.nvim_buf_set_keymap(bufnr, "n", "gi", "Telescope lsp_implementations", opt) - -- mapbuf('n', 'gr', 'lua vim.lsp.buf.references()', opt) - vim.api.nvim_buf_set_keymap(bufnr, "n", "gr", "Trouble lsp_references", opt) - vim.api.nvim_buf_set_keymap(bufnr, "n", "gr", "Telescope lsp_references", opt) - -- mapbuf('n', 'gr', 'lua require"lspsaga.provider".lsp_finder()', opt) - -- mapbuf('n', 's', 'lua vim.lsp.buf.workspace_symbol()', opt) - -- mapbuf('n', 's', 'lua require"telescope.builtin".lsp_workspace_symbols({ query = vim.fn.input("Query> ") })', opt) - vim.api.nvim_buf_set_keymap(bufnr, "n", "fs", "Telescope lsp_dynamic_workspace_symbols", opt) - keymap("v", "fs", function() - local tb = require("telescope.builtin") - local text = require("kide.core.utils").get_visual_selection() - tb.lsp_workspace_symbols({ default_text = text, query = text }) - end, opt) + vim.api.nvim_buf_set_keymap(bufnr, "n", "K", "lua vim.lsp.buf.hover()", opt) + -- rename + vim.api.nvim_buf_set_keymap(bufnr, "n", "rn", "lua vim.lsp.buf.rename()", opt) + -- mapbuf('n', 'rn', 'lua require("lspsaga.rename").rename()', opt) + -- code action + vim.api.nvim_buf_set_keymap(bufnr, "n", "ca", "lua vim.lsp.buf.code_action()", opt) + -- mapbuf('n', 'ca', 'lua require("lspsaga.codeaction").code_action()', opt) + -- go xx + -- mapbuf('n', 'gd', 'lua vim.lsp.buf.definition()', opt) + -- vim.api.nvim_buf_set_keymap(bufnr, 'n', 'gd', 'Trouble lsp_definitions', opt) + vim.api.nvim_buf_set_keymap(bufnr, "n", "gd", "Telescope lsp_definitions", opt) + vim.api.nvim_buf_set_keymap(bufnr, "n", "gh", "lua vim.lsp.buf.hover()", opt) + -- mapbuf('n', 'gD', 'lua vim.lsp.buf.declaration()', opt) + -- mapbuf('n', 'gD', 'lua vim.lsp.buf.type_definition()', opt) + vim.api.nvim_buf_set_keymap(bufnr, "n", "gD", "Trouble lsp_type_definitions", opt) + -- mapbuf('n', 'gi', 'lua vim.lsp.buf.implementation()', opt) + vim.api.nvim_buf_set_keymap(bufnr, "n", "gi", "Trouble lsp_implementations", opt) + vim.api.nvim_buf_set_keymap(bufnr, "n", "gi", "Telescope lsp_implementations", opt) + -- mapbuf('n', 'gr', 'lua vim.lsp.buf.references()', opt) + vim.api.nvim_buf_set_keymap(bufnr, "n", "gr", "Trouble lsp_references", opt) + vim.api.nvim_buf_set_keymap(bufnr, "n", "gr", "Telescope lsp_references", opt) + -- mapbuf('n', 'gr', 'lua require"lspsaga.provider".lsp_finder()', opt) + -- mapbuf('n', 's', 'lua vim.lsp.buf.workspace_symbol()', opt) + -- mapbuf('n', 's', 'lua require"telescope.builtin".lsp_workspace_symbols({ query = vim.fn.input("Query> ") })', opt) + vim.api.nvim_buf_set_keymap(bufnr, "n", "fs", "Telescope lsp_dynamic_workspace_symbols", opt) + keymap("v", "fs", function() + local tb = require("telescope.builtin") + local text = require("kide.core.utils").get_visual_selection() + tb.lsp_workspace_symbols({ default_text = text, query = text }) + end, opt) - vim.api.nvim_buf_set_keymap(bufnr, "n", "fo", "Telescope lsp_document_symbols", opt) - -- diagnostic - vim.api.nvim_buf_set_keymap(bufnr, "n", "go", "lua vim.diagnostic.open_float()", opt) - vim.api.nvim_buf_set_keymap(bufnr, "n", "[g", "lua vim.diagnostic.goto_prev()", opt) - vim.api.nvim_buf_set_keymap(bufnr, "n", "]g", "lua vim.diagnostic.goto_next()", opt) - -- mapbuf('n', 'q', 'lua vim.diagnostic.setloclist()', opt) - -- leader + = - -- vim.api.nvim_buf_set_keymap(bufnr, 'n', '=', 'lua vim.lsp.buf.format()', opt) - -- vim.api.nvim_buf_set_keymap(bufnr, 'v', '=', 'lua vim.lsp.buf.range_formatting()', opt) + vim.api.nvim_buf_set_keymap(bufnr, "n", "fo", "Telescope lsp_document_symbols", opt) + -- diagnostic + vim.api.nvim_buf_set_keymap(bufnr, "n", "go", "lua vim.diagnostic.open_float()", opt) + vim.api.nvim_buf_set_keymap(bufnr, "n", "[g", "lua vim.diagnostic.goto_prev()", opt) + vim.api.nvim_buf_set_keymap(bufnr, "n", "]g", "lua vim.diagnostic.goto_next()", opt) + -- mapbuf('n', 'q', 'lua vim.diagnostic.setloclist()', opt) + -- leader + = + -- vim.api.nvim_buf_set_keymap(bufnr, 'n', '=', 'lua vim.lsp.buf.format()', opt) + -- vim.api.nvim_buf_set_keymap(bufnr, 'v', '=', 'lua vim.lsp.buf.range_formatting()', opt) - keymap("n", "=", function() - local bfn = vim.api.nvim_get_current_buf() - vim.lsp.buf.format({ - bufnr = bfn, - filter = function(c) - return require("kide.lsp.utils").filter_format_lsp_client(c, bfn) - end, - }) - end, opt) - vim.api.nvim_buf_set_keymap( - bufnr, - "v", - "=", - 'lua require("kide.lsp.utils").format_range_operator()', - opt - ) - -- mapbuf('v', '=', 'lua vim.lsp.buf.formatting()', opt) - -- mapbuf('n', '', 'lua vim.lsp.buf.signature_help()', opt) - -- mapbuf('n', 'wa', 'lua vim.lsp.buf.add_workspace_folder()', opt) - -- mapbuf('n', 'wr', 'lua vim.lsp.buf.remove_workspace_folder()', opt) - -- mapbuf('n', 'wl', 'lua print(vim.inspect(vim.lsp.buf.list_workspace_folders()))', opt) - -- mapbuf('n', 'D', 'lua vim.lsp.buf.type_definition()', opt) - vim.api.nvim_buf_set_keymap(bufnr, "n", "xx", "Trouble", opt) - vim.api.nvim_buf_set_keymap(bufnr, "n", "xw", "Trouble workspace_diagnostics", opt) - vim.api.nvim_buf_set_keymap(bufnr, "n", "xd", "Trouble document_diagnostics", opt) - vim.api.nvim_buf_set_keymap(bufnr, "n", "xq", "Trouble quickfix", opt) + keymap("n", "=", function() + local bfn = vim.api.nvim_get_current_buf() + vim.lsp.buf.format({ + bufnr = bfn, + filter = function(c) + return require("kide.lsp.utils").filter_format_lsp_client(c, bfn) + end, + }) + end, opt) + vim.api.nvim_buf_set_keymap( + bufnr, + "v", + "=", + 'lua require("kide.lsp.utils").format_range_operator()', + opt + ) + -- mapbuf('v', '=', 'lua vim.lsp.buf.formatting()', opt) + -- mapbuf('n', '', 'lua vim.lsp.buf.signature_help()', opt) + -- mapbuf('n', 'wa', 'lua vim.lsp.buf.add_workspace_folder()', opt) + -- mapbuf('n', 'wr', 'lua vim.lsp.buf.remove_workspace_folder()', opt) + -- mapbuf('n', 'wl', 'lua print(vim.inspect(vim.lsp.buf.list_workspace_folders()))', opt) + -- mapbuf('n', 'D', 'lua vim.lsp.buf.type_definition()', opt) + vim.api.nvim_buf_set_keymap(bufnr, "n", "xx", "Trouble", opt) + vim.api.nvim_buf_set_keymap(bufnr, "n", "xw", "Trouble workspace_diagnostics", opt) + vim.api.nvim_buf_set_keymap(bufnr, "n", "xd", "Trouble document_diagnostics", opt) + vim.api.nvim_buf_set_keymap(bufnr, "n", "xq", "Trouble quickfix", opt) end -- nvim-cmp 自动补全 M.cmp = function(cmp) - local luasnip = require("luasnip") - local has_words_before = function() - local line, col = unpack(vim.api.nvim_win_get_cursor(0)) - return col ~= 0 and vim.api.nvim_buf_get_lines(0, line - 1, line, true)[1]:sub(col, col):match("%s") == nil - end - return { - -- 上一个 - -- [''] = cmp.mapping.select_prev_item(), - -- 下一个 - -- [''] = cmp.mapping.select_next_item(), - -- [""] = cmp.mapping.select_prev_item(), - -- [''] = cmp.mapping.close(), - -- 确认 - -- Accept currently selected item. If none selected, `select` first item. - -- Set `select` to `false` to only confirm explicitly selected items. - -- [""] = cmp.mapping.scroll_docs(-4), - -- [""] = cmp.mapping.scroll_docs(4), - [""] = cmp.mapping.select_prev_item(), - [""] = cmp.mapping.select_next_item(), - [""] = cmp.mapping.complete(), - [""] = cmp.mapping.close(), - [""] = cmp.mapping.confirm({ - behavior = cmp.ConfirmBehavior.Replace, - -- select = true, - }), + local luasnip = require("luasnip") + local has_words_before = function() + local line, col = unpack(vim.api.nvim_win_get_cursor(0)) + return col ~= 0 and vim.api.nvim_buf_get_lines(0, line - 1, line, true)[1]:sub(col, col):match("%s") == nil + end + return { + -- 上一个 + -- [''] = cmp.mapping.select_prev_item(), + -- 下一个 + -- [''] = cmp.mapping.select_next_item(), + -- [""] = cmp.mapping.select_prev_item(), + -- [''] = cmp.mapping.close(), + -- 确认 + -- Accept currently selected item. If none selected, `select` first item. + -- Set `select` to `false` to only confirm explicitly selected items. + -- [""] = cmp.mapping.scroll_docs(-4), + -- [""] = cmp.mapping.scroll_docs(4), + [""] = cmp.mapping.select_prev_item(), + [""] = cmp.mapping.select_next_item(), + [""] = cmp.mapping.complete(), + [""] = cmp.mapping.close(), + [""] = cmp.mapping.confirm({ + behavior = cmp.ConfirmBehavior.Replace, + -- select = true, + }), - [""] = cmp.mapping(function(fallback) - if cmp.visible() then - cmp.select_next_item() - elseif luasnip.expand_or_jumpable() then - luasnip.expand_or_jump() - elseif has_words_before() then - cmp.complete() - else - fallback() - end - end, { "i", "s" }), + [""] = cmp.mapping(function(fallback) + if cmp.visible() then + cmp.select_next_item() + elseif luasnip.expand_or_jumpable() then + luasnip.expand_or_jump() + elseif has_words_before() then + cmp.complete() + else + fallback() + end + end, { "i", "s" }), - [""] = cmp.mapping(function(fallback) - if cmp.visible() then - cmp.select_prev_item() - elseif luasnip.jumpable(-1) then - luasnip.jump(-1) - else - fallback() - end - end, { "i", "s" }), - } + [""] = cmp.mapping(function(fallback) + if cmp.visible() then + cmp.select_prev_item() + elseif luasnip.jumpable(-1) then + luasnip.jump(-1) + else + fallback() + end + end, { "i", "s" }), + } end M.rest_nvim = function() - -- rest-nvim - vim.cmd([[ + -- rest-nvim + vim.cmd([[ command! -buffer Http :lua require'rest-nvim'.run() command! -buffer HttpCurl :lua require'rest-nvim'.run(true) command! -buffer HttpLast :lua require'rest-nvim'.last() diff --git a/lua/kide/core/utils/init.lua b/lua/kide/core/utils/init.lua index 06035d48..49cc8b57 100644 --- a/lua/kide/core/utils/init.lua +++ b/lua/kide/core/utils/init.lua @@ -3,161 +3,161 @@ local M = {} -- 76 #h "README.md" 第 1 行 -- 78 h "init.lua" 第 1 行 M.close_other_buf = function() - -- local cur_winnr = vim.fn.winnr() - local cur_buf = vim.fn.bufnr("%") - if cur_buf == -1 then - return - end - -- local bf_no = vim.fn.winbufnr(cur_winnr) - vim.fn.execute("bn") - local next_buf = vim.fn.bufnr("%") - -- print('cur_buf ' .. cur_buf) + -- local cur_winnr = vim.fn.winnr() + local cur_buf = vim.fn.bufnr("%") + if cur_buf == -1 then + return + end + -- local bf_no = vim.fn.winbufnr(cur_winnr) + vim.fn.execute("bn") + local next_buf = vim.fn.bufnr("%") + -- print('cur_buf ' .. cur_buf) - local count = 999 - while next_buf ~= -1 and cur_buf ~= next_buf and count > 0 do - -- print('next_buf ' .. next_buf) - local bdel = "bdel " .. next_buf - vim.fn.execute("bn") - vim.fn.execute(bdel) - next_buf = vim.fn.bufnr("%") - count = count - 1 - end + local count = 999 + while next_buf ~= -1 and cur_buf ~= next_buf and count > 0 do + -- print('next_buf ' .. next_buf) + local bdel = "bdel " .. next_buf + vim.fn.execute("bn") + vim.fn.execute(bdel) + next_buf = vim.fn.bufnr("%") + count = count - 1 + end end M.close_other_bufline = function() - vim.fn.execute("BufferLineCloseLeft") - vim.fn.execute("BufferLineCloseRight") + vim.fn.execute("BufferLineCloseLeft") + vim.fn.execute("BufferLineCloseRight") end M.packer_lazy_load = function(plugin, timer) - if plugin then - timer = timer or 0 - vim.defer_fn(function() - require("packer").loader(plugin) - end, timer) - end + if plugin then + timer = timer or 0 + vim.defer_fn(function() + require("packer").loader(plugin) + end, timer) + end end M.is_upper = function(c) - return c >= 65 and c <= 90 + return c >= 65 and c <= 90 end M.is_lower = function(c) - return c >= 97 and c <= 122 + return c >= 97 and c <= 122 end M.char_size = function(c) - local code = c - if code < 127 then - return 1 - elseif code <= 223 then - return 2 - elseif code <= 239 then - return 3 - elseif code <= 247 then - return 4 - end - return nil + local code = c + if code < 127 then + return 1 + elseif code <= 223 then + return 2 + elseif code <= 239 then + return 3 + elseif code <= 247 then + return 4 + end + return nil end M.camel_case = function(word) - if word == "" or word == nil then - return - end - if word:find("_") then - return M.camel_case_c(word) - else - return M.camel_case_u(word) - end + if word == "" or word == nil then + return + end + if word:find("_") then + return M.camel_case_c(word) + else + return M.camel_case_u(word) + end end M.camel_case_u = function(word) - local result = {} - local len = word:len() - local i = 1 - local f = true - while i <= len do - local c = word:byte(i) - local cs = M.char_size(c) - local cf = f - if cs == nil then - return word - end - if cs == 1 and M.is_upper(c) then - f = false - if cf and i ~= 1 then - table.insert(result, "_") - end - else - f = true - end - local e = i + cs - table.insert(result, word:sub(i, e - 1)) - i = e - end - return table.concat(result, ""):upper() + local result = {} + local len = word:len() + local i = 1 + local f = true + while i <= len do + local c = word:byte(i) + local cs = M.char_size(c) + local cf = f + if cs == nil then + return word + end + if cs == 1 and M.is_upper(c) then + f = false + if cf and i ~= 1 then + table.insert(result, "_") + end + else + f = true + end + local e = i + cs + table.insert(result, word:sub(i, e - 1)) + i = e + end + return table.concat(result, ""):upper() end M.camel_case_c = function(word) - local w = word:lower() - local result = {} - local sc = 95 - local f = false - local len = word:len() - local i = 1 - while i <= len do - local c = w:byte(i) - local cs = M.char_size(c) - local e = i + cs - if cs == nil then - return word - end - local cf = f - if f then - f = false - end - if c == sc then - f = true - else - if cs == 1 and cf then - table.insert(result, string.char(c):upper()) - else - table.insert(result, w:sub(i, e - 1)) - end - end - i = e - end - return table.concat(result, "") + local w = word:lower() + local result = {} + local sc = 95 + local f = false + local len = word:len() + local i = 1 + while i <= len do + local c = w:byte(i) + local cs = M.char_size(c) + local e = i + cs + if cs == nil then + return word + end + local cf = f + if f then + f = false + end + if c == sc then + f = true + else + if cs == 1 and cf then + table.insert(result, string.char(c):upper()) + else + table.insert(result, w:sub(i, e - 1)) + end + end + i = e + end + return table.concat(result, "") end M.camel_case_start = function(r, l1, l2) - local word - if r == 0 then - word = vim.fn.expand("") - local cw = M.camel_case(word) - if cw then - vim.fn.setreg('"', M.camel_case(word)) - end - elseif l1 == l2 then - word = vim.fn.getline(".") - local ln1 = vim.fn.getpos("'<") - local ln2 = vim.fn.getpos("'>") - local cs = ln1[3] - local ce = ln2[3] - local ecs = M.char_size(word:byte(ce)) - if ecs ~= 1 then - ce = ce + ecs - 1 - end - word = word:sub(cs, ce) - local reg_tmp = vim.fn.getreg("a") - vim.fn.setreg("a", M.camel_case(word)) - vim.cmd('normal! gv"ap') - vim.fn.setreg("a", reg_tmp) - else - vim.notify("请选择单行字符", vim.log.levels.WARN) - end + local word + if r == 0 then + word = vim.fn.expand("") + local cw = M.camel_case(word) + if cw then + vim.fn.setreg('"', M.camel_case(word)) + end + elseif l1 == l2 then + word = vim.fn.getline(".") + local ln1 = vim.fn.getpos("'<") + local ln2 = vim.fn.getpos("'>") + local cs = ln1[3] + local ce = ln2[3] + local ecs = M.char_size(word:byte(ce)) + if ecs ~= 1 then + ce = ce + ecs - 1 + end + word = word:sub(cs, ce) + local reg_tmp = vim.fn.getreg("a") + vim.fn.setreg("a", M.camel_case(word)) + vim.cmd('normal! gv"ap') + vim.fn.setreg("a", reg_tmp) + else + vim.notify("请选择单行字符", vim.log.levels.WARN) + end end M.test = function(a) - print(a) + print(a) end M.camel_case_init = function() - vim.cmd([[ + vim.cmd([[ " command! -complete=customlist,coreutils#cmdline#complete -nargs=* -bang -range command! -nargs=* -range \ CamelCase @@ -167,23 +167,23 @@ end -- print(M.camel_case("helloWorldAaAaAxC")) M.get_visual_selection = function() - vim.cmd('noau normal! "vy"') - local text = vim.fn.getreg("v") - vim.fn.setreg("v", {}) + vim.cmd('noau normal! "vy"') + local text = vim.fn.getreg("v") + vim.fn.setreg("v", {}) - text = string.gsub(text, "\n", "") - if #text > 0 then - return text - else - return "" - end + text = string.gsub(text, "\n", "") + if #text > 0 then + return text + else + return "" + end end M.run_cmd = function(cmd) - return vim.fn.system(cmd) + return vim.fn.system(cmd) end M.or_default = function(a, v) - return a and a or v + return a and a or v end return M diff --git a/lua/kide/core/utils/plantuml.lua b/lua/kide/core/utils/plantuml.lua index 0c3a4a37..a8110065 100644 --- a/lua/kide/core/utils/plantuml.lua +++ b/lua/kide/core/utils/plantuml.lua @@ -20,56 +20,56 @@ M.types["latex"] = true M.types["latex:nopreamble"] = true local function to_type(type) - if M.types[type] then - return "-t" .. type - end - return "-t" .. M.config.defaultTo + if M.types[type] then + return "-t" .. type + end + return "-t" .. M.config.defaultTo end local function exec(cmd) - if not vim.fn.filereadable(M.config.jar_path) then - vim.notify("Plantuml: 没有文件 " .. M.config.jar_path, vim.log.levels.ERROR) - return - end - if not vim.fn.executable("java") then - vim.notify("Plantuml: 没有 java 环境", vim.log.levels.ERROR) - return - end - local p = vim.fn.expand("%:p:h") - local res = utils.run_cmd("cd " .. p .. " && " .. cmd) - if vim.fn.trim(res) == "" then - vim.notify("Plantuml: export success", vim.log.levels.INFO) - else - vim.notify("Plantuml: export error, " .. res, vim.log.levels.WARN) - end + if not vim.fn.filereadable(M.config.jar_path) then + vim.notify("Plantuml: 没有文件 " .. M.config.jar_path, vim.log.levels.ERROR) + return + end + if not vim.fn.executable("java") then + vim.notify("Plantuml: 没有 java 环境", vim.log.levels.ERROR) + return + end + local p = vim.fn.expand("%:p:h") + local res = utils.run_cmd("cd " .. p .. " && " .. cmd) + if vim.fn.trim(res) == "" then + vim.notify("Plantuml: export success", vim.log.levels.INFO) + else + vim.notify("Plantuml: export error, " .. res, vim.log.levels.WARN) + end end M.run_export_opt = function(filename, args) - exec(M.config.cmd .. " " .. args .. " " .. filename) + exec(M.config.cmd .. " " .. args .. " " .. filename) end M.run_export_to = function(filename, type) - exec(M.config.cmd .. " " .. to_type(type) .. " " .. filename) + exec(M.config.cmd .. " " .. to_type(type) .. " " .. filename) end local function init() - local group = vim.api.nvim_create_augroup("plantuml_export", { clear = true }) - vim.api.nvim_create_autocmd({ "FileType" }, { - group = group, - pattern = { "puml" }, - desc = "Export Plantuml file", - callback = function(o) - vim.api.nvim_buf_create_user_command(o.buf, "Plantuml", function(opts) - M.run_export_to(vim.fn.expand("%"), opts.args) - end, {}) - end, - }) + local group = vim.api.nvim_create_augroup("plantuml_export", { clear = true }) + vim.api.nvim_create_autocmd({ "FileType" }, { + group = group, + pattern = { "puml" }, + desc = "Export Plantuml file", + callback = function(o) + vim.api.nvim_buf_create_user_command(o.buf, "Plantuml", function(opts) + M.run_export_to(vim.fn.expand("%"), opts.args) + end, {}) + end, + }) end M.setup = function(config) - if config then - M.config = vim.tbl_deep_extend("force", M.config, config) - end - init() + if config then + M.config = vim.tbl_deep_extend("force", M.config, config) + end + init() end return M diff --git a/lua/kide/dap/codelldb.lua b/lua/kide/dap/codelldb.lua index 7f5b8ea1..fc20a2ba 100644 --- a/lua/kide/dap/codelldb.lua +++ b/lua/kide/dap/codelldb.lua @@ -4,76 +4,76 @@ M.config = {} M.config.codelldb_path = extension_path .. "/adapter/codelldb" M.setup = function(config) - if config then - M.config = vim.tbl_deep_extend("force", M.config, config) - end - local dap = require("dap") - dap.adapters.codelldb = function(on_adapter) - -- This asks the system for a free port - local tcp = vim.loop.new_tcp() - tcp:bind("127.0.0.1", 0) - local port = tcp:getsockname().port - tcp:shutdown() - tcp:close() + if config then + M.config = vim.tbl_deep_extend("force", M.config, config) + end + local dap = require("dap") + dap.adapters.codelldb = function(on_adapter) + -- This asks the system for a free port + local tcp = vim.loop.new_tcp() + tcp:bind("127.0.0.1", 0) + local port = tcp:getsockname().port + tcp:shutdown() + tcp:close() - -- Start codelldb with the port - local stdout = vim.loop.new_pipe(false) - local stderr = vim.loop.new_pipe(false) - local opts = { - stdio = { nil, stdout, stderr }, - args = { "--port", tostring(port) }, - } - local handle - local pid_or_err - handle, pid_or_err = vim.loop.spawn(M.config.codelldb_path, opts, function(code) - stdout:close() - stderr:close() - handle:close() - if code ~= 0 then - print("codelldb exited with code", code) - end - end) - if not handle then - vim.notify("Error running codelldb: " .. tostring(pid_or_err), vim.log.levels.ERROR) - stdout:close() - stderr:close() - return - end - vim.notify("codelldb started. pid=" .. pid_or_err) - stderr:read_start(function(err, chunk) - assert(not err, err) - if chunk then - vim.schedule(function() - require("dap.repl").append(chunk) - end) - end - end) - local adapter = { - type = "server", - host = "127.0.0.1", - port = port, - } - -- 💀 - -- Wait for codelldb to get ready and start listening before telling nvim-dap to connect - -- If you get connect errors, try to increase 500 to a higher value, or check the stderr (Open the REPL) - vim.defer_fn(function() - on_adapter(adapter) - end, 500) - end + -- Start codelldb with the port + local stdout = vim.loop.new_pipe(false) + local stderr = vim.loop.new_pipe(false) + local opts = { + stdio = { nil, stdout, stderr }, + args = { "--port", tostring(port) }, + } + local handle + local pid_or_err + handle, pid_or_err = vim.loop.spawn(M.config.codelldb_path, opts, function(code) + stdout:close() + stderr:close() + handle:close() + if code ~= 0 then + print("codelldb exited with code", code) + end + end) + if not handle then + vim.notify("Error running codelldb: " .. tostring(pid_or_err), vim.log.levels.ERROR) + stdout:close() + stderr:close() + return + end + vim.notify("codelldb started. pid=" .. pid_or_err) + stderr:read_start(function(err, chunk) + assert(not err, err) + if chunk then + vim.schedule(function() + require("dap.repl").append(chunk) + end) + end + end) + local adapter = { + type = "server", + host = "127.0.0.1", + port = port, + } + -- 💀 + -- Wait for codelldb to get ready and start listening before telling nvim-dap to connect + -- If you get connect errors, try to increase 500 to a higher value, or check the stderr (Open the REPL) + vim.defer_fn(function() + on_adapter(adapter) + end, 500) + end - dap.configurations.cpp = { - { - name = "Launch file", - type = "codelldb", - request = "launch", - program = function() - return vim.fn.input("Path to executable: ", vim.fn.getcwd() .. "/", "file") - end, - cwd = "${workspaceFolder}", - stopOnEntry = true, - }, - } - dap.configurations.c = dap.configurations.cpp - dap.configurations.rust = dap.configurations.cpp + dap.configurations.cpp = { + { + name = "Launch file", + type = "codelldb", + request = "launch", + program = function() + return vim.fn.input("Path to executable: ", vim.fn.getcwd() .. "/", "file") + end, + cwd = "${workspaceFolder}", + stopOnEntry = true, + }, + } + dap.configurations.c = dap.configurations.cpp + dap.configurations.rust = dap.configurations.cpp end return M diff --git a/lua/kide/lsp/init.lua b/lua/kide/lsp/init.lua index 1f15ab6e..7cdd45b7 100644 --- a/lua/kide/lsp/init.lua +++ b/lua/kide/lsp/init.lua @@ -1,32 +1,32 @@ local lsp_installer = require("nvim-lsp-installer") local lspconfig = require("lspconfig") lsp_installer.setup({ - ensure_installed = { - "sumneko_lua", - "clangd", - "tsserver", - "html", - "pyright", - "rust_analyzer", - "sqls", - "gopls", - }, + ensure_installed = { + "sumneko_lua", + "clangd", + "tsserver", + "html", + "pyright", + "rust_analyzer", + "sqls", + "gopls", + }, }) -- 安装列表 -- https://github.com/williamboman/nvim-lsp-installer#available-lsps -- { key: 语言 value: 配置文件 } local server_configs = { - sumneko_lua = require("kide.lsp.sumneko_lua"), -- /lua/lsp/lua.lua - -- jdtls = require "lsp.java", -- /lua/lsp/jdtls.lua - -- jsonls = require("lsp.jsonls"), - clangd = require("kide.lsp.clangd"), - tsserver = require("kide.lsp.tsserver"), - html = require("kide.lsp.html"), - pyright = require("kide.lsp.pyright"), - rust_analyzer = require("kide.lsp.rust_analyzer"), - sqls = require("kide.lsp.sqls"), - gopls = require("kide.lsp.gopls"), + sumneko_lua = require("kide.lsp.sumneko_lua"), -- /lua/lsp/lua.lua + -- jdtls = require "lsp.java", -- /lua/lsp/jdtls.lua + -- jsonls = require("lsp.jsonls"), + clangd = require("kide.lsp.clangd"), + tsserver = require("kide.lsp.tsserver"), + html = require("kide.lsp.html"), + pyright = require("kide.lsp.pyright"), + rust_analyzer = require("kide.lsp.rust_analyzer"), + sqls = require("kide.lsp.sqls"), + gopls = require("kide.lsp.gopls"), } -- Setup lspconfig. @@ -35,37 +35,37 @@ local capabilities = require("cmp_nvim_lsp").update_capabilities(vim.lsp.protoco -- capabilities.textDocument.completion.completionItem.snippetSupport = true local utils = require("kide.core.utils") for _, server in ipairs(lsp_installer.get_installed_servers()) do - -- tools config - local cfg = utils.or_default(server_configs[server.name], {}) + -- tools config + local cfg = utils.or_default(server_configs[server.name], {}) - -- lspconfig - local scfg = utils.or_default(cfg.server, {}) - scfg = vim.tbl_deep_extend("force", server:get_default_options(), scfg) - local on_attach = scfg.on_attach - scfg.on_attach = function(client, bufnr) - -- 绑定快捷键 - require("kide.core.keybindings").maplsp(client, bufnr) - if on_attach then - on_attach(client, bufnr) - end - end - scfg.flags = { - debounce_text_changes = 150, - } - scfg.capabilities = capabilities - if server.name == "rust_analyzer" then - -- Initialize the LSP via rust-tools instead - cfg.server = scfg - require("rust-tools").setup(cfg) - else - lspconfig[server.name].setup(scfg) - end + -- lspconfig + local scfg = utils.or_default(cfg.server, {}) + scfg = vim.tbl_deep_extend("force", server:get_default_options(), scfg) + local on_attach = scfg.on_attach + scfg.on_attach = function(client, bufnr) + -- 绑定快捷键 + require("kide.core.keybindings").maplsp(client, bufnr) + if on_attach then + on_attach(client, bufnr) + end + end + scfg.flags = { + debounce_text_changes = 150, + } + scfg.capabilities = capabilities + if server.name == "rust_analyzer" then + -- Initialize the LSP via rust-tools instead + cfg.server = scfg + require("rust-tools").setup(cfg) + else + lspconfig[server.name].setup(scfg) + end end -- LSP 相关美化参考 https://github.com/NvChad/NvChad local function lspSymbol(name, icon) - local hl = "DiagnosticSign" .. name - vim.fn.sign_define(hl, { text = icon, numhl = hl, texthl = hl }) + local hl = "DiagnosticSign" .. name + vim.fn.sign_define(hl, { text = icon, numhl = hl, texthl = hl }) end lspSymbol("Error", "") @@ -74,19 +74,19 @@ lspSymbol("Hint", "") lspSymbol("Warn", "") vim.diagnostic.config({ - virtual_text = { - prefix = "", - }, - signs = true, - underline = true, - update_in_insert = false, + virtual_text = { + prefix = "", + }, + signs = true, + underline = true, + update_in_insert = false, }) vim.lsp.handlers["textDocument/hover"] = vim.lsp.with(vim.lsp.handlers.hover, { - border = "single", + border = "single", }) vim.lsp.handlers["textDocument/signatureHelp"] = vim.lsp.with(vim.lsp.handlers.signature_help, { - border = "single", + border = "single", }) -- suppress error messages from lang servers diff --git a/lua/kide/lsp/java.lua b/lua/kide/lsp/java.lua index 7bf8faa1..f9821007 100644 --- a/lua/kide/lsp/java.lua +++ b/lua/kide/lsp/java.lua @@ -1,276 +1,276 @@ local M = {} local env = { - -- HOME = vim.loop.os_homedir(), - JAVA_HOME = os.getenv("JAVA_HOME"), - MAVEN_HOME = os.getenv("MAVEN_HOME"), - MAVEN_SETTINGS = os.getenv("MAVEN_SETTINGS"), - JDTLS_HOME = os.getenv("JDTLS_HOME"), - JDTLS_WORKSPACE = os.getenv("JDTLS_WORKSPACE"), - JDTLS_EXTENSIONS = os.getenv("JDTLS_EXTENSIONS"), - LOMBOK_JAR = os.getenv("LOMBOK_JAR"), + -- HOME = vim.loop.os_homedir(), + JAVA_HOME = os.getenv("JAVA_HOME"), + MAVEN_HOME = os.getenv("MAVEN_HOME"), + MAVEN_SETTINGS = os.getenv("MAVEN_SETTINGS"), + JDTLS_HOME = os.getenv("JDTLS_HOME"), + JDTLS_WORKSPACE = os.getenv("JDTLS_WORKSPACE"), + JDTLS_EXTENSIONS = os.getenv("JDTLS_EXTENSIONS"), + LOMBOK_JAR = os.getenv("LOMBOK_JAR"), } local function or_default(a, v) - return require("kide.core.utils").or_default(a, v) + return require("kide.core.utils").or_default(a, v) end local maven_settings = env.MAVEN_HOME .. "/conf/settings.xml" local function get_maven_settings() - return or_default(env.MAVEN_SETTINGS, maven_settings) + return or_default(env.MAVEN_SETTINGS, maven_settings) end local function get_java_home() - return or_default(env.JAVA_HOME, "/opt/software/java/zulu17.34.19-ca-jdk17.0.3-macosx_aarch64") + return or_default(env.JAVA_HOME, "/opt/software/java/zulu17.34.19-ca-jdk17.0.3-macosx_aarch64") end local function get_java() - return get_java_home() .. "/bin/java" + return get_java_home() .. "/bin/java" end local jdtls_root = "/opt/software/lsp/java/jdt-language-server" local function get_jdtls_home() - return or_default(env.JDTLS_HOME, jdtls_root) + return or_default(env.JDTLS_HOME, jdtls_root) end local function get_jdtls_workspace() - return or_default(env.JDTLS_WORKSPACE, "/Users/luokai/jdtls-workspace/") + return or_default(env.JDTLS_WORKSPACE, "/Users/luokai/jdtls-workspace/") end local function get_lombok_jar() - return or_default(env.LOMBOK_JAR, "/opt/software/lsp/lombok.jar") + return or_default(env.LOMBOK_JAR, "/opt/software/lsp/lombok.jar") end local function get_jdtls_extensions() - return or_default(env.JDTLS_EXTENSIONS, "/opt/software/lsp/java") + return or_default(env.JDTLS_EXTENSIONS, "/opt/software/lsp/java") end M.setup = function() - local project_name = vim.fn.fnamemodify(vim.fn.getcwd(), ":p:h:t") - - local workspace_dir = get_jdtls_workspace() .. project_name - - local jdtls_launcher = vim.fn.glob(get_jdtls_home() .. "/plugins/org.eclipse.equinox.launcher_*.jar") - -- See `:help vim.lsp.start_client` for an overview of the supported `config` options. - local config = { - -- The command that starts the language server - -- See: https://github.com/eclipse/eclipse.jdt.ls#running-from-the-command-line - cmd = { - get_java(), -- or '/path/to/java11_or_newer/bin/java' - "-Declipse.application=org.eclipse.jdt.ls.core.id1", - "-Dosgi.bundles.defaultStartLevel=4", - "-Declipse.product=org.eclipse.jdt.ls.core.product", - -- "-Dosgi.configuration.cascaded=true", - -- "-Dosgi.sharedConfiguration.area=" .. get_jdtls_home() .. "/config_mac", - -- "-Dosgi.sharedConfiguration.area.readOnly=true", - "-Dlog.protocol=true", - "-Dlog.level=ALL", - "-Dsun.zip.disableMemoryMapping=true", - -- "-noverify", - -- '-XX:+UseParallelGC', - -- '-XX:GCTimeRatio=4', - -- '-XX:AdaptiveSizePolicyWeight=90', - -- '-XX:+UseG1GC', - -- '-XX:+UseStringDeduplication', - -- '-Xms512m', + local project_name = vim.fn.fnamemodify(vim.fn.getcwd(), ":p:h:t") + + local workspace_dir = get_jdtls_workspace() .. project_name + + local jdtls_launcher = vim.fn.glob(get_jdtls_home() .. "/plugins/org.eclipse.equinox.launcher_*.jar") + -- See `:help vim.lsp.start_client` for an overview of the supported `config` options. + local config = { + -- The command that starts the language server + -- See: https://github.com/eclipse/eclipse.jdt.ls#running-from-the-command-line + cmd = { + get_java(), -- or '/path/to/java11_or_newer/bin/java' + "-Declipse.application=org.eclipse.jdt.ls.core.id1", + "-Dosgi.bundles.defaultStartLevel=4", + "-Declipse.product=org.eclipse.jdt.ls.core.product", + -- "-Dosgi.configuration.cascaded=true", + -- "-Dosgi.sharedConfiguration.area=" .. get_jdtls_home() .. "/config_mac", + -- "-Dosgi.sharedConfiguration.area.readOnly=true", + "-Dlog.protocol=true", + "-Dlog.level=ALL", + "-Dsun.zip.disableMemoryMapping=true", + -- "-noverify", + -- '-XX:+UseParallelGC', + -- '-XX:GCTimeRatio=4', + -- '-XX:AdaptiveSizePolicyWeight=90', + -- '-XX:+UseG1GC', + -- '-XX:+UseStringDeduplication', + -- '-Xms512m', "-XX:+UseZGC", - "-Xmx4g", - -- "-Xbootclasspath/a:" .. get_lombok_jar(), - "-javaagent:" .. get_lombok_jar(), - "--add-modules=ALL-SYSTEM", - "--add-opens", - "java.base/java.util=ALL-UNNAMED", - "--add-opens", - "java.base/java.lang=ALL-UNNAMED", - "-jar", - jdtls_launcher, - "-configuration", - get_jdtls_home() .. "/config_mac", - "-data", - workspace_dir, - }, - filetypes = { "java" }, - - -- 💀 - -- This is the default if not provided, you can remove it. Or adjust as needed. - -- One dedicated LSP server & client will be started per unique root_dir - root_dir = require("jdtls.setup").find_root({ ".git", "mvnw", "gradlew" }), - - -- Here you can configure eclipse.jdt.ls specific settings - -- See https://github.com/eclipse/eclipse.jdt.ls/wiki/Running-the-JAVA-LS-server-from-the-command-line#initialize-request - -- for a list of options - settings = { - java = { - home = get_java_home(), - project = { - resourceFilters = { - "node_modules", - ".git", - ".idea", - }, - }, - import = { - exclusions = { - "**/node_modules/**", - "**/.metadata/**", - "**/archetype-resources/**", - "**/META-INF/maven/**", - "**/.git/**", - "**/.idea/**", - }, - }, - -- referenceCodeLens = { enabled = true }, - -- implementationsCodeLens = { enabled = true }, - templates = { - fileHeader = { - "/**", - " * ${type_name}", - " * @author ${user}", - " */", - }, - typeComment = { - "/**", - " * ${type_name}", - " * @author ${user}", - " */", - }, - }, - eclipse = { - downloadSources = true, - }, - server = { - launchMode = "Hybrid", - }, - maven = { - downloadSources = true, - updateSnapshots = true, - }, - signatureHelp = { enabled = true }, - contentProvider = { preferred = "fernflower" }, - completion = { - favoriteStaticMembers = { - "org.hamcrest.MatcherAssert.assertThat", - "org.hamcrest.Matchers.*", - "org.hamcrest.CoreMatchers.*", - "org.junit.jupiter.api.Assertions.*", - "java.util.Objects.requireNonNull", - "java.util.Objects.requireNonNullElse", - "org.mockito.Mockito.*", - }, - filteredTypes = { - "com.sun.*", - "io.micrometer.shaded.*", - "java.awt.*", - "jdk.*", - "sun.*", - }, - }, - sources = { - organizeImports = { - starThreshold = 9999, - staticStarThreshold = 9999, - }, - }, - configuration = { - maven = { - -- userSettings = "/opt/software/apache-maven-3.6.3/conf/settings.xml", - -- globalSettings = "/opt/software/apache-maven-3.6.3/conf/settings.xml", - userSettings = get_maven_settings(), - globalSettings = get_maven_settings(), - }, - runtimes = { - { - name = "JavaSE-1.8", - path = "/opt/software/java/zulu8.62.0.19-ca-jdk8.0.332-macosx_aarch64", - default = true, - }, - { - name = "JavaSE-11", - path = "/opt/software/java/zulu11.56.19-ca-jdk11.0.15-macosx_aarch64", - }, - { - name = "JavaSE-17", - path = "/opt/software/java/graalvm-ce-java17-22.1.0/Contents/Home", - }, - }, - }, - }, - }, - - -- Language server `initializationOptions` - -- You need to extend the `bundles` with paths to jar files - -- if you want to use additional eclipse.jdt.ls plugins. - -- - -- See https://github.com/mfussenegger/nvim-jdtls#java-debug-installation - -- - -- If you don't plan on using the debugger or other eclipse.jdt.ls plugins you can remove this - -- init_options = { - -- bundles = { - -- vim.fn.glob("/opt/software/lsp/java/java-debug/com.microsoft.java.debug.plugin/target/com.microsoft.java.debug.plugin-0.35.0.jar") - -- }, - -- workspace = workspace_dir - -- }, - } - - -- This bundles definition is the same as in the previous section (java-debug installation) - local bundles = { - vim.fn.glob( - get_jdtls_extensions() - .. "/java-debug/com.microsoft.java.debug.plugin/target/com.microsoft.java.debug.plugin-*.jar" - ), - } - - -- /opt/software/lsp/java/vscode-java-test/server - -- vim.list_extend(bundles, vim.split(vim.fn.glob("/opt/software/lsp/java/vscode-java-test/server/*.jar"), "\n")); - for _, bundle in ipairs(vim.split(vim.fn.glob(get_jdtls_extensions() .. "/vscode-java-test/server/*.jar"), "\n")) do - if not vim.endswith(bundle, "com.microsoft.java.test.runner-jar-with-dependencies.jar") then - table.insert(bundles, bundle) - end - end - - -- /opt/software/lsp/java/vscode-java-decompiler/server/ - vim.list_extend( - bundles, - vim.split(vim.fn.glob(get_jdtls_extensions() .. "/vscode-java-decompiler/server/*.jar"), "\n") - ) - - -- /opt/software/lsp/java/vscode-java-dependency/jdtls.ext/ - -- vim.list_extend(bundles, vim.split(vim.fn.glob("/opt/software/lsp/java/vscode-java-dependency/jdtls.ext/com.microsoft.jdtls.ext.core/target/com.microsoft.jdtls.ext.core-*.jar"), "\n")); - - local jdtls = require("jdtls") - - local extendedClientCapabilities = jdtls.extendedClientCapabilities - extendedClientCapabilities.resolveAdditionalTextEditsSupport = true - - config["init_options"] = { - bundles = bundles, - extendedClientCapabilities = extendedClientCapabilities, - } - - config["on_attach"] = function(client, bufnr) - -- With `hotcodereplace = 'auto' the debug adapter will try to apply code changes - -- you make during a debug session immediately. - -- Remove the option if you do not want that. - require("jdtls").setup_dap({ hotcodereplace = "auto" }) - require("jdtls.setup").add_commands() - require("kide.core.keybindings").maplsp(client, bufnr) - -- require('jdtls.dap').setup_dap_main_class_configs({ verbose = true }) - end - - local capabilities = require("cmp_nvim_lsp").update_capabilities(vim.lsp.protocol.make_client_capabilities()) - -- capabilities.experimental = { - -- hoverActions = true, - -- hoverRange = true, - -- serverStatusNotification = true, - -- snippetTextEdit = true, - -- codeActionGroup = true, - -- ssr = true, - -- } - - config.capabilities = capabilities - - jdtls.start_or_attach(config) - - vim.cmd([[ + "-Xmx4g", + -- "-Xbootclasspath/a:" .. get_lombok_jar(), + "-javaagent:" .. get_lombok_jar(), + "--add-modules=ALL-SYSTEM", + "--add-opens", + "java.base/java.util=ALL-UNNAMED", + "--add-opens", + "java.base/java.lang=ALL-UNNAMED", + "-jar", + jdtls_launcher, + "-configuration", + get_jdtls_home() .. "/config_mac", + "-data", + workspace_dir, + }, + filetypes = { "java" }, + + -- 💀 + -- This is the default if not provided, you can remove it. Or adjust as needed. + -- One dedicated LSP server & client will be started per unique root_dir + root_dir = require("jdtls.setup").find_root({ ".git", "mvnw", "gradlew" }), + + -- Here you can configure eclipse.jdt.ls specific settings + -- See https://github.com/eclipse/eclipse.jdt.ls/wiki/Running-the-JAVA-LS-server-from-the-command-line#initialize-request + -- for a list of options + settings = { + java = { + home = get_java_home(), + project = { + resourceFilters = { + "node_modules", + ".git", + ".idea", + }, + }, + import = { + exclusions = { + "**/node_modules/**", + "**/.metadata/**", + "**/archetype-resources/**", + "**/META-INF/maven/**", + "**/.git/**", + "**/.idea/**", + }, + }, + -- referenceCodeLens = { enabled = true }, + -- implementationsCodeLens = { enabled = true }, + templates = { + fileHeader = { + "/**", + " * ${type_name}", + " * @author ${user}", + " */", + }, + typeComment = { + "/**", + " * ${type_name}", + " * @author ${user}", + " */", + }, + }, + eclipse = { + downloadSources = true, + }, + server = { + launchMode = "Hybrid", + }, + maven = { + downloadSources = true, + updateSnapshots = true, + }, + signatureHelp = { enabled = true }, + contentProvider = { preferred = "fernflower" }, + completion = { + favoriteStaticMembers = { + "org.hamcrest.MatcherAssert.assertThat", + "org.hamcrest.Matchers.*", + "org.hamcrest.CoreMatchers.*", + "org.junit.jupiter.api.Assertions.*", + "java.util.Objects.requireNonNull", + "java.util.Objects.requireNonNullElse", + "org.mockito.Mockito.*", + }, + filteredTypes = { + "com.sun.*", + "io.micrometer.shaded.*", + "java.awt.*", + "jdk.*", + "sun.*", + }, + }, + sources = { + organizeImports = { + starThreshold = 9999, + staticStarThreshold = 9999, + }, + }, + configuration = { + maven = { + -- userSettings = "/opt/software/apache-maven-3.6.3/conf/settings.xml", + -- globalSettings = "/opt/software/apache-maven-3.6.3/conf/settings.xml", + userSettings = get_maven_settings(), + globalSettings = get_maven_settings(), + }, + runtimes = { + { + name = "JavaSE-1.8", + path = "/opt/software/java/zulu8.62.0.19-ca-jdk8.0.332-macosx_aarch64", + default = true, + }, + { + name = "JavaSE-11", + path = "/opt/software/java/zulu11.56.19-ca-jdk11.0.15-macosx_aarch64", + }, + { + name = "JavaSE-17", + path = "/opt/software/java/graalvm-ce-java17-22.1.0/Contents/Home", + }, + }, + }, + }, + }, + + -- Language server `initializationOptions` + -- You need to extend the `bundles` with paths to jar files + -- if you want to use additional eclipse.jdt.ls plugins. + -- + -- See https://github.com/mfussenegger/nvim-jdtls#java-debug-installation + -- + -- If you don't plan on using the debugger or other eclipse.jdt.ls plugins you can remove this + -- init_options = { + -- bundles = { + -- vim.fn.glob("/opt/software/lsp/java/java-debug/com.microsoft.java.debug.plugin/target/com.microsoft.java.debug.plugin-0.35.0.jar") + -- }, + -- workspace = workspace_dir + -- }, + } + + -- This bundles definition is the same as in the previous section (java-debug installation) + local bundles = { + vim.fn.glob( + get_jdtls_extensions() + .. "/java-debug/com.microsoft.java.debug.plugin/target/com.microsoft.java.debug.plugin-*.jar" + ), + } + + -- /opt/software/lsp/java/vscode-java-test/server + -- vim.list_extend(bundles, vim.split(vim.fn.glob("/opt/software/lsp/java/vscode-java-test/server/*.jar"), "\n")); + for _, bundle in ipairs(vim.split(vim.fn.glob(get_jdtls_extensions() .. "/vscode-java-test/server/*.jar"), "\n")) do + if not vim.endswith(bundle, "com.microsoft.java.test.runner-jar-with-dependencies.jar") then + table.insert(bundles, bundle) + end + end + + -- /opt/software/lsp/java/vscode-java-decompiler/server/ + vim.list_extend( + bundles, + vim.split(vim.fn.glob(get_jdtls_extensions() .. "/vscode-java-decompiler/server/*.jar"), "\n") + ) + + -- /opt/software/lsp/java/vscode-java-dependency/jdtls.ext/ + -- vim.list_extend(bundles, vim.split(vim.fn.glob("/opt/software/lsp/java/vscode-java-dependency/jdtls.ext/com.microsoft.jdtls.ext.core/target/com.microsoft.jdtls.ext.core-*.jar"), "\n")); + + local jdtls = require("jdtls") + + local extendedClientCapabilities = jdtls.extendedClientCapabilities + extendedClientCapabilities.resolveAdditionalTextEditsSupport = true + + config["init_options"] = { + bundles = bundles, + extendedClientCapabilities = extendedClientCapabilities, + } + + config["on_attach"] = function(client, bufnr) + -- With `hotcodereplace = 'auto' the debug adapter will try to apply code changes + -- you make during a debug session immediately. + -- Remove the option if you do not want that. + require("jdtls").setup_dap({ hotcodereplace = "auto" }) + require("jdtls.setup").add_commands() + require("kide.core.keybindings").maplsp(client, bufnr) + -- require('jdtls.dap').setup_dap_main_class_configs({ verbose = true }) + end + + local capabilities = require("cmp_nvim_lsp").update_capabilities(vim.lsp.protocol.make_client_capabilities()) + -- capabilities.experimental = { + -- hoverActions = true, + -- hoverRange = true, + -- serverStatusNotification = true, + -- snippetTextEdit = true, + -- codeActionGroup = true, + -- ssr = true, + -- } + + config.capabilities = capabilities + + jdtls.start_or_attach(config) + + vim.cmd([[ command! -nargs=0 OR :lua require'jdtls'.organize_imports() nnoremap crv lua require('jdtls').extract_variable() vnoremap crv lua require('jdtls').extract_variable(true) diff --git a/lua/kide/lsp/pyright.lua b/lua/kide/lsp/pyright.lua index 64aea068..491ffe6f 100644 --- a/lua/kide/lsp/pyright.lua +++ b/lua/kide/lsp/pyright.lua @@ -1,16 +1,16 @@ return { - server = { - organize_imports = function() - local params = { - command = "pyright.organizeimports", - arguments = { vim.uri_from_bufnr(0) }, - } - vim.lsp.buf.execute_command(params) - end, - on_attach = function(_, _) - vim.cmd([[ + server = { + organize_imports = function() + local params = { + command = "pyright.organizeimports", + arguments = { vim.uri_from_bufnr(0) }, + } + vim.lsp.buf.execute_command(params) + end, + on_attach = function(_, _) + vim.cmd([[ command! -nargs=0 OR :lua require'lsp.pyright'.organize_imports() ]]) - end, - }, + end, + }, } diff --git a/lua/kide/lsp/rust_analyzer.lua b/lua/kide/lsp/rust_analyzer.lua index 6ec824b6..2d3eb4b5 100644 --- a/lua/kide/lsp/rust_analyzer.lua +++ b/lua/kide/lsp/rust_analyzer.lua @@ -4,22 +4,22 @@ local codelldb_path = extension_path .. "adapter/codelldb" local liblldb_path = extension_path .. "lldb/lib/liblldb.dylib" return { - dap = { - adapter = require("rust-tools.dap").get_codelldb_adapter(codelldb_path, liblldb_path), - }, - server = { - standalone = false, - settings = { - ["rust-analyzer"] = { - completion = { - postfix = { - enable = false, - }, - }, - checkOnSave = { - command = "clippy", - }, - }, - }, - }, + dap = { + adapter = require("rust-tools.dap").get_codelldb_adapter(codelldb_path, liblldb_path), + }, + server = { + standalone = false, + settings = { + ["rust-analyzer"] = { + completion = { + postfix = { + enable = false, + }, + }, + checkOnSave = { + command = "clippy", + }, + }, + }, + }, } diff --git a/lua/kide/lsp/sqls.lua b/lua/kide/lsp/sqls.lua index 41f17bdc..dc935810 100644 --- a/lua/kide/lsp/sqls.lua +++ b/lua/kide/lsp/sqls.lua @@ -1,8 +1,8 @@ vim.g.sql_type_default = "mysql" return { - server = { - on_attach = function(client, bufnr) - require("sqls").on_attach(client, bufnr) - end, - }, + server = { + on_attach = function(client, bufnr) + require("sqls").on_attach(client, bufnr) + end, + }, } diff --git a/lua/kide/lsp/sumneko_lua.lua b/lua/kide/lsp/sumneko_lua.lua index f2053901..ee61bebc 100644 --- a/lua/kide/lsp/sumneko_lua.lua +++ b/lua/kide/lsp/sumneko_lua.lua @@ -2,28 +2,28 @@ local runtime_path = vim.split(package.path, ";") table.insert(runtime_path, "lua/?.lua") table.insert(runtime_path, "lua/?/init.lua") return { - server = { - settings = { - Lua = { - runtime = { - -- Tell the language server which version of Lua you're using (most likely LuaJIT in the case of Neovim) - version = "LuaJIT", - -- Setup your lua path - path = runtime_path, - }, - diagnostics = { - -- Get the language server to recognize the `vim` global - globals = { "vim" }, - }, - workspace = { - -- Make the server aware of Neovim runtime files - library = vim.api.nvim_get_runtime_file("", true), - }, - -- Do not send telemetry data containing a randomized but unique identifier - telemetry = { - enable = false, - }, - }, - }, - }, + server = { + settings = { + Lua = { + runtime = { + -- Tell the language server which version of Lua you're using (most likely LuaJIT in the case of Neovim) + version = "LuaJIT", + -- Setup your lua path + path = runtime_path, + }, + diagnostics = { + -- Get the language server to recognize the `vim` global + globals = { "vim" }, + }, + workspace = { + -- Make the server aware of Neovim runtime files + library = vim.api.nvim_get_runtime_file("", true), + }, + -- Do not send telemetry data containing a randomized but unique identifier + telemetry = { + enable = false, + }, + }, + }, + }, } diff --git a/lua/kide/lsp/utils/init.lua b/lua/kide/lsp/utils/init.lua index ee38c15d..f3ce805b 100644 --- a/lua/kide/lsp/utils/init.lua +++ b/lua/kide/lsp/utils/init.lua @@ -1,16 +1,16 @@ local M = {} M.format_range_operator = function() - local old_func = vim.go.operatorfunc - _G.op_func_formatting = function() - local start = vim.api.nvim_buf_get_mark(0, "[") - local finish = vim.api.nvim_buf_get_mark(0, "]") - vim.lsp.buf.range_formatting({}, start, finish) - vim.go.operatorfunc = old_func - _G.op_func_formatting = nil - end - vim.go.operatorfunc = "v:lua.op_func_formatting" - vim.api.nvim_feedkeys("g@", "n", false) + local old_func = vim.go.operatorfunc + _G.op_func_formatting = function() + local start = vim.api.nvim_buf_get_mark(0, "[") + local finish = vim.api.nvim_buf_get_mark(0, "]") + vim.lsp.buf.range_formatting({}, start, finish) + vim.go.operatorfunc = old_func + _G.op_func_formatting = nil + end + vim.go.operatorfunc = "v:lua.op_func_formatting" + vim.api.nvim_feedkeys("g@", "n", false) end -- 指定格式化 lsp_client @@ -53,9 +53,9 @@ format_lsp_mapping["rust"] = "null-ls" format_lsp_mapping["http"] = "null-ls" M.filter_format_lsp_client = function(client, bufnr) - local filetype = vim.api.nvim_buf_get_option(bufnr, "filetype") - local cn = format_lsp_mapping[filetype] - return client.name == cn + local filetype = vim.api.nvim_buf_get_option(bufnr, "filetype") + local cn = format_lsp_mapping[filetype] + return client.name == cn end return M diff --git a/lua/kide/plugins/config/aerial.lua b/lua/kide/plugins/config/aerial.lua index 378673f9..2ee401c0 100644 --- a/lua/kide/plugins/config/aerial.lua +++ b/lua/kide/plugins/config/aerial.lua @@ -1,242 +1,242 @@ -- Call the setup function to change the default behavior require("aerial").setup({ - -- Priority list of preferred backends for aerial. - -- This can be a filetype map (see :help aerial-filetype-map) - backends = { "treesitter", "lsp", "markdown" }, - - -- Enum: persist, close, auto, global - -- persist - aerial window will stay open until closed - -- close - aerial window will close when original file is no longer visible - -- auto - aerial window will stay open as long as there is a visible - -- buffer to attach to - -- global - same as 'persist', and will always show symbols for the current buffer - close_behavior = "auto", - - -- Set to false to remove the default keybindings for the aerial buffer - default_bindings = true, - - -- Enum: prefer_right, prefer_left, right, left, float - -- Determines the default direction to open the aerial window. The 'prefer' - -- options will open the window in the other direction *if* there is a - -- different buffer in the way of the preferred direction - default_direction = "prefer_right", - - -- Disable aerial on files with this many lines - disable_max_lines = 10000, - - -- Disable aerial on files this size or larger (in bytes) - disable_max_size = 2000000, -- Default 2MB - - -- A list of all symbols to display. Set to false to display all symbols. - -- This can be a filetype map (see :help aerial-filetype-map) - -- To see all available values, see :help SymbolKind - filter_kind = { - "Array", - "Boolean", - "Class", - "Constant", - "Constructor", - "Enum", - "EnumMember", - "Event", - "Field", - "File", - "Function", - "Interface", - "Key", - "Method", - "Module", - "Namespace", - "Null", - "Number", - "Object", - "Operator", - "Package", - "Property", - "String", - "Struct", - "TypeParameter", - "Variable", - }, - - -- Enum: split_width, full_width, last, none - -- Determines line highlighting mode when multiple splits are visible. - -- split_width Each open window will have its cursor location marked in the - -- aerial buffer. Each line will only be partially highlighted - -- to indicate which window is at that location. - -- full_width Each open window will have its cursor location marked as a - -- full-width highlight in the aerial buffer. - -- last Only the most-recently focused window will have its location - -- marked in the aerial buffer. - -- none Do not show the cursor locations in the aerial window. - highlight_mode = "split_width", - - -- Highlight the closest symbol if the cursor is not exactly on one. - highlight_closest = true, - - -- Highlight the symbol in the source buffer when cursor is in the aerial win - highlight_on_hover = false, - - -- When jumping to a symbol, highlight the line for this many ms. - -- Set to false to disable - highlight_on_jump = 300, - - -- Define symbol icons. You can also specify "Collapsed" to change the - -- icon when the tree is collapsed at that symbol, or "Collapsed" to specify a - -- default collapsed icon. The default icon set is determined by the - -- "nerd_font" option below. - -- If you have lspkind-nvim installed, it will be the default icon set. - -- This can be a filetype map (see :help aerial-filetype-map) - icons = {}, - - -- Control which windows and buffers aerial should ignore. - -- If close_behavior is "global", focusing an ignored window/buffer will - -- not cause the aerial window to update. - -- If open_automatic is true, focusing an ignored window/buffer will not - -- cause an aerial window to open. - -- If open_automatic is a function, ignore rules have no effect on aerial - -- window opening behavior; it's entirely handled by the open_automatic - -- function. - ignore = { - -- Ignore unlisted buffers. See :help buflisted - unlisted_buffers = true, - - -- List of filetypes to ignore. - filetypes = {}, - - -- Ignored buftypes. - -- Can be one of the following: - -- false or nil - No buftypes are ignored. - -- "special" - All buffers other than normal buffers are ignored. - -- table - A list of buftypes to ignore. See :help buftype for the - -- possible values. - -- function - A function that returns true if the buffer should be - -- ignored or false if it should not be ignored. - -- Takes two arguments, `bufnr` and `buftype`. - buftypes = "special", - - -- Ignored wintypes. - -- Can be one of the following: - -- false or nil - No wintypes are ignored. - -- "special" - All windows other than normal windows are ignored. - -- table - A list of wintypes to ignore. See :help win_gettype() for the - -- possible values. - -- function - A function that returns true if the window should be - -- ignored or false if it should not be ignored. - -- Takes two arguments, `winid` and `wintype`. - wintypes = "special", - }, - - -- When you fold code with za, zo, or zc, update the aerial tree as well. - -- Only works when manage_folds = true - link_folds_to_tree = false, - - -- Fold code when you open/collapse symbols in the tree. - -- Only works when manage_folds = true - link_tree_to_folds = true, - - -- Use symbol tree for folding. Set to true or false to enable/disable - -- 'auto' will manage folds if your previous foldmethod was 'manual' - manage_folds = false, - - -- These control the width of the aerial window. - -- They can be integers or a float between 0 and 1 (e.g. 0.4 for 40%) - -- min_width and max_width can be a list of mixed types. - -- max_width = {40, 0.2} means "the lesser of 40 columns or 20% of total" - max_width = { 40, 0.2 }, - width = nil, - min_width = 32, - - -- Set default symbol icons to use patched font icons (see https://www.nerdfonts.com/) - -- "auto" will set it to true if nvim-web-devicons or lspkind-nvim is installed. - nerd_font = "true", - - -- Call this function when aerial attaches to a buffer. - -- Useful for setting keymaps. Takes a single `bufnr` argument. - on_attach = nil, - - -- Call this function when aerial first sets symbols on a buffer. - -- Takes a single `bufnr` argument. - on_first_symbols = nil, - - -- Automatically open aerial when entering supported buffers. - -- This can be a function (see :help aerial-open-automatic) - open_automatic = false, - - -- Set to true to only open aerial at the far right/left of the editor - -- Default behavior opens aerial relative to current window - placement_editor_edge = false, - - -- Run this command after jumping to a symbol (false will disable) - post_jump_cmd = "normal! zz", - - -- When true, aerial will automatically close after jumping to a symbol - close_on_select = false, - - -- Show box drawing characters for the tree hierarchy - show_guides = false, - - -- The autocmds that trigger symbols update (not used for LSP backend) - update_events = "TextChanged,InsertLeave", - - -- Customize the characters used when show_guides = true - guides = { - -- When the child item has a sibling below it - mid_item = "├─", - -- When the child item is the last in the list - last_item = "└─", - -- When there are nested child guides to the right - nested_top = "│ ", - -- Raw indentation - whitespace = " ", - }, - - -- Options for opening aerial in a floating win - float = { - -- Controls border appearance. Passed to nvim_open_win - border = "rounded", - - -- Enum: cursor, editor, win - -- cursor - Opens float on top of the cursor - -- editor - Opens float centered in the editor - -- win - Opens float centered in the window - relative = "cursor", - - -- These control the height of the floating window. - -- They can be integers or a float between 0 and 1 (e.g. 0.4 for 40%) - -- min_height and max_height can be a list of mixed types. - -- min_height = {8, 0.1} means "the greater of 8 rows or 10% of total" - max_height = 0.9, - height = nil, - min_height = { 8, 0.1 }, - - override = function(conf) - -- This is the config that will be passed to nvim_open_win. - -- Change values here to customize the layout - return conf - end, - }, - - lsp = { - -- Fetch document symbols when LSP diagnostics update. - -- If false, will update on buffer changes. - diagnostics_trigger_update = true, - - -- Set to false to not update the symbols when there are LSP errors - update_when_errors = true, - - -- How long to wait (in ms) after a buffer change before updating - -- Only used when diagnostics_trigger_update = false - update_delay = 300, - }, - - treesitter = { - -- How long to wait (in ms) after a buffer change before updating - update_delay = 300, - }, - - markdown = { - -- How long to wait (in ms) after a buffer change before updating - update_delay = 300, - }, + -- Priority list of preferred backends for aerial. + -- This can be a filetype map (see :help aerial-filetype-map) + backends = { "treesitter", "lsp", "markdown" }, + + -- Enum: persist, close, auto, global + -- persist - aerial window will stay open until closed + -- close - aerial window will close when original file is no longer visible + -- auto - aerial window will stay open as long as there is a visible + -- buffer to attach to + -- global - same as 'persist', and will always show symbols for the current buffer + close_behavior = "auto", + + -- Set to false to remove the default keybindings for the aerial buffer + default_bindings = true, + + -- Enum: prefer_right, prefer_left, right, left, float + -- Determines the default direction to open the aerial window. The 'prefer' + -- options will open the window in the other direction *if* there is a + -- different buffer in the way of the preferred direction + default_direction = "prefer_right", + + -- Disable aerial on files with this many lines + disable_max_lines = 10000, + + -- Disable aerial on files this size or larger (in bytes) + disable_max_size = 2000000, -- Default 2MB + + -- A list of all symbols to display. Set to false to display all symbols. + -- This can be a filetype map (see :help aerial-filetype-map) + -- To see all available values, see :help SymbolKind + filter_kind = { + "Array", + "Boolean", + "Class", + "Constant", + "Constructor", + "Enum", + "EnumMember", + "Event", + "Field", + "File", + "Function", + "Interface", + "Key", + "Method", + "Module", + "Namespace", + "Null", + "Number", + "Object", + "Operator", + "Package", + "Property", + "String", + "Struct", + "TypeParameter", + "Variable", + }, + + -- Enum: split_width, full_width, last, none + -- Determines line highlighting mode when multiple splits are visible. + -- split_width Each open window will have its cursor location marked in the + -- aerial buffer. Each line will only be partially highlighted + -- to indicate which window is at that location. + -- full_width Each open window will have its cursor location marked as a + -- full-width highlight in the aerial buffer. + -- last Only the most-recently focused window will have its location + -- marked in the aerial buffer. + -- none Do not show the cursor locations in the aerial window. + highlight_mode = "split_width", + + -- Highlight the closest symbol if the cursor is not exactly on one. + highlight_closest = true, + + -- Highlight the symbol in the source buffer when cursor is in the aerial win + highlight_on_hover = false, + + -- When jumping to a symbol, highlight the line for this many ms. + -- Set to false to disable + highlight_on_jump = 300, + + -- Define symbol icons. You can also specify "Collapsed" to change the + -- icon when the tree is collapsed at that symbol, or "Collapsed" to specify a + -- default collapsed icon. The default icon set is determined by the + -- "nerd_font" option below. + -- If you have lspkind-nvim installed, it will be the default icon set. + -- This can be a filetype map (see :help aerial-filetype-map) + icons = {}, + + -- Control which windows and buffers aerial should ignore. + -- If close_behavior is "global", focusing an ignored window/buffer will + -- not cause the aerial window to update. + -- If open_automatic is true, focusing an ignored window/buffer will not + -- cause an aerial window to open. + -- If open_automatic is a function, ignore rules have no effect on aerial + -- window opening behavior; it's entirely handled by the open_automatic + -- function. + ignore = { + -- Ignore unlisted buffers. See :help buflisted + unlisted_buffers = true, + + -- List of filetypes to ignore. + filetypes = {}, + + -- Ignored buftypes. + -- Can be one of the following: + -- false or nil - No buftypes are ignored. + -- "special" - All buffers other than normal buffers are ignored. + -- table - A list of buftypes to ignore. See :help buftype for the + -- possible values. + -- function - A function that returns true if the buffer should be + -- ignored or false if it should not be ignored. + -- Takes two arguments, `bufnr` and `buftype`. + buftypes = "special", + + -- Ignored wintypes. + -- Can be one of the following: + -- false or nil - No wintypes are ignored. + -- "special" - All windows other than normal windows are ignored. + -- table - A list of wintypes to ignore. See :help win_gettype() for the + -- possible values. + -- function - A function that returns true if the window should be + -- ignored or false if it should not be ignored. + -- Takes two arguments, `winid` and `wintype`. + wintypes = "special", + }, + + -- When you fold code with za, zo, or zc, update the aerial tree as well. + -- Only works when manage_folds = true + link_folds_to_tree = false, + + -- Fold code when you open/collapse symbols in the tree. + -- Only works when manage_folds = true + link_tree_to_folds = true, + + -- Use symbol tree for folding. Set to true or false to enable/disable + -- 'auto' will manage folds if your previous foldmethod was 'manual' + manage_folds = false, + + -- These control the width of the aerial window. + -- They can be integers or a float between 0 and 1 (e.g. 0.4 for 40%) + -- min_width and max_width can be a list of mixed types. + -- max_width = {40, 0.2} means "the lesser of 40 columns or 20% of total" + max_width = { 40, 0.2 }, + width = nil, + min_width = 32, + + -- Set default symbol icons to use patched font icons (see https://www.nerdfonts.com/) + -- "auto" will set it to true if nvim-web-devicons or lspkind-nvim is installed. + nerd_font = "true", + + -- Call this function when aerial attaches to a buffer. + -- Useful for setting keymaps. Takes a single `bufnr` argument. + on_attach = nil, + + -- Call this function when aerial first sets symbols on a buffer. + -- Takes a single `bufnr` argument. + on_first_symbols = nil, + + -- Automatically open aerial when entering supported buffers. + -- This can be a function (see :help aerial-open-automatic) + open_automatic = false, + + -- Set to true to only open aerial at the far right/left of the editor + -- Default behavior opens aerial relative to current window + placement_editor_edge = false, + + -- Run this command after jumping to a symbol (false will disable) + post_jump_cmd = "normal! zz", + + -- When true, aerial will automatically close after jumping to a symbol + close_on_select = false, + + -- Show box drawing characters for the tree hierarchy + show_guides = false, + + -- The autocmds that trigger symbols update (not used for LSP backend) + update_events = "TextChanged,InsertLeave", + + -- Customize the characters used when show_guides = true + guides = { + -- When the child item has a sibling below it + mid_item = "├─", + -- When the child item is the last in the list + last_item = "└─", + -- When there are nested child guides to the right + nested_top = "│ ", + -- Raw indentation + whitespace = " ", + }, + + -- Options for opening aerial in a floating win + float = { + -- Controls border appearance. Passed to nvim_open_win + border = "rounded", + + -- Enum: cursor, editor, win + -- cursor - Opens float on top of the cursor + -- editor - Opens float centered in the editor + -- win - Opens float centered in the window + relative = "cursor", + + -- These control the height of the floating window. + -- They can be integers or a float between 0 and 1 (e.g. 0.4 for 40%) + -- min_height and max_height can be a list of mixed types. + -- min_height = {8, 0.1} means "the greater of 8 rows or 10% of total" + max_height = 0.9, + height = nil, + min_height = { 8, 0.1 }, + + override = function(conf) + -- This is the config that will be passed to nvim_open_win. + -- Change values here to customize the layout + return conf + end, + }, + + lsp = { + -- Fetch document symbols when LSP diagnostics update. + -- If false, will update on buffer changes. + diagnostics_trigger_update = true, + + -- Set to false to not update the symbols when there are LSP errors + update_when_errors = true, + + -- How long to wait (in ms) after a buffer change before updating + -- Only used when diagnostics_trigger_update = false + update_delay = 300, + }, + + treesitter = { + -- How long to wait (in ms) after a buffer change before updating + update_delay = 300, + }, + + markdown = { + -- How long to wait (in ms) after a buffer change before updating + update_delay = 300, + }, }) diff --git a/lua/kide/plugins/config/alpha-nvim.lua b/lua/kide/plugins/config/alpha-nvim.lua index bb49129b..472a59bd 100644 --- a/lua/kide/plugins/config/alpha-nvim.lua +++ b/lua/kide/plugins/config/alpha-nvim.lua @@ -1,6 +1,6 @@ local alpha = require("alpha") local dashboard = require("alpha.themes.dashboard") -local ascli = require('kide.plugins.config.ascli-header') +local ascli = require("kide.plugins.config.ascli-header") dashboard.leader = "\\" -- Set header @@ -8,12 +8,12 @@ dashboard.section.header.val = ascli[math.random(0, #ascli)] local opt = { noremap = true, silent = true } -- Set menu dashboard.section.buttons.val = { - dashboard.button(" ff", " Find File", ":Telescope find_files", opt), - dashboard.button(" fg", " Find Word ", ":Telescope live_grep", opt), - dashboard.button(" fp", " Recent Projects", ":Telescope projects", opt), - dashboard.button(" fo", " Recent File", ":Telescope oldfiles", opt), - dashboard.button(" es", " Settings", ":e $MYVIMRC | :cd %:p:h ", opt), - dashboard.button(" q ", " Quit NVIM", ":qa", opt), + dashboard.button(" ff", " Find File", ":Telescope find_files", opt), + dashboard.button(" fg", " Find Word ", ":Telescope live_grep", opt), + dashboard.button(" fp", " Recent Projects", ":Telescope projects", opt), + dashboard.button(" fo", " Recent File", ":Telescope oldfiles", opt), + dashboard.button(" es", " Settings", ":e $MYVIMRC | :cd %:p:h ", opt), + dashboard.button(" q ", " Quit NVIM", ":qa", opt), } -- Set footer diff --git a/lua/kide/plugins/config/ascli-header.lua b/lua/kide/plugins/config/ascli-header.lua index 3d334ee2..86acf9df 100644 --- a/lua/kide/plugins/config/ascli-header.lua +++ b/lua/kide/plugins/config/ascli-header.lua @@ -1,685 +1,685 @@ local M = {} M[0] = { - " ▄█ █ █▄ ", - " ▐██ ▄█ ███ █▄ ██▌ ", - " ▐██▌ ██████████████ ▐██▌ ", - " ████ ████████████████ ████ ", - " ▐█████ ██████████████████ █████▌ ", - " ████████████████████████████████ ", - " ███████▀▀████████████▀▀███████ ", - " █████▌ ▄▄ ▀████▀ ▄▄ ▐█████ ", - " ▄▄██████▄ ▀▀ ████ ▀▀ ▄██████▄▄ ", - " ██████████████████████████████████ ", - " ████████████████████████████████████ ", - " ██████ ███████▀▄██▄▀███████ ██████▌ ", - "▐█████ ██████████████████ █████▌ ", - " ▐█████ ██████▀ ▀██████ █████▌ ", - " █████▄ ███ ███ ▄█████ ", - " ██████ █ █ ██████ ", - " █████ █████ ", - " █████ █████ ", - " ████ ▄ ▄ ████ ", - " ████ ██ ██ ████ ", - " ████████ ▄██▄ ████████ ", - " ████████████████████████ ", - " ████████████████████████ ", - " ▀█████████▀▀█████████▀ ", - " ▀███▀ ▀███▀ ", + " ▄█ █ █▄ ", + " ▐██ ▄█ ███ █▄ ██▌ ", + " ▐██▌ ██████████████ ▐██▌ ", + " ████ ████████████████ ████ ", + " ▐█████ ██████████████████ █████▌ ", + " ████████████████████████████████ ", + " ███████▀▀████████████▀▀███████ ", + " █████▌ ▄▄ ▀████▀ ▄▄ ▐█████ ", + " ▄▄██████▄ ▀▀ ████ ▀▀ ▄██████▄▄ ", + " ██████████████████████████████████ ", + " ████████████████████████████████████ ", + " ██████ ███████▀▄██▄▀███████ ██████▌ ", + "▐█████ ██████████████████ █████▌ ", + " ▐█████ ██████▀ ▀██████ █████▌ ", + " █████▄ ███ ███ ▄█████ ", + " ██████ █ █ ██████ ", + " █████ █████ ", + " █████ █████ ", + " ████ ▄ ▄ ████ ", + " ████ ██ ██ ████ ", + " ████████ ▄██▄ ████████ ", + " ████████████████████████ ", + " ████████████████████████ ", + " ▀█████████▀▀█████████▀ ", + " ▀███▀ ▀███▀ ", } M[1] = { - " ███████████████████████████ ", - " ███████▀▀▀░░░░░░░▀▀▀███████ ", - " ████▀░░░░░░░░░░░░░░░░░▀████ ", - " ███│░░░░░░░░░░░░░░░░░░░│███ ", - " ██▌│░░░░░░░░░░░░░░░░░░░│▐██ ", - " ██░└┐░░░░░░░░░░░░░░░░░┌┘░██ ", - " ██░░└┐░░░░░░░░░░░░░░░┌┘░░██ ", - " ██░░┌┘▄▄▄▄▄░░░░░▄▄▄▄▄└┐░░██ ", - " ██▌░│██████▌░░░▐██████│░▐██ ", - " ███░│▐███▀▀░░▄░░▀▀███▌│░███ ", - " ██▀─┘░░░░░░░▐█▌░░░░░░░└─▀██ ", - " ██▄░░░▄▄▄▓░░▀█▀░░▓▄▄▄░░░▄██ ", - " ████▄─┘██▌░░░░░░░▐██└─▄████ ", - " █████░░▐█─┬┬┬┬┬┬┬─█▌░░█████ ", - " ████▌░░░▀┬┼┼┼┼┼┼┼┬▀░░░▐████ ", - " █████▄░░░└┴┴┴┴┴┴┴┘░░░▄█████ ", - " ███████▄░░░░░░░░░░░▄███████ ", - " ██████████▄▄▄▄▄▄▄██████████ ", + " ███████████████████████████ ", + " ███████▀▀▀░░░░░░░▀▀▀███████ ", + " ████▀░░░░░░░░░░░░░░░░░▀████ ", + " ███│░░░░░░░░░░░░░░░░░░░│███ ", + " ██▌│░░░░░░░░░░░░░░░░░░░│▐██ ", + " ██░└┐░░░░░░░░░░░░░░░░░┌┘░██ ", + " ██░░└┐░░░░░░░░░░░░░░░┌┘░░██ ", + " ██░░┌┘▄▄▄▄▄░░░░░▄▄▄▄▄└┐░░██ ", + " ██▌░│██████▌░░░▐██████│░▐██ ", + " ███░│▐███▀▀░░▄░░▀▀███▌│░███ ", + " ██▀─┘░░░░░░░▐█▌░░░░░░░└─▀██ ", + " ██▄░░░▄▄▄▓░░▀█▀░░▓▄▄▄░░░▄██ ", + " ████▄─┘██▌░░░░░░░▐██└─▄████ ", + " █████░░▐█─┬┬┬┬┬┬┬─█▌░░█████ ", + " ████▌░░░▀┬┼┼┼┼┼┼┼┬▀░░░▐████ ", + " █████▄░░░└┴┴┴┴┴┴┴┘░░░▄█████ ", + " ███████▄░░░░░░░░░░░▄███████ ", + " ██████████▄▄▄▄▄▄▄██████████ ", } M[2] = { - " ▄▄▄▄▄███████████████████▄▄▄▄▄ ", - " ▄██████████▀▀▀▀▀▀▀▀▀▀██████▀████▄ ", - " █▀████████▄ ▀▀████ ▀██▄ ", - " █▄▄██████████████████▄▄▄ ▄██▀ ", - " ▀█████████████████████████▄ ▄██▀ ", - " ▀████▀▀▀▀▀▀▀▀▀▀▀▀█████████▄▄██▀ ", - " ▀███▄ ▀██████▀ ", - " ▀██████▄ ▄████▀ ", - " ▀█████▄▄▄▄▄▄▄███▀ ", - " ▀████▀▀▀████▀ ", - " ▀███▄███▀ ", - " ▀█▀ ", + " ▄▄▄▄▄███████████████████▄▄▄▄▄ ", + " ▄██████████▀▀▀▀▀▀▀▀▀▀██████▀████▄ ", + " █▀████████▄ ▀▀████ ▀██▄ ", + " █▄▄██████████████████▄▄▄ ▄██▀ ", + " ▀█████████████████████████▄ ▄██▀ ", + " ▀████▀▀▀▀▀▀▀▀▀▀▀▀█████████▄▄██▀ ", + " ▀███▄ ▀██████▀ ", + " ▀██████▄ ▄████▀ ", + " ▀█████▄▄▄▄▄▄▄███▀ ", + " ▀████▀▀▀████▀ ", + " ▀███▄███▀ ", + " ▀█▀ ", } M[3] = { - " ⠀⠀⠀⠀⠀⠀⠀⡴⠞⠉⢉⣭⣿⣿⠿⣳⣤⠴⠖⠛⣛⣿⣿⡷⠖⣶⣤⡀⠀⠀⠀ ", - " ⠀⠀⠀⠀⠀⠀⠀⣼⠁⢀⣶⢻⡟⠿⠋⣴⠿⢻⣧⡴⠟⠋⠿⠛⠠⠾⢛⣵⣿⠀⠀⠀⠀ ", - " ⣼⣿⡿⢶⣄⠀⢀⡇⢀⡿⠁⠈⠀⠀⣀⣉⣀⠘⣿⠀⠀⣀⣀⠀⠀⠀⠛⡹⠋⠀⠀⠀⠀ ", - " ⣭⣤⡈⢑⣼⣻⣿⣧⡌⠁⠀⢀⣴⠟⠋⠉⠉⠛⣿⣴⠟⠋⠙⠻⣦⡰⣞⠁⢀⣤⣦⣤⠀ ", - " ⠀⠀⣰⢫⣾⠋⣽⠟⠑⠛⢠⡟⠁⠀⠀⠀⠀⠀⠈⢻⡄⠀⠀⠀⠘⣷⡈⠻⣍⠤⢤⣌⣀ ", - " ⢀⡞⣡⡌⠁⠀⠀⠀⠀⢀⣿⠁⠀⠀⠀⠀⠀⠀⠀⠀⢿⡀⠀⠀⠀⠸⣇⠀⢾⣷⢤⣬⣉ ", - " ⡞⣼⣿⣤⣄⠀⠀⠀⠀⢸⡇⠀⠀⠀⠀⠀⠀⠀⠀⠀⢸⡇⠀⠀⠀⠀⣿⠀⠸⣿⣇⠈⠻ ", - " ⢰⣿⡿⢹⠃⠀⣠⠤⠶⣼⡇⠀⠀⠀⠀⠀⠀⠀⠀⠀⢸⡇⠀⠀⠀⠀⣿⠀⠀⣿⠛⡄⠀ ", - " ⠈⠉⠁⠀⠀⠀⡟⡀⠀⠈⡗⠲⠶⠦⢤⣤⣤⣄⣀⣀⣸⣧⣤⣤⠤⠤⣿⣀⡀⠉⣼⡇⠀ ", - " ⣿⣴⣴⡆⠀⠀⠻⣄⠀⠀⠡⠀⠀⠀⠈⠛⠋⠀⠀⠀⡈⠀⠻⠟⠀⢀⠋⠉⠙⢷⡿⡇⠀ ", - " ⣻⡿⠏⠁⠀⠀⢠⡟⠀⠀⠀⠣⡀⠀⠀⠀⠀⠀⢀⣄⠀⠀⠀⠀⢀⠈⠀⢀⣀⡾⣴⠃⠀ ", - " ⢿⠛⠀⠀⠀⠀⢸⠁⠀⠀⠀⠀⠈⠢⠄⣀⠠⠼⣁⠀⡱⠤⠤⠐⠁⠀⠀⣸⠋⢻⡟⠀⠀ ", - " ⠈⢧⣀⣤⣶⡄⠘⣆⠀⠀⠀⠀⠀⠀⠀⢀⣤⠖⠛⠻⣄⠀⠀⠀⢀⣠⡾⠋⢀⡞⠀⠀⠀ ", - " ⠀⠀⠻⣿⣿⡇⠀⠈⠓⢦⣤⣤⣤⡤⠞⠉⠀⠀⠀⠀⠈⠛⠒⠚⢩⡅⣠⡴⠋⠀⠀⠀⠀ ", - " ⠀⠀⠀⠈⠻⢧⣀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠐⣻⠿⠋⠀⠀⠀⠀⠀⠀ ", - " ⠀⠀⠀⠀⠀⠀⠉⠓⠶⣤⣄⣀⡀⠀⠀⠀⠀⠀⢀⣀⣠⡴⠖⠋⠁⠀⠀⠀⠀⠀⠀⠀⠀ ", + " ⠀⠀⠀⠀⠀⠀⠀⡴⠞⠉⢉⣭⣿⣿⠿⣳⣤⠴⠖⠛⣛⣿⣿⡷⠖⣶⣤⡀⠀⠀⠀ ", + " ⠀⠀⠀⠀⠀⠀⠀⣼⠁⢀⣶⢻⡟⠿⠋⣴⠿⢻⣧⡴⠟⠋⠿⠛⠠⠾⢛⣵⣿⠀⠀⠀⠀ ", + " ⣼⣿⡿⢶⣄⠀⢀⡇⢀⡿⠁⠈⠀⠀⣀⣉⣀⠘⣿⠀⠀⣀⣀⠀⠀⠀⠛⡹⠋⠀⠀⠀⠀ ", + " ⣭⣤⡈⢑⣼⣻⣿⣧⡌⠁⠀⢀⣴⠟⠋⠉⠉⠛⣿⣴⠟⠋⠙⠻⣦⡰⣞⠁⢀⣤⣦⣤⠀ ", + " ⠀⠀⣰⢫⣾⠋⣽⠟⠑⠛⢠⡟⠁⠀⠀⠀⠀⠀⠈⢻⡄⠀⠀⠀⠘⣷⡈⠻⣍⠤⢤⣌⣀ ", + " ⢀⡞⣡⡌⠁⠀⠀⠀⠀⢀⣿⠁⠀⠀⠀⠀⠀⠀⠀⠀⢿⡀⠀⠀⠀⠸⣇⠀⢾⣷⢤⣬⣉ ", + " ⡞⣼⣿⣤⣄⠀⠀⠀⠀⢸⡇⠀⠀⠀⠀⠀⠀⠀⠀⠀⢸⡇⠀⠀⠀⠀⣿⠀⠸⣿⣇⠈⠻ ", + " ⢰⣿⡿⢹⠃⠀⣠⠤⠶⣼⡇⠀⠀⠀⠀⠀⠀⠀⠀⠀⢸⡇⠀⠀⠀⠀⣿⠀⠀⣿⠛⡄⠀ ", + " ⠈⠉⠁⠀⠀⠀⡟⡀⠀⠈⡗⠲⠶⠦⢤⣤⣤⣄⣀⣀⣸⣧⣤⣤⠤⠤⣿⣀⡀⠉⣼⡇⠀ ", + " ⣿⣴⣴⡆⠀⠀⠻⣄⠀⠀⠡⠀⠀⠀⠈⠛⠋⠀⠀⠀⡈⠀⠻⠟⠀⢀⠋⠉⠙⢷⡿⡇⠀ ", + " ⣻⡿⠏⠁⠀⠀⢠⡟⠀⠀⠀⠣⡀⠀⠀⠀⠀⠀⢀⣄⠀⠀⠀⠀⢀⠈⠀⢀⣀⡾⣴⠃⠀ ", + " ⢿⠛⠀⠀⠀⠀⢸⠁⠀⠀⠀⠀⠈⠢⠄⣀⠠⠼⣁⠀⡱⠤⠤⠐⠁⠀⠀⣸⠋⢻⡟⠀⠀ ", + " ⠈⢧⣀⣤⣶⡄⠘⣆⠀⠀⠀⠀⠀⠀⠀⢀⣤⠖⠛⠻⣄⠀⠀⠀⢀⣠⡾⠋⢀⡞⠀⠀⠀ ", + " ⠀⠀⠻⣿⣿⡇⠀⠈⠓⢦⣤⣤⣤⡤⠞⠉⠀⠀⠀⠀⠈⠛⠒⠚⢩⡅⣠⡴⠋⠀⠀⠀⠀ ", + " ⠀⠀⠀⠈⠻⢧⣀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠐⣻⠿⠋⠀⠀⠀⠀⠀⠀ ", + " ⠀⠀⠀⠀⠀⠀⠉⠓⠶⣤⣄⣀⡀⠀⠀⠀⠀⠀⢀⣀⣠⡴⠖⠋⠁⠀⠀⠀⠀⠀⠀⠀⠀ ", } M[4] = { - " ⠀⠀⠀⠀⠀⠀⠀⠀⢀⣠⣤⣴⣶⣶⣶⣶⣶⠶⣶⣤⣤⣀⠀⠀⠀⠀⠀⠀ ", - " ⠀⠀⠀⠀⠀⠀⠀⢀⣤⣾⣿⣿⣿⠁⠀⢀⠈⢿⢀⣀⠀⠹⣿⣿⣿⣦⣄⠀⠀⠀ ", - " ⠀⠀⠀⠀⠀⠀⣴⣿⣿⣿⣿⣿⠿⠀⠀⣟⡇⢘⣾⣽⠀⠀⡏⠉⠙⢛⣿⣷⡖⠀ ", - " ⠀⠀⠀⠀⠀⣾⣿⣿⡿⠿⠷⠶⠤⠙⠒⠀⠒⢻⣿⣿⡷⠋⠀⠴⠞⠋⠁⢙⣿⣄ ", - " ⠀⠀⠀⠀⢸⣿⣿⣯⣤⣤⣤⣤⣤⡄⠀⠀⠀⠀⠉⢹⡄⠀⠀⠀⠛⠛⠋⠉⠹⡇ ", - " ⠀⠀⠀⠀⢸⣿⣿⠀⠀⠀⣀⣠⣤⣤⣤⣤⣤⣤⣤⣼⣇⣀⣀⣀⣛⣛⣒⣲⢾⡷ ", - " ⢀⠤⠒⠒⢼⣿⣿⠶⠞⢻⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⡿⠁⠀⣼⠃ ", - " ⢮⠀⠀⠀⠀⣿⣿⣆⠀⠀⠻⣿⡿⠛⠉⠉⠁⠀⠉⠉⠛⠿⣿⣿⠟⠁⠀⣼⠃⠀ ", - " ⠈⠓⠶⣶⣾⣿⣿⣿⣧⡀⠀⠈⠒⢤⣀⣀⡀⠀⠀⣀⣀⡠⠚⠁⠀⢀⡼⠃⠀⠀ ", - " ⠀⠀⠀⠈⢿⣿⣿⣿⣿⣿⣷⣤⣤⣤⣤⣭⣭⣭⣭⣭⣥⣤⣤⣤⣴⣟⠁ ", + " ⠀⠀⠀⠀⠀⠀⠀⠀⢀⣠⣤⣴⣶⣶⣶⣶⣶⠶⣶⣤⣤⣀⠀⠀⠀⠀⠀⠀ ", + " ⠀⠀⠀⠀⠀⠀⠀⢀⣤⣾⣿⣿⣿⠁⠀⢀⠈⢿⢀⣀⠀⠹⣿⣿⣿⣦⣄⠀⠀⠀ ", + " ⠀⠀⠀⠀⠀⠀⣴⣿⣿⣿⣿⣿⠿⠀⠀⣟⡇⢘⣾⣽⠀⠀⡏⠉⠙⢛⣿⣷⡖⠀ ", + " ⠀⠀⠀⠀⠀⣾⣿⣿⡿⠿⠷⠶⠤⠙⠒⠀⠒⢻⣿⣿⡷⠋⠀⠴⠞⠋⠁⢙⣿⣄ ", + " ⠀⠀⠀⠀⢸⣿⣿⣯⣤⣤⣤⣤⣤⡄⠀⠀⠀⠀⠉⢹⡄⠀⠀⠀⠛⠛⠋⠉⠹⡇ ", + " ⠀⠀⠀⠀⢸⣿⣿⠀⠀⠀⣀⣠⣤⣤⣤⣤⣤⣤⣤⣼⣇⣀⣀⣀⣛⣛⣒⣲⢾⡷ ", + " ⢀⠤⠒⠒⢼⣿⣿⠶⠞⢻⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⡿⠁⠀⣼⠃ ", + " ⢮⠀⠀⠀⠀⣿⣿⣆⠀⠀⠻⣿⡿⠛⠉⠉⠁⠀⠉⠉⠛⠿⣿⣿⠟⠁⠀⣼⠃⠀ ", + " ⠈⠓⠶⣶⣾⣿⣿⣿⣧⡀⠀⠈⠒⢤⣀⣀⡀⠀⠀⣀⣀⡠⠚⠁⠀⢀⡼⠃⠀⠀ ", + " ⠀⠀⠀⠈⢿⣿⣿⣿⣿⣿⣷⣤⣤⣤⣤⣭⣭⣭⣭⣭⣥⣤⣤⣤⣴⣟⠁ ", } M[5] = { - " ▄▄▄▄▄▄▄▄▄ ", - " ▄█████████████▄ ", - " █████ █████████████████ █████ ", - " ▐████▌ ▀███▄ ▄███▀ ▐████▌ ", - " █████▄ ▀███▄ ▄███▀ ▄█████ ", - " ▐██▀███▄ ▀███▄███▀ ▄███▀██▌ ", - " ███▄▀███▄ ▀███▀ ▄███▀▄███ ", - " ▐█▄▀█▄▀███ ▄ ▀ ▄ ███▀▄█▀▄█▌ ", - " ███▄▀█▄██ ██▄██ ██▄█▀▄███ ", - " ▀███▄▀██ █████ ██▀▄███▀ ", - " █▄ ▀█████ █████ █████▀ ▄█ ", - " ███ ███ ███ ", - " ███▄ ▄█ ███ █▄ ▄███ ", - " █████ ▄███ ███ ███▄ █████ ", - " █████ ████ ███ ████ █████ ", - " █████ ████▄▄▄▄▄████ █████ ", - " ▀███ █████████████ ███▀ ", - " ▀█ ███ ▄▄▄▄▄ ███ █▀ ", - " ▀█▌▐█████▌▐█▀ ", - " ███████ ", + " ▄▄▄▄▄▄▄▄▄ ", + " ▄█████████████▄ ", + " █████ █████████████████ █████ ", + " ▐████▌ ▀███▄ ▄███▀ ▐████▌ ", + " █████▄ ▀███▄ ▄███▀ ▄█████ ", + " ▐██▀███▄ ▀███▄███▀ ▄███▀██▌ ", + " ███▄▀███▄ ▀███▀ ▄███▀▄███ ", + " ▐█▄▀█▄▀███ ▄ ▀ ▄ ███▀▄█▀▄█▌ ", + " ███▄▀█▄██ ██▄██ ██▄█▀▄███ ", + " ▀███▄▀██ █████ ██▀▄███▀ ", + " █▄ ▀█████ █████ █████▀ ▄█ ", + " ███ ███ ███ ", + " ███▄ ▄█ ███ █▄ ▄███ ", + " █████ ▄███ ███ ███▄ █████ ", + " █████ ████ ███ ████ █████ ", + " █████ ████▄▄▄▄▄████ █████ ", + " ▀███ █████████████ ███▀ ", + " ▀█ ███ ▄▄▄▄▄ ███ █▀ ", + " ▀█▌▐█████▌▐█▀ ", + " ███████ ", } M[6] = { - " ████ ████ ", - " ███ ███ ", - " ███ ███ ", - " ███ ███ ", - " ███ ███ ", - "████ ████ ", - "████ ████ ", - "██████ ███████ ██████ ", - "█████████████████████████████████ ", - " ███████████████████████████████ ", - " ████ ███████████████████ ████ ", - " ███▀███████████▀███ ", - " ████──▀███████▀──████ ", - " █████───█████───█████ ", - " ███████████████████ ", - " █████████████████ ", - " ███████████████ ", - " █████████████ ", - " ███████████ ", - " ███──▀▀▀──███ ", - " ███─█████─███ ", - " ███─███─███ ", - " █████████ ", + " ████ ████ ", + " ███ ███ ", + " ███ ███ ", + " ███ ███ ", + " ███ ███ ", + "████ ████ ", + "████ ████ ", + "██████ ███████ ██████ ", + "█████████████████████████████████ ", + " ███████████████████████████████ ", + " ████ ███████████████████ ████ ", + " ███▀███████████▀███ ", + " ████──▀███████▀──████ ", + " █████───█████───█████ ", + " ███████████████████ ", + " █████████████████ ", + " ███████████████ ", + " █████████████ ", + " ███████████ ", + " ███──▀▀▀──███ ", + " ███─█████─███ ", + " ███─███─███ ", + " █████████ ", } M[7] = { - " ▄█ ", - " ▄██░█ ", - " ██ ██░░░░█ ", - " ██░░█ █░░░░░░█ ", - " ▄█░░░███░░░░░██ ", - " █░░░░█░░░░░░██████████▀ ", - " █░░░░▄▄▄▄▄░░░░░░░░░░█ ", - " ▀███████░▐░░░░░░░░░▌░░░░░█ ", - " ██░░░░▐░░▄██████████▄░█ ", - " █░░░░▌▄███████▀▀▀▀█▀█▀ ", - " ██░░▄▄████████░░░░▌░██ ", - " █▐██████▌███▌░░░░▐░░██ ", - " ██▌████▐██▐░░░░░▐░░░░██ ", - " █▐█▐▌█▀███▀▀░░░░░▐░░░░░██ ", - " █░░██▐█░░▄░░░▄█░░░▐░░░░░░██ ", - " █░░░▐▌█▌▀▀░░░█░█▌░░▐░░░░████ ", - " █░░░░▐▀▀░░░░▄█░░█▌░░▌░░███ ", - " ▄██░░░░░▌░░░▄██░▄██▌░▐░███ ", - " ██░░░▐░░▀█▄░▄███▌░▐░░█ ", - " ███░░█░░░██▀▀░█░░▌░░░█ ", - " █░░░▌░░▐█████░▐░░░░██ ", - " █░░░░░▀▄▄░░░░░█░░░░░░██ ", - " ██░░░░░░░░▀▄▄▄▀░░████████▄ ", - " █░█████░░░░░█░░░░█ ", - " ██ ██░░░░██░░░█ ", - " █ █░░░█ ███░░█ ", - " █░░░█ ██░█ ", - " █░░░█ ██ ", - " █░█ ", + " ▄█ ", + " ▄██░█ ", + " ██ ██░░░░█ ", + " ██░░█ █░░░░░░█ ", + " ▄█░░░███░░░░░██ ", + " █░░░░█░░░░░░██████████▀ ", + " █░░░░▄▄▄▄▄░░░░░░░░░░█ ", + " ▀███████░▐░░░░░░░░░▌░░░░░█ ", + " ██░░░░▐░░▄██████████▄░█ ", + " █░░░░▌▄███████▀▀▀▀█▀█▀ ", + " ██░░▄▄████████░░░░▌░██ ", + " █▐██████▌███▌░░░░▐░░██ ", + " ██▌████▐██▐░░░░░▐░░░░██ ", + " █▐█▐▌█▀███▀▀░░░░░▐░░░░░██ ", + " █░░██▐█░░▄░░░▄█░░░▐░░░░░░██ ", + " █░░░▐▌█▌▀▀░░░█░█▌░░▐░░░░████ ", + " █░░░░▐▀▀░░░░▄█░░█▌░░▌░░███ ", + " ▄██░░░░░▌░░░▄██░▄██▌░▐░███ ", + " ██░░░▐░░▀█▄░▄███▌░▐░░█ ", + " ███░░█░░░██▀▀░█░░▌░░░█ ", + " █░░░▌░░▐█████░▐░░░░██ ", + " █░░░░░▀▄▄░░░░░█░░░░░░██ ", + " ██░░░░░░░░▀▄▄▄▀░░████████▄ ", + " █░█████░░░░░█░░░░█ ", + " ██ ██░░░░██░░░█ ", + " █ █░░░█ ███░░█ ", + " █░░░█ ██░█ ", + " █░░░█ ██ ", + " █░█ ", } M[8] = { - " ▄▄██████████▄▄ ", - " ▀▀▀ ██ ▀▀▀ ", - " ▄██▄ ▄▄████████████▄▄ ▄██▄ ", - " ▄███▀ ▄████▀▀▀ ▀▀▀████▄ ▀███▄ ", - " ████▄ ▄███▀ ▀███▄ ▄████ ", - " ███▀█████▀▄████▄ ▄████▄▀█████▀███ ", - " ██▀ ███▀ ██████ ██████ ▀███ ▀██ ", - " ▀ ▄██▀ ▀████▀ ▄▄ ▀████▀ ▀██▄ ▀ ", - " ███ ▀▀ ███ ", - " ██████████████████████████████ ", - " ▄█ ▀██ ███ ██ ██ ███ ██▀ █▄ ", - " ███ ███ ███ ██ ██ ███▄███ ███ ", - " ▀██▄████████ ██ ██ ████████▄██▀ ", - " ▀███▀ ▀████ ██ ██ ████▀ ▀███▀ ", - " ▀███▄ ▀███████ ███████▀ ▄███▀ ", - " ▀███ ▀▀██████████▀▀▀ ███▀ ", - " ▀ ▄▄▄ ██ ▄▄▄ ▀ ", - " ▀████████████▀ ", + " ▄▄██████████▄▄ ", + " ▀▀▀ ██ ▀▀▀ ", + " ▄██▄ ▄▄████████████▄▄ ▄██▄ ", + " ▄███▀ ▄████▀▀▀ ▀▀▀████▄ ▀███▄ ", + " ████▄ ▄███▀ ▀███▄ ▄████ ", + " ███▀█████▀▄████▄ ▄████▄▀█████▀███ ", + " ██▀ ███▀ ██████ ██████ ▀███ ▀██ ", + " ▀ ▄██▀ ▀████▀ ▄▄ ▀████▀ ▀██▄ ▀ ", + " ███ ▀▀ ███ ", + " ██████████████████████████████ ", + " ▄█ ▀██ ███ ██ ██ ███ ██▀ █▄ ", + " ███ ███ ███ ██ ██ ███▄███ ███ ", + " ▀██▄████████ ██ ██ ████████▄██▀ ", + " ▀███▀ ▀████ ██ ██ ████▀ ▀███▀ ", + " ▀███▄ ▀███████ ███████▀ ▄███▀ ", + " ▀███ ▀▀██████████▀▀▀ ███▀ ", + " ▀ ▄▄▄ ██ ▄▄▄ ▀ ", + " ▀████████████▀ ", } M[9] = { - " ▄▄▀▀▀▀▀▀▀▀▄▄ ", - " ▄▀▀ ▀▄▄ ", - " ▄▀ ▀▄ ", - " ▌ ▀▄ ▀▀▄ ", - " ▌ ▀▌ ▌ ", - " ▐ ▌ ▐ ", - " ▌▐ ▐ ▐ ▌ ▌ ", - " ▐ ▌ ▌ ▐ ▌ ▐ ▌▐ ▐ ", - " ▐ ▌ ▌▄▄▀▀▌▌ ▐▀▌▀▌▄ ▐ ▌ ▌ ", - " ▌▌ ▐▀▄▌▌▐▐ ▐▐▐ ▐ ▌▌ ▐ ▌▄▐ ", - " ▄▀▄▐ ▌▌▄▀▄▐ ▌▌ ▐ ▌▄▀▄ ▐ ▐ ▌ ▀▄ ", - " ▀▄▀ ▌ ▄▀ ▌█▐ ▐▐▀ ▌█▐ ▀▄▐ ▌▌ ▀ ", - " ▀▀▄▄▐ ▀▄▀ ▀▄▀ ▀▄▀▄▀ ▌ ▐ ", - " ▀▐▀▄ ▀▄ ▐ ▀▌▐ ", - " ▌ ▌▐ ▀ ▐ ▐ ", - " ▐ ▐ ▌ ▄▄▀▀▀▀▄ ▌ ▐ ", - " ▌▐ ▐▄ ▐ ▌ ▄▀ ▐ ", - " ▐ ▌▐▐▀▄ ▀▄▄▄▀ ▄▀▐ ▐ ", - " ▌▌ ▌▐ ▌ ▀▄▄ ▄▌▐ ▌ ▐ ", - " ▐ ▐ ▐▐ ▌ ▀▀▄▀▌▐ ▌ ▌ ", - " ▌ ▌▐ ▌ ▐▀▄▌ ▐ ", + " ▄▄▀▀▀▀▀▀▀▀▄▄ ", + " ▄▀▀ ▀▄▄ ", + " ▄▀ ▀▄ ", + " ▌ ▀▄ ▀▀▄ ", + " ▌ ▀▌ ▌ ", + " ▐ ▌ ▐ ", + " ▌▐ ▐ ▐ ▌ ▌ ", + " ▐ ▌ ▌ ▐ ▌ ▐ ▌▐ ▐ ", + " ▐ ▌ ▌▄▄▀▀▌▌ ▐▀▌▀▌▄ ▐ ▌ ▌ ", + " ▌▌ ▐▀▄▌▌▐▐ ▐▐▐ ▐ ▌▌ ▐ ▌▄▐ ", + " ▄▀▄▐ ▌▌▄▀▄▐ ▌▌ ▐ ▌▄▀▄ ▐ ▐ ▌ ▀▄ ", + " ▀▄▀ ▌ ▄▀ ▌█▐ ▐▐▀ ▌█▐ ▀▄▐ ▌▌ ▀ ", + " ▀▀▄▄▐ ▀▄▀ ▀▄▀ ▀▄▀▄▀ ▌ ▐ ", + " ▀▐▀▄ ▀▄ ▐ ▀▌▐ ", + " ▌ ▌▐ ▀ ▐ ▐ ", + " ▐ ▐ ▌ ▄▄▀▀▀▀▄ ▌ ▐ ", + " ▌▐ ▐▄ ▐ ▌ ▄▀ ▐ ", + " ▐ ▌▐▐▀▄ ▀▄▄▄▀ ▄▀▐ ▐ ", + " ▌▌ ▌▐ ▌ ▀▄▄ ▄▌▐ ▌ ▐ ", + " ▐ ▐ ▐▐ ▌ ▀▀▄▀▌▐ ▌ ▌ ", + " ▌ ▌▐ ▌ ▐▀▄▌ ▐ ", } M[10] = { - " ▀████▀▄▄ ▄█ ", - " █▀ ▀▀▄▄▄▄▄ ▄▄▀▀█ ", - " ▄ █ ▀▀▀▀▄ ▄▀ ", - " ▄▀ ▀▄ ▀▄ ▀▄▀ ", - " ▄▀ █ █▀ ▄█▀▄ ▄█ ", - " ▀▄ ▀▄ █ ▀██▀ ██▄█ ", - " ▀▄ ▄▀ █ ▄██▄ ▄ ▄ ▀▀ █ ", - " █ ▄▀ █ ▀██▀ ▀▀ ▀▀ ▄▀ ", - " █ █ █ ▄▄ ▄▀ ", + " ▀████▀▄▄ ▄█ ", + " █▀ ▀▀▄▄▄▄▄ ▄▄▀▀█ ", + " ▄ █ ▀▀▀▀▄ ▄▀ ", + " ▄▀ ▀▄ ▀▄ ▀▄▀ ", + " ▄▀ █ █▀ ▄█▀▄ ▄█ ", + " ▀▄ ▀▄ █ ▀██▀ ██▄█ ", + " ▀▄ ▄▀ █ ▄██▄ ▄ ▄ ▀▀ █ ", + " █ ▄▀ █ ▀██▀ ▀▀ ▀▀ ▄▀ ", + " █ █ █ ▄▄ ▄▀ ", } M[11] = { - " ▄████████▄ ", - " ▄█▀▒▒▒▒▒▒▒▀██▄ ", - " ▄█▀▒▒▒▒▒▒▄▒▒▒▒▒▒▐█▌ ", - " ▄█▒▒▒▒▒▒▒▒▒▒▀█▒▒▒▄██ ", - " ▄█▒▒▒▒▒▒▒▒▒▒▒▒▒▒██▀▒▒▒█▄ ", - " ▄█▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒█▄ ", - " ▄█▒▒▒▄██████▄▒▒▒▒▄█████▄▒▒▒▒█ ", - " █▒▒▒█▀░░░░░▀█ ▒▒▒█▀░░░░▀█▒▒▒█ ", - " █▒▒▒█░░▄░░░░▀████▀░░░▄░░█▒▒▒█ ", - " ▄███▄▒█▄░▐▀▄░░░░░░░░░▄▀▌░▄█▒▒███▄", - " █▀░░█▄▒█░▐▐▀▀▄▄▄ ▄▄▄▀▀▌▌░█▒▒█░░▀█", - " █░░░░█▒█░▐▐ ▄▄ █ ▄▄ ▌▌░█▒█░░░░█", - " █░▄░░█▒█░▐▐▄ ▀▀ █ ▀▀ ▄▌▌░█▒█░░▄░█", - " █░░█░█▒█░░▌▄█▄▄▀ ▀▄▄█▄▐░░█▒█░█░░█", - " █▄░█████████▀░░▀▄▀░░▀█████████░▄█", - " ██▀░░▄▀░░▀░░▀▄░░░▄▀░░▀░░▀▄░░▀██ ", - " ██░░░░░░░░░░░░░░░░░░░░░░░░░░░░░██", - " █░▄░░░░░░░░░░░░░░░░░░░░░░░░░░░▄░█", - " █░▀█▄░░░░░░░░░░░░░░░░░░░░░░░▄█▀░█", - " █░░█▀███████████████████████▀█░░█", - " █░░█ █ █ █ █ █ █░░█", - " █░░░▀█▄▄█▄▄▄█▄▄▄█▄▄▄█▄▄▄█▄▄█▀░░░█", - " ▀█░░▀█▄█ █ █ █ █▄█▀░░░█▀ ", - " ▀█░░░▀▀█▄▄ █ █ █▄▄█▀▀░░░░█▀ ", - " ▀█░░░░░▀▀█████████▀▀░░░░░░█▀ ", - " ▀█░░░░░░░▄░░░░░░░▄░░░░░░█▀ ", - " ▀██▄░░░▀▀▀▀▀▀▀▀▀░░░▄██▀ ", - " ▀██▄▄░░░░░░░▄▄██▀ ", - " ▀▀███████▀▀ ", + " ▄████████▄ ", + " ▄█▀▒▒▒▒▒▒▒▀██▄ ", + " ▄█▀▒▒▒▒▒▒▄▒▒▒▒▒▒▐█▌ ", + " ▄█▒▒▒▒▒▒▒▒▒▒▀█▒▒▒▄██ ", + " ▄█▒▒▒▒▒▒▒▒▒▒▒▒▒▒██▀▒▒▒█▄ ", + " ▄█▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒█▄ ", + " ▄█▒▒▒▄██████▄▒▒▒▒▄█████▄▒▒▒▒█ ", + " █▒▒▒█▀░░░░░▀█ ▒▒▒█▀░░░░▀█▒▒▒█ ", + " █▒▒▒█░░▄░░░░▀████▀░░░▄░░█▒▒▒█ ", + " ▄███▄▒█▄░▐▀▄░░░░░░░░░▄▀▌░▄█▒▒███▄", + " █▀░░█▄▒█░▐▐▀▀▄▄▄ ▄▄▄▀▀▌▌░█▒▒█░░▀█", + " █░░░░█▒█░▐▐ ▄▄ █ ▄▄ ▌▌░█▒█░░░░█", + " █░▄░░█▒█░▐▐▄ ▀▀ █ ▀▀ ▄▌▌░█▒█░░▄░█", + " █░░█░█▒█░░▌▄█▄▄▀ ▀▄▄█▄▐░░█▒█░█░░█", + " █▄░█████████▀░░▀▄▀░░▀█████████░▄█", + " ██▀░░▄▀░░▀░░▀▄░░░▄▀░░▀░░▀▄░░▀██ ", + " ██░░░░░░░░░░░░░░░░░░░░░░░░░░░░░██", + " █░▄░░░░░░░░░░░░░░░░░░░░░░░░░░░▄░█", + " █░▀█▄░░░░░░░░░░░░░░░░░░░░░░░▄█▀░█", + " █░░█▀███████████████████████▀█░░█", + " █░░█ █ █ █ █ █ █░░█", + " █░░░▀█▄▄█▄▄▄█▄▄▄█▄▄▄█▄▄▄█▄▄█▀░░░█", + " ▀█░░▀█▄█ █ █ █ █▄█▀░░░█▀ ", + " ▀█░░░▀▀█▄▄ █ █ █▄▄█▀▀░░░░█▀ ", + " ▀█░░░░░▀▀█████████▀▀░░░░░░█▀ ", + " ▀█░░░░░░░▄░░░░░░░▄░░░░░░█▀ ", + " ▀██▄░░░▀▀▀▀▀▀▀▀▀░░░▄██▀ ", + " ▀██▄▄░░░░░░░▄▄██▀ ", + " ▀▀███████▀▀ ", } M[12] = { - " ⠀⠀⠀⠀⠀⠀⠀⠀⠀⣠⠤⠖⠚⢉⣩⣭⡭⠛⠓⠲⠦⣄⡀⠀⠀⠀⠀⠀⠀⠀ ", - " ⠀⠀⠀⠀⠀⠀⢀⡴⠋⠁⠀⠀⠊⠀⠀⠀⠀⠀⠀⠀⠀⠀⠉⠳⢦⡀⠀⠀⠀⠀ ", - " ⠀⠀⠀⠀⢀⡴⠃⢀⡴⢳⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠙⣆⠀⠀⠀ ", - " ⠀⠀⠀⠀⡾⠁⣠⠋⠀⠈⢧⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠈⢧⠀⠀ ", - " ⠀⠀⠀⣸⠁⢰⠃⠀⠀⠀⠈⢣⡀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠈⣇⠀ ", - " ⠀⠀⠀⡇⠀⡾⡀⠀⠀⠀⠀⣀⣹⣆⡀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢹⠀ ", - " ⠀⠀⢸⠃⢀⣇⡈⠀⠀⠀⠀⠀⠀⢀⡑⢄⡀⢀⡀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢸⡇ ", - " ⠀⠀⢸⠀⢻⡟⡻⢶⡆⠀⠀⠀⠀⡼⠟⡳⢿⣦⡑⢄⠀⠀⠀⠀⠀⠀⠀⠀⢸⡇ ", - " ⠀⠀⣸⠀⢸⠃⡇⢀⠇⠀⠀⠀⠀⠀⡼⠀⠀⠈⣿⡗⠂⠀⠀⠀⠀⠀⠀⠀⢸⠁ ", - " ⠀⠀⡏⠀⣼⠀⢳⠊⠀⠀⠀⠀⠀⠀⠱⣀⣀⠔⣸⠁⠀⠀⠀⠀⠀⠀⠀⢠⡟⠀ ", - " ⠀⠀⡇⢀⡇⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠠⠀⡇⠀⠀⠀⠀⠀⠀⠀⠀⢸⠃⠀ ", - " ⠀⢸⠃⠘⡇⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢸⠁⠀⠀⢀⠀⠀⠀⠀⠀⣾⠀⠀ ", - " ⠀⣸⠀⠀⠹⡄⠀⠀⠈⠁⠀⠀⠀⠀⠀⠀⠀⡞⠀⠀⠀⠸⠀⠀⠀⠀⠀⡇⠀⠀ ", - " ⠀⡏⠀⠀⠀⠙⣆⠀⠀⠀⠀⠀⠀⠀⢀⣠⢶⡇⠀⠀⢰⡀⠀⠀⠀⠀⠀⡇⠀⠀ ", - " ⢰⠇⡄⠀⠀⠀⡿⢣⣀⣀⣀⡤⠴⡞⠉⠀⢸⠀⠀⠀⣿⡇⠀⠀⠀⠀⠀⣧⠀⠀ ", - " ⣸⠀⡇⠀⠀⠀⠀⠀⠀⠉⠀⠀⠀⢹⠀⠀⢸⠀⠀⢀⣿⠇⠀⠀⠀⠁⠀⢸⠀⠀ ", - " ⣿⠀⡇⠀⠀⠀⠀⠀⢀⡤⠤⠶⠶⠾⠤⠄⢸⠀⡀⠸⣿⣀⠀⠀⠀⠀⠀⠈⣇⠀ ", - " ⡇⠀⡇⠀⠀⡀⠀⡴⠋⠀⠀⠀⠀⠀⠀⠀⠸⡌⣵⡀⢳⡇⠀⠀⠀⠀⠀⠀⢹⡀ ", - " ⡇⠀⠇⠀⠀⡇⡸⠁⠀⠀⠀⠀⠀⠀⠀⠀⠀⠙⠮⢧⣀⣻⢂⠀⠀⠀⠀⠀⠀⢧ ", - " ⣇⠀⢠⠀⠀⢳⠇⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠈⡎⣆⠀⠀⠀⠀⠀⠘ ", + " ⠀⠀⠀⠀⠀⠀⠀⠀⠀⣠⠤⠖⠚⢉⣩⣭⡭⠛⠓⠲⠦⣄⡀⠀⠀⠀⠀⠀⠀⠀ ", + " ⠀⠀⠀⠀⠀⠀⢀⡴⠋⠁⠀⠀⠊⠀⠀⠀⠀⠀⠀⠀⠀⠀⠉⠳⢦⡀⠀⠀⠀⠀ ", + " ⠀⠀⠀⠀⢀⡴⠃⢀⡴⢳⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠙⣆⠀⠀⠀ ", + " ⠀⠀⠀⠀⡾⠁⣠⠋⠀⠈⢧⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠈⢧⠀⠀ ", + " ⠀⠀⠀⣸⠁⢰⠃⠀⠀⠀⠈⢣⡀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠈⣇⠀ ", + " ⠀⠀⠀⡇⠀⡾⡀⠀⠀⠀⠀⣀⣹⣆⡀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢹⠀ ", + " ⠀⠀⢸⠃⢀⣇⡈⠀⠀⠀⠀⠀⠀⢀⡑⢄⡀⢀⡀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢸⡇ ", + " ⠀⠀⢸⠀⢻⡟⡻⢶⡆⠀⠀⠀⠀⡼⠟⡳⢿⣦⡑⢄⠀⠀⠀⠀⠀⠀⠀⠀⢸⡇ ", + " ⠀⠀⣸⠀⢸⠃⡇⢀⠇⠀⠀⠀⠀⠀⡼⠀⠀⠈⣿⡗⠂⠀⠀⠀⠀⠀⠀⠀⢸⠁ ", + " ⠀⠀⡏⠀⣼⠀⢳⠊⠀⠀⠀⠀⠀⠀⠱⣀⣀⠔⣸⠁⠀⠀⠀⠀⠀⠀⠀⢠⡟⠀ ", + " ⠀⠀⡇⢀⡇⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠠⠀⡇⠀⠀⠀⠀⠀⠀⠀⠀⢸⠃⠀ ", + " ⠀⢸⠃⠘⡇⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢸⠁⠀⠀⢀⠀⠀⠀⠀⠀⣾⠀⠀ ", + " ⠀⣸⠀⠀⠹⡄⠀⠀⠈⠁⠀⠀⠀⠀⠀⠀⠀⡞⠀⠀⠀⠸⠀⠀⠀⠀⠀⡇⠀⠀ ", + " ⠀⡏⠀⠀⠀⠙⣆⠀⠀⠀⠀⠀⠀⠀⢀⣠⢶⡇⠀⠀⢰⡀⠀⠀⠀⠀⠀⡇⠀⠀ ", + " ⢰⠇⡄⠀⠀⠀⡿⢣⣀⣀⣀⡤⠴⡞⠉⠀⢸⠀⠀⠀⣿⡇⠀⠀⠀⠀⠀⣧⠀⠀ ", + " ⣸⠀⡇⠀⠀⠀⠀⠀⠀⠉⠀⠀⠀⢹⠀⠀⢸⠀⠀⢀⣿⠇⠀⠀⠀⠁⠀⢸⠀⠀ ", + " ⣿⠀⡇⠀⠀⠀⠀⠀⢀⡤⠤⠶⠶⠾⠤⠄⢸⠀⡀⠸⣿⣀⠀⠀⠀⠀⠀⠈⣇⠀ ", + " ⡇⠀⡇⠀⠀⡀⠀⡴⠋⠀⠀⠀⠀⠀⠀⠀⠸⡌⣵⡀⢳⡇⠀⠀⠀⠀⠀⠀⢹⡀ ", + " ⡇⠀⠇⠀⠀⡇⡸⠁⠀⠀⠀⠀⠀⠀⠀⠀⠀⠙⠮⢧⣀⣻⢂⠀⠀⠀⠀⠀⠀⢧ ", + " ⣇⠀⢠⠀⠀⢳⠇⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠈⡎⣆⠀⠀⠀⠀⠀⠘ ", } M[13] = { - "⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢀⡀⠀⠀⠀⠀⢀⡀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀ ", - "⠀⠀⠀⠀⠀⠀⠀⠀⠀⣠⡖⠁⠀⠀⠀⠀⠀⠀⠈⢲⣄⠀⠀⠀⠀⠀⠀⠀⠀⠀ ", - "⠀⠀⠀⠀⠀⠀⠀⠀⣼⡏⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢹⣧⠀⠀⠀⠀⠀⠀⠀⠀ ", - "⠀⠀⠀⠀⠀⠀⠀⣸⣿⠁⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠈⣿⣇⠀⠀⠀⠀⠀⠀⠀ ", - "⠀⠀⠀⠀⠀⠀⠀⣿⣿⡇⠀⢀⣀⣤⣤⣤⣤⣀⡀⠀⢸⣿⣿⠀⠀⠀⠀⠀⠀⠀ ", - "⠀⠀⠀⠀⠀⠀⠀⢻⣿⣿⣔⢿⡿⠟⠛⠛⠻⢿⡿⣢⣿⣿⡟⠀⠀⠀⠀⠀⠀⠀ ", - "⠀⠀⠀⠀⣀⣤⣶⣾⣿⣿⣿⣷⣤⣀⡀⢀⣀⣤⣾⣿⣿⣿⣷⣶⣤⡀⠀⠀⠀⠀ ", - "⠀⠀⢠⣾⣿⡿⠿⠿⠿⣿⣿⣿⣿⡿⠏⠻⢿⣿⣿⣿⣿⠿⠿⠿⢿⣿⣷⡀⠀⠀ ", - "⠀⢠⡿⠋⠁⠀⠀⢸⣿⡇⠉⠻⣿⠇⠀⠀⠸⣿⡿⠋⢰⣿⡇⠀⠀⠈⠙⢿⡄⠀ ", - "⠀⡿⠁⠀⠀⠀⠀⠘⣿⣷⡀⠀⠰⣿⣶⣶⣿⡎⠀⢀⣾⣿⠇⠀⠀⠀⠀⠈⢿⠀ ", - "⠀⡇⠀⠀⠀⠀⠀⠀⠹⣿⣷⣄⠀⣿⣿⣿⣿⠀⣠⣾⣿⠏⠀⠀⠀⠀⠀⠀⢸⠀ ", - "⠀⠁⠀⠀⠀⠀⠀⠀⠀⠈⠻⢿⢇⣿⣿⣿⣿⡸⣿⠟⠁⠀⠀⠀⠀⠀⠀⠀⠈⠀ ", - "⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢀⣼⣿⣿⣿⣿⣧⡀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀ ", - "⠀⠀⠀⠐⢤⣀⣀⢀⣀⣠⣴⣿⣿⠿⠋⠙⠿⣿⣿⣦⣄⣀⠀⠀⣀⡠⠂⠀⠀⠀ ", - "⠀⠀⠀⠀⠀⠈⠉⠛⠛⠛⠛⠉⠀⠀⠀⠀⠀⠈⠉⠛⠛⠛⠛⠋⠁⠀⠀⠀⠀⠀ ", + "⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢀⡀⠀⠀⠀⠀⢀⡀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀ ", + "⠀⠀⠀⠀⠀⠀⠀⠀⠀⣠⡖⠁⠀⠀⠀⠀⠀⠀⠈⢲⣄⠀⠀⠀⠀⠀⠀⠀⠀⠀ ", + "⠀⠀⠀⠀⠀⠀⠀⠀⣼⡏⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢹⣧⠀⠀⠀⠀⠀⠀⠀⠀ ", + "⠀⠀⠀⠀⠀⠀⠀⣸⣿⠁⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠈⣿⣇⠀⠀⠀⠀⠀⠀⠀ ", + "⠀⠀⠀⠀⠀⠀⠀⣿⣿⡇⠀⢀⣀⣤⣤⣤⣤⣀⡀⠀⢸⣿⣿⠀⠀⠀⠀⠀⠀⠀ ", + "⠀⠀⠀⠀⠀⠀⠀⢻⣿⣿⣔⢿⡿⠟⠛⠛⠻⢿⡿⣢⣿⣿⡟⠀⠀⠀⠀⠀⠀⠀ ", + "⠀⠀⠀⠀⣀⣤⣶⣾⣿⣿⣿⣷⣤⣀⡀⢀⣀⣤⣾⣿⣿⣿⣷⣶⣤⡀⠀⠀⠀⠀ ", + "⠀⠀⢠⣾⣿⡿⠿⠿⠿⣿⣿⣿⣿⡿⠏⠻⢿⣿⣿⣿⣿⠿⠿⠿⢿⣿⣷⡀⠀⠀ ", + "⠀⢠⡿⠋⠁⠀⠀⢸⣿⡇⠉⠻⣿⠇⠀⠀⠸⣿⡿⠋⢰⣿⡇⠀⠀⠈⠙⢿⡄⠀ ", + "⠀⡿⠁⠀⠀⠀⠀⠘⣿⣷⡀⠀⠰⣿⣶⣶⣿⡎⠀⢀⣾⣿⠇⠀⠀⠀⠀⠈⢿⠀ ", + "⠀⡇⠀⠀⠀⠀⠀⠀⠹⣿⣷⣄⠀⣿⣿⣿⣿⠀⣠⣾⣿⠏⠀⠀⠀⠀⠀⠀⢸⠀ ", + "⠀⠁⠀⠀⠀⠀⠀⠀⠀⠈⠻⢿⢇⣿⣿⣿⣿⡸⣿⠟⠁⠀⠀⠀⠀⠀⠀⠀⠈⠀ ", + "⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢀⣼⣿⣿⣿⣿⣧⡀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀ ", + "⠀⠀⠀⠐⢤⣀⣀⢀⣀⣠⣴⣿⣿⠿⠋⠙⠿⣿⣿⣦⣄⣀⠀⠀⣀⡠⠂⠀⠀⠀ ", + "⠀⠀⠀⠀⠀⠈⠉⠛⠛⠛⠛⠉⠀⠀⠀⠀⠀⠈⠉⠛⠛⠛⠛⠋⠁⠀⠀⠀⠀⠀ ", } M[14] = { - "", - "⠀⠀⠀⠀⠀⠀⠀⠀⠀⢀⣀⣠⣤⣤⣴⣦⣤⣤⣄⣀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀ ", - "⠀⠀⠀⠀⠀⠀⢀⣤⣾⣿⣿⣿⣿⠿⠿⠿⠿⣿⣿⣿⣿⣶⣤⡀⠀⠀⠀⠀⠀⠀ ", - "⠀⠀⠀⠀⣠⣾⣿⣿⡿⠛⠉⠀⠀⠀⠀⠀⠀⠀⠀⠉⠛⢿⣿⣿⣶⡀⠀⠀⠀⠀ ", - "⠀⠀⠀⣴⣿⣿⠟⠁⠀⠀⠀⣶⣶⣶⣶⡆⠀⠀⠀⠀⠀⠀⠈⠻⣿⣿⣦⠀⠀⠀ ", - "⠀⠀⣼⣿⣿⠋⠀⠀⠀⠀⠀⠛⠛⢻⣿⣿⡀⠀⠀⠀⠀⠀⠀⠀⠙⣿⣿⣧⠀⠀ ", - "⠀⢸⣿⣿⠃⠀⠀⠀⠀⠀⠀⠀⠀⢀⣿⣿⣷⠀⠀⠀⠀⠀⠀⠀⠀⠸⣿⣿⡇⠀ ", - "⠀⣿⣿⡿⠀⠀⠀⠀⠀⠀⠀⠀⢀⣾⣿⣿⣿⣇⠀⠀⠀⠀⠀⠀⠀⠀⣿⣿⣿⠀ ", - "⠀⣿⣿⡇⠀⠀⠀⠀⠀⠀⠀⢠⣿⣿⡟⢹⣿⣿⡆⠀⠀⠀⠀⠀⠀⠀⣹⣿⣿⠀ ", - "⠀⣿⣿⣷⠀⠀⠀⠀⠀⠀⣰⣿⣿⠏⠀⠀⢻⣿⣿⡄⠀⠀⠀⠀⠀⠀⣿⣿⡿⠀ ", - "⠀⢸⣿⣿⡆⠀⠀⠀⠀⣴⣿⡿⠃⠀⠀⠀⠈⢿⣿⣷⣤⣤⡆⠀⠀⣰⣿⣿⠇⠀ ", - "⠀⠀⢻⣿⣿⣄⠀⠀⠾⠿⠿⠁⠀⠀⠀⠀⠀⠘⣿⣿⡿⠿⠛⠀⣰⣿⣿⡟⠀⠀ ", - "⠀⠀⠀⠻⣿⣿⣧⣄⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣠⣾⣿⣿⠏⠀⠀⠀ ", - "⠀⠀⠀⠀⠈⠻⣿⣿⣷⣤⣄⡀⠀⠀⠀⠀⠀⠀⢀⣠⣴⣾⣿⣿⠟⠁⠀⠀⠀⠀ ", - "⠀⠀⠀⠀⠀⠀⠈⠛⠿⣿⣿⣿⣿⣿⣶⣶⣿⣿⣿⣿⣿⠿⠋⠁⠀⠀⠀⠀⠀⠀ ", - "⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠉⠉⠛⠛⠛⠛⠛⠛⠉⠉⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀ ", + "", + "⠀⠀⠀⠀⠀⠀⠀⠀⠀⢀⣀⣠⣤⣤⣴⣦⣤⣤⣄⣀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀ ", + "⠀⠀⠀⠀⠀⠀⢀⣤⣾⣿⣿⣿⣿⠿⠿⠿⠿⣿⣿⣿⣿⣶⣤⡀⠀⠀⠀⠀⠀⠀ ", + "⠀⠀⠀⠀⣠⣾⣿⣿⡿⠛⠉⠀⠀⠀⠀⠀⠀⠀⠀⠉⠛⢿⣿⣿⣶⡀⠀⠀⠀⠀ ", + "⠀⠀⠀⣴⣿⣿⠟⠁⠀⠀⠀⣶⣶⣶⣶⡆⠀⠀⠀⠀⠀⠀⠈⠻⣿⣿⣦⠀⠀⠀ ", + "⠀⠀⣼⣿⣿⠋⠀⠀⠀⠀⠀⠛⠛⢻⣿⣿⡀⠀⠀⠀⠀⠀⠀⠀⠙⣿⣿⣧⠀⠀ ", + "⠀⢸⣿⣿⠃⠀⠀⠀⠀⠀⠀⠀⠀⢀⣿⣿⣷⠀⠀⠀⠀⠀⠀⠀⠀⠸⣿⣿⡇⠀ ", + "⠀⣿⣿⡿⠀⠀⠀⠀⠀⠀⠀⠀⢀⣾⣿⣿⣿⣇⠀⠀⠀⠀⠀⠀⠀⠀⣿⣿⣿⠀ ", + "⠀⣿⣿⡇⠀⠀⠀⠀⠀⠀⠀⢠⣿⣿⡟⢹⣿⣿⡆⠀⠀⠀⠀⠀⠀⠀⣹⣿⣿⠀ ", + "⠀⣿⣿⣷⠀⠀⠀⠀⠀⠀⣰⣿⣿⠏⠀⠀⢻⣿⣿⡄⠀⠀⠀⠀⠀⠀⣿⣿⡿⠀ ", + "⠀⢸⣿⣿⡆⠀⠀⠀⠀⣴⣿⡿⠃⠀⠀⠀⠈⢿⣿⣷⣤⣤⡆⠀⠀⣰⣿⣿⠇⠀ ", + "⠀⠀⢻⣿⣿⣄⠀⠀⠾⠿⠿⠁⠀⠀⠀⠀⠀⠘⣿⣿⡿⠿⠛⠀⣰⣿⣿⡟⠀⠀ ", + "⠀⠀⠀⠻⣿⣿⣧⣄⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣠⣾⣿⣿⠏⠀⠀⠀ ", + "⠀⠀⠀⠀⠈⠻⣿⣿⣷⣤⣄⡀⠀⠀⠀⠀⠀⠀⢀⣠⣴⣾⣿⣿⠟⠁⠀⠀⠀⠀ ", + "⠀⠀⠀⠀⠀⠀⠈⠛⠿⣿⣿⣿⣿⣿⣶⣶⣿⣿⣿⣿⣿⠿⠋⠁⠀⠀⠀⠀⠀⠀ ", + "⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠉⠉⠛⠛⠛⠛⠛⠛⠉⠉⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀ ", } M[15] = { - " ⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢀⡴⣪⣭⣿⣷⣶⣄⠀⠀⠀⠀⠀⠀⠀⠀ ", - " ⠀⠀⠀⠀⠀⠀⠀⠀⠀⢀⣀⠤⢤⢔⡾⣹⣿⣿⣿⣿⣿⣿⣷⡄⠀⠀⠀⠀⠀⠀ ", - " ⠀⠀⠀⠀⠀⠀⠀⠀⠀⠁⠀⢰⢳⣿⣿⣿⠋⣻⣿⣿⣿⣿⣿⣿⣾⣿⠟⠀⠀⠀ ", - " ⠀⠀⠀⠀⠀⢀⠔⠁⠀⠀⠀⢸⣼⣷⣻⣧⣴⣿⣏⣿⣿⣿⣿⣿⣿⣿⣶⣶⣦⠤ ", - " ⠀⠀⠀⠀⢠⠇⠀⠀⠀⠀⠀⠈⢿⣿⣷⣿⣏⡿⣿⣿⣿⣿⣿⣿⣿⡿⠿⠛⠁⠀ ", - " ⠀⠀⠀⢀⠇⠀⠀⠀⠀⠀⠀⠀⠀⠹⢿⣿⣿⣿⣝⣿⣯⣾⠋⣇⠀⠀⠀⠀⠀⠀ ", - " ⠀⠀⢠⠀⠀⠀⠀⠀⠀⠀⠀⠀⢠⡄⠀⠀⠙⣽⣝⠋⢡⣯⣀⠘⢦⡀⠀⠀⠀⠀ ", - " ⠀⠀⡷⡁⠀⡄⠀⢠⠻⠀⠀⠀⢸⠙⠀⠀⠀⠙⡇⢹⣧⠛⠂⠀⢤⣉⠢⡀⠀⠀ ", - " ⡠⢊⠚⢇⣰⢣⠀⡞⠒⠣⠀⠀⠘⡄⠘⠓⠲⢆⣳⠀⠀⣠⣄⣀⣀⠙⢯⣾⡄⠀ ", - " ⣇⣇⡌⠈⡜⡌⢳⣧⣤⣄⡑⠄⣀⣳⢀⣠⣤⣴⣾⡆⠀⣿⠖⣠⣮⠀⠀⣿⠇⠀ ", - " ⠈⠛⢇⠀⠿⠷⡘⣿⢙⠿⡏⠀⠈⠉⢻⣻⣿⡏⢹⡟⣢⣿⣟⡻⠋⢀⡴⠁⠀⠀ ", - " ⠀⠀⠈⠢⢤⣀⣋⡿⢮⡉⠁⠀⠀⠀⠈⢉⣙⠷⠛⠺⣿⣙⣛⠭⠝⠋⠀⠀⠀⠀ ", - " ⠀⠀⠀⠀⠀⠀⠀⠀⠀⠈⡩⠒⠶⠲⠞⠓⢦⡀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀ ", - " ⠀⠀⠀⠀⠀⠀⠀⠀⠀⣰⣵⣕⣉⣫⣿⣦⠀⠱⡀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀ ", - " ⠀⠀⠀⠀⠀⠀⠀⠀⢠⣿⡾⡿⡟⣻⣿⡏⠱⣮⣿⣦⡀⠀⠀⠀⠀⠀⠀⠀⠀⠀ ", - " ⠀⠀⠀⠀⠀⠀⠀⣰⢿⡛⣿⣾⣜⣾⣿⣿⣿⣿⣿⣿⣿⣆⠀⠀⠀⠀⠀⠀⠀⠀ ", - " ⠀⠀⠀⠀⢀⣴⣿⣾⣿⣿⣿⣿⣿⣿⣾⡏⣿⣿⣿⣿⣿⣿⣆⠀⠀⠀⠀⠀⠀⠀ ", - " ⠀⠀⠀⠀⢀⣵⣿⣿⣿⣿⣿⣿⣿⡿⣿⣿⣿⣿⣿⣯⣿⣿⠟⠃⠀⠀⠀⠀⠀⠀ ", - " ⠀⠀⠀⠀⠀⠀⠈⢻⣿⣿⣶⣿⣿⣿⣿⣿⣿⣿⣿⠿⠿⠟⠀⠀⠀⠀⠀⠀⠀⠀ ", - " ⠀⠀⠀⠀⠀⠀⠀⠈⠻⠿⠿⣿⣿⣿⣿⣿⣿⡿⠃⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀ ", - " ⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠘⣿⣽⣿⠇⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀ ", + " ⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢀⡴⣪⣭⣿⣷⣶⣄⠀⠀⠀⠀⠀⠀⠀⠀ ", + " ⠀⠀⠀⠀⠀⠀⠀⠀⠀⢀⣀⠤⢤⢔⡾⣹⣿⣿⣿⣿⣿⣿⣷⡄⠀⠀⠀⠀⠀⠀ ", + " ⠀⠀⠀⠀⠀⠀⠀⠀⠀⠁⠀⢰⢳⣿⣿⣿⠋⣻⣿⣿⣿⣿⣿⣿⣾⣿⠟⠀⠀⠀ ", + " ⠀⠀⠀⠀⠀⢀⠔⠁⠀⠀⠀⢸⣼⣷⣻⣧⣴⣿⣏⣿⣿⣿⣿⣿⣿⣿⣶⣶⣦⠤ ", + " ⠀⠀⠀⠀⢠⠇⠀⠀⠀⠀⠀⠈⢿⣿⣷⣿⣏⡿⣿⣿⣿⣿⣿⣿⣿⡿⠿⠛⠁⠀ ", + " ⠀⠀⠀⢀⠇⠀⠀⠀⠀⠀⠀⠀⠀⠹⢿⣿⣿⣿⣝⣿⣯⣾⠋⣇⠀⠀⠀⠀⠀⠀ ", + " ⠀⠀⢠⠀⠀⠀⠀⠀⠀⠀⠀⠀⢠⡄⠀⠀⠙⣽⣝⠋⢡⣯⣀⠘⢦⡀⠀⠀⠀⠀ ", + " ⠀⠀⡷⡁⠀⡄⠀⢠⠻⠀⠀⠀⢸⠙⠀⠀⠀⠙⡇⢹⣧⠛⠂⠀⢤⣉⠢⡀⠀⠀ ", + " ⡠⢊⠚⢇⣰⢣⠀⡞⠒⠣⠀⠀⠘⡄⠘⠓⠲⢆⣳⠀⠀⣠⣄⣀⣀⠙⢯⣾⡄⠀ ", + " ⣇⣇⡌⠈⡜⡌⢳⣧⣤⣄⡑⠄⣀⣳⢀⣠⣤⣴⣾⡆⠀⣿⠖⣠⣮⠀⠀⣿⠇⠀ ", + " ⠈⠛⢇⠀⠿⠷⡘⣿⢙⠿⡏⠀⠈⠉⢻⣻⣿⡏⢹⡟⣢⣿⣟⡻⠋⢀⡴⠁⠀⠀ ", + " ⠀⠀⠈⠢⢤⣀⣋⡿⢮⡉⠁⠀⠀⠀⠈⢉⣙⠷⠛⠺⣿⣙⣛⠭⠝⠋⠀⠀⠀⠀ ", + " ⠀⠀⠀⠀⠀⠀⠀⠀⠀⠈⡩⠒⠶⠲⠞⠓⢦⡀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀ ", + " ⠀⠀⠀⠀⠀⠀⠀⠀⠀⣰⣵⣕⣉⣫⣿⣦⠀⠱⡀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀ ", + " ⠀⠀⠀⠀⠀⠀⠀⠀⢠⣿⡾⡿⡟⣻⣿⡏⠱⣮⣿⣦⡀⠀⠀⠀⠀⠀⠀⠀⠀⠀ ", + " ⠀⠀⠀⠀⠀⠀⠀⣰⢿⡛⣿⣾⣜⣾⣿⣿⣿⣿⣿⣿⣿⣆⠀⠀⠀⠀⠀⠀⠀⠀ ", + " ⠀⠀⠀⠀⢀⣴⣿⣾⣿⣿⣿⣿⣿⣿⣾⡏⣿⣿⣿⣿⣿⣿⣆⠀⠀⠀⠀⠀⠀⠀ ", + " ⠀⠀⠀⠀⢀⣵⣿⣿⣿⣿⣿⣿⣿⡿⣿⣿⣿⣿⣿⣯⣿⣿⠟⠃⠀⠀⠀⠀⠀⠀ ", + " ⠀⠀⠀⠀⠀⠀⠈⢻⣿⣿⣶⣿⣿⣿⣿⣿⣿⣿⣿⠿⠿⠟⠀⠀⠀⠀⠀⠀⠀⠀ ", + " ⠀⠀⠀⠀⠀⠀⠀⠈⠻⠿⠿⣿⣿⣿⣿⣿⣿⡿⠃⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀ ", + " ⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠘⣿⣽⣿⠇⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀ ", } M[16] = { - "", - " ████▌█████▌█ ████████▐▀██▀ ", - " ▄█████ █████▌ █ ▀██████▌█▄▄▀▄ ", - " ▌███▌█ ▐███▌▌ ▄▄ ▌█▌███▐███ ▀ ", - " ▐ ▐██ ▄▄▐▀█ ▐▄█▀▌█▐███▐█ ", - " ███ ▌▄█▌ ▀ ▀██ ▀██████▌ ", - " ▀█▌▀██▀ ▄ ███▐███ ", - " ██▌ ▐███████▌ ", - " ███ ▀█▀ ▐██▐███▀▌ ", - " ▌█▌█▄ ▄▄████▀ ▀ ", - " █▀██▄▄▄ ▄▄▀▀▒█▀█ ", - "", + "", + " ████▌█████▌█ ████████▐▀██▀ ", + " ▄█████ █████▌ █ ▀██████▌█▄▄▀▄ ", + " ▌███▌█ ▐███▌▌ ▄▄ ▌█▌███▐███ ▀ ", + " ▐ ▐██ ▄▄▐▀█ ▐▄█▀▌█▐███▐█ ", + " ███ ▌▄█▌ ▀ ▀██ ▀██████▌ ", + " ▀█▌▀██▀ ▄ ███▐███ ", + " ██▌ ▐███████▌ ", + " ███ ▀█▀ ▐██▐███▀▌ ", + " ▌█▌█▄ ▄▄████▀ ▀ ", + " █▀██▄▄▄ ▄▄▀▀▒█▀█ ", + "", } M[17] = { - "", - "", - " ⢀⣴⡾⠃⠄⠄⠄⠄⠄⠈⠺⠟⠛⠛⠛⠛⠻⢿⣿⣿⣿⣿⣶⣤⡀ ", - " ⢀⣴⣿⡿⠁⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⣸⣿⣿⣿⣿⣿⣿⣿⣷ ", - " ⣴⣿⡿⡟⡼⢹⣷⢲⡶⣖⣾⣶⢄⠄⠄⠄⠄⠄⢀⣼⣿⢿⣿⣿⣿⣿⣿⣿⣿ ", - " ⣾⣿⡟⣾⡸⢠⡿⢳⡿⠍⣼⣿⢏⣿⣷⢄⡀⠄⢠⣾⢻⣿⣸⣿⣿⣿⣿⣿⣿⣿ ", - " ⣡⣿⣿⡟⡼⡁⠁⣰⠂⡾⠉⢨⣿⠃⣿⡿⠍⣾⣟⢤⣿⢇⣿⢇⣿⣿⢿⣿⣿⣿⣿⣿ ", - " ⣱⣿⣿⡟⡐⣰⣧⡷⣿⣴⣧⣤⣼⣯⢸⡿⠁⣰⠟⢀⣼⠏⣲⠏⢸⣿⡟⣿⣿⣿⣿⣿⣿ ", - " ⣿⣿⡟⠁⠄⠟⣁⠄⢡⣿⣿⣿⣿⣿⣿⣦⣼⢟⢀⡼⠃⡹⠃⡀⢸⡿⢸⣿⣿⣿⣿⣿⡟ ", - " ⣿⣿⠃⠄⢀⣾⠋⠓⢰⣿⣿⣿⣿⣿⣿⠿⣿⣿⣾⣅⢔⣕⡇⡇⡼⢁⣿⣿⣿⣿⣿⣿⢣ ", - " ⣿⡟⠄⠄⣾⣇⠷⣢⣿⣿⣿⣿⣿⣿⣿⣭⣀⡈⠙⢿⣿⣿⡇⡧⢁⣾⣿⣿⣿⣿⣿⢏⣾ ", - " ⣿⡇⠄⣼⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⠟⢻⠇⠄⠄⢿⣿⡇⢡⣾⣿⣿⣿⣿⣿⣏⣼⣿ ", - " ⣿⣷⢰⣿⣿⣾⣿⣿⣿⣿⣿⣿⣿⣿⣿⢰⣧⣀⡄⢀⠘⡿⣰⣿⣿⣿⣿⣿⣿⠟⣼⣿⣿ ", - " ⢹⣿⢸⣿⣿⠟⠻⢿⣿⣿⣿⣿⣿⣿⣿⣶⣭⣉⣤⣿⢈⣼⣿⣿⣿⣿⣿⣿⠏⣾⣹⣿⣿ ", - " ⢸⠇⡜⣿⡟⠄⠄⠄⠈⠙⣿⣿⣿⣿⣿⣿⣿⣿⠟⣱⣻⣿⣿⣿⣿⣿⠟⠁⢳⠃⣿⣿⣿ ", - " ⣰⡗⠹⣿⣄⠄⠄⠄⢀⣿⣿⣿⣿⣿⣿⠟⣅⣥⣿⣿⣿⣿⠿⠋ ⣾⡌⢠⣿⡿⠃ ", - " ⠜⠋⢠⣷⢻⣿⣿⣶⣾⣿⣿⣿⣿⠿⣛⣥⣾⣿⠿⠟⠛⠉ ", - "", - "", + "", + "", + " ⢀⣴⡾⠃⠄⠄⠄⠄⠄⠈⠺⠟⠛⠛⠛⠛⠻⢿⣿⣿⣿⣿⣶⣤⡀ ", + " ⢀⣴⣿⡿⠁⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⣸⣿⣿⣿⣿⣿⣿⣿⣷ ", + " ⣴⣿⡿⡟⡼⢹⣷⢲⡶⣖⣾⣶⢄⠄⠄⠄⠄⠄⢀⣼⣿⢿⣿⣿⣿⣿⣿⣿⣿ ", + " ⣾⣿⡟⣾⡸⢠⡿⢳⡿⠍⣼⣿⢏⣿⣷⢄⡀⠄⢠⣾⢻⣿⣸⣿⣿⣿⣿⣿⣿⣿ ", + " ⣡⣿⣿⡟⡼⡁⠁⣰⠂⡾⠉⢨⣿⠃⣿⡿⠍⣾⣟⢤⣿⢇⣿⢇⣿⣿⢿⣿⣿⣿⣿⣿ ", + " ⣱⣿⣿⡟⡐⣰⣧⡷⣿⣴⣧⣤⣼⣯⢸⡿⠁⣰⠟⢀⣼⠏⣲⠏⢸⣿⡟⣿⣿⣿⣿⣿⣿ ", + " ⣿⣿⡟⠁⠄⠟⣁⠄⢡⣿⣿⣿⣿⣿⣿⣦⣼⢟⢀⡼⠃⡹⠃⡀⢸⡿⢸⣿⣿⣿⣿⣿⡟ ", + " ⣿⣿⠃⠄⢀⣾⠋⠓⢰⣿⣿⣿⣿⣿⣿⠿⣿⣿⣾⣅⢔⣕⡇⡇⡼⢁⣿⣿⣿⣿⣿⣿⢣ ", + " ⣿⡟⠄⠄⣾⣇⠷⣢⣿⣿⣿⣿⣿⣿⣿⣭⣀⡈⠙⢿⣿⣿⡇⡧⢁⣾⣿⣿⣿⣿⣿⢏⣾ ", + " ⣿⡇⠄⣼⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⠟⢻⠇⠄⠄⢿⣿⡇⢡⣾⣿⣿⣿⣿⣿⣏⣼⣿ ", + " ⣿⣷⢰⣿⣿⣾⣿⣿⣿⣿⣿⣿⣿⣿⣿⢰⣧⣀⡄⢀⠘⡿⣰⣿⣿⣿⣿⣿⣿⠟⣼⣿⣿ ", + " ⢹⣿⢸⣿⣿⠟⠻⢿⣿⣿⣿⣿⣿⣿⣿⣶⣭⣉⣤⣿⢈⣼⣿⣿⣿⣿⣿⣿⠏⣾⣹⣿⣿ ", + " ⢸⠇⡜⣿⡟⠄⠄⠄⠈⠙⣿⣿⣿⣿⣿⣿⣿⣿⠟⣱⣻⣿⣿⣿⣿⣿⠟⠁⢳⠃⣿⣿⣿ ", + " ⣰⡗⠹⣿⣄⠄⠄⠄⢀⣿⣿⣿⣿⣿⣿⠟⣅⣥⣿⣿⣿⣿⠿⠋ ⣾⡌⢠⣿⡿⠃ ", + " ⠜⠋⢠⣷⢻⣿⣿⣶⣾⣿⣿⣿⣿⠿⣛⣥⣾⣿⠿⠟⠛⠉ ", + "", + "", } M[18] = { - "", - " ⣿⡇⣿⣿⣿⠛⠁⣴⣿⡿⠿⠧⠹⠿⠘⣿⣿⣿⡇⢸⡻⣿⣿⣿⣿⣿⣿⣿ ", - " ⢹⡇⣿⣿⣿⠄⣞⣯⣷⣾⣿⣿⣧⡹⡆⡀⠉⢹⡌⠐⢿⣿⣿⣿⡞⣿⣿⣿ ", - " ⣾⡇⣿⣿⡇⣾⣿⣿⣿⣿⣿⣿⣿⣿⣄⢻⣦⡀⠁⢸⡌⠻⣿⣿⣿⡽⣿⣿ ", - " ⡇⣿⠹⣿⡇⡟⠛⣉⠁⠉⠉⠻⡿⣿⣿⣿⣿⣿⣦⣄⡉⠂⠈⠙⢿⣿⣝⣿ ", - " ⠤⢿⡄⠹⣧⣷⣸⡇⠄⠄⠲⢰⣌⣾⣿⣿⣿⣿⣿⣿⣶⣤⣤⡀⠄⠈⠻⢮ ", - " ⣧⠄⢘⢻⣿⡇⢀⣀⠄⣸⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣧⡀⠄⢀ ", - " ⣿⡆⢸⣿⣿⣿⣬⣭⣴⣿⣿⣿⣿⣿⣿⣿⣯⠝⠛⠛⠙⢿⡿⠃⠄⢸ ", - " ⢿⣿⡀⣿⣿⣿⣾⣿⣿⣿⣿⣿⣿⣿⣿⣿⣷⣿⣿⣿⣿⡾⠁⢠⡇⢀ ", - " ⢸⣿⡇⠻⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣏⣫⣻⡟⢀⠄⣿⣷⣾ ", - " ⢸⣿⡇⠄⠈⠙⠿⣿⣿⣿⣮⣿⣿⣿⣿⣿⣿⣿⣿⡿⢠⠊⢀⡇⣿⣿ ", - " ⣿⡇⢀⡲⠄⠄⠈⠙⠻⢿⣿⣿⠿⠿⠟⠛⠋⠁⣰⠇ ⢸⣿⣿⣿ ", - " ⣿⡇⢬⡻⡇⡄⠄⠄⠄⡰⢖⠔⠉⠄⠄⠄⠄⣼⠏ ⢸⣿⣿⣿ ", - " ⣿⡇⠄⠙⢌⢷⣆⡀⡾⡣⠃⠄⠄⠄⠄⠄⣼⡟ ⢿⣿⣿ ", - "", + "", + " ⣿⡇⣿⣿⣿⠛⠁⣴⣿⡿⠿⠧⠹⠿⠘⣿⣿⣿⡇⢸⡻⣿⣿⣿⣿⣿⣿⣿ ", + " ⢹⡇⣿⣿⣿⠄⣞⣯⣷⣾⣿⣿⣧⡹⡆⡀⠉⢹⡌⠐⢿⣿⣿⣿⡞⣿⣿⣿ ", + " ⣾⡇⣿⣿⡇⣾⣿⣿⣿⣿⣿⣿⣿⣿⣄⢻⣦⡀⠁⢸⡌⠻⣿⣿⣿⡽⣿⣿ ", + " ⡇⣿⠹⣿⡇⡟⠛⣉⠁⠉⠉⠻⡿⣿⣿⣿⣿⣿⣦⣄⡉⠂⠈⠙⢿⣿⣝⣿ ", + " ⠤⢿⡄⠹⣧⣷⣸⡇⠄⠄⠲⢰⣌⣾⣿⣿⣿⣿⣿⣿⣶⣤⣤⡀⠄⠈⠻⢮ ", + " ⣧⠄⢘⢻⣿⡇⢀⣀⠄⣸⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣧⡀⠄⢀ ", + " ⣿⡆⢸⣿⣿⣿⣬⣭⣴⣿⣿⣿⣿⣿⣿⣿⣯⠝⠛⠛⠙⢿⡿⠃⠄⢸ ", + " ⢿⣿⡀⣿⣿⣿⣾⣿⣿⣿⣿⣿⣿⣿⣿⣿⣷⣿⣿⣿⣿⡾⠁⢠⡇⢀ ", + " ⢸⣿⡇⠻⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣏⣫⣻⡟⢀⠄⣿⣷⣾ ", + " ⢸⣿⡇⠄⠈⠙⠿⣿⣿⣿⣮⣿⣿⣿⣿⣿⣿⣿⣿⡿⢠⠊⢀⡇⣿⣿ ", + " ⣿⡇⢀⡲⠄⠄⠈⠙⠻⢿⣿⣿⠿⠿⠟⠛⠋⠁⣰⠇ ⢸⣿⣿⣿ ", + " ⣿⡇⢬⡻⡇⡄⠄⠄⠄⡰⢖⠔⠉⠄⠄⠄⠄⣼⠏ ⢸⣿⣿⣿ ", + " ⣿⡇⠄⠙⢌⢷⣆⡀⡾⡣⠃⠄⠄⠄⠄⠄⣼⡟ ⢿⣿⣿ ", + "", } M[19] = { - "", - " ⢰⣧⣼⣯⠄⣸⣠⣶⣶⣦⣾⠄⠄⠄⠄⡀⠄⢀⣿⣿⠄⠄⠄⢸⡇⠄⠄ ", - " ⣾⣿⠿⠿⠶⠿⢿⣿⣿⣿⣿⣦⣤⣄⢀⡅⢠⣾⣛⡉⠄⠄⠄⠸⢀⣿⠄ ", - " ⢀⡋⣡⣴⣶⣶⡀⠄⠄⠙⢿⣿⣿⣿⣿⣿⣴⣿⣿⣿⢃⣤⣄⣀⣥⣿⣿⠄ ", - " ⢸⣇⠻⣿⣿⣿⣧⣀⢀⣠⡌⢻⣿⣿⣿⣿⣿⣿⣿⣿⣿⠿⠿⠿⣿⣿⣿⠄ ", - " ⢀⢸⣿⣷⣤⣤⣤⣬⣙⣛⢿⣿⣿⣿⣿⣿⣿⡿⣿⣿⡍⠄⠄⢀⣤⣄⠉⠋⣰ ", - " ⣼⣖⣿⣿⣿⣿⣿⣿⣿⣿⣿⢿⣿⣿⣿⣿⣿⢇⣿⣿⡷⠶⠶⢿⣿⣿⠇⢀⣤ ", - " ⠘⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣽⣿⣿⣿⡇⣿⣿⣿⣿⣿⣿⣷⣶⣥⣴⣿⡗ ", - " ⢀⠈⢿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⡟ ", - " ⢸⣿⣦⣌⣛⣻⣿⣿⣧⠙⠛⠛⡭⠅⠒⠦⠭⣭⡻⣿⣿⣿⣿⣿⣿⣿⣿⡿⠃ ", - " ⠘⣿⣿⣿⣿⣿⣿⣿⣿⡆⠄⠄⠄⠄⠄⠄⠄⠄⠹⠈⢋⣽⣿⣿⣿⣿⣵⣾⠃ ", - " ⠘⣿⣿⣿⣿⣿⣿⣿⣿⠄⣴⣿⣶⣄⠄⣴⣶⠄⢀⣾⣿⣿⣿⣿⣿⣿⠃ ", - " ⠈⠻⣿⣿⣿⣿⣿⣿⡄⢻⣿⣿⣿⠄⣿⣿⡀⣾⣿⣿⣿⣿⣛⠛⠁ ", - " ⠈⠛⢿⣿⣿⣿⠁⠞⢿⣿⣿⡄⢿⣿⡇⣸⣿⣿⠿⠛⠁ ", - " ⠉⠻⣿⣿⣾⣦⡙⠻⣷⣾⣿⠃⠿⠋⠁ ⢀⣠⣴ ", - " ⣿⣿⣿⣶⣶⣮⣥⣒⠲⢮⣝⡿⣿⣿⡆⣿⡿⠃⠄⠄⠄⠄⠄⠄⠄⣠⣴⣿⣿⣿ ", - "", + "", + " ⢰⣧⣼⣯⠄⣸⣠⣶⣶⣦⣾⠄⠄⠄⠄⡀⠄⢀⣿⣿⠄⠄⠄⢸⡇⠄⠄ ", + " ⣾⣿⠿⠿⠶⠿⢿⣿⣿⣿⣿⣦⣤⣄⢀⡅⢠⣾⣛⡉⠄⠄⠄⠸⢀⣿⠄ ", + " ⢀⡋⣡⣴⣶⣶⡀⠄⠄⠙⢿⣿⣿⣿⣿⣿⣴⣿⣿⣿⢃⣤⣄⣀⣥⣿⣿⠄ ", + " ⢸⣇⠻⣿⣿⣿⣧⣀⢀⣠⡌⢻⣿⣿⣿⣿⣿⣿⣿⣿⣿⠿⠿⠿⣿⣿⣿⠄ ", + " ⢀⢸⣿⣷⣤⣤⣤⣬⣙⣛⢿⣿⣿⣿⣿⣿⣿⡿⣿⣿⡍⠄⠄⢀⣤⣄⠉⠋⣰ ", + " ⣼⣖⣿⣿⣿⣿⣿⣿⣿⣿⣿⢿⣿⣿⣿⣿⣿⢇⣿⣿⡷⠶⠶⢿⣿⣿⠇⢀⣤ ", + " ⠘⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣽⣿⣿⣿⡇⣿⣿⣿⣿⣿⣿⣷⣶⣥⣴⣿⡗ ", + " ⢀⠈⢿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⡟ ", + " ⢸⣿⣦⣌⣛⣻⣿⣿⣧⠙⠛⠛⡭⠅⠒⠦⠭⣭⡻⣿⣿⣿⣿⣿⣿⣿⣿⡿⠃ ", + " ⠘⣿⣿⣿⣿⣿⣿⣿⣿⡆⠄⠄⠄⠄⠄⠄⠄⠄⠹⠈⢋⣽⣿⣿⣿⣿⣵⣾⠃ ", + " ⠘⣿⣿⣿⣿⣿⣿⣿⣿⠄⣴⣿⣶⣄⠄⣴⣶⠄⢀⣾⣿⣿⣿⣿⣿⣿⠃ ", + " ⠈⠻⣿⣿⣿⣿⣿⣿⡄⢻⣿⣿⣿⠄⣿⣿⡀⣾⣿⣿⣿⣿⣛⠛⠁ ", + " ⠈⠛⢿⣿⣿⣿⠁⠞⢿⣿⣿⡄⢿⣿⡇⣸⣿⣿⠿⠛⠁ ", + " ⠉⠻⣿⣿⣾⣦⡙⠻⣷⣾⣿⠃⠿⠋⠁ ⢀⣠⣴ ", + " ⣿⣿⣿⣶⣶⣮⣥⣒⠲⢮⣝⡿⣿⣿⡆⣿⡿⠃⠄⠄⠄⠄⠄⠄⠄⣠⣴⣿⣿⣿ ", + "", } M[20] = { - "", - " ⣿⢸⣿⣿⣿⣿⣿⢹⣿⣿⣿⣿⣿⢿⣿⡇⡇⣿⣿⡇⢹⣿⣿⣿⣿⣿⣿⠄⢸⣿ ", - " ⡟⢸⣿⣿⣭⣭⡭⣼⣶⣿⣿⣿⣿⢸⣧⣇⠇⢸⣿⣿⠈⣿⣿⣿⣿⣿⣿⡆⠘⣿ ", - " ⡇⢸⣿⣿⣿⣿⡇⣻⡿⣿⣿⡟⣿⢸⣿⣿⠇⡆⣝⠿⡌⣸⣿⣿⣿⣿⣿⡇⠄⣿ ", - " ⢣⢾⣾⣷⣾⣽⣻⣿⣇⣿⣿⣧⣿⢸⣿⣿⡆⢸⣹⣿⣆⢥⢛⡿⣿⣿⣿⡇⠄⣿ ", - " ⣛⡓⣉⠉⠙⠻⢿⣿⣿⣟⣻⠿⣹⡏⣿⣿⣧⢸⣧⣿⣿⣨⡟⣿⣿⣿⣿⡇⠄⣿ ", - " ⠸⣷⣹⣿⠄⠄⠄⠄⠘⢿⣿⣿⣯⣳⣿⣭⣽⢼⣿⣜⣿⣇⣷⡹⣿⣿⣿⠁⢰⣿ ", - " ⢻⣷⣿⡄⢈⠿⠇⢸⣿⣿⣿⣿⣿⣿⣟⠛⠲⢯⣿⣒⡾⣼⣷⡹⣿⣿⠄⣼⣿ ", - " ⡄⢸⣿⣿⣷⣬⣽⣯⣾⣿⣿⣿⣿⣿⣿⣿⣿⡀⠄⢀⠉⠙⠛⠛⠳⠽⠿⢠⣿⣿ ", - " ⡇⣼⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣷⢄⣹⡿⠃⠄⠄⣰⠎⡈⣾⣿⣿ ", - " ⡇⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣾⣭⣽⣖⣄⣴⣯⣾⢷⣿⣿⣿ ", - " ⣧⠸⣿⣿⣿⣿⣿⣿⠯⠊⠙⢻⢿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣏⣾⣿⣿⣿ ", - " ⣿⣦⠹⣿⣿⣿⣿⣿⠄⢀⣴⢾⣼⣻⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⡟⣾⣿⣿⣿⣿ ", - " ⣿⣿⣇⢽⣿⣿⣿⡏⣿⣿⣿⣿⣿⡇⣿⣿⣿⣿⡿⣿⣛⣻⠿⣟⣼⣿⣿⣿⣿⢃ ", - " ⣿⣿⣿⡎⣷⣽⠻⣇⣿⣿⣿⡿⣟⣵⣿⣟⣽⣾⣿⣿⣿⣿⢯⣾⣿⣿⣿⠟⠱⡟ ", - " ⣿⣿⣿⣿⢹⣿⣿⢮⣚⡛⠒⠛⢛⣋⣶⣿⣿⣿⣿⣿⣟⣱⠿⣿⣿⠟⣡⣺⢿ ", - "", + "", + " ⣿⢸⣿⣿⣿⣿⣿⢹⣿⣿⣿⣿⣿⢿⣿⡇⡇⣿⣿⡇⢹⣿⣿⣿⣿⣿⣿⠄⢸⣿ ", + " ⡟⢸⣿⣿⣭⣭⡭⣼⣶⣿⣿⣿⣿⢸⣧⣇⠇⢸⣿⣿⠈⣿⣿⣿⣿⣿⣿⡆⠘⣿ ", + " ⡇⢸⣿⣿⣿⣿⡇⣻⡿⣿⣿⡟⣿⢸⣿⣿⠇⡆⣝⠿⡌⣸⣿⣿⣿⣿⣿⡇⠄⣿ ", + " ⢣⢾⣾⣷⣾⣽⣻⣿⣇⣿⣿⣧⣿⢸⣿⣿⡆⢸⣹⣿⣆⢥⢛⡿⣿⣿⣿⡇⠄⣿ ", + " ⣛⡓⣉⠉⠙⠻⢿⣿⣿⣟⣻⠿⣹⡏⣿⣿⣧⢸⣧⣿⣿⣨⡟⣿⣿⣿⣿⡇⠄⣿ ", + " ⠸⣷⣹⣿⠄⠄⠄⠄⠘⢿⣿⣿⣯⣳⣿⣭⣽⢼⣿⣜⣿⣇⣷⡹⣿⣿⣿⠁⢰⣿ ", + " ⢻⣷⣿⡄⢈⠿⠇⢸⣿⣿⣿⣿⣿⣿⣟⠛⠲⢯⣿⣒⡾⣼⣷⡹⣿⣿⠄⣼⣿ ", + " ⡄⢸⣿⣿⣷⣬⣽⣯⣾⣿⣿⣿⣿⣿⣿⣿⣿⡀⠄⢀⠉⠙⠛⠛⠳⠽⠿⢠⣿⣿ ", + " ⡇⣼⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣷⢄⣹⡿⠃⠄⠄⣰⠎⡈⣾⣿⣿ ", + " ⡇⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣾⣭⣽⣖⣄⣴⣯⣾⢷⣿⣿⣿ ", + " ⣧⠸⣿⣿⣿⣿⣿⣿⠯⠊⠙⢻⢿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣏⣾⣿⣿⣿ ", + " ⣿⣦⠹⣿⣿⣿⣿⣿⠄⢀⣴⢾⣼⣻⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⡟⣾⣿⣿⣿⣿ ", + " ⣿⣿⣇⢽⣿⣿⣿⡏⣿⣿⣿⣿⣿⡇⣿⣿⣿⣿⡿⣿⣛⣻⠿⣟⣼⣿⣿⣿⣿⢃ ", + " ⣿⣿⣿⡎⣷⣽⠻⣇⣿⣿⣿⡿⣟⣵⣿⣟⣽⣾⣿⣿⣿⣿⢯⣾⣿⣿⣿⠟⠱⡟ ", + " ⣿⣿⣿⣿⢹⣿⣿⢮⣚⡛⠒⠛⢛⣋⣶⣿⣿⣿⣿⣿⣟⣱⠿⣿⣿⠟⣡⣺⢿ ", + "", } M[21] = { - "", - " ⣇⣿⠘⣿⣿⣿⡿⡿⣟⣟⢟⢟⢝⠵⡝⣿⡿⢂⣼⣿⣷⣌⠩⡫⡻⣝⠹⢿⣿⣷ ", - " ⡆⣿⣆⠱⣝⡵⣝⢅⠙⣿⢕⢕⢕⢕⢝⣥⢒⠅⣿⣿⣿⡿⣳⣌⠪⡪⣡⢑⢝⣇ ", - " ⡆⣿⣿⣦⠹⣳⣳⣕⢅⠈⢗⢕⢕⢕⢕⢕⢈⢆⠟⠋⠉⠁⠉⠉⠁⠈⠼⢐⢕⢽ ", - " ⡗⢰⣶⣶⣦⣝⢝⢕⢕⠅⡆⢕⢕⢕⢕⢕⣴⠏⣠⡶⠛⡉⡉⡛⢶⣦⡀⠐⣕⢕ ", - " ⡝⡄⢻⢟⣿⣿⣷⣕⣕⣅⣿⣔⣕⣵⣵⣿⣿⢠⣿⢠⣮⡈⣌⠨⠅⠹⣷⡀⢱⢕ ", - " ⡝⡵⠟⠈⢀⣀⣀⡀⠉⢿⣿⣿⣿⣿⣿⣿⣿⣼⣿⢈⡋⠴⢿⡟⣡⡇⣿⡇⡀⢕ ", - " ⡝⠁⣠⣾⠟⡉⡉⡉⠻⣦⣻⣿⣿⣿⣿⣿⣿⣿⣿⣧⠸⣿⣦⣥⣿⡇⡿⣰⢗⢄ ", - " ⠁⢰⣿⡏⣴⣌⠈⣌⠡⠈⢻⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣬⣉⣉⣁⣄⢖⢕⢕⢕ ", - " ⡀⢻⣿⡇⢙⠁⠴⢿⡟⣡⡆⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣷⣵⣵⣿ ", - " ⡻⣄⣻⣿⣌⠘⢿⣷⣥⣿⠇⣿⣿⣿⣿⣿⣿⠛⠻⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿ ", - " ⣷⢄⠻⣿⣟⠿⠦⠍⠉⣡⣾⣿⣿⣿⣿⣿⣿⢸⣿⣦⠙⣿⣿⣿⣿⣿⣿⣿⣿⠟ ", - " ⡕⡑⣑⣈⣻⢗⢟⢞⢝⣻⣿⣿⣿⣿⣿⣿⣿⠸⣿⠿⠃⣿⣿⣿⣿⣿⣿⡿⠁⣠ ", - " ⡝⡵⡈⢟⢕⢕⢕⢕⣵⣿⣿⣿⣿⣿⣿⣿⣿⣿⣶⣶⣿⣿⣿⣿⣿⠿⠋⣀⣈⠙ ", - " ⡝⡵⡕⡀⠑⠳⠿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⠿⠛⢉⡠⡲⡫⡪⡪⡣ ", - "", + "", + " ⣇⣿⠘⣿⣿⣿⡿⡿⣟⣟⢟⢟⢝⠵⡝⣿⡿⢂⣼⣿⣷⣌⠩⡫⡻⣝⠹⢿⣿⣷ ", + " ⡆⣿⣆⠱⣝⡵⣝⢅⠙⣿⢕⢕⢕⢕⢝⣥⢒⠅⣿⣿⣿⡿⣳⣌⠪⡪⣡⢑⢝⣇ ", + " ⡆⣿⣿⣦⠹⣳⣳⣕⢅⠈⢗⢕⢕⢕⢕⢕⢈⢆⠟⠋⠉⠁⠉⠉⠁⠈⠼⢐⢕⢽ ", + " ⡗⢰⣶⣶⣦⣝⢝⢕⢕⠅⡆⢕⢕⢕⢕⢕⣴⠏⣠⡶⠛⡉⡉⡛⢶⣦⡀⠐⣕⢕ ", + " ⡝⡄⢻⢟⣿⣿⣷⣕⣕⣅⣿⣔⣕⣵⣵⣿⣿⢠⣿⢠⣮⡈⣌⠨⠅⠹⣷⡀⢱⢕ ", + " ⡝⡵⠟⠈⢀⣀⣀⡀⠉⢿⣿⣿⣿⣿⣿⣿⣿⣼⣿⢈⡋⠴⢿⡟⣡⡇⣿⡇⡀⢕ ", + " ⡝⠁⣠⣾⠟⡉⡉⡉⠻⣦⣻⣿⣿⣿⣿⣿⣿⣿⣿⣧⠸⣿⣦⣥⣿⡇⡿⣰⢗⢄ ", + " ⠁⢰⣿⡏⣴⣌⠈⣌⠡⠈⢻⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣬⣉⣉⣁⣄⢖⢕⢕⢕ ", + " ⡀⢻⣿⡇⢙⠁⠴⢿⡟⣡⡆⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣷⣵⣵⣿ ", + " ⡻⣄⣻⣿⣌⠘⢿⣷⣥⣿⠇⣿⣿⣿⣿⣿⣿⠛⠻⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿ ", + " ⣷⢄⠻⣿⣟⠿⠦⠍⠉⣡⣾⣿⣿⣿⣿⣿⣿⢸⣿⣦⠙⣿⣿⣿⣿⣿⣿⣿⣿⠟ ", + " ⡕⡑⣑⣈⣻⢗⢟⢞⢝⣻⣿⣿⣿⣿⣿⣿⣿⠸⣿⠿⠃⣿⣿⣿⣿⣿⣿⡿⠁⣠ ", + " ⡝⡵⡈⢟⢕⢕⢕⢕⣵⣿⣿⣿⣿⣿⣿⣿⣿⣿⣶⣶⣿⣿⣿⣿⣿⠿⠋⣀⣈⠙ ", + " ⡝⡵⡕⡀⠑⠳⠿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⠿⠛⢉⡠⡲⡫⡪⡪⡣ ", + "", } M[22] = { - "", - " ⣿⣿⣷⡁⢆⠈⠕⢕⢂⢕⢂⢕⢂⢔⢂⢕⢄⠂⣂⠂⠆⢂⢕⢂⢕⢂⢕⢂⢕⢂ ", - " ⣿⣿⣿⡷⠊⡢⡹⣦⡑⢂⢕⢂⢕⢂⢕⢂⠕⠔⠌⠝⠛⠶⠶⢶⣦⣄⢂⢕⢂⢕ ", - " ⣿⣿⠏⣠⣾⣦⡐⢌⢿⣷⣦⣅⡑⠕⠡⠐⢿⠿⣛⠟⠛⠛⠛⠛⠡⢷⡈⢂⢕⢂ ", - " ⠟⣡⣾⣿⣿⣿⣿⣦⣑⠝⢿⣿⣿⣿⣿⣿⡵⢁⣤⣶⣶⣿⢿⢿⢿⡟⢻⣤⢑⢂ ", - " ⣾⣿⣿⡿⢟⣛⣻⣿⣿⣿⣦⣬⣙⣻⣿⣿⣷⣿⣿⢟⢝⢕⢕⢕⢕⢽⣿⣿⣷⣔ ", - " ⣿⣿⠵⠚⠉⢀⣀⣀⣈⣿⣿⣿⣿⣿⣿⣿⣿⣿⣗⢕⢕⢕⢕⢕⢕⣽⣿⣿⣿⣿ ", - " ⢷⣂⣠⣴⣾⡿⡿⡻⡻⣿⣿⣴⣿⣿⣿⣿⣿⣿⣷⣵⣵⣵⣷⣿⣿⣿⣿⣿⣿⡿ ", - " ⢌⠻⣿⡿⡫⡪⡪⡪⡪⣺⣿⣿⣿⣿⣿⠿⠿⢿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⠃ ", - " ⠣⡁⠹⡪⡪⡪⡪⣪⣾⣿⣿⣿⣿⠋⠐⢉⢍⢄⢌⠻⣿⣿⣿⣿⣿⣿⣿⣿⠏⠈ ", - " ⡣⡘⢄⠙⣾⣾⣾⣿⣿⣿⣿⣿⣿⡀⢐⢕⢕⢕⢕⢕⡘⣿⣿⣿⣿⣿⣿⠏⠠⠈ ", - " ⠌⢊⢂⢣⠹⣿⣿⣿⣿⣿⣿⣿⣿⣧⢐⢕⢕⢕⢕⢕⢅⣿⣿⣿⣿⡿⢋⢜⠠⠈ ", - " ⠄⠁⠕⢝⡢⠈⠻⣿⣿⣿⣿⣿⣿⣿⣷⣕⣑⣑⣑⣵⣿⣿⣿⡿⢋⢔⢕⣿⠠⠈ ", - " ⠨⡂⡀⢑⢕⡅⠂⠄⠉⠛⠻⠿⢿⣿⣿⣿⣿⣿⣿⣿⣿⡿⢋⢔⢕⢕⣿⣿⠠⠈ ", - " ⠄⠪⣂⠁⢕⠆⠄⠂⠄⠁⡀⠂⡀⠄⢈⠉⢍⢛⢛⢛⢋⢔⢕⢕⢕⣽⣿⣿⠠⠈ ", - "", + "", + " ⣿⣿⣷⡁⢆⠈⠕⢕⢂⢕⢂⢕⢂⢔⢂⢕⢄⠂⣂⠂⠆⢂⢕⢂⢕⢂⢕⢂⢕⢂ ", + " ⣿⣿⣿⡷⠊⡢⡹⣦⡑⢂⢕⢂⢕⢂⢕⢂⠕⠔⠌⠝⠛⠶⠶⢶⣦⣄⢂⢕⢂⢕ ", + " ⣿⣿⠏⣠⣾⣦⡐⢌⢿⣷⣦⣅⡑⠕⠡⠐⢿⠿⣛⠟⠛⠛⠛⠛⠡⢷⡈⢂⢕⢂ ", + " ⠟⣡⣾⣿⣿⣿⣿⣦⣑⠝⢿⣿⣿⣿⣿⣿⡵⢁⣤⣶⣶⣿⢿⢿⢿⡟⢻⣤⢑⢂ ", + " ⣾⣿⣿⡿⢟⣛⣻⣿⣿⣿⣦⣬⣙⣻⣿⣿⣷⣿⣿⢟⢝⢕⢕⢕⢕⢽⣿⣿⣷⣔ ", + " ⣿⣿⠵⠚⠉⢀⣀⣀⣈⣿⣿⣿⣿⣿⣿⣿⣿⣿⣗⢕⢕⢕⢕⢕⢕⣽⣿⣿⣿⣿ ", + " ⢷⣂⣠⣴⣾⡿⡿⡻⡻⣿⣿⣴⣿⣿⣿⣿⣿⣿⣷⣵⣵⣵⣷⣿⣿⣿⣿⣿⣿⡿ ", + " ⢌⠻⣿⡿⡫⡪⡪⡪⡪⣺⣿⣿⣿⣿⣿⠿⠿⢿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⠃ ", + " ⠣⡁⠹⡪⡪⡪⡪⣪⣾⣿⣿⣿⣿⠋⠐⢉⢍⢄⢌⠻⣿⣿⣿⣿⣿⣿⣿⣿⠏⠈ ", + " ⡣⡘⢄⠙⣾⣾⣾⣿⣿⣿⣿⣿⣿⡀⢐⢕⢕⢕⢕⢕⡘⣿⣿⣿⣿⣿⣿⠏⠠⠈ ", + " ⠌⢊⢂⢣⠹⣿⣿⣿⣿⣿⣿⣿⣿⣧⢐⢕⢕⢕⢕⢕⢅⣿⣿⣿⣿⡿⢋⢜⠠⠈ ", + " ⠄⠁⠕⢝⡢⠈⠻⣿⣿⣿⣿⣿⣿⣿⣷⣕⣑⣑⣑⣵⣿⣿⣿⡿⢋⢔⢕⣿⠠⠈ ", + " ⠨⡂⡀⢑⢕⡅⠂⠄⠉⠛⠻⠿⢿⣿⣿⣿⣿⣿⣿⣿⣿⡿⢋⢔⢕⢕⣿⣿⠠⠈ ", + " ⠄⠪⣂⠁⢕⠆⠄⠂⠄⠁⡀⠂⡀⠄⢈⠉⢍⢛⢛⢛⢋⢔⢕⢕⢕⣽⣿⣿⠠⠈ ", + "", } M[23] = { - "", - "⠀⠀⠀⠀⠀⠀⠀⡀⠀⠀⣀⣀⣀⡀⠀⢀⡀⠀⢀⣀⣀⣀⠀⡀⠀⠀⠀⠀⠀⠀", - "⠀⠀⠀⠀⠀⣠⣎⣀⣀⣠⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣶⡄⠀⠀⠀⠀", - "⠀⠀⠀⠀⣰⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣆⠀⠀⠀", - "⠀⠀⠀⢰⣿⣿⣿⣿⣿⣿⣿⣿⣿⡿⡿⠏⠿⠿⠿⠿⠿⣿⣿⣿⣿⣿⣿⡆⠀⠀", - "⠀⠀⠀⣿⣿⣿⣿⣿⣿⡿⢿⠋⠉⠀⠀⠀⠀⠀⡀⠀⠀⠘⢿⣿⣿⣿⣿⣧⠀⠀", - "⠀⠀⢰⣿⣿⣿⣿⠟⢁⠀⠀⠀⠀⠀⠀⠀⠀⠀⠇⠀⠀⡈⠀⠻⣿⣿⣿⣿⠀⠀", - "⠀⠀⣼⣿⣿⡿⠁⠀⢸⠀⠈⢳⣶⣤⣄⠀⠈⠀⠁⠀⠀⠀⢀⠀⠹⣿⣿⡟⠀⠀", - "⠀⠀⣿⣿⣿⠀⠀⠈⣼⡇⠀⠘⠻⠟⠁⠀⠀⠀⠀⢤⣀⡀⠌⠀⠀⣿⣿⠃⠀⠀", - "⠀⠀⣿⣿⣿⡀⠀⠀⡏⡇⠀⠀⠀⠀⠀⠀⠀⠀⠀⠸⣿⡿⠋⢰⢠⣿⡏⠀⠀⠀", - "⠀⠀⣿⣿⣿⡇⠀⠀⢷⡃⠀⠀⢀⡀⠀⠀⠀⠀⠀⠀⠀⠀⣴⣯⣾⡟⠀⠀⠀⠀", - "⠀⠀⣿⣿⣿⡿⠀⠀⣼⣿⡄⠀⠈⠀⢑⠶⠀⠀⠀⠀⢀⣾⣿⣿⣿⡇⠀⠀⠀⠀", - "⠀⠀⣿⣿⣿⠁⠀⠀⣿⣿⠁⠀⠀⠀⢀⣀⣠⣤⣤⣴⠟⣿⣿⣿⣿⡇⠀⠀⠀⠀", - "⠀⠀⠙⢿⠃⠀⠀⢸⣿⣟⠀⠀⢀⣤⣾⣿⣿⣿⠟⠁⢰⣿⣿⣿⣿⠃⠀⠀⠀⠀", - "⠀⠀⠠⠴⠀⠀⠀⠿⠿⠿⠧⠾⠿⠿⠿⠿⠿⠃⠀⠀⠾⠿⠿⠟⠁⠀ ", - "", + "", + "⠀⠀⠀⠀⠀⠀⠀⡀⠀⠀⣀⣀⣀⡀⠀⢀⡀⠀⢀⣀⣀⣀⠀⡀⠀⠀⠀⠀⠀⠀", + "⠀⠀⠀⠀⠀⣠⣎⣀⣀⣠⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣶⡄⠀⠀⠀⠀", + "⠀⠀⠀⠀⣰⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣆⠀⠀⠀", + "⠀⠀⠀⢰⣿⣿⣿⣿⣿⣿⣿⣿⣿⡿⡿⠏⠿⠿⠿⠿⠿⣿⣿⣿⣿⣿⣿⡆⠀⠀", + "⠀⠀⠀⣿⣿⣿⣿⣿⣿⡿⢿⠋⠉⠀⠀⠀⠀⠀⡀⠀⠀⠘⢿⣿⣿⣿⣿⣧⠀⠀", + "⠀⠀⢰⣿⣿⣿⣿⠟⢁⠀⠀⠀⠀⠀⠀⠀⠀⠀⠇⠀⠀⡈⠀⠻⣿⣿⣿⣿⠀⠀", + "⠀⠀⣼⣿⣿⡿⠁⠀⢸⠀⠈⢳⣶⣤⣄⠀⠈⠀⠁⠀⠀⠀⢀⠀⠹⣿⣿⡟⠀⠀", + "⠀⠀⣿⣿⣿⠀⠀⠈⣼⡇⠀⠘⠻⠟⠁⠀⠀⠀⠀⢤⣀⡀⠌⠀⠀⣿⣿⠃⠀⠀", + "⠀⠀⣿⣿⣿⡀⠀⠀⡏⡇⠀⠀⠀⠀⠀⠀⠀⠀⠀⠸⣿⡿⠋⢰⢠⣿⡏⠀⠀⠀", + "⠀⠀⣿⣿⣿⡇⠀⠀⢷⡃⠀⠀⢀⡀⠀⠀⠀⠀⠀⠀⠀⠀⣴⣯⣾⡟⠀⠀⠀⠀", + "⠀⠀⣿⣿⣿⡿⠀⠀⣼⣿⡄⠀⠈⠀⢑⠶⠀⠀⠀⠀⢀⣾⣿⣿⣿⡇⠀⠀⠀⠀", + "⠀⠀⣿⣿⣿⠁⠀⠀⣿⣿⠁⠀⠀⠀⢀⣀⣠⣤⣤⣴⠟⣿⣿⣿⣿⡇⠀⠀⠀⠀", + "⠀⠀⠙⢿⠃⠀⠀⢸⣿⣟⠀⠀⢀⣤⣾⣿⣿⣿⠟⠁⢰⣿⣿⣿⣿⠃⠀⠀⠀⠀", + "⠀⠀⠠⠴⠀⠀⠀⠿⠿⠿⠧⠾⠿⠿⠿⠿⠿⠃⠀⠀⠾⠿⠿⠟⠁⠀ ", + "", } M[24] = { - "", - "⣿⣯⣿⣟⣟⡼⣿⡼⡿⣷⣿⣿⣿⠽⡟⢋⣿⣿⠘⣼⣷⡟⠻⡿⣷⡼⣝⡿⡾⣿", - "⣿⣿⣿⣿⢁⣵⡇⡟⠀⣿⣿⣿⠇⠀⡇⣴⣿⣿⣧⣿⣿⡇⠀⢣⣿⣷⣀⡏⢻⣿", - "⣿⣿⠿⣿⣿⣿⠷⠁⠀⠛⠛⠋⠀⠂⠹⠿⠿⠿⠿⠿⠉⠁⠀⠘⠛⠛⠛⠃⢸⣯", - "⣿⡇⠀⣄⣀⣀⣈⣁⠈⠉⠃⠀⠀⠀⠀⠀⠀⠀⠀⠠⠎⠈⠀⣀⣁⣀⣀⡠⠈⠉", - "⣿⣯⣽⡿⢟⡿⠿⠛⠛⠿⣶⣄⠀⠀⠀⠀⠀⠀⠈⢠⣴⣾⠛⠛⠿⠻⠛⠿⣷⣶", - "⣿⣿⣿⠀⠀⠀⣿⡿⣶⣿⣫⠉⠀⠀⠀⠀⠀⠀⠀⠈⠰⣿⠿⠾⣿⡇⠀⠀⢺⣿", - "⣿⣿⠻⡀⠀⠀⠙⠏⠒⡻⠃⠀⠀⠀⠀⣀⠀⠀⠀⠀⠀⠐⡓⢚⠟⠁⠀⠀⡾⢫", - "⣿⣿⠀⠀⡀⠀⠀⡈⣉⡀⡠⣐⣅⣽⣺⣿⣯⡡⣴⣴⣔⣠⣀⣀⡀⢀⡀⡀⠀⣸", - "⣿⣿⣷⣿⣟⣿⡿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⢻⢾⣷⣿", - "⣿⣿⣟⠫⡾⠟⠫⢾⠯⡻⢟⡽⢶⢿⣿⣿⡛⠕⠎⠻⠝⠪⢖⠝⠟⢫⠾⠜⢿⣿", - "⣿⣿⣿⠉⠀⠀⠀⠀⠈⠀⠀⠀⠀⣰⣋⣀⣈⣢⠀⠀⠀⠀⠀⠀⠀⠀⠀⣐⢸⣿", - "⣿⣿⣿⣆⠀⠀⠀⠀⠀⠀⠀⠀⢰⣿⣿⣿⣿⣿⣧⠀⠀⠀⠀⠀⠀⠀⠀⢀⣾⣿", - "⣿⣿⣿⣿⣦⡔⠀⠀⠀⠀⠀⠀⢻⣿⡿⣿⣿⢽⣿⠀⠀⠀⠀⠀⠀⠀⣠⣾⣿⣿", - "⣿⣿⣿⣿⣿⣿⣶⣤⣀⠀⠀⠀⠘⠛⢅⣙⣙⠿⠉⠀⠀⠀⢀⣠⣴⣿⣿⣿⣿⣿", - "⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣶⣤⣄⣅⠀⠓⠀⠀⣀⣠⣴⣺⣿⣿⣿⣿⣿⣿⣿⣿", - "", + "", + "⣿⣯⣿⣟⣟⡼⣿⡼⡿⣷⣿⣿⣿⠽⡟⢋⣿⣿⠘⣼⣷⡟⠻⡿⣷⡼⣝⡿⡾⣿", + "⣿⣿⣿⣿⢁⣵⡇⡟⠀⣿⣿⣿⠇⠀⡇⣴⣿⣿⣧⣿⣿⡇⠀⢣⣿⣷⣀⡏⢻⣿", + "⣿⣿⠿⣿⣿⣿⠷⠁⠀⠛⠛⠋⠀⠂⠹⠿⠿⠿⠿⠿⠉⠁⠀⠘⠛⠛⠛⠃⢸⣯", + "⣿⡇⠀⣄⣀⣀⣈⣁⠈⠉⠃⠀⠀⠀⠀⠀⠀⠀⠀⠠⠎⠈⠀⣀⣁⣀⣀⡠⠈⠉", + "⣿⣯⣽⡿⢟⡿⠿⠛⠛⠿⣶⣄⠀⠀⠀⠀⠀⠀⠈⢠⣴⣾⠛⠛⠿⠻⠛⠿⣷⣶", + "⣿⣿⣿⠀⠀⠀⣿⡿⣶⣿⣫⠉⠀⠀⠀⠀⠀⠀⠀⠈⠰⣿⠿⠾⣿⡇⠀⠀⢺⣿", + "⣿⣿⠻⡀⠀⠀⠙⠏⠒⡻⠃⠀⠀⠀⠀⣀⠀⠀⠀⠀⠀⠐⡓⢚⠟⠁⠀⠀⡾⢫", + "⣿⣿⠀⠀⡀⠀⠀⡈⣉⡀⡠⣐⣅⣽⣺⣿⣯⡡⣴⣴⣔⣠⣀⣀⡀⢀⡀⡀⠀⣸", + "⣿⣿⣷⣿⣟⣿⡿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⢻⢾⣷⣿", + "⣿⣿⣟⠫⡾⠟⠫⢾⠯⡻⢟⡽⢶⢿⣿⣿⡛⠕⠎⠻⠝⠪⢖⠝⠟⢫⠾⠜⢿⣿", + "⣿⣿⣿⠉⠀⠀⠀⠀⠈⠀⠀⠀⠀⣰⣋⣀⣈⣢⠀⠀⠀⠀⠀⠀⠀⠀⠀⣐⢸⣿", + "⣿⣿⣿⣆⠀⠀⠀⠀⠀⠀⠀⠀⢰⣿⣿⣿⣿⣿⣧⠀⠀⠀⠀⠀⠀⠀⠀⢀⣾⣿", + "⣿⣿⣿⣿⣦⡔⠀⠀⠀⠀⠀⠀⢻⣿⡿⣿⣿⢽⣿⠀⠀⠀⠀⠀⠀⠀⣠⣾⣿⣿", + "⣿⣿⣿⣿⣿⣿⣶⣤⣀⠀⠀⠀⠘⠛⢅⣙⣙⠿⠉⠀⠀⠀⢀⣠⣴⣿⣿⣿⣿⣿", + "⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣶⣤⣄⣅⠀⠓⠀⠀⣀⣠⣴⣺⣿⣿⣿⣿⣿⣿⣿⣿", + "", } M[25] = { - "", - " ⡿⠉⠄⠄⠄⠄⠈⠙⠿⠟⠛⠉⠉⠉⠄⠄⠄⠈⠉⠉⠉⠛⠛⠻⢿⣿⣿⣿⣿⣿ ", - " ⠁⠄⠄⠄⢀⡴⣋⣵⣮⠇⡀⠄⠄⠄⠄⠄⠄⢀⠄⠄⠄⡀⠄⠄⠄⠈⠛⠿⠋⠉ ", - " ⠄⠄⠄⢠⣯⣾⣿⡿⣳⡟⣰⣿⣠⣂⡀⢀⠄⢸⡄⠄⢀⣈⢆⣱⣤⡀⢄⠄⠄⠄ ", - " ⠄⠄⠄⣼⣿⣿⡟⣹⡿⣸⣿⢳⣿⣿⣿⣿⣴⣾⢻⣆⣿⣿⣯⢿⣿⣿⣷⣧⣀⣤ ", - " ⠄⠄⣼⡟⣿⠏⢀⣿⣇⣿⣏⣿⣿⣿⣿⣿⣿⣿⢸⡇⣿⣿⣿⣟⣿⣿⣿⣿⣏⠋ ", - " ⡆⣸⡟⣼⣯⠏⣾⣿⢸⣿⢸⣿⣿⣿⣿⣿⣿⡟⠸⠁⢹⡿⣿⣿⢻⣿⣿⣿⣿⠄ ", - " ⡇⡟⣸⢟⣫⡅⣶⢆⡶⡆⣿⣿⣿⣿⣿⢿⣛⠃⠰⠆⠈⠁⠈⠙⠈⠻⣿⢹⡏⠄ ", - " ⣧⣱⡷⣱⠿⠟⠛⠼⣇⠇⣿⣿⣿⣿⣿⣿⠃⣰⣿⣿⡆⠄⠄⠄⠄⠄⠉⠈⠄⠄ ", - " ⡏⡟⢑⠃⡠⠂⠄⠄⠈⣾⢻⣿⣿⡿⡹⡳⠋⠉⠁⠉⠙⠄⢀⠄⠄⠄⠄⠄⠂⠄ ", - " ⡇⠁⢈⢰⡇⠄⠄⡙⠂⣿⣿⣿⣿⣱⣿⡗⠄⠄⠄⢀⡀⠄⠈⢰⠄⠄⠄⠐⠄⠄ ", - " ⠄⠄⠘⣿⣧⠴⣄⣡⢄⣿⣿⣿⣷⣿⣿⡇⢀⠄⠤⠈⠁⣠⣠⣸⢠⠄⠄⠄⠄⠄ ", - " ⢀⠄⠄⣿⣿⣷⣬⣵⣿⣿⣿⣿⣿⣿⣿⣷⣟⢷⡶⢗⡰⣿⣿⠇⠘⠄⠄⠄⠄⠄ ", - " ⣿⠄⠄⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣷⣶⣾⣿⣿⡟⢀⠃⠄⢸⡄⠁⣸ ", - " ⣿⠄⠄⠘⢿⣿⣿⣿⣿⣿⣿⢛⣿⣿⣿⣿⣿⣿⣿⣿⣿⣟⢄⡆⠄⢀⣪⡆⠄⣿ ", - " ⡟⠄⠄⠄⠄⣾⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⡿⢿⣟⣻⣩⣾⣃⣴⣿⣿⡇⠸⢾ ", - "", + "", + " ⡿⠉⠄⠄⠄⠄⠈⠙⠿⠟⠛⠉⠉⠉⠄⠄⠄⠈⠉⠉⠉⠛⠛⠻⢿⣿⣿⣿⣿⣿ ", + " ⠁⠄⠄⠄⢀⡴⣋⣵⣮⠇⡀⠄⠄⠄⠄⠄⠄⢀⠄⠄⠄⡀⠄⠄⠄⠈⠛⠿⠋⠉ ", + " ⠄⠄⠄⢠⣯⣾⣿⡿⣳⡟⣰⣿⣠⣂⡀⢀⠄⢸⡄⠄⢀⣈⢆⣱⣤⡀⢄⠄⠄⠄ ", + " ⠄⠄⠄⣼⣿⣿⡟⣹⡿⣸⣿⢳⣿⣿⣿⣿⣴⣾⢻⣆⣿⣿⣯⢿⣿⣿⣷⣧⣀⣤ ", + " ⠄⠄⣼⡟⣿⠏⢀⣿⣇⣿⣏⣿⣿⣿⣿⣿⣿⣿⢸⡇⣿⣿⣿⣟⣿⣿⣿⣿⣏⠋ ", + " ⡆⣸⡟⣼⣯⠏⣾⣿⢸⣿⢸⣿⣿⣿⣿⣿⣿⡟⠸⠁⢹⡿⣿⣿⢻⣿⣿⣿⣿⠄ ", + " ⡇⡟⣸⢟⣫⡅⣶⢆⡶⡆⣿⣿⣿⣿⣿⢿⣛⠃⠰⠆⠈⠁⠈⠙⠈⠻⣿⢹⡏⠄ ", + " ⣧⣱⡷⣱⠿⠟⠛⠼⣇⠇⣿⣿⣿⣿⣿⣿⠃⣰⣿⣿⡆⠄⠄⠄⠄⠄⠉⠈⠄⠄ ", + " ⡏⡟⢑⠃⡠⠂⠄⠄⠈⣾⢻⣿⣿⡿⡹⡳⠋⠉⠁⠉⠙⠄⢀⠄⠄⠄⠄⠄⠂⠄ ", + " ⡇⠁⢈⢰⡇⠄⠄⡙⠂⣿⣿⣿⣿⣱⣿⡗⠄⠄⠄⢀⡀⠄⠈⢰⠄⠄⠄⠐⠄⠄ ", + " ⠄⠄⠘⣿⣧⠴⣄⣡⢄⣿⣿⣿⣷⣿⣿⡇⢀⠄⠤⠈⠁⣠⣠⣸⢠⠄⠄⠄⠄⠄ ", + " ⢀⠄⠄⣿⣿⣷⣬⣵⣿⣿⣿⣿⣿⣿⣿⣷⣟⢷⡶⢗⡰⣿⣿⠇⠘⠄⠄⠄⠄⠄ ", + " ⣿⠄⠄⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣷⣶⣾⣿⣿⡟⢀⠃⠄⢸⡄⠁⣸ ", + " ⣿⠄⠄⠘⢿⣿⣿⣿⣿⣿⣿⢛⣿⣿⣿⣿⣿⣿⣿⣿⣿⣟⢄⡆⠄⢀⣪⡆⠄⣿ ", + " ⡟⠄⠄⠄⠄⣾⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⡿⢿⣟⣻⣩⣾⣃⣴⣿⣿⡇⠸⢾ ", + "", } M[26] = { - "", - "⡆⣐⢕⢕⢕⢕⢕⢕⢕⢕⠅⢗⢕⢕⢕⢕⢕⢕⢕⠕⠕⢕⢕⢕⢕⢕⢕⢕⢕⢕", - "⢐⢕⢕⢕⢕⢕⣕⢕⢕⠕⠁⢕⢕⢕⢕⢕⢕⢕⢕⠅⡄⢕⢕⢕⢕⢕⢕⢕⢕⢕", - "⢕⢕⢕⢕⢕⠅⢗⢕⠕⣠⠄⣗⢕⢕⠕⢕⢕⢕⠕⢠⣿⠐⢕⢕⢕⠑⢕⢕⠵⢕", - "⢕⢕⢕⢕⠁⢜⠕⢁⣴⣿⡇⢓⢕⢵⢐⢕⢕⠕⢁⣾⢿⣧⠑⢕⢕⠄⢑⢕⠅⢕", - "⢕⢕⠵⢁⠔⢁⣤⣤⣶⣶⣶⡐⣕⢽⠐⢕⠕⣡⣾⣶⣶⣶⣤⡁⢓⢕⠄⢑⢅⢑", - "⠍⣧⠄⣶⣾⣿⣿⣿⣿⣿⣿⣷⣔⢕⢄⢡⣾⣿⣿⣿⣿⣿⣿⣿⣦⡑⢕⢤⠱⢐", - "⢠⢕⠅⣾⣿⠋⢿⣿⣿⣿⠉⣿⣿⣷⣦⣶⣽⣿⣿⠈⣿⣿⣿⣿⠏⢹⣷⣷⡅⢐", - "⣔⢕⢥⢻⣿⡀⠈⠛⠛⠁⢠⣿⣿⣿⣿⣿⣿⣿⣿⡀⠈⠛⠛⠁⠄⣼⣿⣿⡇⢔", - "⢕⢕⢽⢸⢟⢟⢖⢖⢤⣶⡟⢻⣿⡿⠻⣿⣿⡟⢀⣿⣦⢤⢤⢔⢞⢿⢿⣿⠁⢕", - "⢕⢕⠅⣐⢕⢕⢕⢕⢕⣿⣿⡄⠛⢀⣦⠈⠛⢁⣼⣿⢗⢕⢕⢕⢕⢕⢕⡏⣘⢕", - "⢕⢕⠅⢓⣕⣕⣕⣕⣵⣿⣿⣿⣾⣿⣿⣿⣿⣿⣿⣿⣷⣕⢕⢕⢕⢕⡵⢀⢕⢕", - "⢑⢕⠃⡈⢿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⢃⢕⢕⢕", - "⣆⢕⠄⢱⣄⠛⢿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⠿⢁⢕⢕⠕⢁", - "⣿⣦⡀⣿⣿⣷⣶⣬⣍⣛⣛⣛⡛⠿⠿⠿⠛⠛⢛⣛⣉⣭⣤⣂⢜⠕⢑⣡⣴⣿", - "", + "", + "⡆⣐⢕⢕⢕⢕⢕⢕⢕⢕⠅⢗⢕⢕⢕⢕⢕⢕⢕⠕⠕⢕⢕⢕⢕⢕⢕⢕⢕⢕", + "⢐⢕⢕⢕⢕⢕⣕⢕⢕⠕⠁⢕⢕⢕⢕⢕⢕⢕⢕⠅⡄⢕⢕⢕⢕⢕⢕⢕⢕⢕", + "⢕⢕⢕⢕⢕⠅⢗⢕⠕⣠⠄⣗⢕⢕⠕⢕⢕⢕⠕⢠⣿⠐⢕⢕⢕⠑⢕⢕⠵⢕", + "⢕⢕⢕⢕⠁⢜⠕⢁⣴⣿⡇⢓⢕⢵⢐⢕⢕⠕⢁⣾⢿⣧⠑⢕⢕⠄⢑⢕⠅⢕", + "⢕⢕⠵⢁⠔⢁⣤⣤⣶⣶⣶⡐⣕⢽⠐⢕⠕⣡⣾⣶⣶⣶⣤⡁⢓⢕⠄⢑⢅⢑", + "⠍⣧⠄⣶⣾⣿⣿⣿⣿⣿⣿⣷⣔⢕⢄⢡⣾⣿⣿⣿⣿⣿⣿⣿⣦⡑⢕⢤⠱⢐", + "⢠⢕⠅⣾⣿⠋⢿⣿⣿⣿⠉⣿⣿⣷⣦⣶⣽⣿⣿⠈⣿⣿⣿⣿⠏⢹⣷⣷⡅⢐", + "⣔⢕⢥⢻⣿⡀⠈⠛⠛⠁⢠⣿⣿⣿⣿⣿⣿⣿⣿⡀⠈⠛⠛⠁⠄⣼⣿⣿⡇⢔", + "⢕⢕⢽⢸⢟⢟⢖⢖⢤⣶⡟⢻⣿⡿⠻⣿⣿⡟⢀⣿⣦⢤⢤⢔⢞⢿⢿⣿⠁⢕", + "⢕⢕⠅⣐⢕⢕⢕⢕⢕⣿⣿⡄⠛⢀⣦⠈⠛⢁⣼⣿⢗⢕⢕⢕⢕⢕⢕⡏⣘⢕", + "⢕⢕⠅⢓⣕⣕⣕⣕⣵⣿⣿⣿⣾⣿⣿⣿⣿⣿⣿⣿⣷⣕⢕⢕⢕⢕⡵⢀⢕⢕", + "⢑⢕⠃⡈⢿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⢃⢕⢕⢕", + "⣆⢕⠄⢱⣄⠛⢿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⠿⢁⢕⢕⠕⢁", + "⣿⣦⡀⣿⣿⣷⣶⣬⣍⣛⣛⣛⡛⠿⠿⠿⠛⠛⢛⣛⣉⣭⣤⣂⢜⠕⢑⣡⣴⣿", + "", } M[27] = { - "", - "⡿⠋⠄⣀⣀⣤⣴⣶⣾⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣦⣌⠻⣿⣿", - "⣴⣾⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣦⠹⣿", - "⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣧⠹", - "⣿⣿⡟⢹⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⡛⢿⣿⣿⣿⣮⠛⣿⣿⣿⣿⣿⣿⡆", - "⡟⢻⡇⢸⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣣⠄⡀⢬⣭⣻⣷⡌⢿⣿⣿⣿⣿⣿", - "⠃⣸⡀⠈⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣧⠈⣆⢹⣿⣿⣿⡈⢿⣿⣿⣿⣿", - "⠄⢻⡇⠄⢛⣛⣻⣿⣿⣿⣿⣿⣿⣿⣿⡆⠹⣿⣆⠸⣆⠙⠛⠛⠃⠘⣿⣿⣿⣿", - "⠄⠸⣡⠄⡈⣿⣿⣿⣿⣿⣿⣿⣿⠿⠟⠁⣠⣉⣤⣴⣿⣿⠿⠿⠿⡇⢸⣿⣿⣿", - "⠄⡄⢿⣆⠰⡘⢿⣿⠿⢛⣉⣥⣴⣶⣿⣿⣿⣿⣻⠟⣉⣤⣶⣶⣾⣿⡄⣿⡿⢸", - "⠄⢰⠸⣿⠄⢳⣠⣤⣾⣿⣿⣿⣿⣿⣿⣿⣿⣿⣧⣼⣿⣿⣿⣿⣿⣿⡇⢻⡇⢸", - "⢷⡈⢣⣡⣶⠿⠟⠛⠓⣚⣻⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣇⢸⠇⠘", - "⡀⣌⠄⠻⣧⣴⣾⣿⣿⣿⣿⣿⣿⣿⣿⡿⠟⠛⠛⠛⢿⣿⣿⣿⣿⣿⡟⠘⠄⠄", - "⣷⡘⣷⡀⠘⣿⣿⣿⣿⣿⣿⣿⣿⡋⢀⣠⣤⣶⣶⣾⡆⣿⣿⣿⠟⠁⠄⠄⠄⠄", - "⣿⣷⡘⣿⡀⢻⣿⣿⣿⣿⣿⣿⣿⣧⠸⣿⣿⣿⣿⣿⣷⡿⠟⠉⠄⠄⠄⠄⡄⢀", - "⣿⣿⣷⡈⢷⡀⠙⠛⠻⠿⠿⠿⠿⠿⠷⠾⠿⠟⣛⣋⣥⣶⣄⠄⢀⣄⠹⣦⢹⣿", - "", + "", + "⡿⠋⠄⣀⣀⣤⣴⣶⣾⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣦⣌⠻⣿⣿", + "⣴⣾⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣦⠹⣿", + "⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣧⠹", + "⣿⣿⡟⢹⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⡛⢿⣿⣿⣿⣮⠛⣿⣿⣿⣿⣿⣿⡆", + "⡟⢻⡇⢸⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣣⠄⡀⢬⣭⣻⣷⡌⢿⣿⣿⣿⣿⣿", + "⠃⣸⡀⠈⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣧⠈⣆⢹⣿⣿⣿⡈⢿⣿⣿⣿⣿", + "⠄⢻⡇⠄⢛⣛⣻⣿⣿⣿⣿⣿⣿⣿⣿⡆⠹⣿⣆⠸⣆⠙⠛⠛⠃⠘⣿⣿⣿⣿", + "⠄⠸⣡⠄⡈⣿⣿⣿⣿⣿⣿⣿⣿⠿⠟⠁⣠⣉⣤⣴⣿⣿⠿⠿⠿⡇⢸⣿⣿⣿", + "⠄⡄⢿⣆⠰⡘⢿⣿⠿⢛⣉⣥⣴⣶⣿⣿⣿⣿⣻⠟⣉⣤⣶⣶⣾⣿⡄⣿⡿⢸", + "⠄⢰⠸⣿⠄⢳⣠⣤⣾⣿⣿⣿⣿⣿⣿⣿⣿⣿⣧⣼⣿⣿⣿⣿⣿⣿⡇⢻⡇⢸", + "⢷⡈⢣⣡⣶⠿⠟⠛⠓⣚⣻⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣇⢸⠇⠘", + "⡀⣌⠄⠻⣧⣴⣾⣿⣿⣿⣿⣿⣿⣿⣿⡿⠟⠛⠛⠛⢿⣿⣿⣿⣿⣿⡟⠘⠄⠄", + "⣷⡘⣷⡀⠘⣿⣿⣿⣿⣿⣿⣿⣿⡋⢀⣠⣤⣶⣶⣾⡆⣿⣿⣿⠟⠁⠄⠄⠄⠄", + "⣿⣷⡘⣿⡀⢻⣿⣿⣿⣿⣿⣿⣿⣧⠸⣿⣿⣿⣿⣿⣷⡿⠟⠉⠄⠄⠄⠄⡄⢀", + "⣿⣿⣷⡈⢷⡀⠙⠛⠻⠿⠿⠿⠿⠿⠷⠾⠿⠟⣛⣋⣥⣶⣄⠄⢀⣄⠹⣦⢹⣿", + "", } M[28] = { - "", - "⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⡿⣿⡿⠿⢿⣿⣿⣿⣿⣿⣿", - "⣿⣿⣿⣿⣿⣿⣿⣿⣿⡿⠿⠛⠛⠉⠉⠉⠙⠻⣅⠀⠈⢧⠀⠈⠛⠉⠉⢻⣿⣿", - "⣿⣿⣿⣿⣿⣿⠿⠋⠀⠀⠀⠀⠀⠀⠀⠀⣤⡶⠟⠀⠀⣈⠓⢤⣶⡶⠿⠛⠻⣿", - "⣿⣿⣿⣿⣿⢣⠂⠀⠀⠀⠀⠀⠀⠀⠀⠀⢿⣀⣴⠶⠿⠿⢷⡄⠀⠀⢀⣤⣾⣿", - "⣿⣿⣿⣿⣡⠁⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠸⣦⣤⣤⡀⠀⢷⡀⠀⠀⣻⣿⣿", - "⣿⣿⣿⣿⠇⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⡈⠛⠶⠛⠃⠈⠈⢿⣿⣿", - "⣿⣿⠟⠘⠀⠀⠀⠀⠀⠀⠀⠀⢀⡆⠀⠀⠀⠀⠀⠀⣧⠀⠀⠀⠀⠀⠀⠈⣿⣿", - "⣿⠏⠀⠁⠀⠀⠀⠀⠀⠀⠀⢀⣶⡄⠀⠀⠀⠀⠀⠀⣡⣄⣿⡆⠀⠀⠀⠀⣿⣿", - "⡏⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠚⠛⠛⢛⣲⣶⣿⣷⣉⠉⢉⣥⡄⠀⠀⠀⠨⣿⣿", - "⡇⢠⡆⠀⠀⢰⠀⠀⠀⠀⢸⣿⣧⣠⣿⣿⣿⣿⣿⣿⣷⣾⣿⡅⠀⠀⡄⠠⢸⣿", - "⣧⠸⣇⠀⠀⠘⣤⡀⠀⠀⠘⣿⣿⣿⣿⣿⠟⠛⠻⣿⣿⣿⡿⢁⠀⠀⢰⠀⢸⣿", - "⣿⣷⣽⣦⠀⠀⠙⢷⡀⠀⠀⠙⠻⠿⢿⣷⣾⣿⣶⠾⢟⣥⣾⣿⣧⠀⠂⢀⣿⣿", - "⣿⣿⣿⣿⣷⣆⣠⣤⣤⣤⣀⣀⡀⠀⠒⢻⣶⣾⣿⣿⣿⣿⣿⣿⣿⢀⣀⣾⣿⣿", - "", + "", + "⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⡿⣿⡿⠿⢿⣿⣿⣿⣿⣿⣿", + "⣿⣿⣿⣿⣿⣿⣿⣿⣿⡿⠿⠛⠛⠉⠉⠉⠙⠻⣅⠀⠈⢧⠀⠈⠛⠉⠉⢻⣿⣿", + "⣿⣿⣿⣿⣿⣿⠿⠋⠀⠀⠀⠀⠀⠀⠀⠀⣤⡶⠟⠀⠀⣈⠓⢤⣶⡶⠿⠛⠻⣿", + "⣿⣿⣿⣿⣿⢣⠂⠀⠀⠀⠀⠀⠀⠀⠀⠀⢿⣀⣴⠶⠿⠿⢷⡄⠀⠀⢀⣤⣾⣿", + "⣿⣿⣿⣿⣡⠁⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠸⣦⣤⣤⡀⠀⢷⡀⠀⠀⣻⣿⣿", + "⣿⣿⣿⣿⠇⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⡈⠛⠶⠛⠃⠈⠈⢿⣿⣿", + "⣿⣿⠟⠘⠀⠀⠀⠀⠀⠀⠀⠀⢀⡆⠀⠀⠀⠀⠀⠀⣧⠀⠀⠀⠀⠀⠀⠈⣿⣿", + "⣿⠏⠀⠁⠀⠀⠀⠀⠀⠀⠀⢀⣶⡄⠀⠀⠀⠀⠀⠀⣡⣄⣿⡆⠀⠀⠀⠀⣿⣿", + "⡏⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠚⠛⠛⢛⣲⣶⣿⣷⣉⠉⢉⣥⡄⠀⠀⠀⠨⣿⣿", + "⡇⢠⡆⠀⠀⢰⠀⠀⠀⠀⢸⣿⣧⣠⣿⣿⣿⣿⣿⣿⣷⣾⣿⡅⠀⠀⡄⠠⢸⣿", + "⣧⠸⣇⠀⠀⠘⣤⡀⠀⠀⠘⣿⣿⣿⣿⣿⠟⠛⠻⣿⣿⣿⡿⢁⠀⠀⢰⠀⢸⣿", + "⣿⣷⣽⣦⠀⠀⠙⢷⡀⠀⠀⠙⠻⠿⢿⣷⣾⣿⣶⠾⢟⣥⣾⣿⣧⠀⠂⢀⣿⣿", + "⣿⣿⣿⣿⣷⣆⣠⣤⣤⣤⣀⣀⡀⠀⠒⢻⣶⣾⣿⣿⣿⣿⣿⣿⣿⢀⣀⣾⣿⣿", + "", } M[29] = { - "", - "⣿⣿⣿⣿⣯⣿⣿⠄⢠⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⡟⠈⣿⣿⣿⣿⣿⣿⣆⠄", - "⢻⣿⣿⣿⣾⣿⢿⣢⣞⣿⣿⣿⣿⣷⣶⣿⣯⣟⣿⢿⡇⢃⢻⣿⣿⣿⣿⣿⢿⡄", - "⠄⢿⣿⣯⣏⣿⣿⣿⡟⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣷⣧⣾⢿⣮⣿⣿⣿⣿⣾⣷", - "⠄⣈⣽⢾⣿⣿⣿⣟⣄⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣷⣝⣯⢿⣿⣿⣿⣿", - "⣿⠟⣫⢸⣿⢿⣿⣾⣿⢿⣿⣿⢻⣿⣿⣿⢿⣿⣿⣿⢸⣿⣼⣿⣿⣿⣿⣿⣿⣿", - "⡟⢸⣟⢸⣿⠸⣷⣝⢻⠘⣿⣿⢸⢿⣿⣿⠄⣿⣿⣿⡆⢿⣿⣼⣿⣿⣿⣿⢹⣿", - "⡇⣿⡿⣿⣿⢟⠛⠛⠿⡢⢻⣿⣾⣞⣿⡏⠖⢸⣿⢣⣷⡸⣇⣿⣿⣿⢼⡿⣿⣿", - "⣡⢿⡷⣿⣿⣾⣿⣷⣶⣮⣄⣿⣏⣸⣻⣃⠭⠄⠛⠙⠛⠳⠋⣿⣿⣇⠙⣿⢸⣿", - "⠫⣿⣧⣿⣿⣿⣿⣿⣿⣿⣿⣿⠻⣿⣾⣿⣿⣿⣿⣿⣿⣿⣷⣿⣿⣹⢷⣿⡼⠋", - " ⠸⣿⣿⣿⣿⣿⣿⣿⣿⣿⣷⣦⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⡟⣿⣿⣿ ", - " ⢻⢹⣿⠸⣿⣿⣿⣿⣿⣷⣿⣿⣿⣿⣿⣿⣿⣿⣿⡿⣼⣿⣿⣿⣿⡟ ", - " ⠈⢸⣿ ⠙⢿⣿⣿⣹⣿⣿⣿⣿⣟⡃⣽⣿⣿⡟⠁⣿⣿⢻⣿⣿⢿ ", - " ⠘⣿⡄ ⠙⢿⣿⣿⣾⣿⣷⣿⣿⣿⠟⠁ ⣿⣿⣾⣿⡟⣿ ", - " ⢻⡇⠸⣆ ⠈⠻⣿⡿⠿⠛⠉ ⢸⣿⣇⣿⣿⢿⣿ ", - "", + "", + "⣿⣿⣿⣿⣯⣿⣿⠄⢠⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⡟⠈⣿⣿⣿⣿⣿⣿⣆⠄", + "⢻⣿⣿⣿⣾⣿⢿⣢⣞⣿⣿⣿⣿⣷⣶⣿⣯⣟⣿⢿⡇⢃⢻⣿⣿⣿⣿⣿⢿⡄", + "⠄⢿⣿⣯⣏⣿⣿⣿⡟⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣷⣧⣾⢿⣮⣿⣿⣿⣿⣾⣷", + "⠄⣈⣽⢾⣿⣿⣿⣟⣄⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣷⣝⣯⢿⣿⣿⣿⣿", + "⣿⠟⣫⢸⣿⢿⣿⣾⣿⢿⣿⣿⢻⣿⣿⣿⢿⣿⣿⣿⢸⣿⣼⣿⣿⣿⣿⣿⣿⣿", + "⡟⢸⣟⢸⣿⠸⣷⣝⢻⠘⣿⣿⢸⢿⣿⣿⠄⣿⣿⣿⡆⢿⣿⣼⣿⣿⣿⣿⢹⣿", + "⡇⣿⡿⣿⣿⢟⠛⠛⠿⡢⢻⣿⣾⣞⣿⡏⠖⢸⣿⢣⣷⡸⣇⣿⣿⣿⢼⡿⣿⣿", + "⣡⢿⡷⣿⣿⣾⣿⣷⣶⣮⣄⣿⣏⣸⣻⣃⠭⠄⠛⠙⠛⠳⠋⣿⣿⣇⠙⣿⢸⣿", + "⠫⣿⣧⣿⣿⣿⣿⣿⣿⣿⣿⣿⠻⣿⣾⣿⣿⣿⣿⣿⣿⣿⣷⣿⣿⣹⢷⣿⡼⠋", + " ⠸⣿⣿⣿⣿⣿⣿⣿⣿⣿⣷⣦⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⡟⣿⣿⣿ ", + " ⢻⢹⣿⠸⣿⣿⣿⣿⣿⣷⣿⣿⣿⣿⣿⣿⣿⣿⣿⡿⣼⣿⣿⣿⣿⡟ ", + " ⠈⢸⣿ ⠙⢿⣿⣿⣹⣿⣿⣿⣿⣟⡃⣽⣿⣿⡟⠁⣿⣿⢻⣿⣿⢿ ", + " ⠘⣿⡄ ⠙⢿⣿⣿⣾⣿⣷⣿⣿⣿⠟⠁ ⣿⣿⣾⣿⡟⣿ ", + " ⢻⡇⠸⣆ ⠈⠻⣿⡿⠿⠛⠉ ⢸⣿⣇⣿⣿⢿⣿ ", + "", } M[30] = { - "", - "⣿⠟⣽⣿⣿⣿⣿⣿⢣⠟⠋⡜⠄⢸⣿⣿⡟⣬⢁⠠⠁⣤⠄⢰⠄⠇⢻⢸", - "⢏⣾⣿⣿⣿⠿⣟⢁⡴⡀⡜⣠⣶⢸⣿⣿⢃⡇⠂⢁⣶⣦⣅⠈⠇⠄⢸⢸", - "⣹⣿⣿⣿⡗⣾⡟⡜⣵⠃⣴⣿⣿⢸⣿⣿⢸⠘⢰⣿⣿⣿⣿⡀⢱⠄⠨⢸", - "⣿⣿⣿⣿⡇⣿⢁⣾⣿⣾⣿⣿⣿⣿⣸⣿⡎⠐⠒⠚⠛⠛⠿⢧⠄⠄⢠⣼", - "⣿⣿⣿⣿⠃⠿⢸⡿⠭⠭⢽⣿⣿⣿⢂⣿⠃⣤⠄⠄⠄⠄⠄⠄⠄⠄⣿⡾", - "⣼⠏⣿⡏⠄⠄⢠⣤⣶⣶⣾⣿⣿⣟⣾⣾⣼⣿⠒⠄⠄⠄⡠⣴⡄⢠⣿⣵", - "⣳⠄⣿⠄⠄⢣⠸⣹⣿⡟⣻⣿⣿⣿⣿⣿⣿⡿⡻⡖⠦⢤⣔⣯⡅⣼⡿⣹", - "⡿⣼⢸⠄⠄⣷⣷⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣕⡜⡌⡝⡸⠙⣼⠟⢱⠏", - "⡇⣿⣧⡰⡄⣿⣿⣿⣿⡿⠿⠿⠿⣿⣿⣿⣿⣿⣿⣿⣿⣷⣋⣪⣥⢠⠏⠄", - "⣧⢻⣿⣷⣧⢻⣿⣿⣿⡇⠄⢀⣀⣀⡙⣿⣿⣿⣿⣿⣿⣿⣿⣿⡇⠂⠄⠄", - "⢹⣼⣿⣿⣿⣧⡻⣿⣿⣇⣴⣿⣿⣿⣷⢸⣿⣿⣿⣿⣿⣿⣿⣿⣰⠄⠄⠄", - "⣼⡟⡟⣿⢸⣿⣿⣝⢿⣿⣾⣿⣿⣿⢟⣾⣿⣿⣿⣿⣿⣿⣿⣿⠟⠄⡀⡀", - "⣿⢰⣿⢹⢸⣿⣿⣿⣷⣝⢿⣿⣿⣿⣿⣿⣿⣿⣿⡿⠿⠛⠉⠄⠄⣸⢰⡇", - "⣿⣾⣹⣏⢸⣿⣿⣿⣿⣿⣷⣍⡻⣛⣛⣛⡉⠁⠄⠄⠄⠄⠄⠄⢀⢇⡏⠄", - "", + "", + "⣿⠟⣽⣿⣿⣿⣿⣿⢣⠟⠋⡜⠄⢸⣿⣿⡟⣬⢁⠠⠁⣤⠄⢰⠄⠇⢻⢸", + "⢏⣾⣿⣿⣿⠿⣟⢁⡴⡀⡜⣠⣶⢸⣿⣿⢃⡇⠂⢁⣶⣦⣅⠈⠇⠄⢸⢸", + "⣹⣿⣿⣿⡗⣾⡟⡜⣵⠃⣴⣿⣿⢸⣿⣿⢸⠘⢰⣿⣿⣿⣿⡀⢱⠄⠨⢸", + "⣿⣿⣿⣿⡇⣿⢁⣾⣿⣾⣿⣿⣿⣿⣸⣿⡎⠐⠒⠚⠛⠛⠿⢧⠄⠄⢠⣼", + "⣿⣿⣿⣿⠃⠿⢸⡿⠭⠭⢽⣿⣿⣿⢂⣿⠃⣤⠄⠄⠄⠄⠄⠄⠄⠄⣿⡾", + "⣼⠏⣿⡏⠄⠄⢠⣤⣶⣶⣾⣿⣿⣟⣾⣾⣼⣿⠒⠄⠄⠄⡠⣴⡄⢠⣿⣵", + "⣳⠄⣿⠄⠄⢣⠸⣹⣿⡟⣻⣿⣿⣿⣿⣿⣿⡿⡻⡖⠦⢤⣔⣯⡅⣼⡿⣹", + "⡿⣼⢸⠄⠄⣷⣷⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣕⡜⡌⡝⡸⠙⣼⠟⢱⠏", + "⡇⣿⣧⡰⡄⣿⣿⣿⣿⡿⠿⠿⠿⣿⣿⣿⣿⣿⣿⣿⣿⣷⣋⣪⣥⢠⠏⠄", + "⣧⢻⣿⣷⣧⢻⣿⣿⣿⡇⠄⢀⣀⣀⡙⣿⣿⣿⣿⣿⣿⣿⣿⣿⡇⠂⠄⠄", + "⢹⣼⣿⣿⣿⣧⡻⣿⣿⣇⣴⣿⣿⣿⣷⢸⣿⣿⣿⣿⣿⣿⣿⣿⣰⠄⠄⠄", + "⣼⡟⡟⣿⢸⣿⣿⣝⢿⣿⣾⣿⣿⣿⢟⣾⣿⣿⣿⣿⣿⣿⣿⣿⠟⠄⡀⡀", + "⣿⢰⣿⢹⢸⣿⣿⣿⣷⣝⢿⣿⣿⣿⣿⣿⣿⣿⣿⡿⠿⠛⠉⠄⠄⣸⢰⡇", + "⣿⣾⣹⣏⢸⣿⣿⣿⣿⣿⣷⣍⡻⣛⣛⣛⡉⠁⠄⠄⠄⠄⠄⠄⢀⢇⡏⠄", + "", } M[31] = { - "", - "⢰⡟⣡⡟⣱⣿⡿⠡⢛⣋⣥⣴⣌⢿⣿⣿⣿⣿⣷⣌⠻⢿⣿⣿⣿⣿⣿⣿", - "⠏⢼⡿⣰⡿⠿⠡⠿⠿⢯⣉⠿⣿⣿⣿⣿⣿⣿⣷⣶⣿⣦⣍⠻⢿⣿⣿⣿", - "⣼⣷⢠⠀⠀⢠⣴⡖⠀⠀⠈⠻⣿⡿⣿⣿⣿⣿⣿⣛⣯⣝⣻⣿⣶⣿⣿⣿", - "⣿⡇⣿⡷⠂⠈⡉⠀⠀⠀⣠⣴⣾⣿⣿⣿⣿⣿⣍⡤⣤⣤⣤⡀⠀⠉⠛⠿", - "⣿⢸⣿⡅⣠⣬⣥⣤⣴⣴⣿⣿⢿⣿⣿⣿⣿⣿⣟⡭⡄⣀⣉⡀⠀⠀⠀⠀", - "⡟⣿⣿⢰⣿⣿⣿⣿⣿⣿⣿⣿⣾⣿⣿⣿⣿⣿⣿⣿⣶⣦⣈⠀⠀⠀⢀⣶", - "⡧⣿⡇⣼⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣶⣶⣾⣿", - "⡇⣿⠃⣿⣿⣿⣿⣿⠛⠛⢫⣿⣿⣻⣻⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⢿⣿", - "⡇⣿⠘⡇⢻⣿⣿⣿⡆⠀⠀⠀⠀⠈⠉⠙⠻⠏⠛⠻⣿⣿⣿⣿⣿⣭⡾⢁", - "⡇⣿⠀⠘⢿⣿⣿⣿⣧⢠⣤⠀⡤⢀⣠⣀⣀⠀⠀⣼⣿⣿⣿⣿⣿⠟⣁⠉", - "⣧⢻⠀⡄⠀⠹⣿⣿⣿⡸⣿⣾⡆⣿⣿⣿⠿⣡⣾⣿⣿⣿⣿⡿⠋⠐⢡⣶", - "⣿⡘⠈⣷⠀⠀⠈⠻⣿⣷⣎⠐⠿⢟⣋⣤⣾⣿⣿⣿⡿⠟⣩⠖⢠⡬⠈⠀", - "⣿⣧⠁⢻⡇⠀⠀⠀⠈⠻⣿⣿⣿⣿⣿⣿⠿⠟⠋⠁⢀⠈⢀⡴⠈⠁⠀⠀", - "⠻⣿⣆⠘⣿⠀⠀ ⠀⠈⠙⠛⠋⠉⠀⠀⠀⠀⡀⠤⠚⠁ ", - "", + "", + "⢰⡟⣡⡟⣱⣿⡿⠡⢛⣋⣥⣴⣌⢿⣿⣿⣿⣿⣷⣌⠻⢿⣿⣿⣿⣿⣿⣿", + "⠏⢼⡿⣰⡿⠿⠡⠿⠿⢯⣉⠿⣿⣿⣿⣿⣿⣿⣷⣶⣿⣦⣍⠻⢿⣿⣿⣿", + "⣼⣷⢠⠀⠀⢠⣴⡖⠀⠀⠈⠻⣿⡿⣿⣿⣿⣿⣿⣛⣯⣝⣻⣿⣶⣿⣿⣿", + "⣿⡇⣿⡷⠂⠈⡉⠀⠀⠀⣠⣴⣾⣿⣿⣿⣿⣿⣍⡤⣤⣤⣤⡀⠀⠉⠛⠿", + "⣿⢸⣿⡅⣠⣬⣥⣤⣴⣴⣿⣿⢿⣿⣿⣿⣿⣿⣟⡭⡄⣀⣉⡀⠀⠀⠀⠀", + "⡟⣿⣿⢰⣿⣿⣿⣿⣿⣿⣿⣿⣾⣿⣿⣿⣿⣿⣿⣿⣶⣦⣈⠀⠀⠀⢀⣶", + "⡧⣿⡇⣼⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣶⣶⣾⣿", + "⡇⣿⠃⣿⣿⣿⣿⣿⠛⠛⢫⣿⣿⣻⣻⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⢿⣿", + "⡇⣿⠘⡇⢻⣿⣿⣿⡆⠀⠀⠀⠀⠈⠉⠙⠻⠏⠛⠻⣿⣿⣿⣿⣿⣭⡾⢁", + "⡇⣿⠀⠘⢿⣿⣿⣿⣧⢠⣤⠀⡤⢀⣠⣀⣀⠀⠀⣼⣿⣿⣿⣿⣿⠟⣁⠉", + "⣧⢻⠀⡄⠀⠹⣿⣿⣿⡸⣿⣾⡆⣿⣿⣿⠿⣡⣾⣿⣿⣿⣿⡿⠋⠐⢡⣶", + "⣿⡘⠈⣷⠀⠀⠈⠻⣿⣷⣎⠐⠿⢟⣋⣤⣾⣿⣿⣿⡿⠟⣩⠖⢠⡬⠈⠀", + "⣿⣧⠁⢻⡇⠀⠀⠀⠈⠻⣿⣿⣿⣿⣿⣿⠿⠟⠋⠁⢀⠈⢀⡴⠈⠁⠀⠀", + "⠻⣿⣆⠘⣿⠀⠀ ⠀⠈⠙⠛⠋⠉⠀⠀⠀⠀⡀⠤⠚⠁ ", + "", } M[32] = { - "", - " ⣴⣶⣤⡤⠦⣤⣀⣤⠆ ⣈⣭⣭⣿⣶⣿⣦⣼⣆ ", - " ⠉⠻⢿⣿⠿⣿⣿⣶⣦⠤⠄⡠⢾⣿⣿⡿⠋⠉⠉⠻⣿⣿⡛⣦ ", - " ⠈⢿⣿⣟⠦ ⣾⣿⣿⣷⠄⠄⠄⠄⠻⠿⢿⣿⣧⣄ ", - " ⣸⣿⣿⢧ ⢻⠻⣿⣿⣷⣄⣀⠄⠢⣀⡀⠈⠙⠿⠄ ", - " ⢠⣿⣿⣿⠈ ⠡⠌⣻⣿⣿⣿⣿⣿⣿⣿⣛⣳⣤⣀⣀ ", - " ⢠⣧⣶⣥⡤⢄ ⣸⣿⣿⠘⠄ ⢀⣴⣿⣿⡿⠛⣿⣿⣧⠈⢿⠿⠟⠛⠻⠿⠄ ", - " ⣰⣿⣿⠛⠻⣿⣿⡦⢹⣿⣷ ⢊⣿⣿⡏ ⢸⣿⣿⡇ ⢀⣠⣄⣾⠄ ", - " ⣠⣿⠿⠛⠄⢀⣿⣿⣷⠘⢿⣿⣦⡀ ⢸⢿⣿⣿⣄ ⣸⣿⣿⡇⣪⣿⡿⠿⣿⣷⡄ ", - " ⠙⠃ ⣼⣿⡟ ⠈⠻⣿⣿⣦⣌⡇⠻⣿⣿⣷⣿⣿⣿ ⣿⣿⡇⠄⠛⠻⢷⣄ ", - " ⢻⣿⣿⣄ ⠈⠻⣿⣿⣿⣷⣿⣿⣿⣿⣿⡟ ⠫⢿⣿⡆ ", - " ⠻⣿⣿⣿⣿⣶⣶⣾⣿⣿⣿⣿⣿⣿⣿⣿⡟⢀⣀⣤⣾⡿⠃ ", - " ⢰⣶ ⣶ ⢶⣆⢀⣶⠂⣶⡶⠶⣦⡄⢰⣶⠶⢶⣦ ⣴⣶ ", - " ⢸⣿⠶⠶⣿ ⠈⢻⣿⠁ ⣿⡇ ⢸⣿⢸⣿⢶⣾⠏ ⣸⣟⣹⣧ ", - " ⠸⠿ ⠿ ⠸⠿ ⠿⠷⠶⠿⠃⠸⠿⠄⠙⠷⠤⠿⠉⠉⠿⠆ ", - "", + "", + " ⣴⣶⣤⡤⠦⣤⣀⣤⠆ ⣈⣭⣭⣿⣶⣿⣦⣼⣆ ", + " ⠉⠻⢿⣿⠿⣿⣿⣶⣦⠤⠄⡠⢾⣿⣿⡿⠋⠉⠉⠻⣿⣿⡛⣦ ", + " ⠈⢿⣿⣟⠦ ⣾⣿⣿⣷⠄⠄⠄⠄⠻⠿⢿⣿⣧⣄ ", + " ⣸⣿⣿⢧ ⢻⠻⣿⣿⣷⣄⣀⠄⠢⣀⡀⠈⠙⠿⠄ ", + " ⢠⣿⣿⣿⠈ ⠡⠌⣻⣿⣿⣿⣿⣿⣿⣿⣛⣳⣤⣀⣀ ", + " ⢠⣧⣶⣥⡤⢄ ⣸⣿⣿⠘⠄ ⢀⣴⣿⣿⡿⠛⣿⣿⣧⠈⢿⠿⠟⠛⠻⠿⠄ ", + " ⣰⣿⣿⠛⠻⣿⣿⡦⢹⣿⣷ ⢊⣿⣿⡏ ⢸⣿⣿⡇ ⢀⣠⣄⣾⠄ ", + " ⣠⣿⠿⠛⠄⢀⣿⣿⣷⠘⢿⣿⣦⡀ ⢸⢿⣿⣿⣄ ⣸⣿⣿⡇⣪⣿⡿⠿⣿⣷⡄ ", + " ⠙⠃ ⣼⣿⡟ ⠈⠻⣿⣿⣦⣌⡇⠻⣿⣿⣷⣿⣿⣿ ⣿⣿⡇⠄⠛⠻⢷⣄ ", + " ⢻⣿⣿⣄ ⠈⠻⣿⣿⣿⣷⣿⣿⣿⣿⣿⡟ ⠫⢿⣿⡆ ", + " ⠻⣿⣿⣿⣿⣶⣶⣾⣿⣿⣿⣿⣿⣿⣿⣿⡟⢀⣀⣤⣾⡿⠃ ", + " ⢰⣶ ⣶ ⢶⣆⢀⣶⠂⣶⡶⠶⣦⡄⢰⣶⠶⢶⣦ ⣴⣶ ", + " ⢸⣿⠶⠶⣿ ⠈⢻⣿⠁ ⣿⡇ ⢸⣿⢸⣿⢶⣾⠏ ⣸⣟⣹⣧ ", + " ⠸⠿ ⠿ ⠸⠿ ⠿⠷⠶⠿⠃⠸⠿⠄⠙⠷⠤⠿⠉⠉⠿⠆ ", + "", } M[33] = { - " ███╗ ██╗ ███████╗ ██████╗ ██╗ ██╗ ██╗ ███╗ ███╗", - " ████╗ ██║ ██╔════╝██╔═══██╗ ██║ ██║ ██║ ████╗ ████║", - " ██╔██╗ ██║ █████╗ ██║ ██║ ██║ ██║ ██║ ██╔████╔██║", - " ██║╚██╗██║ ██╔══╝ ██║ ██║ ╚██╗ ██╔╝ ██║ ██║╚██╔╝██║", - " ██║ ╚████║ ███████╗╚██████╔╝ ╚████╔╝ ██║ ██║ ╚═╝ ██║", - " ╚═╝ ╚═══╝ ╚══════╝ ╚═════╝ ╚═══╝ ╚═╝ ╚═╝ ╚═╝", + " ███╗ ██╗ ███████╗ ██████╗ ██╗ ██╗ ██╗ ███╗ ███╗", + " ████╗ ██║ ██╔════╝██╔═══██╗ ██║ ██║ ██║ ████╗ ████║", + " ██╔██╗ ██║ █████╗ ██║ ██║ ██║ ██║ ██║ ██╔████╔██║", + " ██║╚██╗██║ ██╔══╝ ██║ ██║ ╚██╗ ██╔╝ ██║ ██║╚██╔╝██║", + " ██║ ╚████║ ███████╗╚██████╔╝ ╚████╔╝ ██║ ██║ ╚═╝ ██║", + " ╚═╝ ╚═══╝ ╚══════╝ ╚═════╝ ╚═══╝ ╚═╝ ╚═╝ ╚═╝", } return M diff --git a/lua/kide/plugins/config/autosave.lua b/lua/kide/plugins/config/autosave.lua index 46febbcf..ffb8078d 100644 --- a/lua/kide/plugins/config/autosave.lua +++ b/lua/kide/plugins/config/autosave.lua @@ -1,17 +1,17 @@ local autosave = require("autosave") autosave.setup({ - enabled = true, - execution_message = "AutoSave: saved at " .. vim.fn.strftime("%H:%M:%S"), - events = { "InsertLeave", "TextChanged" }, - conditions = { - exists = true, - filename_is_not = {}, - filetype_is_not = {}, - modifiable = true, - }, - write_all_buffers = false, - on_off_commands = true, - clean_command_line_interval = 0, - debounce_delay = 135, + enabled = true, + execution_message = "AutoSave: saved at " .. vim.fn.strftime("%H:%M:%S"), + events = { "InsertLeave", "TextChanged" }, + conditions = { + exists = true, + filename_is_not = {}, + filetype_is_not = {}, + modifiable = true, + }, + write_all_buffers = false, + on_off_commands = true, + clean_command_line_interval = 0, + debounce_delay = 135, }) diff --git a/lua/kide/plugins/config/bufferline.lua b/lua/kide/plugins/config/bufferline.lua index 793b2a38..c3f7600c 100644 --- a/lua/kide/plugins/config/bufferline.lua +++ b/lua/kide/plugins/config/bufferline.lua @@ -1,62 +1,62 @@ require("bufferline").setup({ - options = { - -- 使用 nvim 内置lsp - diagnostics = "nvim_lsp", - diagnostics_indicator = function(count, level, diagnostics_dict, context) - local s = " " - for e, n in pairs(diagnostics_dict) do - local sym = e == "error" and " " or (e == "warning" and " " or "") - s = s .. n .. sym - end - return s - end, - -- 左侧让出 nvim-tree 的位置 - offsets = { - { - filetype = "NvimTree", - text = function() - -- return "File Explorer" - -- git symbolic-ref --short -q HEAD - -- git --no-pager rev-parse --show-toplevel --absolute-git-dir --abbrev-ref HEAD - -- git --no-pager rev-parse --short HEAD - -- local b = vim.fn.trim(vim.fn.system("git symbolic-ref --short -q HEAD")) - -- if string.match(b, "fatal") then - -- b = "" - -- else - -- b = "  " .. b - -- end - -- return vim.fn.fnamemodify(vim.fn.getcwd(), ":p:h:t") .. b - return "File Explorer" - end, - padding = 1, - highlight = "Directory", - -- text_align = "center" - text_align = "left", - }, - { - filetype = "DiffviewFiles", - text = function() - return "DiffviewFilePanel" - end, - padding = 1, - highlight = "Directory", - -- text_align = "center" - text_align = "left", - }, - { - filetype = "Outline", - text = " Outline", - padding = 1, - highlight = "Directory", - text_align = "left", - }, - }, - color_icons = true, - show_buffer_close_icons = true, - show_buffer_default_icon = true, - show_close_icon = false, - show_tab_indicators = true, - -- separator_style = "slant" | "thick" | "thin" | { 'any', 'any' }, - separator_style = "slant", - }, + options = { + -- 使用 nvim 内置lsp + diagnostics = "nvim_lsp", + diagnostics_indicator = function(count, level, diagnostics_dict, context) + local s = " " + for e, n in pairs(diagnostics_dict) do + local sym = e == "error" and " " or (e == "warning" and " " or "") + s = s .. n .. sym + end + return s + end, + -- 左侧让出 nvim-tree 的位置 + offsets = { + { + filetype = "NvimTree", + text = function() + -- return "File Explorer" + -- git symbolic-ref --short -q HEAD + -- git --no-pager rev-parse --show-toplevel --absolute-git-dir --abbrev-ref HEAD + -- git --no-pager rev-parse --short HEAD + -- local b = vim.fn.trim(vim.fn.system("git symbolic-ref --short -q HEAD")) + -- if string.match(b, "fatal") then + -- b = "" + -- else + -- b = "  " .. b + -- end + -- return vim.fn.fnamemodify(vim.fn.getcwd(), ":p:h:t") .. b + return "File Explorer" + end, + padding = 1, + highlight = "Directory", + -- text_align = "center" + text_align = "left", + }, + { + filetype = "DiffviewFiles", + text = function() + return "DiffviewFilePanel" + end, + padding = 1, + highlight = "Directory", + -- text_align = "center" + text_align = "left", + }, + { + filetype = "Outline", + text = " Outline", + padding = 1, + highlight = "Directory", + text_align = "left", + }, + }, + color_icons = true, + show_buffer_close_icons = true, + show_buffer_default_icon = true, + show_close_icon = false, + show_tab_indicators = true, + -- separator_style = "slant" | "thick" | "thin" | { 'any', 'any' }, + separator_style = "slant", + }, }) diff --git a/lua/kide/plugins/config/dashboard-nvim.lua b/lua/kide/plugins/config/dashboard-nvim.lua index fb56a4dd..fad89a6a 100644 --- a/lua/kide/plugins/config/dashboard-nvim.lua +++ b/lua/kide/plugins/config/dashboard-nvim.lua @@ -7,13 +7,13 @@ g.dashboard_default_executive = "telescope" -- } local startify_ascii_header = { - " ▟▙ ", - " ▝▘ ", - "██▃▅▇█▆▖ ▗▟████▙▖ ▄████▄ ██▄ ▄██ ██ ▗▟█▆▄▄▆█▙▖", - "██▛▔ ▝██ ██▄▄▄▄██ ██▛▔▔▜██ ▝██ ██▘ ██ ██▛▜██▛▜██", - "██ ██ ██▀▀▀▀▀▘ ██▖ ▗██ ▜█▙▟█▛ ██ ██ ██ ██", - "██ ██ ▜█▙▄▄▄▟▊ ▀██▙▟██▀ ▝████▘ ██ ██ ██ ██", - "▀▀ ▀▀ ▝▀▀▀▀▀ ▀▀▀▀ ▀▀ ▀▀ ▀▀ ▀▀ ▀▀", - "", + " ▟▙ ", + " ▝▘ ", + "██▃▅▇█▆▖ ▗▟████▙▖ ▄████▄ ██▄ ▄██ ██ ▗▟█▆▄▄▆█▙▖", + "██▛▔ ▝██ ██▄▄▄▄██ ██▛▔▔▜██ ▝██ ██▘ ██ ██▛▜██▛▜██", + "██ ██ ██▀▀▀▀▀▘ ██▖ ▗██ ▜█▙▟█▛ ██ ██ ██ ██", + "██ ██ ▜█▙▄▄▄▟▊ ▀██▙▟██▀ ▝████▘ ██ ██ ██ ██", + "▀▀ ▀▀ ▝▀▀▀▀▀ ▀▀▀▀ ▀▀ ▀▀ ▀▀ ▀▀ ▀▀", + "", } g.dashboard_custom_header = startify_ascii_header diff --git a/lua/kide/plugins/config/diffview-nvim.lua b/lua/kide/plugins/config/diffview-nvim.lua index 000adfd0..60bf68ac 100644 --- a/lua/kide/plugins/config/diffview-nvim.lua +++ b/lua/kide/plugins/config/diffview-nvim.lua @@ -2,117 +2,117 @@ local actions = require("diffview.actions") require("diffview").setup({ - diff_binaries = false, -- Show diffs for binaries - enhanced_diff_hl = false, -- See ':h diffview-config-enhanced_diff_hl' - git_cmd = { "git" }, -- The git executable followed by default args. - use_icons = true, -- Requires nvim-web-devicons - icons = { -- Only applies when use_icons is true. - folder_closed = "", - folder_open = "", - }, - signs = { - fold_closed = "", - fold_open = "", - }, - file_panel = { - listing_style = "tree", -- One of 'list' or 'tree' - tree_options = { -- Only applies when listing_style is 'tree' - flatten_dirs = true, -- Flatten dirs that only contain one single dir - folder_statuses = "only_folded", -- One of 'never', 'only_folded' or 'always'. - }, - win_config = { -- See ':h diffview-config-win_config' - position = "left", - width = 35, - }, - }, - file_history_panel = { - log_options = { -- See ':h diffview-config-log_options' - single_file = { - diff_merges = "combined", - }, - multi_file = { - diff_merges = "first-parent", - }, - }, - win_config = { -- See ':h diffview-config-win_config' - position = "bottom", - height = 16, - }, - }, - commit_log_panel = { - win_config = {}, -- See ':h diffview-config-win_config' - }, - default_args = { -- Default args prepended to the arg-list for the listed commands - DiffviewOpen = {}, - DiffviewFileHistory = {}, - }, - hooks = {}, -- See ':h diffview-config-hooks' - keymaps = { - disable_defaults = false, -- Disable the default keymaps - view = { - -- The `view` bindings are active in the diff buffers, only when the current - -- tabpage is a Diffview. - [""] = actions.select_next_entry, -- Open the diff for the next file - [""] = actions.select_prev_entry, -- Open the diff for the previous file - ["gf"] = actions.goto_file, -- Open the file in a new split in the previous tabpage - [""] = actions.goto_file_split, -- Open the file in a new split - ["gf"] = actions.goto_file_tab, -- Open the file in a new tabpage - ["e"] = actions.focus_files, -- Bring focus to the files panel - ["b"] = actions.toggle_files, -- Toggle the files panel. - }, - file_panel = { - ["j"] = actions.next_entry, -- Bring the cursor to the next file entry - [""] = actions.next_entry, - ["k"] = actions.prev_entry, -- Bring the cursor to the previous file entry. - [""] = actions.prev_entry, - [""] = actions.select_entry, -- Open the diff for the selected entry. - ["o"] = actions.select_entry, - ["<2-LeftMouse>"] = actions.select_entry, - ["-"] = actions.toggle_stage_entry, -- Stage / unstage the selected entry. - ["S"] = actions.stage_all, -- Stage all entries. - ["U"] = actions.unstage_all, -- Unstage all entries. - ["X"] = actions.restore_entry, -- Restore entry to the state on the left side. - ["R"] = actions.refresh_files, -- Update stats and entries in the file list. - ["L"] = actions.open_commit_log, -- Open the commit log panel. - [""] = actions.scroll_view(-0.25), -- Scroll the view up - [""] = actions.scroll_view(0.25), -- Scroll the view down - [""] = actions.select_next_entry, - [""] = actions.select_prev_entry, - ["gf"] = actions.goto_file, - [""] = actions.goto_file_split, - ["gf"] = actions.goto_file_tab, - ["i"] = actions.listing_style, -- Toggle between 'list' and 'tree' views - ["f"] = actions.toggle_flatten_dirs, -- Flatten empty subdirectories in tree listing style. - ["e"] = actions.focus_files, - ["b"] = actions.toggle_files, - }, - file_history_panel = { - ["g!"] = actions.options, -- Open the option panel - [""] = actions.open_in_diffview, -- Open the entry under the cursor in a diffview - ["y"] = actions.copy_hash, -- Copy the commit hash of the entry under the cursor - ["L"] = actions.open_commit_log, - ["zR"] = actions.open_all_folds, - ["zM"] = actions.close_all_folds, - ["j"] = actions.next_entry, - [""] = actions.next_entry, - ["k"] = actions.prev_entry, - [""] = actions.prev_entry, - [""] = actions.select_entry, - ["o"] = actions.select_entry, - ["<2-LeftMouse>"] = actions.select_entry, - [""] = actions.scroll_view(-0.25), - [""] = actions.scroll_view(0.25), - [""] = actions.select_next_entry, - [""] = actions.select_prev_entry, - ["gf"] = actions.goto_file, - [""] = actions.goto_file_split, - ["gf"] = actions.goto_file_tab, - ["e"] = actions.focus_files, - ["b"] = actions.toggle_files, - }, - option_panel = { - [""] = actions.select_entry, - ["q"] = actions.close, - }, - }, + diff_binaries = false, -- Show diffs for binaries + enhanced_diff_hl = false, -- See ':h diffview-config-enhanced_diff_hl' + git_cmd = { "git" }, -- The git executable followed by default args. + use_icons = true, -- Requires nvim-web-devicons + icons = { -- Only applies when use_icons is true. + folder_closed = "", + folder_open = "", + }, + signs = { + fold_closed = "", + fold_open = "", + }, + file_panel = { + listing_style = "tree", -- One of 'list' or 'tree' + tree_options = { -- Only applies when listing_style is 'tree' + flatten_dirs = true, -- Flatten dirs that only contain one single dir + folder_statuses = "only_folded", -- One of 'never', 'only_folded' or 'always'. + }, + win_config = { -- See ':h diffview-config-win_config' + position = "left", + width = 35, + }, + }, + file_history_panel = { + log_options = { -- See ':h diffview-config-log_options' + single_file = { + diff_merges = "combined", + }, + multi_file = { + diff_merges = "first-parent", + }, + }, + win_config = { -- See ':h diffview-config-win_config' + position = "bottom", + height = 16, + }, + }, + commit_log_panel = { + win_config = {}, -- See ':h diffview-config-win_config' + }, + default_args = { -- Default args prepended to the arg-list for the listed commands + DiffviewOpen = {}, + DiffviewFileHistory = {}, + }, + hooks = {}, -- See ':h diffview-config-hooks' + keymaps = { + disable_defaults = false, -- Disable the default keymaps + view = { + -- The `view` bindings are active in the diff buffers, only when the current + -- tabpage is a Diffview. + [""] = actions.select_next_entry, -- Open the diff for the next file + [""] = actions.select_prev_entry, -- Open the diff for the previous file + ["gf"] = actions.goto_file, -- Open the file in a new split in the previous tabpage + [""] = actions.goto_file_split, -- Open the file in a new split + ["gf"] = actions.goto_file_tab, -- Open the file in a new tabpage + ["e"] = actions.focus_files, -- Bring focus to the files panel + ["b"] = actions.toggle_files, -- Toggle the files panel. + }, + file_panel = { + ["j"] = actions.next_entry, -- Bring the cursor to the next file entry + [""] = actions.next_entry, + ["k"] = actions.prev_entry, -- Bring the cursor to the previous file entry. + [""] = actions.prev_entry, + [""] = actions.select_entry, -- Open the diff for the selected entry. + ["o"] = actions.select_entry, + ["<2-LeftMouse>"] = actions.select_entry, + ["-"] = actions.toggle_stage_entry, -- Stage / unstage the selected entry. + ["S"] = actions.stage_all, -- Stage all entries. + ["U"] = actions.unstage_all, -- Unstage all entries. + ["X"] = actions.restore_entry, -- Restore entry to the state on the left side. + ["R"] = actions.refresh_files, -- Update stats and entries in the file list. + ["L"] = actions.open_commit_log, -- Open the commit log panel. + [""] = actions.scroll_view(-0.25), -- Scroll the view up + [""] = actions.scroll_view(0.25), -- Scroll the view down + [""] = actions.select_next_entry, + [""] = actions.select_prev_entry, + ["gf"] = actions.goto_file, + [""] = actions.goto_file_split, + ["gf"] = actions.goto_file_tab, + ["i"] = actions.listing_style, -- Toggle between 'list' and 'tree' views + ["f"] = actions.toggle_flatten_dirs, -- Flatten empty subdirectories in tree listing style. + ["e"] = actions.focus_files, + ["b"] = actions.toggle_files, + }, + file_history_panel = { + ["g!"] = actions.options, -- Open the option panel + [""] = actions.open_in_diffview, -- Open the entry under the cursor in a diffview + ["y"] = actions.copy_hash, -- Copy the commit hash of the entry under the cursor + ["L"] = actions.open_commit_log, + ["zR"] = actions.open_all_folds, + ["zM"] = actions.close_all_folds, + ["j"] = actions.next_entry, + [""] = actions.next_entry, + ["k"] = actions.prev_entry, + [""] = actions.prev_entry, + [""] = actions.select_entry, + ["o"] = actions.select_entry, + ["<2-LeftMouse>"] = actions.select_entry, + [""] = actions.scroll_view(-0.25), + [""] = actions.scroll_view(0.25), + [""] = actions.select_next_entry, + [""] = actions.select_prev_entry, + ["gf"] = actions.goto_file, + [""] = actions.goto_file_split, + ["gf"] = actions.goto_file_tab, + ["e"] = actions.focus_files, + ["b"] = actions.toggle_files, + }, + option_panel = { + [""] = actions.select_entry, + ["q"] = actions.close, + }, + }, }) diff --git a/lua/kide/plugins/config/formatter.lua b/lua/kide/plugins/config/formatter.lua index c1163c5f..925e053b 100644 --- a/lua/kide/plugins/config/formatter.lua +++ b/lua/kide/plugins/config/formatter.lua @@ -1,28 +1,28 @@ local prettierConfig = function() - return { - exe = "prettier", - args = { "--stdin-filepath", vim.fn.shellescape(vim.api.nvim_buf_get_name(0)), "--single-quote" }, - stdin = true, - } + return { + exe = "prettier", + args = { "--stdin-filepath", vim.fn.shellescape(vim.api.nvim_buf_get_name(0)), "--single-quote" }, + stdin = true, + } end require("formatter").setup({ - filetype = { - -- lua = {function() return {exe = "lua-format", stdin = true} end}, - json = { prettierConfig }, - html = { prettierConfig }, - javascript = { prettierConfig }, - typescript = { prettierConfig }, - typescriptreact = { prettierConfig }, - markdown = { prettierConfig }, - sql = { - function() - return { - exe = "sql-formatter", - args = { vim.fn.shellescape(vim.api.nvim_buf_get_name(0)) }, - stdin = true, - } - end, - }, - }, + filetype = { + -- lua = {function() return {exe = "lua-format", stdin = true} end}, + json = { prettierConfig }, + html = { prettierConfig }, + javascript = { prettierConfig }, + typescript = { prettierConfig }, + typescriptreact = { prettierConfig }, + markdown = { prettierConfig }, + sql = { + function() + return { + exe = "sql-formatter", + args = { vim.fn.shellescape(vim.api.nvim_buf_get_name(0)) }, + stdin = true, + } + end, + }, + }, }) diff --git a/lua/kide/plugins/config/gitsigns-nvim.lua b/lua/kide/plugins/config/gitsigns-nvim.lua index c905b0c8..96c5bd48 100644 --- a/lua/kide/plugins/config/gitsigns-nvim.lua +++ b/lua/kide/plugins/config/gitsigns-nvim.lua @@ -1,94 +1,94 @@ require("gitsigns").setup({ - signs = { - add = { hl = "DiffAdd", text = "│", numhl = "GitSignsAddNr" }, - change = { hl = "DiffChange", text = "│", numhl = "GitSignsChangeNr" }, - delete = { hl = "DiffDelete", text = "", numhl = "GitSignsDeleteNr" }, - topdelete = { hl = "DiffDelete", text = "‾", numhl = "GitSignsDeleteNr" }, - changedelete = { hl = "DiffChangeDelete", text = "~", numhl = "GitSignsChangeNr" }, - }, - signcolumn = true, -- Toggle with `:Gitsigns toggle_signs` - numhl = false, -- Toggle with `:Gitsigns toggle_numhl` - linehl = false, -- Toggle with `:Gitsigns toggle_linehl` - word_diff = false, -- Toggle with `:Gitsigns toggle_word_diff` - watch_gitdir = { - interval = 1000, - follow_files = true, - }, - attach_to_untracked = true, - current_line_blame = true, -- Toggle with `:Gitsigns toggle_current_line_blame` - current_line_blame_opts = { - virt_text = true, - virt_text_pos = "eol", -- 'eol' | 'overlay' | 'right_align' - delay = 400, - ignore_whitespace = false, - }, - current_line_blame_formatter = ", - ", - current_line_blame_formatter_opts = { - relative_time = false, - }, - sign_priority = 6, - update_debounce = 100, - status_formatter = nil, -- Use default - max_file_length = 40000, - preview_config = { - -- Options passed to nvim_open_win - border = "single", - style = "minimal", - relative = "cursor", - row = 0, - col = 1, - }, - yadm = { - enable = false, - }, - on_attach = function(bufnr) - local gs = package.loaded.gitsigns + signs = { + add = { hl = "DiffAdd", text = "│", numhl = "GitSignsAddNr" }, + change = { hl = "DiffChange", text = "│", numhl = "GitSignsChangeNr" }, + delete = { hl = "DiffDelete", text = "", numhl = "GitSignsDeleteNr" }, + topdelete = { hl = "DiffDelete", text = "‾", numhl = "GitSignsDeleteNr" }, + changedelete = { hl = "DiffChangeDelete", text = "~", numhl = "GitSignsChangeNr" }, + }, + signcolumn = true, -- Toggle with `:Gitsigns toggle_signs` + numhl = false, -- Toggle with `:Gitsigns toggle_numhl` + linehl = false, -- Toggle with `:Gitsigns toggle_linehl` + word_diff = false, -- Toggle with `:Gitsigns toggle_word_diff` + watch_gitdir = { + interval = 1000, + follow_files = true, + }, + attach_to_untracked = true, + current_line_blame = true, -- Toggle with `:Gitsigns toggle_current_line_blame` + current_line_blame_opts = { + virt_text = true, + virt_text_pos = "eol", -- 'eol' | 'overlay' | 'right_align' + delay = 400, + ignore_whitespace = false, + }, + current_line_blame_formatter = ", - ", + current_line_blame_formatter_opts = { + relative_time = false, + }, + sign_priority = 6, + update_debounce = 100, + status_formatter = nil, -- Use default + max_file_length = 40000, + preview_config = { + -- Options passed to nvim_open_win + border = "single", + style = "minimal", + relative = "cursor", + row = 0, + col = 1, + }, + yadm = { + enable = false, + }, + on_attach = function(bufnr) + local gs = package.loaded.gitsigns - local function map(mode, l, r, opts) - opts = opts or {} - opts.buffer = bufnr - vim.keymap.set(mode, l, r, opts) - end + local function map(mode, l, r, opts) + opts = opts or {} + opts.buffer = bufnr + vim.keymap.set(mode, l, r, opts) + end - -- Navigation - map("n", "]c", function() - if vim.wo.diff then - return "]c" - end - vim.schedule(function() - gs.next_hunk() - end) - return "" - end, { expr = true }) + -- Navigation + map("n", "]c", function() + if vim.wo.diff then + return "]c" + end + vim.schedule(function() + gs.next_hunk() + end) + return "" + end, { expr = true }) - map("n", "[c", function() - if vim.wo.diff then - return "[c" - end - vim.schedule(function() - gs.prev_hunk() - end) - return "" - end, { expr = true }) + map("n", "[c", function() + if vim.wo.diff then + return "[c" + end + vim.schedule(function() + gs.prev_hunk() + end) + return "" + end, { expr = true }) - -- Actions - map({ "n", "v" }, "hs", ":Gitsigns stage_hunk") - map({ "n", "v" }, "hr", ":Gitsigns reset_hunk") - map("n", "hS", gs.stage_buffer) - map("n", "hu", gs.undo_stage_hunk) - map("n", "hR", gs.reset_buffer) - map("n", "hp", gs.preview_hunk) - map("n", "hb", function() - gs.blame_line({ full = true }) - end) - map("n", "tb", gs.toggle_current_line_blame) - map("n", "hd", gs.diffthis) - map("n", "hD", function() - gs.diffthis("~") - end) - map("n", "td", gs.toggle_deleted) + -- Actions + map({ "n", "v" }, "hs", ":Gitsigns stage_hunk") + map({ "n", "v" }, "hr", ":Gitsigns reset_hunk") + map("n", "hS", gs.stage_buffer) + map("n", "hu", gs.undo_stage_hunk) + map("n", "hR", gs.reset_buffer) + map("n", "hp", gs.preview_hunk) + map("n", "hb", function() + gs.blame_line({ full = true }) + end) + map("n", "tb", gs.toggle_current_line_blame) + map("n", "hd", gs.diffthis) + map("n", "hD", function() + gs.diffthis("~") + end) + map("n", "td", gs.toggle_deleted) - -- Text object - map({ "o", "x" }, "ih", ":Gitsigns select_hunk") - end, + -- Text object + map({ "o", "x" }, "ih", ":Gitsigns select_hunk") + end, }) diff --git a/lua/kide/plugins/config/gruvbox.lua b/lua/kide/plugins/config/gruvbox.lua index 3226b59f..05a1fac3 100644 --- a/lua/kide/plugins/config/gruvbox.lua +++ b/lua/kide/plugins/config/gruvbox.lua @@ -5,17 +5,17 @@ local overrides = {} overrides = vim.tbl_extend("force", overrides, require("kide.theme.telescope")) require("gruvbox").setup({ - undercurl = true, - underline = true, - bold = true, - italic = true, -- will make italic comments and special strings - inverse = true, -- invert background for search, diffs, statuslines and errors - invert_selection = false, - invert_signs = false, - invert_tabline = false, - invert_intend_guides = false, - contrast = "", -- can be "hard" or "soft" - overrides = overrides, + undercurl = true, + underline = true, + bold = true, + italic = true, -- will make italic comments and special strings + inverse = true, -- invert background for search, diffs, statuslines and errors + invert_selection = false, + invert_signs = false, + invert_tabline = false, + invert_intend_guides = false, + contrast = "", -- can be "hard" or "soft" + overrides = overrides, }) -- vim.api.nvim_command('colorscheme gruvbox') diff --git a/lua/kide/plugins/config/indent-blankline.lua b/lua/kide/plugins/config/indent-blankline.lua index 9fdd7ed0..cd0b1e5d 100644 --- a/lua/kide/plugins/config/indent-blankline.lua +++ b/lua/kide/plugins/config/indent-blankline.lua @@ -3,37 +3,37 @@ vim.opt.list = true -- vim.opt.listchars:append("eol:↴") require("indent_blankline").setup({ - -- show_end_of_line = true, - -- space_char_blankline = " ", - show_current_context = true, - -- show_current_context_start = true, - disable_with_nolist = true, - -- filetype_exclude = { "help", "terminal", "packer", "NvimTree", "git", "text" }, - filetype_exclude = { - "help", - "terminal", - "packer", - "markdown", - "git", - "text", - "NvimTree", - "dashboard", - "alpha", - "Outline", - }, - buftype_exclude = { "terminal" }, - use_treesitter = true, - context_patterns = { - "class", - "function", - "method", - "block", - "list_literal", - "selector", - "^if", - "^table", - "if_statement", - "while", - "for", - }, + -- show_end_of_line = true, + -- space_char_blankline = " ", + show_current_context = true, + -- show_current_context_start = true, + disable_with_nolist = true, + -- filetype_exclude = { "help", "terminal", "packer", "NvimTree", "git", "text" }, + filetype_exclude = { + "help", + "terminal", + "packer", + "markdown", + "git", + "text", + "NvimTree", + "dashboard", + "alpha", + "Outline", + }, + buftype_exclude = { "terminal" }, + use_treesitter = true, + context_patterns = { + "class", + "function", + "method", + "block", + "list_literal", + "selector", + "^if", + "^table", + "if_statement", + "while", + "for", + }, }) diff --git a/lua/kide/plugins/config/lsp-colors.lua b/lua/kide/plugins/config/lsp-colors.lua index 3d0ac0e6..cf7a458a 100644 --- a/lua/kide/plugins/config/lsp-colors.lua +++ b/lua/kide/plugins/config/lsp-colors.lua @@ -1,7 +1,7 @@ -- Lua require("lsp-colors").setup({ - Error = "#db4b4b", - Warning = "#e0af68", - Information = "#0db9d7", - Hint = "#10B981", + Error = "#db4b4b", + Warning = "#e0af68", + Information = "#0db9d7", + Hint = "#10B981", }) diff --git a/lua/kide/plugins/config/lsp_signature.lua b/lua/kide/plugins/config/lsp_signature.lua index ffc3ee51..6ef5cc2a 100644 --- a/lua/kide/plugins/config/lsp_signature.lua +++ b/lua/kide/plugins/config/lsp_signature.lua @@ -1,9 +1,9 @@ require("lsp_signature").on_attach({ - bind = true, - use_lspsaga = false, - floating_window = true, - fix_pos = true, - hint_enable = true, - hi_parameter = "Search", - handler_opts = { "double" }, + bind = true, + use_lspsaga = false, + floating_window = true, + fix_pos = true, + hint_enable = true, + hi_parameter = "Search", + handler_opts = { "double" }, }) diff --git a/lua/kide/plugins/config/lspsaga.lua b/lua/kide/plugins/config/lspsaga.lua index 3ba89453..6293dd16 100644 --- a/lua/kide/plugins/config/lspsaga.lua +++ b/lua/kide/plugins/config/lspsaga.lua @@ -37,8 +37,8 @@ local saga = require("lspsaga") -- server_filetype_map = {} saga.init_lsp_saga({ - diagnostic_header = { " ", " ", " ", " " }, - server_filetype_map = { - metals = { "java" }, - }, + diagnostic_header = { " ", " ", " ", " " }, + server_filetype_map = { + metals = { "java" }, + }, }) diff --git a/lua/kide/plugins/config/lualine.lua b/lua/kide/plugins/config/lualine.lua index 89ac7bb6..158e9e7d 100644 --- a/lua/kide/plugins/config/lualine.lua +++ b/lua/kide/plugins/config/lualine.lua @@ -1,44 +1,44 @@ local config = { - options = { - icons_enabled = true, - theme = "gruvbox", - component_separators = { left = "", right = "" }, - section_separators = { left = "", right = "" }, - disabled_filetypes = { - -- "dap-repl", "dapui_watches", "dapui_stacks", "dapui_breakpoints", "dapui_scopes" - }, - always_divide_middle = true, - }, - sections = { - lualine_a = { "mode" }, - lualine_b = { "branch", "diff", "diagnostics" }, - -- lualine_c = {'filename', 'lsp_progress'}, - lualine_c = { "filename" }, - lualine_x = { "encoding", "fileformat", "filetype" }, - lualine_y = { "progress" }, - lualine_z = { "location" }, - }, - inactive_sections = { - lualine_a = {}, - -- lualine_b = {function() return require('lsp-status').status() end}, - lualine_b = {}, - lualine_c = { "filename" }, - lualine_x = { "location" }, - lualine_y = {}, - lualine_z = {}, - }, - tabline = {}, - extensions = { "quickfix", "toggleterm", "fugitive", "symbols-outline", "nvim-dap-ui" }, + options = { + icons_enabled = true, + theme = "gruvbox", + component_separators = { left = "", right = "" }, + section_separators = { left = "", right = "" }, + disabled_filetypes = { + -- "dap-repl", "dapui_watches", "dapui_stacks", "dapui_breakpoints", "dapui_scopes" + }, + always_divide_middle = true, + }, + sections = { + lualine_a = { "mode" }, + lualine_b = { "branch", "diff", "diagnostics" }, + -- lualine_c = {'filename', 'lsp_progress'}, + lualine_c = { "filename" }, + lualine_x = { "encoding", "fileformat", "filetype" }, + lualine_y = { "progress" }, + lualine_z = { "location" }, + }, + inactive_sections = { + lualine_a = {}, + -- lualine_b = {function() return require('lsp-status').status() end}, + lualine_b = {}, + lualine_c = { "filename" }, + lualine_x = { "location" }, + lualine_y = {}, + lualine_z = {}, + }, + tabline = {}, + extensions = { "quickfix", "toggleterm", "fugitive", "symbols-outline", "nvim-dap-ui" }, } local dap = {} dap.sections = { - lualine_a = { - { "filename", file_status = false }, - }, + lualine_a = { + { "filename", file_status = false }, + }, } dap.filetypes = { - "dap-terminal", + "dap-terminal", } table.insert(config.extensions, dap) @@ -49,7 +49,7 @@ local nvim_tree = {} nvim_tree.sections = vim.deepcopy(nerdtree.sections) nvim_tree.sections.lualine_b = { "branch" } nvim_tree.filetypes = { - "NvimTree", + "NvimTree", } table.insert(config.extensions, nvim_tree) @@ -57,37 +57,37 @@ table.insert(config.extensions, nvim_tree) local db_connection_value = "default" local db_database_value = "default" require("sqls.events").add_subscriber("connection_choice", function(event) - local cs = vim.split(event.choice, " ") - db_connection_value = cs[3] - local db = vim.split(cs[4], "/") - if db[2] and db_database_value == "default" then - db_database_value = db[2] - end + local cs = vim.split(event.choice, " ") + db_connection_value = cs[3] + local db = vim.split(cs[4], "/") + if db[2] and db_database_value == "default" then + db_database_value = db[2] + end end) require("sqls.events").add_subscriber("database_choice", function(event) - db_database_value = event.choice + db_database_value = event.choice end) local function db_info() - return db_connection_value .. "->" .. db_database_value + return db_connection_value .. "->" .. db_database_value end local sqls = {} sqls.sections = vim.deepcopy(config.sections) table.insert(sqls.sections.lualine_c, db_info) sqls.filetypes = { - "sql", + "sql", } table.insert(config.extensions, sqls) -- DiffviewFilePanel local diffview = {} diffview.sections = { - lualine_a = { - { "filename", file_status = false }, - }, + lualine_a = { + { "filename", file_status = false }, + }, } diffview.filetypes = { - "DiffviewFiles", + "DiffviewFiles", } table.insert(config.extensions, diffview) diff --git a/lua/kide/plugins/config/luasnip.lua b/lua/kide/plugins/config/luasnip.lua index f26b07c6..7ee923b1 100644 --- a/lua/kide/plugins/config/luasnip.lua +++ b/lua/kide/plugins/config/luasnip.lua @@ -25,472 +25,472 @@ local conds = require("luasnip.extras.expand_conditions") -- Every unspecified option will be set to the default. ls.config.set_config({ - history = true, - -- Update more often, :h events for more info. - updateevents = "TextChanged,TextChangedI", - -- Snippets aren't automatically removed if their text is deleted. - -- `delete_check_events` determines on which events (:h events) a check for - -- deleted snippets is performed. - -- This can be especially useful when `history` is enabled. - delete_check_events = "TextChanged", - ext_opts = { - [types.choiceNode] = { - active = { - virt_text = { { "●", "GruvboxOrange" } }, - }, - }, - [types.insertNode] = { - active = { - virt_text = { { "●", "GruvboxBlue" } }, - }, - }, - }, + history = true, + -- Update more often, :h events for more info. + updateevents = "TextChanged,TextChangedI", + -- Snippets aren't automatically removed if their text is deleted. + -- `delete_check_events` determines on which events (:h events) a check for + -- deleted snippets is performed. + -- This can be especially useful when `history` is enabled. + delete_check_events = "TextChanged", + ext_opts = { + [types.choiceNode] = { + active = { + virt_text = { { "●", "GruvboxOrange" } }, + }, + }, + [types.insertNode] = { + active = { + virt_text = { { "●", "GruvboxBlue" } }, + }, + }, + }, - -- treesitter-hl has 100, use something higher (default is 200). - ext_base_prio = 300, - -- minimal increase in priority. - ext_prio_increase = 1, - enable_autosnippets = true, - -- mapping for cutting selected text so it's usable as SELECT_DEDENT, - -- SELECT_RAW or TM_SELECTED_TEXT (mapped via xmap). - store_selection_keys = "", - -- luasnip uses this function to get the currently active filetype. This - -- is the (rather uninteresting) default, but it's possible to use - -- eg. treesitter for getting the current filetype by setting ft_func to - -- require("luasnip.extras.filetype_functions").from_cursor (requires - -- `nvim-treesitter/nvim-treesitter`). This allows correctly resolving - -- the current filetype in eg. a markdown-code block or `vim.cmd()`. - ft_func = function() - return vim.split(vim.bo.filetype, ".", true) - end, + -- treesitter-hl has 100, use something higher (default is 200). + ext_base_prio = 300, + -- minimal increase in priority. + ext_prio_increase = 1, + enable_autosnippets = true, + -- mapping for cutting selected text so it's usable as SELECT_DEDENT, + -- SELECT_RAW or TM_SELECTED_TEXT (mapped via xmap). + store_selection_keys = "", + -- luasnip uses this function to get the currently active filetype. This + -- is the (rather uninteresting) default, but it's possible to use + -- eg. treesitter for getting the current filetype by setting ft_func to + -- require("luasnip.extras.filetype_functions").from_cursor (requires + -- `nvim-treesitter/nvim-treesitter`). This allows correctly resolving + -- the current filetype in eg. a markdown-code block or `vim.cmd()`. + ft_func = function() + return vim.split(vim.bo.filetype, ".", true) + end, }) -- args is a table, where 1 is the text in Placeholder 1, 2 the text in -- placeholder 2,... local function copy(args) - return args[1] + return args[1] end -- 'recursive' dynamic snippet. Expands to some text followed by itself. local rec_ls rec_ls = function() - return sn( - nil, - c(1, { - -- Order is important, sn(...) first would cause infinite loop of expansion. - t(""), - sn(nil, { t({ "", "\t\\item " }), i(1), d(2, rec_ls, {}) }), - }) - ) + return sn( + nil, + c(1, { + -- Order is important, sn(...) first would cause infinite loop of expansion. + t(""), + sn(nil, { t({ "", "\t\\item " }), i(1), d(2, rec_ls, {}) }), + }) + ) end -- complicated function for dynamicNode. local function jdocsnip(args, _, old_state) - -- !!! old_state is used to preserve user-input here. DON'T DO IT THAT WAY! - -- Using a restoreNode instead is much easier. - -- View this only as an example on how old_state functions. - local nodes = { - t({ "/**", " * " }), - i(1, "A short Description"), - t({ "", "" }), - } + -- !!! old_state is used to preserve user-input here. DON'T DO IT THAT WAY! + -- Using a restoreNode instead is much easier. + -- View this only as an example on how old_state functions. + local nodes = { + t({ "/**", " * " }), + i(1, "A short Description"), + t({ "", "" }), + } - -- These will be merged with the snippet; that way, should the snippet be updated, - -- some user input eg. text can be referred to in the new snippet. - local param_nodes = {} + -- These will be merged with the snippet; that way, should the snippet be updated, + -- some user input eg. text can be referred to in the new snippet. + local param_nodes = {} - if old_state then - nodes[2] = i(1, old_state.descr:get_text()) - end - param_nodes.descr = nodes[2] + if old_state then + nodes[2] = i(1, old_state.descr:get_text()) + end + param_nodes.descr = nodes[2] - -- At least one param. - if string.find(args[2][1], ", ") then - vim.list_extend(nodes, { t({ " * ", "" }) }) - end + -- At least one param. + if string.find(args[2][1], ", ") then + vim.list_extend(nodes, { t({ " * ", "" }) }) + end - local insert = 2 - for indx, arg in ipairs(vim.split(args[2][1], ", ", true)) do - -- Get actual name parameter. - arg = vim.split(arg, " ", true)[2] - if arg then - local inode - -- if there was some text in this parameter, use it as static_text for this new snippet. - if old_state and old_state[arg] then - inode = i(insert, old_state["arg" .. arg]:get_text()) - else - inode = i(insert) - end - vim.list_extend(nodes, { t({ " * @param " .. arg .. " " }), inode, t({ "", "" }) }) - param_nodes["arg" .. arg] = inode + local insert = 2 + for indx, arg in ipairs(vim.split(args[2][1], ", ", true)) do + -- Get actual name parameter. + arg = vim.split(arg, " ", true)[2] + if arg then + local inode + -- if there was some text in this parameter, use it as static_text for this new snippet. + if old_state and old_state[arg] then + inode = i(insert, old_state["arg" .. arg]:get_text()) + else + inode = i(insert) + end + vim.list_extend(nodes, { t({ " * @param " .. arg .. " " }), inode, t({ "", "" }) }) + param_nodes["arg" .. arg] = inode - insert = insert + 1 - end - end + insert = insert + 1 + end + end - if args[1][1] ~= "void" then - local inode - if old_state and old_state.ret then - inode = i(insert, old_state.ret:get_text()) - else - inode = i(insert) - end + if args[1][1] ~= "void" then + local inode + if old_state and old_state.ret then + inode = i(insert, old_state.ret:get_text()) + else + inode = i(insert) + end - vim.list_extend(nodes, { t({ " * ", " * @return " }), inode, t({ "", "" }) }) - param_nodes.ret = inode - insert = insert + 1 - end + vim.list_extend(nodes, { t({ " * ", " * @return " }), inode, t({ "", "" }) }) + param_nodes.ret = inode + insert = insert + 1 + end - if vim.tbl_count(args[3]) ~= 1 then - local exc = string.gsub(args[3][2], " throws ", "") - local ins - if old_state and old_state.ex then - ins = i(insert, old_state.ex:get_text()) - else - ins = i(insert) - end - vim.list_extend(nodes, { t({ " * ", " * @throws " .. exc .. " " }), ins, t({ "", "" }) }) - param_nodes.ex = ins - insert = insert + 1 - end + if vim.tbl_count(args[3]) ~= 1 then + local exc = string.gsub(args[3][2], " throws ", "") + local ins + if old_state and old_state.ex then + ins = i(insert, old_state.ex:get_text()) + else + ins = i(insert) + end + vim.list_extend(nodes, { t({ " * ", " * @throws " .. exc .. " " }), ins, t({ "", "" }) }) + param_nodes.ex = ins + insert = insert + 1 + end - vim.list_extend(nodes, { t({ " */" }) }) + vim.list_extend(nodes, { t({ " */" }) }) - local snip = sn(nil, nodes) - -- Error on attempting overwrite. - snip.old_state = param_nodes - return snip + local snip = sn(nil, nodes) + -- Error on attempting overwrite. + snip.old_state = param_nodes + return snip end -- Make sure to not pass an invalid command, as io.popen() may write over nvim-text. local function bash(_, _, command) - local file = io.popen(command, "r") - local res = {} - for line in file:lines() do - table.insert(res, line) - end - return res + local file = io.popen(command, "r") + local res = {} + for line in file:lines() do + table.insert(res, line) + end + return res end -- Returns a snippet_node wrapped around an insert_node whose initial -- text value is set to the current date in the desired format. local date_input = function(args, state, fmt) - local fmt = fmt or "%Y-%m-%d" - return sn(nil, i(1, os.date(fmt))) + local fmt = fmt or "%Y-%m-%d" + return sn(nil, i(1, os.date(fmt))) end ls.snippets = { - -- When trying to expand a snippet, luasnip first searches the tables for - -- each filetype specified in 'filetype' followed by 'all'. - -- If ie. the filetype is 'lua.c' - -- - luasnip.lua - -- - luasnip.c - -- - luasnip.all - -- are searched in that order. - all = { - -- trigger is `fn`, second argument to snippet-constructor are the nodes to insert into the buffer on expansion. - s("fn", { - -- Simple static text. - t("//Parameters: "), - -- function, first parameter is the function, second the Placeholders - -- whose text it gets as input. - f(copy, 2), - t({ "", "function " }), - -- Placeholder/Insert. - i(1), - t("("), - -- Placeholder with initial text. - i(2, "int foo"), - -- Linebreak - t({ ") {", "\t" }), - -- Last Placeholder, exit Point of the snippet. - i(0), - t({ "", "}" }), - }), - s("class", { - -- Choice: Switch between two different Nodes, first parameter is its position, second a list of nodes. - c(1, { - t("public "), - t("private "), - }), - t("class "), - i(2), - t(" "), - c(3, { - t("{"), - -- sn: Nested Snippet. Instead of a trigger, it has a position, just like insert-nodes. !!! These don't expect a 0-node!!!! - -- Inside Choices, Nodes don't need a position as the choice node is the one being jumped to. - sn(nil, { - t("extends "), - -- restoreNode: stores and restores nodes. - -- pass position, store-key and nodes. - r(1, "other_class", i(1)), - t(" {"), - }), - sn(nil, { - t("implements "), - -- no need to define the nodes for a given key a second time. - r(1, "other_class"), - t(" {"), - }), - }), - t({ "", "\t" }), - i(0), - t({ "", "}" }), - }), - -- Alternative printf-like notation for defining snippets. It uses format - -- string with placeholders similar to the ones used with Python's .format(). - s( - "fmt1", - fmt("To {title} {} {}.", { - i(2, "Name"), - i(3, "Surname"), - title = c(1, { t("Mr."), t("Ms.") }), - }) - ), - -- To escape delimiters use double them, e.g. `{}` -> `{{}}`. - -- Multi-line format strings by default have empty first/last line removed. - -- Indent common to all lines is also removed. Use the third `opts` argument - -- to control this behaviour. - s( - "fmt2", - fmt( - [[ + -- When trying to expand a snippet, luasnip first searches the tables for + -- each filetype specified in 'filetype' followed by 'all'. + -- If ie. the filetype is 'lua.c' + -- - luasnip.lua + -- - luasnip.c + -- - luasnip.all + -- are searched in that order. + all = { + -- trigger is `fn`, second argument to snippet-constructor are the nodes to insert into the buffer on expansion. + s("fn", { + -- Simple static text. + t("//Parameters: "), + -- function, first parameter is the function, second the Placeholders + -- whose text it gets as input. + f(copy, 2), + t({ "", "function " }), + -- Placeholder/Insert. + i(1), + t("("), + -- Placeholder with initial text. + i(2, "int foo"), + -- Linebreak + t({ ") {", "\t" }), + -- Last Placeholder, exit Point of the snippet. + i(0), + t({ "", "}" }), + }), + s("class", { + -- Choice: Switch between two different Nodes, first parameter is its position, second a list of nodes. + c(1, { + t("public "), + t("private "), + }), + t("class "), + i(2), + t(" "), + c(3, { + t("{"), + -- sn: Nested Snippet. Instead of a trigger, it has a position, just like insert-nodes. !!! These don't expect a 0-node!!!! + -- Inside Choices, Nodes don't need a position as the choice node is the one being jumped to. + sn(nil, { + t("extends "), + -- restoreNode: stores and restores nodes. + -- pass position, store-key and nodes. + r(1, "other_class", i(1)), + t(" {"), + }), + sn(nil, { + t("implements "), + -- no need to define the nodes for a given key a second time. + r(1, "other_class"), + t(" {"), + }), + }), + t({ "", "\t" }), + i(0), + t({ "", "}" }), + }), + -- Alternative printf-like notation for defining snippets. It uses format + -- string with placeholders similar to the ones used with Python's .format(). + s( + "fmt1", + fmt("To {title} {} {}.", { + i(2, "Name"), + i(3, "Surname"), + title = c(1, { t("Mr."), t("Ms.") }), + }) + ), + -- To escape delimiters use double them, e.g. `{}` -> `{{}}`. + -- Multi-line format strings by default have empty first/last line removed. + -- Indent common to all lines is also removed. Use the third `opts` argument + -- to control this behaviour. + s( + "fmt2", + fmt( + [[ foo({1}, {3}) {{ return {2} * {4} }} ]], - { - i(1, "x"), - rep(1), - i(2, "y"), - rep(2), - } - ) - ), - -- Empty placeholders are numbered automatically starting from 1 or the last - -- value of a numbered placeholder. Named placeholders do not affect numbering. - s( - "fmt3", - fmt("{} {a} {} {1} {}", { - t("1"), - t("2"), - a = t("A"), - }) - ), - -- The delimiters can be changed from the default `{}` to something else. - s("fmt4", fmt("foo() { return []; }", i(1, "x"), { delimiters = "[]" })), - -- `fmta` is a convenient wrapper that uses `<>` instead of `{}`. - s("fmt5", fmta("foo() { return <>; }", i(1, "x"))), - -- By default all args must be used. Use strict=false to disable the check - s("fmt6", fmt("use {} only", { t("this"), t("not this") }, { strict = false })), - -- Use a dynamic_node to interpolate the output of a - -- function (see date_input above) into the initial - -- value of an insert_node. - s("novel", { - t("It was a dark and stormy night on "), - d(1, date_input, {}, "%A, %B %d of %Y"), - t(" and the clocks were striking thirteen."), - }), - -- Parsing snippets: First parameter: Snippet-Trigger, Second: Snippet body. - -- Placeholders are parsed into choices with 1. the placeholder text(as a snippet) and 2. an empty string. - -- This means they are not SELECTed like in other editors/Snippet engines. - ls.parser.parse_snippet("lspsyn", "Wow! This ${1:Stuff} really ${2:works. ${3:Well, a bit.}}"), + { + i(1, "x"), + rep(1), + i(2, "y"), + rep(2), + } + ) + ), + -- Empty placeholders are numbered automatically starting from 1 or the last + -- value of a numbered placeholder. Named placeholders do not affect numbering. + s( + "fmt3", + fmt("{} {a} {} {1} {}", { + t("1"), + t("2"), + a = t("A"), + }) + ), + -- The delimiters can be changed from the default `{}` to something else. + s("fmt4", fmt("foo() { return []; }", i(1, "x"), { delimiters = "[]" })), + -- `fmta` is a convenient wrapper that uses `<>` instead of `{}`. + s("fmt5", fmta("foo() { return <>; }", i(1, "x"))), + -- By default all args must be used. Use strict=false to disable the check + s("fmt6", fmt("use {} only", { t("this"), t("not this") }, { strict = false })), + -- Use a dynamic_node to interpolate the output of a + -- function (see date_input above) into the initial + -- value of an insert_node. + s("novel", { + t("It was a dark and stormy night on "), + d(1, date_input, {}, "%A, %B %d of %Y"), + t(" and the clocks were striking thirteen."), + }), + -- Parsing snippets: First parameter: Snippet-Trigger, Second: Snippet body. + -- Placeholders are parsed into choices with 1. the placeholder text(as a snippet) and 2. an empty string. + -- This means they are not SELECTed like in other editors/Snippet engines. + ls.parser.parse_snippet("lspsyn", "Wow! This ${1:Stuff} really ${2:works. ${3:Well, a bit.}}"), - -- When wordTrig is set to false, snippets may also expand inside other words. - ls.parser.parse_snippet({ trig = "te", wordTrig = false }, "${1:cond} ? ${2:true} : ${3:false}"), + -- When wordTrig is set to false, snippets may also expand inside other words. + ls.parser.parse_snippet({ trig = "te", wordTrig = false }, "${1:cond} ? ${2:true} : ${3:false}"), - -- When regTrig is set, trig is treated like a pattern, this snippet will expand after any number. - ls.parser.parse_snippet({ trig = "%d", regTrig = true }, "A Number!!"), - -- Using the condition, it's possible to allow expansion only in specific cases. - s("cond", { - t("will only expand in c-style comments"), - }, { - condition = function(line_to_cursor, matched_trigger, captures) - -- optional whitespace followed by // - return line_to_cursor:match("%s*//") - end, - }), - -- there's some built-in conditions in "luasnip.extras.expand_conditions". - s("cond2", { - t("will only expand at the beginning of the line"), - }, { - condition = conds.line_begin, - }), - -- The last entry of args passed to the user-function is the surrounding snippet. - s( - { trig = "a%d", regTrig = true }, - f(function(_, snip) - return "Triggered with " .. snip.trigger .. "." - end, {}) - ), - -- It's possible to use capture-groups inside regex-triggers. - s( - { trig = "b(%d)", regTrig = true }, - f(function(_, snip) - return "Captured Text: " .. snip.captures[1] .. "." - end, {}) - ), - s({ trig = "c(%d+)", regTrig = true }, { - t("will only expand for even numbers"), - }, { - condition = function(line_to_cursor, matched_trigger, captures) - return tonumber(captures[1]) % 2 == 0 - end, - }), - -- Use a function to execute any shell command and print its text. - s("bash", f(bash, {}, "ls")), - -- Short version for applying String transformations using function nodes. - s("transform", { - i(1, "initial text"), - t({ "", "" }), - -- lambda nodes accept an l._1,2,3,4,5, which in turn accept any string transformations. - -- This list will be applied in order to the first node given in the second argument. - l(l._1:match("[^i]*$"):gsub("i", "o"):gsub(" ", "_"):upper(), 1), - }), - s("transform2", { - i(1, "initial text"), - t("::"), - i(2, "replacement for e"), - t({ "", "" }), - -- Lambdas can also apply transforms USING the text of other nodes: - l(l._1:gsub("e", l._2), { 1, 2 }), - }), - s({ trig = "trafo(%d+)", regTrig = true }, { - -- env-variables and captures can also be used: - l(l.CAPTURE1:gsub("1", l.TM_FILENAME), {}), - }), - -- Set store_selection_keys = "" (for example) in your - -- luasnip.config.setup() call to populate - -- TM_SELECTED_TEXT/SELECT_RAW/SELECT_DEDENT. - -- In this case: select a URL, hit Tab, then expand this snippet. - s("link_url", { - t(''), - i(1), - t(""), - i(0), - }), - -- Shorthand for repeating the text in a given node. - s("repeat", { i(1, "text"), t({ "", "" }), rep(1) }), - -- Directly insert the ouput from a function evaluated at runtime. - s("part", p(os.date, "%Y")), - -- use matchNodes (`m(argnode, condition, then, else)`) to insert text - -- based on a pattern/function/lambda-evaluation. - -- It's basically a shortcut for simple functionNodes: - s("mat", { - i(1, { "sample_text" }), - t(": "), - m(1, "%d", "contains a number", "no number :("), - }), - -- The `then`-text defaults to the first capture group/the entire - -- match if there are none. - s("mat2", { - i(1, { "sample_text" }), - t(": "), - m(1, "[abc][abc][abc]"), - }), - -- It is even possible to apply gsubs' or other transformations - -- before matching. - s("mat3", { - i(1, { "sample_text" }), - t(": "), - m(1, l._1:gsub("[123]", ""):match("%d"), "contains a number that isn't 1, 2 or 3!"), - }), - -- `match` also accepts a function in place of the condition, which in - -- turn accepts the usual functionNode-args. - -- The condition is considered true if the function returns any - -- non-nil/false-value. - -- If that value is a string, it is used as the `if`-text if no if is explicitly given. - s("mat4", { - i(1, { "sample_text" }), - t(": "), - m(1, function(args) - -- args is a table of multiline-strings (as usual). - return (#args[1][1] % 2 == 0 and args[1]) or nil - end), - }), - -- The nonempty-node inserts text depending on whether the arg-node is - -- empty. - s("nempty", { - i(1, "sample_text"), - n(1, "i(1) is not empty!"), - }), - -- dynamic lambdas work exactly like regular lambdas, except that they - -- don't return a textNode, but a dynamicNode containing one insertNode. - -- This makes it easier to dynamically set preset-text for insertNodes. - s("dl1", { - i(1, "sample_text"), - t({ ":", "" }), - dl(2, l._1, 1), - }), - -- Obviously, it's also possible to apply transformations, just like lambdas. - s("dl2", { - i(1, "sample_text"), - i(2, "sample_text_2"), - t({ "", "" }), - dl(3, l._1:gsub("\n", " linebreak ") .. l._2, { 1, 2 }), - }), - }, - java = { - -- Very long example for a java class. - s("fn", { - d(6, jdocsnip, { 2, 4, 5 }), - t({ "", "" }), - c(1, { - t("public "), - t("private "), - }), - c(2, { - t("void"), - t("String"), - t("char"), - t("int"), - t("double"), - t("boolean"), - i(nil, ""), - }), - t(" "), - i(3, "myFunc"), - t("("), - i(4), - t(")"), - c(5, { - t(""), - sn(nil, { - t({ "", " throws " }), - i(1), - }), - }), - t({ " {", "\t" }), - i(0), - t({ "", "}" }), - }), - }, - tex = { - -- rec_ls is self-referencing. That makes this snippet 'infinite' eg. have as many - -- \item as necessary by utilizing a choiceNode. - s("ls", { - t({ "\\begin{itemize}", "\t\\item " }), - i(1), - d(2, rec_ls, {}), - t({ "", "\\end{itemize}" }), - }), - }, + -- When regTrig is set, trig is treated like a pattern, this snippet will expand after any number. + ls.parser.parse_snippet({ trig = "%d", regTrig = true }, "A Number!!"), + -- Using the condition, it's possible to allow expansion only in specific cases. + s("cond", { + t("will only expand in c-style comments"), + }, { + condition = function(line_to_cursor, matched_trigger, captures) + -- optional whitespace followed by // + return line_to_cursor:match("%s*//") + end, + }), + -- there's some built-in conditions in "luasnip.extras.expand_conditions". + s("cond2", { + t("will only expand at the beginning of the line"), + }, { + condition = conds.line_begin, + }), + -- The last entry of args passed to the user-function is the surrounding snippet. + s( + { trig = "a%d", regTrig = true }, + f(function(_, snip) + return "Triggered with " .. snip.trigger .. "." + end, {}) + ), + -- It's possible to use capture-groups inside regex-triggers. + s( + { trig = "b(%d)", regTrig = true }, + f(function(_, snip) + return "Captured Text: " .. snip.captures[1] .. "." + end, {}) + ), + s({ trig = "c(%d+)", regTrig = true }, { + t("will only expand for even numbers"), + }, { + condition = function(line_to_cursor, matched_trigger, captures) + return tonumber(captures[1]) % 2 == 0 + end, + }), + -- Use a function to execute any shell command and print its text. + s("bash", f(bash, {}, "ls")), + -- Short version for applying String transformations using function nodes. + s("transform", { + i(1, "initial text"), + t({ "", "" }), + -- lambda nodes accept an l._1,2,3,4,5, which in turn accept any string transformations. + -- This list will be applied in order to the first node given in the second argument. + l(l._1:match("[^i]*$"):gsub("i", "o"):gsub(" ", "_"):upper(), 1), + }), + s("transform2", { + i(1, "initial text"), + t("::"), + i(2, "replacement for e"), + t({ "", "" }), + -- Lambdas can also apply transforms USING the text of other nodes: + l(l._1:gsub("e", l._2), { 1, 2 }), + }), + s({ trig = "trafo(%d+)", regTrig = true }, { + -- env-variables and captures can also be used: + l(l.CAPTURE1:gsub("1", l.TM_FILENAME), {}), + }), + -- Set store_selection_keys = "" (for example) in your + -- luasnip.config.setup() call to populate + -- TM_SELECTED_TEXT/SELECT_RAW/SELECT_DEDENT. + -- In this case: select a URL, hit Tab, then expand this snippet. + s("link_url", { + t(''), + i(1), + t(""), + i(0), + }), + -- Shorthand for repeating the text in a given node. + s("repeat", { i(1, "text"), t({ "", "" }), rep(1) }), + -- Directly insert the ouput from a function evaluated at runtime. + s("part", p(os.date, "%Y")), + -- use matchNodes (`m(argnode, condition, then, else)`) to insert text + -- based on a pattern/function/lambda-evaluation. + -- It's basically a shortcut for simple functionNodes: + s("mat", { + i(1, { "sample_text" }), + t(": "), + m(1, "%d", "contains a number", "no number :("), + }), + -- The `then`-text defaults to the first capture group/the entire + -- match if there are none. + s("mat2", { + i(1, { "sample_text" }), + t(": "), + m(1, "[abc][abc][abc]"), + }), + -- It is even possible to apply gsubs' or other transformations + -- before matching. + s("mat3", { + i(1, { "sample_text" }), + t(": "), + m(1, l._1:gsub("[123]", ""):match("%d"), "contains a number that isn't 1, 2 or 3!"), + }), + -- `match` also accepts a function in place of the condition, which in + -- turn accepts the usual functionNode-args. + -- The condition is considered true if the function returns any + -- non-nil/false-value. + -- If that value is a string, it is used as the `if`-text if no if is explicitly given. + s("mat4", { + i(1, { "sample_text" }), + t(": "), + m(1, function(args) + -- args is a table of multiline-strings (as usual). + return (#args[1][1] % 2 == 0 and args[1]) or nil + end), + }), + -- The nonempty-node inserts text depending on whether the arg-node is + -- empty. + s("nempty", { + i(1, "sample_text"), + n(1, "i(1) is not empty!"), + }), + -- dynamic lambdas work exactly like regular lambdas, except that they + -- don't return a textNode, but a dynamicNode containing one insertNode. + -- This makes it easier to dynamically set preset-text for insertNodes. + s("dl1", { + i(1, "sample_text"), + t({ ":", "" }), + dl(2, l._1, 1), + }), + -- Obviously, it's also possible to apply transformations, just like lambdas. + s("dl2", { + i(1, "sample_text"), + i(2, "sample_text_2"), + t({ "", "" }), + dl(3, l._1:gsub("\n", " linebreak ") .. l._2, { 1, 2 }), + }), + }, + java = { + -- Very long example for a java class. + s("fn", { + d(6, jdocsnip, { 2, 4, 5 }), + t({ "", "" }), + c(1, { + t("public "), + t("private "), + }), + c(2, { + t("void"), + t("String"), + t("char"), + t("int"), + t("double"), + t("boolean"), + i(nil, ""), + }), + t(" "), + i(3, "myFunc"), + t("("), + i(4), + t(")"), + c(5, { + t(""), + sn(nil, { + t({ "", " throws " }), + i(1), + }), + }), + t({ " {", "\t" }), + i(0), + t({ "", "}" }), + }), + }, + tex = { + -- rec_ls is self-referencing. That makes this snippet 'infinite' eg. have as many + -- \item as necessary by utilizing a choiceNode. + s("ls", { + t({ "\\begin{itemize}", "\t\\item " }), + i(1), + d(2, rec_ls, {}), + t({ "", "\\end{itemize}" }), + }), + }, } -- autotriggered snippets have to be defined in a separate table, luasnip.autosnippets. ls.autosnippets = { - all = { - s("autotrigger", { - t("autosnippet"), - }), - }, + all = { + s("autotrigger", { + t("autosnippet"), + }), + }, } -- in a lua file: search lua-, then c-, then all-snippets. diff --git a/lua/kide/plugins/config/neogit.lua b/lua/kide/plugins/config/neogit.lua index ca9d3d81..b9aed821 100644 --- a/lua/kide/plugins/config/neogit.lua +++ b/lua/kide/plugins/config/neogit.lua @@ -1,75 +1,75 @@ local neogit = require("neogit") neogit.setup({ - disable_signs = false, - disable_hint = false, - disable_context_highlighting = false, - disable_commit_confirmation = false, - -- Neogit refreshes its internal state after specific events, which can be expensive depending on the repository size. - -- Disabling `auto_refresh` will make it so you have to manually refresh the status after you open it. - auto_refresh = true, - disable_builtin_notifications = false, - use_magit_keybindings = false, - commit_popup = { - kind = "split", - }, - -- Change the default way of opening neogit - kind = "tab", - -- customize displayed signs - signs = { - -- { CLOSED, OPENED } - section = { ">", "v" }, - item = { ">", "v" }, - hunk = { "", "" }, - }, - integrations = { - -- Neogit only provides inline diffs. If you want a more traditional way to look at diffs, you can use `sindrets/diffview.nvim`. - -- The diffview integration enables the diff popup, which is a wrapper around `sindrets/diffview.nvim`. - -- - -- Requires you to have `sindrets/diffview.nvim` installed. - -- use { - -- 'TimUntersberger/neogit', - -- requires = { - -- 'nvim-lua/plenary.nvim', - -- 'sindrets/diffview.nvim' - -- } - -- } - -- - diffview = true, - }, - -- Setting any section to `false` will make the section not render at all - sections = { - untracked = { - folded = false, - }, - unstaged = { - folded = false, - }, - staged = { - folded = false, - }, - stashes = { - folded = true, - }, - unpulled = { - folded = true, - }, - unmerged = { - folded = false, - }, - recent = { - folded = true, - }, - }, - -- override/add mappings - mappings = { - -- modify status buffer mappings - status = { - -- Adds a mapping with "B" as key that does the "BranchPopup" command - ["B"] = "BranchPopup", - }, - }, - status = { - recent_commit_count = 40, - }, + disable_signs = false, + disable_hint = false, + disable_context_highlighting = false, + disable_commit_confirmation = false, + -- Neogit refreshes its internal state after specific events, which can be expensive depending on the repository size. + -- Disabling `auto_refresh` will make it so you have to manually refresh the status after you open it. + auto_refresh = true, + disable_builtin_notifications = false, + use_magit_keybindings = false, + commit_popup = { + kind = "split", + }, + -- Change the default way of opening neogit + kind = "tab", + -- customize displayed signs + signs = { + -- { CLOSED, OPENED } + section = { ">", "v" }, + item = { ">", "v" }, + hunk = { "", "" }, + }, + integrations = { + -- Neogit only provides inline diffs. If you want a more traditional way to look at diffs, you can use `sindrets/diffview.nvim`. + -- The diffview integration enables the diff popup, which is a wrapper around `sindrets/diffview.nvim`. + -- + -- Requires you to have `sindrets/diffview.nvim` installed. + -- use { + -- 'TimUntersberger/neogit', + -- requires = { + -- 'nvim-lua/plenary.nvim', + -- 'sindrets/diffview.nvim' + -- } + -- } + -- + diffview = true, + }, + -- Setting any section to `false` will make the section not render at all + sections = { + untracked = { + folded = false, + }, + unstaged = { + folded = false, + }, + staged = { + folded = false, + }, + stashes = { + folded = true, + }, + unpulled = { + folded = true, + }, + unmerged = { + folded = false, + }, + recent = { + folded = true, + }, + }, + -- override/add mappings + mappings = { + -- modify status buffer mappings + status = { + -- Adds a mapping with "B" as key that does the "BranchPopup" command + ["B"] = "BranchPopup", + }, + }, + status = { + recent_commit_count = 40, + }, }) diff --git a/lua/kide/plugins/config/null-ls.lua b/lua/kide/plugins/config/null-ls.lua index 77446958..0f8ced05 100644 --- a/lua/kide/plugins/config/null-ls.lua +++ b/lua/kide/plugins/config/null-ls.lua @@ -2,64 +2,64 @@ local null_ls = require("null-ls") -- register any number of sources simultaneously local sources = { - null_ls.builtins.formatting.prettier.with({ - filetypes = { - "javascript", - "javascriptreact", - "typescript", - "typescriptreact", - "vue", - "css", - "scss", - "less", - "html", - "json", - "jsonc", - "yaml", - "markdown", - "graphql", - "handlebars", - }, - }), - -- null_ls.builtins.formatting.jq, - -- xml - null_ls.builtins.formatting.xmllint, - -- toml - null_ls.builtins.formatting.taplo, - -- sh - null_ls.builtins.code_actions.shellcheck, - null_ls.builtins.diagnostics.shellcheck, - null_ls.builtins.formatting.shellharden, - -- lua - null_ls.builtins.formatting.stylua, - -- word - null_ls.builtins.diagnostics.write_good.with({ - method = null_ls.methods.DIAGNOSTICS_ON_SAVE, - }), - -- md - null_ls.builtins.diagnostics.markdownlint.with({ - method = null_ls.methods.DIAGNOSTICS_ON_SAVE, - }), - -- null_ls.builtins.code_actions.gitsigns, - -- sql - null_ls.builtins.formatting.sql_formatter, - -- null_ls.builtins.formatting.google_java_format, - -- null_ls.builtins.diagnostics.semgrep, - null_ls.builtins.formatting.rustfmt, - -- null_ls.builtins.diagnostics.semgrep.with({ - -- method = null_ls.methods.DIAGNOSTICS_ON_SAVE, - -- extra_args = { "--config", "p/java" }, - -- }), + null_ls.builtins.formatting.prettier.with({ + filetypes = { + "javascript", + "javascriptreact", + "typescript", + "typescriptreact", + "vue", + "css", + "scss", + "less", + "html", + "json", + "jsonc", + "yaml", + "markdown", + "graphql", + "handlebars", + }, + }), + -- null_ls.builtins.formatting.jq, + -- xml + null_ls.builtins.formatting.xmllint, + -- toml + null_ls.builtins.formatting.taplo, + -- sh + null_ls.builtins.code_actions.shellcheck, + null_ls.builtins.diagnostics.shellcheck, + null_ls.builtins.formatting.shellharden, + -- lua + null_ls.builtins.formatting.stylua, + -- word + null_ls.builtins.diagnostics.write_good.with({ + method = null_ls.methods.DIAGNOSTICS_ON_SAVE, + }), + -- md + null_ls.builtins.diagnostics.markdownlint.with({ + method = null_ls.methods.DIAGNOSTICS_ON_SAVE, + }), + -- null_ls.builtins.code_actions.gitsigns, + -- sql + null_ls.builtins.formatting.sql_formatter, + -- null_ls.builtins.formatting.google_java_format, + -- null_ls.builtins.diagnostics.semgrep, + null_ls.builtins.formatting.rustfmt, + -- null_ls.builtins.diagnostics.semgrep.with({ + -- method = null_ls.methods.DIAGNOSTICS_ON_SAVE, + -- extra_args = { "--config", "p/java" }, + -- }), } local lsp_formatting = function(bufnr) - vim.lsp.buf.format({ - filter = function(client) - -- apply whatever logic you want (in this example, we'll only use null-ls) - return client.name == "null-ls" - end, - bufnr = bufnr, - }) + vim.lsp.buf.format({ + filter = function(client) + -- apply whatever logic you want (in this example, we'll only use null-ls) + return client.name == "null-ls" + end, + bufnr = bufnr, + }) end -- if you want to set up formatting on save, you can use this as a callback @@ -67,23 +67,23 @@ local augroup = vim.api.nvim_create_augroup("LspFormatting", {}) -- add to your shared on_attach callback local on_attach = function(client, bufnr) - if client.supports_method("textDocument/formatting") then - vim.api.nvim_clear_autocmds({ group = augroup, buffer = bufnr }) - vim.api.nvim_create_autocmd("BufWritePre", { - group = augroup, - buffer = bufnr, - callback = function() - lsp_formatting(bufnr) - end, - }) - end + if client.supports_method("textDocument/formatting") then + vim.api.nvim_clear_autocmds({ group = augroup, buffer = bufnr }) + vim.api.nvim_create_autocmd("BufWritePre", { + group = augroup, + buffer = bufnr, + callback = function() + lsp_formatting(bufnr) + end, + }) + end end null_ls.setup({ - sources = sources, - on_attach = function(client, bufnr) - require("kide.core.keybindings").maplsp(client, bufnr) - -- on_attach(client, bufnr) - end, - -- debug = true, + sources = sources, + on_attach = function(client, bufnr) + require("kide.core.keybindings").maplsp(client, bufnr) + -- on_attach(client, bufnr) + end, + -- debug = true, }) diff --git a/lua/kide/plugins/config/nvim-cmp.lua b/lua/kide/plugins/config/nvim-cmp.lua index e7baf797..da8b08b3 100644 --- a/lua/kide/plugins/config/nvim-cmp.lua +++ b/lua/kide/plugins/config/nvim-cmp.lua @@ -2,58 +2,58 @@ local lspkind = require("lspkind") local cmp = require("cmp") cmp.setup({ - -- 指定 snippet 引擎 - snippet = { - expand = function(args) - -- For `vsnip` users. - -- vim.fn["vsnip#anonymous"](args.body) + -- 指定 snippet 引擎 + snippet = { + expand = function(args) + -- For `vsnip` users. + -- vim.fn["vsnip#anonymous"](args.body) - -- For `luasnip` users. - require("luasnip").lsp_expand(args.body) + -- For `luasnip` users. + require("luasnip").lsp_expand(args.body) - -- For `ultisnips` users. - -- vim.fn["UltiSnips#Anon"](args.body) + -- For `ultisnips` users. + -- vim.fn["UltiSnips#Anon"](args.body) - -- For `snippy` users. - -- require'snippy'.expand_snippet(args.body) - end, - }, - -- 来源 - sources = cmp.config.sources({ - { name = "nvim_lsp" }, - -- For vsnip users. - -- { name = 'vsnip' }, - -- For luasnip users. - { name = "luasnip" }, - --For ultisnips users. - -- { name = 'ultisnips' }, - -- -- For snippy users. - -- { name = 'snippy' }, - }, { - { name = "buffer" }, - { name = "path" }, - }), + -- For `snippy` users. + -- require'snippy'.expand_snippet(args.body) + end, + }, + -- 来源 + sources = cmp.config.sources({ + { name = "nvim_lsp" }, + -- For vsnip users. + -- { name = 'vsnip' }, + -- For luasnip users. + { name = "luasnip" }, + --For ultisnips users. + -- { name = 'ultisnips' }, + -- -- For snippy users. + -- { name = 'snippy' }, + }, { + { name = "buffer" }, + { name = "path" }, + }), - -- 快捷键 - mapping = require("kide.core.keybindings").cmp(cmp), - -- 使用lspkind-nvim显示类型图标 - formatting = { - format = lspkind.cmp_format({ - with_text = true, -- do not show text alongside icons - maxwidth = 50, -- prevent the popup from showing more than provided characters (e.g 50 will not show more than 50 characters) - before = function(entry, vim_item) - -- Source 显示提示来源 - vim_item.menu = "[" .. string.upper(entry.source.name) .. "]" - return vim_item - end, - menu = { - nvim_lsp = "[LSP]", - luasnip = "[Lsnip]", - path = "[Path]", - -- buffer = "[Buffer]", - }, - }), - }, + -- 快捷键 + mapping = require("kide.core.keybindings").cmp(cmp), + -- 使用lspkind-nvim显示类型图标 + formatting = { + format = lspkind.cmp_format({ + with_text = true, -- do not show text alongside icons + maxwidth = 50, -- prevent the popup from showing more than provided characters (e.g 50 will not show more than 50 characters) + before = function(entry, vim_item) + -- Source 显示提示来源 + vim_item.menu = "[" .. string.upper(entry.source.name) .. "]" + return vim_item + end, + menu = { + nvim_lsp = "[LSP]", + luasnip = "[Lsnip]", + path = "[Path]", + -- buffer = "[Buffer]", + }, + }), + }, }) -- Use buffer source for `/`. diff --git a/lua/kide/plugins/config/nvim-colorizer.lua b/lua/kide/plugins/config/nvim-colorizer.lua index cf5503d1..31326e84 100644 --- a/lua/kide/plugins/config/nvim-colorizer.lua +++ b/lua/kide/plugins/config/nvim-colorizer.lua @@ -1,22 +1,22 @@ local present, colorizer = pcall(require, "colorizer") if present then - local default = { - filetypes = { - "*", - }, - user_default_options = { - RGB = true, -- #RGB hex codes - RRGGBB = true, -- #RRGGBB hex codes - names = false, -- "Name" codes like Blue - RRGGBBAA = false, -- #RRGGBBAA hex codes - rgb_fn = false, -- CSS rgb() and rgba() functions - hsl_fn = false, -- CSS hsl() and hsla() functions - css = false, -- Enable all CSS features: rgb_fn, hsl_fn, names, RGB, RRGGBB - css_fn = false, -- Enable all CSS *functions*: rgb_fn, hsl_fn + local default = { + filetypes = { + "*", + }, + user_default_options = { + RGB = true, -- #RGB hex codes + RRGGBB = true, -- #RRGGBB hex codes + names = false, -- "Name" codes like Blue + RRGGBBAA = false, -- #RRGGBBAA hex codes + rgb_fn = false, -- CSS rgb() and rgba() functions + hsl_fn = false, -- CSS hsl() and hsla() functions + css = false, -- Enable all CSS features: rgb_fn, hsl_fn, names, RGB, RRGGBB + css_fn = false, -- Enable all CSS *functions*: rgb_fn, hsl_fn - -- Available modes: foreground, background - mode = "background", -- Set the display mode. - }, - } - colorizer.setup(default["filetypes"], default["user_default_options"]) + -- Available modes: foreground, background + mode = "background", -- Set the display mode. + }, + } + colorizer.setup(default["filetypes"], default["user_default_options"]) end diff --git a/lua/kide/plugins/config/nvim-dap.lua b/lua/kide/plugins/config/nvim-dap.lua index 24b0ef37..7a6a59ee 100644 --- a/lua/kide/plugins/config/nvim-dap.lua +++ b/lua/kide/plugins/config/nvim-dap.lua @@ -7,38 +7,38 @@ local dap = require("dap") -- } local dapui = require("dapui") dapui.setup({ - layouts = { - { - elements = { - "scopes", - "breakpoints", - "stacks", - "watches", - }, - size = 40, - position = "left", - }, - { - elements = { - "repl", - -- 'console', - }, - size = 12, - position = "bottom", - }, - }, + layouts = { + { + elements = { + "scopes", + "breakpoints", + "stacks", + "watches", + }, + size = 40, + position = "left", + }, + { + elements = { + "repl", + -- 'console', + }, + size = 12, + position = "bottom", + }, + }, }) dap.defaults.fallback.terminal_win_cmd = "belowright 12new | set filetype=dap-terminal" dap.listeners.after.event_initialized["dapui_config"] = function() - dapui.open() + dapui.open() end dap.listeners.before.event_terminated["dapui_config"] = function() - dapui.close() + dapui.close() end dap.listeners.before.event_exited["dapui_config"] = function() - dapui.close() + dapui.close() end -- vim.fn.sign_define('DapBreakpoint', { text = '🔴', texthl = '', linehl = '', numhl = '' }) diff --git a/lua/kide/plugins/config/nvim-lsputils.lua b/lua/kide/plugins/config/nvim-lsputils.lua index 85a506e1..a6710175 100644 --- a/lua/kide/plugins/config/nvim-lsputils.lua +++ b/lua/kide/plugins/config/nvim-lsputils.lua @@ -1,78 +1,78 @@ if vim.fn.has("nvim-0.5.1") == 1 then - vim.lsp.handlers["textDocument/codeAction"] = require("lsputil.codeAction").code_action_handler - vim.lsp.handlers["textDocument/references"] = require("lsputil.locations").references_handler - vim.lsp.handlers["textDocument/definition"] = require("lsputil.locations").definition_handler - vim.lsp.handlers["textDocument/declaration"] = require("lsputil.locations").declaration_handler - vim.lsp.handlers["textDocument/typeDefinition"] = require("lsputil.locations").typeDefinition_handler - vim.lsp.handlers["textDocument/implementation"] = require("lsputil.locations").implementation_handler - vim.lsp.handlers["textDocument/documentSymbol"] = require("lsputil.symbols").document_handler - vim.lsp.handlers["workspace/symbol"] = require("lsputil.symbols").workspace_handler + vim.lsp.handlers["textDocument/codeAction"] = require("lsputil.codeAction").code_action_handler + vim.lsp.handlers["textDocument/references"] = require("lsputil.locations").references_handler + vim.lsp.handlers["textDocument/definition"] = require("lsputil.locations").definition_handler + vim.lsp.handlers["textDocument/declaration"] = require("lsputil.locations").declaration_handler + vim.lsp.handlers["textDocument/typeDefinition"] = require("lsputil.locations").typeDefinition_handler + vim.lsp.handlers["textDocument/implementation"] = require("lsputil.locations").implementation_handler + vim.lsp.handlers["textDocument/documentSymbol"] = require("lsputil.symbols").document_handler + vim.lsp.handlers["workspace/symbol"] = require("lsputil.symbols").workspace_handler else - local bufnr = vim.api.nvim_buf_get_number(0) + local bufnr = vim.api.nvim_buf_get_number(0) - vim.lsp.handlers["textDocument/codeAction"] = function(_, _, actions) - require("lsputil.codeAction").code_action_handler(nil, actions, nil, nil, nil) - end + vim.lsp.handlers["textDocument/codeAction"] = function(_, _, actions) + require("lsputil.codeAction").code_action_handler(nil, actions, nil, nil, nil) + end - vim.lsp.handlers["textDocument/references"] = function(_, _, result) - require("lsputil.locations").references_handler(nil, result, { bufnr = bufnr }, nil) - end + vim.lsp.handlers["textDocument/references"] = function(_, _, result) + require("lsputil.locations").references_handler(nil, result, { bufnr = bufnr }, nil) + end - vim.lsp.handlers["textDocument/definition"] = function(_, method, result) - require("lsputil.locations").definition_handler(nil, result, { bufnr = bufnr, method = method }, nil) - end + vim.lsp.handlers["textDocument/definition"] = function(_, method, result) + require("lsputil.locations").definition_handler(nil, result, { bufnr = bufnr, method = method }, nil) + end - vim.lsp.handlers["textDocument/declaration"] = function(_, method, result) - require("lsputil.locations").declaration_handler(nil, result, { bufnr = bufnr, method = method }, nil) - end + vim.lsp.handlers["textDocument/declaration"] = function(_, method, result) + require("lsputil.locations").declaration_handler(nil, result, { bufnr = bufnr, method = method }, nil) + end - vim.lsp.handlers["textDocument/typeDefinition"] = function(_, method, result) - require("lsputil.locations").typeDefinition_handler(nil, result, { bufnr = bufnr, method = method }, nil) - end + vim.lsp.handlers["textDocument/typeDefinition"] = function(_, method, result) + require("lsputil.locations").typeDefinition_handler(nil, result, { bufnr = bufnr, method = method }, nil) + end - vim.lsp.handlers["textDocument/implementation"] = function(_, method, result) - require("lsputil.locations").implementation_handler(nil, result, { bufnr = bufnr, method = method }, nil) - end + vim.lsp.handlers["textDocument/implementation"] = function(_, method, result) + require("lsputil.locations").implementation_handler(nil, result, { bufnr = bufnr, method = method }, nil) + end - vim.lsp.handlers["textDocument/documentSymbol"] = function(_, _, result, _, bufn) - require("lsputil.symbols").document_handler(nil, result, { bufnr = bufn }, nil) - end + vim.lsp.handlers["textDocument/documentSymbol"] = function(_, _, result, _, bufn) + require("lsputil.symbols").document_handler(nil, result, { bufnr = bufn }, nil) + end - vim.lsp.handlers["textDocument/symbol"] = function(_, _, result, _, bufn) - require("lsputil.symbols").workspace_handler(nil, result, { bufnr = bufn }, nil) - end + vim.lsp.handlers["textDocument/symbol"] = function(_, _, result, _, bufn) + require("lsputil.symbols").workspace_handler(nil, result, { bufnr = bufn }, nil) + end end local border_chars = { - TOP_LEFT = "┌", - TOP_RIGHT = "┐", - MID_HORIZONTAL = "─", - MID_VERTICAL = "│", - BOTTOM_LEFT = "└", - BOTTOM_RIGHT = "┘", + TOP_LEFT = "┌", + TOP_RIGHT = "┐", + MID_HORIZONTAL = "─", + MID_VERTICAL = "│", + BOTTOM_LEFT = "└", + BOTTOM_RIGHT = "┘", } vim.g.lsp_utils_location_opts = { - height = 24, - mode = "editor", - preview = { - title = "Location Preview", - border = true, - border_chars = border_chars, - }, - keymaps = { - n = { - [""] = "j", - [""] = "k", - }, - }, + height = 24, + mode = "editor", + preview = { + title = "Location Preview", + border = true, + border_chars = border_chars, + }, + keymaps = { + n = { + [""] = "j", + [""] = "k", + }, + }, } vim.g.lsp_utils_symbols_opts = { - height = 24, - mode = "editor", - preview = { - title = "Symbols Preview", - border = true, - border_chars = border_chars, - }, - prompt = {}, + height = 24, + mode = "editor", + preview = { + title = "Symbols Preview", + border = true, + border_chars = border_chars, + }, + prompt = {}, } diff --git a/lua/kide/plugins/config/nvim-neorg.lua b/lua/kide/plugins/config/nvim-neorg.lua index 60f35bf6..f54d94df 100644 --- a/lua/kide/plugins/config/nvim-neorg.lua +++ b/lua/kide/plugins/config/nvim-neorg.lua @@ -1,13 +1,13 @@ require("neorg").setup({ - load = { - ["core.defaults"] = {}, - ["core.norg.dirman"] = { - config = { - workspaces = { - work = "~/notes/work", - home = "~/notes/home", - }, - }, - }, - }, + load = { + ["core.defaults"] = {}, + ["core.norg.dirman"] = { + config = { + workspaces = { + work = "~/notes/work", + home = "~/notes/home", + }, + }, + }, + }, }) diff --git a/lua/kide/plugins/config/nvim-notify.lua b/lua/kide/plugins/config/nvim-notify.lua index a8aef35a..6e4aef70 100644 --- a/lua/kide/plugins/config/nvim-notify.lua +++ b/lua/kide/plugins/config/nvim-notify.lua @@ -1,33 +1,33 @@ vim.notify = require("notify") vim.notify.setup({ - -- Animation style (see below for details) - stages = "fade_in_slide_out", + -- Animation style (see below for details) + stages = "fade_in_slide_out", - -- Function called when a new window is opened, use for changing win settings/config - on_open = nil, + -- Function called when a new window is opened, use for changing win settings/config + on_open = nil, - -- Function called when a window is closed - on_close = nil, + -- Function called when a window is closed + on_close = nil, - -- Render function for notifications. See notify-render() - render = "default", + -- Render function for notifications. See notify-render() + render = "default", - -- Default timeout for notifications - timeout = 3000, + -- Default timeout for notifications + timeout = 3000, - -- For stages that change opacity this is treated as the highlight behind the window - -- Set this to either a highlight group, an RGB hex value e.g. "#000000" or a function returning an RGB code for dynamic values - background_colour = "#000000", + -- For stages that change opacity this is treated as the highlight behind the window + -- Set this to either a highlight group, an RGB hex value e.g. "#000000" or a function returning an RGB code for dynamic values + background_colour = "#000000", - -- Minimum width for notification windows - minimum_width = 50, + -- Minimum width for notification windows + minimum_width = 50, - -- Icons for the different levels - icons = { - ERROR = "", - WARN = "", - INFO = "", - DEBUG = "", - TRACE = "✎", - }, + -- Icons for the different levels + icons = { + ERROR = "", + WARN = "", + INFO = "", + DEBUG = "", + TRACE = "✎", + }, }) diff --git a/lua/kide/plugins/config/nvim-tree.lua b/lua/kide/plugins/config/nvim-tree.lua index 32442dd9..455471bb 100644 --- a/lua/kide/plugins/config/nvim-tree.lua +++ b/lua/kide/plugins/config/nvim-tree.lua @@ -1,87 +1,87 @@ require("nvim-tree").setup({ - disable_netrw = true, - hijack_netrw = true, - open_on_setup = false, - ignore_ft_on_setup = { "dashboard", "alpha" }, - -- auto_close = true, - auto_reload_on_write = true, - open_on_tab = false, - hijack_cursor = true, - update_cwd = false, - actions = { - use_system_clipboard = true, - change_dir = { - enable = true, - global = false, - }, - open_file = { - quit_on_open = true, - resize_window = true, - window_picker = { - enable = true, - chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890", - exclude = { - filetype = { "notify", "packer", "qf", "diff", "fugitive", "fugitiveblame" }, - buftype = { "nofile", "terminal", "help" }, - }, - }, - }, - }, - diagnostics = { - enable = false, - icons = { - hint = "", - info = "", - warning = "", - error = "", - }, - }, - update_focused_file = { - enable = true, - update_cwd = false, - ignore_list = {}, - }, - system_open = { - cmd = nil, - args = {}, - }, - filters = { - dotfiles = false, - custom = { ".git" }, - }, - git = { - enable = true, - ignore = true, - timeout = 400, - }, - view = { - width = 34, - height = 40, - hide_root_folder = true, - side = "left", - preserve_window_proportions = false, - number = false, - relativenumber = false, - signcolumn = "yes", - mappings = { - custom_only = false, - list = {}, - }, - }, - renderer = { - indent_markers = { - enable = true, - icons = { - corner = "└ ", - edge = "│ ", - none = " ", - }, - }, - }, - trash = { - cmd = "trash", - require_confirm = true, - }, + disable_netrw = true, + hijack_netrw = true, + open_on_setup = false, + ignore_ft_on_setup = { "dashboard", "alpha" }, + -- auto_close = true, + auto_reload_on_write = true, + open_on_tab = false, + hijack_cursor = true, + update_cwd = false, + actions = { + use_system_clipboard = true, + change_dir = { + enable = true, + global = false, + }, + open_file = { + quit_on_open = true, + resize_window = true, + window_picker = { + enable = true, + chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890", + exclude = { + filetype = { "notify", "packer", "qf", "diff", "fugitive", "fugitiveblame" }, + buftype = { "nofile", "terminal", "help" }, + }, + }, + }, + }, + diagnostics = { + enable = false, + icons = { + hint = "", + info = "", + warning = "", + error = "", + }, + }, + update_focused_file = { + enable = true, + update_cwd = false, + ignore_list = {}, + }, + system_open = { + cmd = nil, + args = {}, + }, + filters = { + dotfiles = false, + custom = { ".git" }, + }, + git = { + enable = true, + ignore = true, + timeout = 400, + }, + view = { + width = 34, + height = 40, + hide_root_folder = true, + side = "left", + preserve_window_proportions = false, + number = false, + relativenumber = false, + signcolumn = "yes", + mappings = { + custom_only = false, + list = {}, + }, + }, + renderer = { + indent_markers = { + enable = true, + icons = { + corner = "└ ", + edge = "│ ", + none = " ", + }, + }, + }, + trash = { + cmd = "trash", + require_confirm = true, + }, }) local g = vim.g @@ -91,8 +91,8 @@ g.nvim_tree_indent_markers = 1 g.nvim_tree_special_files = {} g.nvim_tree_window_picker_exclude = { - filetype = { "notify", "packer", "qf" }, - buftype = { "terminal" }, + filetype = { "notify", "packer", "qf" }, + buftype = { "terminal" }, } -- g.nvim_tree_icons = { @@ -118,7 +118,7 @@ g.nvim_tree_window_picker_exclude = { -- } g.nvim_tree_show_icons = { - folders = 1, - files = 1, - git = 1, + folders = 1, + files = 1, + git = 1, } diff --git a/lua/kide/plugins/config/nvim-treesitter.lua b/lua/kide/plugins/config/nvim-treesitter.lua index b4d0946a..81cb94f1 100644 --- a/lua/kide/plugins/config/nvim-treesitter.lua +++ b/lua/kide/plugins/config/nvim-treesitter.lua @@ -1,67 +1,67 @@ require("nvim-treesitter.configs").setup({ - -- One of "all", "maintained" (parsers with maintainers), or a list of languages - ensure_installed = { - "lua", - "java", - "javascript", - "html", - "css", - "c", - "cpp", - "go", - "rust", - "python", - "vim", - "yaml", - "http", - "bash", - }, + -- One of "all", "maintained" (parsers with maintainers), or a list of languages + ensure_installed = { + "lua", + "java", + "javascript", + "html", + "css", + "c", + "cpp", + "go", + "rust", + "python", + "vim", + "yaml", + "http", + "bash", + }, - -- Install languages synchronously (only applied to `ensure_installed`) - sync_install = false, + -- Install languages synchronously (only applied to `ensure_installed`) + sync_install = false, - -- List of parsers to ignore installing - ignore_install = {}, + -- List of parsers to ignore installing + ignore_install = {}, - highlight = { - -- `false` will disable the whole extension - enable = true, + highlight = { + -- `false` will disable the whole extension + enable = true, - -- list of language that will be disabled - disable = {}, + -- list of language that will be disabled + disable = {}, - -- Setting this to true will run `:h syntax` and tree-sitter at the same time. - -- Set this to `true` if you depend on 'syntax' being enabled (like for indentation). - -- Using this option may slow down your editor, and you may see some duplicate highlights. - -- Instead of true it can also be a list of languages - additional_vim_regex_highlighting = false, - }, - matchup = { - enable = true, - disable = {}, - }, - textobjects = { - move = { - enable = true, - set_jumps = true, -- whether to set jumps in the jumplist - goto_next_start = { - ["]m"] = "@function.outer", - ["]]"] = "@class.outer", - }, - goto_next_end = { - ["]M"] = "@function.outer", - ["]["] = "@class.outer", - }, - goto_previous_start = { - ["[m"] = "@function.outer", - ["[["] = "@class.outer", - }, - goto_previous_end = { - ["[M"] = "@function.outer", - ["[]"] = "@class.outer", - }, - }, - }, + -- Setting this to true will run `:h syntax` and tree-sitter at the same time. + -- Set this to `true` if you depend on 'syntax' being enabled (like for indentation). + -- Using this option may slow down your editor, and you may see some duplicate highlights. + -- Instead of true it can also be a list of languages + additional_vim_regex_highlighting = false, + }, + matchup = { + enable = true, + disable = {}, + }, + textobjects = { + move = { + enable = true, + set_jumps = true, -- whether to set jumps in the jumplist + goto_next_start = { + ["]m"] = "@function.outer", + ["]]"] = "@class.outer", + }, + goto_next_end = { + ["]M"] = "@function.outer", + ["]["] = "@class.outer", + }, + goto_previous_start = { + ["[m"] = "@function.outer", + ["[["] = "@class.outer", + }, + goto_previous_end = { + ["[M"] = "@function.outer", + ["[]"] = "@class.outer", + }, + }, + }, }) -- 开启 Folding vim.wo.foldmethod = "expr" diff --git a/lua/kide/plugins/config/rest-nvim.lua b/lua/kide/plugins/config/rest-nvim.lua index 290edb25..8efe3902 100644 --- a/lua/kide/plugins/config/rest-nvim.lua +++ b/lua/kide/plugins/config/rest-nvim.lua @@ -1,22 +1,22 @@ require("rest-nvim").setup({ - -- Open request results in a horizontal split - result_split_horizontal = false, - -- Skip SSL verification, useful for unknown certificates - skip_ssl_verification = false, - -- Highlight request on run - highlight = { - enabled = true, - timeout = 150, - }, - result = { - -- toggle showing URL, HTTP info, headers at top the of result window - show_url = true, - show_http_info = true, - show_headers = true, - }, - -- Jump to request line on run - jump_to_request = false, - env_file = ".env", - custom_dynamic_variables = {}, - yank_dry_run = true, + -- Open request results in a horizontal split + result_split_horizontal = false, + -- Skip SSL verification, useful for unknown certificates + skip_ssl_verification = false, + -- Highlight request on run + highlight = { + enabled = true, + timeout = 150, + }, + result = { + -- toggle showing URL, HTTP info, headers at top the of result window + show_url = true, + show_http_info = true, + show_headers = true, + }, + -- Jump to request line on run + jump_to_request = false, + env_file = ".env", + custom_dynamic_variables = {}, + yank_dry_run = true, }) diff --git a/lua/kide/plugins/config/symbols-outline.lua b/lua/kide/plugins/config/symbols-outline.lua index 0cbc05e2..d0d273e3 100644 --- a/lua/kide/plugins/config/symbols-outline.lua +++ b/lua/kide/plugins/config/symbols-outline.lua @@ -1,53 +1,53 @@ -- init.lua vim.g.symbols_outline = { - highlight_hovered_item = false, - show_guides = true, - auto_preview = false, - position = "right", - relative_width = true, - width = 34, - auto_close = false, - show_numbers = false, - show_relative_numbers = false, - show_symbol_details = true, - preview_bg_highlight = "Pmenu", - keymaps = { -- These keymaps can be a string or a table for multiple keys - close = { "", "q" }, - goto_location = "", - focus_location = "o", - hover_symbol = "", - toggle_preview = "K", - rename_symbol = "r", - code_actions = "a", - }, - lsp_blacklist = {}, - symbol_blacklist = {}, - symbols = { - File = { icon = "", hl = "TSURI" }, - Module = { icon = "", hl = "TSNamespace" }, - Namespace = { icon = "", hl = "TSNamespace" }, - Package = { icon = "", hl = "TSNamespace" }, - Class = { icon = "ﴯ", hl = "TSType" }, - Method = { icon = "", hl = "TSMethod" }, - Property = { icon = "ﰠ", hl = "TSMethod" }, - Field = { icon = "ﰠ", hl = "TSField" }, - Constructor = { icon = "", hl = "TSConstructor" }, - Enum = { icon = "", hl = "TSType" }, - Interface = { icon = "", hl = "TSType" }, - Function = { icon = "", hl = "TSFunction" }, - Variable = { icon = "", hl = "TSConstant" }, - Constant = { icon = "", hl = "TSConstant" }, - String = { icon = "", hl = "TSString" }, - Number = { icon = "", hl = "TSNumber" }, - Boolean = { icon = "", hl = "TSBoolean" }, - Array = { icon = "", hl = "TSConstant" }, - Object = { icon = "", hl = "TSType" }, - Key = { icon = "", hl = "TSType" }, - Null = { icon = "ﳠ", hl = "TSType" }, - EnumMember = { icon = "", hl = "TSField" }, - Struct = { icon = "פּ", hl = "TSType" }, - Event = { icon = "", hl = "TSType" }, - Operator = { icon = "", hl = "TSOperator" }, - TypeParameter = { icon = "", hl = "TSParameter" }, - }, + highlight_hovered_item = false, + show_guides = true, + auto_preview = false, + position = "right", + relative_width = true, + width = 34, + auto_close = false, + show_numbers = false, + show_relative_numbers = false, + show_symbol_details = true, + preview_bg_highlight = "Pmenu", + keymaps = { -- These keymaps can be a string or a table for multiple keys + close = { "", "q" }, + goto_location = "", + focus_location = "o", + hover_symbol = "", + toggle_preview = "K", + rename_symbol = "r", + code_actions = "a", + }, + lsp_blacklist = {}, + symbol_blacklist = {}, + symbols = { + File = { icon = "", hl = "TSURI" }, + Module = { icon = "", hl = "TSNamespace" }, + Namespace = { icon = "", hl = "TSNamespace" }, + Package = { icon = "", hl = "TSNamespace" }, + Class = { icon = "ﴯ", hl = "TSType" }, + Method = { icon = "", hl = "TSMethod" }, + Property = { icon = "ﰠ", hl = "TSMethod" }, + Field = { icon = "ﰠ", hl = "TSField" }, + Constructor = { icon = "", hl = "TSConstructor" }, + Enum = { icon = "", hl = "TSType" }, + Interface = { icon = "", hl = "TSType" }, + Function = { icon = "", hl = "TSFunction" }, + Variable = { icon = "", hl = "TSConstant" }, + Constant = { icon = "", hl = "TSConstant" }, + String = { icon = "", hl = "TSString" }, + Number = { icon = "", hl = "TSNumber" }, + Boolean = { icon = "", hl = "TSBoolean" }, + Array = { icon = "", hl = "TSConstant" }, + Object = { icon = "", hl = "TSType" }, + Key = { icon = "", hl = "TSType" }, + Null = { icon = "ﳠ", hl = "TSType" }, + EnumMember = { icon = "", hl = "TSField" }, + Struct = { icon = "פּ", hl = "TSType" }, + Event = { icon = "", hl = "TSType" }, + Operator = { icon = "", hl = "TSOperator" }, + TypeParameter = { icon = "", hl = "TSParameter" }, + }, } diff --git a/lua/kide/plugins/config/telescope.lua b/lua/kide/plugins/config/telescope.lua index aae58342..999407e1 100644 --- a/lua/kide/plugins/config/telescope.lua +++ b/lua/kide/plugins/config/telescope.lua @@ -2,107 +2,107 @@ local actions = require("telescope.actions") local trouble = require("trouble.providers.telescope") local telescope = require("telescope") telescope.setup({ - defaults = { - -- vimgrep_arguments = { - -- "rg", - -- "--color=never", - -- "--no-heading", - -- "--with-filename", - -- "--line-number", - -- "--column", - -- "--smart-case", - -- }, - -- prompt_prefix = "  ", - prompt_prefix = "  ", - selection_caret = " ", - entry_prefix = " ", - initial_mode = "insert", - selection_strategy = "reset", - sorting_strategy = "ascending", - layout_strategy = "horizontal", - layout_config = { - horizontal = { - prompt_position = "top", - preview_width = 0.55, - results_width = 0.8, - }, - vertical = { - mirror = false, - }, - width = 0.87, - height = 0.80, - preview_cutoff = 120, - }, - winblend = 0, - -- border = {}, - -- borderchars = { "─", "│", "─", "│", "╭", "╮", "╯", "╰" }, - -- borderchars = { - -- prompt = { '▀', '▐', '▄', '▌', '▛', '▜', '▟', '▙' }; - -- results = { '▀', '▐', '▄', '▌', '▛', '▜', '▟', '▙' }; - -- preview = { '▀', '▐', '▄', '▌', '▛', '▜', '▟', '▙' }; - -- }, - -- borderchars = { - -- prompt = { '▀', '▐', '▄', '▌', '▛', '▜', '▟', '▙' }; - -- results = { ' ', '▐', '▄', '▌', '▌', '▐', '▟', '▙' }; - -- preview = { '▀', '▐', '▄', '▌', '▛', '▜', '▟', '▙' }; - -- }, - color_devicons = true, - -- use_less = true, - -- set_env = { ["COLORTERM"] = "gruvbox" }, -- default = nil, - -- file_sorter = require("telescope.sorters").get_fuzzy_file, - file_ignore_patterns = { "node_modules" }, - -- generic_sorter = require("telescope.sorters").get_generic_fuzzy_sorter, - -- path_display = { "truncate" }, - -- file_previewer = require("telescope.previewers").vim_buffer_cat.new, - -- grep_previewer = require("telescope.previewers").vim_buffer_vimgrep.new, - -- qflist_previewer = require("telescope.previewers").vim_buffer_qflist.new, - -- Developer configurations: Not meant for general override - -- buffer_previewer_maker = require("telescope.previewers").buffer_previewer_maker, + defaults = { + -- vimgrep_arguments = { + -- "rg", + -- "--color=never", + -- "--no-heading", + -- "--with-filename", + -- "--line-number", + -- "--column", + -- "--smart-case", + -- }, + -- prompt_prefix = "  ", + prompt_prefix = "  ", + selection_caret = " ", + entry_prefix = " ", + initial_mode = "insert", + selection_strategy = "reset", + sorting_strategy = "ascending", + layout_strategy = "horizontal", + layout_config = { + horizontal = { + prompt_position = "top", + preview_width = 0.55, + results_width = 0.8, + }, + vertical = { + mirror = false, + }, + width = 0.87, + height = 0.80, + preview_cutoff = 120, + }, + winblend = 0, + -- border = {}, + -- borderchars = { "─", "│", "─", "│", "╭", "╮", "╯", "╰" }, + -- borderchars = { + -- prompt = { '▀', '▐', '▄', '▌', '▛', '▜', '▟', '▙' }; + -- results = { '▀', '▐', '▄', '▌', '▛', '▜', '▟', '▙' }; + -- preview = { '▀', '▐', '▄', '▌', '▛', '▜', '▟', '▙' }; + -- }, + -- borderchars = { + -- prompt = { '▀', '▐', '▄', '▌', '▛', '▜', '▟', '▙' }; + -- results = { ' ', '▐', '▄', '▌', '▌', '▐', '▟', '▙' }; + -- preview = { '▀', '▐', '▄', '▌', '▛', '▜', '▟', '▙' }; + -- }, + color_devicons = true, + -- use_less = true, + -- set_env = { ["COLORTERM"] = "gruvbox" }, -- default = nil, + -- file_sorter = require("telescope.sorters").get_fuzzy_file, + file_ignore_patterns = { "node_modules" }, + -- generic_sorter = require("telescope.sorters").get_generic_fuzzy_sorter, + -- path_display = { "truncate" }, + -- file_previewer = require("telescope.previewers").vim_buffer_cat.new, + -- grep_previewer = require("telescope.previewers").vim_buffer_vimgrep.new, + -- qflist_previewer = require("telescope.previewers").vim_buffer_qflist.new, + -- Developer configurations: Not meant for general override + -- buffer_previewer_maker = require("telescope.previewers").buffer_previewer_maker, - -- Default configuration for telescope goes here: - -- config_key = value, - mappings = { - i = { - -- map actions.which_key to (default: ) - -- actions.which_key shows the mappings for your picker, - -- e.g. git_{create, delete, ...}_branch for the git_branches picker - [""] = "which_key", - -- [""] = actions.close, - -- [""] = trouble.open_with_trouble, - }, - n = { - -- [""] = trouble.open_with_trouble, - }, - }, - }, - pickers = { - -- Default configuration for builtin pickers goes here: - -- picker_name = { - -- picker_config_key = value, - -- ... - -- } - -- Now the picker_config_key will be applied every time you call this - -- builtin picker - }, - extensions = { - -- Your extension configuration goes here: - -- extension_name = { - -- extension_config_key = value, - -- } - -- please take a look at the readme of the extension you want to configure - ["ui-select"] = { - require("telescope.themes").get_dropdown({ - -- even more opts - }), - }, - -- fzf = { - -- fuzzy = true, -- false will only do exact matching - -- override_generic_sorter = true, -- override the generic sorter - -- override_file_sorter = true, -- override the file sorter - -- case_mode = "smart_case", -- or "ignore_case" or "respect_case" - -- -- the default case_mode is "smart_case" - -- } - }, + -- Default configuration for telescope goes here: + -- config_key = value, + mappings = { + i = { + -- map actions.which_key to (default: ) + -- actions.which_key shows the mappings for your picker, + -- e.g. git_{create, delete, ...}_branch for the git_branches picker + [""] = "which_key", + -- [""] = actions.close, + -- [""] = trouble.open_with_trouble, + }, + n = { + -- [""] = trouble.open_with_trouble, + }, + }, + }, + pickers = { + -- Default configuration for builtin pickers goes here: + -- picker_name = { + -- picker_config_key = value, + -- ... + -- } + -- Now the picker_config_key will be applied every time you call this + -- builtin picker + }, + extensions = { + -- Your extension configuration goes here: + -- extension_name = { + -- extension_config_key = value, + -- } + -- please take a look at the readme of the extension you want to configure + ["ui-select"] = { + require("telescope.themes").get_dropdown({ + -- even more opts + }), + }, + -- fzf = { + -- fuzzy = true, -- false will only do exact matching + -- override_generic_sorter = true, -- override the generic sorter + -- override_file_sorter = true, -- override the file sorter + -- case_mode = "smart_case", -- or "ignore_case" or "respect_case" + -- -- the default case_mode is "smart_case" + -- } + }, }) telescope.load_extension("notify") -- telescope.load_extension('fzf') @@ -114,4 +114,4 @@ telescope.load_extension("dap") telescope.load_extension("toggletasks") -telescope.load_extension('projects') +telescope.load_extension("projects") diff --git a/lua/kide/plugins/config/toggletasks.lua b/lua/kide/plugins/config/toggletasks.lua index eae485e0..791a2b48 100644 --- a/lua/kide/plugins/config/toggletasks.lua +++ b/lua/kide/plugins/config/toggletasks.lua @@ -1,8 +1,8 @@ require("toggletasks").setup({ - search_paths = { - ".tasks", - ".toggletasks", - ".nvim/toggletasks", - ".nvim/tasks", - }, + search_paths = { + ".tasks", + ".toggletasks", + ".nvim/toggletasks", + ".nvim/tasks", + }, }) diff --git a/lua/kide/plugins/config/translate.lua b/lua/kide/plugins/config/translate.lua index d00f6269..45445f61 100644 --- a/lua/kide/plugins/config/translate.lua +++ b/lua/kide/plugins/config/translate.lua @@ -1,12 +1,12 @@ require("translate").setup({ - default = { - command = "translate_shell", - }, - preset = { - output = { - split = { - append = true, - }, - }, - }, + default = { + command = "translate_shell", + }, + preset = { + output = { + split = { + append = true, + }, + }, + }, }) diff --git a/lua/kide/plugins/config/trouble.lua b/lua/kide/plugins/config/trouble.lua index e0c75772..db2bc4a6 100644 --- a/lua/kide/plugins/config/trouble.lua +++ b/lua/kide/plugins/config/trouble.lua @@ -1,5 +1,5 @@ require("trouble").setup({ - -- your configuration comes here - -- or leave it empty to use the default settings - -- refer to the configuration section below + -- your configuration comes here + -- or leave it empty to use the default settings + -- refer to the configuration section below }) diff --git a/lua/kide/plugins/config/vim-illuminate.lua b/lua/kide/plugins/config/vim-illuminate.lua index 06f1aa92..0425ed35 100644 --- a/lua/kide/plugins/config/vim-illuminate.lua +++ b/lua/kide/plugins/config/vim-illuminate.lua @@ -1,15 +1,15 @@ -- https://github.com/RRethy/vim-illuminate -- 禁止高亮的文件类型 vim.g.Illuminate_ftblacklist = { - "vista_kind", - "help", - "terminal", - "packer", - "markdown", - "git", - "text", - "NvimTree", - "dashboard", - "alpha", - "Outline", + "vista_kind", + "help", + "terminal", + "packer", + "markdown", + "git", + "text", + "NvimTree", + "dashboard", + "alpha", + "Outline", } diff --git a/lua/kide/plugins/config/wilder.lua b/lua/kide/plugins/config/wilder.lua index ec982bc5..1cd6f4cd 100644 --- a/lua/kide/plugins/config/wilder.lua +++ b/lua/kide/plugins/config/wilder.lua @@ -1,5 +1,5 @@ local result = vim.api.nvim_exec( - [[ + [[ call wilder#setup({ \ 'modes': [':', '/', '?'], \ 'next_key': '', @@ -38,5 +38,5 @@ call wilder#set_option('renderer', wilder#renderer_mux({ \ 'substitute': s:wildmenu_renderer, \ })) ]], - true + true ) diff --git a/lua/kide/plugins/init.lua b/lua/kide/plugins/init.lua index 64caf9a8..078ce29e 100644 --- a/lua/kide/plugins/init.lua +++ b/lua/kide/plugins/init.lua @@ -1,280 +1,280 @@ local bootstrap = require("packer_bootstrap") require("packer").startup({ - function(use) - -- Packer can manage itself - use("wbthomason/packer.nvim") - use({ "nvim-lua/plenary.nvim" }) - use({ "lewis6991/impatient.nvim" }) - use({ "nathom/filetype.nvim" }) - - use("kyazdani42/nvim-web-devicons") - use({ "neovim/nvim-lspconfig", "williamboman/nvim-lsp-installer" }) - - -- nvim-cmp - use("hrsh7th/cmp-nvim-lsp") -- { name = nvim_lsp } - use("hrsh7th/cmp-buffer") -- { name = 'buffer' }, - use("hrsh7th/cmp-path") -- { name = 'path' } - -- use 'hrsh7th/cmp-cmdline' -- { name = 'cmdline' } - use("hrsh7th/nvim-cmp") - - -- vsnip - -- use 'hrsh7th/cmp-vsnip' -- { name = 'vsnip' } - -- use 'hrsh7th/vim-vsnip' - - -- 代码片段 - use("rafamadriz/friendly-snippets") - -- LuaSnip - use("L3MON4D3/LuaSnip") - use({ "saadparwaiz1/cmp_luasnip" }) - - -- lspkind - use("onsails/lspkind-nvim") - - -- lsp 相关 - -- use 'folke/lsp-colors.nvim' - use("folke/trouble.nvim") - - -- java 不友好 - -- use 'glepnir/lspsaga.nvim' - -- use 'arkav/lualine-lsp-progress' - -- use 'nvim-lua/lsp-status.nvim' - - -- use 'ray-x/lsp_signature.nvim' - - -- use 'RishabhRD/popfix' - -- use 'RishabhRD/nvim-lsputils' - - use({ - "jose-elias-alvarez/null-ls.nvim", - config = function() end, - requires = { "nvim-lua/plenary.nvim" }, - }) - - -- 主题 - -- use 'morhetz/gruvbox' - use({ "ellisonleao/gruvbox.nvim" }) - -- use 'sainnhe/gruvbox-material' - - -- 文件管理 - use({ - "kyazdani42/nvim-tree.lua", - requires = { - "kyazdani42/nvim-web-devicons", -- optional, for file icon - }, - }) - - -- using packer.nvim - use({ "akinsho/bufferline.nvim", tag = "v2.*", requires = "kyazdani42/nvim-web-devicons" }) - - -- treesitter (新增) - use({ "nvim-treesitter/nvim-treesitter", run = ":TSUpdate" }) - use("nvim-treesitter/nvim-treesitter-textobjects") - - -- java - use("mfussenegger/nvim-jdtls") - -- use 'NiYanhhhhh/lighttree-java' - - -- debug - use("mfussenegger/nvim-dap") - use({ "rcarriga/nvim-dap-ui", requires = { "mfussenegger/nvim-dap" } }) - use("theHamsta/nvim-dap-virtual-text") - - -- git - use("tpope/vim-fugitive") - use("sindrets/diffview.nvim") - use({ "TimUntersberger/neogit", requires = "nvim-lua/plenary.nvim" }) - - -- LeaderF - -- use 'Yggdroot/LeaderF' - - -- git edit 状态显示插件 - use({ - "lewis6991/gitsigns.nvim", - requires = { - "nvim-lua/plenary.nvim", - }, - }) - - -- 异步任务执行插件 - -- use 'skywind3000/asynctasks.vim' - -- use 'skywind3000/asyncrun.vim' - use({ - "jedrzejboczar/toggletasks.nvim", - requires = { - "nvim-lua/plenary.nvim", - "akinsho/toggleterm.nvim", - "nvim-telescope/telescope.nvim/", - }, - }) - - -- 浮动窗口插件 - -- use 'voldikss/vim-floaterm' - -- use 'voldikss/LeaderF-floaterm' - use({ - "akinsho/toggleterm.nvim", - tag = "v2.*", - config = function() - require("toggleterm").setup() - end, - }) - - -- 多光标插件 - use("mg979/vim-visual-multi") - - -- 状态栏插件 - -- use 'feline-nvim/feline.nvim' - use({ - "nvim-lualine/lualine.nvim", - }) - - -- blankline - use("lukas-reineke/indent-blankline.nvim") - - -- <>()等匹配插件 - use("andymass/vim-matchup") - -- 大纲插件 - -- use 'liuchengxu/vista.vim' - use("simrat39/symbols-outline.nvim") - -- use { - -- 'stevearc/aerial.nvim', - -- } - - -- 消息通知 - use("rcarriga/nvim-notify") - - -- wildmenu 补全美化 - use("gelguy/wilder.nvim") - - -- 颜色显示 - use("norcalli/nvim-colorizer.lua") - - use({ - "numToStr/Comment.nvim", - }) - - -- mackdown 预览插件 - use({ "iamcco/markdown-preview.nvim", run = "cd app && yarn install" }) - -- mackdown cli 预览插件 - use({ "ellisonleao/glow.nvim", branch = "main" }) - - -- 格式化插件 -> 使用 null-ls - -- use 'mhartington/formatter.nvim' - -- use 'sbdchd/neoformat' - - -- 快捷键查看 - use({ - "folke/which-key.nvim", - config = function() - require("which-key").setup({ - -- your configuration comes here - -- or leave it empty to use the default settings - -- refer to the configuration section below - }) - end, - }) - - -- 搜索插件 - use({ - "nvim-telescope/telescope.nvim", - requires = { - "nvim-lua/plenary.nvim", - }, - }) - use({ "nvim-telescope/telescope-ui-select.nvim" }) - -- use {'nvim-telescope/telescope-fzf-native.nvim', run = 'make' } - use({ "nvim-telescope/telescope-dap.nvim" }) - - -- use 'GustavoKatel/telescope-asynctasks.nvim' - -- use 'aloussase/telescope-gradle.nvim' - -- use 'aloussase/telescope-mvnsearch' - use({ "LinArcX/telescope-env.nvim" }) - - -- 仪表盘 - -- use {'glepnir/dashboard-nvim'} - use({ - "goolord/alpha-nvim", - requires = { "kyazdani42/nvim-web-devicons" }, - }) - - -- 翻译插件 - -- use 'voldikss/vim-translator' - use("uga-rosa/translate.nvim") - - -- 自动对齐插件 - use("junegunn/vim-easy-align") - - -- 表格模式插件 - use("dhruvasagar/vim-table-mode") - - -- () 自动补全 - use("windwp/nvim-autopairs") - - -- 任务插件 - use("itchyny/calendar.vim") - - -- rust - use("simrat39/rust-tools.nvim") - - -- use "Pocco81/AutoSave.nvim" - - use({ - "NTBBloodbath/rest.nvim", - requires = { - "nvim-lua/plenary.nvim", - }, - }) - - -- 选中高亮插件 - use("RRethy/vim-illuminate") - - -- 快速跳转 - use({ - "phaazon/hop.nvim", - branch = "v1", -- optional but strongly recommended - config = function() - -- you can configure Hop the way you like here; see :h hop-config - require("hop").setup({ keys = "etovxqpdygfblzhckisuran" }) - end, - }) - - -- LSP 进度 - use({ - "j-hui/fidget.nvim", - config = function() - require("fidget").setup({}) - end, - }) - - -- 查找替换 - use({ - "windwp/nvim-spectre", - config = function() - require("spectre").setup() - end, - }) - - -- ASCII 图 - use("jbyuki/venn.nvim") - - use("tversteeg/registers.nvim") - - use("nanotee/sqls.nvim") - if bootstrap then - require("packer").sync() - end - -- 项目管理 - use({ - "ahmedkhalf/project.nvim", - config = function() - require("project_nvim").setup({}) - end, - }) - end, - config = { - display = { - open_fn = require("packer.util").float, - }, - }, + function(use) + -- Packer can manage itself + use("wbthomason/packer.nvim") + use({ "nvim-lua/plenary.nvim" }) + use({ "lewis6991/impatient.nvim" }) + use({ "nathom/filetype.nvim" }) + + use("kyazdani42/nvim-web-devicons") + use({ "neovim/nvim-lspconfig", "williamboman/nvim-lsp-installer" }) + + -- nvim-cmp + use("hrsh7th/cmp-nvim-lsp") -- { name = nvim_lsp } + use("hrsh7th/cmp-buffer") -- { name = 'buffer' }, + use("hrsh7th/cmp-path") -- { name = 'path' } + -- use 'hrsh7th/cmp-cmdline' -- { name = 'cmdline' } + use("hrsh7th/nvim-cmp") + + -- vsnip + -- use 'hrsh7th/cmp-vsnip' -- { name = 'vsnip' } + -- use 'hrsh7th/vim-vsnip' + + -- 代码片段 + use("rafamadriz/friendly-snippets") + -- LuaSnip + use("L3MON4D3/LuaSnip") + use({ "saadparwaiz1/cmp_luasnip" }) + + -- lspkind + use("onsails/lspkind-nvim") + + -- lsp 相关 + -- use 'folke/lsp-colors.nvim' + use("folke/trouble.nvim") + + -- java 不友好 + -- use 'glepnir/lspsaga.nvim' + -- use 'arkav/lualine-lsp-progress' + -- use 'nvim-lua/lsp-status.nvim' + + -- use 'ray-x/lsp_signature.nvim' + + -- use 'RishabhRD/popfix' + -- use 'RishabhRD/nvim-lsputils' + + use({ + "jose-elias-alvarez/null-ls.nvim", + config = function() end, + requires = { "nvim-lua/plenary.nvim" }, + }) + + -- 主题 + -- use 'morhetz/gruvbox' + use({ "ellisonleao/gruvbox.nvim" }) + -- use 'sainnhe/gruvbox-material' + + -- 文件管理 + use({ + "kyazdani42/nvim-tree.lua", + requires = { + "kyazdani42/nvim-web-devicons", -- optional, for file icon + }, + }) + + -- using packer.nvim + use({ "akinsho/bufferline.nvim", tag = "v2.*", requires = "kyazdani42/nvim-web-devicons" }) + + -- treesitter (新增) + use({ "nvim-treesitter/nvim-treesitter", run = ":TSUpdate" }) + use("nvim-treesitter/nvim-treesitter-textobjects") + + -- java + use("mfussenegger/nvim-jdtls") + -- use 'NiYanhhhhh/lighttree-java' + + -- debug + use("mfussenegger/nvim-dap") + use({ "rcarriga/nvim-dap-ui", requires = { "mfussenegger/nvim-dap" } }) + use("theHamsta/nvim-dap-virtual-text") + + -- git + use("tpope/vim-fugitive") + use("sindrets/diffview.nvim") + use({ "TimUntersberger/neogit", requires = "nvim-lua/plenary.nvim" }) + + -- LeaderF + -- use 'Yggdroot/LeaderF' + + -- git edit 状态显示插件 + use({ + "lewis6991/gitsigns.nvim", + requires = { + "nvim-lua/plenary.nvim", + }, + }) + + -- 异步任务执行插件 + -- use 'skywind3000/asynctasks.vim' + -- use 'skywind3000/asyncrun.vim' + use({ + "jedrzejboczar/toggletasks.nvim", + requires = { + "nvim-lua/plenary.nvim", + "akinsho/toggleterm.nvim", + "nvim-telescope/telescope.nvim/", + }, + }) + + -- 浮动窗口插件 + -- use 'voldikss/vim-floaterm' + -- use 'voldikss/LeaderF-floaterm' + use({ + "akinsho/toggleterm.nvim", + tag = "v2.*", + config = function() + require("toggleterm").setup() + end, + }) + + -- 多光标插件 + use("mg979/vim-visual-multi") + + -- 状态栏插件 + -- use 'feline-nvim/feline.nvim' + use({ + "nvim-lualine/lualine.nvim", + }) + + -- blankline + use("lukas-reineke/indent-blankline.nvim") + + -- <>()等匹配插件 + use("andymass/vim-matchup") + -- 大纲插件 + -- use 'liuchengxu/vista.vim' + use("simrat39/symbols-outline.nvim") + -- use { + -- 'stevearc/aerial.nvim', + -- } + + -- 消息通知 + use("rcarriga/nvim-notify") + + -- wildmenu 补全美化 + use("gelguy/wilder.nvim") + + -- 颜色显示 + use("norcalli/nvim-colorizer.lua") + + use({ + "numToStr/Comment.nvim", + }) + + -- mackdown 预览插件 + use({ "iamcco/markdown-preview.nvim", run = "cd app && yarn install" }) + -- mackdown cli 预览插件 + use({ "ellisonleao/glow.nvim", branch = "main" }) + + -- 格式化插件 -> 使用 null-ls + -- use 'mhartington/formatter.nvim' + -- use 'sbdchd/neoformat' + + -- 快捷键查看 + use({ + "folke/which-key.nvim", + config = function() + require("which-key").setup({ + -- your configuration comes here + -- or leave it empty to use the default settings + -- refer to the configuration section below + }) + end, + }) + + -- 搜索插件 + use({ + "nvim-telescope/telescope.nvim", + requires = { + "nvim-lua/plenary.nvim", + }, + }) + use({ "nvim-telescope/telescope-ui-select.nvim" }) + -- use {'nvim-telescope/telescope-fzf-native.nvim', run = 'make' } + use({ "nvim-telescope/telescope-dap.nvim" }) + + -- use 'GustavoKatel/telescope-asynctasks.nvim' + -- use 'aloussase/telescope-gradle.nvim' + -- use 'aloussase/telescope-mvnsearch' + use({ "LinArcX/telescope-env.nvim" }) + + -- 仪表盘 + -- use {'glepnir/dashboard-nvim'} + use({ + "goolord/alpha-nvim", + requires = { "kyazdani42/nvim-web-devicons" }, + }) + + -- 翻译插件 + -- use 'voldikss/vim-translator' + use("uga-rosa/translate.nvim") + + -- 自动对齐插件 + use("junegunn/vim-easy-align") + + -- 表格模式插件 + use("dhruvasagar/vim-table-mode") + + -- () 自动补全 + use("windwp/nvim-autopairs") + + -- 任务插件 + use("itchyny/calendar.vim") + + -- rust + use("simrat39/rust-tools.nvim") + + -- use "Pocco81/AutoSave.nvim" + + use({ + "NTBBloodbath/rest.nvim", + requires = { + "nvim-lua/plenary.nvim", + }, + }) + + -- 选中高亮插件 + use("RRethy/vim-illuminate") + + -- 快速跳转 + use({ + "phaazon/hop.nvim", + branch = "v1", -- optional but strongly recommended + config = function() + -- you can configure Hop the way you like here; see :h hop-config + require("hop").setup({ keys = "etovxqpdygfblzhckisuran" }) + end, + }) + + -- LSP 进度 + use({ + "j-hui/fidget.nvim", + config = function() + require("fidget").setup({}) + end, + }) + + -- 查找替换 + use({ + "windwp/nvim-spectre", + config = function() + require("spectre").setup() + end, + }) + + -- ASCII 图 + use("jbyuki/venn.nvim") + + use("tversteeg/registers.nvim") + + use("nanotee/sqls.nvim") + if bootstrap then + require("packer").sync() + end + -- 项目管理 + use({ + "ahmedkhalf/project.nvim", + config = function() + require("project_nvim").setup({}) + end, + }) + end, + config = { + display = { + open_fn = require("packer.util").float, + }, + }, }) require("kide.plugins.config.gruvbox") @@ -288,39 +288,39 @@ require("kide.plugins.config.vim-illuminate") require("kide.plugins.config.symbols-outline") -- 异步加载 vim.defer_fn(function() - require("kide.plugins.config.nvim-treesitter") - - require("kide.plugins.config.luasnip") - require("kide.plugins.config.nvim-cmp") - -- require('plugins/config/LeaderF') - require("kide.plugins.config.gitsigns-nvim") - -- require('plugins/config/vim-floaterm') - -- require('plugins/config/asynctasks') - require("kide.plugins.config.toggletasks") - -- require('plugins/config/feline') - -- require('plugins/config/vista') - -- require('plugins/config/aerial') - -- require('plugins/config/lsp-colors') - require("kide.plugins.config.trouble") - require("kide.plugins.config.nvim-notify") - require("kide.plugins.config.wilder") - require("kide.plugins.config.nvim-colorizer") - require("kide.plugins.config.comment") - -- require('kide.plugins.config.lspsaga') - -- require('plugins/config/formatter') - require("kide.plugins.config.telescope") - -- require('plugins/config/nvim-lsputils') - require("kide.plugins.config.nvim-autopairs") - -- require('plugins/config/lsp_signature') - require("kide.plugins.config.nvim-dap") - require("kide.plugins.config.markdown-preview") - require("kide.plugins.config.translate") - -- require('plugins/config/autosave') - -- require('plugins/config/nvim-neorg') - require("kide.plugins.config.null-ls") - require("kide.plugins.config.diffview-nvim") - require("kide.plugins.config.neogit") - vim.cmd([[ + require("kide.plugins.config.nvim-treesitter") + + require("kide.plugins.config.luasnip") + require("kide.plugins.config.nvim-cmp") + -- require('plugins/config/LeaderF') + require("kide.plugins.config.gitsigns-nvim") + -- require('plugins/config/vim-floaterm') + -- require('plugins/config/asynctasks') + require("kide.plugins.config.toggletasks") + -- require('plugins/config/feline') + -- require('plugins/config/vista') + -- require('plugins/config/aerial') + -- require('plugins/config/lsp-colors') + require("kide.plugins.config.trouble") + require("kide.plugins.config.nvim-notify") + require("kide.plugins.config.wilder") + require("kide.plugins.config.nvim-colorizer") + require("kide.plugins.config.comment") + -- require('kide.plugins.config.lspsaga') + -- require('plugins/config/formatter') + require("kide.plugins.config.telescope") + -- require('plugins/config/nvim-lsputils') + require("kide.plugins.config.nvim-autopairs") + -- require('plugins/config/lsp_signature') + require("kide.plugins.config.nvim-dap") + require("kide.plugins.config.markdown-preview") + require("kide.plugins.config.translate") + -- require('plugins/config/autosave') + -- require('plugins/config/nvim-neorg') + require("kide.plugins.config.null-ls") + require("kide.plugins.config.diffview-nvim") + require("kide.plugins.config.neogit") + vim.cmd([[ function! s:http_rest_init() abort lua require('kide.plugins/config/rest-nvim') lua require('kide.core.keybindings').rest_nvim() @@ -331,5 +331,5 @@ augroup http_rest augroup end ]]) - require("kide.core.keybindings").setup() + require("kide.core.keybindings").setup() end, 0) diff --git a/lua/kide/theme/gruvbox.lua b/lua/kide/theme/gruvbox.lua index 02b66881..4bd9d8ea 100644 --- a/lua/kide/theme/gruvbox.lua +++ b/lua/kide/theme/gruvbox.lua @@ -1,11 +1,11 @@ local colors = require("gruvbox.palette") return { - white = "#ebdbb2", - darker_black = "#232323", - black = "#282828", - black2 = "#2e2e2e", - black3 = "#313131", - grey = "#464646", + white = "#ebdbb2", + darker_black = "#232323", + black = "#282828", + black2 = "#2e2e2e", + black3 = "#313131", + grey = "#464646", red = colors.bright_red, green = colors.bright_green, yellow = colors.bright_yellow, diff --git a/lua/kide/theme/telescope.lua b/lua/kide/theme/telescope.lua index ac7a8ce2..d58253f9 100644 --- a/lua/kide/theme/telescope.lua +++ b/lua/kide/theme/telescope.lua @@ -1,55 +1,55 @@ local colors = require("kide.theme.gruvbox") return { - TelescopeBorder = { - fg = colors.darker_black, - bg = colors.darker_black, - }, + TelescopeBorder = { + fg = colors.darker_black, + bg = colors.darker_black, + }, - TelescopePromptTitle = { - fg = colors.black, - bg = colors.red, - }, - TelescopePromptPrefix = { - fg = colors.red, - bg = colors.darker_black, - }, - TelescopePromptBorder = { - fg = colors.darker_black, - bg = colors.darker_black, - }, - TelescopePromptNormal = { - fg = colors.white, - bg = colors.darker_black, - }, + TelescopePromptTitle = { + fg = colors.black, + bg = colors.red, + }, + TelescopePromptPrefix = { + fg = colors.red, + bg = colors.darker_black, + }, + TelescopePromptBorder = { + fg = colors.darker_black, + bg = colors.darker_black, + }, + TelescopePromptNormal = { + fg = colors.white, + bg = colors.darker_black, + }, - TelescopeResultsTitle = { - fg = colors.black2, - bg = colors.black2, - }, - TelescopeResultsBorder = { - fg = colors.black2, - bg = colors.black2, - }, - TelescopeResultsNormal = { - fg = colors.white, - bg = colors.black2, - }, + TelescopeResultsTitle = { + fg = colors.black2, + bg = colors.black2, + }, + TelescopeResultsBorder = { + fg = colors.black2, + bg = colors.black2, + }, + TelescopeResultsNormal = { + fg = colors.white, + bg = colors.black2, + }, - TelescopeNormal = { bg = colors.darker_black }, + TelescopeNormal = { bg = colors.darker_black }, - TelescopePreviewTitle = { - fg = colors.black3, - bg = colors.green, - }, - TelescopePreviewBorder = { - fg = colors.black3, - bg = colors.black3, - }, - TelescopePreviewNormal = { - fg = colors.black3, - bg = colors.black3, - }, + TelescopePreviewTitle = { + fg = colors.black3, + bg = colors.green, + }, + TelescopePreviewBorder = { + fg = colors.black3, + bg = colors.black3, + }, + TelescopePreviewNormal = { + fg = colors.black3, + bg = colors.black3, + }, - TelescopeSelection = { bg = colors.black2, fg = colors.yellow }, + TelescopeSelection = { bg = colors.black2, fg = colors.yellow }, } diff --git a/lua/packer_bootstrap.lua b/lua/packer_bootstrap.lua index 7fdb05a8..4ef6ebb1 100644 --- a/lua/packer_bootstrap.lua +++ b/lua/packer_bootstrap.lua @@ -2,14 +2,14 @@ local fn = vim.fn local install_path = fn.stdpath("data") .. "/site/pack/packer/start/packer.nvim" local packer_bootstrap = false if fn.empty(fn.glob(install_path)) > 0 then - vim.notify(install_path, vim.log.levels.INFO) - packer_bootstrap = fn.system({ - "git", - "clone", - "--depth", - "1", - "https://github.com/wbthomason/packer.nvim", - install_path, - }) + vim.notify(install_path, vim.log.levels.INFO) + packer_bootstrap = fn.system({ + "git", + "clone", + "--depth", + "1", + "https://github.com/wbthomason/packer.nvim", + install_path, + }) end return packer_bootstrap From 175db0862b352212a80900d5f10e34a02ce652d1 Mon Sep 17 00:00:00 2001 From: luokai Date: Wed, 6 Jul 2022 09:26:38 +0800 Subject: [PATCH 0298/1278] LICENSE --- LICENSE | 202 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 202 insertions(+) create mode 100644 LICENSE diff --git a/LICENSE b/LICENSE new file mode 100644 index 00000000..d6456956 --- /dev/null +++ b/LICENSE @@ -0,0 +1,202 @@ + + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright [yyyy] [name of copyright owner] + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. From 5ba826702318db40f5df6a4e94f736f3ad80cdb2 Mon Sep 17 00:00:00 2001 From: luokai Date: Wed, 6 Jul 2022 17:39:44 +0800 Subject: [PATCH 0299/1278] liblldb_path --- lua/kide/dap/codelldb.lua | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lua/kide/dap/codelldb.lua b/lua/kide/dap/codelldb.lua index fc20a2ba..b38ce891 100644 --- a/lua/kide/dap/codelldb.lua +++ b/lua/kide/dap/codelldb.lua @@ -2,6 +2,7 @@ local M = {} local extension_path = "/Users/luokai/.vscode/extensions/vadimcn.vscode-lldb-1.7.0" M.config = {} M.config.codelldb_path = extension_path .. "/adapter/codelldb" +M.config.liblldb_path = extension_path .. "/lldb/lib/liblldb.dylib" M.setup = function(config) if config then @@ -21,7 +22,7 @@ M.setup = function(config) local stderr = vim.loop.new_pipe(false) local opts = { stdio = { nil, stdout, stderr }, - args = { "--port", tostring(port) }, + args = { "--port", tostring(port), "--liblldb", M.config.liblldb_path }, } local handle local pid_or_err From 558faf808741ef1ca7763938a528253074278b22 Mon Sep 17 00:00:00 2001 From: luokai Date: Thu, 7 Jul 2022 14:27:00 +0800 Subject: [PATCH 0300/1278] Hack --- lua/kide/core/basic.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lua/kide/core/basic.lua b/lua/kide/core/basic.lua index b6c51b93..0942236f 100644 --- a/lua/kide/core/basic.lua +++ b/lua/kide/core/basic.lua @@ -93,7 +93,7 @@ set mouse=n if exists('g:neovide') " let g:neovide_refresh_rate=60 let g:neovide_cursor_vfx_mode = "railgun" - set guifont=CaskaydiaCove\ Nerd\ Font\ Mono,Cascadia\ Mono\ PL:h14 + set guifont=Hack\ Nerd\ Font\ Mono,Hack:h13 " let g:neovide_transparency=1 " let g:neovide_fullscreen=v:true " let g:neovide_remember_window_size = v:true From b62ebd1749f91b4495d914e174b49de009a34856 Mon Sep 17 00:00:00 2001 From: luokai Date: Thu, 7 Jul 2022 15:22:58 +0800 Subject: [PATCH 0301/1278] preview fg --- lua/kide/theme/telescope.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lua/kide/theme/telescope.lua b/lua/kide/theme/telescope.lua index d58253f9..04ecd523 100644 --- a/lua/kide/theme/telescope.lua +++ b/lua/kide/theme/telescope.lua @@ -47,7 +47,7 @@ return { bg = colors.black3, }, TelescopePreviewNormal = { - fg = colors.black3, + fg = colors.white, bg = colors.black3, }, From 63586301d0de3ef2d4023a31bfd7e28ddca47cc2 Mon Sep 17 00:00:00 2001 From: luokai Date: Thu, 7 Jul 2022 16:59:56 +0800 Subject: [PATCH 0302/1278] vim-dadbod --- lua/kide/lsp/utils/init.lua | 1 + lua/kide/plugins/config/lualine.lua | 14 ++++++++++++++ lua/kide/plugins/config/null-ls.lua | 7 ++++++- lua/kide/plugins/config/vim-dadbod.lua | 0 lua/kide/plugins/init.lua | 12 +++++++++--- 5 files changed, 30 insertions(+), 4 deletions(-) create mode 100644 lua/kide/plugins/config/vim-dadbod.lua diff --git a/lua/kide/lsp/utils/init.lua b/lua/kide/lsp/utils/init.lua index f3ce805b..022a1588 100644 --- a/lua/kide/lsp/utils/init.lua +++ b/lua/kide/lsp/utils/init.lua @@ -19,6 +19,7 @@ format_lsp_mapping["java"] = "jdt.ls" -- sql_formatter format_lsp_mapping["sql"] = "null-ls" +format_lsp_mapping["mysql"] = "null-ls" -- prettier format_lsp_mapping["javascript"] = "null-ls" format_lsp_mapping["javascriptreact"] = "null-ls" diff --git a/lua/kide/plugins/config/lualine.lua b/lua/kide/plugins/config/lualine.lua index 158e9e7d..173cfa04 100644 --- a/lua/kide/plugins/config/lualine.lua +++ b/lua/kide/plugins/config/lualine.lua @@ -91,4 +91,18 @@ diffview.filetypes = { } table.insert(config.extensions, diffview) + + +-- db-ui +local dbui = {} +dbui.sections = { + lualine_a = { + { "filename", file_status = false }, + }, +} +dbui.filetypes = { + "dbui", +} +table.insert(config.extensions, dbui) + require("lualine").setup(config) diff --git a/lua/kide/plugins/config/null-ls.lua b/lua/kide/plugins/config/null-ls.lua index 0f8ced05..f708255d 100644 --- a/lua/kide/plugins/config/null-ls.lua +++ b/lua/kide/plugins/config/null-ls.lua @@ -42,7 +42,12 @@ local sources = { }), -- null_ls.builtins.code_actions.gitsigns, -- sql - null_ls.builtins.formatting.sql_formatter, + null_ls.builtins.formatting.sql_formatter.with({ + filetypes = { + "sql", + "mysql", + }, + }), -- null_ls.builtins.formatting.google_java_format, -- null_ls.builtins.diagnostics.semgrep, null_ls.builtins.formatting.rustfmt, diff --git a/lua/kide/plugins/config/vim-dadbod.lua b/lua/kide/plugins/config/vim-dadbod.lua new file mode 100644 index 00000000..e69de29b diff --git a/lua/kide/plugins/init.lua b/lua/kide/plugins/init.lua index 078ce29e..c9f10ad4 100644 --- a/lua/kide/plugins/init.lua +++ b/lua/kide/plugins/init.lua @@ -258,10 +258,11 @@ require("packer").startup({ use("tversteeg/registers.nvim") + -- databases use("nanotee/sqls.nvim") - if bootstrap then - require("packer").sync() - end + use("tpope/vim-dadbod") + use("kristijanhusak/vim-dadbod-ui") + -- 项目管理 use({ "ahmedkhalf/project.nvim", @@ -269,6 +270,10 @@ require("packer").startup({ require("project_nvim").setup({}) end, }) + + if bootstrap then + require("packer").sync() + end end, config = { display = { @@ -320,6 +325,7 @@ vim.defer_fn(function() require("kide.plugins.config.null-ls") require("kide.plugins.config.diffview-nvim") require("kide.plugins.config.neogit") + require("kide.plugins.config.vim-dadbod") vim.cmd([[ function! s:http_rest_init() abort lua require('kide.plugins/config/rest-nvim') From 5ef4da4a32670bed81f07fa65495247167875ed6 Mon Sep 17 00:00:00 2001 From: luokai Date: Thu, 7 Jul 2022 17:08:33 +0800 Subject: [PATCH 0303/1278] dbui nerd font --- lua/kide/plugins/config/vim-dadbod.lua | 1 + lua/kide/plugins/init.lua | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/lua/kide/plugins/config/vim-dadbod.lua b/lua/kide/plugins/config/vim-dadbod.lua index e69de29b..19c32cc3 100644 --- a/lua/kide/plugins/config/vim-dadbod.lua +++ b/lua/kide/plugins/config/vim-dadbod.lua @@ -0,0 +1 @@ +vim.g.db_ui_use_nerd_fonts = 1 diff --git a/lua/kide/plugins/init.lua b/lua/kide/plugins/init.lua index c9f10ad4..23ca827f 100644 --- a/lua/kide/plugins/init.lua +++ b/lua/kide/plugins/init.lua @@ -291,6 +291,7 @@ require("kide.plugins.config.lualine") require("kide.plugins.config.nvim-tree") require("kide.plugins.config.vim-illuminate") require("kide.plugins.config.symbols-outline") +require("kide.plugins.config.vim-dadbod") -- 异步加载 vim.defer_fn(function() require("kide.plugins.config.nvim-treesitter") @@ -325,7 +326,6 @@ vim.defer_fn(function() require("kide.plugins.config.null-ls") require("kide.plugins.config.diffview-nvim") require("kide.plugins.config.neogit") - require("kide.plugins.config.vim-dadbod") vim.cmd([[ function! s:http_rest_init() abort lua require('kide.plugins/config/rest-nvim') From a0b26c658eff441b1a23dc009a4d7654177921bf Mon Sep 17 00:00:00 2001 From: luokai Date: Thu, 7 Jul 2022 17:21:58 +0800 Subject: [PATCH 0304/1278] dbui bufferline --- lua/kide/plugins/config/bufferline.lua | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/lua/kide/plugins/config/bufferline.lua b/lua/kide/plugins/config/bufferline.lua index c3f7600c..c354f995 100644 --- a/lua/kide/plugins/config/bufferline.lua +++ b/lua/kide/plugins/config/bufferline.lua @@ -50,6 +50,13 @@ require("bufferline").setup({ highlight = "Directory", text_align = "left", }, + { + filetype = "dbui", + text = "Databases", + padding = 1, + highlight = "Directory", + text_align = "left", + }, }, color_icons = true, show_buffer_close_icons = true, From 46c94198e982a598217faaa797f2cc14a8eb2657 Mon Sep 17 00:00:00 2001 From: luokai Date: Thu, 7 Jul 2022 17:24:55 +0800 Subject: [PATCH 0305/1278] nvim-tree --- lua/kide/plugins/init.lua | 1 + 1 file changed, 1 insertion(+) diff --git a/lua/kide/plugins/init.lua b/lua/kide/plugins/init.lua index 23ca827f..66d59c98 100644 --- a/lua/kide/plugins/init.lua +++ b/lua/kide/plugins/init.lua @@ -61,6 +61,7 @@ require("packer").startup({ requires = { "kyazdani42/nvim-web-devicons", -- optional, for file icon }, + tag = "nightly", }) -- using packer.nvim From 919df46698dd978056e0f85ccffcb6b28575b940 Mon Sep 17 00:00:00 2001 From: luokai Date: Thu, 7 Jul 2022 17:35:33 +0800 Subject: [PATCH 0306/1278] nvim-tree find --- lua/kide/plugins/config/nvim-tree.lua | 9 +++- lua/kide/plugins/config/utils/treeutil.lua | 49 ++++++++++++++++++++++ 2 files changed, 57 insertions(+), 1 deletion(-) create mode 100644 lua/kide/plugins/config/utils/treeutil.lua diff --git a/lua/kide/plugins/config/nvim-tree.lua b/lua/kide/plugins/config/nvim-tree.lua index 455471bb..8fff8e46 100644 --- a/lua/kide/plugins/config/nvim-tree.lua +++ b/lua/kide/plugins/config/nvim-tree.lua @@ -1,3 +1,6 @@ +local function custom_callback(callback_name) + return string.format(":lua require('kide.plugins.config.utils.treeutil').%s()", callback_name) +end require("nvim-tree").setup({ disable_netrw = true, hijack_netrw = true, @@ -65,7 +68,11 @@ require("nvim-tree").setup({ signcolumn = "yes", mappings = { custom_only = false, - list = {}, + list = { + + { key = "ff", cb = custom_callback("launch_find_files") }, + { key = "fg", cb = custom_callback("launch_live_grep") }, + }, }, }, renderer = { diff --git a/lua/kide/plugins/config/utils/treeutil.lua b/lua/kide/plugins/config/utils/treeutil.lua new file mode 100644 index 00000000..fd0e7605 --- /dev/null +++ b/lua/kide/plugins/config/utils/treeutil.lua @@ -0,0 +1,49 @@ +local openfile = require("nvim-tree.actions.open-file") +local actions = require("telescope.actions") +local action_state = require("telescope.actions.state") +local M = {} + +local view_selection = function(prompt_bufnr, _) + actions.select_default:replace(function() + actions.close(prompt_bufnr) + local selection = action_state.get_selected_entry() + local filename = selection.filename + if filename == nil then + filename = selection[1] + end + openfile.fn("preview", filename) + end) + return true +end + +function M.launch_live_grep(opts) + return M.launch_telescope("live_grep", opts) +end + +function M.launch_find_files(opts) + return M.launch_telescope("find_files", opts) +end + +function M.launch_telescope(func_name, opts) + local telescope_status_ok, _ = pcall(require, "telescope") + if not telescope_status_ok then + return + end + local lib_status_ok, lib = pcall(require, "nvim-tree.lib") + if not lib_status_ok then + return + end + local node = lib.get_node_at_cursor() + local is_folder = node.fs_stat and node.fs_stat.type == "directory" or false + local basedir = is_folder and node.absolute_path or vim.fn.fnamemodify(node.absolute_path, ":h") + if node.name == ".." and TreeExplorer ~= nil then + basedir = TreeExplorer.cwd + end + opts = opts or {} + opts.cwd = basedir + opts.search_dirs = { basedir } + opts.attach_mappings = view_selection + return require("telescope.builtin")[func_name](opts) +end + +return M From 4c530682449ea52ef11a25058b10cd9edd305f36 Mon Sep 17 00:00:00 2001 From: luokai Date: Thu, 7 Jul 2022 17:53:41 +0800 Subject: [PATCH 0307/1278] nvim-tree config --- lua/kide/plugins/config/gruvbox.lua | 9 ++++++++- lua/kide/plugins/config/nvim-tree.lua | 19 ++----------------- 2 files changed, 10 insertions(+), 18 deletions(-) diff --git a/lua/kide/plugins/config/gruvbox.lua b/lua/kide/plugins/config/gruvbox.lua index 05a1fac3..4f017c9d 100644 --- a/lua/kide/plugins/config/gruvbox.lua +++ b/lua/kide/plugins/config/gruvbox.lua @@ -1,9 +1,16 @@ -- setup must be called before loading the colorscheme -- Default options: -local overrides = {} +local colors = require("gruvbox.palette") +local overrides = { + + NvimTreeFolderIcon = { + fg = colors.bright_green, + }, +} overrides = vim.tbl_extend("force", overrides, require("kide.theme.telescope")) + require("gruvbox").setup({ undercurl = true, underline = true, diff --git a/lua/kide/plugins/config/nvim-tree.lua b/lua/kide/plugins/config/nvim-tree.lua index 8fff8e46..79667204 100644 --- a/lua/kide/plugins/config/nvim-tree.lua +++ b/lua/kide/plugins/config/nvim-tree.lua @@ -50,7 +50,7 @@ require("nvim-tree").setup({ }, filters = { dotfiles = false, - custom = { ".git" }, + custom = { "^.git$" }, }, git = { enable = true, @@ -91,16 +91,7 @@ require("nvim-tree").setup({ }, }) -local g = vim.g - -g.nvim_tree_indent_markers = 1 - -g.nvim_tree_special_files = {} - -g.nvim_tree_window_picker_exclude = { - filetype = { "notify", "packer", "qf" }, - buftype = { "terminal" }, -} +-- local g = vim.g -- g.nvim_tree_icons = { -- default = "", @@ -123,9 +114,3 @@ g.nvim_tree_window_picker_exclude = { -- symlink_open = "", -- }, -- } - -g.nvim_tree_show_icons = { - folders = 1, - files = 1, - git = 1, -} From a4c5e415bd4e5c1d0eeb0629ab40ab84d00e7518 Mon Sep 17 00:00:00 2001 From: luokai Date: Thu, 7 Jul 2022 18:06:03 +0800 Subject: [PATCH 0308/1278] =?UTF-8?q?=E5=9B=BA=E5=AE=9A=E5=90=AF=E5=8A=A8?= =?UTF-8?q?=E9=A1=B5=E9=9D=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lua/kide/plugins/config/alpha-nvim.lua | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/lua/kide/plugins/config/alpha-nvim.lua b/lua/kide/plugins/config/alpha-nvim.lua index 472a59bd..b5182aed 100644 --- a/lua/kide/plugins/config/alpha-nvim.lua +++ b/lua/kide/plugins/config/alpha-nvim.lua @@ -1,10 +1,20 @@ local alpha = require("alpha") local dashboard = require("alpha.themes.dashboard") -local ascli = require("kide.plugins.config.ascli-header") +-- local ascli = require("kide.plugins.config.ascli-header") dashboard.leader = "\\" -- Set header -dashboard.section.header.val = ascli[math.random(0, #ascli)] +-- dashboard.section.header.val = ascli[math.random(0, #ascli)] +dashboard.section.header.val = { + " ", + " ███╗ ██╗███████╗ ██████╗ ██╗ ██╗██╗███╗ ███╗ ", + " ████╗ ██║██╔════╝██╔═══██╗██║ ██║██║████╗ ████║ ", + " ██╔██╗ ██║█████╗ ██║ ██║██║ ██║██║██╔████╔██║ ", + " ██║╚██╗██║██╔══╝ ██║ ██║╚██╗ ██╔╝██║██║╚██╔╝██║ ", + " ██║ ╚████║███████╗╚██████╔╝ ╚████╔╝ ██║██║ ╚═╝ ██║ ", + " ╚═╝ ╚═══╝╚══════╝ ╚═════╝ ╚═══╝ ╚═╝╚═╝ ╚═╝ ", + " ", +} local opt = { noremap = true, silent = true } -- Set menu dashboard.section.buttons.val = { From 91c81aa5546cde2fda76655928c3938a78f88d29 Mon Sep 17 00:00:00 2001 From: luokai Date: Fri, 8 Jul 2022 10:20:52 +0800 Subject: [PATCH 0309/1278] fmt --- lua/kide/plugins/config/lualine.lua | 2 -- 1 file changed, 2 deletions(-) diff --git a/lua/kide/plugins/config/lualine.lua b/lua/kide/plugins/config/lualine.lua index 173cfa04..a30853f3 100644 --- a/lua/kide/plugins/config/lualine.lua +++ b/lua/kide/plugins/config/lualine.lua @@ -91,8 +91,6 @@ diffview.filetypes = { } table.insert(config.extensions, diffview) - - -- db-ui local dbui = {} dbui.sections = { From af0f44e22f8810fba7c2ccb20f5de7ceaf2d5ed0 Mon Sep 17 00:00:00 2001 From: luokai Date: Fri, 8 Jul 2022 20:47:29 +0800 Subject: [PATCH 0310/1278] diagnostics --- lua/kide/plugins/config/nvim-tree.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lua/kide/plugins/config/nvim-tree.lua b/lua/kide/plugins/config/nvim-tree.lua index 79667204..7a3297f3 100644 --- a/lua/kide/plugins/config/nvim-tree.lua +++ b/lua/kide/plugins/config/nvim-tree.lua @@ -31,7 +31,7 @@ require("nvim-tree").setup({ }, }, diagnostics = { - enable = false, + enable = true, icons = { hint = "", info = "", From ea67c8db534887eda9fc9486629b0f5d9bb06d04 Mon Sep 17 00:00:00 2001 From: luokai Date: Fri, 8 Jul 2022 21:33:25 +0800 Subject: [PATCH 0311/1278] config --- lua/kide/plugins/config/lspsaga.lua | 3 ++- lua/kide/plugins/config/trouble.lua | 4 +--- lua/kide/plugins/init.lua | 4 ++-- 3 files changed, 5 insertions(+), 6 deletions(-) diff --git a/lua/kide/plugins/config/lspsaga.lua b/lua/kide/plugins/config/lspsaga.lua index 6293dd16..d850d99b 100644 --- a/lua/kide/plugins/config/lspsaga.lua +++ b/lua/kide/plugins/config/lspsaga.lua @@ -35,9 +35,10 @@ local saga = require("lspsaga") -- the related filetypes into this table -- like server_filetype_map = {metals = {'sbt', 'scala'}} -- server_filetype_map = {} - saga.init_lsp_saga({ diagnostic_header = { " ", " ", " ", " " }, + code_action_icon = "", + max_preview_lines = 40, server_filetype_map = { metals = { "java" }, }, diff --git a/lua/kide/plugins/config/trouble.lua b/lua/kide/plugins/config/trouble.lua index db2bc4a6..28b63f46 100644 --- a/lua/kide/plugins/config/trouble.lua +++ b/lua/kide/plugins/config/trouble.lua @@ -1,5 +1,3 @@ require("trouble").setup({ - -- your configuration comes here - -- or leave it empty to use the default settings - -- refer to the configuration section below + use_diagnostic_signs = true, }) diff --git a/lua/kide/plugins/init.lua b/lua/kide/plugins/init.lua index 66d59c98..9294a2a1 100644 --- a/lua/kide/plugins/init.lua +++ b/lua/kide/plugins/init.lua @@ -35,7 +35,7 @@ require("packer").startup({ use("folke/trouble.nvim") -- java 不友好 - -- use 'glepnir/lspsaga.nvim' + -- use({ "glepnir/lspsaga.nvim", branch = "main" }) -- use 'arkav/lualine-lsp-progress' -- use 'nvim-lua/lsp-status.nvim' @@ -313,7 +313,7 @@ vim.defer_fn(function() require("kide.plugins.config.wilder") require("kide.plugins.config.nvim-colorizer") require("kide.plugins.config.comment") - -- require('kide.plugins.config.lspsaga') + -- require("kide.plugins.config.lspsaga") -- require('plugins/config/formatter') require("kide.plugins.config.telescope") -- require('plugins/config/nvim-lsputils') From 7ecfe3796c81b64ebb788c46d9825f4c67a124bb Mon Sep 17 00:00:00 2001 From: luokai Date: Fri, 8 Jul 2022 21:46:44 +0800 Subject: [PATCH 0312/1278] lsp --- lua/kide/plugins/config/nvim-tree.lua | 2 +- lua/kide/plugins/config/trouble.lua | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/lua/kide/plugins/config/nvim-tree.lua b/lua/kide/plugins/config/nvim-tree.lua index 7a3297f3..79667204 100644 --- a/lua/kide/plugins/config/nvim-tree.lua +++ b/lua/kide/plugins/config/nvim-tree.lua @@ -31,7 +31,7 @@ require("nvim-tree").setup({ }, }, diagnostics = { - enable = true, + enable = false, icons = { hint = "", info = "", diff --git a/lua/kide/plugins/config/trouble.lua b/lua/kide/plugins/config/trouble.lua index 28b63f46..b6396257 100644 --- a/lua/kide/plugins/config/trouble.lua +++ b/lua/kide/plugins/config/trouble.lua @@ -1,3 +1,4 @@ require("trouble").setup({ use_diagnostic_signs = true, + auto_preview = false, }) From 1f6f9e263e40cf6a8ec5cf86616cfc5ea0e6e6f9 Mon Sep 17 00:00:00 2001 From: luokai Date: Fri, 8 Jul 2022 22:09:02 +0800 Subject: [PATCH 0313/1278] remove trouble --- lua/kide/core/keybindings.lua | 20 ++++++++++++-------- lua/kide/plugins/config/telescope.lua | 4 ++-- lua/kide/plugins/init.lua | 4 ++-- 3 files changed, 16 insertions(+), 12 deletions(-) diff --git a/lua/kide/core/keybindings.lua b/lua/kide/core/keybindings.lua index 16c18351..35d3bbb9 100644 --- a/lua/kide/core/keybindings.lua +++ b/lua/kide/core/keybindings.lua @@ -204,15 +204,16 @@ M.maplsp = function(client, bufnr) -- vim.api.nvim_buf_set_keymap(bufnr, 'n', 'gd', 'Trouble lsp_definitions', opt) vim.api.nvim_buf_set_keymap(bufnr, "n", "gd", "Telescope lsp_definitions", opt) vim.api.nvim_buf_set_keymap(bufnr, "n", "gh", "lua vim.lsp.buf.hover()", opt) + vim.api.nvim_buf_set_keymap(bufnr, "n", "gs", "lua vim.lsp.buf.signature_help()", opt) -- mapbuf('n', 'gD', 'lua vim.lsp.buf.declaration()', opt) -- mapbuf('n', 'gD', 'lua vim.lsp.buf.type_definition()', opt) vim.api.nvim_buf_set_keymap(bufnr, "n", "gD", "Trouble lsp_type_definitions", opt) -- mapbuf('n', 'gi', 'lua vim.lsp.buf.implementation()', opt) - vim.api.nvim_buf_set_keymap(bufnr, "n", "gi", "Trouble lsp_implementations", opt) - vim.api.nvim_buf_set_keymap(bufnr, "n", "gi", "Telescope lsp_implementations", opt) + -- vim.api.nvim_buf_set_keymap(bufnr, "n", "gi", "Trouble lsp_implementations", opt) + vim.api.nvim_buf_set_keymap(bufnr, "n", "gi", "Telescope lsp_implementations", opt) -- mapbuf('n', 'gr', 'lua vim.lsp.buf.references()', opt) - vim.api.nvim_buf_set_keymap(bufnr, "n", "gr", "Trouble lsp_references", opt) - vim.api.nvim_buf_set_keymap(bufnr, "n", "gr", "Telescope lsp_references", opt) + -- vim.api.nvim_buf_set_keymap(bufnr, "n", "gr", "Trouble lsp_references", opt) + vim.api.nvim_buf_set_keymap(bufnr, "n", "gr", "Telescope lsp_references", opt) -- mapbuf('n', 'gr', 'lua require"lspsaga.provider".lsp_finder()', opt) -- mapbuf('n', 's', 'lua vim.lsp.buf.workspace_symbol()', opt) -- mapbuf('n', 's', 'lua require"telescope.builtin".lsp_workspace_symbols({ query = vim.fn.input("Query> ") })', opt) @@ -255,10 +256,13 @@ M.maplsp = function(client, bufnr) -- mapbuf('n', 'wr', 'lua vim.lsp.buf.remove_workspace_folder()', opt) -- mapbuf('n', 'wl', 'lua print(vim.inspect(vim.lsp.buf.list_workspace_folders()))', opt) -- mapbuf('n', 'D', 'lua vim.lsp.buf.type_definition()', opt) - vim.api.nvim_buf_set_keymap(bufnr, "n", "xx", "Trouble", opt) - vim.api.nvim_buf_set_keymap(bufnr, "n", "xw", "Trouble workspace_diagnostics", opt) - vim.api.nvim_buf_set_keymap(bufnr, "n", "xd", "Trouble document_diagnostics", opt) - vim.api.nvim_buf_set_keymap(bufnr, "n", "xq", "Trouble quickfix", opt) + + vim.api.nvim_buf_set_keymap(bufnr, "n", "xw", "Telescope diagnostics", opt) + -- vim.api.nvim_buf_set_keymap(bufnr, "n", "xw", "Trouble workspace_diagnostics", opt) + -- vim.api.nvim_buf_set_keymap(bufnr, "n", "xx", "Trouble", opt) + -- vim.api.nvim_buf_set_keymap(bufnr, "n", "xw", "Trouble workspace_diagnostics", opt) + -- vim.api.nvim_buf_set_keymap(bufnr, "n", "xd", "Trouble document_diagnostics", opt) + -- vim.api.nvim_buf_set_keymap(bufnr, "n", "xq", "Trouble quickfix", opt) end -- nvim-cmp 自动补全 diff --git a/lua/kide/plugins/config/telescope.lua b/lua/kide/plugins/config/telescope.lua index 999407e1..b5e2b6f2 100644 --- a/lua/kide/plugins/config/telescope.lua +++ b/lua/kide/plugins/config/telescope.lua @@ -1,5 +1,5 @@ -local actions = require("telescope.actions") -local trouble = require("trouble.providers.telescope") +-- local actions = require("telescope.actions") +-- local trouble = require("trouble.providers.telescope") local telescope = require("telescope") telescope.setup({ defaults = { diff --git a/lua/kide/plugins/init.lua b/lua/kide/plugins/init.lua index 9294a2a1..3c7250c0 100644 --- a/lua/kide/plugins/init.lua +++ b/lua/kide/plugins/init.lua @@ -32,7 +32,7 @@ require("packer").startup({ -- lsp 相关 -- use 'folke/lsp-colors.nvim' - use("folke/trouble.nvim") + -- use("folke/trouble.nvim") -- java 不友好 -- use({ "glepnir/lspsaga.nvim", branch = "main" }) @@ -308,7 +308,7 @@ vim.defer_fn(function() -- require('plugins/config/vista') -- require('plugins/config/aerial') -- require('plugins/config/lsp-colors') - require("kide.plugins.config.trouble") + -- require("kide.plugins.config.trouble") require("kide.plugins.config.nvim-notify") require("kide.plugins.config.wilder") require("kide.plugins.config.nvim-colorizer") From e1c0d3f2a945d09dd60e8dffa1be430f8f7f683d Mon Sep 17 00:00:00 2001 From: luokai Date: Fri, 8 Jul 2022 22:15:28 +0800 Subject: [PATCH 0314/1278] bd --- lua/kide/core/keybindings.lua | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lua/kide/core/keybindings.lua b/lua/kide/core/keybindings.lua index 35d3bbb9..042c7b2c 100644 --- a/lua/kide/core/keybindings.lua +++ b/lua/kide/core/keybindings.lua @@ -27,8 +27,8 @@ M.setup = function() require("kide.core.utils").close_other_bufline() end, {}) map("n", "s", ":w", opt) - map("n", "w", ":bwipeout", opt) - map("n", "W", ":%bwipeout", opt) + map("n", "w", ":bd", opt) + map("n", "W", ":%bd", opt) map("n", "q", ":q", opt) map("n", "n", ":BufferLineCycleNext ", opt) map("n", "p", ":BufferLineCyclePrev ", opt) From 2904649302b46cede9f711be2268a42da92bc44f Mon Sep 17 00:00:00 2001 From: luokai Date: Sat, 9 Jul 2022 09:10:06 +0800 Subject: [PATCH 0315/1278] =?UTF-8?q?=E6=94=AF=E6=8C=81=E9=A2=84=E8=A7=88?= =?UTF-8?q?=20jar=20=E5=8C=85=20class?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lua/kide/lsp/utils/jdtls.lua | 67 +++++++++++++++++++++++++++ lua/kide/plugins/config/telescope.lua | 38 ++++++++++++++- 2 files changed, 104 insertions(+), 1 deletion(-) create mode 100644 lua/kide/lsp/utils/jdtls.lua diff --git a/lua/kide/lsp/utils/jdtls.lua b/lua/kide/lsp/utils/jdtls.lua new file mode 100644 index 00000000..d6e2603c --- /dev/null +++ b/lua/kide/lsp/utils/jdtls.lua @@ -0,0 +1,67 @@ +local M = {} +M.open_jdt_link = function(uri, buf, timeout) + local client + for _, c in ipairs(vim.lsp.get_active_clients()) do + if + c.config.init_options + and c.config.init_options.extendedClientCapabilities + and c.config.init_options.extendedClientCapabilities.classFileContentsSupport + then + client = c + break + end + end + assert(client, "Must have a buffer open with a language client connected to eclipse.jdt.ls to load JDT URI") + local params = { + uri = uri, + } + local response = nil + local cb = function(err, result) + response = { err, result } + end + local ok, request_id = client.request("java/classFileContents", params, cb, buf) + assert(ok, "Request to `java/classFileContents` must succeed to open JDT URI. Client shutdown?") + local timeout_ms = timeout or 500 + local wait_ok, reason = vim.wait(timeout_ms, function() + return response + end) + local log_path = require("jdtls.path").join(vim.fn.stdpath("cache"), "lsp.log") + local buf_content + if wait_ok and #response == 2 and response[2] then + local content = response[2] + if content == "" then + buf_content = { + "Received response from server, but it was empty. Check the log file for errors", + log_path, + } + else + buf_content = vim.split(response[2], "\n", true) + end + else + local error_msg + if not wait_ok then + client.cancel_request(request_id) + local wait_failure = { + [-1] = "timeout", + [-2] = "interrupted", + [-3] = "error", + } + error_msg = wait_failure[reason] + else + error_msg = response[1] + end + buf_content = { + "Failed to load content for uri", + uri, + "", + "Error was: ", + } + vim.list_extend(buf_content, vim.split(vim.inspect(error_msg), "\n")) + vim.list_extend(buf_content, { "", "Check the log file for errors", log_path }) + end + vim.api.nvim_buf_set_option(buf, "modifiable", true) + vim.api.nvim_buf_set_lines(buf, 0, -1, false, buf_content) + vim.api.nvim_buf_set_option(buf, "filetype", "java") + vim.api.nvim_buf_set_option(buf, "modifiable", false) +end +return M diff --git a/lua/kide/plugins/config/telescope.lua b/lua/kide/plugins/config/telescope.lua index b5e2b6f2..630740dc 100644 --- a/lua/kide/plugins/config/telescope.lua +++ b/lua/kide/plugins/config/telescope.lua @@ -1,6 +1,30 @@ -- local actions = require("telescope.actions") -- local trouble = require("trouble.providers.telescope") local telescope = require("telescope") + +-- 支持预览 jar 包 class +local form_entry = require("telescope.from_entry") +local f_path = form_entry.path +form_entry.path = function(entry, validate, escape) + escape = vim.F.if_nil(escape, true) + local path + if escape then + path = entry.path and vim.fn.fnameescape(entry.path) or nil + else + path = entry.path + end + if path == nil then + path = entry.filename + end + if path == nil then + path = entry.value + end + if vim.startswith(path, "jdt://") then + return path + end + return f_path(entry, validate, escape) +end + telescope.setup({ defaults = { -- vimgrep_arguments = { @@ -52,7 +76,9 @@ telescope.setup({ -- file_sorter = require("telescope.sorters").get_fuzzy_file, file_ignore_patterns = { "node_modules" }, -- generic_sorter = require("telescope.sorters").get_generic_fuzzy_sorter, - -- path_display = { "truncate" }, + path_display = { "truncate" }, + dynamic_preview_title = true, + results_title = false, -- file_previewer = require("telescope.previewers").vim_buffer_cat.new, -- grep_previewer = require("telescope.previewers").vim_buffer_vimgrep.new, -- qflist_previewer = require("telescope.previewers").vim_buffer_qflist.new, @@ -61,6 +87,16 @@ telescope.setup({ -- Default configuration for telescope goes here: -- config_key = value, + preview = { + -- timeout = 1000, + filetype_hook = function(filepath, bufnr, opts) + if vim.startswith(filepath, "jdt://") then + require("kide.lsp.utils.jdtls").open_jdt_link(filepath, bufnr, opts.preview.timeout) + return false + end + return true + end, + }, mappings = { i = { -- map actions.which_key to (default: ) From 4f5b1b94e952b05447d458d561215be51ea0fcf5 Mon Sep 17 00:00:00 2001 From: luokai Date: Sat, 9 Jul 2022 11:14:14 +0800 Subject: [PATCH 0316/1278] timeout --- lua/kide/plugins/config/telescope.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lua/kide/plugins/config/telescope.lua b/lua/kide/plugins/config/telescope.lua index 630740dc..9d221bfd 100644 --- a/lua/kide/plugins/config/telescope.lua +++ b/lua/kide/plugins/config/telescope.lua @@ -88,7 +88,7 @@ telescope.setup({ -- Default configuration for telescope goes here: -- config_key = value, preview = { - -- timeout = 1000, + timeout = 1000, filetype_hook = function(filepath, bufnr, opts) if vim.startswith(filepath, "jdt://") then require("kide.lsp.utils.jdtls").open_jdt_link(filepath, bufnr, opts.preview.timeout) From 81714f5a4467956d3755d6773f6a2d2963920777 Mon Sep 17 00:00:00 2001 From: luokai Date: Sat, 9 Jul 2022 20:44:13 +0800 Subject: [PATCH 0317/1278] path --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 27ca1dbe..e71d8d7b 100644 --- a/README.md +++ b/README.md @@ -42,7 +42,7 @@ git clone https://github.com/JavaHello/nvim.git | 内置终端 | `:ToggleTerm` | | Tasks 列表 | `ts` | -更多配置参考 [keybindings](./lua/core/keybindings.lua) 文件 +更多配置参考 [keybindings](./lua/kide/core/keybindings.lua) 文件 ## Java 配置 From fa41b847b66d3a69669ea5d5626182c8ce7760e4 Mon Sep 17 00:00:00 2001 From: luokai Date: Sun, 10 Jul 2022 11:01:25 +0800 Subject: [PATCH 0318/1278] update toggleterm --- lua/kide/plugins/init.lua | 1 - 1 file changed, 1 deletion(-) diff --git a/lua/kide/plugins/init.lua b/lua/kide/plugins/init.lua index 3c7250c0..8ae012db 100644 --- a/lua/kide/plugins/init.lua +++ b/lua/kide/plugins/init.lua @@ -113,7 +113,6 @@ require("packer").startup({ -- use 'voldikss/LeaderF-floaterm' use({ "akinsho/toggleterm.nvim", - tag = "v2.*", config = function() require("toggleterm").setup() end, From 80c3747557106d3d7d799d73c16c301bb36f185e Mon Sep 17 00:00:00 2001 From: luokai Date: Tue, 12 Jul 2022 14:55:06 +0800 Subject: [PATCH 0319/1278] update --- lua/kide/core/keybindings.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lua/kide/core/keybindings.lua b/lua/kide/core/keybindings.lua index 042c7b2c..dc789d2d 100644 --- a/lua/kide/core/keybindings.lua +++ b/lua/kide/core/keybindings.lua @@ -207,7 +207,7 @@ M.maplsp = function(client, bufnr) vim.api.nvim_buf_set_keymap(bufnr, "n", "gs", "lua vim.lsp.buf.signature_help()", opt) -- mapbuf('n', 'gD', 'lua vim.lsp.buf.declaration()', opt) -- mapbuf('n', 'gD', 'lua vim.lsp.buf.type_definition()', opt) - vim.api.nvim_buf_set_keymap(bufnr, "n", "gD", "Trouble lsp_type_definitions", opt) + -- vim.api.nvim_buf_set_keymap(bufnr, "n", "gD", "Trouble lsp_type_definitions", opt) -- mapbuf('n', 'gi', 'lua vim.lsp.buf.implementation()', opt) -- vim.api.nvim_buf_set_keymap(bufnr, "n", "gi", "Trouble lsp_implementations", opt) vim.api.nvim_buf_set_keymap(bufnr, "n", "gi", "Telescope lsp_implementations", opt) From ec8637d52d91d4b19fcd6e249432b81ac0803898 Mon Sep 17 00:00:00 2001 From: luokai Date: Tue, 12 Jul 2022 20:46:55 +0800 Subject: [PATCH 0320/1278] Outline --- ftplugin/Outline.lua | 2 ++ 1 file changed, 2 insertions(+) create mode 100644 ftplugin/Outline.lua diff --git a/ftplugin/Outline.lua b/ftplugin/Outline.lua new file mode 100644 index 00000000..ebc58ea7 --- /dev/null +++ b/ftplugin/Outline.lua @@ -0,0 +1,2 @@ +vim.opt_local.signcolumn = "no" + From c75b20d8699190724ba0c34f1d48a3e2310ce2bb Mon Sep 17 00:00:00 2001 From: luokai Date: Tue, 12 Jul 2022 22:55:00 +0800 Subject: [PATCH 0321/1278] fmt --- ftplugin/Outline.lua | 1 - 1 file changed, 1 deletion(-) diff --git a/ftplugin/Outline.lua b/ftplugin/Outline.lua index ebc58ea7..9fd021a8 100644 --- a/ftplugin/Outline.lua +++ b/ftplugin/Outline.lua @@ -1,2 +1 @@ vim.opt_local.signcolumn = "no" - From 36cf5e8699f17b3d39ddcfe8fa3f00c7af72e61e Mon Sep 17 00:00:00 2001 From: luokai Date: Tue, 12 Jul 2022 23:16:45 +0800 Subject: [PATCH 0322/1278] GPL3 --- LICENSE | 876 +++++++++++++++++++++++++++++++++++++++++++------------- 1 file changed, 674 insertions(+), 202 deletions(-) diff --git a/LICENSE b/LICENSE index d6456956..f288702d 100644 --- a/LICENSE +++ b/LICENSE @@ -1,202 +1,674 @@ - - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "[]" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright [yyyy] [name of copyright owner] - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. + GNU GENERAL PUBLIC LICENSE + Version 3, 29 June 2007 + + Copyright (C) 2007 Free Software Foundation, Inc. + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The GNU General Public License is a free, copyleft license for +software and other kinds of works. + + The licenses for most software and other practical works are designed +to take away your freedom to share and change the works. By contrast, +the GNU General Public License is intended to guarantee your freedom to +share and change all versions of a program--to make sure it remains free +software for all its users. We, the Free Software Foundation, use the +GNU General Public License for most of our software; it applies also to +any other work released this way by its authors. You can apply it to +your programs, too. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +them if you wish), that you receive source code or can get it if you +want it, that you can change the software or use pieces of it in new +free programs, and that you know you can do these things. + + To protect your rights, we need to prevent others from denying you +these rights or asking you to surrender the rights. Therefore, you have +certain responsibilities if you distribute copies of the software, or if +you modify it: responsibilities to respect the freedom of others. + + For example, if you distribute copies of such a program, whether +gratis or for a fee, you must pass on to the recipients the same +freedoms that you received. You must make sure that they, too, receive +or can get the source code. And you must show them these terms so they +know their rights. + + Developers that use the GNU GPL protect your rights with two steps: +(1) assert copyright on the software, and (2) offer you this License +giving you legal permission to copy, distribute and/or modify it. + + For the developers' and authors' protection, the GPL clearly explains +that there is no warranty for this free software. For both users' and +authors' sake, the GPL requires that modified versions be marked as +changed, so that their problems will not be attributed erroneously to +authors of previous versions. + + Some devices are designed to deny users access to install or run +modified versions of the software inside them, although the manufacturer +can do so. This is fundamentally incompatible with the aim of +protecting users' freedom to change the software. The systematic +pattern of such abuse occurs in the area of products for individuals to +use, which is precisely where it is most unacceptable. Therefore, we +have designed this version of the GPL to prohibit the practice for those +products. If such problems arise substantially in other domains, we +stand ready to extend this provision to those domains in future versions +of the GPL, as needed to protect the freedom of users. + + Finally, every program is threatened constantly by software patents. +States should not allow patents to restrict development and use of +software on general-purpose computers, but in those that do, we wish to +avoid the special danger that patents applied to a free program could +make it effectively proprietary. To prevent this, the GPL assures that +patents cannot be used to render the program non-free. + + The precise terms and conditions for copying, distribution and +modification follow. + + TERMS AND CONDITIONS + + 0. Definitions. + + "This License" refers to version 3 of the GNU General Public License. + + "Copyright" also means copyright-like laws that apply to other kinds of +works, such as semiconductor masks. + + "The Program" refers to any copyrightable work licensed under this +License. Each licensee is addressed as "you". "Licensees" and +"recipients" may be individuals or organizations. + + To "modify" a work means to copy from or adapt all or part of the work +in a fashion requiring copyright permission, other than the making of an +exact copy. The resulting work is called a "modified version" of the +earlier work or a work "based on" the earlier work. + + A "covered work" means either the unmodified Program or a work based +on the Program. + + To "propagate" a work means to do anything with it that, without +permission, would make you directly or secondarily liable for +infringement under applicable copyright law, except executing it on a +computer or modifying a private copy. Propagation includes copying, +distribution (with or without modification), making available to the +public, and in some countries other activities as well. + + To "convey" a work means any kind of propagation that enables other +parties to make or receive copies. Mere interaction with a user through +a computer network, with no transfer of a copy, is not conveying. + + An interactive user interface displays "Appropriate Legal Notices" +to the extent that it includes a convenient and prominently visible +feature that (1) displays an appropriate copyright notice, and (2) +tells the user that there is no warranty for the work (except to the +extent that warranties are provided), that licensees may convey the +work under this License, and how to view a copy of this License. If +the interface presents a list of user commands or options, such as a +menu, a prominent item in the list meets this criterion. + + 1. Source Code. + + The "source code" for a work means the preferred form of the work +for making modifications to it. "Object code" means any non-source +form of a work. + + A "Standard Interface" means an interface that either is an official +standard defined by a recognized standards body, or, in the case of +interfaces specified for a particular programming language, one that +is widely used among developers working in that language. + + The "System Libraries" of an executable work include anything, other +than the work as a whole, that (a) is included in the normal form of +packaging a Major Component, but which is not part of that Major +Component, and (b) serves only to enable use of the work with that +Major Component, or to implement a Standard Interface for which an +implementation is available to the public in source code form. A +"Major Component", in this context, means a major essential component +(kernel, window system, and so on) of the specific operating system +(if any) on which the executable work runs, or a compiler used to +produce the work, or an object code interpreter used to run it. + + The "Corresponding Source" for a work in object code form means all +the source code needed to generate, install, and (for an executable +work) run the object code and to modify the work, including scripts to +control those activities. However, it does not include the work's +System Libraries, or general-purpose tools or generally available free +programs which are used unmodified in performing those activities but +which are not part of the work. For example, Corresponding Source +includes interface definition files associated with source files for +the work, and the source code for shared libraries and dynamically +linked subprograms that the work is specifically designed to require, +such as by intimate data communication or control flow between those +subprograms and other parts of the work. + + The Corresponding Source need not include anything that users +can regenerate automatically from other parts of the Corresponding +Source. + + The Corresponding Source for a work in source code form is that +same work. + + 2. Basic Permissions. + + All rights granted under this License are granted for the term of +copyright on the Program, and are irrevocable provided the stated +conditions are met. This License explicitly affirms your unlimited +permission to run the unmodified Program. The output from running a +covered work is covered by this License only if the output, given its +content, constitutes a covered work. This License acknowledges your +rights of fair use or other equivalent, as provided by copyright law. + + You may make, run and propagate covered works that you do not +convey, without conditions so long as your license otherwise remains +in force. You may convey covered works to others for the sole purpose +of having them make modifications exclusively for you, or provide you +with facilities for running those works, provided that you comply with +the terms of this License in conveying all material for which you do +not control copyright. Those thus making or running the covered works +for you must do so exclusively on your behalf, under your direction +and control, on terms that prohibit them from making any copies of +your copyrighted material outside their relationship with you. + + Conveying under any other circumstances is permitted solely under +the conditions stated below. Sublicensing is not allowed; section 10 +makes it unnecessary. + + 3. Protecting Users' Legal Rights From Anti-Circumvention Law. + + No covered work shall be deemed part of an effective technological +measure under any applicable law fulfilling obligations under article +11 of the WIPO copyright treaty adopted on 20 December 1996, or +similar laws prohibiting or restricting circumvention of such +measures. + + When you convey a covered work, you waive any legal power to forbid +circumvention of technological measures to the extent such circumvention +is effected by exercising rights under this License with respect to +the covered work, and you disclaim any intention to limit operation or +modification of the work as a means of enforcing, against the work's +users, your or third parties' legal rights to forbid circumvention of +technological measures. + + 4. Conveying Verbatim Copies. + + You may convey verbatim copies of the Program's source code as you +receive it, in any medium, provided that you conspicuously and +appropriately publish on each copy an appropriate copyright notice; +keep intact all notices stating that this License and any +non-permissive terms added in accord with section 7 apply to the code; +keep intact all notices of the absence of any warranty; and give all +recipients a copy of this License along with the Program. + + You may charge any price or no price for each copy that you convey, +and you may offer support or warranty protection for a fee. + + 5. Conveying Modified Source Versions. + + You may convey a work based on the Program, or the modifications to +produce it from the Program, in the form of source code under the +terms of section 4, provided that you also meet all of these conditions: + + a) The work must carry prominent notices stating that you modified + it, and giving a relevant date. + + b) The work must carry prominent notices stating that it is + released under this License and any conditions added under section + 7. This requirement modifies the requirement in section 4 to + "keep intact all notices". + + c) You must license the entire work, as a whole, under this + License to anyone who comes into possession of a copy. This + License will therefore apply, along with any applicable section 7 + additional terms, to the whole of the work, and all its parts, + regardless of how they are packaged. This License gives no + permission to license the work in any other way, but it does not + invalidate such permission if you have separately received it. + + d) If the work has interactive user interfaces, each must display + Appropriate Legal Notices; however, if the Program has interactive + interfaces that do not display Appropriate Legal Notices, your + work need not make them do so. + + A compilation of a covered work with other separate and independent +works, which are not by their nature extensions of the covered work, +and which are not combined with it such as to form a larger program, +in or on a volume of a storage or distribution medium, is called an +"aggregate" if the compilation and its resulting copyright are not +used to limit the access or legal rights of the compilation's users +beyond what the individual works permit. Inclusion of a covered work +in an aggregate does not cause this License to apply to the other +parts of the aggregate. + + 6. Conveying Non-Source Forms. + + You may convey a covered work in object code form under the terms +of sections 4 and 5, provided that you also convey the +machine-readable Corresponding Source under the terms of this License, +in one of these ways: + + a) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by the + Corresponding Source fixed on a durable physical medium + customarily used for software interchange. + + b) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by a + written offer, valid for at least three years and valid for as + long as you offer spare parts or customer support for that product + model, to give anyone who possesses the object code either (1) a + copy of the Corresponding Source for all the software in the + product that is covered by this License, on a durable physical + medium customarily used for software interchange, for a price no + more than your reasonable cost of physically performing this + conveying of source, or (2) access to copy the + Corresponding Source from a network server at no charge. + + c) Convey individual copies of the object code with a copy of the + written offer to provide the Corresponding Source. This + alternative is allowed only occasionally and noncommercially, and + only if you received the object code with such an offer, in accord + with subsection 6b. + + d) Convey the object code by offering access from a designated + place (gratis or for a charge), and offer equivalent access to the + Corresponding Source in the same way through the same place at no + further charge. You need not require recipients to copy the + Corresponding Source along with the object code. If the place to + copy the object code is a network server, the Corresponding Source + may be on a different server (operated by you or a third party) + that supports equivalent copying facilities, provided you maintain + clear directions next to the object code saying where to find the + Corresponding Source. Regardless of what server hosts the + Corresponding Source, you remain obligated to ensure that it is + available for as long as needed to satisfy these requirements. + + e) Convey the object code using peer-to-peer transmission, provided + you inform other peers where the object code and Corresponding + Source of the work are being offered to the general public at no + charge under subsection 6d. + + A separable portion of the object code, whose source code is excluded +from the Corresponding Source as a System Library, need not be +included in conveying the object code work. + + A "User Product" is either (1) a "consumer product", which means any +tangible personal property which is normally used for personal, family, +or household purposes, or (2) anything designed or sold for incorporation +into a dwelling. In determining whether a product is a consumer product, +doubtful cases shall be resolved in favor of coverage. For a particular +product received by a particular user, "normally used" refers to a +typical or common use of that class of product, regardless of the status +of the particular user or of the way in which the particular user +actually uses, or expects or is expected to use, the product. A product +is a consumer product regardless of whether the product has substantial +commercial, industrial or non-consumer uses, unless such uses represent +the only significant mode of use of the product. + + "Installation Information" for a User Product means any methods, +procedures, authorization keys, or other information required to install +and execute modified versions of a covered work in that User Product from +a modified version of its Corresponding Source. The information must +suffice to ensure that the continued functioning of the modified object +code is in no case prevented or interfered with solely because +modification has been made. + + If you convey an object code work under this section in, or with, or +specifically for use in, a User Product, and the conveying occurs as +part of a transaction in which the right of possession and use of the +User Product is transferred to the recipient in perpetuity or for a +fixed term (regardless of how the transaction is characterized), the +Corresponding Source conveyed under this section must be accompanied +by the Installation Information. But this requirement does not apply +if neither you nor any third party retains the ability to install +modified object code on the User Product (for example, the work has +been installed in ROM). + + The requirement to provide Installation Information does not include a +requirement to continue to provide support service, warranty, or updates +for a work that has been modified or installed by the recipient, or for +the User Product in which it has been modified or installed. Access to a +network may be denied when the modification itself materially and +adversely affects the operation of the network or violates the rules and +protocols for communication across the network. + + Corresponding Source conveyed, and Installation Information provided, +in accord with this section must be in a format that is publicly +documented (and with an implementation available to the public in +source code form), and must require no special password or key for +unpacking, reading or copying. + + 7. Additional Terms. + + "Additional permissions" are terms that supplement the terms of this +License by making exceptions from one or more of its conditions. +Additional permissions that are applicable to the entire Program shall +be treated as though they were included in this License, to the extent +that they are valid under applicable law. If additional permissions +apply only to part of the Program, that part may be used separately +under those permissions, but the entire Program remains governed by +this License without regard to the additional permissions. + + When you convey a copy of a covered work, you may at your option +remove any additional permissions from that copy, or from any part of +it. (Additional permissions may be written to require their own +removal in certain cases when you modify the work.) You may place +additional permissions on material, added by you to a covered work, +for which you have or can give appropriate copyright permission. + + Notwithstanding any other provision of this License, for material you +add to a covered work, you may (if authorized by the copyright holders of +that material) supplement the terms of this License with terms: + + a) Disclaiming warranty or limiting liability differently from the + terms of sections 15 and 16 of this License; or + + b) Requiring preservation of specified reasonable legal notices or + author attributions in that material or in the Appropriate Legal + Notices displayed by works containing it; or + + c) Prohibiting misrepresentation of the origin of that material, or + requiring that modified versions of such material be marked in + reasonable ways as different from the original version; or + + d) Limiting the use for publicity purposes of names of licensors or + authors of the material; or + + e) Declining to grant rights under trademark law for use of some + trade names, trademarks, or service marks; or + + f) Requiring indemnification of licensors and authors of that + material by anyone who conveys the material (or modified versions of + it) with contractual assumptions of liability to the recipient, for + any liability that these contractual assumptions directly impose on + those licensors and authors. + + All other non-permissive additional terms are considered "further +restrictions" within the meaning of section 10. If the Program as you +received it, or any part of it, contains a notice stating that it is +governed by this License along with a term that is a further +restriction, you may remove that term. If a license document contains +a further restriction but permits relicensing or conveying under this +License, you may add to a covered work material governed by the terms +of that license document, provided that the further restriction does +not survive such relicensing or conveying. + + If you add terms to a covered work in accord with this section, you +must place, in the relevant source files, a statement of the +additional terms that apply to those files, or a notice indicating +where to find the applicable terms. + + Additional terms, permissive or non-permissive, may be stated in the +form of a separately written license, or stated as exceptions; +the above requirements apply either way. + + 8. Termination. + + You may not propagate or modify a covered work except as expressly +provided under this License. Any attempt otherwise to propagate or +modify it is void, and will automatically terminate your rights under +this License (including any patent licenses granted under the third +paragraph of section 11). + + However, if you cease all violation of this License, then your +license from a particular copyright holder is reinstated (a) +provisionally, unless and until the copyright holder explicitly and +finally terminates your license, and (b) permanently, if the copyright +holder fails to notify you of the violation by some reasonable means +prior to 60 days after the cessation. + + Moreover, your license from a particular copyright holder is +reinstated permanently if the copyright holder notifies you of the +violation by some reasonable means, this is the first time you have +received notice of violation of this License (for any work) from that +copyright holder, and you cure the violation prior to 30 days after +your receipt of the notice. + + Termination of your rights under this section does not terminate the +licenses of parties who have received copies or rights from you under +this License. If your rights have been terminated and not permanently +reinstated, you do not qualify to receive new licenses for the same +material under section 10. + + 9. Acceptance Not Required for Having Copies. + + You are not required to accept this License in order to receive or +run a copy of the Program. Ancillary propagation of a covered work +occurring solely as a consequence of using peer-to-peer transmission +to receive a copy likewise does not require acceptance. However, +nothing other than this License grants you permission to propagate or +modify any covered work. These actions infringe copyright if you do +not accept this License. Therefore, by modifying or propagating a +covered work, you indicate your acceptance of this License to do so. + + 10. Automatic Licensing of Downstream Recipients. + + Each time you convey a covered work, the recipient automatically +receives a license from the original licensors, to run, modify and +propagate that work, subject to this License. You are not responsible +for enforcing compliance by third parties with this License. + + An "entity transaction" is a transaction transferring control of an +organization, or substantially all assets of one, or subdividing an +organization, or merging organizations. If propagation of a covered +work results from an entity transaction, each party to that +transaction who receives a copy of the work also receives whatever +licenses to the work the party's predecessor in interest had or could +give under the previous paragraph, plus a right to possession of the +Corresponding Source of the work from the predecessor in interest, if +the predecessor has it or can get it with reasonable efforts. + + You may not impose any further restrictions on the exercise of the +rights granted or affirmed under this License. For example, you may +not impose a license fee, royalty, or other charge for exercise of +rights granted under this License, and you may not initiate litigation +(including a cross-claim or counterclaim in a lawsuit) alleging that +any patent claim is infringed by making, using, selling, offering for +sale, or importing the Program or any portion of it. + + 11. Patents. + + A "contributor" is a copyright holder who authorizes use under this +License of the Program or a work on which the Program is based. The +work thus licensed is called the contributor's "contributor version". + + A contributor's "essential patent claims" are all patent claims +owned or controlled by the contributor, whether already acquired or +hereafter acquired, that would be infringed by some manner, permitted +by this License, of making, using, or selling its contributor version, +but do not include claims that would be infringed only as a +consequence of further modification of the contributor version. For +purposes of this definition, "control" includes the right to grant +patent sublicenses in a manner consistent with the requirements of +this License. + + Each contributor grants you a non-exclusive, worldwide, royalty-free +patent license under the contributor's essential patent claims, to +make, use, sell, offer for sale, import and otherwise run, modify and +propagate the contents of its contributor version. + + In the following three paragraphs, a "patent license" is any express +agreement or commitment, however denominated, not to enforce a patent +(such as an express permission to practice a patent or covenant not to +sue for patent infringement). To "grant" such a patent license to a +party means to make such an agreement or commitment not to enforce a +patent against the party. + + If you convey a covered work, knowingly relying on a patent license, +and the Corresponding Source of the work is not available for anyone +to copy, free of charge and under the terms of this License, through a +publicly available network server or other readily accessible means, +then you must either (1) cause the Corresponding Source to be so +available, or (2) arrange to deprive yourself of the benefit of the +patent license for this particular work, or (3) arrange, in a manner +consistent with the requirements of this License, to extend the patent +license to downstream recipients. "Knowingly relying" means you have +actual knowledge that, but for the patent license, your conveying the +covered work in a country, or your recipient's use of the covered work +in a country, would infringe one or more identifiable patents in that +country that you have reason to believe are valid. + + If, pursuant to or in connection with a single transaction or +arrangement, you convey, or propagate by procuring conveyance of, a +covered work, and grant a patent license to some of the parties +receiving the covered work authorizing them to use, propagate, modify +or convey a specific copy of the covered work, then the patent license +you grant is automatically extended to all recipients of the covered +work and works based on it. + + A patent license is "discriminatory" if it does not include within +the scope of its coverage, prohibits the exercise of, or is +conditioned on the non-exercise of one or more of the rights that are +specifically granted under this License. You may not convey a covered +work if you are a party to an arrangement with a third party that is +in the business of distributing software, under which you make payment +to the third party based on the extent of your activity of conveying +the work, and under which the third party grants, to any of the +parties who would receive the covered work from you, a discriminatory +patent license (a) in connection with copies of the covered work +conveyed by you (or copies made from those copies), or (b) primarily +for and in connection with specific products or compilations that +contain the covered work, unless you entered into that arrangement, +or that patent license was granted, prior to 28 March 2007. + + Nothing in this License shall be construed as excluding or limiting +any implied license or other defenses to infringement that may +otherwise be available to you under applicable patent law. + + 12. No Surrender of Others' Freedom. + + If conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot convey a +covered work so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you may +not convey it at all. For example, if you agree to terms that obligate you +to collect a royalty for further conveying from those to whom you convey +the Program, the only way you could satisfy both those terms and this +License would be to refrain entirely from conveying the Program. + + 13. Use with the GNU Affero General Public License. + + Notwithstanding any other provision of this License, you have +permission to link or combine any covered work with a work licensed +under version 3 of the GNU Affero General Public License into a single +combined work, and to convey the resulting work. The terms of this +License will continue to apply to the part which is the covered work, +but the special requirements of the GNU Affero General Public License, +section 13, concerning interaction through a network will apply to the +combination as such. + + 14. Revised Versions of this License. + + The Free Software Foundation may publish revised and/or new versions of +the GNU General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + + Each version is given a distinguishing version number. If the +Program specifies that a certain numbered version of the GNU General +Public License "or any later version" applies to it, you have the +option of following the terms and conditions either of that numbered +version or of any later version published by the Free Software +Foundation. If the Program does not specify a version number of the +GNU General Public License, you may choose any version ever published +by the Free Software Foundation. + + If the Program specifies that a proxy can decide which future +versions of the GNU General Public License can be used, that proxy's +public statement of acceptance of a version permanently authorizes you +to choose that version for the Program. + + Later license versions may give you additional or different +permissions. However, no additional obligations are imposed on any +author or copyright holder as a result of your choosing to follow a +later version. + + 15. Disclaimer of Warranty. + + THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY +APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT +HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY +OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, +THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM +IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF +ALL NECESSARY SERVICING, REPAIR OR CORRECTION. + + 16. Limitation of Liability. + + IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS +THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY +GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE +USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF +DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD +PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), +EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF +SUCH DAMAGES. + + 17. Interpretation of Sections 15 and 16. + + If the disclaimer of warranty and limitation of liability provided +above cannot be given local legal effect according to their terms, +reviewing courts shall apply local law that most closely approximates +an absolute waiver of all civil liability in connection with the +Program, unless a warranty or assumption of liability accompanies a +copy of the Program in return for a fee. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Programs + + If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + + To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +state the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + + Copyright (C) + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . + +Also add information on how to contact you by electronic and paper mail. + + If the program does terminal interaction, make it output a short +notice like this when it starts in an interactive mode: + + Copyright (C) + This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. + This is free software, and you are welcome to redistribute it + under certain conditions; type `show c' for details. + +The hypothetical commands `show w' and `show c' should show the appropriate +parts of the General Public License. Of course, your program's commands +might be different; for a GUI interface, you would use an "about box". + + You should also get your employer (if you work as a programmer) or school, +if any, to sign a "copyright disclaimer" for the program, if necessary. +For more information on this, and how to apply and follow the GNU GPL, see +. + + The GNU General Public License does not permit incorporating your program +into proprietary programs. If your program is a subroutine library, you +may consider it more useful to permit linking proprietary applications with +the library. If this is what you want to do, use the GNU Lesser General +Public License instead of this License. But first, please read +. From d335564c4fd7d44021a46ca5576089890ea9b5e7 Mon Sep 17 00:00:00 2001 From: luokai Date: Wed, 13 Jul 2022 00:00:11 +0800 Subject: [PATCH 0323/1278] =?UTF-8?q?=E5=BC=82=E6=AD=A5=E5=8A=A0=E8=BD=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .tasks.json | 2 +- lua/kide/core/layz_load.lua | 42 ++++++++++++++++++ lua/kide/plugins/init.lua | 86 ++++++++++++++++++++++++++++--------- 3 files changed, 108 insertions(+), 22 deletions(-) create mode 100644 lua/kide/core/layz_load.lua diff --git a/.tasks.json b/.tasks.json index 8031ce41..2a9200db 100644 --- a/.tasks.json +++ b/.tasks.json @@ -2,7 +2,7 @@ "tasks": [ { "name": "fmt", - "cmd": "stylua --config-path ./stylua.toml **/*.lua" + "cmd": "stylua --config-path ./stylua.toml lua/**/*.lua ftplugin/*.lua init.lua" } ] } diff --git a/lua/kide/core/layz_load.lua b/lua/kide/core/layz_load.lua new file mode 100644 index 00000000..ba226562 --- /dev/null +++ b/lua/kide/core/layz_load.lua @@ -0,0 +1,42 @@ +local M = {} +local autocmd = vim.api.nvim_create_autocmd + +M.lazy_load = function(tb) + autocmd(tb.events, { + pattern = "*", + group = vim.api.nvim_create_augroup(tb.augroup_name, {}), + callback = function() + if tb.condition() then + vim.api.nvim_del_augroup_by_name(tb.augroup_name) + + -- dont defer for treesitter as it will show slow highlighting + -- This deferring only happens only when we do "nvim filename" + if tb.plugins ~= "nvim-treesitter" then + vim.defer_fn(function() + vim.cmd("PackerLoad " .. tb.plugins) + end, 0) + else + vim.cmd("PackerLoad " .. tb.plugins) + end + end + end, + }) +end + +-- load certain plugins only when there's a file opened in the buffer +-- if "nvim filename" is executed -> load the plugin after nvim gui loads +-- This gives an instant preview of nvim with the file opened + +M.on_file_open = function(plugin_name) + M.lazy_load({ + events = { "BufRead", "BufWinEnter", "BufNewFile" }, + augroup_name = "BeLazyOnFileOpen" .. plugin_name, + plugins = plugin_name, + condition = function() + local file = vim.fn.expand("%") + return file ~= "NvimTree_1" and file ~= "[packer]" and file ~= "[Scratch]" and file ~= "" + end, + }) +end + +return M diff --git a/lua/kide/plugins/init.lua b/lua/kide/plugins/init.lua index 8ae012db..1baf4c09 100644 --- a/lua/kide/plugins/init.lua +++ b/lua/kide/plugins/init.lua @@ -1,4 +1,5 @@ local bootstrap = require("packer_bootstrap") +vim.cmd("packadd packer.nvim") require("packer").startup({ function(use) -- Packer can manage itself @@ -119,7 +120,13 @@ require("packer").startup({ }) -- 多光标插件 - use("mg979/vim-visual-multi") + use({ + "mg979/vim-visual-multi", + opt = true, + setup = function() + require("kide.core.layz_load").on_file_open("vim-visual-multi") + end, + }) -- 状态栏插件 -- use 'feline-nvim/feline.nvim' @@ -131,7 +138,13 @@ require("packer").startup({ use("lukas-reineke/indent-blankline.nvim") -- <>()等匹配插件 - use("andymass/vim-matchup") + use({ + "andymass/vim-matchup", + opt = true, + setup = function() + require("kide.core.layz_load").on_file_open("vim-matchup") + end, + }) -- 大纲插件 -- use 'liuchengxu/vista.vim' use("simrat39/symbols-outline.nvim") @@ -153,9 +166,22 @@ require("packer").startup({ }) -- mackdown 预览插件 - use({ "iamcco/markdown-preview.nvim", run = "cd app && yarn install" }) + use({ + "iamcco/markdown-preview.nvim", + opt = true, + ft = "markdown", + run = "cd app && yarn install", + config = function() + require("kide.plugins.config.markdown-preview") + end, + }) -- mackdown cli 预览插件 - use({ "ellisonleao/glow.nvim", branch = "main" }) + use({ + "ellisonleao/glow.nvim", + opt = true, + ft = "markdown", + branch = "main", + }) -- 格式化插件 -> 使用 null-ls -- use 'mhartington/formatter.nvim' @@ -201,10 +227,23 @@ require("packer").startup({ use("uga-rosa/translate.nvim") -- 自动对齐插件 - use("junegunn/vim-easy-align") + use({ + "junegunn/vim-easy-align", + + opt = true, + setup = function() + require("kide.core.layz_load").on_file_open("vim-easy-align") + end, + }) -- 表格模式插件 - use("dhruvasagar/vim-table-mode") + use({ + "dhruvasagar/vim-table-mode", + opt = true, + setup = function() + require("kide.core.layz_load").on_file_open("vim-table-mode") + end, + }) -- () 自动补全 use("windwp/nvim-autopairs") @@ -219,9 +258,23 @@ require("packer").startup({ use({ "NTBBloodbath/rest.nvim", + ft = "http", + opt = true, requires = { "nvim-lua/plenary.nvim", }, + config = function() + vim.cmd([[ + function! s:http_rest_init() abort + lua require('kide.plugins.config.rest-nvim') + lua require('kide.core.keybindings').rest_nvim() + endfunction + augroup http_rest + autocmd! + autocmd FileType http call s:http_rest_init() + augroup end + ]]) + end, }) -- 选中高亮插件 @@ -230,9 +283,12 @@ require("packer").startup({ -- 快速跳转 use({ "phaazon/hop.nvim", - branch = "v1", -- optional but strongly recommended + opt = true, + branch = "v1", + setup = function() + require("kide.core.layz_load").on_file_open("hop.nvim") + end, config = function() - -- you can configure Hop the way you like here; see :h hop-config require("hop").setup({ keys = "etovxqpdygfblzhckisuran" }) end, }) @@ -283,6 +339,7 @@ require("packer").startup({ }) require("kide.plugins.config.gruvbox") +require("kide.plugins.config.nvim-treesitter") require("kide.plugins.config.bufferline") require("kide.plugins.config.indent-blankline") -- require('plugins/config/dashboard-nvim') @@ -294,8 +351,6 @@ require("kide.plugins.config.symbols-outline") require("kide.plugins.config.vim-dadbod") -- 异步加载 vim.defer_fn(function() - require("kide.plugins.config.nvim-treesitter") - require("kide.plugins.config.luasnip") require("kide.plugins.config.nvim-cmp") -- require('plugins/config/LeaderF') @@ -319,23 +374,12 @@ vim.defer_fn(function() require("kide.plugins.config.nvim-autopairs") -- require('plugins/config/lsp_signature') require("kide.plugins.config.nvim-dap") - require("kide.plugins.config.markdown-preview") require("kide.plugins.config.translate") -- require('plugins/config/autosave') -- require('plugins/config/nvim-neorg') require("kide.plugins.config.null-ls") require("kide.plugins.config.diffview-nvim") require("kide.plugins.config.neogit") - vim.cmd([[ -function! s:http_rest_init() abort - lua require('kide.plugins/config/rest-nvim') - lua require('kide.core.keybindings').rest_nvim() -endfunction -augroup http_rest - autocmd! - autocmd FileType http call s:http_rest_init() -augroup end -]]) require("kide.core.keybindings").setup() end, 0) From 997af1e32d24059e06dd6b0933798dbf7816166b Mon Sep 17 00:00:00 2001 From: luokai Date: Wed, 13 Jul 2022 00:06:46 +0800 Subject: [PATCH 0324/1278] =?UTF-8?q?jdtls=20=E5=BC=82=E6=AD=A5=E5=8A=A0?= =?UTF-8?q?=E8=BD=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lua/kide/lsp/init.lua | 6 ------ lua/kide/plugins/init.lua | 17 ++++++++++++++++- 2 files changed, 16 insertions(+), 7 deletions(-) diff --git a/lua/kide/lsp/init.lua b/lua/kide/lsp/init.lua index 7cdd45b7..d758c394 100644 --- a/lua/kide/lsp/init.lua +++ b/lua/kide/lsp/init.lua @@ -100,9 +100,3 @@ vim.lsp.handlers["textDocument/signatureHelp"] = vim.lsp.with(vim.lsp.handlers.s -- vim.api.nvim_echo({ { msg } }, true, {}) -- end -- end -vim.cmd([[ -augroup jdtls_lsp - autocmd! - autocmd FileType java lua require"kide.lsp.java".setup() -augroup end -]]) diff --git a/lua/kide/plugins/init.lua b/lua/kide/plugins/init.lua index 1baf4c09..03a074d4 100644 --- a/lua/kide/plugins/init.lua +++ b/lua/kide/plugins/init.lua @@ -73,7 +73,22 @@ require("packer").startup({ use("nvim-treesitter/nvim-treesitter-textobjects") -- java - use("mfussenegger/nvim-jdtls") + use({ + "mfussenegger/nvim-jdtls", + opt = true, + ft = "java", + setup = function() + require("kide.core.layz_load").on_file_open("nvim-jdtls") + end, + config = function() + vim.cmd([[ + augroup jdtls_lsp + autocmd! + autocmd FileType java lua require"kide.lsp.java".setup() + augroup end + ]]) + end, + }) -- use 'NiYanhhhhh/lighttree-java' -- debug From 88110937030a78d6acc14913f8a205aeca808328 Mon Sep 17 00:00:00 2001 From: luokai Date: Wed, 13 Jul 2022 00:15:24 +0800 Subject: [PATCH 0325/1278] =?UTF-8?q?=E5=BC=82=E6=AD=A5=E5=8A=A0=E8=BD=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lua/kide/plugins/init.lua | 21 +++++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-) diff --git a/lua/kide/plugins/init.lua b/lua/kide/plugins/init.lua index 03a074d4..2bed5189 100644 --- a/lua/kide/plugins/init.lua +++ b/lua/kide/plugins/init.lua @@ -47,7 +47,13 @@ require("packer").startup({ use({ "jose-elias-alvarez/null-ls.nvim", - config = function() end, + opt = true, + setup = function() + require("kide.core.layz_load").on_file_open("null-ls.nvim") + end, + config = function() + require("kide.plugins.config.null-ls") + end, requires = { "nvim-lua/plenary.nvim" }, }) @@ -150,7 +156,16 @@ require("packer").startup({ }) -- blankline - use("lukas-reineke/indent-blankline.nvim") + use({ + "lukas-reineke/indent-blankline.nvim", + opt = true, + setup = function() + require("kide.core.layz_load").on_file_open("indent-blankline.nvim") + end, + function() + require("kide.plugins.config.indent-blankline") + end, + }) -- <>()等匹配插件 use({ @@ -356,7 +371,6 @@ require("packer").startup({ require("kide.plugins.config.gruvbox") require("kide.plugins.config.nvim-treesitter") require("kide.plugins.config.bufferline") -require("kide.plugins.config.indent-blankline") -- require('plugins/config/dashboard-nvim') require("kide.plugins.config.alpha-nvim") require("kide.plugins.config.lualine") @@ -392,7 +406,6 @@ vim.defer_fn(function() require("kide.plugins.config.translate") -- require('plugins/config/autosave') -- require('plugins/config/nvim-neorg') - require("kide.plugins.config.null-ls") require("kide.plugins.config.diffview-nvim") require("kide.plugins.config.neogit") From 4f6740224e0bf59e85c21d09c72d469d08a9c2a1 Mon Sep 17 00:00:00 2001 From: luokai Date: Wed, 13 Jul 2022 00:26:48 +0800 Subject: [PATCH 0326/1278] update --- lua/kide/plugins/init.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lua/kide/plugins/init.lua b/lua/kide/plugins/init.lua index 2bed5189..b5755576 100644 --- a/lua/kide/plugins/init.lua +++ b/lua/kide/plugins/init.lua @@ -162,7 +162,7 @@ require("packer").startup({ setup = function() require("kide.core.layz_load").on_file_open("indent-blankline.nvim") end, - function() + config = function() require("kide.plugins.config.indent-blankline") end, }) From bdaddf24dfbc4dbef7165bb4dfe0254fb4ffb405 Mon Sep 17 00:00:00 2001 From: luokai Date: Wed, 13 Jul 2022 00:39:18 +0800 Subject: [PATCH 0327/1278] config --- lua/kide/core/basic.lua | 1 + lua/kide/plugins/config/indent-blankline.lua | 5 ++++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/lua/kide/core/basic.lua b/lua/kide/core/basic.lua index 0942236f..d80e27d4 100644 --- a/lua/kide/core/basic.lua +++ b/lua/kide/core/basic.lua @@ -85,6 +85,7 @@ vim.opt.confirm = true -- vim.g.python_host_prog='/opt/homebrew/bin/python3' vim.g.python3_host_prog = "/opt/homebrew/bin/python3" +vim.opt.list = true vim.cmd([[ " 始终显示符号列 set signcolumn=yes diff --git a/lua/kide/plugins/config/indent-blankline.lua b/lua/kide/plugins/config/indent-blankline.lua index cd0b1e5d..e451f744 100644 --- a/lua/kide/plugins/config/indent-blankline.lua +++ b/lua/kide/plugins/config/indent-blankline.lua @@ -1,4 +1,3 @@ -vim.opt.list = true -- vim.opt.listchars:append("space:⋅") -- vim.opt.listchars:append("eol:↴") @@ -16,10 +15,14 @@ require("indent_blankline").setup({ "markdown", "git", "text", + "txt", "NvimTree", "dashboard", "alpha", "Outline", + "TelescopePrompt", + "TelescopeResults", + "" }, buftype_exclude = { "terminal" }, use_treesitter = true, From 9492051324f4db73fc12e3d67bed1fe3cf2decc1 Mon Sep 17 00:00:00 2001 From: luokai Date: Wed, 13 Jul 2022 09:30:06 +0800 Subject: [PATCH 0328/1278] settings key --- lua/kide/plugins/config/alpha-nvim.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lua/kide/plugins/config/alpha-nvim.lua b/lua/kide/plugins/config/alpha-nvim.lua index b5182aed..1f137008 100644 --- a/lua/kide/plugins/config/alpha-nvim.lua +++ b/lua/kide/plugins/config/alpha-nvim.lua @@ -22,7 +22,7 @@ dashboard.section.buttons.val = { dashboard.button(" fg", " Find Word ", ":Telescope live_grep", opt), dashboard.button(" fp", " Recent Projects", ":Telescope projects", opt), dashboard.button(" fo", " Recent File", ":Telescope oldfiles", opt), - dashboard.button(" es", " Settings", ":e $MYVIMRC | :cd %:p:h ", opt), + dashboard.button(" ns", " Settings", ":e $MYVIMRC | :cd %:p:h ", opt), dashboard.button(" q ", " Quit NVIM", ":qa", opt), } From 300a54e40f13866b5370bb703072936dca41864f Mon Sep 17 00:00:00 2001 From: luokai Date: Wed, 13 Jul 2022 09:49:23 +0800 Subject: [PATCH 0329/1278] =?UTF-8?q?=E5=BC=82=E6=AD=A5=E5=8A=A0=E8=BD=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lua/kide/plugins/config/lualine.lua | 48 +++++++++++++-------------- lua/kide/plugins/init.lua | 51 ++++++++++++++++++++++++----- 2 files changed, 67 insertions(+), 32 deletions(-) diff --git a/lua/kide/plugins/config/lualine.lua b/lua/kide/plugins/config/lualine.lua index a30853f3..e06c728a 100644 --- a/lua/kide/plugins/config/lualine.lua +++ b/lua/kide/plugins/config/lualine.lua @@ -54,30 +54,30 @@ nvim_tree.filetypes = { table.insert(config.extensions, nvim_tree) -- nvim-sqls extensions -local db_connection_value = "default" -local db_database_value = "default" -require("sqls.events").add_subscriber("connection_choice", function(event) - local cs = vim.split(event.choice, " ") - db_connection_value = cs[3] - local db = vim.split(cs[4], "/") - if db[2] and db_database_value == "default" then - db_database_value = db[2] - end -end) -require("sqls.events").add_subscriber("database_choice", function(event) - db_database_value = event.choice -end) -local function db_info() - return db_connection_value .. "->" .. db_database_value -end - -local sqls = {} -sqls.sections = vim.deepcopy(config.sections) -table.insert(sqls.sections.lualine_c, db_info) -sqls.filetypes = { - "sql", -} -table.insert(config.extensions, sqls) +-- local db_connection_value = "default" +-- local db_database_value = "default" +-- require("sqls.events").add_subscriber("connection_choice", function(event) +-- local cs = vim.split(event.choice, " ") +-- db_connection_value = cs[3] +-- local db = vim.split(cs[4], "/") +-- if db[2] and db_database_value == "default" then +-- db_database_value = db[2] +-- end +-- end) +-- require("sqls.events").add_subscriber("database_choice", function(event) +-- db_database_value = event.choice +-- end) +-- local function db_info() +-- return db_connection_value .. "->" .. db_database_value +-- end +-- +-- local sqls = {} +-- sqls.sections = vim.deepcopy(config.sections) +-- table.insert(sqls.sections.lualine_c, db_info) +-- sqls.filetypes = { +-- "sql", +-- } +-- table.insert(config.extensions, sqls) -- DiffviewFilePanel local diffview = {} diff --git a/lua/kide/plugins/init.lua b/lua/kide/plugins/init.lua index b5755576..d4ba0825 100644 --- a/lua/kide/plugins/init.lua +++ b/lua/kide/plugins/init.lua @@ -189,7 +189,16 @@ require("packer").startup({ use("gelguy/wilder.nvim") -- 颜色显示 - use("norcalli/nvim-colorizer.lua") + use({ + "norcalli/nvim-colorizer.lua", + opt = true, + setup = function() + require("kide.core.layz_load").on_file_open("nvim-colorizer.lua") + end, + config = function() + require("kide.plugins.config.nvim-colorizer") + end, + }) use({ "numToStr/Comment.nvim", @@ -254,12 +263,20 @@ require("packer").startup({ -- 翻译插件 -- use 'voldikss/vim-translator' - use("uga-rosa/translate.nvim") + use({ + "uga-rosa/translate.nvim", + opt = true, + setup = function() + require("kide.core.layz_load").on_file_open("translate.nvim") + end, + config = function() + require("kide.plugins.config.translate") + end, + }) -- 自动对齐插件 use({ "junegunn/vim-easy-align", - opt = true, setup = function() require("kide.core.layz_load").on_file_open("vim-easy-align") @@ -334,18 +351,38 @@ require("packer").startup({ -- 查找替换 use({ "windwp/nvim-spectre", + opt = true, + setup = function() + require("kide.core.layz_load").on_file_open("nvim-spectre") + end, config = function() require("spectre").setup() end, }) -- ASCII 图 - use("jbyuki/venn.nvim") + use({ + "jbyuki/venn.nvim", + opt = true, + setup = function() + require("kide.core.layz_load").on_file_open("venn.nvim") + end, + }) - use("tversteeg/registers.nvim") + use({ + "tversteeg/registers.nvim", + opt = true, + setup = function() + require("kide.core.layz_load").on_file_open("registers.nvim") + end, + }) -- databases - use("nanotee/sqls.nvim") + use({ + "nanotee/sqls.nvim", + ft = { "sql", "mysql" }, + opt = true, + }) use("tpope/vim-dadbod") use("kristijanhusak/vim-dadbod-ui") @@ -394,7 +431,6 @@ vim.defer_fn(function() -- require("kide.plugins.config.trouble") require("kide.plugins.config.nvim-notify") require("kide.plugins.config.wilder") - require("kide.plugins.config.nvim-colorizer") require("kide.plugins.config.comment") -- require("kide.plugins.config.lspsaga") -- require('plugins/config/formatter') @@ -403,7 +439,6 @@ vim.defer_fn(function() require("kide.plugins.config.nvim-autopairs") -- require('plugins/config/lsp_signature') require("kide.plugins.config.nvim-dap") - require("kide.plugins.config.translate") -- require('plugins/config/autosave') -- require('plugins/config/nvim-neorg') require("kide.plugins.config.diffview-nvim") From 9dd85620a7ddb2163cb1fab58c56506d49cd83c1 Mon Sep 17 00:00:00 2001 From: luokai Date: Wed, 13 Jul 2022 10:42:19 +0800 Subject: [PATCH 0330/1278] fmt --- lua/kide/plugins/config/indent-blankline.lua | 2 +- lua/kide/plugins/config/lualine.lua | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/lua/kide/plugins/config/indent-blankline.lua b/lua/kide/plugins/config/indent-blankline.lua index e451f744..a7f1c78d 100644 --- a/lua/kide/plugins/config/indent-blankline.lua +++ b/lua/kide/plugins/config/indent-blankline.lua @@ -22,7 +22,7 @@ require("indent_blankline").setup({ "Outline", "TelescopePrompt", "TelescopeResults", - "" + "", }, buftype_exclude = { "terminal" }, use_treesitter = true, diff --git a/lua/kide/plugins/config/lualine.lua b/lua/kide/plugins/config/lualine.lua index e06c728a..db3d7eaa 100644 --- a/lua/kide/plugins/config/lualine.lua +++ b/lua/kide/plugins/config/lualine.lua @@ -70,7 +70,7 @@ table.insert(config.extensions, nvim_tree) -- local function db_info() -- return db_connection_value .. "->" .. db_database_value -- end --- +-- -- local sqls = {} -- sqls.sections = vim.deepcopy(config.sections) -- table.insert(sqls.sections.lualine_c, db_info) From 7cddc515c0fcb7568982852afb56d3fbcdb03658 Mon Sep 17 00:00:00 2001 From: luokai Date: Wed, 13 Jul 2022 10:47:13 +0800 Subject: [PATCH 0331/1278] keybindings --- lua/kide/core/keybindings.lua | 108 +++++++++++++++++----------------- 1 file changed, 54 insertions(+), 54 deletions(-) diff --git a/lua/kide/core/keybindings.lua b/lua/kide/core/keybindings.lua index dc789d2d..18e6e316 100644 --- a/lua/kide/core/keybindings.lua +++ b/lua/kide/core/keybindings.lua @@ -130,63 +130,63 @@ nnoremap j nnoremap k nnoremap l ]]) -end --- hop.nvim --- place this in one of your configuration file(s) -map( - "n", - "f", - "lua require'hop'.hint_char1({ direction = require'hop.hint'.HintDirection.AFTER_CURSOR, current_line_only = true })", - opt -) -map( - "v", - "f", - "lua require'hop'.hint_char1({ direction = require'hop.hint'.HintDirection.AFTER_CURSOR, current_line_only = true })", - opt -) -map( - "n", - "F", - "lua require'hop'.hint_char1({ direction = require'hop.hint'.HintDirection.BEFORE_CURSOR, current_line_only = true })", - opt -) -map( - "v", - "F", - "lua require'hop'.hint_char1({ direction = require'hop.hint'.HintDirection.BEFORE_CURSOR, current_line_only = true })", - opt -) -map( - "o", - "f", - "lua require'hop'.hint_char1({ direction = require'hop.hint'.HintDirection.AFTER_CURSOR, current_line_only = true, inclusive_jump = true })", - opt -) -map( - "o", - "F", - "lua require'hop'.hint_char1({ direction = require'hop.hint'.HintDirection.BEFORE_CURSOR, current_line_only = true, inclusive_jump = true })", - opt -) --- map('', 't', "lua require'hop'.hint_char1({ direction = require'hop.hint'.HintDirection.AFTER_CURSOR, current_line_only = true })", opt) --- map('', 'T', "lua require'hop'.hint_char1({ direction = require'hop.hint'.HintDirection.BEFORE_CURSOR, current_line_only = true })", opt) --- map('n', 'e', " lua require'hop'.hint_words({ hint_position = require'hop.hint'.HintPosition.END })", opt) --- map('v', 'e', " lua require'hop'.hint_words({ hint_position = require'hop.hint'.HintPosition.END })", opt) --- map('o', 'e', " lua require'hop'.hint_words({ hint_position = require'hop.hint'.HintPosition.END, inclusive_jump = true })", opt) + -- hop.nvim + -- place this in one of your configuration file(s) + map( + "n", + "f", + "lua require'hop'.hint_char1({ direction = require'hop.hint'.HintDirection.AFTER_CURSOR, current_line_only = true })", + opt + ) + map( + "v", + "f", + "lua require'hop'.hint_char1({ direction = require'hop.hint'.HintDirection.AFTER_CURSOR, current_line_only = true })", + opt + ) + map( + "n", + "F", + "lua require'hop'.hint_char1({ direction = require'hop.hint'.HintDirection.BEFORE_CURSOR, current_line_only = true })", + opt + ) + map( + "v", + "F", + "lua require'hop'.hint_char1({ direction = require'hop.hint'.HintDirection.BEFORE_CURSOR, current_line_only = true })", + opt + ) + map( + "o", + "f", + "lua require'hop'.hint_char1({ direction = require'hop.hint'.HintDirection.AFTER_CURSOR, current_line_only = true, inclusive_jump = true })", + opt + ) + map( + "o", + "F", + "lua require'hop'.hint_char1({ direction = require'hop.hint'.HintDirection.BEFORE_CURSOR, current_line_only = true, inclusive_jump = true })", + opt + ) + -- map('', 't', "lua require'hop'.hint_char1({ direction = require'hop.hint'.HintDirection.AFTER_CURSOR, current_line_only = true })", opt) + -- map('', 'T', "lua require'hop'.hint_char1({ direction = require'hop.hint'.HintDirection.BEFORE_CURSOR, current_line_only = true })", opt) + -- map('n', 'e', " lua require'hop'.hint_words({ hint_position = require'hop.hint'.HintPosition.END })", opt) + -- map('v', 'e', " lua require'hop'.hint_words({ hint_position = require'hop.hint'.HintPosition.END })", opt) + -- map('o', 'e', " lua require'hop'.hint_words({ hint_position = require'hop.hint'.HintPosition.END, inclusive_jump = true })", opt) --- nvim-spectre -map("n", "S", "lua require('spectre').open()", opt) --- search current word -map("n", "fr", "lua require('spectre').open_visual({select_word=true})", opt) -map("v", "fr", "lua require('spectre').open_visual()", opt) --- search in current file --- map("n", "fp", "viw:lua require('spectre').open_file_search()", opt) --- run command :Spectre + -- nvim-spectre + map("n", "S", "lua require('spectre').open()", opt) + -- search current word + map("n", "fr", "lua require('spectre').open_visual({select_word=true})", opt) + map("v", "fr", "lua require('spectre').open_visual()", opt) + -- search in current file + -- map("n", "fp", "viw:lua require('spectre').open_file_search()", opt) + -- run command :Spectre --- ToggleTask -map("n", "ts", "Telescope toggletasks spawn", opt) + -- ToggleTask + map("n", "ts", "Telescope toggletasks spawn", opt) +end -- lsp 回调函数快捷键设置 M.maplsp = function(client, bufnr) vim.api.nvim_buf_set_option(bufnr, "omnifunc", "v:lua.vim.lsp.omnifunc") From ecda406dee223ac40cf40179b074882002d6c131 Mon Sep 17 00:00:00 2001 From: luokai Date: Wed, 13 Jul 2022 12:50:13 +0800 Subject: [PATCH 0332/1278] =?UTF-8?q?=E5=BC=82=E6=AD=A5=E5=8A=A0=E8=BD=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lua/kide/core/keybindings.lua | 90 ++++++++++++++++++----------------- lua/kide/plugins/init.lua | 9 +++- 2 files changed, 54 insertions(+), 45 deletions(-) diff --git a/lua/kide/core/keybindings.lua b/lua/kide/core/keybindings.lua index 18e6e316..e5ec7d18 100644 --- a/lua/kide/core/keybindings.lua +++ b/lua/kide/core/keybindings.lua @@ -131,50 +131,6 @@ nnoremap k nnoremap l ]]) - -- hop.nvim - -- place this in one of your configuration file(s) - map( - "n", - "f", - "lua require'hop'.hint_char1({ direction = require'hop.hint'.HintDirection.AFTER_CURSOR, current_line_only = true })", - opt - ) - map( - "v", - "f", - "lua require'hop'.hint_char1({ direction = require'hop.hint'.HintDirection.AFTER_CURSOR, current_line_only = true })", - opt - ) - map( - "n", - "F", - "lua require'hop'.hint_char1({ direction = require'hop.hint'.HintDirection.BEFORE_CURSOR, current_line_only = true })", - opt - ) - map( - "v", - "F", - "lua require'hop'.hint_char1({ direction = require'hop.hint'.HintDirection.BEFORE_CURSOR, current_line_only = true })", - opt - ) - map( - "o", - "f", - "lua require'hop'.hint_char1({ direction = require'hop.hint'.HintDirection.AFTER_CURSOR, current_line_only = true, inclusive_jump = true })", - opt - ) - map( - "o", - "F", - "lua require'hop'.hint_char1({ direction = require'hop.hint'.HintDirection.BEFORE_CURSOR, current_line_only = true, inclusive_jump = true })", - opt - ) - -- map('', 't', "lua require'hop'.hint_char1({ direction = require'hop.hint'.HintDirection.AFTER_CURSOR, current_line_only = true })", opt) - -- map('', 'T', "lua require'hop'.hint_char1({ direction = require'hop.hint'.HintDirection.BEFORE_CURSOR, current_line_only = true })", opt) - -- map('n', 'e', " lua require'hop'.hint_words({ hint_position = require'hop.hint'.HintPosition.END })", opt) - -- map('v', 'e', " lua require'hop'.hint_words({ hint_position = require'hop.hint'.HintPosition.END })", opt) - -- map('o', 'e', " lua require'hop'.hint_words({ hint_position = require'hop.hint'.HintPosition.END, inclusive_jump = true })", opt) - -- nvim-spectre map("n", "S", "lua require('spectre').open()", opt) -- search current word @@ -326,4 +282,50 @@ command! -buffer HttpLast :lua require'rest-nvim'.last() ]]) end +M.hop_mapkey = function() + -- hop.nvim + -- place this in one of your configuration file(s) + map( + "n", + "f", + "lua require'hop'.hint_char1({ direction = require'hop.hint'.HintDirection.AFTER_CURSOR, current_line_only = true })", + opt + ) + map( + "v", + "f", + "lua require'hop'.hint_char1({ direction = require'hop.hint'.HintDirection.AFTER_CURSOR, current_line_only = true })", + opt + ) + map( + "n", + "F", + "lua require'hop'.hint_char1({ direction = require'hop.hint'.HintDirection.BEFORE_CURSOR, current_line_only = true })", + opt + ) + map( + "v", + "F", + "lua require'hop'.hint_char1({ direction = require'hop.hint'.HintDirection.BEFORE_CURSOR, current_line_only = true })", + opt + ) + map( + "o", + "f", + "lua require'hop'.hint_char1({ direction = require'hop.hint'.HintDirection.AFTER_CURSOR, current_line_only = true, inclusive_jump = true })", + opt + ) + map( + "o", + "F", + "lua require'hop'.hint_char1({ direction = require'hop.hint'.HintDirection.BEFORE_CURSOR, current_line_only = true, inclusive_jump = true })", + opt + ) + -- map('', 't', "lua require'hop'.hint_char1({ direction = require'hop.hint'.HintDirection.AFTER_CURSOR, current_line_only = true })", opt) + -- map('', 'T', "lua require'hop'.hint_char1({ direction = require'hop.hint'.HintDirection.BEFORE_CURSOR, current_line_only = true })", opt) + -- map('n', 'e', " lua require'hop'.hint_words({ hint_position = require'hop.hint'.HintPosition.END })", opt) + -- map('v', 'e', " lua require'hop'.hint_words({ hint_position = require'hop.hint'.HintPosition.END })", opt) + -- map('o', 'e', " lua require'hop'.hint_words({ hint_position = require'hop.hint'.HintPosition.END, inclusive_jump = true })", opt) +end + return M diff --git a/lua/kide/plugins/init.lua b/lua/kide/plugins/init.lua index d4ba0825..79fad1f5 100644 --- a/lua/kide/plugins/init.lua +++ b/lua/kide/plugins/init.lua @@ -202,6 +202,13 @@ require("packer").startup({ use({ "numToStr/Comment.nvim", + opt = true, + setup = function() + require("kide.core.layz_load").on_file_open("Comment.nvim") + end, + config = function() + require("kide.plugins.config.comment") + end, }) -- mackdown 预览插件 @@ -337,6 +344,7 @@ require("packer").startup({ end, config = function() require("hop").setup({ keys = "etovxqpdygfblzhckisuran" }) + require("kide.core.keybindings").hop_mapkey() end, }) @@ -431,7 +439,6 @@ vim.defer_fn(function() -- require("kide.plugins.config.trouble") require("kide.plugins.config.nvim-notify") require("kide.plugins.config.wilder") - require("kide.plugins.config.comment") -- require("kide.plugins.config.lspsaga") -- require('plugins/config/formatter') require("kide.plugins.config.telescope") From de601844c51da655faf3b9c5ec8129e27c86940e Mon Sep 17 00:00:00 2001 From: luokai Date: Wed, 13 Jul 2022 21:40:20 +0800 Subject: [PATCH 0333/1278] =?UTF-8?q?=E5=BC=82=E6=AD=A5=E5=8A=A0=E8=BD=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lua/kide/plugins/init.lua | 40 +++++++++++++++++++++++++++++++-------- 1 file changed, 32 insertions(+), 8 deletions(-) diff --git a/lua/kide/plugins/init.lua b/lua/kide/plugins/init.lua index 79fad1f5..68daf360 100644 --- a/lua/kide/plugins/init.lua +++ b/lua/kide/plugins/init.lua @@ -103,9 +103,37 @@ require("packer").startup({ use("theHamsta/nvim-dap-virtual-text") -- git - use("tpope/vim-fugitive") - use("sindrets/diffview.nvim") - use({ "TimUntersberger/neogit", requires = "nvim-lua/plenary.nvim" }) + use({ + "tpope/vim-fugitive", + opt = true, + cmd = { "Git" }, + }) + use({ + "sindrets/diffview.nvim", + opt = true, + cmd = { + "DiffviewClose", + "DiffviewFileHistory", + "DiffviewFocusFiles", + "DiffviewLog", + "DiffviewOpen", + "DiffviewRefresh", + "DiffviewToggleFiles", + }, + config = function() + require("kide.plugins.config.diffview-nvim") + end, + }) + use({ + after = "diffview.nvim", + opt = true, + "TimUntersberger/neogit", + cmd = { "Neogit" }, + config = function() + require("kide.plugins.config.neogit") + end, + requires = "nvim-lua/plenary.nvim", + }) -- LeaderF -- use 'Yggdroot/LeaderF' @@ -203,9 +231,7 @@ require("packer").startup({ use({ "numToStr/Comment.nvim", opt = true, - setup = function() - require("kide.core.layz_load").on_file_open("Comment.nvim") - end, + keys = { "gc", "gb" }, config = function() require("kide.plugins.config.comment") end, @@ -448,8 +474,6 @@ vim.defer_fn(function() require("kide.plugins.config.nvim-dap") -- require('plugins/config/autosave') -- require('plugins/config/nvim-neorg') - require("kide.plugins.config.diffview-nvim") - require("kide.plugins.config.neogit") require("kide.core.keybindings").setup() end, 0) From 144a57d8fdd321533e5dbf7817cce6c3b6d09bba Mon Sep 17 00:00:00 2001 From: luokai Date: Wed, 13 Jul 2022 21:56:36 +0800 Subject: [PATCH 0334/1278] =?UTF-8?q?=E5=BC=82=E6=AD=A5=E5=8A=A0=E8=BD=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- init.lua | 1 - lua/kide/plugins/init.lua | 34 +++++++++++++++++++++++++++++++--- 2 files changed, 31 insertions(+), 4 deletions(-) diff --git a/init.lua b/init.lua index 6d239398..cfe66233 100644 --- a/init.lua +++ b/init.lua @@ -8,7 +8,6 @@ end require("kide.core.basic") require("kide.plugins") vim.defer_fn(function() - require("kide.lsp") require("kide.dap") require("kide.core.utils.plantuml").setup() diff --git a/lua/kide/plugins/init.lua b/lua/kide/plugins/init.lua index 68daf360..86304eb5 100644 --- a/lua/kide/plugins/init.lua +++ b/lua/kide/plugins/init.lua @@ -9,7 +9,33 @@ require("packer").startup({ use({ "nathom/filetype.nvim" }) use("kyazdani42/nvim-web-devicons") - use({ "neovim/nvim-lspconfig", "williamboman/nvim-lsp-installer" }) + use({ + "williamboman/nvim-lsp-installer", + cmd = { + "LspInfo", + "LspStart", + "LspRestart", + "LspStop", + "LspInstall", + "LspUnInstall", + "LspUnInstallAll", + "LspInstall", + "LspInstallInfo", + "LspInstallLog", + "LspLog", + "LspPrintInstalled", + }, + setup = function() + require("kide.core.layz_load").on_file_open("nvim-lsp-installer") + end, + }) + use({ + after = "nvim-lsp-installer", + "neovim/nvim-lspconfig", + config = function() + require("kide.lsp") + end, + }) -- nvim-cmp use("hrsh7th/cmp-nvim-lsp") -- { name = nvim_lsp } @@ -98,9 +124,11 @@ require("packer").startup({ -- use 'NiYanhhhhh/lighttree-java' -- debug - use("mfussenegger/nvim-dap") + use({ "mfussenegger/nvim-dap" }) use({ "rcarriga/nvim-dap-ui", requires = { "mfussenegger/nvim-dap" } }) - use("theHamsta/nvim-dap-virtual-text") + use({ + "theHamsta/nvim-dap-virtual-text", + }) -- git use({ From 12034e0ae57a16c747a0f822b3146acccea5b876 Mon Sep 17 00:00:00 2001 From: luokai Date: Wed, 13 Jul 2022 22:44:39 +0800 Subject: [PATCH 0335/1278] =?UTF-8?q?=E5=BC=82=E6=AD=A5=E5=8A=A0=E8=BD=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lua/kide/plugins/init.lua | 87 +++++++++++++++++++++++++++++---------- 1 file changed, 66 insertions(+), 21 deletions(-) diff --git a/lua/kide/plugins/init.lua b/lua/kide/plugins/init.lua index 86304eb5..ddb7024a 100644 --- a/lua/kide/plugins/init.lua +++ b/lua/kide/plugins/init.lua @@ -4,11 +4,17 @@ require("packer").startup({ function(use) -- Packer can manage itself use("wbthomason/packer.nvim") - use({ "nvim-lua/plenary.nvim" }) + use({ + "nvim-lua/plenary.nvim", + module = "plenary", + }) use({ "lewis6991/impatient.nvim" }) use({ "nathom/filetype.nvim" }) - use("kyazdani42/nvim-web-devicons") + use({ + "kyazdani42/nvim-web-devicons", + module = "nvim-web-devicons", + }) use({ "williamboman/nvim-lsp-installer", cmd = { @@ -30,33 +36,63 @@ require("packer").startup({ end, }) use({ - after = "nvim-lsp-installer", "neovim/nvim-lspconfig", + after = "nvim-lsp-installer", + module = "lspconfig", config = function() require("kide.lsp") end, }) + -- 代码片段 + use({ + "rafamadriz/friendly-snippets", + event = "InsertEnter", + }) -- nvim-cmp - use("hrsh7th/cmp-nvim-lsp") -- { name = nvim_lsp } - use("hrsh7th/cmp-buffer") -- { name = 'buffer' }, - use("hrsh7th/cmp-path") -- { name = 'path' } + use({ + "hrsh7th/nvim-cmp", + after = "friendly-snippets", + }) + -- LuaSnip + use({ + "L3MON4D3/LuaSnip", + after = "nvim-cmp", + config = function() + require("kide.plugins.config.luasnip") + end, + }) + use({ + "saadparwaiz1/cmp_luasnip", + after = "LuaSnip", + }) + + use({ + "hrsh7th/cmp-nvim-lsp", + after = "cmp_luasnip", + }) + use({ + "hrsh7th/cmp-buffer", + after = "cmp-nvim-lsp", + }) + use({ + "hrsh7th/cmp-path", + after = "cmp-buffer", + }) + -- lspkind + use({ + "onsails/lspkind-nvim", + after = "cmp-path", + config = function() + require("kide.plugins.config.nvim-cmp") + end, + }) -- use 'hrsh7th/cmp-cmdline' -- { name = 'cmdline' } - use("hrsh7th/nvim-cmp") -- vsnip -- use 'hrsh7th/cmp-vsnip' -- { name = 'vsnip' } -- use 'hrsh7th/vim-vsnip' - -- 代码片段 - use("rafamadriz/friendly-snippets") - -- LuaSnip - use("L3MON4D3/LuaSnip") - use({ "saadparwaiz1/cmp_luasnip" }) - - -- lspkind - use("onsails/lspkind-nvim") - -- lsp 相关 -- use 'folke/lsp-colors.nvim' -- use("folke/trouble.nvim") @@ -139,6 +175,7 @@ require("packer").startup({ use({ "sindrets/diffview.nvim", opt = true, + module = "diffview", cmd = { "DiffviewClose", "DiffviewFileHistory", @@ -302,6 +339,7 @@ require("packer").startup({ -- 搜索插件 use({ "nvim-telescope/telescope.nvim", + module = "telescope", requires = { "nvim-lua/plenary.nvim", }, @@ -354,13 +392,23 @@ require("packer").startup({ }) -- () 自动补全 - use("windwp/nvim-autopairs") + use({ + "windwp/nvim-autopairs", + after = "nvim-cmp", + config = function() + require("kide.plugins.config.nvim-autopairs") + end, + }) -- 任务插件 use("itchyny/calendar.vim") -- rust - use("simrat39/rust-tools.nvim") + use({ + "simrat39/rust-tools.nvim", + opt = true, + module = "rust-tools", + }) -- use "Pocco81/AutoSave.nvim" @@ -479,8 +527,6 @@ require("kide.plugins.config.symbols-outline") require("kide.plugins.config.vim-dadbod") -- 异步加载 vim.defer_fn(function() - require("kide.plugins.config.luasnip") - require("kide.plugins.config.nvim-cmp") -- require('plugins/config/LeaderF') require("kide.plugins.config.gitsigns-nvim") -- require('plugins/config/vim-floaterm') @@ -497,7 +543,6 @@ vim.defer_fn(function() -- require('plugins/config/formatter') require("kide.plugins.config.telescope") -- require('plugins/config/nvim-lsputils') - require("kide.plugins.config.nvim-autopairs") -- require('plugins/config/lsp_signature') require("kide.plugins.config.nvim-dap") -- require('plugins/config/autosave') From 594c162c87973962269dfc37a65b5b3523ebe321 Mon Sep 17 00:00:00 2001 From: luokai Date: Wed, 13 Jul 2022 23:06:20 +0800 Subject: [PATCH 0336/1278] =?UTF-8?q?=E6=8C=89=E9=9C=80=E5=8A=A0=E8=BD=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- init.lua | 2 -- lua/kide/plugins/config/nvim-dap.lua | 1 + lua/kide/plugins/config/telescope.lua | 1 - lua/kide/plugins/init.lua | 16 +++++++++++++--- 4 files changed, 14 insertions(+), 6 deletions(-) diff --git a/init.lua b/init.lua index cfe66233..ca3a4312 100644 --- a/init.lua +++ b/init.lua @@ -8,7 +8,5 @@ end require("kide.core.basic") require("kide.plugins") vim.defer_fn(function() - require("kide.dap") - require("kide.core.utils.plantuml").setup() end, 0) diff --git a/lua/kide/plugins/config/nvim-dap.lua b/lua/kide/plugins/config/nvim-dap.lua index 7a6a59ee..413b4690 100644 --- a/lua/kide/plugins/config/nvim-dap.lua +++ b/lua/kide/plugins/config/nvim-dap.lua @@ -49,3 +49,4 @@ vim.fn.sign_define("DapBreakpoint", { text = "", texthl = "Debug", linehl = " -- vim.fn.sign_define('DapStopped', {text='→', texthl='', linehl='debugPC', numhl=''}) require("nvim-dap-virtual-text").setup() +require("telescope").load_extension("dap") diff --git a/lua/kide/plugins/config/telescope.lua b/lua/kide/plugins/config/telescope.lua index 9d221bfd..261f57b0 100644 --- a/lua/kide/plugins/config/telescope.lua +++ b/lua/kide/plugins/config/telescope.lua @@ -146,7 +146,6 @@ telescope.load_extension("ui-select") -- telescope.load_extension('gradle') -- telescope.load_extension('maven_search') telescope.load_extension("env") -telescope.load_extension("dap") telescope.load_extension("toggletasks") diff --git a/lua/kide/plugins/init.lua b/lua/kide/plugins/init.lua index ddb7024a..a8f8f2b7 100644 --- a/lua/kide/plugins/init.lua +++ b/lua/kide/plugins/init.lua @@ -160,10 +160,21 @@ require("packer").startup({ -- use 'NiYanhhhhh/lighttree-java' -- debug - use({ "mfussenegger/nvim-dap" }) - use({ "rcarriga/nvim-dap-ui", requires = { "mfussenegger/nvim-dap" } }) + use({ + "mfussenegger/nvim-dap", + }) + use({ + "rcarriga/nvim-dap-ui", + after = "nvim-dap", + }) use({ "theHamsta/nvim-dap-virtual-text", + after = "nvim-dap-ui", + module = { "dap", "dapui" }, + config = function() + require("kide.plugins.config.nvim-dap") + require("kide.dap") + end, }) -- git @@ -544,7 +555,6 @@ vim.defer_fn(function() require("kide.plugins.config.telescope") -- require('plugins/config/nvim-lsputils') -- require('plugins/config/lsp_signature') - require("kide.plugins.config.nvim-dap") -- require('plugins/config/autosave') -- require('plugins/config/nvim-neorg') From fb0962c24a0411636da73d617ed60ddf542a3e4b Mon Sep 17 00:00:00 2001 From: luokai Date: Wed, 13 Jul 2022 23:11:24 +0800 Subject: [PATCH 0337/1278] =?UTF-8?q?=E6=8C=89=E9=9C=80=E5=8A=A0=E8=BD=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lua/kide/plugins/init.lua | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/lua/kide/plugins/init.lua b/lua/kide/plugins/init.lua index a8f8f2b7..1f8b3206 100644 --- a/lua/kide/plugins/init.lua +++ b/lua/kide/plugins/init.lua @@ -281,7 +281,13 @@ require("packer").startup({ }) -- 大纲插件 -- use 'liuchengxu/vista.vim' - use("simrat39/symbols-outline.nvim") + use({ + "simrat39/symbols-outline.nvim", + cmd = { "SymbolsOutline" }, + config = function() + require("kide.plugins.config.symbols-outline") + end, + }) -- use { -- 'stevearc/aerial.nvim', -- } @@ -534,7 +540,6 @@ require("kide.plugins.config.alpha-nvim") require("kide.plugins.config.lualine") require("kide.plugins.config.nvim-tree") require("kide.plugins.config.vim-illuminate") -require("kide.plugins.config.symbols-outline") require("kide.plugins.config.vim-dadbod") -- 异步加载 vim.defer_fn(function() From 575ccdc2521dd72ba0f52d5cd970b7de9bd1e17f Mon Sep 17 00:00:00 2001 From: luokai Date: Wed, 13 Jul 2022 23:13:14 +0800 Subject: [PATCH 0338/1278] update --- lua/kide/plugins/init.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lua/kide/plugins/init.lua b/lua/kide/plugins/init.lua index 1f8b3206..61d48b03 100644 --- a/lua/kide/plugins/init.lua +++ b/lua/kide/plugins/init.lua @@ -284,7 +284,7 @@ require("packer").startup({ use({ "simrat39/symbols-outline.nvim", cmd = { "SymbolsOutline" }, - config = function() + setup = function() require("kide.plugins.config.symbols-outline") end, }) From 14156890e98ad7407a3441795f0538ba6277bf80 Mon Sep 17 00:00:00 2001 From: luokai Date: Wed, 13 Jul 2022 23:29:47 +0800 Subject: [PATCH 0339/1278] update --- lua/kide/plugins/init.lua | 32 +++++++++++++++++++++++++++----- 1 file changed, 27 insertions(+), 5 deletions(-) diff --git a/lua/kide/plugins/init.lua b/lua/kide/plugins/init.lua index 61d48b03..4b5fe596 100644 --- a/lua/kide/plugins/init.lua +++ b/lua/kide/plugins/init.lua @@ -47,6 +47,7 @@ require("packer").startup({ -- 代码片段 use({ "rafamadriz/friendly-snippets", + module = "cmp_nvim_lsp", event = "InsertEnter", }) -- nvim-cmp @@ -57,6 +58,7 @@ require("packer").startup({ -- LuaSnip use({ "L3MON4D3/LuaSnip", + wants = "friendly-snippets", after = "nvim-cmp", config = function() require("kide.plugins.config.luasnip") @@ -451,7 +453,14 @@ require("packer").startup({ }) -- 选中高亮插件 - use("RRethy/vim-illuminate") + use({ + "RRethy/vim-illuminate", + opt = true, + setup = function() + require("kide.plugins.config.vim-illuminate") + require("kide.core.layz_load").on_file_open("vim-illuminate") + end, + }) -- 快速跳转 use({ @@ -510,8 +519,23 @@ require("packer").startup({ ft = { "sql", "mysql" }, opt = true, }) - use("tpope/vim-dadbod") - use("kristijanhusak/vim-dadbod-ui") + use({ + "tpope/vim-dadbod", + opt = true, + }) + use({ + "kristijanhusak/vim-dadbod-ui", + opt = true, + wants = "vim-dadbod", + after = "vim-dadbod", + cmd = { + "DBUI", + "DBUIToggle", + }, + setup = function() + require("kide.plugins.config.vim-dadbod") + end, + }) -- 项目管理 use({ @@ -539,8 +563,6 @@ require("kide.plugins.config.bufferline") require("kide.plugins.config.alpha-nvim") require("kide.plugins.config.lualine") require("kide.plugins.config.nvim-tree") -require("kide.plugins.config.vim-illuminate") -require("kide.plugins.config.vim-dadbod") -- 异步加载 vim.defer_fn(function() -- require('plugins/config/LeaderF') From a72fb0bdd93c76d30661911569d5f93fde6017e9 Mon Sep 17 00:00:00 2001 From: luokai Date: Wed, 13 Jul 2022 23:30:44 +0800 Subject: [PATCH 0340/1278] update --- lua/kide/plugins/config/vim-illuminate.lua | 1 + 1 file changed, 1 insertion(+) diff --git a/lua/kide/plugins/config/vim-illuminate.lua b/lua/kide/plugins/config/vim-illuminate.lua index 0425ed35..555add4c 100644 --- a/lua/kide/plugins/config/vim-illuminate.lua +++ b/lua/kide/plugins/config/vim-illuminate.lua @@ -8,6 +8,7 @@ vim.g.Illuminate_ftblacklist = { "markdown", "git", "text", + "txt", "NvimTree", "dashboard", "alpha", From 820eb3b9ac207fbfc8a48433a261dec4c39b63a6 Mon Sep 17 00:00:00 2001 From: luokai Date: Wed, 13 Jul 2022 23:42:09 +0800 Subject: [PATCH 0341/1278] update --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index e71d8d7b..4f6c6dc0 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # NVIM IDE -支持 `Java`, `Rust`, `C/C++`, `JavaScript` 等编程语言开发。 +支持 `Java`, `Rust`, `C/C++`, `JavaScript` 等编程语言开发。 极速启动 (70 ~ 100 ms), 注重细节。 ## 安装 From f4a8f39c787f750b7e6a77a808c2963050b69401 Mon Sep 17 00:00:00 2001 From: luokai Date: Thu, 14 Jul 2022 10:16:23 +0800 Subject: [PATCH 0342/1278] =?UTF-8?q?=E5=BC=82=E6=AD=A5=E5=8A=A0=E8=BD=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lua/kide/plugins/config/telescope.lua | 7 - lua/kide/plugins/config/toggletasks.lua | 2 + lua/kide/plugins/init.lua | 165 ++++++++++++++++++------ 3 files changed, 131 insertions(+), 43 deletions(-) diff --git a/lua/kide/plugins/config/telescope.lua b/lua/kide/plugins/config/telescope.lua index 261f57b0..3c98e258 100644 --- a/lua/kide/plugins/config/telescope.lua +++ b/lua/kide/plugins/config/telescope.lua @@ -140,13 +140,6 @@ telescope.setup({ -- } }, }) -telescope.load_extension("notify") -- telescope.load_extension('fzf') -telescope.load_extension("ui-select") -- telescope.load_extension('gradle') -- telescope.load_extension('maven_search') -telescope.load_extension("env") - -telescope.load_extension("toggletasks") - -telescope.load_extension("projects") diff --git a/lua/kide/plugins/config/toggletasks.lua b/lua/kide/plugins/config/toggletasks.lua index 791a2b48..5604be9b 100644 --- a/lua/kide/plugins/config/toggletasks.lua +++ b/lua/kide/plugins/config/toggletasks.lua @@ -6,3 +6,5 @@ require("toggletasks").setup({ ".nvim/tasks", }, }) + +require("telescope").load_extension("toggletasks") diff --git a/lua/kide/plugins/init.lua b/lua/kide/plugins/init.lua index 4b5fe596..999d7c9f 100644 --- a/lua/kide/plugins/init.lua +++ b/lua/kide/plugins/init.lua @@ -123,7 +123,17 @@ require("packer").startup({ -- 主题 -- use 'morhetz/gruvbox' - use({ "ellisonleao/gruvbox.nvim" }) + use({ + "ellisonleao/gruvbox.nvim", + opt = true, + module = "gruvbox", + setup = function() + vim.cmd("PackerLoad gruvbox.nvim") + end, + config = function() + require("kide.plugins.config.gruvbox") + end, + }) -- use 'sainnhe/gruvbox-material' -- 文件管理 @@ -132,15 +142,53 @@ require("packer").startup({ requires = { "kyazdani42/nvim-web-devicons", -- optional, for file icon }, + + opt = true, tag = "nightly", + after = "gruvbox.nvim", + setup = function() + vim.defer_fn(function() + vim.cmd("PackerLoad nvim-tree.lua") + end, 0) + end, + config = function() + require("kide.plugins.config.nvim-tree") + end, }) -- using packer.nvim - use({ "akinsho/bufferline.nvim", tag = "v2.*", requires = "kyazdani42/nvim-web-devicons" }) + use({ + "akinsho/bufferline.nvim", + opt = true, + tag = "v2.*", + after = "gruvbox.nvim", + requires = "kyazdani42/nvim-web-devicons", + setup = function() + vim.cmd("PackerLoad bufferline.nvim") + end, + config = function() + require("kide.plugins.config.bufferline") + end, + }) -- treesitter (新增) - use({ "nvim-treesitter/nvim-treesitter", run = ":TSUpdate" }) - use("nvim-treesitter/nvim-treesitter-textobjects") + use({ + "nvim-treesitter/nvim-treesitter", + module = "nvim-treesitter", + after = "gruvbox.nvim", + run = ":TSUpdate", + }) + use({ + "nvim-treesitter/nvim-treesitter-textobjects", + opt = true, + after = "nvim-treesitter", + setup = function() + vim.cmd("PackerLoad nvim-treesitter-textobjects") + end, + config = function() + require("kide.plugins.config.nvim-treesitter") + end, + }) -- java use({ @@ -219,9 +267,18 @@ require("packer").startup({ -- git edit 状态显示插件 use({ "lewis6991/gitsigns.nvim", + opt = true, + setup = function() + vim.defer_fn(function() + vim.cmd("PackerLoad gitsigns.nvim") + end, 0) + end, requires = { "nvim-lua/plenary.nvim", }, + config = function() + require("kide.plugins.config.gitsigns-nvim") + end, }) -- 异步任务执行插件 @@ -229,11 +286,18 @@ require("packer").startup({ -- use 'skywind3000/asyncrun.vim' use({ "jedrzejboczar/toggletasks.nvim", + opt = true, + setup = function() + vim.cmd("PackerLoad toggletasks.nvim") + end, requires = { "nvim-lua/plenary.nvim", "akinsho/toggleterm.nvim", "nvim-telescope/telescope.nvim/", }, + config = function() + require("kide.plugins.config.toggletasks") + end, }) -- 浮动窗口插件 @@ -259,6 +323,14 @@ require("packer").startup({ -- use 'feline-nvim/feline.nvim' use({ "nvim-lualine/lualine.nvim", + opt = true, + after = "gruvbox.nvim", + setup = function() + vim.cmd("PackerLoad lualine.nvim") + end, + config = function() + require("kide.plugins.config.lualine") + end, }) -- blankline @@ -295,10 +367,32 @@ require("packer").startup({ -- } -- 消息通知 - use("rcarriga/nvim-notify") + use({ + "rcarriga/nvim-notify", + opt = true, + setup = function() + vim.defer_fn(function() + vim.cmd("PackerLoad nvim-notify") + end, 0) + end, + config = function() + require("kide.plugins.config.nvim-notify") + end, + }) -- wildmenu 补全美化 - use("gelguy/wilder.nvim") + use({ + "gelguy/wilder.nvim", + opt = true, + setup = function() + vim.defer_fn(function() + vim.cmd("PackerLoad wilder.nvim") + end, 0) + end, + config = function() + require("kide.plugins.config.wilder") + end, + }) -- 颜色显示 use({ @@ -362,21 +456,46 @@ require("packer").startup({ requires = { "nvim-lua/plenary.nvim", }, + config = function() + require("kide.plugins.config.telescope") + end, + }) + use({ + "nvim-telescope/telescope-ui-select.nvim", + after = "telescope.nvim", + setup = function() + vim.cmd("PackerLoad telescope-ui-select.nvim") + end, + config = function() + require("telescope").load_extension("ui-select") + end, }) - use({ "nvim-telescope/telescope-ui-select.nvim" }) -- use {'nvim-telescope/telescope-fzf-native.nvim', run = 'make' } use({ "nvim-telescope/telescope-dap.nvim" }) -- use 'GustavoKatel/telescope-asynctasks.nvim' -- use 'aloussase/telescope-gradle.nvim' -- use 'aloussase/telescope-mvnsearch' - use({ "LinArcX/telescope-env.nvim" }) + use({ + "LinArcX/telescope-env.nvim", + after = "telescope.nvim", + config = function() + require("telescope").load_extension("env") + end, + }) -- 仪表盘 -- use {'glepnir/dashboard-nvim'} use({ "goolord/alpha-nvim", + opt = true, requires = { "kyazdani42/nvim-web-devicons" }, + setup = function() + vim.cmd("PackerLoad alpha-nvim") + end, + config = function() + require("kide.plugins.config.alpha-nvim") + end, }) -- 翻译插件 @@ -542,6 +661,8 @@ require("packer").startup({ "ahmedkhalf/project.nvim", config = function() require("project_nvim").setup({}) + + require("telescope").load_extension("projects") end, }) @@ -556,34 +677,6 @@ require("packer").startup({ }, }) -require("kide.plugins.config.gruvbox") -require("kide.plugins.config.nvim-treesitter") -require("kide.plugins.config.bufferline") --- require('plugins/config/dashboard-nvim') -require("kide.plugins.config.alpha-nvim") -require("kide.plugins.config.lualine") -require("kide.plugins.config.nvim-tree") --- 异步加载 vim.defer_fn(function() - -- require('plugins/config/LeaderF') - require("kide.plugins.config.gitsigns-nvim") - -- require('plugins/config/vim-floaterm') - -- require('plugins/config/asynctasks') - require("kide.plugins.config.toggletasks") - -- require('plugins/config/feline') - -- require('plugins/config/vista') - -- require('plugins/config/aerial') - -- require('plugins/config/lsp-colors') - -- require("kide.plugins.config.trouble") - require("kide.plugins.config.nvim-notify") - require("kide.plugins.config.wilder") - -- require("kide.plugins.config.lspsaga") - -- require('plugins/config/formatter') - require("kide.plugins.config.telescope") - -- require('plugins/config/nvim-lsputils') - -- require('plugins/config/lsp_signature') - -- require('plugins/config/autosave') - -- require('plugins/config/nvim-neorg') - require("kide.core.keybindings").setup() end, 0) From ba2c2395a81a5c8094419c50bf45eb545d2fe004 Mon Sep 17 00:00:00 2001 From: luokai Date: Thu, 14 Jul 2022 10:31:32 +0800 Subject: [PATCH 0343/1278] update --- lua/kide/plugins/init.lua | 24 ++++++++++++++++++++++-- 1 file changed, 22 insertions(+), 2 deletions(-) diff --git a/lua/kide/plugins/init.lua b/lua/kide/plugins/init.lua index 999d7c9f..3aabaf6a 100644 --- a/lua/kide/plugins/init.lua +++ b/lua/kide/plugins/init.lua @@ -145,6 +145,7 @@ require("packer").startup({ opt = true, tag = "nightly", + wants = "gruvbox.nvim", after = "gruvbox.nvim", setup = function() vim.defer_fn(function() @@ -161,6 +162,7 @@ require("packer").startup({ "akinsho/bufferline.nvim", opt = true, tag = "v2.*", + wants = "gruvbox.nvim", after = "gruvbox.nvim", requires = "kyazdani42/nvim-web-devicons", setup = function() @@ -175,6 +177,7 @@ require("packer").startup({ use({ "nvim-treesitter/nvim-treesitter", module = "nvim-treesitter", + wants = "gruvbox.nvim", after = "gruvbox.nvim", run = ":TSUpdate", }) @@ -287,8 +290,11 @@ require("packer").startup({ use({ "jedrzejboczar/toggletasks.nvim", opt = true, + after = "toggleterm.nvim", setup = function() - vim.cmd("PackerLoad toggletasks.nvim") + vim.defer_fn(function() + vim.cmd("PackerLoad toggletasks.nvim") + end, 0) end, requires = { "nvim-lua/plenary.nvim", @@ -305,6 +311,8 @@ require("packer").startup({ -- use 'voldikss/LeaderF-floaterm' use({ "akinsho/toggleterm.nvim", + module = "toggleterm", + opt = true, config = function() require("toggleterm").setup() end, @@ -324,6 +332,7 @@ require("packer").startup({ use({ "nvim-lualine/lualine.nvim", opt = true, + wants = "gruvbox.nvim", after = "gruvbox.nvim", setup = function() vim.cmd("PackerLoad lualine.nvim") @@ -357,6 +366,7 @@ require("packer").startup({ -- use 'liuchengxu/vista.vim' use({ "simrat39/symbols-outline.nvim", + opt = true, cmd = { "SymbolsOutline" }, setup = function() require("kide.plugins.config.symbols-outline") @@ -453,6 +463,8 @@ require("packer").startup({ use({ "nvim-telescope/telescope.nvim", module = "telescope", + wants = "gruvbox.nvim", + after = "gruvbox.nvim", requires = { "nvim-lua/plenary.nvim", }, @@ -539,7 +551,15 @@ require("packer").startup({ }) -- 任务插件 - use("itchyny/calendar.vim") + use({ + "itchyny/calendar.vim", + opt = true, + setup = function() + vim.defer_fn(function() + vim.cmd("PackerLoad calendar.vim") + end, 0) + end, + }) -- rust use({ From ae0c381f86e78bad03985ceb3e96b642af7bf1e6 Mon Sep 17 00:00:00 2001 From: luokai Date: Thu, 14 Jul 2022 12:58:24 +0800 Subject: [PATCH 0344/1278] update --- lua/kide/plugins/init.lua | 1 + 1 file changed, 1 insertion(+) diff --git a/lua/kide/plugins/init.lua b/lua/kide/plugins/init.lua index 3aabaf6a..af6fc13b 100644 --- a/lua/kide/plugins/init.lua +++ b/lua/kide/plugins/init.lua @@ -58,6 +58,7 @@ require("packer").startup({ -- LuaSnip use({ "L3MON4D3/LuaSnip", + module = "luasnip", wants = "friendly-snippets", after = "nvim-cmp", config = function() From 9543559c8bda37516ceff80d9ee4b788c06d1f87 Mon Sep 17 00:00:00 2001 From: luokai Date: Thu, 14 Jul 2022 23:59:14 +0800 Subject: [PATCH 0345/1278] =?UTF-8?q?=E7=9B=AE=E5=BD=95=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- init.lua | 5 +---- lua/kide/core/init.lua | 5 +++++ 2 files changed, 6 insertions(+), 4 deletions(-) create mode 100644 lua/kide/core/init.lua diff --git a/init.lua b/init.lua index ca3a4312..ad43004b 100644 --- a/init.lua +++ b/init.lua @@ -5,8 +5,5 @@ if present then impatient.enable_profile() end -require("kide.core.basic") +require("kide.core") require("kide.plugins") -vim.defer_fn(function() - require("kide.core.utils.plantuml").setup() -end, 0) diff --git a/lua/kide/core/init.lua b/lua/kide/core/init.lua new file mode 100644 index 00000000..9e1fa711 --- /dev/null +++ b/lua/kide/core/init.lua @@ -0,0 +1,5 @@ +require("kide.core.basic") + +vim.defer_fn(function() + require("kide.core.utils.plantuml").setup() +end, 0) From 7d55bb50da113ae9dd53933545f1eeced6cd3eb4 Mon Sep 17 00:00:00 2001 From: luokai Date: Fri, 15 Jul 2022 00:16:13 +0800 Subject: [PATCH 0346/1278] fzf --- lua/kide/plugins/config/telescope.lua | 14 +++++++------- lua/kide/plugins/init.lua | 12 +++++++++++- 2 files changed, 18 insertions(+), 8 deletions(-) diff --git a/lua/kide/plugins/config/telescope.lua b/lua/kide/plugins/config/telescope.lua index 3c98e258..72673699 100644 --- a/lua/kide/plugins/config/telescope.lua +++ b/lua/kide/plugins/config/telescope.lua @@ -131,13 +131,13 @@ telescope.setup({ -- even more opts }), }, - -- fzf = { - -- fuzzy = true, -- false will only do exact matching - -- override_generic_sorter = true, -- override the generic sorter - -- override_file_sorter = true, -- override the file sorter - -- case_mode = "smart_case", -- or "ignore_case" or "respect_case" - -- -- the default case_mode is "smart_case" - -- } + fzf = { + fuzzy = true, -- false will only do exact matching + override_generic_sorter = true, -- override the generic sorter + override_file_sorter = true, -- override the file sorter + case_mode = "smart_case", -- or "ignore_case" or "respect_case" + -- the default case_mode is "smart_case" + }, }, }) -- telescope.load_extension('fzf') diff --git a/lua/kide/plugins/init.lua b/lua/kide/plugins/init.lua index af6fc13b..c7821fed 100644 --- a/lua/kide/plugins/init.lua +++ b/lua/kide/plugins/init.lua @@ -483,7 +483,17 @@ require("packer").startup({ require("telescope").load_extension("ui-select") end, }) - -- use {'nvim-telescope/telescope-fzf-native.nvim', run = 'make' } + use({ + "nvim-telescope/telescope-fzf-native.nvim", + run = "make", + after = "telescope.nvim", + setup = function() + vim.cmd("PackerLoad telescope-fzf-native.nvim") + end, + config = function() + require("telescope").load_extension("fzf") + end, + }) use({ "nvim-telescope/telescope-dap.nvim" }) -- use 'GustavoKatel/telescope-asynctasks.nvim' From 11cbbf54ee74cfca35d9caebb0fc14e513f719bd Mon Sep 17 00:00:00 2001 From: luokai Date: Sun, 17 Jul 2022 17:15:35 +0800 Subject: [PATCH 0347/1278] .stylua.toml --- stylua.toml => .stylua.toml | 0 .tasks.json | 2 +- 2 files changed, 1 insertion(+), 1 deletion(-) rename stylua.toml => .stylua.toml (100%) diff --git a/stylua.toml b/.stylua.toml similarity index 100% rename from stylua.toml rename to .stylua.toml diff --git a/.tasks.json b/.tasks.json index 2a9200db..2ae47715 100644 --- a/.tasks.json +++ b/.tasks.json @@ -2,7 +2,7 @@ "tasks": [ { "name": "fmt", - "cmd": "stylua --config-path ./stylua.toml lua/**/*.lua ftplugin/*.lua init.lua" + "cmd": "stylua lua/**/*.lua ftplugin/*.lua init.lua" } ] } From 98db34b66372fcd18126a2caebf3b513665aa968 Mon Sep 17 00:00:00 2001 From: luokai Date: Sun, 17 Jul 2022 20:14:23 +0800 Subject: [PATCH 0348/1278] update --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 4f6c6dc0..3c705eb5 100644 --- a/README.md +++ b/README.md @@ -26,12 +26,12 @@ git clone https://github.com/JavaHello/nvim.git | 文件搜索 | `ff` | | 全局搜索 | `fg` | | 全局搜索替换 | `fr` | -| Git 操作 | `:Git` | +| Git 操作 | `:Neogit` | | Outline | `o` | | 查看实现 | `gi` | | 查看引用 | `gr` | | 查看声明 | `gd` | -| 搜索 symbols | `sw` | +| 搜索 symbols | `fs` | | 格式化(LSP 提供支持) | `=` | | 重命名 | `rn` | | Code Action | `ca` | From c827517690afdae67f1f0bc95d1ffc37603d5250 Mon Sep 17 00:00:00 2001 From: luokai Date: Sun, 17 Jul 2022 20:21:38 +0800 Subject: [PATCH 0349/1278] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E5=BF=AB=E6=8D=B7?= =?UTF-8?q?=E9=94=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 3c705eb5..d6d59f56 100644 --- a/README.md +++ b/README.md @@ -26,12 +26,12 @@ git clone https://github.com/JavaHello/nvim.git | 文件搜索 | `ff` | | 全局搜索 | `fg` | | 全局搜索替换 | `fr` | +| 搜索 symbols | `fs` | | Git 操作 | `:Neogit` | | Outline | `o` | | 查看实现 | `gi` | | 查看引用 | `gr` | | 查看声明 | `gd` | -| 搜索 symbols | `fs` | | 格式化(LSP 提供支持) | `=` | | 重命名 | `rn` | | Code Action | `ca` | From f36314f5cde0c5960c194099730d448147ed8c7c Mon Sep 17 00:00:00 2001 From: luokai Date: Mon, 18 Jul 2022 14:11:18 +0800 Subject: [PATCH 0350/1278] =?UTF-8?q?=E4=BF=AE=E6=94=B9java=E9=85=8D?= =?UTF-8?q?=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lua/kide/lsp/java.lua | 47 +++++++++---------------------------------- 1 file changed, 10 insertions(+), 37 deletions(-) diff --git a/lua/kide/lsp/java.lua b/lua/kide/lsp/java.lua index f9821007..c9739cca 100644 --- a/lua/kide/lsp/java.lua +++ b/lua/kide/lsp/java.lua @@ -254,6 +254,16 @@ M.setup = function() require("jdtls.setup").add_commands() require("kide.core.keybindings").maplsp(client, bufnr) -- require('jdtls.dap').setup_dap_main_class_configs({ verbose = true }) + local opts = { silent = true, buffer = bufnr } + vim.keymap.set("n", "dc", jdtls.test_class, opts) + vim.keymap.set("n", "dm", jdtls.test_nearest_method, opts) + vim.keymap.set("n", "crv", jdtls.extract_variable, opts) + vim.keymap.set("v", "crm", [[lua require('jdtls').extract_method(true)]], opts) + vim.keymap.set("n", "crc", jdtls.extract_constant, opts) + local create_command = vim.api.nvim_buf_create_user_command + create_command(bufnr, "OR", require("jdtls").organize_imports, { + nargs = 0, + }) end local capabilities = require("cmp_nvim_lsp").update_capabilities(vim.lsp.protocol.make_client_capabilities()) @@ -269,43 +279,6 @@ M.setup = function() config.capabilities = capabilities jdtls.start_or_attach(config) - - vim.cmd([[ - command! -nargs=0 OR :lua require'jdtls'.organize_imports() - nnoremap crv lua require('jdtls').extract_variable() - vnoremap crv lua require('jdtls').extract_variable(true) - nnoremap crc lua require('jdtls').extract_constant() - vnoremap crc lua require('jdtls').extract_constant(true) - vnoremap crm lua require('jdtls').extract_method(true) - - - function! s:jdtls_test_class_ui() - lua require'jdtls'.test_class() - lua require'dapui'.open() - endfunction - function! s:jdtls_test_method_ui() - lua require'jdtls'.test_nearest_method() - lua require'dapui'.open() - endfunction - command! -nargs=0 TestClass :lua require'jdtls'.test_class() - command! -nargs=0 TestMethod :lua require'jdtls'.test_nearest_method() - command! -nargs=0 TestClassUI :call s:jdtls_test_class_ui() - command! -nargs=0 TestMethodUI :call s:jdtls_test_method_ui() - nnoremap dc lua require'jdtls'.test_class() - nnoremap dm lua require'jdtls'.test_nearest_method() - - - " command! -nargs=0 JdtRefreshDebugConfigs :lua require('jdtls.dap').setup_dap_main_class_configs() - " - " command! -buffer -nargs=? -complete=custom,v:lua.require'jdtls'._complete_compile JdtCompile lua require('jdtls').compile() - " command! -buffer -nargs=? -complete=custom,v:lua.require'jdtls'._complete_set_runtime JdtSetRuntime lua require('jdtls').set_runtime() - " command! -buffer JdtUpdateConfig lua require('jdtls').update_project_config() - " command! -buffer JdtJol lua require('jdtls').jol() - " command! -buffer JdtBytecode lua require('jdtls').javap() - " command! -buffer JdtJshell lua require('jdtls').jshell() - - " nnoremap p call lighttree#plugin#jdt#toggle_win() - ]]) end return M From 839dba6c4920dc41792802c3360ab81b0b9f2746 Mon Sep 17 00:00:00 2001 From: luokai Date: Mon, 18 Jul 2022 14:42:11 +0800 Subject: [PATCH 0351/1278] codelldb update --- lua/kide/dap/codelldb.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lua/kide/dap/codelldb.lua b/lua/kide/dap/codelldb.lua index b38ce891..118dd8df 100644 --- a/lua/kide/dap/codelldb.lua +++ b/lua/kide/dap/codelldb.lua @@ -1,5 +1,5 @@ local M = {} -local extension_path = "/Users/luokai/.vscode/extensions/vadimcn.vscode-lldb-1.7.0" +local extension_path = "/Users/luokai/.vscode/extensions/vadimcn.vscode-lldb-1.7.2" M.config = {} M.config.codelldb_path = extension_path .. "/adapter/codelldb" M.config.liblldb_path = extension_path .. "/lldb/lib/liblldb.dylib" From 8290450158739644a4f2ba2809917cb0e7b11d8a Mon Sep 17 00:00:00 2001 From: luokai Date: Mon, 18 Jul 2022 15:42:24 +0800 Subject: [PATCH 0352/1278] =?UTF-8?q?=E4=BD=BF=E7=94=A8=20vscode=20?= =?UTF-8?q?=E6=89=A9=E5=B1=95=E5=8C=85?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lua/kide/lsp/java.lua | 31 +++++++++++++++---------------- 1 file changed, 15 insertions(+), 16 deletions(-) diff --git a/lua/kide/lsp/java.lua b/lua/kide/lsp/java.lua index c9739cca..0290c5f5 100644 --- a/lua/kide/lsp/java.lua +++ b/lua/kide/lsp/java.lua @@ -6,7 +6,7 @@ local env = { MAVEN_SETTINGS = os.getenv("MAVEN_SETTINGS"), JDTLS_HOME = os.getenv("JDTLS_HOME"), JDTLS_WORKSPACE = os.getenv("JDTLS_WORKSPACE"), - JDTLS_EXTENSIONS = os.getenv("JDTLS_EXTENSIONS"), + VSCODE_EXTENSIONS = os.getenv("VSCODE_EXTENSIONS"), LOMBOK_JAR = os.getenv("LOMBOK_JAR"), } @@ -27,11 +27,6 @@ local function get_java() return get_java_home() .. "/bin/java" end -local jdtls_root = "/opt/software/lsp/java/jdt-language-server" -local function get_jdtls_home() - return or_default(env.JDTLS_HOME, jdtls_root) -end - local function get_jdtls_workspace() return or_default(env.JDTLS_WORKSPACE, "/Users/luokai/jdtls-workspace/") end @@ -40,8 +35,8 @@ local function get_lombok_jar() return or_default(env.LOMBOK_JAR, "/opt/software/lsp/lombok.jar") end -local function get_jdtls_extensions() - return or_default(env.JDTLS_EXTENSIONS, "/opt/software/lsp/java") +local function get_vscode_extensions() + return or_default(env.VSCODE_EXTENSIONS, "~/.vscode/extensions") end M.setup = function() @@ -49,7 +44,11 @@ M.setup = function() local workspace_dir = get_jdtls_workspace() .. project_name - local jdtls_launcher = vim.fn.glob(get_jdtls_home() .. "/plugins/org.eclipse.equinox.launcher_*.jar") + local jdtls_launcher = vim.fn.glob( + get_vscode_extensions() .. "/redhat.java-*/server/plugins/org.eclipse.equinox.launcher_*.jar" + ) + local jdtls_config = vim.fn.glob(get_vscode_extensions() .. "/redhat.java-*/server/config_mac") + -- See `:help vim.lsp.start_client` for an overview of the supported `config` options. local config = { -- The command that starts the language server @@ -84,7 +83,7 @@ M.setup = function() "-jar", jdtls_launcher, "-configuration", - get_jdtls_home() .. "/config_mac", + jdtls_config, "-data", workspace_dir, }, @@ -212,16 +211,16 @@ M.setup = function() } -- This bundles definition is the same as in the previous section (java-debug installation) + vim.notify(vim.fn.glob(get_vscode_extensions() .. "/redhat.java-*"), vim.log.levels.INFO) local bundles = { - vim.fn.glob( - get_jdtls_extensions() - .. "/java-debug/com.microsoft.java.debug.plugin/target/com.microsoft.java.debug.plugin-*.jar" - ), + vim.fn.glob(get_vscode_extensions() .. "/vscjava.vscode-java-debug-*/server/com.microsoft.java.debug.plugin-*.jar"), } -- /opt/software/lsp/java/vscode-java-test/server -- vim.list_extend(bundles, vim.split(vim.fn.glob("/opt/software/lsp/java/vscode-java-test/server/*.jar"), "\n")); - for _, bundle in ipairs(vim.split(vim.fn.glob(get_jdtls_extensions() .. "/vscode-java-test/server/*.jar"), "\n")) do + for _, bundle in + ipairs(vim.split(vim.fn.glob(get_vscode_extensions() .. "/vscjava.vscode-java-test-*/server/*.jar"), "\n")) + do if not vim.endswith(bundle, "com.microsoft.java.test.runner-jar-with-dependencies.jar") then table.insert(bundles, bundle) end @@ -230,7 +229,7 @@ M.setup = function() -- /opt/software/lsp/java/vscode-java-decompiler/server/ vim.list_extend( bundles, - vim.split(vim.fn.glob(get_jdtls_extensions() .. "/vscode-java-decompiler/server/*.jar"), "\n") + vim.split(vim.fn.glob(get_vscode_extensions() .. "/dgileadi.java-decompiler-*/server/*.jar"), "\n") ) -- /opt/software/lsp/java/vscode-java-dependency/jdtls.ext/ From 38ecff6de137192cbeaab80f80290b034b3eda0a Mon Sep 17 00:00:00 2001 From: luokai Date: Mon, 18 Jul 2022 16:18:27 +0800 Subject: [PATCH 0353/1278] java os_type config --- lua/kide/core/utils/init.lua | 16 ++++++++++++++++ lua/kide/lsp/java.lua | 27 +++++++++++++++++++++------ 2 files changed, 37 insertions(+), 6 deletions(-) diff --git a/lua/kide/core/utils/init.lua b/lua/kide/core/utils/init.lua index 49cc8b57..d8bced17 100644 --- a/lua/kide/core/utils/init.lua +++ b/lua/kide/core/utils/init.lua @@ -186,4 +186,20 @@ end M.or_default = function(a, v) return a and a or v end + +M.Windows = "Windows" +M.Linux = "Linux" +M.Mac = "Mac" + +M.os_type = function() + local has = vim.fn.has + local t = M.Linux + if has("win32") == 1 or has("win64") == 1 then + t = M.Windows + elseif has("mac") == 1 then + t = M.Mac + end + return t +end + return M diff --git a/lua/kide/lsp/java.lua b/lua/kide/lsp/java.lua index 0290c5f5..b4cfe87c 100644 --- a/lua/kide/lsp/java.lua +++ b/lua/kide/lsp/java.lua @@ -1,4 +1,5 @@ local M = {} +local cutils = require("kide.core.utils") local env = { -- HOME = vim.loop.os_homedir(), JAVA_HOME = os.getenv("JAVA_HOME"), @@ -31,14 +32,27 @@ local function get_jdtls_workspace() return or_default(env.JDTLS_WORKSPACE, "/Users/luokai/jdtls-workspace/") end -local function get_lombok_jar() - return or_default(env.LOMBOK_JAR, "/opt/software/lsp/lombok.jar") -end - local function get_vscode_extensions() return or_default(env.VSCODE_EXTENSIONS, "~/.vscode/extensions") end +local function get_lombok_jar() + return or_default( + env.LOMBOK_JAR, + vim.fn.glob(get_vscode_extensions() .. "/vscjava.vscode-lombok-*/server/lombok.jar") + ) +end + +local _config = (function() + if cutils.os_type() == cutils.Windows then + return "config_win" + elseif cutils.os_type() == cutils.Mac then + return "config_mac" + else + return "config_linux" + end +end)() + M.setup = function() local project_name = vim.fn.fnamemodify(vim.fn.getcwd(), ":p:h:t") @@ -47,7 +61,9 @@ M.setup = function() local jdtls_launcher = vim.fn.glob( get_vscode_extensions() .. "/redhat.java-*/server/plugins/org.eclipse.equinox.launcher_*.jar" ) - local jdtls_config = vim.fn.glob(get_vscode_extensions() .. "/redhat.java-*/server/config_mac") + local jdtls_config = vim.fn.glob(get_vscode_extensions() .. "/redhat.java-*/server/" .. _config) + + -- vim.notify(jdtls_config, vim.log.levels.INFO) -- See `:help vim.lsp.start_client` for an overview of the supported `config` options. local config = { @@ -211,7 +227,6 @@ M.setup = function() } -- This bundles definition is the same as in the previous section (java-debug installation) - vim.notify(vim.fn.glob(get_vscode_extensions() .. "/redhat.java-*"), vim.log.levels.INFO) local bundles = { vim.fn.glob(get_vscode_extensions() .. "/vscjava.vscode-java-debug-*/server/com.microsoft.java.debug.plugin-*.jar"), } From 21709a887656030e8d53c34525824884bde38b72 Mon Sep 17 00:00:00 2001 From: luokai Date: Mon, 18 Jul 2022 16:21:17 +0800 Subject: [PATCH 0354/1278] =?UTF-8?q?=E6=9B=B4=E6=96=B0=20java=20=E5=AE=89?= =?UTF-8?q?=E8=A3=85=E8=AF=B4=E6=98=8E?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index d6d59f56..d74c8ae9 100644 --- a/README.md +++ b/README.md @@ -48,7 +48,8 @@ git clone https://github.com/JavaHello/nvim.git > 如果不使用 `Java` 语言开发,无需配置 -[NVIM 打造 Java IDE](https://javahello.github.io/dev/tools/NVIM-LSP-Java-IDE.html) +[NVIM 打造 Java IDE](https://javahello.github.io/dev/tools/NVIM-LSP-Java-IDE-vscode.html) +更新了配置,全部使用 vscode 扩展,简化安装步骤。 如果使用长时间后感觉卡顿,关闭下所有`buffer`, `:%bw` 。 From d380c73fd3ab9ef8dbbad0b3410e52575ef8f9d7 Mon Sep 17 00:00:00 2001 From: luokai Date: Mon, 18 Jul 2022 16:44:00 +0800 Subject: [PATCH 0355/1278] =?UTF-8?q?=E8=8E=B7=E5=8F=96home?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lua/kide/lsp/java.lua | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lua/kide/lsp/java.lua b/lua/kide/lsp/java.lua index b4cfe87c..d1879272 100644 --- a/lua/kide/lsp/java.lua +++ b/lua/kide/lsp/java.lua @@ -1,7 +1,7 @@ local M = {} local cutils = require("kide.core.utils") local env = { - -- HOME = vim.loop.os_homedir(), + HOME = vim.loop.os_homedir(), JAVA_HOME = os.getenv("JAVA_HOME"), MAVEN_HOME = os.getenv("MAVEN_HOME"), MAVEN_SETTINGS = os.getenv("MAVEN_SETTINGS"), @@ -29,7 +29,7 @@ local function get_java() end local function get_jdtls_workspace() - return or_default(env.JDTLS_WORKSPACE, "/Users/luokai/jdtls-workspace/") + return or_default(env.JDTLS_WORKSPACE, env.HOME .. "/jdtls-workspace/") end local function get_vscode_extensions() From d5d4ff653779128b9eadab67a09886458cf4a1ee Mon Sep 17 00:00:00 2001 From: luokai Date: Mon, 18 Jul 2022 17:33:31 +0800 Subject: [PATCH 0356/1278] =?UTF-8?q?uri=20error=20=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lua/kide/plugins/config/telescope.lua | 1 + 1 file changed, 1 insertion(+) diff --git a/lua/kide/plugins/config/telescope.lua b/lua/kide/plugins/config/telescope.lua index 72673699..2900edac 100644 --- a/lua/kide/plugins/config/telescope.lua +++ b/lua/kide/plugins/config/telescope.lua @@ -91,6 +91,7 @@ telescope.setup({ timeout = 1000, filetype_hook = function(filepath, bufnr, opts) if vim.startswith(filepath, "jdt://") then + vim.api.nvim_buf_set_name(bufnr, filepath) require("kide.lsp.utils.jdtls").open_jdt_link(filepath, bufnr, opts.preview.timeout) return false end From fb04b9de12d48b5b404f4eefd5dc14e1f677efa7 Mon Sep 17 00:00:00 2001 From: luokai Date: Tue, 19 Jul 2022 09:06:52 +0800 Subject: [PATCH 0357/1278] =?UTF-8?q?=E5=BC=82=E6=AD=A5=E5=8A=A0=E8=BD=BD?= =?UTF-8?q?=E9=85=8D=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lua/kide/core/init.lua | 5 ++-- lua/kide/core/layz_load.lua | 4 +-- lua/kide/lsp/utils/jdtls.lua | 3 ++- lua/kide/plugins/config/telescope.lua | 2 -- lua/kide/plugins/init.lua | 38 +++++++++++---------------- 5 files changed, 22 insertions(+), 30 deletions(-) diff --git a/lua/kide/core/init.lua b/lua/kide/core/init.lua index 9e1fa711..ec27ed31 100644 --- a/lua/kide/core/init.lua +++ b/lua/kide/core/init.lua @@ -1,5 +1,6 @@ require("kide.core.basic") -vim.defer_fn(function() + +vim.schedule(function() require("kide.core.utils.plantuml").setup() -end, 0) +end) diff --git a/lua/kide/core/layz_load.lua b/lua/kide/core/layz_load.lua index ba226562..9137a705 100644 --- a/lua/kide/core/layz_load.lua +++ b/lua/kide/core/layz_load.lua @@ -12,9 +12,9 @@ M.lazy_load = function(tb) -- dont defer for treesitter as it will show slow highlighting -- This deferring only happens only when we do "nvim filename" if tb.plugins ~= "nvim-treesitter" then - vim.defer_fn(function() + vim.schedule(function() vim.cmd("PackerLoad " .. tb.plugins) - end, 0) + end) else vim.cmd("PackerLoad " .. tb.plugins) end diff --git a/lua/kide/lsp/utils/jdtls.lua b/lua/kide/lsp/utils/jdtls.lua index d6e2603c..6601e1df 100644 --- a/lua/kide/lsp/utils/jdtls.lua +++ b/lua/kide/lsp/utils/jdtls.lua @@ -61,7 +61,8 @@ M.open_jdt_link = function(uri, buf, timeout) end vim.api.nvim_buf_set_option(buf, "modifiable", true) vim.api.nvim_buf_set_lines(buf, 0, -1, false, buf_content) - vim.api.nvim_buf_set_option(buf, "filetype", "java") + -- vim.api.nvim_buf_set_option(buf, "filetype", "java") + vim.api.nvim_buf_set_option(buf, "syntax", "java") vim.api.nvim_buf_set_option(buf, "modifiable", false) end return M diff --git a/lua/kide/plugins/config/telescope.lua b/lua/kide/plugins/config/telescope.lua index 2900edac..fcd675bf 100644 --- a/lua/kide/plugins/config/telescope.lua +++ b/lua/kide/plugins/config/telescope.lua @@ -91,9 +91,7 @@ telescope.setup({ timeout = 1000, filetype_hook = function(filepath, bufnr, opts) if vim.startswith(filepath, "jdt://") then - vim.api.nvim_buf_set_name(bufnr, filepath) require("kide.lsp.utils.jdtls").open_jdt_link(filepath, bufnr, opts.preview.timeout) - return false end return true end, diff --git a/lua/kide/plugins/init.lua b/lua/kide/plugins/init.lua index c7821fed..ca8dc880 100644 --- a/lua/kide/plugins/init.lua +++ b/lua/kide/plugins/init.lua @@ -149,9 +149,9 @@ require("packer").startup({ wants = "gruvbox.nvim", after = "gruvbox.nvim", setup = function() - vim.defer_fn(function() + vim.schedule(function() vim.cmd("PackerLoad nvim-tree.lua") - end, 0) + end) end, config = function() require("kide.plugins.config.nvim-tree") @@ -199,16 +199,8 @@ require("packer").startup({ "mfussenegger/nvim-jdtls", opt = true, ft = "java", - setup = function() - require("kide.core.layz_load").on_file_open("nvim-jdtls") - end, config = function() - vim.cmd([[ - augroup jdtls_lsp - autocmd! - autocmd FileType java lua require"kide.lsp.java".setup() - augroup end - ]]) + require("kide.lsp.java").init() end, }) -- use 'NiYanhhhhh/lighttree-java' @@ -273,9 +265,9 @@ require("packer").startup({ "lewis6991/gitsigns.nvim", opt = true, setup = function() - vim.defer_fn(function() + vim.schedule(function() vim.cmd("PackerLoad gitsigns.nvim") - end, 0) + end) end, requires = { "nvim-lua/plenary.nvim", @@ -293,9 +285,9 @@ require("packer").startup({ opt = true, after = "toggleterm.nvim", setup = function() - vim.defer_fn(function() + vim.schedule(function() vim.cmd("PackerLoad toggletasks.nvim") - end, 0) + end) end, requires = { "nvim-lua/plenary.nvim", @@ -382,9 +374,9 @@ require("packer").startup({ "rcarriga/nvim-notify", opt = true, setup = function() - vim.defer_fn(function() + vim.schedule(function() vim.cmd("PackerLoad nvim-notify") - end, 0) + end) end, config = function() require("kide.plugins.config.nvim-notify") @@ -396,9 +388,9 @@ require("packer").startup({ "gelguy/wilder.nvim", opt = true, setup = function() - vim.defer_fn(function() + vim.schedule(function() vim.cmd("PackerLoad wilder.nvim") - end, 0) + end) end, config = function() require("kide.plugins.config.wilder") @@ -566,9 +558,9 @@ require("packer").startup({ "itchyny/calendar.vim", opt = true, setup = function() - vim.defer_fn(function() + vim.schedule(function() vim.cmd("PackerLoad calendar.vim") - end, 0) + end) end, }) @@ -708,6 +700,6 @@ require("packer").startup({ }, }) -vim.defer_fn(function() +vim.schedule(function() require("kide.core.keybindings").setup() -end, 0) +end) From 4197b5390c9d905c67bd1bbeb9ec22d05d196627 Mon Sep 17 00:00:00 2001 From: luokai Date: Tue, 19 Jul 2022 09:07:04 +0800 Subject: [PATCH 0358/1278] =?UTF-8?q?=E5=8F=AA=E9=AB=98=E4=BA=AE=E6=98=BE?= =?UTF-8?q?=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lua/kide/lsp/java.lua | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/lua/kide/lsp/java.lua b/lua/kide/lsp/java.lua index d1879272..7a132e43 100644 --- a/lua/kide/lsp/java.lua +++ b/lua/kide/lsp/java.lua @@ -63,8 +63,7 @@ M.setup = function() ) local jdtls_config = vim.fn.glob(get_vscode_extensions() .. "/redhat.java-*/server/" .. _config) - -- vim.notify(jdtls_config, vim.log.levels.INFO) - + -- vim.notify("SETUP: " .. vim.api.nvim_buf_get_name(vim.api.nvim_get_current_buf()), vim.log.levels.INFO) -- See `:help vim.lsp.start_client` for an overview of the supported `config` options. local config = { -- The command that starts the language server @@ -278,6 +277,7 @@ M.setup = function() create_command(bufnr, "OR", require("jdtls").organize_imports, { nargs = 0, }) + -- vim.notify(vim.api.nvim_buf_get_name(bufnr), vim.log.levels.INFO) end local capabilities = require("cmp_nvim_lsp").update_capabilities(vim.lsp.protocol.make_client_capabilities()) @@ -295,4 +295,17 @@ M.setup = function() jdtls.start_or_attach(config) end +M.init = function() + local group = vim.api.nvim_create_augroup("jdtls_java", { clear = true }) + vim.api.nvim_create_autocmd({ "FileType" }, { + group = group, + pattern = { "java" }, + desc = "jdtls", + callback = function(o) + -- vim.notify("load: " .. o.buf, vim.log.levels.INFO) + M.setup() + end, + }) + return group +end return M From 63b60dc822673ee3a288662b09b8236207010bda Mon Sep 17 00:00:00 2001 From: luokai Date: Wed, 20 Jul 2022 10:34:08 +0800 Subject: [PATCH 0359/1278] toggletasks config --- lua/kide/core/init.lua | 1 - lua/kide/plugins/config/toggletasks.lua | 4 ++++ lua/kide/plugins/init.lua | 17 ++++++++++++++++- 3 files changed, 20 insertions(+), 2 deletions(-) diff --git a/lua/kide/core/init.lua b/lua/kide/core/init.lua index ec27ed31..791001cd 100644 --- a/lua/kide/core/init.lua +++ b/lua/kide/core/init.lua @@ -1,6 +1,5 @@ require("kide.core.basic") - vim.schedule(function() require("kide.core.utils.plantuml").setup() end) diff --git a/lua/kide/plugins/config/toggletasks.lua b/lua/kide/plugins/config/toggletasks.lua index 5604be9b..cffd880f 100644 --- a/lua/kide/plugins/config/toggletasks.lua +++ b/lua/kide/plugins/config/toggletasks.lua @@ -5,6 +5,10 @@ require("toggletasks").setup({ ".nvim/toggletasks", ".nvim/tasks", }, + defaults = { + close_on_exit = false, + hidden = true, + }, }) require("telescope").load_extension("toggletasks") diff --git a/lua/kide/plugins/init.lua b/lua/kide/plugins/init.lua index ca8dc880..931ab9c6 100644 --- a/lua/kide/plugins/init.lua +++ b/lua/kide/plugins/init.lua @@ -307,7 +307,22 @@ require("packer").startup({ module = "toggleterm", opt = true, config = function() - require("toggleterm").setup() + require("toggleterm").setup({ + shade_terminals = true, + direction = "float", + close_on_exit = true, + float_opts = { + -- The border key is *almost* the same as 'nvim_open_win' + -- see :h nvim_open_win for details on borders however + -- the 'curved' border is a custom border type + -- not natively supported but implemented in this plugin. + -- border = 'single' | 'double' | 'shadow' | 'curved' | ... other options supported by win open + -- width = , + -- height = , + border = "double", + winblend = 0, + }, + }) end, }) From 46825ef0c5b51b4413a04656690ec81f731b33a1 Mon Sep 17 00:00:00 2001 From: luokai Date: Wed, 20 Jul 2022 10:50:45 +0800 Subject: [PATCH 0360/1278] toggletasks config --- lua/kide/plugins/config/toggletasks.lua | 3 +-- lua/kide/plugins/init.lua | 8 +------- 2 files changed, 2 insertions(+), 9 deletions(-) diff --git a/lua/kide/plugins/config/toggletasks.lua b/lua/kide/plugins/config/toggletasks.lua index cffd880f..771382ea 100644 --- a/lua/kide/plugins/config/toggletasks.lua +++ b/lua/kide/plugins/config/toggletasks.lua @@ -6,8 +6,7 @@ require("toggletasks").setup({ ".nvim/tasks", }, defaults = { - close_on_exit = false, - hidden = true, + close_on_exit = true, }, }) diff --git a/lua/kide/plugins/init.lua b/lua/kide/plugins/init.lua index 931ab9c6..775e03c4 100644 --- a/lua/kide/plugins/init.lua +++ b/lua/kide/plugins/init.lua @@ -309,16 +309,10 @@ require("packer").startup({ config = function() require("toggleterm").setup({ shade_terminals = true, + -- shade_filetypes = { "none", "fzf" }, direction = "float", close_on_exit = true, float_opts = { - -- The border key is *almost* the same as 'nvim_open_win' - -- see :h nvim_open_win for details on borders however - -- the 'curved' border is a custom border type - -- not natively supported but implemented in this plugin. - -- border = 'single' | 'double' | 'shadow' | 'curved' | ... other options supported by win open - -- width = , - -- height = , border = "double", winblend = 0, }, From bea2448e8a34fa0ef2901aed0f4bc382bf289663 Mon Sep 17 00:00:00 2001 From: luokai Date: Wed, 20 Jul 2022 17:52:50 +0800 Subject: [PATCH 0361/1278] update --- .tasks.json | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.tasks.json b/.tasks.json index 2ae47715..3128dfc0 100644 --- a/.tasks.json +++ b/.tasks.json @@ -2,7 +2,8 @@ "tasks": [ { "name": "fmt", - "cmd": "stylua lua/**/*.lua ftplugin/*.lua init.lua" + "cmd": "stylua lua/**/*.lua ftplugin/*.lua init.lua", + "close_on_exit": true } ] } From 6f8ac1ff259d78b8d4b19a167deecac07c134747 Mon Sep 17 00:00:00 2001 From: luokai Date: Wed, 20 Jul 2022 21:31:28 +0800 Subject: [PATCH 0362/1278] =?UTF-8?q?=E5=BB=B6=E8=BF=9F=E5=8A=A0=E8=BD=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 2 +- lua/kide/core/layz_load.lua | 9 +++ lua/kide/core/utils/init.lua | 9 --- lua/kide/plugins/init.lua | 117 ++++++++++++++++++----------------- 4 files changed, 71 insertions(+), 66 deletions(-) diff --git a/README.md b/README.md index d74c8ae9..b1966a79 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # NVIM IDE -支持 `Java`, `Rust`, `C/C++`, `JavaScript` 等编程语言开发。 极速启动 (70 ~ 100 ms), 注重细节。 +支持 `Java`, `Rust`, `C/C++`, `JavaScript` 等编程语言开发。 极速启动 (60 ~ 100 ms), 注重细节。 ## 安装 diff --git a/lua/kide/core/layz_load.lua b/lua/kide/core/layz_load.lua index 9137a705..9465dd7c 100644 --- a/lua/kide/core/layz_load.lua +++ b/lua/kide/core/layz_load.lua @@ -39,4 +39,13 @@ M.on_file_open = function(plugin_name) }) end +M.sync_load = function(plugin) + require("packer").loader(plugin) +end +M.async_load = function(plugin) + vim.schedule(function() + require("packer").loader(plugin) + end) +end + return M diff --git a/lua/kide/core/utils/init.lua b/lua/kide/core/utils/init.lua index d8bced17..201928eb 100644 --- a/lua/kide/core/utils/init.lua +++ b/lua/kide/core/utils/init.lua @@ -29,15 +29,6 @@ M.close_other_bufline = function() vim.fn.execute("BufferLineCloseRight") end -M.packer_lazy_load = function(plugin, timer) - if plugin then - timer = timer or 0 - vim.defer_fn(function() - require("packer").loader(plugin) - end, timer) - end -end - M.is_upper = function(c) return c >= 65 and c <= 90 end diff --git a/lua/kide/plugins/init.lua b/lua/kide/plugins/init.lua index 775e03c4..a4cbe22f 100644 --- a/lua/kide/plugins/init.lua +++ b/lua/kide/plugins/init.lua @@ -1,5 +1,6 @@ local bootstrap = require("packer_bootstrap") vim.cmd("packadd packer.nvim") + require("packer").startup({ function(use) -- Packer can manage itself @@ -17,28 +18,16 @@ require("packer").startup({ }) use({ "williamboman/nvim-lsp-installer", - cmd = { - "LspInfo", - "LspStart", - "LspRestart", - "LspStop", - "LspInstall", - "LspUnInstall", - "LspUnInstallAll", - "LspInstall", - "LspInstallInfo", - "LspInstallLog", - "LspLog", - "LspPrintInstalled", - }, - setup = function() - require("kide.core.layz_load").on_file_open("nvim-lsp-installer") - end, + module = "nvim-lsp-installer", + opt = true, }) use({ "neovim/nvim-lspconfig", after = "nvim-lsp-installer", module = "lspconfig", + setup = function() + require("kide.core.layz_load").async_load("nvim-lspconfig") + end, config = function() require("kide.lsp") end, @@ -114,7 +103,8 @@ require("packer").startup({ "jose-elias-alvarez/null-ls.nvim", opt = true, setup = function() - require("kide.core.layz_load").on_file_open("null-ls.nvim") + -- on_file_open("null-ls.nvim") + require("kide.core.layz_load").async_load("null-ls.nvim") end, config = function() require("kide.plugins.config.null-ls") @@ -129,7 +119,7 @@ require("packer").startup({ opt = true, module = "gruvbox", setup = function() - vim.cmd("PackerLoad gruvbox.nvim") + require("kide.core.layz_load").sync_load("gruvbox.nvim") end, config = function() require("kide.plugins.config.gruvbox") @@ -149,9 +139,7 @@ require("packer").startup({ wants = "gruvbox.nvim", after = "gruvbox.nvim", setup = function() - vim.schedule(function() - vim.cmd("PackerLoad nvim-tree.lua") - end) + require("kide.core.layz_load").async_load("nvim-tree.lua") end, config = function() require("kide.plugins.config.nvim-tree") @@ -167,7 +155,7 @@ require("packer").startup({ after = "gruvbox.nvim", requires = "kyazdani42/nvim-web-devicons", setup = function() - vim.cmd("PackerLoad bufferline.nvim") + require("kide.core.layz_load").sync_load("bufferline.nvim") end, config = function() require("kide.plugins.config.bufferline") @@ -187,7 +175,7 @@ require("packer").startup({ opt = true, after = "nvim-treesitter", setup = function() - vim.cmd("PackerLoad nvim-treesitter-textobjects") + require("kide.core.layz_load").sync_load("nvim-treesitter-textobjects") end, config = function() require("kide.plugins.config.nvim-treesitter") @@ -265,9 +253,7 @@ require("packer").startup({ "lewis6991/gitsigns.nvim", opt = true, setup = function() - vim.schedule(function() - vim.cmd("PackerLoad gitsigns.nvim") - end) + require("kide.core.layz_load").async_load("gitsigns.nvim") end, requires = { "nvim-lua/plenary.nvim", @@ -285,9 +271,7 @@ require("packer").startup({ opt = true, after = "toggleterm.nvim", setup = function() - vim.schedule(function() - vim.cmd("PackerLoad toggletasks.nvim") - end) + require("kide.core.layz_load").async_load("toggletasks.nvim") end, requires = { "nvim-lua/plenary.nvim", @@ -325,7 +309,8 @@ require("packer").startup({ "mg979/vim-visual-multi", opt = true, setup = function() - require("kide.core.layz_load").on_file_open("vim-visual-multi") + -- on_file_open("vim-visual-multi") + require("kide.core.layz_load").async_load("vim-visual-multi") end, }) @@ -337,7 +322,7 @@ require("packer").startup({ wants = "gruvbox.nvim", after = "gruvbox.nvim", setup = function() - vim.cmd("PackerLoad lualine.nvim") + require("kide.core.layz_load").sync_load("lualine.nvim") end, config = function() require("kide.plugins.config.lualine") @@ -349,7 +334,8 @@ require("packer").startup({ "lukas-reineke/indent-blankline.nvim", opt = true, setup = function() - require("kide.core.layz_load").on_file_open("indent-blankline.nvim") + -- on_file_open("indent-blankline.nvim") + require("kide.core.layz_load").async_load("indent-blankline.nvim") end, config = function() require("kide.plugins.config.indent-blankline") @@ -361,7 +347,8 @@ require("packer").startup({ "andymass/vim-matchup", opt = true, setup = function() - require("kide.core.layz_load").on_file_open("vim-matchup") + -- on_file_open("vim-matchup") + require("kide.core.layz_load").async_load("vim-matchup") end, }) -- 大纲插件 @@ -383,9 +370,7 @@ require("packer").startup({ "rcarriga/nvim-notify", opt = true, setup = function() - vim.schedule(function() - vim.cmd("PackerLoad nvim-notify") - end) + require("kide.core.layz_load").sync_load("nvim-notify") end, config = function() require("kide.plugins.config.nvim-notify") @@ -397,9 +382,7 @@ require("packer").startup({ "gelguy/wilder.nvim", opt = true, setup = function() - vim.schedule(function() - vim.cmd("PackerLoad wilder.nvim") - end) + require("kide.core.layz_load").async_load("wilder.nvim") end, config = function() require("kide.plugins.config.wilder") @@ -411,7 +394,8 @@ require("packer").startup({ "norcalli/nvim-colorizer.lua", opt = true, setup = function() - require("kide.core.layz_load").on_file_open("nvim-colorizer.lua") + -- on_file_open("nvim-colorizer.lua") + require("kide.core.layz_load").async_load("nvim-colorizer.lua") end, config = function() require("kide.plugins.config.nvim-colorizer") @@ -452,6 +436,10 @@ require("packer").startup({ -- 快捷键查看 use({ "folke/which-key.nvim", + opt = true, + setup = function() + require("kide.core.layz_load").async_load("which-key.nvim") + end, config = function() require("which-key").setup({ -- your configuration comes here @@ -478,7 +466,7 @@ require("packer").startup({ "nvim-telescope/telescope-ui-select.nvim", after = "telescope.nvim", setup = function() - vim.cmd("PackerLoad telescope-ui-select.nvim") + require("kide.core.layz_load").async_load("telescope-ui-select.nvim") end, config = function() require("telescope").load_extension("ui-select") @@ -489,7 +477,7 @@ require("packer").startup({ run = "make", after = "telescope.nvim", setup = function() - vim.cmd("PackerLoad telescope-fzf-native.nvim") + require("kide.core.layz_load").async_load("telescope-fzf-native.nvim") end, config = function() require("telescope").load_extension("fzf") @@ -515,7 +503,7 @@ require("packer").startup({ opt = true, requires = { "kyazdani42/nvim-web-devicons" }, setup = function() - vim.cmd("PackerLoad alpha-nvim") + require("kide.core.layz_load").sync_load("alpha-nvim") end, config = function() require("kide.plugins.config.alpha-nvim") @@ -528,7 +516,8 @@ require("packer").startup({ "uga-rosa/translate.nvim", opt = true, setup = function() - require("kide.core.layz_load").on_file_open("translate.nvim") + -- on_file_open("translate.nvim") + require("kide.core.layz_load").async_load("translate.nvim") end, config = function() require("kide.plugins.config.translate") @@ -540,7 +529,8 @@ require("packer").startup({ "junegunn/vim-easy-align", opt = true, setup = function() - require("kide.core.layz_load").on_file_open("vim-easy-align") + -- on_file_open("vim-easy-align") + require("kide.core.layz_load").async_load("vim-easy-align") end, }) @@ -549,14 +539,19 @@ require("packer").startup({ "dhruvasagar/vim-table-mode", opt = true, setup = function() - require("kide.core.layz_load").on_file_open("vim-table-mode") + -- on_file_open("vim-table-mode") + require("kide.core.layz_load").async_load("vim-table-mode") end, }) -- () 自动补全 use({ "windwp/nvim-autopairs", + opt = true, after = "nvim-cmp", + setup = function() + require("kide.core.layz_load").async_load("nvim-autopairs") + end, config = function() require("kide.plugins.config.nvim-autopairs") end, @@ -567,9 +562,7 @@ require("packer").startup({ "itchyny/calendar.vim", opt = true, setup = function() - vim.schedule(function() - vim.cmd("PackerLoad calendar.vim") - end) + require("kide.core.layz_load").async_load("calendar.vim") end, }) @@ -609,7 +602,8 @@ require("packer").startup({ opt = true, setup = function() require("kide.plugins.config.vim-illuminate") - require("kide.core.layz_load").on_file_open("vim-illuminate") + -- on_file_open("vim-illuminate") + require("kide.core.layz_load").async_load("vim-illuminate") end, }) @@ -619,7 +613,8 @@ require("packer").startup({ opt = true, branch = "v1", setup = function() - require("kide.core.layz_load").on_file_open("hop.nvim") + -- on_file_open("hop.nvim") + require("kide.core.layz_load").async_load("hop.nvim") end, config = function() require("hop").setup({ keys = "etovxqpdygfblzhckisuran" }) @@ -630,6 +625,10 @@ require("packer").startup({ -- LSP 进度 use({ "j-hui/fidget.nvim", + opt = true, + setup = function() + require("kide.core.layz_load").async_load("fidget.nvim") + end, config = function() require("fidget").setup({}) end, @@ -640,7 +639,8 @@ require("packer").startup({ "windwp/nvim-spectre", opt = true, setup = function() - require("kide.core.layz_load").on_file_open("nvim-spectre") + -- on_file_open("nvim-spectre") + require("kide.core.layz_load").async_load("nvim-spectre") end, config = function() require("spectre").setup() @@ -652,7 +652,8 @@ require("packer").startup({ "jbyuki/venn.nvim", opt = true, setup = function() - require("kide.core.layz_load").on_file_open("venn.nvim") + -- on_file_open("venn.nvim") + require("kide.core.layz_load").async_load("venn.nvim") end, }) @@ -660,7 +661,8 @@ require("packer").startup({ "tversteeg/registers.nvim", opt = true, setup = function() - require("kide.core.layz_load").on_file_open("registers.nvim") + -- on_file_open("registers.nvim") + require("kide.core.layz_load").async_load("registers.nvim") end, }) @@ -691,9 +693,12 @@ require("packer").startup({ -- 项目管理 use({ "ahmedkhalf/project.nvim", + opt = true, + setup = function() + require("kide.core.layz_load").async_load("project.nvim") + end, config = function() require("project_nvim").setup({}) - require("telescope").load_extension("projects") end, }) From e7d81ac16079b8c15e29c9c0899cb95903514e9e Mon Sep 17 00:00:00 2001 From: luokai Date: Wed, 20 Jul 2022 21:56:15 +0800 Subject: [PATCH 0363/1278] =?UTF-8?q?telescope=20=E9=85=8D=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- init.lua | 2 +- lua/kide/plugins/config/gruvbox.lua | 2 +- lua/kide/plugins/init.lua | 19 ++++++++- lua/kide/theme/gruvbox.lua | 66 ++++++++++++++++++++++++++--- lua/kide/theme/telescope.lua | 55 ------------------------ 5 files changed, 80 insertions(+), 64 deletions(-) delete mode 100644 lua/kide/theme/telescope.lua diff --git a/init.lua b/init.lua index ad43004b..34b9ed02 100644 --- a/init.lua +++ b/init.lua @@ -1,4 +1,4 @@ -math.randomseed(os.time()) +-- math.randomseed(os.time()) local present, impatient = pcall(require, "impatient") if present then diff --git a/lua/kide/plugins/config/gruvbox.lua b/lua/kide/plugins/config/gruvbox.lua index 4f017c9d..958b453d 100644 --- a/lua/kide/plugins/config/gruvbox.lua +++ b/lua/kide/plugins/config/gruvbox.lua @@ -9,7 +9,7 @@ local overrides = { }, } -overrides = vim.tbl_extend("force", overrides, require("kide.theme.telescope")) +overrides = vim.tbl_extend("force", overrides, require("kide.theme.gruvbox").flat_telescope) require("gruvbox").setup({ undercurl = true, diff --git a/lua/kide/plugins/init.lua b/lua/kide/plugins/init.lua index a4cbe22f..68bad9c8 100644 --- a/lua/kide/plugins/init.lua +++ b/lua/kide/plugins/init.lua @@ -196,15 +196,21 @@ require("packer").startup({ -- debug use({ "mfussenegger/nvim-dap", + opt = true, + module = "dap", }) use({ "rcarriga/nvim-dap-ui", + opt = true, + module = "dapui", after = "nvim-dap", }) use({ "theHamsta/nvim-dap-virtual-text", after = "nvim-dap-ui", - module = { "dap", "dapui" }, + setup = function() + require("kide.core.layz_load").async_load("nvim-dap-virtual-text") + end, config = function() require("kide.plugins.config.nvim-dap") require("kide.dap") @@ -452,6 +458,7 @@ require("packer").startup({ -- 搜索插件 use({ "nvim-telescope/telescope.nvim", + opt = true, module = "telescope", wants = "gruvbox.nvim", after = "gruvbox.nvim", @@ -483,14 +490,22 @@ require("packer").startup({ require("telescope").load_extension("fzf") end, }) - use({ "nvim-telescope/telescope-dap.nvim" }) + use({ + "nvim-telescope/telescope-dap.nvim", + after = "telescope.nvim", + opt = true, + }) -- use 'GustavoKatel/telescope-asynctasks.nvim' -- use 'aloussase/telescope-gradle.nvim' -- use 'aloussase/telescope-mvnsearch' use({ "LinArcX/telescope-env.nvim", + opt = true, after = "telescope.nvim", + setup = function() + require("kide.core.layz_load").async_load("telescope-env.nvim") + end, config = function() require("telescope").load_extension("env") end, diff --git a/lua/kide/theme/gruvbox.lua b/lua/kide/theme/gruvbox.lua index 4bd9d8ea..4262e001 100644 --- a/lua/kide/theme/gruvbox.lua +++ b/lua/kide/theme/gruvbox.lua @@ -1,12 +1,68 @@ -local colors = require("gruvbox.palette") -return { +local M = {} +local colors = { white = "#ebdbb2", darker_black = "#232323", black = "#282828", black2 = "#2e2e2e", black3 = "#313131", grey = "#464646", - red = colors.bright_red, - green = colors.bright_green, - yellow = colors.bright_yellow, + red = "#fb4934", + green = "#b8bb26", + yellow = "#fabd2f", } +M.colors = colors +M.flat_telescope = { + + TelescopeBorder = { + fg = colors.darker_black, + bg = colors.darker_black, + }, + + TelescopePromptTitle = { + fg = colors.black, + bg = colors.red, + }, + TelescopePromptPrefix = { + fg = colors.red, + bg = colors.darker_black, + }, + TelescopePromptBorder = { + fg = colors.darker_black, + bg = colors.darker_black, + }, + TelescopePromptNormal = { + fg = colors.white, + bg = colors.darker_black, + }, + + TelescopeResultsTitle = { + fg = colors.black2, + bg = colors.black2, + }, + TelescopeResultsBorder = { + fg = colors.black2, + bg = colors.black2, + }, + TelescopeResultsNormal = { + fg = colors.white, + bg = colors.black2, + }, + + TelescopeNormal = { bg = colors.darker_black }, + + TelescopePreviewTitle = { + fg = colors.black3, + bg = colors.green, + }, + TelescopePreviewBorder = { + fg = colors.black3, + bg = colors.black3, + }, + TelescopePreviewNormal = { + fg = colors.white, + bg = colors.black3, + }, + + TelescopeSelection = { bg = colors.black2, fg = colors.yellow }, +} +return M diff --git a/lua/kide/theme/telescope.lua b/lua/kide/theme/telescope.lua deleted file mode 100644 index 04ecd523..00000000 --- a/lua/kide/theme/telescope.lua +++ /dev/null @@ -1,55 +0,0 @@ -local colors = require("kide.theme.gruvbox") -return { - - TelescopeBorder = { - fg = colors.darker_black, - bg = colors.darker_black, - }, - - TelescopePromptTitle = { - fg = colors.black, - bg = colors.red, - }, - TelescopePromptPrefix = { - fg = colors.red, - bg = colors.darker_black, - }, - TelescopePromptBorder = { - fg = colors.darker_black, - bg = colors.darker_black, - }, - TelescopePromptNormal = { - fg = colors.white, - bg = colors.darker_black, - }, - - TelescopeResultsTitle = { - fg = colors.black2, - bg = colors.black2, - }, - TelescopeResultsBorder = { - fg = colors.black2, - bg = colors.black2, - }, - TelescopeResultsNormal = { - fg = colors.white, - bg = colors.black2, - }, - - TelescopeNormal = { bg = colors.darker_black }, - - TelescopePreviewTitle = { - fg = colors.black3, - bg = colors.green, - }, - TelescopePreviewBorder = { - fg = colors.black3, - bg = colors.black3, - }, - TelescopePreviewNormal = { - fg = colors.white, - bg = colors.black3, - }, - - TelescopeSelection = { bg = colors.black2, fg = colors.yellow }, -} From 75bc95ec37cca885142943172664bb3d02d62236 Mon Sep 17 00:00:00 2001 From: luokai Date: Wed, 20 Jul 2022 22:10:34 +0800 Subject: [PATCH 0364/1278] =?UTF-8?q?=E7=AE=80=E5=8C=96=E9=85=8D=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- init.lua | 6 ------ lua/kide/plugins/init.lua | 2 -- 2 files changed, 8 deletions(-) diff --git a/init.lua b/init.lua index 34b9ed02..e7ae4853 100644 --- a/init.lua +++ b/init.lua @@ -1,9 +1,3 @@ -- math.randomseed(os.time()) -local present, impatient = pcall(require, "impatient") - -if present then - impatient.enable_profile() -end - require("kide.core") require("kide.plugins") diff --git a/lua/kide/plugins/init.lua b/lua/kide/plugins/init.lua index 68bad9c8..a19ddd9c 100644 --- a/lua/kide/plugins/init.lua +++ b/lua/kide/plugins/init.lua @@ -9,8 +9,6 @@ require("packer").startup({ "nvim-lua/plenary.nvim", module = "plenary", }) - use({ "lewis6991/impatient.nvim" }) - use({ "nathom/filetype.nvim" }) use({ "kyazdani42/nvim-web-devicons", From a0b2d938a4778ee00c82a36ce054bfc482bd15a2 Mon Sep 17 00:00:00 2001 From: luokai Date: Wed, 20 Jul 2022 22:17:43 +0800 Subject: [PATCH 0365/1278] Debug ui --- lua/kide/plugins/config/bufferline.lua | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/lua/kide/plugins/config/bufferline.lua b/lua/kide/plugins/config/bufferline.lua index c354f995..044b635d 100644 --- a/lua/kide/plugins/config/bufferline.lua +++ b/lua/kide/plugins/config/bufferline.lua @@ -50,6 +50,13 @@ require("bufferline").setup({ highlight = "Directory", text_align = "left", }, + { + filetype = "dapui_watches", + text = "Debug", + padding = 1, + highlight = "Directory", + text_align = "left", + }, { filetype = "dbui", text = "Databases", From d9a2055dd31c17563e4c8c95c9e1686d315d0074 Mon Sep 17 00:00:00 2001 From: luokai Date: Wed, 20 Jul 2022 22:39:06 +0800 Subject: [PATCH 0366/1278] auto setup_dap_main_class_configs --- lua/kide/lsp/java.lua | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/lua/kide/lsp/java.lua b/lua/kide/lsp/java.lua index 7a132e43..de469b02 100644 --- a/lua/kide/lsp/java.lua +++ b/lua/kide/lsp/java.lua @@ -277,6 +277,14 @@ M.setup = function() create_command(bufnr, "OR", require("jdtls").organize_imports, { nargs = 0, }) + local dt = vim.g.jdtls_dap_main_class_config_time or 0 + vim.defer_fn(function() + if vim.g.jdtls_dap_main_class_config_time then + require("jdtls.dap").setup_dap_main_class_configs() + end + vim.g.jdtls_dap_main_class_config_time = 200 + end, dt) + -- vim.notify(vim.api.nvim_buf_get_name(bufnr), vim.log.levels.INFO) end From df0248fa7cb6ebb3dab03bccf356b33084f07e17 Mon Sep 17 00:00:00 2001 From: luokai Date: Thu, 21 Jul 2022 00:17:59 +0800 Subject: [PATCH 0367/1278] mouse=a --- lua/kide/core/basic.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lua/kide/core/basic.lua b/lua/kide/core/basic.lua index d80e27d4..b4f5e73b 100644 --- a/lua/kide/core/basic.lua +++ b/lua/kide/core/basic.lua @@ -90,7 +90,7 @@ vim.cmd([[ " 始终显示符号列 set signcolumn=yes " set signcolumn=number -set mouse=n +set mouse=a if exists('g:neovide') " let g:neovide_refresh_rate=60 let g:neovide_cursor_vfx_mode = "railgun" From f17908e3e3cb859e6917d8e63d85689f2eaa0229 Mon Sep 17 00:00:00 2001 From: luokai Date: Thu, 21 Jul 2022 00:27:42 +0800 Subject: [PATCH 0368/1278] =?UTF-8?q?=E6=8C=89=E9=9C=80=E5=8A=A0=E8=BD=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lua/kide/plugins/init.lua | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/lua/kide/plugins/init.lua b/lua/kide/plugins/init.lua index a19ddd9c..47fce409 100644 --- a/lua/kide/plugins/init.lua +++ b/lua/kide/plugins/init.lua @@ -40,6 +40,7 @@ require("packer").startup({ -- nvim-cmp use({ "hrsh7th/nvim-cmp", + module = "cmp", after = "friendly-snippets", }) -- LuaSnip @@ -574,9 +575,9 @@ require("packer").startup({ use({ "itchyny/calendar.vim", opt = true, - setup = function() - require("kide.core.layz_load").async_load("calendar.vim") - end, + cmd = { + "Calendar", + }, }) -- rust From b2b4a7e5c21b008bf6c3e2040d550ed917a7465c Mon Sep 17 00:00:00 2001 From: luokai Date: Thu, 21 Jul 2022 11:38:52 +0800 Subject: [PATCH 0369/1278] del setup_dap_main_class_configs --- lua/kide/lsp/java.lua | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/lua/kide/lsp/java.lua b/lua/kide/lsp/java.lua index de469b02..71a347b3 100644 --- a/lua/kide/lsp/java.lua +++ b/lua/kide/lsp/java.lua @@ -277,13 +277,13 @@ M.setup = function() create_command(bufnr, "OR", require("jdtls").organize_imports, { nargs = 0, }) - local dt = vim.g.jdtls_dap_main_class_config_time or 0 - vim.defer_fn(function() - if vim.g.jdtls_dap_main_class_config_time then - require("jdtls.dap").setup_dap_main_class_configs() - end - vim.g.jdtls_dap_main_class_config_time = 200 - end, dt) + -- local dt = vim.g.jdtls_dap_main_class_config_time or 0 + -- vim.defer_fn(function() + -- if vim.g.jdtls_dap_main_class_config_time then + -- require("jdtls.dap").setup_dap_main_class_configs() + -- end + -- vim.g.jdtls_dap_main_class_config_time = 200 + -- end, dt) -- vim.notify(vim.api.nvim_buf_get_name(bufnr), vim.log.levels.INFO) end From 025086d575b45497dfd40b81ba981bd2fb328cca Mon Sep 17 00:00:00 2001 From: luokai Date: Thu, 21 Jul 2022 13:40:37 +0800 Subject: [PATCH 0370/1278] update hop --- lua/kide/core/keybindings.lua | 5 ++++- lua/kide/plugins/init.lua | 2 +- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/lua/kide/core/keybindings.lua b/lua/kide/core/keybindings.lua index e5ec7d18..c98a61c0 100644 --- a/lua/kide/core/keybindings.lua +++ b/lua/kide/core/keybindings.lua @@ -243,7 +243,10 @@ M.cmp = function(cmp) [""] = cmp.mapping.select_prev_item(), [""] = cmp.mapping.select_next_item(), [""] = cmp.mapping.complete(), - [""] = cmp.mapping.close(), + [""] = cmp.mapping({ + i = cmp.mapping.abort(), + c = cmp.mapping.close(), + }), [""] = cmp.mapping.confirm({ behavior = cmp.ConfirmBehavior.Replace, -- select = true, diff --git a/lua/kide/plugins/init.lua b/lua/kide/plugins/init.lua index 47fce409..edda80d8 100644 --- a/lua/kide/plugins/init.lua +++ b/lua/kide/plugins/init.lua @@ -625,7 +625,7 @@ require("packer").startup({ use({ "phaazon/hop.nvim", opt = true, - branch = "v1", + branch = "v2", setup = function() -- on_file_open("hop.nvim") require("kide.core.layz_load").async_load("hop.nvim") From 9445ad0a78819f7598780b22b950be30cbce21e9 Mon Sep 17 00:00:00 2001 From: luokai Date: Thu, 21 Jul 2022 18:16:29 +0800 Subject: [PATCH 0371/1278] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E8=B7=AF=E5=BE=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lua/kide/core/utils/init.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lua/kide/core/utils/init.lua b/lua/kide/core/utils/init.lua index 201928eb..9fc91160 100644 --- a/lua/kide/core/utils/init.lua +++ b/lua/kide/core/utils/init.lua @@ -152,7 +152,7 @@ M.camel_case_init = function() " command! -complete=customlist,coreutils#cmdline#complete -nargs=* -bang -range command! -nargs=* -range \ CamelCase - \ lua require('core.utils').camel_case_start(, , ) + \ lua require('kide.core.utils').camel_case_start(, , ) ]]) end -- print(M.camel_case("helloWorldAaAaAxC")) From 3248d4abe89be5b9b693ef6e7824f2f69723ccc6 Mon Sep 17 00:00:00 2001 From: luokai Date: Fri, 22 Jul 2022 09:47:08 +0800 Subject: [PATCH 0372/1278] go fmt --- lua/kide/lsp/utils/init.lua | 3 +++ lua/kide/plugins/config/null-ls.lua | 1 + 2 files changed, 4 insertions(+) diff --git a/lua/kide/lsp/utils/init.lua b/lua/kide/lsp/utils/init.lua index 022a1588..08d7a4e4 100644 --- a/lua/kide/lsp/utils/init.lua +++ b/lua/kide/lsp/utils/init.lua @@ -53,6 +53,9 @@ format_lsp_mapping["rust"] = "null-ls" format_lsp_mapping["http"] = "null-ls" +-- gofmt +format_lsp_mapping["go"] = "null-ls" + M.filter_format_lsp_client = function(client, bufnr) local filetype = vim.api.nvim_buf_get_option(bufnr, "filetype") local cn = format_lsp_mapping[filetype] diff --git a/lua/kide/plugins/config/null-ls.lua b/lua/kide/plugins/config/null-ls.lua index f708255d..da67b456 100644 --- a/lua/kide/plugins/config/null-ls.lua +++ b/lua/kide/plugins/config/null-ls.lua @@ -55,6 +55,7 @@ local sources = { -- method = null_ls.methods.DIAGNOSTICS_ON_SAVE, -- extra_args = { "--config", "p/java" }, -- }), + null_ls.builtins.formatting.gofmt, } local lsp_formatting = function(bufnr) From 8ace66b625647befb1021dd50d9929edfbb10308 Mon Sep 17 00:00:00 2001 From: luokai Date: Fri, 22 Jul 2022 12:48:27 +0800 Subject: [PATCH 0373/1278] =?UTF-8?q?java=20=E6=8F=92=E4=BB=B6=E5=A4=9A?= =?UTF-8?q?=E7=89=88=E6=9C=AC=E6=83=85=E5=86=B5=E9=80=89=E6=8B=A9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lua/kide/lsp/java.lua | 37 +++++++++++++++++++++++-------------- 1 file changed, 23 insertions(+), 14 deletions(-) diff --git a/lua/kide/lsp/java.lua b/lua/kide/lsp/java.lua index 71a347b3..72ff9e98 100644 --- a/lua/kide/lsp/java.lua +++ b/lua/kide/lsp/java.lua @@ -53,15 +53,24 @@ local _config = (function() end end)() +local function find_one(v) + if type(v) == "string" then + return vim.split(v, "\n")[1] + elseif type(v) == "table" then + return v[1] + end + return v +end + M.setup = function() local project_name = vim.fn.fnamemodify(vim.fn.getcwd(), ":p:h:t") local workspace_dir = get_jdtls_workspace() .. project_name + local jdtls_path = find_one(vim.fn.glob(get_vscode_extensions() .. "/redhat.java-*/server")) - local jdtls_launcher = vim.fn.glob( - get_vscode_extensions() .. "/redhat.java-*/server/plugins/org.eclipse.equinox.launcher_*.jar" - ) - local jdtls_config = vim.fn.glob(get_vscode_extensions() .. "/redhat.java-*/server/" .. _config) + local jdtls_launcher = vim.fn.glob(jdtls_path .. "/plugins/org.eclipse.equinox.launcher_*.jar") + + local jdtls_config = vim.fn.glob(jdtls_path .. "/" .. _config) -- vim.notify("SETUP: " .. vim.api.nvim_buf_get_name(vim.api.nvim_get_current_buf()), vim.log.levels.INFO) -- See `:help vim.lsp.start_client` for an overview of the supported `config` options. @@ -225,26 +234,26 @@ M.setup = function() -- }, } + local bundles = {} -- This bundles definition is the same as in the previous section (java-debug installation) - local bundles = { - vim.fn.glob(get_vscode_extensions() .. "/vscjava.vscode-java-debug-*/server/com.microsoft.java.debug.plugin-*.jar"), - } + local vscode_java_debug_path = find_one(vim.fn.glob(get_vscode_extensions() .. "/vscjava.vscode-java-debug-*/server")) + vim.list_extend( + bundles, + vim.split(vim.fn.glob(vscode_java_debug_path .. "/com.microsoft.java.debug.plugin-*.jar"), "\n") + ) -- /opt/software/lsp/java/vscode-java-test/server -- vim.list_extend(bundles, vim.split(vim.fn.glob("/opt/software/lsp/java/vscode-java-test/server/*.jar"), "\n")); - for _, bundle in - ipairs(vim.split(vim.fn.glob(get_vscode_extensions() .. "/vscjava.vscode-java-test-*/server/*.jar"), "\n")) - do + local vscode_java_test_path = find_one(vim.fn.glob(get_vscode_extensions() .. "/vscjava.vscode-java-test-*/server")) + for _, bundle in ipairs(vim.split(vim.fn.glob(vscode_java_test_path .. "/*.jar"), "\n")) do if not vim.endswith(bundle, "com.microsoft.java.test.runner-jar-with-dependencies.jar") then table.insert(bundles, bundle) end end -- /opt/software/lsp/java/vscode-java-decompiler/server/ - vim.list_extend( - bundles, - vim.split(vim.fn.glob(get_vscode_extensions() .. "/dgileadi.java-decompiler-*/server/*.jar"), "\n") - ) + local java_decoompiler_path = find_one(vim.fn.glob(get_vscode_extensions() .. "/dgileadi.java-decompiler-*/server")) + vim.list_extend(bundles, vim.split(vim.fn.glob(java_decoompiler_path .. "/*.jar"), "\n")) -- /opt/software/lsp/java/vscode-java-dependency/jdtls.ext/ -- vim.list_extend(bundles, vim.split(vim.fn.glob("/opt/software/lsp/java/vscode-java-dependency/jdtls.ext/com.microsoft.jdtls.ext.core/target/com.microsoft.jdtls.ext.core-*.jar"), "\n")); From c2e8500cd7c5e4040fe0ddea51b41a55897bd777 Mon Sep 17 00:00:00 2001 From: luokai Date: Fri, 22 Jul 2022 13:01:04 +0800 Subject: [PATCH 0374/1278] opt true --- lua/kide/plugins/init.lua | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lua/kide/plugins/init.lua b/lua/kide/plugins/init.lua index edda80d8..810928ff 100644 --- a/lua/kide/plugins/init.lua +++ b/lua/kide/plugins/init.lua @@ -8,11 +8,13 @@ require("packer").startup({ use({ "nvim-lua/plenary.nvim", module = "plenary", + opt = true, }) use({ "kyazdani42/nvim-web-devicons", module = "nvim-web-devicons", + opt = true, }) use({ "williamboman/nvim-lsp-installer", From 42ddc2a3451b60c27067b0d7767620b7fb208ef8 Mon Sep 17 00:00:00 2001 From: luokai Date: Sat, 23 Jul 2022 13:29:51 +0800 Subject: [PATCH 0375/1278] lua config --- lua/kide/core/basic.lua | 23 ++++++++++++++--------- lua/kide/plugins/config/gruvbox.lua | 13 ++----------- 2 files changed, 16 insertions(+), 20 deletions(-) diff --git a/lua/kide/core/basic.lua b/lua/kide/core/basic.lua index b4f5e73b..dea21d9e 100644 --- a/lua/kide/core/basic.lua +++ b/lua/kide/core/basic.lua @@ -4,8 +4,10 @@ vim.opt.title = true vim.opt.clipboard = "unnamedplus" -- 行号 -vim.wo.number = true -vim.wo.relativenumber = true +vim.opt.number = true +vim.opt.relativenumber = true +vim.opt.numberwidth = 2 +vim.opt.ruler = false -- 高亮所在行 vim.wo.cursorline = true @@ -66,15 +68,14 @@ vim.o.backup = false vim.o.writebackup = false vim.o.swapfile = false -- smaller updatetime -vim.o.updatetime = 300 +vim.o.updatetime = 240 -- split window 从下边和右边出现 vim.o.splitbelow = false vim.o.splitright = true -- 样式 -vim.o.background = "dark" -vim.o.termguicolors = true +vim.opt.background = "dark" vim.opt.termguicolors = true -- 补全增强 @@ -86,11 +87,15 @@ vim.opt.confirm = true vim.g.python3_host_prog = "/opt/homebrew/bin/python3" vim.opt.list = true +vim.opt.cul = true -- cursor line + +vim.opt.timeoutlen = 400 + +-- 始终显示符号列 +vim.opt.signcolumn = "yes" +vim.opt.mouse = "a" + vim.cmd([[ -" 始终显示符号列 -set signcolumn=yes -" set signcolumn=number -set mouse=a if exists('g:neovide') " let g:neovide_refresh_rate=60 let g:neovide_cursor_vfx_mode = "railgun" diff --git a/lua/kide/plugins/config/gruvbox.lua b/lua/kide/plugins/config/gruvbox.lua index 958b453d..05d66c2a 100644 --- a/lua/kide/plugins/config/gruvbox.lua +++ b/lua/kide/plugins/config/gruvbox.lua @@ -25,14 +25,5 @@ require("gruvbox").setup({ overrides = overrides, }) --- vim.api.nvim_command('colorscheme gruvbox') -vim.cmd([[ -set background=dark -" g:gruvbox_contrast_dark=hard -" set background=light -" g:gruvbox_contrast_light=medium -colorscheme gruvbox -" 丢失配色, 变为透明 -" highlight Normal guibg=NONE ctermbg=None -" autocmd vimenter * hi Normal guibg=#282828 -]]) +vim.opt.background = "dark" +vim.cmd.colorscheme("gruvbox") From b336fc4c84fd58b7ef3dd5f4c1ec2c4cb6d0df87 Mon Sep 17 00:00:00 2001 From: luokai Date: Sat, 23 Jul 2022 15:56:24 +0800 Subject: [PATCH 0376/1278] lua config --- lua/kide/core/basic.lua | 40 ++++++++++++++++++++++++++++++---------- 1 file changed, 30 insertions(+), 10 deletions(-) diff --git a/lua/kide/core/basic.lua b/lua/kide/core/basic.lua index dea21d9e..52f00682 100644 --- a/lua/kide/core/basic.lua +++ b/lua/kide/core/basic.lua @@ -38,16 +38,36 @@ vim.o.softtabstop = 4 vim.o.shiftwidth = 4 vim.bo.shiftwidth = 4 -vim.cmd("autocmd Filetype lua setlocal ts=2 sw=2 expandtab") -vim.cmd("autocmd Filetype js setlocal ts=2 sw=2 expandtab") -vim.cmd("autocmd Filetype javascript setlocal ts=2 sw=2 expandtab") -vim.cmd("autocmd Filetype json setlocal ts=2 sw=2 expandtab") -vim.cmd("autocmd Filetype css setlocal ts=2 sw=2 expandtab") -vim.cmd("autocmd Filetype html setlocal ts=2 sw=2 expandtab") -vim.cmd("autocmd Filetype xml setlocal ts=2 sw=2 expandtab") -vim.cmd("autocmd Filetype yaml setlocal ts=2 sw=2 expandtab") -vim.cmd("autocmd Filetype http setlocal ts=2 sw=2 expandtab") -vim.cmd("autocmd Filetype markdown setlocal ts=2 sw=2 expandtab") +local autocmd = vim.api.nvim_create_autocmd +autocmd("FileType", { + pattern = { + "lua", + "javascript", + "json", + "css", + "html", + "xml", + "yaml", + "http", + "markdown", + }, + callback = function() + vim.opt_local.tabstop = 2 + vim.opt_local.shiftwidth = 2 + vim.opt_local.expandtab = true + end, +}) + +-- vim.cmd("autocmd Filetype lua setlocal ts=2 sw=2 expandtab") +-- vim.cmd("autocmd Filetype js setlocal ts=2 sw=2 expandtab") +-- vim.cmd("autocmd Filetype javascript setlocal ts=2 sw=2 expandtab") +-- vim.cmd("autocmd Filetype json setlocal ts=2 sw=2 expandtab") +-- vim.cmd("autocmd Filetype css setlocal ts=2 sw=2 expandtab") +-- vim.cmd("autocmd Filetype html setlocal ts=2 sw=2 expandtab") +-- vim.cmd("autocmd Filetype xml setlocal ts=2 sw=2 expandtab") +-- vim.cmd("autocmd Filetype yaml setlocal ts=2 sw=2 expandtab") +-- vim.cmd("autocmd Filetype http setlocal ts=2 sw=2 expandtab") +-- vim.cmd("autocmd Filetype markdown setlocal ts=2 sw=2 expandtab") -- 新行对齐当前行,空格替代tab vim.o.expandtab = true From 8fb861071390d537d8c04a8762883586a1582dca Mon Sep 17 00:00:00 2001 From: luokai Date: Sun, 24 Jul 2022 10:09:04 +0800 Subject: [PATCH 0377/1278] update config --- lua/kide/core/basic.lua | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lua/kide/core/basic.lua b/lua/kide/core/basic.lua index 52f00682..15d2153d 100644 --- a/lua/kide/core/basic.lua +++ b/lua/kide/core/basic.lua @@ -88,7 +88,7 @@ vim.o.backup = false vim.o.writebackup = false vim.o.swapfile = false -- smaller updatetime -vim.o.updatetime = 240 +vim.o.updatetime = 300 -- split window 从下边和右边出现 vim.o.splitbelow = false @@ -109,7 +109,7 @@ vim.g.python3_host_prog = "/opt/homebrew/bin/python3" vim.opt.list = true vim.opt.cul = true -- cursor line -vim.opt.timeoutlen = 400 +vim.opt.timeoutlen = 250 -- 始终显示符号列 vim.opt.signcolumn = "yes" From 3623489f61e2b367b97f6ee8c33847f41e193075 Mon Sep 17 00:00:00 2001 From: luokai Date: Mon, 25 Jul 2022 11:09:14 +0800 Subject: [PATCH 0378/1278] typescript --- lua/kide/plugins/config/nvim-treesitter.lua | 1 + 1 file changed, 1 insertion(+) diff --git a/lua/kide/plugins/config/nvim-treesitter.lua b/lua/kide/plugins/config/nvim-treesitter.lua index 81cb94f1..6fb180ae 100644 --- a/lua/kide/plugins/config/nvim-treesitter.lua +++ b/lua/kide/plugins/config/nvim-treesitter.lua @@ -4,6 +4,7 @@ require("nvim-treesitter.configs").setup({ "lua", "java", "javascript", + "typescript", "html", "css", "c", From e5fca1f4df1919c39af9eaf86960f7b225f186d8 Mon Sep 17 00:00:00 2001 From: luokai Date: Mon, 1 Aug 2022 18:10:43 +0800 Subject: [PATCH 0379/1278] update --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index b1966a79..2b1ec7c8 100644 --- a/README.md +++ b/README.md @@ -51,7 +51,7 @@ git clone https://github.com/JavaHello/nvim.git [NVIM 打造 Java IDE](https://javahello.github.io/dev/tools/NVIM-LSP-Java-IDE-vscode.html) 更新了配置,全部使用 vscode 扩展,简化安装步骤。 -如果使用长时间后感觉卡顿,关闭下所有`buffer`, `:%bw` 。 +如果使用长时间后感觉卡顿,关闭下所有`buffer`, `:%bw`(当前会导致诊断列表不可用,正在修复中[neovim/issues/19322](https://github.com/neovim/neovim/issues/19322)) 。 ### 功能演示 From 05d3bc3c07e138793455f5f1fe59191b2cce2da3 Mon Sep 17 00:00:00 2001 From: luokai Date: Thu, 4 Aug 2022 09:14:48 +0800 Subject: [PATCH 0380/1278] Outline --- ftplugin/ftplugin/Outline.lua | 1 + 1 file changed, 1 insertion(+) create mode 100644 ftplugin/ftplugin/Outline.lua diff --git a/ftplugin/ftplugin/Outline.lua b/ftplugin/ftplugin/Outline.lua new file mode 100644 index 00000000..9fd021a8 --- /dev/null +++ b/ftplugin/ftplugin/Outline.lua @@ -0,0 +1 @@ +vim.opt_local.signcolumn = "no" From 7187b6c6e1d54e72387daa6d7e6c2e1b9862565d Mon Sep 17 00:00:00 2001 From: luokai Date: Thu, 4 Aug 2022 09:15:29 +0800 Subject: [PATCH 0381/1278] del --- ftplugin/ftplugin/Outline.lua | 1 - 1 file changed, 1 deletion(-) delete mode 100644 ftplugin/ftplugin/Outline.lua diff --git a/ftplugin/ftplugin/Outline.lua b/ftplugin/ftplugin/Outline.lua deleted file mode 100644 index 9fd021a8..00000000 --- a/ftplugin/ftplugin/Outline.lua +++ /dev/null @@ -1 +0,0 @@ -vim.opt_local.signcolumn = "no" From 51a7186e732f5f3e7a1f082b84a5a763683f8c60 Mon Sep 17 00:00:00 2001 From: luokai Date: Thu, 4 Aug 2022 09:16:14 +0800 Subject: [PATCH 0382/1278] # On branch nvim-lsp # Your branch is up to date with 'origin/nvim-lsp'. # # Changes to be committed: # (use "git restore --staged ..." to unstage) # modified: lua/kide/lsp/java.lua --- lua/kide/lsp/java.lua | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/lua/kide/lsp/java.lua b/lua/kide/lsp/java.lua index 72ff9e98..b1e93b32 100644 --- a/lua/kide/lsp/java.lua +++ b/lua/kide/lsp/java.lua @@ -257,6 +257,9 @@ M.setup = function() -- /opt/software/lsp/java/vscode-java-dependency/jdtls.ext/ -- vim.list_extend(bundles, vim.split(vim.fn.glob("/opt/software/lsp/java/vscode-java-dependency/jdtls.ext/com.microsoft.jdtls.ext.core/target/com.microsoft.jdtls.ext.core-*.jar"), "\n")); + -- /opt/software/lsp/java/vscode-java-dependency/server/ + local java_dependency_path = find_one(vim.fn.glob(get_vscode_extensions() .. "/vscjava.vscode-java-dependency-*/server")) + vim.list_extend(bundles, vim.split(vim.fn.glob(java_dependency_path .. "/*.jar"), "\n")) local jdtls = require("jdtls") @@ -313,7 +316,7 @@ M.setup = function() end M.init = function() - local group = vim.api.nvim_create_augroup("jdtls_java", { clear = true }) + local group = vim.api.nvim_create_augroup("kide_jdtls_java", { clear = true }) vim.api.nvim_create_autocmd({ "FileType" }, { group = group, pattern = { "java" }, From a2617f52fbfd57d63943c5304954383bc6915f4c Mon Sep 17 00:00:00 2001 From: luokai Date: Sun, 7 Aug 2022 11:24:29 +0800 Subject: [PATCH 0383/1278] =?UTF-8?q?=E5=8F=AA=E5=8A=A0=E8=BD=BD=E4=B8=80?= =?UTF-8?q?=E6=AC=A1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lua/kide/lsp/java.lua | 67 ++++++++++++++++++++++--------------------- 1 file changed, 34 insertions(+), 33 deletions(-) diff --git a/lua/kide/lsp/java.lua b/lua/kide/lsp/java.lua index b1e93b32..5ea43cb1 100644 --- a/lua/kide/lsp/java.lua +++ b/lua/kide/lsp/java.lua @@ -61,17 +61,45 @@ local function find_one(v) end return v end +local project_name = vim.fn.fnamemodify(vim.fn.getcwd(), ":p:h:t") -M.setup = function() - local project_name = vim.fn.fnamemodify(vim.fn.getcwd(), ":p:h:t") +local workspace_dir = get_jdtls_workspace() .. project_name +local jdtls_path = find_one(vim.fn.glob(get_vscode_extensions() .. "/redhat.java-*/server")) + +local jdtls_launcher = vim.fn.glob(jdtls_path .. "/plugins/org.eclipse.equinox.launcher_*.jar") - local workspace_dir = get_jdtls_workspace() .. project_name - local jdtls_path = find_one(vim.fn.glob(get_vscode_extensions() .. "/redhat.java-*/server")) +local jdtls_config = vim.fn.glob(jdtls_path .. "/" .. _config) - local jdtls_launcher = vim.fn.glob(jdtls_path .. "/plugins/org.eclipse.equinox.launcher_*.jar") +local bundles = {} +-- This bundles definition is the same as in the previous section (java-debug installation) +local vscode_java_debug_path = find_one(vim.fn.glob(get_vscode_extensions() .. "/vscjava.vscode-java-debug-*/server")) +vim.list_extend( + bundles, + vim.split(vim.fn.glob(vscode_java_debug_path .. "/com.microsoft.java.debug.plugin-*.jar"), "\n") +) - local jdtls_config = vim.fn.glob(jdtls_path .. "/" .. _config) +-- /opt/software/lsp/java/vscode-java-test/server +-- vim.list_extend(bundles, vim.split(vim.fn.glob("/opt/software/lsp/java/vscode-java-test/server/*.jar"), "\n")); +local vscode_java_test_path = find_one(vim.fn.glob(get_vscode_extensions() .. "/vscjava.vscode-java-test-*/server")) +for _, bundle in ipairs(vim.split(vim.fn.glob(vscode_java_test_path .. "/*.jar"), "\n")) do + if not vim.endswith(bundle, "com.microsoft.java.test.runner-jar-with-dependencies.jar") then + table.insert(bundles, bundle) + end +end +-- /opt/software/lsp/java/vscode-java-decompiler/server/ +local java_decoompiler_path = find_one(vim.fn.glob(get_vscode_extensions() .. "/dgileadi.java-decompiler-*/server")) +vim.list_extend(bundles, vim.split(vim.fn.glob(java_decoompiler_path .. "/*.jar"), "\n")) + +-- /opt/software/lsp/java/vscode-java-dependency/jdtls.ext/ +-- vim.list_extend(bundles, vim.split(vim.fn.glob("/opt/software/lsp/java/vscode-java-dependency/jdtls.ext/com.microsoft.jdtls.ext.core/target/com.microsoft.jdtls.ext.core-*.jar"), "\n")); +-- /opt/software/lsp/java/vscode-java-dependency/server/ +local java_dependency_path = find_one( + vim.fn.glob(get_vscode_extensions() .. "/vscjava.vscode-java-dependency-*/server") +) +vim.list_extend(bundles, vim.split(vim.fn.glob(java_dependency_path .. "/*.jar"), "\n")) + +M.setup = function() -- vim.notify("SETUP: " .. vim.api.nvim_buf_get_name(vim.api.nvim_get_current_buf()), vim.log.levels.INFO) -- See `:help vim.lsp.start_client` for an overview of the supported `config` options. local config = { @@ -234,33 +262,6 @@ M.setup = function() -- }, } - local bundles = {} - -- This bundles definition is the same as in the previous section (java-debug installation) - local vscode_java_debug_path = find_one(vim.fn.glob(get_vscode_extensions() .. "/vscjava.vscode-java-debug-*/server")) - vim.list_extend( - bundles, - vim.split(vim.fn.glob(vscode_java_debug_path .. "/com.microsoft.java.debug.plugin-*.jar"), "\n") - ) - - -- /opt/software/lsp/java/vscode-java-test/server - -- vim.list_extend(bundles, vim.split(vim.fn.glob("/opt/software/lsp/java/vscode-java-test/server/*.jar"), "\n")); - local vscode_java_test_path = find_one(vim.fn.glob(get_vscode_extensions() .. "/vscjava.vscode-java-test-*/server")) - for _, bundle in ipairs(vim.split(vim.fn.glob(vscode_java_test_path .. "/*.jar"), "\n")) do - if not vim.endswith(bundle, "com.microsoft.java.test.runner-jar-with-dependencies.jar") then - table.insert(bundles, bundle) - end - end - - -- /opt/software/lsp/java/vscode-java-decompiler/server/ - local java_decoompiler_path = find_one(vim.fn.glob(get_vscode_extensions() .. "/dgileadi.java-decompiler-*/server")) - vim.list_extend(bundles, vim.split(vim.fn.glob(java_decoompiler_path .. "/*.jar"), "\n")) - - -- /opt/software/lsp/java/vscode-java-dependency/jdtls.ext/ - -- vim.list_extend(bundles, vim.split(vim.fn.glob("/opt/software/lsp/java/vscode-java-dependency/jdtls.ext/com.microsoft.jdtls.ext.core/target/com.microsoft.jdtls.ext.core-*.jar"), "\n")); - -- /opt/software/lsp/java/vscode-java-dependency/server/ - local java_dependency_path = find_one(vim.fn.glob(get_vscode_extensions() .. "/vscjava.vscode-java-dependency-*/server")) - vim.list_extend(bundles, vim.split(vim.fn.glob(java_dependency_path .. "/*.jar"), "\n")) - local jdtls = require("jdtls") local extendedClientCapabilities = jdtls.extendedClientCapabilities From e12f46cab42c9bcab6b20749042fce4b3b2ac9b6 Mon Sep 17 00:00:00 2001 From: luokai Date: Sun, 7 Aug 2022 11:33:30 +0800 Subject: [PATCH 0384/1278] root_dir --- lua/kide/lsp/java.lua | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lua/kide/lsp/java.lua b/lua/kide/lsp/java.lua index 5ea43cb1..1af3e957 100644 --- a/lua/kide/lsp/java.lua +++ b/lua/kide/lsp/java.lua @@ -99,6 +99,8 @@ local java_dependency_path = find_one( ) vim.list_extend(bundles, vim.split(vim.fn.glob(java_dependency_path .. "/*.jar"), "\n")) +local root_dir = require("jdtls.setup").find_root({ ".git", "mvnw", "gradlew" }) + M.setup = function() -- vim.notify("SETUP: " .. vim.api.nvim_buf_get_name(vim.api.nvim_get_current_buf()), vim.log.levels.INFO) -- See `:help vim.lsp.start_client` for an overview of the supported `config` options. @@ -144,7 +146,7 @@ M.setup = function() -- 💀 -- This is the default if not provided, you can remove it. Or adjust as needed. -- One dedicated LSP server & client will be started per unique root_dir - root_dir = require("jdtls.setup").find_root({ ".git", "mvnw", "gradlew" }), + root_dir = root_dir, -- Here you can configure eclipse.jdt.ls specific settings -- See https://github.com/eclipse/eclipse.jdt.ls/wiki/Running-the-JAVA-LS-server-from-the-command-line#initialize-request From 1c2ba28375f2708daf93b46e003aec4ab35f1fa6 Mon Sep 17 00:00:00 2001 From: luokai Date: Sun, 7 Aug 2022 11:38:45 +0800 Subject: [PATCH 0385/1278] =?UTF-8?q?=E9=85=8D=E7=BD=AE=E7=BC=93=E5=AD=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lua/kide/lsp/java.lua | 380 +++++++++++++++++++++--------------------- 1 file changed, 190 insertions(+), 190 deletions(-) diff --git a/lua/kide/lsp/java.lua b/lua/kide/lsp/java.lua index 1af3e957..476304c3 100644 --- a/lua/kide/lsp/java.lua +++ b/lua/kide/lsp/java.lua @@ -101,220 +101,220 @@ vim.list_extend(bundles, vim.split(vim.fn.glob(java_dependency_path .. "/*.jar") local root_dir = require("jdtls.setup").find_root({ ".git", "mvnw", "gradlew" }) -M.setup = function() - -- vim.notify("SETUP: " .. vim.api.nvim_buf_get_name(vim.api.nvim_get_current_buf()), vim.log.levels.INFO) - -- See `:help vim.lsp.start_client` for an overview of the supported `config` options. - local config = { - -- The command that starts the language server - -- See: https://github.com/eclipse/eclipse.jdt.ls#running-from-the-command-line - cmd = { - get_java(), -- or '/path/to/java11_or_newer/bin/java' - "-Declipse.application=org.eclipse.jdt.ls.core.id1", - "-Dosgi.bundles.defaultStartLevel=4", - "-Declipse.product=org.eclipse.jdt.ls.core.product", - -- "-Dosgi.configuration.cascaded=true", - -- "-Dosgi.sharedConfiguration.area=" .. get_jdtls_home() .. "/config_mac", - -- "-Dosgi.sharedConfiguration.area.readOnly=true", - "-Dlog.protocol=true", - "-Dlog.level=ALL", - "-Dsun.zip.disableMemoryMapping=true", - -- "-noverify", - -- '-XX:+UseParallelGC', - -- '-XX:GCTimeRatio=4', - -- '-XX:AdaptiveSizePolicyWeight=90', - -- '-XX:+UseG1GC', - -- '-XX:+UseStringDeduplication', - -- '-Xms512m', - "-XX:+UseZGC", - "-Xmx4g", - -- "-Xbootclasspath/a:" .. get_lombok_jar(), - "-javaagent:" .. get_lombok_jar(), - "--add-modules=ALL-SYSTEM", - "--add-opens", - "java.base/java.util=ALL-UNNAMED", - "--add-opens", - "java.base/java.lang=ALL-UNNAMED", - "-jar", - jdtls_launcher, - "-configuration", - jdtls_config, - "-data", - workspace_dir, - }, - filetypes = { "java" }, +-- vim.notify("SETUP: " .. vim.api.nvim_buf_get_name(vim.api.nvim_get_current_buf()), vim.log.levels.INFO) +-- See `:help vim.lsp.start_client` for an overview of the supported `config` options. +local config = { + -- The command that starts the language server + -- See: https://github.com/eclipse/eclipse.jdt.ls#running-from-the-command-line + cmd = { + get_java(), -- or '/path/to/java11_or_newer/bin/java' + "-Declipse.application=org.eclipse.jdt.ls.core.id1", + "-Dosgi.bundles.defaultStartLevel=4", + "-Declipse.product=org.eclipse.jdt.ls.core.product", + -- "-Dosgi.configuration.cascaded=true", + -- "-Dosgi.sharedConfiguration.area=" .. get_jdtls_home() .. "/config_mac", + -- "-Dosgi.sharedConfiguration.area.readOnly=true", + "-Dlog.protocol=true", + "-Dlog.level=ALL", + "-Dsun.zip.disableMemoryMapping=true", + -- "-noverify", + -- '-XX:+UseParallelGC', + -- '-XX:GCTimeRatio=4', + -- '-XX:AdaptiveSizePolicyWeight=90', + -- '-XX:+UseG1GC', + -- '-XX:+UseStringDeduplication', + -- '-Xms512m', + "-XX:+UseZGC", + "-Xmx4g", + -- "-Xbootclasspath/a:" .. get_lombok_jar(), + "-javaagent:" .. get_lombok_jar(), + "--add-modules=ALL-SYSTEM", + "--add-opens", + "java.base/java.util=ALL-UNNAMED", + "--add-opens", + "java.base/java.lang=ALL-UNNAMED", + "-jar", + jdtls_launcher, + "-configuration", + jdtls_config, + "-data", + workspace_dir, + }, + filetypes = { "java" }, - -- 💀 - -- This is the default if not provided, you can remove it. Or adjust as needed. - -- One dedicated LSP server & client will be started per unique root_dir - root_dir = root_dir, + -- 💀 + -- This is the default if not provided, you can remove it. Or adjust as needed. + -- One dedicated LSP server & client will be started per unique root_dir + root_dir = root_dir, - -- Here you can configure eclipse.jdt.ls specific settings - -- See https://github.com/eclipse/eclipse.jdt.ls/wiki/Running-the-JAVA-LS-server-from-the-command-line#initialize-request - -- for a list of options - settings = { - java = { - home = get_java_home(), - project = { - resourceFilters = { - "node_modules", - ".git", - ".idea", - }, + -- Here you can configure eclipse.jdt.ls specific settings + -- See https://github.com/eclipse/eclipse.jdt.ls/wiki/Running-the-JAVA-LS-server-from-the-command-line#initialize-request + -- for a list of options + settings = { + java = { + home = get_java_home(), + project = { + resourceFilters = { + "node_modules", + ".git", + ".idea", }, - import = { - exclusions = { - "**/node_modules/**", - "**/.metadata/**", - "**/archetype-resources/**", - "**/META-INF/maven/**", - "**/.git/**", - "**/.idea/**", - }, + }, + import = { + exclusions = { + "**/node_modules/**", + "**/.metadata/**", + "**/archetype-resources/**", + "**/META-INF/maven/**", + "**/.git/**", + "**/.idea/**", }, - -- referenceCodeLens = { enabled = true }, - -- implementationsCodeLens = { enabled = true }, - templates = { - fileHeader = { - "/**", - " * ${type_name}", - " * @author ${user}", - " */", - }, - typeComment = { - "/**", - " * ${type_name}", - " * @author ${user}", - " */", - }, + }, + -- referenceCodeLens = { enabled = true }, + -- implementationsCodeLens = { enabled = true }, + templates = { + fileHeader = { + "/**", + " * ${type_name}", + " * @author ${user}", + " */", }, - eclipse = { - downloadSources = true, + typeComment = { + "/**", + " * ${type_name}", + " * @author ${user}", + " */", }, - server = { - launchMode = "Hybrid", + }, + eclipse = { + downloadSources = true, + }, + server = { + launchMode = "Hybrid", + }, + maven = { + downloadSources = true, + updateSnapshots = true, + }, + signatureHelp = { enabled = true }, + contentProvider = { preferred = "fernflower" }, + completion = { + favoriteStaticMembers = { + "org.hamcrest.MatcherAssert.assertThat", + "org.hamcrest.Matchers.*", + "org.hamcrest.CoreMatchers.*", + "org.junit.jupiter.api.Assertions.*", + "java.util.Objects.requireNonNull", + "java.util.Objects.requireNonNullElse", + "org.mockito.Mockito.*", }, - maven = { - downloadSources = true, - updateSnapshots = true, + filteredTypes = { + "com.sun.*", + "io.micrometer.shaded.*", + "java.awt.*", + "jdk.*", + "sun.*", }, - signatureHelp = { enabled = true }, - contentProvider = { preferred = "fernflower" }, - completion = { - favoriteStaticMembers = { - "org.hamcrest.MatcherAssert.assertThat", - "org.hamcrest.Matchers.*", - "org.hamcrest.CoreMatchers.*", - "org.junit.jupiter.api.Assertions.*", - "java.util.Objects.requireNonNull", - "java.util.Objects.requireNonNullElse", - "org.mockito.Mockito.*", - }, - filteredTypes = { - "com.sun.*", - "io.micrometer.shaded.*", - "java.awt.*", - "jdk.*", - "sun.*", - }, + }, + sources = { + organizeImports = { + starThreshold = 9999, + staticStarThreshold = 9999, }, - sources = { - organizeImports = { - starThreshold = 9999, - staticStarThreshold = 9999, - }, + }, + configuration = { + maven = { + -- userSettings = "/opt/software/apache-maven-3.6.3/conf/settings.xml", + -- globalSettings = "/opt/software/apache-maven-3.6.3/conf/settings.xml", + userSettings = get_maven_settings(), + globalSettings = get_maven_settings(), }, - configuration = { - maven = { - -- userSettings = "/opt/software/apache-maven-3.6.3/conf/settings.xml", - -- globalSettings = "/opt/software/apache-maven-3.6.3/conf/settings.xml", - userSettings = get_maven_settings(), - globalSettings = get_maven_settings(), + runtimes = { + { + name = "JavaSE-1.8", + path = "/opt/software/java/zulu8.62.0.19-ca-jdk8.0.332-macosx_aarch64", + default = true, + }, + { + name = "JavaSE-11", + path = "/opt/software/java/zulu11.56.19-ca-jdk11.0.15-macosx_aarch64", }, - runtimes = { - { - name = "JavaSE-1.8", - path = "/opt/software/java/zulu8.62.0.19-ca-jdk8.0.332-macosx_aarch64", - default = true, - }, - { - name = "JavaSE-11", - path = "/opt/software/java/zulu11.56.19-ca-jdk11.0.15-macosx_aarch64", - }, - { - name = "JavaSE-17", - path = "/opt/software/java/graalvm-ce-java17-22.1.0/Contents/Home", - }, + { + name = "JavaSE-17", + path = "/opt/software/java/graalvm-ce-java17-22.1.0/Contents/Home", }, }, }, }, + }, - -- Language server `initializationOptions` - -- You need to extend the `bundles` with paths to jar files - -- if you want to use additional eclipse.jdt.ls plugins. - -- - -- See https://github.com/mfussenegger/nvim-jdtls#java-debug-installation - -- - -- If you don't plan on using the debugger or other eclipse.jdt.ls plugins you can remove this - -- init_options = { - -- bundles = { - -- vim.fn.glob("/opt/software/lsp/java/java-debug/com.microsoft.java.debug.plugin/target/com.microsoft.java.debug.plugin-0.35.0.jar") - -- }, - -- workspace = workspace_dir - -- }, - } + -- Language server `initializationOptions` + -- You need to extend the `bundles` with paths to jar files + -- if you want to use additional eclipse.jdt.ls plugins. + -- + -- See https://github.com/mfussenegger/nvim-jdtls#java-debug-installation + -- + -- If you don't plan on using the debugger or other eclipse.jdt.ls plugins you can remove this + -- init_options = { + -- bundles = { + -- vim.fn.glob("/opt/software/lsp/java/java-debug/com.microsoft.java.debug.plugin/target/com.microsoft.java.debug.plugin-0.35.0.jar") + -- }, + -- workspace = workspace_dir + -- }, +} - local jdtls = require("jdtls") +local jdtls = require("jdtls") - local extendedClientCapabilities = jdtls.extendedClientCapabilities - extendedClientCapabilities.resolveAdditionalTextEditsSupport = true +local extendedClientCapabilities = jdtls.extendedClientCapabilities +extendedClientCapabilities.resolveAdditionalTextEditsSupport = true - config["init_options"] = { - bundles = bundles, - extendedClientCapabilities = extendedClientCapabilities, - } +config["init_options"] = { + bundles = bundles, + extendedClientCapabilities = extendedClientCapabilities, +} - config["on_attach"] = function(client, bufnr) - -- With `hotcodereplace = 'auto' the debug adapter will try to apply code changes - -- you make during a debug session immediately. - -- Remove the option if you do not want that. - require("jdtls").setup_dap({ hotcodereplace = "auto" }) - require("jdtls.setup").add_commands() - require("kide.core.keybindings").maplsp(client, bufnr) - -- require('jdtls.dap').setup_dap_main_class_configs({ verbose = true }) - local opts = { silent = true, buffer = bufnr } - vim.keymap.set("n", "dc", jdtls.test_class, opts) - vim.keymap.set("n", "dm", jdtls.test_nearest_method, opts) - vim.keymap.set("n", "crv", jdtls.extract_variable, opts) - vim.keymap.set("v", "crm", [[lua require('jdtls').extract_method(true)]], opts) - vim.keymap.set("n", "crc", jdtls.extract_constant, opts) - local create_command = vim.api.nvim_buf_create_user_command - create_command(bufnr, "OR", require("jdtls").organize_imports, { - nargs = 0, - }) - -- local dt = vim.g.jdtls_dap_main_class_config_time or 0 - -- vim.defer_fn(function() - -- if vim.g.jdtls_dap_main_class_config_time then - -- require("jdtls.dap").setup_dap_main_class_configs() - -- end - -- vim.g.jdtls_dap_main_class_config_time = 200 - -- end, dt) +config["on_attach"] = function(client, bufnr) + -- With `hotcodereplace = 'auto' the debug adapter will try to apply code changes + -- you make during a debug session immediately. + -- Remove the option if you do not want that. + require("jdtls").setup_dap({ hotcodereplace = "auto" }) + require("jdtls.setup").add_commands() + require("kide.core.keybindings").maplsp(client, bufnr) + -- require('jdtls.dap').setup_dap_main_class_configs({ verbose = true }) + local opts = { silent = true, buffer = bufnr } + vim.keymap.set("n", "dc", jdtls.test_class, opts) + vim.keymap.set("n", "dm", jdtls.test_nearest_method, opts) + vim.keymap.set("n", "crv", jdtls.extract_variable, opts) + vim.keymap.set("v", "crm", [[lua require('jdtls').extract_method(true)]], opts) + vim.keymap.set("n", "crc", jdtls.extract_constant, opts) + local create_command = vim.api.nvim_buf_create_user_command + create_command(bufnr, "OR", require("jdtls").organize_imports, { + nargs = 0, + }) + -- local dt = vim.g.jdtls_dap_main_class_config_time or 0 + -- vim.defer_fn(function() + -- if vim.g.jdtls_dap_main_class_config_time then + -- require("jdtls.dap").setup_dap_main_class_configs() + -- end + -- vim.g.jdtls_dap_main_class_config_time = 200 + -- end, dt) - -- vim.notify(vim.api.nvim_buf_get_name(bufnr), vim.log.levels.INFO) - end + -- vim.notify(vim.api.nvim_buf_get_name(bufnr), vim.log.levels.INFO) +end - local capabilities = require("cmp_nvim_lsp").update_capabilities(vim.lsp.protocol.make_client_capabilities()) - -- capabilities.experimental = { - -- hoverActions = true, - -- hoverRange = true, - -- serverStatusNotification = true, - -- snippetTextEdit = true, - -- codeActionGroup = true, - -- ssr = true, - -- } +local capabilities = require("cmp_nvim_lsp").update_capabilities(vim.lsp.protocol.make_client_capabilities()) +-- capabilities.experimental = { +-- hoverActions = true, +-- hoverRange = true, +-- serverStatusNotification = true, +-- snippetTextEdit = true, +-- codeActionGroup = true, +-- ssr = true, +-- } - config.capabilities = capabilities +config.capabilities = capabilities +M.setup = function() jdtls.start_or_attach(config) end From e6cd31735feb791b4b857d806e2fbc8fa96a39cc Mon Sep 17 00:00:00 2001 From: luokai Date: Sun, 7 Aug 2022 14:24:38 +0800 Subject: [PATCH 0386/1278] vscode config --- lua/kide/core/vscode/init.lua | 18 ++++++++++++++++++ lua/kide/lsp/java.lua | 34 ++++++++++++++-------------------- 2 files changed, 32 insertions(+), 20 deletions(-) create mode 100644 lua/kide/core/vscode/init.lua diff --git a/lua/kide/core/vscode/init.lua b/lua/kide/core/vscode/init.lua new file mode 100644 index 00000000..e422afbf --- /dev/null +++ b/lua/kide/core/vscode/init.lua @@ -0,0 +1,18 @@ +local M = {} +local env = { + HOME = vim.loop.os_homedir(), + VSCODE_EXTENSIONS = os.getenv("VSCODE_EXTENSIONS"), +} +M.get_vscode_extensions = function() + return env.VSCODE_EXTENSIONS or "~/.vscode/extensions" +end +M.find_one = function(v) + if type(v) == "string" then + return vim.split(v, "\n")[1] + elseif type(v) == "table" then + return v[1] + end + return v +end + +return M diff --git a/lua/kide/lsp/java.lua b/lua/kide/lsp/java.lua index 476304c3..c1ab3eed 100644 --- a/lua/kide/lsp/java.lua +++ b/lua/kide/lsp/java.lua @@ -7,7 +7,6 @@ local env = { MAVEN_SETTINGS = os.getenv("MAVEN_SETTINGS"), JDTLS_HOME = os.getenv("JDTLS_HOME"), JDTLS_WORKSPACE = os.getenv("JDTLS_WORKSPACE"), - VSCODE_EXTENSIONS = os.getenv("VSCODE_EXTENSIONS"), LOMBOK_JAR = os.getenv("LOMBOK_JAR"), } @@ -32,14 +31,11 @@ local function get_jdtls_workspace() return or_default(env.JDTLS_WORKSPACE, env.HOME .. "/jdtls-workspace/") end -local function get_vscode_extensions() - return or_default(env.VSCODE_EXTENSIONS, "~/.vscode/extensions") -end - +local vscode = require("kide.core.vscode") local function get_lombok_jar() return or_default( env.LOMBOK_JAR, - vim.fn.glob(get_vscode_extensions() .. "/vscjava.vscode-lombok-*/server/lombok.jar") + vscode.find_one(vim.fn.glob(vscode.get_vscode_extensions() .. "/vscjava.vscode-lombok-*/server/lombok.jar")) ) end @@ -53,18 +49,10 @@ local _config = (function() end end)() -local function find_one(v) - if type(v) == "string" then - return vim.split(v, "\n")[1] - elseif type(v) == "table" then - return v[1] - end - return v -end local project_name = vim.fn.fnamemodify(vim.fn.getcwd(), ":p:h:t") local workspace_dir = get_jdtls_workspace() .. project_name -local jdtls_path = find_one(vim.fn.glob(get_vscode_extensions() .. "/redhat.java-*/server")) +local jdtls_path = vscode.find_one(vim.fn.glob(vscode.get_vscode_extensions() .. "/redhat.java-*/server")) local jdtls_launcher = vim.fn.glob(jdtls_path .. "/plugins/org.eclipse.equinox.launcher_*.jar") @@ -72,7 +60,9 @@ local jdtls_config = vim.fn.glob(jdtls_path .. "/" .. _config) local bundles = {} -- This bundles definition is the same as in the previous section (java-debug installation) -local vscode_java_debug_path = find_one(vim.fn.glob(get_vscode_extensions() .. "/vscjava.vscode-java-debug-*/server")) +local vscode_java_debug_path = vscode.find_one( + vim.fn.glob(vscode.get_vscode_extensions() .. "/vscjava.vscode-java-debug-*/server") +) vim.list_extend( bundles, vim.split(vim.fn.glob(vscode_java_debug_path .. "/com.microsoft.java.debug.plugin-*.jar"), "\n") @@ -80,7 +70,9 @@ vim.list_extend( -- /opt/software/lsp/java/vscode-java-test/server -- vim.list_extend(bundles, vim.split(vim.fn.glob("/opt/software/lsp/java/vscode-java-test/server/*.jar"), "\n")); -local vscode_java_test_path = find_one(vim.fn.glob(get_vscode_extensions() .. "/vscjava.vscode-java-test-*/server")) +local vscode_java_test_path = vscode.find_one( + vim.fn.glob(vscode.get_vscode_extensions() .. "/vscjava.vscode-java-test-*/server") +) for _, bundle in ipairs(vim.split(vim.fn.glob(vscode_java_test_path .. "/*.jar"), "\n")) do if not vim.endswith(bundle, "com.microsoft.java.test.runner-jar-with-dependencies.jar") then table.insert(bundles, bundle) @@ -88,14 +80,16 @@ for _, bundle in ipairs(vim.split(vim.fn.glob(vscode_java_test_path .. "/*.jar") end -- /opt/software/lsp/java/vscode-java-decompiler/server/ -local java_decoompiler_path = find_one(vim.fn.glob(get_vscode_extensions() .. "/dgileadi.java-decompiler-*/server")) +local java_decoompiler_path = vscode.find_one( + vim.fn.glob(vscode.get_vscode_extensions() .. "/dgileadi.java-decompiler-*/server") +) vim.list_extend(bundles, vim.split(vim.fn.glob(java_decoompiler_path .. "/*.jar"), "\n")) -- /opt/software/lsp/java/vscode-java-dependency/jdtls.ext/ -- vim.list_extend(bundles, vim.split(vim.fn.glob("/opt/software/lsp/java/vscode-java-dependency/jdtls.ext/com.microsoft.jdtls.ext.core/target/com.microsoft.jdtls.ext.core-*.jar"), "\n")); -- /opt/software/lsp/java/vscode-java-dependency/server/ -local java_dependency_path = find_one( - vim.fn.glob(get_vscode_extensions() .. "/vscjava.vscode-java-dependency-*/server") +local java_dependency_path = vscode.find_one( + vim.fn.glob(vscode.get_vscode_extensions() .. "/vscjava.vscode-java-dependency-*/server") ) vim.list_extend(bundles, vim.split(vim.fn.glob(java_dependency_path .. "/*.jar"), "\n")) From 99a9a5f059e3728c1d6fdf205ffa5f25cf3dbfdc Mon Sep 17 00:00:00 2001 From: luokai Date: Sun, 7 Aug 2022 14:29:57 +0800 Subject: [PATCH 0387/1278] vscode java config --- lua/kide/core/vscode/init.lua | 3 ++- lua/kide/lsp/java.lua | 23 ++++++----------------- 2 files changed, 8 insertions(+), 18 deletions(-) diff --git a/lua/kide/core/vscode/init.lua b/lua/kide/core/vscode/init.lua index e422afbf..e8b0794e 100644 --- a/lua/kide/core/vscode/init.lua +++ b/lua/kide/core/vscode/init.lua @@ -6,7 +6,8 @@ local env = { M.get_vscode_extensions = function() return env.VSCODE_EXTENSIONS or "~/.vscode/extensions" end -M.find_one = function(v) +M.find_one = function(extension_path) + local v = vim.fn.glob(M.get_vscode_extensions() .. extension_path) if type(v) == "string" then return vim.split(v, "\n")[1] elseif type(v) == "table" then diff --git a/lua/kide/lsp/java.lua b/lua/kide/lsp/java.lua index c1ab3eed..0d414a29 100644 --- a/lua/kide/lsp/java.lua +++ b/lua/kide/lsp/java.lua @@ -33,10 +33,7 @@ end local vscode = require("kide.core.vscode") local function get_lombok_jar() - return or_default( - env.LOMBOK_JAR, - vscode.find_one(vim.fn.glob(vscode.get_vscode_extensions() .. "/vscjava.vscode-lombok-*/server/lombok.jar")) - ) + return or_default(env.LOMBOK_JAR, vscode.find_one("/vscjava.vscode-lombok-*/server/lombok.jar")) end local _config = (function() @@ -52,7 +49,7 @@ end)() local project_name = vim.fn.fnamemodify(vim.fn.getcwd(), ":p:h:t") local workspace_dir = get_jdtls_workspace() .. project_name -local jdtls_path = vscode.find_one(vim.fn.glob(vscode.get_vscode_extensions() .. "/redhat.java-*/server")) +local jdtls_path = vscode.find_one("/redhat.java-*/server") local jdtls_launcher = vim.fn.glob(jdtls_path .. "/plugins/org.eclipse.equinox.launcher_*.jar") @@ -60,9 +57,7 @@ local jdtls_config = vim.fn.glob(jdtls_path .. "/" .. _config) local bundles = {} -- This bundles definition is the same as in the previous section (java-debug installation) -local vscode_java_debug_path = vscode.find_one( - vim.fn.glob(vscode.get_vscode_extensions() .. "/vscjava.vscode-java-debug-*/server") -) +local vscode_java_debug_path = vscode.find_one("/vscjava.vscode-java-debug-*/server") vim.list_extend( bundles, vim.split(vim.fn.glob(vscode_java_debug_path .. "/com.microsoft.java.debug.plugin-*.jar"), "\n") @@ -70,9 +65,7 @@ vim.list_extend( -- /opt/software/lsp/java/vscode-java-test/server -- vim.list_extend(bundles, vim.split(vim.fn.glob("/opt/software/lsp/java/vscode-java-test/server/*.jar"), "\n")); -local vscode_java_test_path = vscode.find_one( - vim.fn.glob(vscode.get_vscode_extensions() .. "/vscjava.vscode-java-test-*/server") -) +local vscode_java_test_path = vscode.find_one("/vscjava.vscode-java-test-*/server") for _, bundle in ipairs(vim.split(vim.fn.glob(vscode_java_test_path .. "/*.jar"), "\n")) do if not vim.endswith(bundle, "com.microsoft.java.test.runner-jar-with-dependencies.jar") then table.insert(bundles, bundle) @@ -80,17 +73,13 @@ for _, bundle in ipairs(vim.split(vim.fn.glob(vscode_java_test_path .. "/*.jar") end -- /opt/software/lsp/java/vscode-java-decompiler/server/ -local java_decoompiler_path = vscode.find_one( - vim.fn.glob(vscode.get_vscode_extensions() .. "/dgileadi.java-decompiler-*/server") -) +local java_decoompiler_path = vscode.find_one("/dgileadi.java-decompiler-*/server") vim.list_extend(bundles, vim.split(vim.fn.glob(java_decoompiler_path .. "/*.jar"), "\n")) -- /opt/software/lsp/java/vscode-java-dependency/jdtls.ext/ -- vim.list_extend(bundles, vim.split(vim.fn.glob("/opt/software/lsp/java/vscode-java-dependency/jdtls.ext/com.microsoft.jdtls.ext.core/target/com.microsoft.jdtls.ext.core-*.jar"), "\n")); -- /opt/software/lsp/java/vscode-java-dependency/server/ -local java_dependency_path = vscode.find_one( - vim.fn.glob(vscode.get_vscode_extensions() .. "/vscjava.vscode-java-dependency-*/server") -) +local java_dependency_path = vscode.find_one("/vscjava.vscode-java-dependency-*/server") vim.list_extend(bundles, vim.split(vim.fn.glob(java_dependency_path .. "/*.jar"), "\n")) local root_dir = require("jdtls.setup").find_root({ ".git", "mvnw", "gradlew" }) From 40a92b9fa531af8a112416db70ca8271b8e5e3e3 Mon Sep 17 00:00:00 2001 From: luokai Date: Sun, 7 Aug 2022 14:33:31 +0800 Subject: [PATCH 0388/1278] vscode codelldb # On branch nvim-lsp # Your branch is up to date with 'origin/nvim-lsp'. # # Changes to be committed: # (use "git restore --staged ..." to unstage) # modified: lua/kide/dap/codelldb.lua --- lua/kide/dap/codelldb.lua | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lua/kide/dap/codelldb.lua b/lua/kide/dap/codelldb.lua index 118dd8df..96928ad3 100644 --- a/lua/kide/dap/codelldb.lua +++ b/lua/kide/dap/codelldb.lua @@ -1,5 +1,7 @@ local M = {} -local extension_path = "/Users/luokai/.vscode/extensions/vadimcn.vscode-lldb-1.7.2" +local vscode = require("kide.core.vscode") +local extension_path = vscode.find_one("/vadimcn.vscode-lldb-*") + M.config = {} M.config.codelldb_path = extension_path .. "/adapter/codelldb" M.config.liblldb_path = extension_path .. "/lldb/lib/liblldb.dylib" From 1722d1c56acbbc2a549a832908c82472e219e5df Mon Sep 17 00:00:00 2001 From: luokai Date: Sun, 7 Aug 2022 16:26:41 +0800 Subject: [PATCH 0389/1278] clang_format --- lua/kide/lsp/utils/init.lua | 4 ++++ lua/kide/plugins/config/null-ls.lua | 6 ++++++ 2 files changed, 10 insertions(+) diff --git a/lua/kide/lsp/utils/init.lua b/lua/kide/lsp/utils/init.lua index 08d7a4e4..cdff6edf 100644 --- a/lua/kide/lsp/utils/init.lua +++ b/lua/kide/lsp/utils/init.lua @@ -56,6 +56,10 @@ format_lsp_mapping["http"] = "null-ls" -- gofmt format_lsp_mapping["go"] = "null-ls" +-- clang_format +format_lsp_mapping["c"] = "null-ls" +format_lsp_mapping["cpp"] = "null-ls" + M.filter_format_lsp_client = function(client, bufnr) local filetype = vim.api.nvim_buf_get_option(bufnr, "filetype") local cn = format_lsp_mapping[filetype] diff --git a/lua/kide/plugins/config/null-ls.lua b/lua/kide/plugins/config/null-ls.lua index da67b456..c2a54cb3 100644 --- a/lua/kide/plugins/config/null-ls.lua +++ b/lua/kide/plugins/config/null-ls.lua @@ -56,6 +56,12 @@ local sources = { -- extra_args = { "--config", "p/java" }, -- }), null_ls.builtins.formatting.gofmt, + null_ls.builtins.formatting.clang_format.with({ + filetypes = { + "c", + "cpp", + }, + }), } local lsp_formatting = function(bufnr) From 11ecd3b655959cc1db6d2817a47c18c58147bc4b Mon Sep 17 00:00:00 2001 From: luokai Date: Sun, 7 Aug 2022 17:37:42 +0800 Subject: [PATCH 0390/1278] clangd format --- lua/kide/lsp/utils/init.lua | 4 ++-- lua/kide/plugins/config/null-ls.lua | 12 ++++++------ 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/lua/kide/lsp/utils/init.lua b/lua/kide/lsp/utils/init.lua index cdff6edf..a47d82ee 100644 --- a/lua/kide/lsp/utils/init.lua +++ b/lua/kide/lsp/utils/init.lua @@ -57,8 +57,8 @@ format_lsp_mapping["http"] = "null-ls" format_lsp_mapping["go"] = "null-ls" -- clang_format -format_lsp_mapping["c"] = "null-ls" -format_lsp_mapping["cpp"] = "null-ls" +format_lsp_mapping["c"] = "clangd" +format_lsp_mapping["cpp"] = "clangd" M.filter_format_lsp_client = function(client, bufnr) local filetype = vim.api.nvim_buf_get_option(bufnr, "filetype") diff --git a/lua/kide/plugins/config/null-ls.lua b/lua/kide/plugins/config/null-ls.lua index c2a54cb3..33a3cd2b 100644 --- a/lua/kide/plugins/config/null-ls.lua +++ b/lua/kide/plugins/config/null-ls.lua @@ -56,12 +56,12 @@ local sources = { -- extra_args = { "--config", "p/java" }, -- }), null_ls.builtins.formatting.gofmt, - null_ls.builtins.formatting.clang_format.with({ - filetypes = { - "c", - "cpp", - }, - }), + -- null_ls.builtins.formatting.clang_format.with({ + -- filetypes = { + -- "c", + -- "cpp", + -- }, + -- }), } local lsp_formatting = function(bufnr) From 5c39da4461bcf324422faa9975a375fa6a2a8fe4 Mon Sep 17 00:00:00 2001 From: luokai Date: Sat, 13 Aug 2022 22:37:49 +0800 Subject: [PATCH 0391/1278] =?UTF-8?q?=E5=88=87=E6=8D=A2=E5=88=B0=20mason.n?= =?UTF-8?q?vim,=20nvim-lsp-installer=20=E4=B8=8D=E5=86=8D=E7=BB=B4?= =?UTF-8?q?=E6=8A=A4=E4=BA=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lua/kide/lsp/init.lua | 62 ++++++++++++++------------ lua/kide/lsp/sumneko_lua.lua | 8 ++-- lua/kide/plugins/config/mason-nvim.lua | 1 + lua/kide/plugins/init.lua | 21 +++++++-- 4 files changed, 57 insertions(+), 35 deletions(-) create mode 100644 lua/kide/plugins/config/mason-nvim.lua diff --git a/lua/kide/lsp/init.lua b/lua/kide/lsp/init.lua index d758c394..2186b081 100644 --- a/lua/kide/lsp/init.lua +++ b/lua/kide/lsp/init.lua @@ -1,6 +1,5 @@ -local lsp_installer = require("nvim-lsp-installer") -local lspconfig = require("lspconfig") -lsp_installer.setup({ +local mason_lspconfig = require("mason-lspconfig") +mason_lspconfig.setup({ ensure_installed = { "sumneko_lua", "clangd", @@ -34,33 +33,40 @@ local capabilities = require("cmp_nvim_lsp").update_capabilities(vim.lsp.protoco -- 没有确定使用效果参数 -- capabilities.textDocument.completion.completionItem.snippetSupport = true local utils = require("kide.core.utils") -for _, server in ipairs(lsp_installer.get_installed_servers()) do - -- tools config - local cfg = utils.or_default(server_configs[server.name], {}) - -- lspconfig - local scfg = utils.or_default(cfg.server, {}) - scfg = vim.tbl_deep_extend("force", server:get_default_options(), scfg) - local on_attach = scfg.on_attach - scfg.on_attach = function(client, bufnr) - -- 绑定快捷键 - require("kide.core.keybindings").maplsp(client, bufnr) - if on_attach then - on_attach(client, bufnr) +require("mason-lspconfig").setup_handlers({ + -- The first entry (without a key) will be the default handler + -- and will be called for each installed server that doesn't have + -- a dedicated handler. + function(server_name) -- default handler (optional) + local lspconfig = require("lspconfig") + -- tools config + local cfg = utils.or_default(server_configs[server_name], {}) + + -- lspconfig + local scfg = utils.or_default(cfg.server, {}) + -- scfg = vim.tbl_deep_extend("force", server:get_default_options(), scfg) + local on_attach = scfg.on_attach + scfg.on_attach = function(client, bufnr) + -- 绑定快捷键 + require("kide.core.keybindings").maplsp(client, bufnr) + if on_attach then + on_attach(client, bufnr) + end end - end - scfg.flags = { - debounce_text_changes = 150, - } - scfg.capabilities = capabilities - if server.name == "rust_analyzer" then - -- Initialize the LSP via rust-tools instead - cfg.server = scfg - require("rust-tools").setup(cfg) - else - lspconfig[server.name].setup(scfg) - end -end + scfg.flags = { + debounce_text_changes = 150, + } + scfg.capabilities = capabilities + if server_name == "rust_analyzer" then + -- Initialize the LSP via rust-tools instead + cfg.server = scfg + require("rust-tools").setup(cfg) + else + lspconfig[server_name].setup(scfg) + end + end, +}) -- LSP 相关美化参考 https://github.com/NvChad/NvChad local function lspSymbol(name, icon) diff --git a/lua/kide/lsp/sumneko_lua.lua b/lua/kide/lsp/sumneko_lua.lua index ee61bebc..0402e67b 100644 --- a/lua/kide/lsp/sumneko_lua.lua +++ b/lua/kide/lsp/sumneko_lua.lua @@ -1,6 +1,6 @@ -local runtime_path = vim.split(package.path, ";") -table.insert(runtime_path, "lua/?.lua") -table.insert(runtime_path, "lua/?/init.lua") +-- local runtime_path = vim.split(package.path, ";") +-- table.insert(runtime_path, "lua/?.lua") +-- table.insert(runtime_path, "lua/?/init.lua") return { server = { settings = { @@ -9,7 +9,7 @@ return { -- Tell the language server which version of Lua you're using (most likely LuaJIT in the case of Neovim) version = "LuaJIT", -- Setup your lua path - path = runtime_path, + -- path = runtime_path, }, diagnostics = { -- Get the language server to recognize the `vim` global diff --git a/lua/kide/plugins/config/mason-nvim.lua b/lua/kide/plugins/config/mason-nvim.lua new file mode 100644 index 00000000..ac266614 --- /dev/null +++ b/lua/kide/plugins/config/mason-nvim.lua @@ -0,0 +1 @@ +require("mason").setup() diff --git a/lua/kide/plugins/init.lua b/lua/kide/plugins/init.lua index 810928ff..f9575510 100644 --- a/lua/kide/plugins/init.lua +++ b/lua/kide/plugins/init.lua @@ -17,13 +17,28 @@ require("packer").startup({ opt = true, }) use({ - "williamboman/nvim-lsp-installer", - module = "nvim-lsp-installer", + "williamboman/mason.nvim", opt = true, + module = "mason", + setup = function() + require("kide.core.layz_load").async_load("mason.nvim") + end, + config = function() + require("kide.plugins.config.mason-nvim") + end, + }) + use({ + "williamboman/mason-lspconfig.nvim", + after = "mason.nvim", + module = "mason-lspconfig", + opt = true, + setup = function() + require("kide.core.layz_load").async_load("mason-lspconfig.nvim") + end, }) use({ "neovim/nvim-lspconfig", - after = "nvim-lsp-installer", + after = "mason-lspconfig.nvim", module = "lspconfig", setup = function() require("kide.core.layz_load").async_load("nvim-lspconfig") From bac21acbba3e4c69db1bf81a2227959ff6f99d08 Mon Sep 17 00:00:00 2001 From: luokai Date: Sun, 14 Aug 2022 17:15:07 +0800 Subject: [PATCH 0392/1278] java-deps --- lua/java-deps.lua | 512 ++++++++++++++++++++++++++++++++++++++++++ lua/kide/lsp/java.lua | 1 + 2 files changed, 513 insertions(+) create mode 100644 lua/java-deps.lua diff --git a/lua/java-deps.lua b/lua/java-deps.lua new file mode 100644 index 00000000..c854c255 --- /dev/null +++ b/lua/java-deps.lua @@ -0,0 +1,512 @@ +local M = {} + +local get_client = function() + local clients = vim.lsp.get_active_clients() + for _, client in ipairs(clients) do + if client.name == "jdt.ls" then + return client + end + end +end + +local get_root_project_uri = function(client) + client = client or get_client() + if client then + return "file://" .. client.config.root_dir + end +end + +local request = function(bufnr, method, params, handler) + vim.lsp.buf_request(bufnr, method, params, handler) +end + +M.NodeKind = { + WORKSPACE = 1, + PROJECT = 2, + CONTAINER = 3, + PACKAGEROOT = 4, + PACKAGE = 5, + PRIMARYTYPE = 6, + FOLDER = 7, + FILE = 8, + + CLASS = 11, + INTERFACE = 12, + ENUM = 13, +} +M.symbols = {} +M.symbols.kinds = { + "WORKSPACE", + "PROJECT", + "CONTAINER", + "PACKAGEROOT", + "PACKAGE", + "PRIMARYTYPE", + "FOLDER", + "FILE", + + [11] = "CLASS", + [12] = "INTERFACE", + [13] = "ENUM", + [21] = "JAR", +} + +M.config = { + options = { + show_guides = true, + auto_clise = false, + width = 40, + relative_width = true, + symbols = { + FILE = { icon = "", hl = "TSURI" }, + WORKSPACE = { icon = "", hl = "TSNamespace" }, + CONTAINER = { icon = "", hl = "TSMethod" }, + PACKAGE = { icon = "", hl = "TSNamespace" }, + PRIMARYTYPE = { icon = "ﴯ", hl = "TSType" }, + PROJECT = { icon = "פּ", hl = "TSType" }, + PACKAGEROOT = { icon = "", hl = "TSType" }, + FOLDER = { icon = "", hl = "TSType" }, + CLASS = { icon = "C", hl = "TSType" }, + ENUM = { icon = "E", hl = "TSType" }, + INTERFACE = { icon = "I", hl = "TSType" }, + JAR = { icon = "", hl = "TSKeyword" }, + }, + }, +} +M.state = { + root_cache = nil, + root_view = nil, + jdt_dep_win = nil, + jdt_dep_buf = nil, + code_win = 0, + code_buf = 0, +} +M.project_list = function(code_buf, handler) + local params = {} + params.command = "java.project.list" + params.arguments = { + M.state.root_cache.project_uri, + } + request(code_buf, "workspace/executeCommand", params, function(err, projects) + if err then + vim.notify(err.message, vim.log.levels.WARN) + elseif projects then + handler(projects) + end + end) +end + +M.get_package_data = function(buf, node, handler) + buf = buf or 0 + + local params0 = {} + params0.command = "java.getPackageData" + params0.arguments = { + kind = node.kind, + projectUri = M.state.root_cache.project_uri, + path = node.path, + } + if node.root_project then + params0.arguments.projectUri = node.root_project.uri + end + if node.container then + params0.arguments.projectUri = node.container.uri + end + if node.kind == M.NodeKind.PROJECT then + params0.arguments.projectUri = node.uri + end + + if node.kind == M.NodeKind.PACKAGEROOT then + params0.arguments.rootPath = M.state.root_cache.project_uri + params0.arguments.handlerIdentifier = node.handlerIdentifier + params0.arguments.isHierarchicalView = true + end + if node.kind == M.NodeKind.PACKAGE then + params0.arguments.isHierarchicalView = true + params0.arguments.path = node.name + params0.arguments.handlerIdentifier = node.handlerIdentifier + end + -- 获取项目结构 + request(buf, "workspace/executeCommand", params0, function(err0, packages) + if err0 then + print(err0.message) + elseif packages then + handler(node, packages) + end + end) +end + +M.write_buf = function(bufnr, lines) + vim.api.nvim_buf_set_option(bufnr, "modifiable", true) + vim.api.nvim_buf_set_lines(bufnr, 0, -1, false, lines) + vim.api.nvim_buf_set_option(bufnr, "modifiable", false) +end +M.markers = { + bottom = "└", + middle = "├", + vertical = "│", + horizontal = "─", +} + +local function table_to_str(t) + local ret = "" + for _, value in ipairs(t) do + ret = ret .. tostring(value) + end + return ret +end +local function str_to_table(str) + local t = {} + for i = 1, #str do + t[i] = str:sub(i, i) + end + return t +end + +M.parse_lines = function(root_view) + local lines = {} + local hl_info = {} + -- .depth + for _, v in ipairs(root_view) do + local line = str_to_table(string.rep(" ", v.depth)) + + if M.config.options.show_guides then + -- makes the guides + for index, _ in ipairs(line) do + -- all items start with a space (or two) + if index == 1 then + line[index] = " " + -- if index is last, add a bottom marker if current item is last, + -- else add a middle marker + elseif index == #line then + if v.isLast then + line[index] = M.markers.bottom + else + line[index] = M.markers.middle + end + -- else if the parent was not the last in its group, add a + -- vertical marker because there are items under us and we need + -- to point to those + -- else + -- line[index] = M.markers.vertical + end + end + end + local final_prefix = {} + -- Add 1 space between the guides + for _, l in ipairs(line) do + table.insert(final_prefix, l) + table.insert(final_prefix, " ") + end + + local string_prefix = table_to_str(final_prefix) + local hl_start = #string_prefix + local hl_end = #string_prefix + #v.icon + + -- table.insert(lines, string_prefix .. v.icon .. " " .. v.name .. ":" .. v.kind .. ":" .. v.order) + table.insert(lines, string_prefix .. v.icon .. " " .. v.name) + local hl_type = M.config.options.symbols[M.symbols.kinds[v.type_kind]].hl + table.insert(hl_info, { hl_start, hl_end, hl_type }) + end + return lines, hl_info +end + +local function type_kind(node) + if node.metaData and node.metaData.TypeKind then + return node.metaData.TypeKind + 10 + end + if vim.endswith(node.name, ".jar") then + return 21 + end + return node.kind +end +function M.flatten(items, depth) + if items and items[#items] then + items[#items].isLast = true + end + local ret = {} + for _, value in ipairs(items) do + local idepth = depth or value.depth or 1 + value.depth = idepth + value.type_kind = type_kind(value) + value.icon = M.config.options.symbols[M.symbols.kinds[value.type_kind]].icon + table.insert(ret, value) + if value.children ~= nil then + local inner = M.flatten(value.children, idepth + 1) + for _, value_inner in ipairs(inner) do + table.insert(ret, value_inner) + end + end + end + return ret +end + +local function sort_node_c(node) + if node == nil or node.children == nil then + return + end + table.sort(node.children, function(a, b) + if a.order ~= b.order then + return a.order < b.order + end + if a.kind == b.kind then + if + a.kind == M.NodeKind.PROJECT + or a.kind == M.NodeKind.PRIMARYTYPE + or a.kind == M.NodeKind.PACKAGEROOT + or a.kind == M.NodeKind.PACKAGE + then + if a.name ~= b.name then + return a.name:upper() < b.name:upper() + end + end + end + return false + end) +end + +local hlns = vim.api.nvim_create_namespace("java-deps-icon-highlight") +function M.add_highlights(bufnr, hl_info) + for line, line_hl in ipairs(hl_info) do + local hl_start, hl_end, hl_type = unpack(line_hl) + vim.api.nvim_buf_add_highlight(bufnr, hlns, hl_type, line - 1, hl_start, hl_end) + end +end + +local function _auto_close(bufnr) + local clean_diagnostic = vim.api.nvim_create_augroup("clean_java_deps_view", { clear = true }) + vim.api.nvim_create_autocmd("WinClosed", { + group = clean_diagnostic, + buffer = bufnr, + callback = function() + vim.api.nvim_del_augroup_by_id(clean_diagnostic) + M._clean() + end, + }) +end +local function _render() + M.state.root_view = M.flatten(M.state.root_cache.children) + local lines, hl_info = M.parse_lines(M.state.root_view) + if M.state.jdt_dep_buf == nil then + M.state.jdt_dep_buf, M.state.jdt_dep_win = M.setup_view() + M.keymaps(M.state.jdt_dep_buf, true) + _auto_close(M.state.jdt_dep_buf) + end + M.write_buf(M.state.jdt_dep_buf, lines) + M.add_highlights(M.state.jdt_dep_buf, hl_info) +end + +local function setup_keymaps(bufnr) + local buf_map = function(key, action) + vim.api.nvim_buf_set_keymap(bufnr, "n", key, action, { silent = true, noremap = true }) + end + buf_map("o", ":lua require('java-deps')._open_file(false)") +end + +local function get_cmp_uri(code_buf) + local name = vim.api.nvim_buf_get_name(code_buf) + if not vim.startswith(name, "jdt://") then + return "file://" .. name + end +end +local function handler_debs(bufnr, cnode) + if + cnode.kind == M.NodeKind.PRIMARYTYPE + or cnode.kind == M.NodeKind.FILE + or cnode.kind == M.NodeKind.CLASS + or cnode.kind == M.NodeKind.INTERFACE + or cnode.kind == M.NodeKind.ENUM + then + return + end + if cnode.children then + cnode.children = nil + cnode.isLast = false + _render() + else + if M.state.code_buf_uri == nil then + M.state.code_buf_uri = get_cmp_uri(bufnr) + end + M.get_package_data(bufnr, cnode, function(node, iresp) + node.children = {} + for _, value in ipairs(iresp) do + if value.uri and vim.startswith(value.uri, M.state.code_buf_uri) then + value.current = true + end + if M.NodeKind.CONTAINER == value.kind then + value.root_project = node + end + if M.NodeKind.PACKAGEROOT == value.kind and vim.startswith(value.name, "src/") then + value.order = 0 + else + value.order = 1 + end + if + M.NodeKind.CONTAINER == value.kind + and not vim.startswith(value.name, "JRE System Library") + and not vim.startswith(value.name, "Maven Dependencies") + then + M.get_package_data(bufnr, value, function(inode, iiresp) + for _, iv in ipairs(iiresp) do + if M.NodeKind.PACKAGEROOT == iv.kind and vim.startswith(iv.name, "src/") then + iv.order = 0 + else + iv.order = 1 + end + iv.container = inode + table.insert(node.children, iv) + end + sort_node_c(node) + _render() + end) + else + table.insert(node.children, value) + end + end + node.isLast = true + sort_node_c(node) + _render() + end) + end +end +M.java_projects = function() + if M.state.root_cache == nil then + M.state.root_cache = {} + M.state.root_cache.project_uri = get_root_project_uri() + end + if M.state.root_cache.project_uri == nil then + M.state.root_cache = nil + vim.notify("Failed to get project root directory", vim.log.levels.WARN) + return + end + local code_buf = vim.api.nvim_get_current_buf() + M.state.code_buf = code_buf + M.state.code_buf_uri = get_cmp_uri(code_buf) + if M.state.root_view == nil then + M.state.root_view = {} + end + M.project_list(code_buf, function(projects) + for _, project in ipairs(projects) do + project.order = 0 + end + M.state.root_cache.children = projects + for _, project in ipairs(M.state.root_cache.children) do + handler_debs(code_buf, project) + end + _render() + setup_keymaps(M.state.jdt_dep_buf) + end) +end + +function M._open_file(change_focus) + local current_line = vim.api.nvim_win_get_cursor(M.state.jdt_dep_win)[1] + local node = M.state.root_view[current_line] + handler_debs(M.state.code_buf, node) + if change_focus then + vim.fn.win_gotoid(M.state.code_win) + end + if M.config.options.auto_close then + M.close_outline() + end +end + +function M.get_split_command() + if M.config.options.position == "left" then + return "topleft vs" + else + return "botright vs" + end +end +function M.get_window_width() + if M.config.options.relative_width then + return math.ceil(vim.o.columns * (M.config.options.width / 100)) + else + return M.options.width + end +end +M.setup_view = function() + -- create a scratch unlisted buffer + local bufnr = vim.api.nvim_create_buf(false, true) + + -- delete buffer when window is closed / buffer is hidden + vim.api.nvim_buf_set_option(bufnr, "bufhidden", "delete") + -- create a split + vim.cmd(M.get_split_command()) + -- resize to a % of the current window size + vim.cmd("vertical resize " .. M.get_window_width()) + + -- get current (outline) window and attach our buffer to it + local winnr = vim.api.nvim_get_current_win() + vim.api.nvim_win_set_buf(winnr, bufnr) + + -- window stuff + vim.api.nvim_win_set_option(winnr, "number", false) + vim.api.nvim_win_set_option(winnr, "relativenumber", false) + vim.api.nvim_win_set_option(winnr, "winfixwidth", true) + -- buffer stuff + vim.api.nvim_buf_set_name(bufnr, "Java Projects") + vim.api.nvim_buf_set_option(bufnr, "filetype", "JavaProjects") + vim.api.nvim_buf_set_option(bufnr, "modifiable", false) + + if M.config.options.show_numbers or M.config.options.show_relative_numbers then + vim.api.nvim_win_set_option(winnr, "nu", true) + end + + if M.config.options.show_relative_numbers then + vim.api.nvim_win_set_option(winnr, "rnu", true) + end + + return bufnr, winnr +end + +function M._clean() + M.state.jdt_dep_buf = nil + M.state.jdt_dep_win = nil + M.state.root_cache = nil +end + +function M.close_jdt_dep() + if M.state.jdt_dep_buf then + vim.api.nvim_win_close(M.state.jdt_dep_win, true) + M._clean() + end +end + +function M.open_jdt_dep() + if M.state.jdt_dep_buf == nil then + M.java_projects() + end +end +function M.java_deps_toggle() + if M.state.jdt_dep_buf == nil then + M.java_projects() + else + M.close_jdt_dep() + end +end + +function M.setup(config) + if config then + M.config = vim.tbl_extend("force", M.config, config) + end +end +function M.attach(client, bufnr) + if M.state.root_cache == nil then + M.state.root_cache = {} + M.state.root_cache.project_uri = get_root_project_uri(client) + end + if M.state.root_cache.project_uri then + M.keymaps(bufnr) + end +end +function M.keymaps(bufnr, view) + local buf_map = function(key, action) + vim.api.nvim_buf_set_keymap(bufnr, "n", key, action, { silent = true, noremap = true }) + end + buf_map("p", ":lua require('java-deps').java_deps_toggle(false)") + if view then + buf_map("q", ":lua require('java-deps').close_jdt_dep()") + end +end + +return M diff --git a/lua/kide/lsp/java.lua b/lua/kide/lsp/java.lua index 0d414a29..34d6c237 100644 --- a/lua/kide/lsp/java.lua +++ b/lua/kide/lsp/java.lua @@ -282,6 +282,7 @@ config["on_attach"] = function(client, bufnr) -- vim.g.jdtls_dap_main_class_config_time = 200 -- end, dt) + require('java-deps').attach(client, bufnr) -- vim.notify(vim.api.nvim_buf_get_name(bufnr), vim.log.levels.INFO) end From 6da28ffad318842082b4818a7fc8124df6e839bb Mon Sep 17 00:00:00 2001 From: luokai Date: Mon, 15 Aug 2022 09:54:50 +0800 Subject: [PATCH 0393/1278] =?UTF-8?q?=E5=B1=8F=E8=94=BD=E9=85=8D=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lua/kide/lsp/java.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lua/kide/lsp/java.lua b/lua/kide/lsp/java.lua index 34d6c237..b79510bb 100644 --- a/lua/kide/lsp/java.lua +++ b/lua/kide/lsp/java.lua @@ -282,7 +282,7 @@ config["on_attach"] = function(client, bufnr) -- vim.g.jdtls_dap_main_class_config_time = 200 -- end, dt) - require('java-deps').attach(client, bufnr) + -- require('java-deps').attach(client, bufnr) -- vim.notify(vim.api.nvim_buf_get_name(bufnr), vim.log.levels.INFO) end From d9b37197b283fe395de2cb7a49a1ffb3b39649df Mon Sep 17 00:00:00 2001 From: luokai Date: Tue, 16 Aug 2022 10:36:14 +0800 Subject: [PATCH 0394/1278] symbols-outline --- lua/kide/plugins/config/symbols-outline.lua | 4 ++-- lua/kide/plugins/init.lua | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/lua/kide/plugins/config/symbols-outline.lua b/lua/kide/plugins/config/symbols-outline.lua index d0d273e3..34434505 100644 --- a/lua/kide/plugins/config/symbols-outline.lua +++ b/lua/kide/plugins/config/symbols-outline.lua @@ -1,5 +1,5 @@ -- init.lua -vim.g.symbols_outline = { +require("symbols-outline").setup({ highlight_hovered_item = false, show_guides = true, auto_preview = false, @@ -50,4 +50,4 @@ vim.g.symbols_outline = { Operator = { icon = "", hl = "TSOperator" }, TypeParameter = { icon = "", hl = "TSParameter" }, }, -} +}) diff --git a/lua/kide/plugins/init.lua b/lua/kide/plugins/init.lua index f9575510..d728657a 100644 --- a/lua/kide/plugins/init.lua +++ b/lua/kide/plugins/init.lua @@ -379,7 +379,7 @@ require("packer").startup({ "simrat39/symbols-outline.nvim", opt = true, cmd = { "SymbolsOutline" }, - setup = function() + config = function() require("kide.plugins.config.symbols-outline") end, }) From c3422149b6d5e0861e21fdd07b080108d066610c Mon Sep 17 00:00:00 2001 From: luokai Date: Tue, 16 Aug 2022 11:23:14 +0800 Subject: [PATCH 0395/1278] keybindings --- lua/kide/core/keybindings.lua | 36 +++++++++++++-------------- lua/kide/lsp/java.lua | 12 +++++---- lua/kide/plugins/config/which-key.lua | 7 ++++++ lua/kide/plugins/init.lua | 6 +---- 4 files changed, 33 insertions(+), 28 deletions(-) create mode 100644 lua/kide/plugins/config/which-key.lua diff --git a/lua/kide/core/keybindings.lua b/lua/kide/core/keybindings.lua index c98a61c0..ad43e64b 100644 --- a/lua/kide/core/keybindings.lua +++ b/lua/kide/core/keybindings.lua @@ -144,47 +144,47 @@ nnoremap l map("n", "ts", "Telescope toggletasks spawn", opt) end -- lsp 回调函数快捷键设置 -M.maplsp = function(client, bufnr) - vim.api.nvim_buf_set_option(bufnr, "omnifunc", "v:lua.vim.lsp.omnifunc") - vim.api.nvim_buf_set_option(bufnr, "formatexpr", "v:lua.vim.lsp.formatexpr()") +M.maplsp = function(client, buffer) + vim.api.nvim_buf_set_option(buffer, "omnifunc", "v:lua.vim.lsp.omnifunc") + vim.api.nvim_buf_set_option(buffer, "formatexpr", "v:lua.vim.lsp.formatexpr()") - vim.api.nvim_buf_set_keymap(bufnr, "n", "K", "lua vim.lsp.buf.hover()", opt) + vim.api.nvim_buf_set_keymap(buffer, "n", "K", "lua vim.lsp.buf.hover()", opt) -- rename - vim.api.nvim_buf_set_keymap(bufnr, "n", "rn", "lua vim.lsp.buf.rename()", opt) + vim.api.nvim_buf_set_keymap(buffer, "n", "rn", "lua vim.lsp.buf.rename()", opt) -- mapbuf('n', 'rn', 'lua require("lspsaga.rename").rename()', opt) -- code action - vim.api.nvim_buf_set_keymap(bufnr, "n", "ca", "lua vim.lsp.buf.code_action()", opt) + vim.api.nvim_buf_set_keymap(buffer, "n", "ca", "lua vim.lsp.buf.code_action()", opt) -- mapbuf('n', 'ca', 'lua require("lspsaga.codeaction").code_action()', opt) -- go xx -- mapbuf('n', 'gd', 'lua vim.lsp.buf.definition()', opt) -- vim.api.nvim_buf_set_keymap(bufnr, 'n', 'gd', 'Trouble lsp_definitions', opt) - vim.api.nvim_buf_set_keymap(bufnr, "n", "gd", "Telescope lsp_definitions", opt) - vim.api.nvim_buf_set_keymap(bufnr, "n", "gh", "lua vim.lsp.buf.hover()", opt) - vim.api.nvim_buf_set_keymap(bufnr, "n", "gs", "lua vim.lsp.buf.signature_help()", opt) + vim.api.nvim_buf_set_keymap(buffer, "n", "gd", "Telescope lsp_definitions", opt) + vim.api.nvim_buf_set_keymap(buffer, "n", "gh", "lua vim.lsp.buf.hover()", opt) + vim.api.nvim_buf_set_keymap(buffer, "n", "gs", "lua vim.lsp.buf.signature_help()", opt) -- mapbuf('n', 'gD', 'lua vim.lsp.buf.declaration()', opt) -- mapbuf('n', 'gD', 'lua vim.lsp.buf.type_definition()', opt) -- vim.api.nvim_buf_set_keymap(bufnr, "n", "gD", "Trouble lsp_type_definitions", opt) -- mapbuf('n', 'gi', 'lua vim.lsp.buf.implementation()', opt) -- vim.api.nvim_buf_set_keymap(bufnr, "n", "gi", "Trouble lsp_implementations", opt) - vim.api.nvim_buf_set_keymap(bufnr, "n", "gi", "Telescope lsp_implementations", opt) + vim.api.nvim_buf_set_keymap(buffer, "n", "gi", "Telescope lsp_implementations", opt) -- mapbuf('n', 'gr', 'lua vim.lsp.buf.references()', opt) -- vim.api.nvim_buf_set_keymap(bufnr, "n", "gr", "Trouble lsp_references", opt) - vim.api.nvim_buf_set_keymap(bufnr, "n", "gr", "Telescope lsp_references", opt) + vim.api.nvim_buf_set_keymap(buffer, "n", "gr", "Telescope lsp_references", opt) -- mapbuf('n', 'gr', 'lua require"lspsaga.provider".lsp_finder()', opt) -- mapbuf('n', 's', 'lua vim.lsp.buf.workspace_symbol()', opt) -- mapbuf('n', 's', 'lua require"telescope.builtin".lsp_workspace_symbols({ query = vim.fn.input("Query> ") })', opt) - vim.api.nvim_buf_set_keymap(bufnr, "n", "fs", "Telescope lsp_dynamic_workspace_symbols", opt) + vim.api.nvim_buf_set_keymap(buffer, "n", "fs", "Telescope lsp_dynamic_workspace_symbols", opt) keymap("v", "fs", function() local tb = require("telescope.builtin") local text = require("kide.core.utils").get_visual_selection() tb.lsp_workspace_symbols({ default_text = text, query = text }) end, opt) - vim.api.nvim_buf_set_keymap(bufnr, "n", "fo", "Telescope lsp_document_symbols", opt) + vim.api.nvim_buf_set_keymap(buffer, "n", "fo", "Telescope lsp_document_symbols", opt) -- diagnostic - vim.api.nvim_buf_set_keymap(bufnr, "n", "go", "lua vim.diagnostic.open_float()", opt) - vim.api.nvim_buf_set_keymap(bufnr, "n", "[g", "lua vim.diagnostic.goto_prev()", opt) - vim.api.nvim_buf_set_keymap(bufnr, "n", "]g", "lua vim.diagnostic.goto_next()", opt) + vim.api.nvim_buf_set_keymap(buffer, "n", "go", "lua vim.diagnostic.open_float()", opt) + vim.api.nvim_buf_set_keymap(buffer, "n", "[g", "lua vim.diagnostic.goto_prev()", opt) + vim.api.nvim_buf_set_keymap(buffer, "n", "]g", "lua vim.diagnostic.goto_next()", opt) -- mapbuf('n', 'q', 'lua vim.diagnostic.setloclist()', opt) -- leader + = -- vim.api.nvim_buf_set_keymap(bufnr, 'n', '=', 'lua vim.lsp.buf.format()', opt) @@ -200,7 +200,7 @@ M.maplsp = function(client, bufnr) }) end, opt) vim.api.nvim_buf_set_keymap( - bufnr, + buffer, "v", "=", 'lua require("kide.lsp.utils").format_range_operator()', @@ -213,7 +213,7 @@ M.maplsp = function(client, bufnr) -- mapbuf('n', 'wl', 'lua print(vim.inspect(vim.lsp.buf.list_workspace_folders()))', opt) -- mapbuf('n', 'D', 'lua vim.lsp.buf.type_definition()', opt) - vim.api.nvim_buf_set_keymap(bufnr, "n", "xw", "Telescope diagnostics", opt) + vim.api.nvim_buf_set_keymap(buffer, "n", "xw", "Telescope diagnostics", opt) -- vim.api.nvim_buf_set_keymap(bufnr, "n", "xw", "Trouble workspace_diagnostics", opt) -- vim.api.nvim_buf_set_keymap(bufnr, "n", "xx", "Trouble", opt) -- vim.api.nvim_buf_set_keymap(bufnr, "n", "xw", "Trouble workspace_diagnostics", opt) diff --git a/lua/kide/lsp/java.lua b/lua/kide/lsp/java.lua index b79510bb..ce3dd56a 100644 --- a/lua/kide/lsp/java.lua +++ b/lua/kide/lsp/java.lua @@ -256,22 +256,24 @@ config["init_options"] = { extendedClientCapabilities = extendedClientCapabilities, } -config["on_attach"] = function(client, bufnr) +config["on_attach"] = function(client, buffer) -- With `hotcodereplace = 'auto' the debug adapter will try to apply code changes -- you make during a debug session immediately. -- Remove the option if you do not want that. require("jdtls").setup_dap({ hotcodereplace = "auto" }) require("jdtls.setup").add_commands() - require("kide.core.keybindings").maplsp(client, bufnr) + require("kide.core.keybindings").maplsp(client, buffer) -- require('jdtls.dap').setup_dap_main_class_configs({ verbose = true }) - local opts = { silent = true, buffer = bufnr } + local opts = { silent = true, buffer = buffer } vim.keymap.set("n", "dc", jdtls.test_class, opts) vim.keymap.set("n", "dm", jdtls.test_nearest_method, opts) vim.keymap.set("n", "crv", jdtls.extract_variable, opts) - vim.keymap.set("v", "crm", [[lua require('jdtls').extract_method(true)]], opts) + vim.keymap.set("v", "crm", function() + require("jdtls").extract_method(true) + end, opts) vim.keymap.set("n", "crc", jdtls.extract_constant, opts) local create_command = vim.api.nvim_buf_create_user_command - create_command(bufnr, "OR", require("jdtls").organize_imports, { + create_command(buffer, "OR", require("jdtls").organize_imports, { nargs = 0, }) -- local dt = vim.g.jdtls_dap_main_class_config_time or 0 diff --git a/lua/kide/plugins/config/which-key.lua b/lua/kide/plugins/config/which-key.lua new file mode 100644 index 00000000..29beaaa9 --- /dev/null +++ b/lua/kide/plugins/config/which-key.lua @@ -0,0 +1,7 @@ +local which_key = require("which-key") +which_key.setup({ + -- your configuration comes here + -- or leave it empty to use the default settings + -- refer to the configuration section below +}) + diff --git a/lua/kide/plugins/init.lua b/lua/kide/plugins/init.lua index d728657a..b12f679c 100644 --- a/lua/kide/plugins/init.lua +++ b/lua/kide/plugins/init.lua @@ -463,11 +463,7 @@ require("packer").startup({ require("kide.core.layz_load").async_load("which-key.nvim") end, config = function() - require("which-key").setup({ - -- your configuration comes here - -- or leave it empty to use the default settings - -- refer to the configuration section below - }) + require("kide.plugins.config.which-key") end, }) From 2be4519a9a124f6a1791ae829fcf4da3ce6f01f7 Mon Sep 17 00:00:00 2001 From: luokai Date: Tue, 16 Aug 2022 11:38:10 +0800 Subject: [PATCH 0396/1278] java keymap --- lua/kide/lsp/java.lua | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/lua/kide/lsp/java.lua b/lua/kide/lsp/java.lua index ce3dd56a..04b1849c 100644 --- a/lua/kide/lsp/java.lua +++ b/lua/kide/lsp/java.lua @@ -267,11 +267,9 @@ config["on_attach"] = function(client, buffer) local opts = { silent = true, buffer = buffer } vim.keymap.set("n", "dc", jdtls.test_class, opts) vim.keymap.set("n", "dm", jdtls.test_nearest_method, opts) - vim.keymap.set("n", "crv", jdtls.extract_variable, opts) - vim.keymap.set("v", "crm", function() - require("jdtls").extract_method(true) - end, opts) - vim.keymap.set("n", "crc", jdtls.extract_constant, opts) + vim.keymap.set("n", "rv", jdtls.extract_variable, opts) + vim.keymap.set("v", "rm", [[lua require('jdtls').extract_method(true)]], opts) + vim.keymap.set("n", "rc", jdtls.extract_constant, opts) local create_command = vim.api.nvim_buf_create_user_command create_command(buffer, "OR", require("jdtls").organize_imports, { nargs = 0, From 8b76dd80a8d526a0628321275511722d422607b7 Mon Sep 17 00:00:00 2001 From: luokai Date: Tue, 16 Aug 2022 23:05:58 +0800 Subject: [PATCH 0397/1278] =?UTF-8?q?=E6=81=A2=E5=A4=8D=E5=BF=AB=E6=8D=B7?= =?UTF-8?q?=E9=94=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lua/kide/core/basic.lua | 2 +- lua/kide/lsp/java.lua | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/lua/kide/core/basic.lua b/lua/kide/core/basic.lua index 15d2153d..72c92c97 100644 --- a/lua/kide/core/basic.lua +++ b/lua/kide/core/basic.lua @@ -109,7 +109,7 @@ vim.g.python3_host_prog = "/opt/homebrew/bin/python3" vim.opt.list = true vim.opt.cul = true -- cursor line -vim.opt.timeoutlen = 250 +vim.opt.timeoutlen = 450 -- 始终显示符号列 vim.opt.signcolumn = "yes" diff --git a/lua/kide/lsp/java.lua b/lua/kide/lsp/java.lua index 04b1849c..529aa0b1 100644 --- a/lua/kide/lsp/java.lua +++ b/lua/kide/lsp/java.lua @@ -267,9 +267,9 @@ config["on_attach"] = function(client, buffer) local opts = { silent = true, buffer = buffer } vim.keymap.set("n", "dc", jdtls.test_class, opts) vim.keymap.set("n", "dm", jdtls.test_nearest_method, opts) - vim.keymap.set("n", "rv", jdtls.extract_variable, opts) - vim.keymap.set("v", "rm", [[lua require('jdtls').extract_method(true)]], opts) - vim.keymap.set("n", "rc", jdtls.extract_constant, opts) + vim.keymap.set("n", "crv", jdtls.extract_variable, opts) + vim.keymap.set("v", "crm", [[lua require('jdtls').extract_method(true)]], opts) + vim.keymap.set("n", "crc", jdtls.extract_constant, opts) local create_command = vim.api.nvim_buf_create_user_command create_command(buffer, "OR", require("jdtls").organize_imports, { nargs = 0, From a7f3004cf7e728660bf3bbb2901d7ff5b94585e3 Mon Sep 17 00:00:00 2001 From: luokai Date: Fri, 19 Aug 2022 23:01:00 +0800 Subject: [PATCH 0398/1278] lisp --- lua/kide/core/basic.lua | 1 + 1 file changed, 1 insertion(+) diff --git a/lua/kide/core/basic.lua b/lua/kide/core/basic.lua index 72c92c97..ce3319b9 100644 --- a/lua/kide/core/basic.lua +++ b/lua/kide/core/basic.lua @@ -50,6 +50,7 @@ autocmd("FileType", { "yaml", "http", "markdown", + "lisp", }, callback = function() vim.opt_local.tabstop = 2 From c7e7083337b95bedf162ad15b63dfee02a7d3774 Mon Sep 17 00:00:00 2001 From: luokai Date: Fri, 19 Aug 2022 23:33:24 +0800 Subject: [PATCH 0399/1278] setup_dap_main_class_configs --- lua/kide/lsp/java.lua | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/lua/kide/lsp/java.lua b/lua/kide/lsp/java.lua index 529aa0b1..4e511030 100644 --- a/lua/kide/lsp/java.lua +++ b/lua/kide/lsp/java.lua @@ -274,13 +274,13 @@ config["on_attach"] = function(client, buffer) create_command(buffer, "OR", require("jdtls").organize_imports, { nargs = 0, }) - -- local dt = vim.g.jdtls_dap_main_class_config_time or 0 - -- vim.defer_fn(function() - -- if vim.g.jdtls_dap_main_class_config_time then - -- require("jdtls.dap").setup_dap_main_class_configs() - -- end - -- vim.g.jdtls_dap_main_class_config_time = 200 - -- end, dt) + if vim.g.jdtls_dap_main_class_config_init then + vim.defer_fn(function() + require("jdtls.dap").setup_dap_main_class_configs() + require("jdtls.dap").setup_dap_main_class_configs({ verbose = true }) + end, 3000) + vim.g.jdtls_dap_main_class_config_init = false + end -- require('java-deps').attach(client, bufnr) -- vim.notify(vim.api.nvim_buf_get_name(bufnr), vim.log.levels.INFO) @@ -303,6 +303,7 @@ M.setup = function() end M.init = function() + vim.g.jdtls_dap_main_class_config_init = true local group = vim.api.nvim_create_augroup("kide_jdtls_java", { clear = true }) vim.api.nvim_create_autocmd({ "FileType" }, { group = group, From d38a6a3d43408f9f297bc04253de9e0d119dcf2e Mon Sep 17 00:00:00 2001 From: luokai Date: Fri, 19 Aug 2022 23:35:50 +0800 Subject: [PATCH 0400/1278] setup_dap_main_class_configs --- lua/kide/lsp/java.lua | 1 - 1 file changed, 1 deletion(-) diff --git a/lua/kide/lsp/java.lua b/lua/kide/lsp/java.lua index 4e511030..100b247b 100644 --- a/lua/kide/lsp/java.lua +++ b/lua/kide/lsp/java.lua @@ -276,7 +276,6 @@ config["on_attach"] = function(client, buffer) }) if vim.g.jdtls_dap_main_class_config_init then vim.defer_fn(function() - require("jdtls.dap").setup_dap_main_class_configs() require("jdtls.dap").setup_dap_main_class_configs({ verbose = true }) end, 3000) vim.g.jdtls_dap_main_class_config_init = false From 998caffb5b100ba887d010bd41d3cd8c096975dd Mon Sep 17 00:00:00 2001 From: luokai Date: Sat, 20 Aug 2022 11:40:36 +0800 Subject: [PATCH 0401/1278] config --- lua/kide/plugins/config/nvim-dap.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lua/kide/plugins/config/nvim-dap.lua b/lua/kide/plugins/config/nvim-dap.lua index 413b4690..1674eaea 100644 --- a/lua/kide/plugins/config/nvim-dap.lua +++ b/lua/kide/plugins/config/nvim-dap.lua @@ -48,5 +48,5 @@ vim.fn.sign_define("DapBreakpoint", { text = "", texthl = "Debug", linehl = " -- vim.fn.sign_define('DapLogPoint', {text='L', texthl='', linehl='', numhl=''}) -- vim.fn.sign_define('DapStopped', {text='→', texthl='', linehl='debugPC', numhl=''}) -require("nvim-dap-virtual-text").setup() +require("nvim-dap-virtual-text").setup({}) require("telescope").load_extension("dap") From f0cc45f284d02d4ba72893dfa6d0d6f1acbb70f9 Mon Sep 17 00:00:00 2001 From: luokai Date: Sat, 20 Aug 2022 11:43:37 +0800 Subject: [PATCH 0402/1278] illuminate config --- lua/kide/plugins/config/vim-illuminate.lua | 60 ++++++++++++++++------ lua/kide/plugins/init.lua | 5 +- 2 files changed, 48 insertions(+), 17 deletions(-) diff --git a/lua/kide/plugins/config/vim-illuminate.lua b/lua/kide/plugins/config/vim-illuminate.lua index 555add4c..3bdae5e0 100644 --- a/lua/kide/plugins/config/vim-illuminate.lua +++ b/lua/kide/plugins/config/vim-illuminate.lua @@ -1,16 +1,46 @@ -- https://github.com/RRethy/vim-illuminate --- 禁止高亮的文件类型 -vim.g.Illuminate_ftblacklist = { - "vista_kind", - "help", - "terminal", - "packer", - "markdown", - "git", - "text", - "txt", - "NvimTree", - "dashboard", - "alpha", - "Outline", -} + +-- default configuration +require("illuminate").configure({ + -- providers: provider used to get references in the buffer, ordered by priority + providers = { + "lsp", + "treesitter", + "regex", + }, + -- delay: delay in milliseconds + delay = 100, + -- filetypes_denylist: filetypes to not illuminate, this overrides filetypes_allowlist + filetypes_denylist = { + "dirvish", + "fugitive", + "vista_kind", + "help", + "terminal", + "packer", + "markdown", + "git", + "text", + "txt", + "NvimTree", + "dashboard", + "alpha", + "Outline", + }, + -- filetypes_allowlist: filetypes to illuminate, this is overriden by filetypes_denylist + filetypes_allowlist = {}, + -- modes_denylist: modes to not illuminate, this overrides modes_allowlist + modes_denylist = {}, + -- modes_allowlist: modes to illuminate, this is overriden by modes_denylist + modes_allowlist = {}, + -- providers_regex_syntax_denylist: syntax to not illuminate, this overrides providers_regex_syntax_allowlist + -- Only applies to the 'regex' provider + -- Use :echom synIDattr(synIDtrans(synID(line('.'), col('.'), 1)), 'name') + providers_regex_syntax_denylist = {}, + -- providers_regex_syntax_allowlist: syntax to illuminate, this is overriden by providers_regex_syntax_denylist + -- Only applies to the 'regex' provider + -- Use :echom synIDattr(synIDtrans(synID(line('.'), col('.'), 1)), 'name') + providers_regex_syntax_allowlist = {}, + -- under_cursor: whether or not to illuminate under the cursor + under_cursor = true, +}) diff --git a/lua/kide/plugins/init.lua b/lua/kide/plugins/init.lua index b12f679c..adfb3936 100644 --- a/lua/kide/plugins/init.lua +++ b/lua/kide/plugins/init.lua @@ -628,10 +628,11 @@ require("packer").startup({ "RRethy/vim-illuminate", opt = true, setup = function() - require("kide.plugins.config.vim-illuminate") - -- on_file_open("vim-illuminate") require("kide.core.layz_load").async_load("vim-illuminate") end, + config = function () + require("kide.plugins.config.vim-illuminate") + end, }) -- 快速跳转 From 8056ab3f47ee44b9cb8ab008e9081d5f909ed7af Mon Sep 17 00:00:00 2001 From: luokai Date: Sat, 20 Aug 2022 11:45:38 +0800 Subject: [PATCH 0403/1278] =?UTF-8?q?=E6=8E=92=E9=99=A4=E6=96=87=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lua/kide/plugins/config/indent-blankline.lua | 1 + lua/kide/plugins/config/vim-illuminate.lua | 1 + 2 files changed, 2 insertions(+) diff --git a/lua/kide/plugins/config/indent-blankline.lua b/lua/kide/plugins/config/indent-blankline.lua index a7f1c78d..03039999 100644 --- a/lua/kide/plugins/config/indent-blankline.lua +++ b/lua/kide/plugins/config/indent-blankline.lua @@ -22,6 +22,7 @@ require("indent_blankline").setup({ "Outline", "TelescopePrompt", "TelescopeResults", + "NeogitStatus", "", }, buftype_exclude = { "terminal" }, diff --git a/lua/kide/plugins/config/vim-illuminate.lua b/lua/kide/plugins/config/vim-illuminate.lua index 3bdae5e0..fb9f69a1 100644 --- a/lua/kide/plugins/config/vim-illuminate.lua +++ b/lua/kide/plugins/config/vim-illuminate.lua @@ -26,6 +26,7 @@ require("illuminate").configure({ "dashboard", "alpha", "Outline", + "NeogitStatus", }, -- filetypes_allowlist: filetypes to illuminate, this is overriden by filetypes_denylist filetypes_allowlist = {}, From f84aa0904aad65e3cc631990a3c6ede1be735885 Mon Sep 17 00:00:00 2001 From: luokai Date: Sat, 20 Aug 2022 12:20:19 +0800 Subject: [PATCH 0404/1278] plantuml --- lua/kide/core/utils/plantuml.lua | 2 +- lua/kide/plugins/init.lua | 8 +++++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/lua/kide/core/utils/plantuml.lua b/lua/kide/core/utils/plantuml.lua index a8110065..24ac015b 100644 --- a/lua/kide/core/utils/plantuml.lua +++ b/lua/kide/core/utils/plantuml.lua @@ -56,7 +56,7 @@ local function init() local group = vim.api.nvim_create_augroup("plantuml_export", { clear = true }) vim.api.nvim_create_autocmd({ "FileType" }, { group = group, - pattern = { "puml" }, + pattern = { "plantuml" }, desc = "Export Plantuml file", callback = function(o) vim.api.nvim_buf_create_user_command(o.buf, "Plantuml", function(opts) diff --git a/lua/kide/plugins/init.lua b/lua/kide/plugins/init.lua index adfb3936..2b27db16 100644 --- a/lua/kide/plugins/init.lua +++ b/lua/kide/plugins/init.lua @@ -630,7 +630,7 @@ require("packer").startup({ setup = function() require("kide.core.layz_load").async_load("vim-illuminate") end, - config = function () + config = function() require("kide.plugins.config.vim-illuminate") end, }) @@ -731,6 +731,12 @@ require("packer").startup({ end, }) + use({ + "aklt/plantuml-syntax", + opt = true, + ft = "plantuml", + }) + if bootstrap then require("packer").sync() end From e5ebde869e1bf145d84bf4b251dd6580206f7c62 Mon Sep 17 00:00:00 2001 From: luokai Date: Sat, 20 Aug 2022 12:28:58 +0800 Subject: [PATCH 0405/1278] =?UTF-8?q?=E7=BE=8E=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lua/kide/plugins/config/indent-blankline.lua | 4 ++++ lua/kide/plugins/config/telescope.lua | 2 +- lua/kide/plugins/config/vim-illuminate.lua | 4 ++++ 3 files changed, 9 insertions(+), 1 deletion(-) diff --git a/lua/kide/plugins/config/indent-blankline.lua b/lua/kide/plugins/config/indent-blankline.lua index 03039999..676f0f62 100644 --- a/lua/kide/plugins/config/indent-blankline.lua +++ b/lua/kide/plugins/config/indent-blankline.lua @@ -23,6 +23,10 @@ require("indent_blankline").setup({ "TelescopePrompt", "TelescopeResults", "NeogitStatus", + "NeogitPopup", + "DiffviewFiles", + "TelescopePrompt", + "TelescopeResults", "", }, buftype_exclude = { "terminal" }, diff --git a/lua/kide/plugins/config/telescope.lua b/lua/kide/plugins/config/telescope.lua index fcd675bf..be0a0f98 100644 --- a/lua/kide/plugins/config/telescope.lua +++ b/lua/kide/plugins/config/telescope.lua @@ -38,7 +38,7 @@ telescope.setup({ -- }, -- prompt_prefix = "  ", prompt_prefix = "  ", - selection_caret = " ", + selection_caret = "➜ ", entry_prefix = " ", initial_mode = "insert", selection_strategy = "reset", diff --git a/lua/kide/plugins/config/vim-illuminate.lua b/lua/kide/plugins/config/vim-illuminate.lua index fb9f69a1..67cae09f 100644 --- a/lua/kide/plugins/config/vim-illuminate.lua +++ b/lua/kide/plugins/config/vim-illuminate.lua @@ -27,6 +27,10 @@ require("illuminate").configure({ "alpha", "Outline", "NeogitStatus", + "NeogitPopup", + "DiffviewFiles", + "TelescopePrompt", + "TelescopeResults", }, -- filetypes_allowlist: filetypes to illuminate, this is overriden by filetypes_denylist filetypes_allowlist = {}, From a7e1b94ea13c2b15fab637c0adc5fd7564a0d604 Mon Sep 17 00:00:00 2001 From: luokai Date: Sat, 20 Aug 2022 16:21:00 +0800 Subject: [PATCH 0406/1278] keybindings --- lua/kide/core/keybindings.lua | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/lua/kide/core/keybindings.lua b/lua/kide/core/keybindings.lua index ad43e64b..e29cd9cc 100644 --- a/lua/kide/core/keybindings.lua +++ b/lua/kide/core/keybindings.lua @@ -30,8 +30,12 @@ M.setup = function() map("n", "w", ":bd", opt) map("n", "W", ":%bd", opt) map("n", "q", ":q", opt) - map("n", "n", ":BufferLineCycleNext ", opt) - map("n", "p", ":BufferLineCyclePrev ", opt) + -- buffer + map("n", "]b", ":BufferLineCycleNext ", opt) + map("n", "[b", ":BufferLineCyclePrev ", opt) + -- window + map("n", "", ":vertical resize +5 ", opt) + map("n", "", ":vertical resize -5 ", opt) -- " 退出 terminal 模式 map("t", "", "", opt) From ed8ef348321684b487ec93ca8af830e4a3171c07 Mon Sep 17 00:00:00 2001 From: luokai Date: Sat, 20 Aug 2022 23:59:41 +0800 Subject: [PATCH 0407/1278] fmt --- lua/kide/plugins/config/null-ls.lua | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/lua/kide/plugins/config/null-ls.lua b/lua/kide/plugins/config/null-ls.lua index 33a3cd2b..e8ad43ff 100644 --- a/lua/kide/plugins/config/null-ls.lua +++ b/lua/kide/plugins/config/null-ls.lua @@ -50,7 +50,23 @@ local sources = { }), -- null_ls.builtins.formatting.google_java_format, -- null_ls.builtins.diagnostics.semgrep, - null_ls.builtins.formatting.rustfmt, + null_ls.builtins.formatting.rustfmt.with({ + extra_args = function(params) + local Path = require("plenary.path") + local cargo_toml = Path:new(params.root .. "/" .. "Cargo.toml") + + if cargo_toml:exists() and cargo_toml:is_file() then + for _, line in ipairs(cargo_toml:readlines()) do + local edition = line:match([[^edition%s*=%s*%"(%d+)%"]]) + if edition then + return { "--edition=" .. edition } + end + end + end + -- default edition when we don't find `Cargo.toml` or the `edition` in it. + return { "--edition=2021" } + end, + }), -- null_ls.builtins.diagnostics.semgrep.with({ -- method = null_ls.methods.DIAGNOSTICS_ON_SAVE, -- extra_args = { "--config", "p/java" }, From 61cd83f5f458947b8717e34f3a38b93368c8e87f Mon Sep 17 00:00:00 2001 From: luokai Date: Mon, 22 Aug 2022 00:10:46 +0800 Subject: [PATCH 0408/1278] =?UTF-8?q?=E5=BF=AB=E6=8D=B7=E9=94=AE=E8=B0=83?= =?UTF-8?q?=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 2 +- lua/kide/core/keybindings.lua | 10 +++++----- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index 2b1ec7c8..b43f9d79 100644 --- a/README.md +++ b/README.md @@ -36,7 +36,7 @@ git clone https://github.com/JavaHello/nvim.git | 重命名 | `rn` | | Code Action | `ca` | | Debug | `F5`or`:DapContinue` | -| 断点 | `b` | +| 断点 | `db` | | 翻译 en->zh | `tz` | | 翻译 zh->en | `te` | | 内置终端 | `:ToggleTerm` | diff --git a/lua/kide/core/keybindings.lua b/lua/kide/core/keybindings.lua index e29cd9cc..98f0585d 100644 --- a/lua/kide/core/keybindings.lua +++ b/lua/kide/core/keybindings.lua @@ -31,8 +31,8 @@ M.setup = function() map("n", "W", ":%bd", opt) map("n", "q", ":q", opt) -- buffer - map("n", "]b", ":BufferLineCycleNext ", opt) - map("n", "[b", ":BufferLineCyclePrev ", opt) + map("n", "bn", ":BufferLineCycleNext ", opt) + map("n", "bp", ":BufferLineCyclePrev ", opt) -- window map("n", "", ":vertical resize +5 ", opt) map("n", "", ":vertical resize -5 ", opt) @@ -105,9 +105,9 @@ nnoremap :lua require'dap'.continue() nnoremap :lua require'dap'.step_over() nnoremap :lua require'dap'.step_into() nnoremap :lua require'dap'.step_out() -nnoremap b :lua require'dap'.toggle_breakpoint() -nnoremap B :lua require'dap'.set_breakpoint(vim.fn.input('Breakpoint condition: ')) -nnoremap lp :lua require'dap'.set_breakpoint(nil, nil, vim.fn.input('Log point message: ')) +nnoremap db :lua require'dap'.toggle_breakpoint() +nnoremap dB :lua require'dap'.set_breakpoint(vim.fn.input('Breakpoint condition: ')) +nnoremap dp :lua require'dap'.set_breakpoint(nil, nil, vim.fn.input('Log point message: ')) nnoremap dr :lua require'dap'.repl.open() nnoremap dl :lua require'dap'.run_last() ]]) From ac48c6779c455580fcfe9023025c5b497490e874 Mon Sep 17 00:00:00 2001 From: luokai Date: Mon, 22 Aug 2022 00:11:36 +0800 Subject: [PATCH 0409/1278] fmt --- lua/kide/plugins/config/which-key.lua | 1 - 1 file changed, 1 deletion(-) diff --git a/lua/kide/plugins/config/which-key.lua b/lua/kide/plugins/config/which-key.lua index 29beaaa9..1929a225 100644 --- a/lua/kide/plugins/config/which-key.lua +++ b/lua/kide/plugins/config/which-key.lua @@ -4,4 +4,3 @@ which_key.setup({ -- or leave it empty to use the default settings -- refer to the configuration section below }) - From edfd09b971f9d4136cbc0e2fa9c12444335ac76b Mon Sep 17 00:00:00 2001 From: luokai Date: Mon, 22 Aug 2022 00:16:06 +0800 Subject: [PATCH 0410/1278] :zx --- lua/kide/plugins/config/telescope.lua | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/lua/kide/plugins/config/telescope.lua b/lua/kide/plugins/config/telescope.lua index be0a0f98..61c872e7 100644 --- a/lua/kide/plugins/config/telescope.lua +++ b/lua/kide/plugins/config/telescope.lua @@ -142,3 +142,14 @@ telescope.setup({ -- telescope.load_extension('fzf') -- telescope.load_extension('gradle') -- telescope.load_extension('maven_search') + +-- 解决 telescope 打开的文件不折叠问题 +-- https://github.com/nvim-telescope/telescope.nvim/issues/1277 +vim.api.nvim_create_autocmd('BufRead', { + callback = function() + vim.api.nvim_create_autocmd('BufWinEnter', { + once = true, + command = 'normal! zx' + }) + end +}) From 0bc688e8329ca9e6f87122b97ea626a06ec0d001 Mon Sep 17 00:00:00 2001 From: luokai Date: Tue, 23 Aug 2022 23:44:34 +0800 Subject: [PATCH 0411/1278] =?UTF-8?q?=E6=81=A2=E5=A4=8D=E5=BF=AB=E6=8D=B7?= =?UTF-8?q?=E9=94=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lua/kide/core/basic.lua | 2 +- lua/kide/core/keybindings.lua | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/lua/kide/core/basic.lua b/lua/kide/core/basic.lua index ce3319b9..31477c85 100644 --- a/lua/kide/core/basic.lua +++ b/lua/kide/core/basic.lua @@ -122,7 +122,7 @@ if exists('g:neovide') let g:neovide_cursor_vfx_mode = "railgun" set guifont=Hack\ Nerd\ Font\ Mono,Hack:h13 " let g:neovide_transparency=1 - " let g:neovide_fullscreen=v:true + let g:neovide_fullscreen=v:true " let g:neovide_remember_window_size = v:true let g:neovide_input_use_logo=v:true let g:neovide_profiler = v:false diff --git a/lua/kide/core/keybindings.lua b/lua/kide/core/keybindings.lua index 98f0585d..a597f58f 100644 --- a/lua/kide/core/keybindings.lua +++ b/lua/kide/core/keybindings.lua @@ -31,8 +31,8 @@ M.setup = function() map("n", "W", ":%bd", opt) map("n", "q", ":q", opt) -- buffer - map("n", "bn", ":BufferLineCycleNext ", opt) - map("n", "bp", ":BufferLineCyclePrev ", opt) + map("n", "n", ":BufferLineCycleNext ", opt) + map("n", "p", ":BufferLineCyclePrev ", opt) -- window map("n", "", ":vertical resize +5 ", opt) map("n", "", ":vertical resize -5 ", opt) From 51f09ced1a26647713539c51e5980ce0294a9a09 Mon Sep 17 00:00:00 2001 From: luokai Date: Wed, 24 Aug 2022 21:43:42 +0800 Subject: [PATCH 0412/1278] icon --- lua/java-deps.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lua/java-deps.lua b/lua/java-deps.lua index c854c255..dd29275c 100644 --- a/lua/java-deps.lua +++ b/lua/java-deps.lua @@ -61,7 +61,7 @@ M.config = { FILE = { icon = "", hl = "TSURI" }, WORKSPACE = { icon = "", hl = "TSNamespace" }, CONTAINER = { icon = "", hl = "TSMethod" }, - PACKAGE = { icon = "", hl = "TSNamespace" }, + PACKAGE = { icon = "", hl = "TSNamespace" }, PRIMARYTYPE = { icon = "ﴯ", hl = "TSType" }, PROJECT = { icon = "פּ", hl = "TSType" }, PACKAGEROOT = { icon = "", hl = "TSType" }, From a76c4836a842d9bfff8dadef70e5aa02adc46ecd Mon Sep 17 00:00:00 2001 From: luokai Date: Wed, 24 Aug 2022 23:12:48 +0800 Subject: [PATCH 0413/1278] dressing, browse --- lua/kide/plugins/config/browse-nvim.lua | 43 ++++++ lua/kide/plugins/config/dressing-nvim.lua | 155 ++++++++++++++++++++++ lua/kide/plugins/init.lua | 23 ++++ 3 files changed, 221 insertions(+) create mode 100644 lua/kide/plugins/config/browse-nvim.lua create mode 100644 lua/kide/plugins/config/dressing-nvim.lua diff --git a/lua/kide/plugins/config/browse-nvim.lua b/lua/kide/plugins/config/browse-nvim.lua new file mode 100644 index 00000000..85ace03b --- /dev/null +++ b/lua/kide/plugins/config/browse-nvim.lua @@ -0,0 +1,43 @@ +local browse = require("browse") + +browse.setup({ + -- search provider you want to use + provider = "google", -- default +}) + +local bookmarks = { + "https://github.com/hoob3rt/lualine.nvim", + "https://github.com/neovim/neovim", + "https://neovim.discourse.group/", + "https://github.com/nvim-telescope/telescope.nvim", + "https://github.com/rockerBOO/awesome-neovim", +} + +local function command(name, rhs, opts) + opts = opts or {} + vim.api.nvim_create_user_command(name, rhs, opts) +end + +command("BrowseInputSearch", function() + browse.input_search() +end, {}) + +command("Browse", function() + browse.browse({ bookmarks = bookmarks }) +end, {}) + +command("BrowseBookmarks", function() + browse.open_bookmarks({ bookmarks = bookmarks }) +end, {}) + +command("BrowseDevdocsSearch", function() + browse.devdocs.search() +end, {}) + +command("BrowseDevdocsFiletypeSearch", function() + browse.devdocs.search_with_filetype() +end, {}) + +command("BrowseMdnSearch", function() + browse.mdn.search() +end, {}) diff --git a/lua/kide/plugins/config/dressing-nvim.lua b/lua/kide/plugins/config/dressing-nvim.lua new file mode 100644 index 00000000..b77db24c --- /dev/null +++ b/lua/kide/plugins/config/dressing-nvim.lua @@ -0,0 +1,155 @@ +require("dressing").setup({ + input = { + -- Set to false to disable the vim.ui.input implementation + enabled = true, + + -- Default prompt string + default_prompt = "Input:", + + -- Can be 'left', 'right', or 'center' + prompt_align = "left", + + -- When true, will close the modal + insert_only = true, + + -- When true, input will start in insert mode. + start_in_insert = true, + + -- These are passed to nvim_open_win + anchor = "SW", + border = "rounded", + -- 'editor' and 'win' will default to being centered + relative = "cursor", + + -- These can be integers or a float between 0 and 1 (e.g. 0.4 for 40%) + prefer_width = 40, + width = nil, + -- min_width and max_width can be a list of mixed types. + -- min_width = {20, 0.2} means "the greater of 20 columns or 20% of total" + max_width = { 140, 0.9 }, + min_width = { 20, 0.2 }, + + -- Window transparency (0-100) + winblend = 10, + -- Change default highlight groups (see :help winhl) + winhighlight = "", + + -- Set to `false` to disable + mappings = { + n = { + [""] = "Close", + [""] = "Confirm", + }, + i = { + [""] = "Close", + [""] = "Confirm", + [""] = "HistoryPrev", + [""] = "HistoryNext", + }, + }, + + override = function(conf) + -- This is the config that will be passed to nvim_open_win. + -- Change values here to customize the layout + return conf + end, + + -- see :help dressing_get_config + get_config = nil, + }, + select = { + -- Set to false to disable the vim.ui.select implementation + enabled = true, + + -- Priority list of preferred vim.select implementations + backend = { "telescope", "fzf_lua", "fzf", "builtin", "nui" }, + + -- Trim trailing `:` from prompt + trim_prompt = true, + + -- Options for telescope selector + -- These are passed into the telescope picker directly. Can be used like: + -- telescope = require('telescope.themes').get_ivy({...}) + telescope = nil, + + -- Options for fzf selector + fzf = { + window = { + width = 0.5, + height = 0.4, + }, + }, + + -- Options for fzf_lua selector + fzf_lua = { + winopts = { + width = 0.5, + height = 0.4, + }, + }, + + -- Options for nui Menu + nui = { + position = "50%", + size = nil, + relative = "editor", + border = { + style = "rounded", + }, + buf_options = { + swapfile = false, + filetype = "DressingSelect", + }, + win_options = { + winblend = 10, + }, + max_width = 80, + max_height = 40, + min_width = 40, + min_height = 10, + }, + + -- Options for built-in selector + builtin = { + -- These are passed to nvim_open_win + anchor = "NW", + border = "rounded", + -- 'editor' and 'win' will default to being centered + relative = "editor", + + -- Window transparency (0-100) + winblend = 10, + -- Change default highlight groups (see :help winhl) + winhighlight = "", + + -- These can be integers or a float between 0 and 1 (e.g. 0.4 for 40%) + -- the min_ and max_ options can be a list of mixed types. + -- max_width = {140, 0.8} means "the lesser of 140 columns or 80% of total" + width = nil, + max_width = { 140, 0.8 }, + min_width = { 40, 0.2 }, + height = nil, + max_height = 0.9, + min_height = { 10, 0.2 }, + + -- Set to `false` to disable + mappings = { + [""] = "Close", + [""] = "Close", + [""] = "Confirm", + }, + + override = function(conf) + -- This is the config that will be passed to nvim_open_win. + -- Change values here to customize the layout + return conf + end, + }, + + -- Used to override format_item. See :help dressing-format + format_item_override = {}, + + -- see :help dressing_get_config + get_config = nil, + }, +}) diff --git a/lua/kide/plugins/init.lua b/lua/kide/plugins/init.lua index 2b27db16..d20685bb 100644 --- a/lua/kide/plugins/init.lua +++ b/lua/kide/plugins/init.lua @@ -737,6 +737,29 @@ require("packer").startup({ ft = "plantuml", }) + use({ + "stevearc/dressing.nvim", + opt = true, + module = "dressing", + setup = function() + require("kide.core.layz_load").async_load("dressing.nvim") + end, + config = function() + require("kide.plugins.config.dressing-nvim") + end, + }) + + use({ + "lalitmee/browse.nvim", + opt = true, + cmd = { + "Browse", + }, + config = function() + require("kide.plugins.config.browse-nvim") + end, + }) + if bootstrap then require("packer").sync() end From 2578fbd8349227823fff3e6217d230ea42f5007f Mon Sep 17 00:00:00 2001 From: luokai Date: Thu, 25 Aug 2022 09:16:06 +0800 Subject: [PATCH 0414/1278] =?UTF-8?q?=E6=96=B0=E5=A2=9E=E6=8F=92=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../config/nvim-treesitter-context.lua | 39 +++++++++++++++++++ lua/kide/plugins/init.lua | 24 ++++++++++++ 2 files changed, 63 insertions(+) create mode 100644 lua/kide/plugins/config/nvim-treesitter-context.lua diff --git a/lua/kide/plugins/config/nvim-treesitter-context.lua b/lua/kide/plugins/config/nvim-treesitter-context.lua new file mode 100644 index 00000000..ccbde3a9 --- /dev/null +++ b/lua/kide/plugins/config/nvim-treesitter-context.lua @@ -0,0 +1,39 @@ +require("treesitter-context").setup({ + enable = true, -- Enable this plugin (Can be enabled/disabled later via commands) + max_lines = 0, -- How many lines the window should span. Values <= 0 mean no limit. + trim_scope = "outer", -- Which context lines to discard if `max_lines` is exceeded. Choices: 'inner', 'outer' + patterns = { -- Match patterns for TS nodes. These get wrapped to match at word boundaries. + -- For all filetypes + -- Note that setting an entry here replaces all other patterns for this entry. + -- By setting the 'default' entry below, you can control which nodes you want to + -- appear in the context window. + default = { + "class", + "function", + "method", + -- 'for', -- These won't appear in the context + -- 'while', + -- 'if', + -- 'switch', + -- 'case', + }, + -- Example for a specific filetype. + -- If a pattern is missing, *open a PR* so everyone can benefit. + -- rust = { + -- 'impl_item', + -- }, + }, + exact_patterns = { + -- Example for a specific filetype with Lua patterns + -- Treat patterns.rust as a Lua pattern (i.e "^impl_item$" will + -- exactly match "impl_item" only) + -- rust = true, + }, + + -- [!] The options below are exposed but shouldn't require your attention, + -- you can safely ignore them. + + zindex = 20, -- The Z-index of the context window + mode = "cursor", -- Line used to calculate context. Choices: 'cursor', 'topline' + separator = nil, -- Separator between context and content. Should be a single character string, like '-'. +}) diff --git a/lua/kide/plugins/init.lua b/lua/kide/plugins/init.lua index d20685bb..7bc53195 100644 --- a/lua/kide/plugins/init.lua +++ b/lua/kide/plugins/init.lua @@ -197,6 +197,17 @@ require("packer").startup({ require("kide.plugins.config.nvim-treesitter") end, }) + use({ + "nvim-treesitter/nvim-treesitter-context", + opt = true, + after = "nvim-treesitter-textobjects", + setup = function() + require("kide.core.layz_load").async_load("nvim-treesitter-context") + end, + config = function() + require("kide.plugins.config.nvim-treesitter-context") + end, + }) -- java use({ @@ -760,6 +771,19 @@ require("packer").startup({ end, }) + use({ + "kylechui/nvim-surround", + opt=true, + setup = function() + require("kide.core.layz_load").async_load("nvim-surround") + end, + config = function() + require("nvim-surround").setup({ + -- Configuration here, or leave empty to use defaults + }) + end, + }) + if bootstrap then require("packer").sync() end From fa2aef159b1f164ef972547703d6776a3e810277 Mon Sep 17 00:00:00 2001 From: luokai Date: Thu, 25 Aug 2022 09:45:06 +0800 Subject: [PATCH 0415/1278] =?UTF-8?q?=E6=B3=A8=E9=87=8A=E6=8F=92=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lua/kide/core/keybindings.lua | 9 +++++++++ lua/kide/plugins/config/neogen.lua | 6 ++++++ lua/kide/plugins/init.lua | 17 ++++++++++++++++- 3 files changed, 31 insertions(+), 1 deletion(-) create mode 100644 lua/kide/plugins/config/neogen.lua diff --git a/lua/kide/core/keybindings.lua b/lua/kide/core/keybindings.lua index a597f58f..b8ad299a 100644 --- a/lua/kide/core/keybindings.lua +++ b/lua/kide/core/keybindings.lua @@ -90,6 +90,10 @@ M.setup = function() -- camel_case require("kide.core.utils").camel_case_init() + -- neogen + map("n", "nc", ":lua require('neogen').generate({ type = 'class' })", opt) + map("n", "nf", ":lua require('neogen').generate({ type = 'func' })", opt) + -- vim-easy-align vim.cmd([[ " Start interactive EasyAlign in visual mode (e.g. vipga) @@ -228,6 +232,7 @@ end -- nvim-cmp 自动补全 M.cmp = function(cmp) local luasnip = require("luasnip") + local neogen = require("neogen") local has_words_before = function() local line, col = unpack(vim.api.nvim_win_get_cursor(0)) return col ~= 0 and vim.api.nvim_buf_get_lines(0, line - 1, line, true)[1]:sub(col, col):match("%s") == nil @@ -261,6 +266,8 @@ M.cmp = function(cmp) cmp.select_next_item() elseif luasnip.expand_or_jumpable() then luasnip.expand_or_jump() + elseif neogen.jumpable() then + neogen.jump_next() elseif has_words_before() then cmp.complete() else @@ -273,6 +280,8 @@ M.cmp = function(cmp) cmp.select_prev_item() elseif luasnip.jumpable(-1) then luasnip.jump(-1) + elseif neogen.jumpable(true) then + neogen.jump_prev() else fallback() end diff --git a/lua/kide/plugins/config/neogen.lua b/lua/kide/plugins/config/neogen.lua new file mode 100644 index 00000000..9a41f6c6 --- /dev/null +++ b/lua/kide/plugins/config/neogen.lua @@ -0,0 +1,6 @@ +require("neogen").setup({ + snippet_engine = "luasnip", + enabled = true, --if you want to disable Neogen + input_after_comment = true, -- (default: true) automatic jump (with insert mode) on inserted annotation + -- jump_map = "" -- (DROPPED SUPPORT, see [here](#cycle-between-annotations) !) The keymap in order to jump in the annotation fields (in insert mode) +}) diff --git a/lua/kide/plugins/init.lua b/lua/kide/plugins/init.lua index 7bc53195..f056b81a 100644 --- a/lua/kide/plugins/init.lua +++ b/lua/kide/plugins/init.lua @@ -443,6 +443,14 @@ require("packer").startup({ require("kide.plugins.config.comment") end, }) + use({ + "danymat/neogen", + opt = true, + module = "neogen", + config = function() + require("kide.plugins.config.neogen") + end, + }) -- mackdown 预览插件 use({ @@ -773,7 +781,7 @@ require("packer").startup({ use({ "kylechui/nvim-surround", - opt=true, + opt = true, setup = function() require("kide.core.layz_load").async_load("nvim-surround") end, @@ -783,6 +791,13 @@ require("packer").startup({ }) end, }) + use({ + "anuvyklack/hydra.nvim", + opt = true, + setup = function() + require("kide.core.layz_load").async_load("hydra.nvim") + end, + }) if bootstrap then require("packer").sync() From 10f860123e6a09f4f59dc5fbcbeeee702dbfd137 Mon Sep 17 00:00:00 2001 From: luokai Date: Thu, 25 Aug 2022 09:55:23 +0800 Subject: [PATCH 0416/1278] git --- lua/kide/plugins/init.lua | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/lua/kide/plugins/init.lua b/lua/kide/plugins/init.lua index f056b81a..1a373d53 100644 --- a/lua/kide/plugins/init.lua +++ b/lua/kide/plugins/init.lua @@ -760,9 +760,6 @@ require("packer").startup({ "stevearc/dressing.nvim", opt = true, module = "dressing", - setup = function() - require("kide.core.layz_load").async_load("dressing.nvim") - end, config = function() require("kide.plugins.config.dressing-nvim") end, @@ -794,9 +791,7 @@ require("packer").startup({ use({ "anuvyklack/hydra.nvim", opt = true, - setup = function() - require("kide.core.layz_load").async_load("hydra.nvim") - end, + module = "hydra", }) if bootstrap then From 7a27e1e0d45e0ae54edcdb4a24cfe32bac16345d Mon Sep 17 00:00:00 2001 From: luokai Date: Thu, 25 Aug 2022 16:52:29 +0800 Subject: [PATCH 0417/1278] navic --- lua/kide/lsp/init.lua | 7 +++--- lua/kide/lsp/java.lua | 1 + lua/kide/plugins/config/lualine.lua | 4 ++- lua/kide/plugins/config/nvim-navic.lua | 35 ++++++++++++++++++++++++++ lua/kide/plugins/init.lua | 9 +++++++ 5 files changed, 52 insertions(+), 4 deletions(-) create mode 100644 lua/kide/plugins/config/nvim-navic.lua diff --git a/lua/kide/lsp/init.lua b/lua/kide/lsp/init.lua index 2186b081..d59a8695 100644 --- a/lua/kide/lsp/init.lua +++ b/lua/kide/lsp/init.lua @@ -47,11 +47,12 @@ require("mason-lspconfig").setup_handlers({ local scfg = utils.or_default(cfg.server, {}) -- scfg = vim.tbl_deep_extend("force", server:get_default_options(), scfg) local on_attach = scfg.on_attach - scfg.on_attach = function(client, bufnr) + scfg.on_attach = function(client, buffer) -- 绑定快捷键 - require("kide.core.keybindings").maplsp(client, bufnr) + require("kide.core.keybindings").maplsp(client, buffer) + require("nvim-navic").attach(client, buffer) if on_attach then - on_attach(client, bufnr) + on_attach(client, buffer) end end scfg.flags = { diff --git a/lua/kide/lsp/java.lua b/lua/kide/lsp/java.lua index 100b247b..16302d43 100644 --- a/lua/kide/lsp/java.lua +++ b/lua/kide/lsp/java.lua @@ -281,6 +281,7 @@ config["on_attach"] = function(client, buffer) vim.g.jdtls_dap_main_class_config_init = false end + require("nvim-navic").attach(client, buffer) -- require('java-deps').attach(client, bufnr) -- vim.notify(vim.api.nvim_buf_get_name(bufnr), vim.log.levels.INFO) end diff --git a/lua/kide/plugins/config/lualine.lua b/lua/kide/plugins/config/lualine.lua index db3d7eaa..4b8a1062 100644 --- a/lua/kide/plugins/config/lualine.lua +++ b/lua/kide/plugins/config/lualine.lua @@ -1,3 +1,5 @@ +local navic = require("nvim-navic") + local config = { options = { icons_enabled = true, @@ -13,7 +15,7 @@ local config = { lualine_a = { "mode" }, lualine_b = { "branch", "diff", "diagnostics" }, -- lualine_c = {'filename', 'lsp_progress'}, - lualine_c = { "filename" }, + lualine_c = { "filename", { navic.get_location, cond = navic.is_available } }, lualine_x = { "encoding", "fileformat", "filetype" }, lualine_y = { "progress" }, lualine_z = { "location" }, diff --git a/lua/kide/plugins/config/nvim-navic.lua b/lua/kide/plugins/config/nvim-navic.lua new file mode 100644 index 00000000..fc8624bd --- /dev/null +++ b/lua/kide/plugins/config/nvim-navic.lua @@ -0,0 +1,35 @@ +local navic = require("nvim-navic") +navic.setup({ + icons = { + File = " ", + Module = " ", + Namespace = " ", + Package = " ", + Class = " ", + Method = " ", + Property = " ", + Field = " ", + Constructor = " ", + Enum = "", + Interface = "", + Function = " ", + Variable = " ", + Constant = " ", + String = " ", + Number = " ", + Boolean = "◩ ", + Array = " ", + Object = " ", + Key = " ", + Null = "ﳠ ", + EnumMember = " ", + Struct = " ", + Event = " ", + Operator = " ", + TypeParameter = " ", + }, + -- highlight = false, + -- separator = " > ", + -- depth_limit = 0, + -- depth_limit_indicator = "..", +}) diff --git a/lua/kide/plugins/init.lua b/lua/kide/plugins/init.lua index 1a373d53..32a9f30f 100644 --- a/lua/kide/plugins/init.lua +++ b/lua/kide/plugins/init.lua @@ -794,6 +794,15 @@ require("packer").startup({ module = "hydra", }) + use({ + "SmiteshP/nvim-navic", + opt = true, + module = "nvim-navic", + config = function() + require("kide.plugins.config.nvim-navic") + end, + }) + if bootstrap then require("packer").sync() end From 5b32c6ccb877a36c6d5aa218cca5d69748a07b49 Mon Sep 17 00:00:00 2001 From: luokai Date: Thu, 25 Aug 2022 17:17:29 +0800 Subject: [PATCH 0418/1278] keybindings --- lua/kide/core/keybindings.lua | 3 --- lua/kide/plugins/config/nvim-navic.lua | 2 +- 2 files changed, 1 insertion(+), 4 deletions(-) diff --git a/lua/kide/core/keybindings.lua b/lua/kide/core/keybindings.lua index b8ad299a..0b697942 100644 --- a/lua/kide/core/keybindings.lua +++ b/lua/kide/core/keybindings.lua @@ -90,9 +90,6 @@ M.setup = function() -- camel_case require("kide.core.utils").camel_case_init() - -- neogen - map("n", "nc", ":lua require('neogen').generate({ type = 'class' })", opt) - map("n", "nf", ":lua require('neogen').generate({ type = 'func' })", opt) -- vim-easy-align vim.cmd([[ diff --git a/lua/kide/plugins/config/nvim-navic.lua b/lua/kide/plugins/config/nvim-navic.lua index fc8624bd..85336a16 100644 --- a/lua/kide/plugins/config/nvim-navic.lua +++ b/lua/kide/plugins/config/nvim-navic.lua @@ -29,7 +29,7 @@ navic.setup({ TypeParameter = " ", }, -- highlight = false, - -- separator = " > ", + separator = "  ", -- depth_limit = 0, -- depth_limit_indicator = "..", }) From a1e3c57ce7b713c83b01e990cd99da283fa4abc7 Mon Sep 17 00:00:00 2001 From: luokai Date: Fri, 26 Aug 2022 14:01:17 +0800 Subject: [PATCH 0419/1278] symbol_map --- lua/kide/core/symbol_map.lua | 39 +++++++++++++++++++ lua/kide/plugins/config/nvim-navic.lua | 53 +++++++++++++------------- 2 files changed, 66 insertions(+), 26 deletions(-) create mode 100644 lua/kide/core/symbol_map.lua diff --git a/lua/kide/core/symbol_map.lua b/lua/kide/core/symbol_map.lua new file mode 100644 index 00000000..54b18486 --- /dev/null +++ b/lua/kide/core/symbol_map.lua @@ -0,0 +1,39 @@ +local M = { + Text = { icon = "" }, + Method = { icon = "", hl = "TSMethod" }, + Function = { icon = "", hl = "TSFunction" }, + Constructor = { icon = "", hl = "TSConstructor" }, + Field = { icon = "ﰠ", hl = "TSField" }, + Variable = { icon = "", hl = "TSConstant" }, + Class = { icon = "ﴯ", hl = "TSType" }, + Interface = { icon = "", hl = "TSType" }, + Module = { icon = "", hl = "TSNamespace" }, + Property = { icon = "ﰠ", hl = "TSMethod" }, + Unit = { icon = "塞" }, + Value = { icon = "" }, + Enum = { icon = "", hl = "TSType" }, + Keyword = { icon = "" }, + Snippet = { icon = "" }, + Color = { icon = "" }, + File = { icon = "", hl = "TSURI" }, + Reference = { icon = "" }, + Folder = { icon = "" }, + EnumMember = { icon = "", hl = "TSField" }, + Constant = { icon = "", hl = "TSConstant" }, + Struct = { icon = "פּ", hl = "TSType" }, + Event = { icon = "", hl = "TSType" }, + Operator = { icon = "", hl = "TSOperator" }, + TypeParameter = { icon = "", hl = "TSParameter" }, + --------------------------------------------------------- + Namespace = { icon = "", hl = "TSNamespace" }, + Package = { icon = "", hl = "TSNamespace" }, + String = { icon = "", hl = "TSString" }, + Number = { icon = "", hl = "TSNumber" }, + Boolean = { icon = "", hl = "TSBoolean" }, + Array = { icon = "", hl = "TSConstant" }, + Object = { icon = "", hl = "TSType" }, + Key = { icon = "", hl = "TSType" }, + Null = { icon = "ﳠ", hl = "TSType" }, +} + +return M diff --git a/lua/kide/plugins/config/nvim-navic.lua b/lua/kide/plugins/config/nvim-navic.lua index 85336a16..db6287d6 100644 --- a/lua/kide/plugins/config/nvim-navic.lua +++ b/lua/kide/plugins/config/nvim-navic.lua @@ -1,32 +1,33 @@ local navic = require("nvim-navic") +local symbol_map = require("kide.core.symbol_map") navic.setup({ icons = { - File = " ", - Module = " ", - Namespace = " ", - Package = " ", - Class = " ", - Method = " ", - Property = " ", - Field = " ", - Constructor = " ", - Enum = "", - Interface = "", - Function = " ", - Variable = " ", - Constant = " ", - String = " ", - Number = " ", - Boolean = "◩ ", - Array = " ", - Object = " ", - Key = " ", - Null = "ﳠ ", - EnumMember = " ", - Struct = " ", - Event = " ", - Operator = " ", - TypeParameter = " ", + File = symbol_map.File.icon .. " ", + Module = symbol_map.Module.icon .. " ", + Namespace = symbol_map.Namespace.icon .. " ", + Package = symbol_map.Package.icon .. " ", + Class = symbol_map.Class.icon .. " ", + Method = symbol_map.Method.icon .. " ", + Property = symbol_map.Property.icon .. " ", + Field = symbol_map.Field.icon .. " ", + Constructor = symbol_map.Constructor.icon .. " ", + Enum = symbol_map.Enum.icon .. "", + Interface = symbol_map.Interface.icon .. "", + Function = symbol_map.Function.icon .. " ", + Variable = symbol_map.Variable.icon .. " ", + Constant = symbol_map.Constant.icon .. " ", + String = symbol_map.String.icon .. " ", + Number = symbol_map.Number.icon .. " ", + Boolean = symbol_map.Boolean.icon .. " ", + Array = symbol_map.Array.icon .. " ", + Object = symbol_map.Object.icon .. " ", + Key = symbol_map.Key.icon .. " ", + Null = symbol_map.Null.icon .. " ", + EnumMember = symbol_map.EnumMember.icon .. " ", + Struct = symbol_map.Struct.icon .. " ", + Event = symbol_map.Event.icon .. " ", + Operator = symbol_map.Operator.icon .. " ", + TypeParameter = symbol_map.TypeParameter.icon .. " ", }, -- highlight = false, separator = "  ", From dccd5b81250ffc6ddf8f75f3be81e6e2729f8f5a Mon Sep 17 00:00:00 2001 From: luokai Date: Sat, 27 Aug 2022 14:04:13 +0800 Subject: [PATCH 0420/1278] =?UTF-8?q?=E4=BC=98=E5=8C=96=E9=85=8D=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lua/kide/plugins/init.lua | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lua/kide/plugins/init.lua b/lua/kide/plugins/init.lua index 32a9f30f..a0f43cfb 100644 --- a/lua/kide/plugins/init.lua +++ b/lua/kide/plugins/init.lua @@ -51,7 +51,6 @@ require("packer").startup({ -- 代码片段 use({ "rafamadriz/friendly-snippets", - module = "cmp_nvim_lsp", event = "InsertEnter", }) -- nvim-cmp @@ -77,6 +76,7 @@ require("packer").startup({ use({ "hrsh7th/cmp-nvim-lsp", + module = "cmp_nvim_lsp", after = "cmp_luasnip", }) use({ @@ -200,7 +200,7 @@ require("packer").startup({ use({ "nvim-treesitter/nvim-treesitter-context", opt = true, - after = "nvim-treesitter-textobjects", + after = "nvim-treesitter", setup = function() require("kide.core.layz_load").async_load("nvim-treesitter-context") end, From b0538c7c204ac62754219a4abe953649c69bc0e0 Mon Sep 17 00:00:00 2001 From: luokai Date: Sat, 27 Aug 2022 16:25:46 +0800 Subject: [PATCH 0421/1278] =?UTF-8?q?=E5=85=BC=E5=AE=B97.2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lua/kide/plugins/config/gruvbox.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lua/kide/plugins/config/gruvbox.lua b/lua/kide/plugins/config/gruvbox.lua index 05d66c2a..5117fff0 100644 --- a/lua/kide/plugins/config/gruvbox.lua +++ b/lua/kide/plugins/config/gruvbox.lua @@ -26,4 +26,4 @@ require("gruvbox").setup({ }) vim.opt.background = "dark" -vim.cmd.colorscheme("gruvbox") +vim.cmd[[colorscheme gruvbox]] From 8b4f298c4357b8d10ea2c3f8e6b98bc310fbbb68 Mon Sep 17 00:00:00 2001 From: luokai Date: Sat, 27 Aug 2022 18:00:02 +0800 Subject: [PATCH 0422/1278] =?UTF-8?q?=E6=B8=85=E7=90=86=E5=A4=9A=E4=BD=99?= =?UTF-8?q?=E6=8F=92=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lua/kide/plugins/config/nvim-treesitter.lua | 4 ---- lua/kide/plugins/init.lua | 23 +++++++++++---------- 2 files changed, 12 insertions(+), 15 deletions(-) diff --git a/lua/kide/plugins/config/nvim-treesitter.lua b/lua/kide/plugins/config/nvim-treesitter.lua index 6fb180ae..dd529c63 100644 --- a/lua/kide/plugins/config/nvim-treesitter.lua +++ b/lua/kide/plugins/config/nvim-treesitter.lua @@ -37,10 +37,6 @@ require("nvim-treesitter.configs").setup({ -- Instead of true it can also be a list of languages additional_vim_regex_highlighting = false, }, - matchup = { - enable = true, - disable = {}, - }, textobjects = { move = { enable = true, diff --git a/lua/kide/plugins/init.lua b/lua/kide/plugins/init.lua index a0f43cfb..c7785690 100644 --- a/lua/kide/plugins/init.lua +++ b/lua/kide/plugins/init.lua @@ -185,6 +185,9 @@ require("packer").startup({ wants = "gruvbox.nvim", after = "gruvbox.nvim", run = ":TSUpdate", + config = function() + require("kide.plugins.config.nvim-treesitter") + end, }) use({ "nvim-treesitter/nvim-treesitter-textobjects", @@ -193,9 +196,6 @@ require("packer").startup({ setup = function() require("kide.core.layz_load").sync_load("nvim-treesitter-textobjects") end, - config = function() - require("kide.plugins.config.nvim-treesitter") - end, }) use({ "nvim-treesitter/nvim-treesitter-context", @@ -376,14 +376,15 @@ require("packer").startup({ }) -- <>()等匹配插件 - use({ - "andymass/vim-matchup", - opt = true, - setup = function() - -- on_file_open("vim-matchup") - require("kide.core.layz_load").async_load("vim-matchup") - end, - }) + -- use({ + -- "andymass/vim-matchup", + -- opt = true, + -- after = "nvim-treesitter", + -- setup = function() + -- -- on_file_open("vim-matchup") + -- require("kide.core.layz_load").async_load("vim-matchup") + -- end, + -- }) -- 大纲插件 -- use 'liuchengxu/vista.vim' use({ From 7f9e995dabbb281c67bcc968ee7f1dce7188c8e2 Mon Sep 17 00:00:00 2001 From: luokai Date: Sun, 28 Aug 2022 09:29:08 +0800 Subject: [PATCH 0423/1278] =?UTF-8?q?lsp=20=E7=BE=8E=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lua/kide/lsp/init.lua | 10 +- lua/kide/lsp/java.lua | 121 +++++++++++++++++- .../{core/symbol_map.lua => lsp/lsp_ui.lua} | 14 +- lua/kide/plugins/config/gruvbox.lua | 13 +- lua/kide/plugins/config/nvim-navic.lua | 2 +- lua/kide/plugins/config/wilder.lua | 77 ++++++----- lua/kide/theme/gruvbox.lua | 2 +- 7 files changed, 187 insertions(+), 52 deletions(-) rename lua/kide/{core/symbol_map.lua => lsp/lsp_ui.lua} (84%) diff --git a/lua/kide/lsp/init.lua b/lua/kide/lsp/init.lua index d59a8695..4cf040ae 100644 --- a/lua/kide/lsp/init.lua +++ b/lua/kide/lsp/init.lua @@ -81,19 +81,19 @@ lspSymbol("Hint", "") lspSymbol("Warn", "") vim.diagnostic.config({ - virtual_text = { - prefix = "", - }, + virtual_text = true, signs = true, underline = true, update_in_insert = false, + severity_sort = false, }) +local border = require("kide.lsp.lsp_ui").hover_border vim.lsp.handlers["textDocument/hover"] = vim.lsp.with(vim.lsp.handlers.hover, { - border = "single", + border = border, }) vim.lsp.handlers["textDocument/signatureHelp"] = vim.lsp.with(vim.lsp.handlers.signature_help, { - border = "single", + border = border, }) -- suppress error messages from lang servers diff --git a/lua/kide/lsp/java.lua b/lua/kide/lsp/java.lua index 16302d43..8482b140 100644 --- a/lua/kide/lsp/java.lua +++ b/lua/kide/lsp/java.lua @@ -135,8 +135,10 @@ local config = { -- for a list of options settings = { java = { + maxConcurrentBuilds = 8, home = get_java_home(), project = { + encoding = "UTF-8", resourceFilters = { "node_modules", ".git", @@ -179,10 +181,16 @@ local config = { downloadSources = true, updateSnapshots = true, }, - signatureHelp = { enabled = true }, + signatureHelp = { + enabled = true, + description = { + enabled = true, + }, + }, contentProvider = { preferred = "fernflower" }, completion = { favoriteStaticMembers = { + "org.junit.Assert.*", "org.hamcrest.MatcherAssert.assertThat", "org.hamcrest.Matchers.*", "org.hamcrest.CoreMatchers.*", @@ -195,6 +203,7 @@ local config = { "com.sun.*", "io.micrometer.shaded.*", "java.awt.*", + "org.graalvm.*", "jdk.*", "sun.*", }, @@ -228,6 +237,12 @@ local config = { }, }, }, + -- referencesCodeLens = { + -- enabled = true, + -- }, + -- implementationsCodeLens = { + -- enabled = true, + -- }, }, }, @@ -298,6 +313,108 @@ local capabilities = require("cmp_nvim_lsp").update_capabilities(vim.lsp.protoco config.capabilities = capabilities +local function markdown_format(input) + if input then + -- input = string.gsub(input, "[\r\n]( +)(%*)", function (i1) + -- return i1 .. "-" + -- end) + return string.gsub(input, "(%[)([^%]]+)(%])(%(jdt://[^%)]+%))", function(_, i2) + return "`" .. i2 .. "`" + end) + end + return input +end + +local function split_lines(value) + value = string.gsub(value, "\r\n?", "\n") + return vim.split(value, "\n", true) +end +function M.convert_input_to_markdown_lines(input, contents) + contents = contents or {} + -- MarkedString variation 1 + if type(input) == "string" then + input = markdown_format(input) + vim.list_extend(contents, split_lines(input)) + else + assert(type(input) == "table", "Expected a table for Hover.contents") + -- MarkupContent + if input.kind then + -- The kind can be either plaintext or markdown. + -- If it's plaintext, then wrap it in a block + + -- Some servers send input.value as empty, so let's ignore this :( + local value = input.value or "" + + if input.kind == "plaintext" then + -- wrap this in a block so that stylize_markdown + -- can properly process it as plaintext + value = string.format("\n%s\n", value) + end + + -- assert(type(value) == 'string') + vim.list_extend(contents, split_lines(value)) + -- MarkupString variation 2 + elseif input.language then + -- Some servers send input.value as empty, so let's ignore this :( + -- assert(type(input.value) == 'string') + table.insert(contents, "```" .. input.language) + vim.list_extend(contents, split_lines(input.value or "")) + table.insert(contents, "```") + -- By deduction, this must be MarkedString[] + else + -- Use our existing logic to handle MarkedString + for _, marked_string in ipairs(input) do + M.convert_input_to_markdown_lines(marked_string, contents) + end + end + end + if (contents[1] == "" or contents[1] == nil) and #contents == 1 then + return {} + end + return contents +end + +local function jhover(_, result, ctx, c) + c = c or {} + c.focus_id = ctx.method + c.stylize_markdown = true + if not (result and result.contents) then + vim.notify("No information available") + return + end + local markdown_lines = M.convert_input_to_markdown_lines(result.contents) + markdown_lines = vim.lsp.util.trim_empty_lines(markdown_lines) + if vim.tbl_isempty(markdown_lines) then + vim.notify("No information available") + return + end + local b, w = vim.lsp.util.open_floating_preview(markdown_lines, "markdown", c) + -- vim.api.nvim_win_set_option(w, "winblend", 10) + return b, w +end +vim.lsp.handlers["textDocument/hover"] = vim.lsp.with(jhover, { border = require("kide.lsp.lsp_ui").hover_border }) +local source = require("cmp_nvim_lsp.source") +source.resolve = function(self, completion_item, callback) + -- client is stopped. + if self.client.is_stopped() then + return callback() + end + + -- client has no completion capability. + if not self:_get(self.client.server_capabilities, { "completionProvider", "resolveProvider" }) then + return callback() + end + + self:_request("completionItem/resolve", completion_item, function(_, response) + -- print(vim.inspect(response)) + if response and response.documentation then + response.documentation.value = markdown_format(response.documentation.value) + end + -- print(vim.inspect(response)) + callback(response or completion_item) + end) +end + M.setup = function() jdtls.start_or_attach(config) end @@ -309,7 +426,7 @@ M.init = function() group = group, pattern = { "java" }, desc = "jdtls", - callback = function(o) + callback = function(_) -- vim.notify("load: " .. o.buf, vim.log.levels.INFO) M.setup() end, diff --git a/lua/kide/core/symbol_map.lua b/lua/kide/lsp/lsp_ui.lua similarity index 84% rename from lua/kide/core/symbol_map.lua rename to lua/kide/lsp/lsp_ui.lua index 54b18486..7c81e9f4 100644 --- a/lua/kide/core/symbol_map.lua +++ b/lua/kide/lsp/lsp_ui.lua @@ -1,4 +1,5 @@ -local M = { +local M = {} +M.symbol_map = { Text = { icon = "" }, Method = { icon = "", hl = "TSMethod" }, Function = { icon = "", hl = "TSFunction" }, @@ -36,4 +37,15 @@ local M = { Null = { icon = "ﳠ", hl = "TSType" }, } +M.hover_border = { + { "╭", "FloatBorder" }, + { "─", "FloatBorder" }, + { "╮", "FloatBorder" }, + { "│", "FloatBorder" }, + { "╯", "FloatBorder" }, + { "─", "FloatBorder" }, + { "╰", "FloatBorder" }, + { "│", "FloatBorder" }, +} + return M diff --git a/lua/kide/plugins/config/gruvbox.lua b/lua/kide/plugins/config/gruvbox.lua index 5117fff0..cf2d7bc9 100644 --- a/lua/kide/plugins/config/gruvbox.lua +++ b/lua/kide/plugins/config/gruvbox.lua @@ -2,14 +2,23 @@ -- Default options: local colors = require("gruvbox.palette") +local kgrubox = require("kide.theme.gruvbox") local overrides = { NvimTreeFolderIcon = { fg = colors.bright_green, }, + NormalFloat = { + bg = kgrubox.colors.black3, + }, + Pmenu = { + bg = kgrubox.colors.black2, + }, + + -- cmp, wilder } -overrides = vim.tbl_extend("force", overrides, require("kide.theme.gruvbox").flat_telescope) +overrides = vim.tbl_extend("force", overrides, kgrubox.flat_telescope) require("gruvbox").setup({ undercurl = true, @@ -26,4 +35,4 @@ require("gruvbox").setup({ }) vim.opt.background = "dark" -vim.cmd[[colorscheme gruvbox]] +vim.cmd([[colorscheme gruvbox]]) diff --git a/lua/kide/plugins/config/nvim-navic.lua b/lua/kide/plugins/config/nvim-navic.lua index db6287d6..6fec4e13 100644 --- a/lua/kide/plugins/config/nvim-navic.lua +++ b/lua/kide/plugins/config/nvim-navic.lua @@ -1,5 +1,5 @@ local navic = require("nvim-navic") -local symbol_map = require("kide.core.symbol_map") +local symbol_map = require("kide.lsp.lsp_ui").symbol_map navic.setup({ icons = { File = symbol_map.File.icon .. " ", diff --git a/lua/kide/plugins/config/wilder.lua b/lua/kide/plugins/config/wilder.lua index 1cd6f4cd..fecc8475 100644 --- a/lua/kide/plugins/config/wilder.lua +++ b/lua/kide/plugins/config/wilder.lua @@ -1,42 +1,39 @@ -local result = vim.api.nvim_exec( - [[ -call wilder#setup({ - \ 'modes': [':', '/', '?'], - \ 'next_key': '', - \ 'previous_key': '', - \ 'accept_key': '', - \ 'reject_key': '', - \ }) +local wilder = require("wilder") +wilder.setup({ + modes = { ":", "/", "?" }, + next_key = "", + previous_key = "", + accept_key = "", + reject_key = "", +}) +local popupmenu_renderer = wilder.popupmenu_renderer(wilder.popupmenu_border_theme({ + highlighter = wilder.basic_highlighter(), + highlights = { + bg = "NormalFloat", + border = "NormalFloat", -- highlight to use for the border + }, + pumblend = 20, + -- 'single', 'double', 'rounded' or 'solid' + -- can also be a list of 8 characters, see :h wilder#popupmenu_border_theme() for more details + border = "rounded", + left = { " ", wilder.popupmenu_devicons() }, + right = { " ", wilder.popupmenu_scrollbar() }, +})) - -let s:popupmenu_renderer = wilder#popupmenu_renderer(wilder#popupmenu_border_theme({ - \ 'highlighter': wilder#basic_highlighter(), - \ 'empty_message': wilder#popupmenu_empty_message_with_spinner(), - \ 'pumblend': 20, - \ 'left': [ - \ ' ', wilder#popupmenu_devicons(), - \ ], - \ 'right': [ - \ ' ', wilder#popupmenu_scrollbar(), - \ ], - \ 'highlights': { - \ 'border': 'Normal', - \ }, - \ 'border': 'rounded', - \ })) - -let s:wildmenu_renderer = wilder#wildmenu_renderer({ - \ 'highlighter': wilder#basic_highlighter(), - \ 'separator': ' | ', - \ 'left': [' ', wilder#wildmenu_spinner(), ' '], - \ 'right': [' ', wilder#wildmenu_index()], - \ }) - -call wilder#set_option('renderer', wilder#renderer_mux({ - \ ':': s:popupmenu_renderer, - \ '/': s:wildmenu_renderer, - \ 'substitute': s:wildmenu_renderer, - \ })) -]], - true +local wildmenu_renderer = wilder.wildmenu_renderer({ + highlighter = wilder.basic_highlighter(), + highlights = { + bg = "NormalFloat", + border = "NormalFloat", -- highlight to use for the border + }, + separator = " · ", + left = { " ", wilder.wildmenu_spinner(), " " }, + right = { " ", wilder.wildmenu_index() }, +}) +wilder.set_option( + "renderer", + wilder.renderer_mux({ + [":"] = popupmenu_renderer, + ["/"] = wildmenu_renderer, + }) ) diff --git a/lua/kide/theme/gruvbox.lua b/lua/kide/theme/gruvbox.lua index 4262e001..124abbf8 100644 --- a/lua/kide/theme/gruvbox.lua +++ b/lua/kide/theme/gruvbox.lua @@ -5,7 +5,7 @@ local colors = { black = "#282828", black2 = "#2e2e2e", black3 = "#313131", - grey = "#464646", + gray = "#928374", red = "#fb4934", green = "#b8bb26", yellow = "#fabd2f", From 4da3a91cc817f2e3da140191067da8b68b4a10fc Mon Sep 17 00:00:00 2001 From: luokai Date: Sun, 28 Aug 2022 10:14:53 +0800 Subject: [PATCH 0424/1278] jhover --- lua/kide/lsp/java.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lua/kide/lsp/java.lua b/lua/kide/lsp/java.lua index 8482b140..3c7e9147 100644 --- a/lua/kide/lsp/java.lua +++ b/lua/kide/lsp/java.lua @@ -318,7 +318,7 @@ local function markdown_format(input) -- input = string.gsub(input, "[\r\n]( +)(%*)", function (i1) -- return i1 .. "-" -- end) - return string.gsub(input, "(%[)([^%]]+)(%])(%(jdt://[^%)]+%))", function(_, i2) + return string.gsub(input, "(%[)([^%]]+[\\%]%)]*)(%])(%(jdt://[^%)]+%))", function(_, i2) return "`" .. i2 .. "`" end) end From 9667436be21aa4d9093e90d3f30319294fb7f337 Mon Sep 17 00:00:00 2001 From: luokai Date: Sun, 28 Aug 2022 10:42:26 +0800 Subject: [PATCH 0425/1278] jhover --- lua/kide/lsp/java.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lua/kide/lsp/java.lua b/lua/kide/lsp/java.lua index 3c7e9147..ae13842b 100644 --- a/lua/kide/lsp/java.lua +++ b/lua/kide/lsp/java.lua @@ -318,7 +318,7 @@ local function markdown_format(input) -- input = string.gsub(input, "[\r\n]( +)(%*)", function (i1) -- return i1 .. "-" -- end) - return string.gsub(input, "(%[)([^%]]+[\\%]%)]*)(%])(%(jdt://[^%)]+%))", function(_, i2) + return string.gsub(input, "(%[)([^%]]+[,%s%w%[\\%]%)]*)(%])%(([jdt://file://]).+%)", function(_, i2) return "`" .. i2 .. "`" end) end From c98c40f918145f69936b81523a47cf3caa95c97e Mon Sep 17 00:00:00 2001 From: luokai Date: Sun, 28 Aug 2022 11:30:22 +0800 Subject: [PATCH 0426/1278] jhover --- lua/kide/lsp/java.lua | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/lua/kide/lsp/java.lua b/lua/kide/lsp/java.lua index ae13842b..4dd6eb4c 100644 --- a/lua/kide/lsp/java.lua +++ b/lua/kide/lsp/java.lua @@ -318,9 +318,11 @@ local function markdown_format(input) -- input = string.gsub(input, "[\r\n]( +)(%*)", function (i1) -- return i1 .. "-" -- end) - return string.gsub(input, "(%[)([^%]]+[,%s%w%[\\%]%)]*)(%])%(([jdt://file://]).+%)", function(_, i2) - return "`" .. i2 .. "`" + input = string.gsub(input, "%[([^:/]*)%]", function(i1) + return "`" .. i1 .. "`" end) + input = string.gsub(input, "%(file:/[^%)]+%)", "") + input = string.gsub(input, "%(jdt://[^%)]+%)", "") end return input end From a441562538b6e1febb850afe4742e7e813f7cbd4 Mon Sep 17 00:00:00 2001 From: luokai Date: Sun, 28 Aug 2022 23:47:42 +0800 Subject: [PATCH 0427/1278] hover ui --- lua/kide/lsp/init.lua | 10 +++------- lua/kide/lsp/java.lua | 4 +++- lua/kide/lsp/lsp_ui.lua | 21 ++++++++++++--------- 3 files changed, 18 insertions(+), 17 deletions(-) diff --git a/lua/kide/lsp/init.lua b/lua/kide/lsp/init.lua index 4cf040ae..deb26f2e 100644 --- a/lua/kide/lsp/init.lua +++ b/lua/kide/lsp/init.lua @@ -88,13 +88,9 @@ vim.diagnostic.config({ severity_sort = false, }) -local border = require("kide.lsp.lsp_ui").hover_border -vim.lsp.handlers["textDocument/hover"] = vim.lsp.with(vim.lsp.handlers.hover, { - border = border, -}) -vim.lsp.handlers["textDocument/signatureHelp"] = vim.lsp.with(vim.lsp.handlers.signature_help, { - border = border, -}) +local lsp_ui = require("kide.lsp.lsp_ui") +vim.lsp.handlers["textDocument/hover"] = vim.lsp.with(vim.lsp.handlers.hover, lsp_ui.hover_actions) +vim.lsp.handlers["textDocument/signatureHelp"] = vim.lsp.with(vim.lsp.handlers.signature_help, lsp_ui.hover_actions) -- suppress error messages from lang servers -- vim.notify = function(msg, log_level) diff --git a/lua/kide/lsp/java.lua b/lua/kide/lsp/java.lua index 4dd6eb4c..b744c9a2 100644 --- a/lua/kide/lsp/java.lua +++ b/lua/kide/lsp/java.lua @@ -394,7 +394,9 @@ local function jhover(_, result, ctx, c) -- vim.api.nvim_win_set_option(w, "winblend", 10) return b, w end -vim.lsp.handlers["textDocument/hover"] = vim.lsp.with(jhover, { border = require("kide.lsp.lsp_ui").hover_border }) + +local lsp_ui = require("kide.lsp.lsp_ui") +vim.lsp.handlers["textDocument/hover"] = vim.lsp.with(jhover, lsp_ui.hover_actions) local source = require("cmp_nvim_lsp.source") source.resolve = function(self, completion_item, callback) -- client is stopped. diff --git a/lua/kide/lsp/lsp_ui.lua b/lua/kide/lsp/lsp_ui.lua index 7c81e9f4..f4fbb3ca 100644 --- a/lua/kide/lsp/lsp_ui.lua +++ b/lua/kide/lsp/lsp_ui.lua @@ -37,15 +37,18 @@ M.symbol_map = { Null = { icon = "ﳠ", hl = "TSType" }, } -M.hover_border = { - { "╭", "FloatBorder" }, - { "─", "FloatBorder" }, - { "╮", "FloatBorder" }, - { "│", "FloatBorder" }, - { "╯", "FloatBorder" }, - { "─", "FloatBorder" }, - { "╰", "FloatBorder" }, - { "│", "FloatBorder" }, +M.hover_actions = { + width = 120, + border = { + { "╭", "FloatBorder" }, + { "─", "FloatBorder" }, + { "╮", "FloatBorder" }, + { "│", "FloatBorder" }, + { "╯", "FloatBorder" }, + { "─", "FloatBorder" }, + { "╰", "FloatBorder" }, + { "│", "FloatBorder" }, + }, } return M From fb48b2701762fa044d998b8fcb633e86cf25178a Mon Sep 17 00:00:00 2001 From: luokai Date: Tue, 30 Aug 2022 21:15:39 +0800 Subject: [PATCH 0428/1278] lsp ui --- lua/kide/plugins/config/symbols-outline.lua | 54 +++++++++++---------- 1 file changed, 28 insertions(+), 26 deletions(-) diff --git a/lua/kide/plugins/config/symbols-outline.lua b/lua/kide/plugins/config/symbols-outline.lua index 34434505..efcdce57 100644 --- a/lua/kide/plugins/config/symbols-outline.lua +++ b/lua/kide/plugins/config/symbols-outline.lua @@ -1,3 +1,5 @@ +local lsp_ui = require("kide.lsp.lsp_ui") +local symbols_map = lsp_ui.symbol_map -- init.lua require("symbols-outline").setup({ highlight_hovered_item = false, @@ -23,31 +25,31 @@ require("symbols-outline").setup({ lsp_blacklist = {}, symbol_blacklist = {}, symbols = { - File = { icon = "", hl = "TSURI" }, - Module = { icon = "", hl = "TSNamespace" }, - Namespace = { icon = "", hl = "TSNamespace" }, - Package = { icon = "", hl = "TSNamespace" }, - Class = { icon = "ﴯ", hl = "TSType" }, - Method = { icon = "", hl = "TSMethod" }, - Property = { icon = "ﰠ", hl = "TSMethod" }, - Field = { icon = "ﰠ", hl = "TSField" }, - Constructor = { icon = "", hl = "TSConstructor" }, - Enum = { icon = "", hl = "TSType" }, - Interface = { icon = "", hl = "TSType" }, - Function = { icon = "", hl = "TSFunction" }, - Variable = { icon = "", hl = "TSConstant" }, - Constant = { icon = "", hl = "TSConstant" }, - String = { icon = "", hl = "TSString" }, - Number = { icon = "", hl = "TSNumber" }, - Boolean = { icon = "", hl = "TSBoolean" }, - Array = { icon = "", hl = "TSConstant" }, - Object = { icon = "", hl = "TSType" }, - Key = { icon = "", hl = "TSType" }, - Null = { icon = "ﳠ", hl = "TSType" }, - EnumMember = { icon = "", hl = "TSField" }, - Struct = { icon = "פּ", hl = "TSType" }, - Event = { icon = "", hl = "TSType" }, - Operator = { icon = "", hl = "TSOperator" }, - TypeParameter = { icon = "", hl = "TSParameter" }, + File = symbols_map.File, + Module = symbols_map.Module, + Namespace = symbols_map.Namespace, + Package = symbols_map.Package, + Class = symbols_map.Class, + Method = symbols_map.Method, + Property = symbols_map.Property, + Field = symbols_map.Field, + Constructor = symbols_map.Constructor, + Enum = symbols_map.Enum, + Interface = symbols_map.Interface, + Function = symbols_map.Function, + Variable = symbols_map.Variable, + Constant = symbols_map.Constant, + String = symbols_map.String, + Number = symbols_map.Number, + Boolean = symbols_map.Boolean, + Array = symbols_map.Array, + Object = symbols_map.Object, + Key = symbols_map.Key, + Null = symbols_map.Null, + EnumMember = symbols_map.EnumMember, + Struct = symbols_map.Struct, + Event = symbols_map.Event, + Operator = symbols_map.Operator, + TypeParameter = symbols_map.TypeParameter, }, }) From 732867858a30280484d79e2378b2b1d5aabf0eca Mon Sep 17 00:00:00 2001 From: luokai Date: Tue, 30 Aug 2022 21:20:53 +0800 Subject: [PATCH 0429/1278] lsp ui --- lua/kide/lsp/lsp_ui.lua | 2 ++ lua/kide/plugins/config/symbols-outline.lua | 4 +++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/lua/kide/lsp/lsp_ui.lua b/lua/kide/lsp/lsp_ui.lua index f4fbb3ca..e4c4e47b 100644 --- a/lua/kide/lsp/lsp_ui.lua +++ b/lua/kide/lsp/lsp_ui.lua @@ -35,6 +35,8 @@ M.symbol_map = { Object = { icon = "", hl = "TSType" }, Key = { icon = "", hl = "TSType" }, Null = { icon = "ﳠ", hl = "TSType" }, + Component = { icon = '', hl = 'TSFunction' }, + Fragment = { icon = '', hl = 'TSConstant' }, } M.hover_actions = { diff --git a/lua/kide/plugins/config/symbols-outline.lua b/lua/kide/plugins/config/symbols-outline.lua index efcdce57..a54eb8cd 100644 --- a/lua/kide/plugins/config/symbols-outline.lua +++ b/lua/kide/plugins/config/symbols-outline.lua @@ -7,7 +7,7 @@ require("symbols-outline").setup({ auto_preview = false, position = "right", relative_width = true, - width = 34, + width = 25, auto_close = false, show_numbers = false, show_relative_numbers = false, @@ -51,5 +51,7 @@ require("symbols-outline").setup({ Event = symbols_map.Event, Operator = symbols_map.Operator, TypeParameter = symbols_map.TypeParameter, + Component = symbols_map.Component, + Fragment = symbols_map.Fragment, }, }) From 8d5965a06266d4f071d5f8452dd8be2e001e734e Mon Sep 17 00:00:00 2001 From: luokai Date: Tue, 30 Aug 2022 21:50:15 +0800 Subject: [PATCH 0430/1278] =?UTF-8?q?=E6=8F=92=E4=BB=B6=E6=95=B4=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lua/kide/plugins/init.lua | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/lua/kide/plugins/init.lua b/lua/kide/plugins/init.lua index c7785690..da7169c1 100644 --- a/lua/kide/plugins/init.lua +++ b/lua/kide/plugins/init.lua @@ -757,15 +757,17 @@ require("packer").startup({ ft = "plantuml", }) - use({ - "stevearc/dressing.nvim", - opt = true, - module = "dressing", - config = function() - require("kide.plugins.config.dressing-nvim") - end, - }) + -- UI 美化 + -- use({ + -- "stevearc/dressing.nvim", + -- opt = true, + -- module = "dressing", + -- config = function() + -- require("kide.plugins.config.dressing-nvim") + -- end, + -- }) + -- 浏览器搜索 use({ "lalitmee/browse.nvim", opt = true, @@ -777,6 +779,7 @@ require("packer").startup({ end, }) + -- 环绕输入 use({ "kylechui/nvim-surround", opt = true, From 2c8b727ce1e70028fe1a36a952089898236dff87 Mon Sep 17 00:00:00 2001 From: luokai Date: Tue, 30 Aug 2022 22:09:48 +0800 Subject: [PATCH 0431/1278] glow config --- lua/kide/plugins/init.lua | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/lua/kide/plugins/init.lua b/lua/kide/plugins/init.lua index da7169c1..e5c72fb3 100644 --- a/lua/kide/plugins/init.lua +++ b/lua/kide/plugins/init.lua @@ -468,7 +468,12 @@ require("packer").startup({ "ellisonleao/glow.nvim", opt = true, ft = "markdown", - branch = "main", + config = function() + require("glow").setup({ + style = "dark", + width = 120, + }) + end, }) -- 格式化插件 -> 使用 null-ls From a180114ae56892f0b264920cd60af90cd33d6e57 Mon Sep 17 00:00:00 2001 From: luokai Date: Tue, 30 Aug 2022 23:22:04 +0800 Subject: [PATCH 0432/1278] LSP --- lua/kide/plugins/config/lualine.lua | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/lua/kide/plugins/config/lualine.lua b/lua/kide/plugins/config/lualine.lua index 4b8a1062..51a7cd03 100644 --- a/lua/kide/plugins/config/lualine.lua +++ b/lua/kide/plugins/config/lualine.lua @@ -15,7 +15,23 @@ local config = { lualine_a = { "mode" }, lualine_b = { "branch", "diff", "diagnostics" }, -- lualine_c = {'filename', 'lsp_progress'}, - lualine_c = { "filename", { navic.get_location, cond = navic.is_available } }, + lualine_c = { + { + function() + local names = {} + for _, server in pairs(vim.lsp.buf_get_clients(0)) do + table.insert(names, server.name) + end + if vim.tbl_isempty(names) then + return " [No LSP]" + else + return " [" .. table.concat(names, " ") .. "]" + end + end, + }, + "filename", + { navic.get_location, cond = navic.is_available }, + }, lualine_x = { "encoding", "fileformat", "filetype" }, lualine_y = { "progress" }, lualine_z = { "location" }, From 483faeb17547dfb89e1c199788e92aed33f6dcb8 Mon Sep 17 00:00:00 2001 From: luokai Date: Wed, 31 Aug 2022 11:14:37 +0800 Subject: [PATCH 0433/1278] zk-nvim --- lua/kide/plugins/config/zk-nvim.lua | 21 +++++++++++++++++++++ lua/kide/plugins/init.lua | 20 ++++++++++++++++++++ 2 files changed, 41 insertions(+) create mode 100644 lua/kide/plugins/config/zk-nvim.lua diff --git a/lua/kide/plugins/config/zk-nvim.lua b/lua/kide/plugins/config/zk-nvim.lua new file mode 100644 index 00000000..593ebc1f --- /dev/null +++ b/lua/kide/plugins/config/zk-nvim.lua @@ -0,0 +1,21 @@ +require("zk").setup({ + -- can be "telescope", "fzf" or "select" (`vim.ui.select`) + -- it's recommended to use "telescope" or "fzf" + picker = "telescope", + + lsp = { + -- `config` is passed to `vim.lsp.start_client(config)` + config = { + cmd = { "zk", "lsp" }, + name = "zk", + -- on_attach = ... + -- etc, see `:h vim.lsp.start_client()` + }, + + -- automatically attach buffers in a zk notebook that match the given filetypes + auto_attach = { + enabled = true, + filetypes = { "markdown" }, + }, + }, +}) diff --git a/lua/kide/plugins/init.lua b/lua/kide/plugins/init.lua index e5c72fb3..ac892ba4 100644 --- a/lua/kide/plugins/init.lua +++ b/lua/kide/plugins/init.lua @@ -811,6 +811,26 @@ require("packer").startup({ require("kide.plugins.config.nvim-navic") end, }) + use({ + "lukas-reineke/headlines.nvim", + opt = true, + ft = { "markdown", "norg", "org" }, + config = function() + require("headlines").setup() + end, + }) + use({ + "mickael-menu/zk-nvim", + opt = true, + cmd = { + "ZkIndex", + "ZkNew", + "ZkNotes", + }, + config = function() + require("kide.plugins.config.zk-nvim") + end, + }) if bootstrap then require("packer").sync() From cd5caa9b52e2f4c62fc1c3e0e7730b4a3c6b031d Mon Sep 17 00:00:00 2001 From: luokai Date: Thu, 1 Sep 2022 04:46:38 +0800 Subject: [PATCH 0434/1278] update --- lua/kide/plugins/config/nvim-treesitter.lua | 1 + lua/kide/plugins/init.lua | 7 +++++++ 2 files changed, 8 insertions(+) diff --git a/lua/kide/plugins/config/nvim-treesitter.lua b/lua/kide/plugins/config/nvim-treesitter.lua index dd529c63..71da353c 100644 --- a/lua/kide/plugins/config/nvim-treesitter.lua +++ b/lua/kide/plugins/config/nvim-treesitter.lua @@ -16,6 +16,7 @@ require("nvim-treesitter.configs").setup({ "yaml", "http", "bash", + "markdown", }, -- Install languages synchronously (only applied to `ensure_installed`) diff --git a/lua/kide/plugins/init.lua b/lua/kide/plugins/init.lua index ac892ba4..82c7dead 100644 --- a/lua/kide/plugins/init.lua +++ b/lua/kide/plugins/init.lua @@ -797,12 +797,15 @@ require("packer").startup({ }) end, }) + + -- Create custom submodes and menus use({ "anuvyklack/hydra.nvim", opt = true, module = "hydra", }) + -- 代码状态栏导航 use({ "SmiteshP/nvim-navic", opt = true, @@ -811,6 +814,8 @@ require("packer").startup({ require("kide.plugins.config.nvim-navic") end, }) + + -- markdown 背景设置 use({ "lukas-reineke/headlines.nvim", opt = true, @@ -819,6 +824,8 @@ require("packer").startup({ require("headlines").setup() end, }) + + -- 笔记 use({ "mickael-menu/zk-nvim", opt = true, From 228312b1f2a2ed4e6a272bd0b16d246d14dcdd5e Mon Sep 17 00:00:00 2001 From: luokai Date: Thu, 1 Sep 2022 04:47:37 +0800 Subject: [PATCH 0435/1278] norg, org --- lua/kide/plugins/config/nvim-treesitter.lua | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lua/kide/plugins/config/nvim-treesitter.lua b/lua/kide/plugins/config/nvim-treesitter.lua index 71da353c..fdd61553 100644 --- a/lua/kide/plugins/config/nvim-treesitter.lua +++ b/lua/kide/plugins/config/nvim-treesitter.lua @@ -17,6 +17,8 @@ require("nvim-treesitter.configs").setup({ "http", "bash", "markdown", + "org", + "norg", }, -- Install languages synchronously (only applied to `ensure_installed`) From f8e66f05a0f525e95bcec22b4719273ecceb11bf Mon Sep 17 00:00:00 2001 From: luokai Date: Thu, 1 Sep 2022 09:25:16 +0800 Subject: [PATCH 0436/1278] =?UTF-8?q?=E8=B0=83=E6=95=B4=E9=A1=BA=E5=BA=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lua/kide/plugins/init.lua | 151 +++++++++++++++++++------------------- 1 file changed, 76 insertions(+), 75 deletions(-) diff --git a/lua/kide/plugins/init.lua b/lua/kide/plugins/init.lua index 82c7dead..d63439dc 100644 --- a/lua/kide/plugins/init.lua +++ b/lua/kide/plugins/init.lua @@ -244,6 +244,62 @@ require("packer").startup({ end, }) + -- 搜索插件 + use({ + "nvim-telescope/telescope.nvim", + opt = true, + module = "telescope", + wants = "gruvbox.nvim", + after = "gruvbox.nvim", + requires = { + "nvim-lua/plenary.nvim", + }, + config = function() + require("kide.plugins.config.telescope") + end, + }) + use({ + "nvim-telescope/telescope-ui-select.nvim", + after = "telescope.nvim", + setup = function() + require("kide.core.layz_load").async_load("telescope-ui-select.nvim") + end, + config = function() + require("telescope").load_extension("ui-select") + end, + }) + use({ + "nvim-telescope/telescope-fzf-native.nvim", + run = "make", + after = "telescope.nvim", + setup = function() + require("kide.core.layz_load").async_load("telescope-fzf-native.nvim") + end, + config = function() + require("telescope").load_extension("fzf") + end, + }) + use({ + "nvim-telescope/telescope-dap.nvim", + after = "telescope.nvim", + opt = true, + }) + + -- use 'GustavoKatel/telescope-asynctasks.nvim' + -- use 'aloussase/telescope-gradle.nvim' + -- use 'aloussase/telescope-mvnsearch' + use({ + "LinArcX/telescope-env.nvim", + opt = true, + after = "telescope.nvim", + setup = function() + require("kide.core.layz_load").async_load("telescope-env.nvim") + end, + config = function() + require("telescope").load_extension("env") + end, + }) + -- git use({ "tpope/vim-fugitive", @@ -296,26 +352,6 @@ require("packer").startup({ end, }) - -- 异步任务执行插件 - -- use 'skywind3000/asynctasks.vim' - -- use 'skywind3000/asyncrun.vim' - use({ - "jedrzejboczar/toggletasks.nvim", - opt = true, - after = "toggleterm.nvim", - setup = function() - require("kide.core.layz_load").async_load("toggletasks.nvim") - end, - requires = { - "nvim-lua/plenary.nvim", - "akinsho/toggleterm.nvim", - "nvim-telescope/telescope.nvim/", - }, - config = function() - require("kide.plugins.config.toggletasks") - end, - }) - -- 浮动窗口插件 -- use 'voldikss/vim-floaterm' -- use 'voldikss/LeaderF-floaterm' @@ -337,6 +373,26 @@ require("packer").startup({ end, }) + -- 异步任务执行插件 + -- use 'skywind3000/asynctasks.vim' + -- use 'skywind3000/asyncrun.vim' + use({ + "jedrzejboczar/toggletasks.nvim", + opt = true, + after = "toggleterm.nvim", + setup = function() + require("kide.core.layz_load").async_load("toggletasks.nvim") + end, + requires = { + "nvim-lua/plenary.nvim", + "akinsho/toggleterm.nvim", + "nvim-telescope/telescope.nvim", + }, + config = function() + require("kide.plugins.config.toggletasks") + end, + }) + -- 多光标插件 use({ "mg979/vim-visual-multi", @@ -492,61 +548,6 @@ require("packer").startup({ end, }) - -- 搜索插件 - use({ - "nvim-telescope/telescope.nvim", - opt = true, - module = "telescope", - wants = "gruvbox.nvim", - after = "gruvbox.nvim", - requires = { - "nvim-lua/plenary.nvim", - }, - config = function() - require("kide.plugins.config.telescope") - end, - }) - use({ - "nvim-telescope/telescope-ui-select.nvim", - after = "telescope.nvim", - setup = function() - require("kide.core.layz_load").async_load("telescope-ui-select.nvim") - end, - config = function() - require("telescope").load_extension("ui-select") - end, - }) - use({ - "nvim-telescope/telescope-fzf-native.nvim", - run = "make", - after = "telescope.nvim", - setup = function() - require("kide.core.layz_load").async_load("telescope-fzf-native.nvim") - end, - config = function() - require("telescope").load_extension("fzf") - end, - }) - use({ - "nvim-telescope/telescope-dap.nvim", - after = "telescope.nvim", - opt = true, - }) - - -- use 'GustavoKatel/telescope-asynctasks.nvim' - -- use 'aloussase/telescope-gradle.nvim' - -- use 'aloussase/telescope-mvnsearch' - use({ - "LinArcX/telescope-env.nvim", - opt = true, - after = "telescope.nvim", - setup = function() - require("kide.core.layz_load").async_load("telescope-env.nvim") - end, - config = function() - require("telescope").load_extension("env") - end, - }) -- 仪表盘 -- use {'glepnir/dashboard-nvim'} From ac316bf120463003434ef11395670fc2f4258410 Mon Sep 17 00:00:00 2001 From: luokai Date: Thu, 1 Sep 2022 09:29:03 +0800 Subject: [PATCH 0437/1278] =?UTF-8?q?=E5=88=A0=E9=99=A4markdown=20DIAGNOST?= =?UTF-8?q?ICS=5FON=5FSAVE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lua/kide/plugins/config/null-ls.lua | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lua/kide/plugins/config/null-ls.lua b/lua/kide/plugins/config/null-ls.lua index e8ad43ff..e473c5e1 100644 --- a/lua/kide/plugins/config/null-ls.lua +++ b/lua/kide/plugins/config/null-ls.lua @@ -37,9 +37,9 @@ local sources = { method = null_ls.methods.DIAGNOSTICS_ON_SAVE, }), -- md - null_ls.builtins.diagnostics.markdownlint.with({ - method = null_ls.methods.DIAGNOSTICS_ON_SAVE, - }), + -- null_ls.builtins.diagnostics.markdownlint.with({ + -- method = null_ls.methods.DIAGNOSTICS_ON_SAVE, + -- }), -- null_ls.builtins.code_actions.gitsigns, -- sql null_ls.builtins.formatting.sql_formatter.with({ From e79b33eeccb42f1656c49ab0659db5c568700a59 Mon Sep 17 00:00:00 2001 From: luokai Date: Thu, 1 Sep 2022 09:45:59 +0800 Subject: [PATCH 0438/1278] max_jobs --- lua/kide/plugins/init.lua | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/lua/kide/plugins/init.lua b/lua/kide/plugins/init.lua index d63439dc..5b10bbaa 100644 --- a/lua/kide/plugins/init.lua +++ b/lua/kide/plugins/init.lua @@ -817,14 +817,14 @@ require("packer").startup({ }) -- markdown 背景设置 - use({ - "lukas-reineke/headlines.nvim", - opt = true, - ft = { "markdown", "norg", "org" }, - config = function() - require("headlines").setup() - end, - }) + -- use({ + -- "lukas-reineke/headlines.nvim", + -- opt = true, + -- ft = { "markdown", "norg", "org" }, + -- config = function() + -- require("headlines").setup() + -- end, + -- }) -- 笔记 use({ @@ -848,6 +848,7 @@ require("packer").startup({ display = { open_fn = require("packer.util").float, }, + max_jobs = 10, }, }) From 8e09b70371f40015a9a8141ff69f5756c97fbff7 Mon Sep 17 00:00:00 2001 From: luokai Date: Thu, 1 Sep 2022 21:05:59 +0800 Subject: [PATCH 0439/1278] update --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index b43f9d79..7b92be45 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # NVIM IDE -支持 `Java`, `Rust`, `C/C++`, `JavaScript` 等编程语言开发。 极速启动 (60 ~ 100 ms), 注重细节。 +可配置 `Java`, `Rust`, `C/C++`, `JavaScript` 等编程语言开发环境。 极速启动 (60 ~ 100 ms), 注重细节。 ## 安装 From 71e082a9892e73c55cb693b98aa5ab309fc8d682 Mon Sep 17 00:00:00 2001 From: luokai Date: Thu, 1 Sep 2022 22:33:56 +0800 Subject: [PATCH 0440/1278] nvim-tree update --- lua/kide/lsp/init.lua | 10 +++++----- lua/kide/lsp/lsp_ui.lua | 12 ++++++++++-- lua/kide/plugins/config/nvim-tree.lua | 21 ++++++--------------- 3 files changed, 21 insertions(+), 22 deletions(-) diff --git a/lua/kide/lsp/init.lua b/lua/kide/lsp/init.lua index deb26f2e..8ce78f10 100644 --- a/lua/kide/lsp/init.lua +++ b/lua/kide/lsp/init.lua @@ -75,10 +75,11 @@ local function lspSymbol(name, icon) vim.fn.sign_define(hl, { text = icon, numhl = hl, texthl = hl }) end -lspSymbol("Error", "") -lspSymbol("Info", "") -lspSymbol("Hint", "") -lspSymbol("Warn", "") +local lsp_ui = require("kide.lsp.lsp_ui") +lspSymbol("Error", lsp_ui.diagnostics.icons.error) +lspSymbol("Info", lsp_ui.diagnostics.icons.info) +lspSymbol("Hint", lsp_ui.diagnostics.icons.hint) +lspSymbol("Warn", lsp_ui.diagnostics.icons.warning) vim.diagnostic.config({ virtual_text = true, @@ -88,7 +89,6 @@ vim.diagnostic.config({ severity_sort = false, }) -local lsp_ui = require("kide.lsp.lsp_ui") vim.lsp.handlers["textDocument/hover"] = vim.lsp.with(vim.lsp.handlers.hover, lsp_ui.hover_actions) vim.lsp.handlers["textDocument/signatureHelp"] = vim.lsp.with(vim.lsp.handlers.signature_help, lsp_ui.hover_actions) diff --git a/lua/kide/lsp/lsp_ui.lua b/lua/kide/lsp/lsp_ui.lua index e4c4e47b..ebc129a5 100644 --- a/lua/kide/lsp/lsp_ui.lua +++ b/lua/kide/lsp/lsp_ui.lua @@ -35,8 +35,8 @@ M.symbol_map = { Object = { icon = "", hl = "TSType" }, Key = { icon = "", hl = "TSType" }, Null = { icon = "ﳠ", hl = "TSType" }, - Component = { icon = '', hl = 'TSFunction' }, - Fragment = { icon = '', hl = 'TSConstant' }, + Component = { icon = "", hl = "TSFunction" }, + Fragment = { icon = "", hl = "TSConstant" }, } M.hover_actions = { @@ -53,4 +53,12 @@ M.hover_actions = { }, } +M.diagnostics = { + icons = { + hint = "", + info = "", + warning = "", + error = "", + }, +} return M diff --git a/lua/kide/plugins/config/nvim-tree.lua b/lua/kide/plugins/config/nvim-tree.lua index 79667204..8100a6e3 100644 --- a/lua/kide/plugins/config/nvim-tree.lua +++ b/lua/kide/plugins/config/nvim-tree.lua @@ -10,7 +10,6 @@ require("nvim-tree").setup({ auto_reload_on_write = true, open_on_tab = false, hijack_cursor = true, - update_cwd = false, actions = { use_system_clipboard = true, change_dir = { @@ -30,22 +29,13 @@ require("nvim-tree").setup({ }, }, }, - diagnostics = { - enable = false, - icons = { - hint = "", - info = "", - warning = "", - error = "", - }, - }, update_focused_file = { enable = true, update_cwd = false, ignore_list = {}, }, system_open = { - cmd = nil, + cmd = "", args = {}, }, filters = { @@ -77,11 +67,12 @@ require("nvim-tree").setup({ }, renderer = { indent_markers = { - enable = true, + enable = false, icons = { - corner = "└ ", - edge = "│ ", - none = " ", + corner = "└", + edge = "│", + item = "│", + none = " ", }, }, }, From 2ca59b31809a3674058bf5ecc7c21f8bd5514fa8 Mon Sep 17 00:00:00 2001 From: luokai Date: Thu, 1 Sep 2022 22:40:59 +0800 Subject: [PATCH 0441/1278] update --- lua/kide/lsp/lsp_ui.lua | 5 +++++ lua/kide/plugins/config/neogit.lua | 5 +++-- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/lua/kide/lsp/lsp_ui.lua b/lua/kide/lsp/lsp_ui.lua index ebc129a5..1e2af949 100644 --- a/lua/kide/lsp/lsp_ui.lua +++ b/lua/kide/lsp/lsp_ui.lua @@ -53,6 +53,11 @@ M.hover_actions = { }, } +M.signs = { + closed = "", + opened = "", +} + M.diagnostics = { icons = { hint = "", diff --git a/lua/kide/plugins/config/neogit.lua b/lua/kide/plugins/config/neogit.lua index b9aed821..1e94e5ea 100644 --- a/lua/kide/plugins/config/neogit.lua +++ b/lua/kide/plugins/config/neogit.lua @@ -1,3 +1,4 @@ +local lsp_ui = require("kide.lsp.lsp_ui") local neogit = require("neogit") neogit.setup({ @@ -18,8 +19,8 @@ neogit.setup({ -- customize displayed signs signs = { -- { CLOSED, OPENED } - section = { ">", "v" }, - item = { ">", "v" }, + section = { lsp_ui.signs.closed, lsp_ui.signs.opened }, + item = { lsp_ui.signs.closed, lsp_ui.signs.opened }, hunk = { "", "" }, }, integrations = { From a51b3a4bf5a1ef0837135f3b2c3cb275d0236ee1 Mon Sep 17 00:00:00 2001 From: luokai Date: Thu, 1 Sep 2022 23:15:05 +0800 Subject: [PATCH 0442/1278] async load neogit --- lua/kide/core/keybindings.lua | 1 - lua/kide/plugins/config/telescope.lua | 14 +++++++------- lua/kide/plugins/init.lua | 9 +++++---- 3 files changed, 12 insertions(+), 12 deletions(-) diff --git a/lua/kide/core/keybindings.lua b/lua/kide/core/keybindings.lua index 0b697942..47eadd27 100644 --- a/lua/kide/core/keybindings.lua +++ b/lua/kide/core/keybindings.lua @@ -90,7 +90,6 @@ M.setup = function() -- camel_case require("kide.core.utils").camel_case_init() - -- vim-easy-align vim.cmd([[ " Start interactive EasyAlign in visual mode (e.g. vipga) diff --git a/lua/kide/plugins/config/telescope.lua b/lua/kide/plugins/config/telescope.lua index 61c872e7..0812074c 100644 --- a/lua/kide/plugins/config/telescope.lua +++ b/lua/kide/plugins/config/telescope.lua @@ -145,11 +145,11 @@ telescope.setup({ -- 解决 telescope 打开的文件不折叠问题 -- https://github.com/nvim-telescope/telescope.nvim/issues/1277 -vim.api.nvim_create_autocmd('BufRead', { - callback = function() - vim.api.nvim_create_autocmd('BufWinEnter', { - once = true, - command = 'normal! zx' - }) - end +vim.api.nvim_create_autocmd("BufRead", { + callback = function() + vim.api.nvim_create_autocmd("BufWinEnter", { + once = true, + command = "normal! zx", + }) + end, }) diff --git a/lua/kide/plugins/init.lua b/lua/kide/plugins/init.lua index 5b10bbaa..ca6df6a3 100644 --- a/lua/kide/plugins/init.lua +++ b/lua/kide/plugins/init.lua @@ -324,10 +324,12 @@ require("packer").startup({ end, }) use({ + "TimUntersberger/neogit", after = "diffview.nvim", opt = true, - "TimUntersberger/neogit", - cmd = { "Neogit" }, + setup = function() + require("kide.core.layz_load").async_load("neogit") + end, config = function() require("kide.plugins.config.neogit") end, @@ -548,7 +550,6 @@ require("packer").startup({ end, }) - -- 仪表盘 -- use {'glepnir/dashboard-nvim'} use({ @@ -799,7 +800,7 @@ require("packer").startup({ end, }) - -- Create custom submodes and menus + -- Create custom submodes and menus use({ "anuvyklack/hydra.nvim", opt = true, From d5c4e5df9a3dd81e501a1252f9cee313f6edb71f Mon Sep 17 00:00:00 2001 From: luokai Date: Thu, 1 Sep 2022 23:19:05 +0800 Subject: [PATCH 0443/1278] neogit --- lua/kide/plugins/init.lua | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/lua/kide/plugins/init.lua b/lua/kide/plugins/init.lua index ca6df6a3..9add3c60 100644 --- a/lua/kide/plugins/init.lua +++ b/lua/kide/plugins/init.lua @@ -327,9 +327,7 @@ require("packer").startup({ "TimUntersberger/neogit", after = "diffview.nvim", opt = true, - setup = function() - require("kide.core.layz_load").async_load("neogit") - end, + cmd = "Neogit", config = function() require("kide.plugins.config.neogit") end, From 22e162c2a2ed0af9d7d4608a7fc2ae24addff5d8 Mon Sep 17 00:00:00 2001 From: luokai Date: Sat, 3 Sep 2022 19:38:32 +0800 Subject: [PATCH 0444/1278] pyright --- lua/kide/lsp/pyright.lua | 14 -------------- 1 file changed, 14 deletions(-) diff --git a/lua/kide/lsp/pyright.lua b/lua/kide/lsp/pyright.lua index 491ffe6f..97aeaddb 100644 --- a/lua/kide/lsp/pyright.lua +++ b/lua/kide/lsp/pyright.lua @@ -1,16 +1,2 @@ return { - server = { - organize_imports = function() - local params = { - command = "pyright.organizeimports", - arguments = { vim.uri_from_bufnr(0) }, - } - vim.lsp.buf.execute_command(params) - end, - on_attach = function(_, _) - vim.cmd([[ - command! -nargs=0 OR :lua require'lsp.pyright'.organize_imports() - ]]) - end, - }, } From 179a9dfb94a197bbcbf23c602de638c5cf949716 Mon Sep 17 00:00:00 2001 From: luokai Date: Mon, 5 Sep 2022 09:05:45 +0800 Subject: [PATCH 0445/1278] nvim-ufo --- lua/kide/core/basic.lua | 8 ++++++++ lua/kide/core/keybindings.lua | 5 +++++ lua/kide/plugins/config/nvim-treesitter.lua | 3 --- lua/kide/plugins/config/nvim-ufo.lua | 12 ++++++++++++ lua/kide/plugins/init.lua | 19 +++++++++++++++++++ 5 files changed, 44 insertions(+), 3 deletions(-) create mode 100644 lua/kide/plugins/config/nvim-ufo.lua diff --git a/lua/kide/core/basic.lua b/lua/kide/core/basic.lua index 31477c85..1e4c6b8e 100644 --- a/lua/kide/core/basic.lua +++ b/lua/kide/core/basic.lua @@ -116,6 +116,14 @@ vim.opt.timeoutlen = 450 vim.opt.signcolumn = "yes" vim.opt.mouse = "a" +vim.o.foldcolumn = "1" +-- 默认不要折叠 +-- https://stackoverflow.com/questions/8316139/how-to-set-the-default-to-unfolded-when-you-open-a-file +vim.o.foldlevel = 99 -- Using ufo provider need a large value, feel free to decrease the value +vim.o.foldlevelstart = 99 +vim.o.foldenable = true + + vim.cmd([[ if exists('g:neovide') " let g:neovide_refresh_rate=60 diff --git a/lua/kide/core/keybindings.lua b/lua/kide/core/keybindings.lua index 47eadd27..44d39cec 100644 --- a/lua/kide/core/keybindings.lua +++ b/lua/kide/core/keybindings.lua @@ -340,4 +340,9 @@ M.hop_mapkey = function() -- map('o', 'e', " lua require'hop'.hint_words({ hint_position = require'hop.hint'.HintPosition.END, inclusive_jump = true })", opt) end +M.ufo_mapkey = function() + -- Using ufo provider need remap `zR` and `zM`. If Neovim is 0.6.1, remap yourself + vim.keymap.set("n", "zR", require("ufo").openAllFolds) + vim.keymap.set("n", "zM", require("ufo").closeAllFolds) +end return M diff --git a/lua/kide/plugins/config/nvim-treesitter.lua b/lua/kide/plugins/config/nvim-treesitter.lua index fdd61553..f3599aab 100644 --- a/lua/kide/plugins/config/nvim-treesitter.lua +++ b/lua/kide/plugins/config/nvim-treesitter.lua @@ -66,6 +66,3 @@ require("nvim-treesitter.configs").setup({ -- 开启 Folding vim.wo.foldmethod = "expr" vim.wo.foldexpr = "nvim_treesitter#foldexpr()" --- 默认不要折叠 --- https://stackoverflow.com/questions/8316139/how-to-set-the-default-to-unfolded-when-you-open-a-file -vim.wo.foldlevel = 99 diff --git a/lua/kide/plugins/config/nvim-ufo.lua b/lua/kide/plugins/config/nvim-ufo.lua new file mode 100644 index 00000000..03226036 --- /dev/null +++ b/lua/kide/plugins/config/nvim-ufo.lua @@ -0,0 +1,12 @@ + +require("kide.core.keybindings").ufo_mapkey() + +-- Option 3: treesitter as a main provider instead +-- Only depend on `nvim-treesitter/queries/filetype/folds.scm`, +-- performance and stability are better than `foldmethod=nvim_treesitter#foldexpr()` +require("ufo").setup({ + provider_selector = function(bufnr, filetype, buftype) + return { "treesitter", "indent" } + end, +}) +-- diff --git a/lua/kide/plugins/init.lua b/lua/kide/plugins/init.lua index 9add3c60..de9cb4f6 100644 --- a/lua/kide/plugins/init.lua +++ b/lua/kide/plugins/init.lua @@ -839,6 +839,25 @@ require("packer").startup({ end, }) + -- 折叠 + use({ + "kevinhwang91/promise-async", + opt = true, + module = "promise", + }) + use({ + "kevinhwang91/nvim-ufo", + opt = true, + require = "kevinhwang91/promise-async", + after = "promise-async", + setup = function() + require("kide.core.layz_load").async_load("nvim-ufo") + end, + config = function() + require("kide.plugins.config.nvim-ufo") + end, + }) + if bootstrap then require("packer").sync() end From 2720f133f8a40b69d0034425b9d65a57c5fab2fc Mon Sep 17 00:00:00 2001 From: luokai Date: Mon, 5 Sep 2022 20:28:11 +0800 Subject: [PATCH 0446/1278] fmt --- lua/kide/core/basic.lua | 1 - lua/kide/lsp/pyright.lua | 3 +-- lua/kide/plugins/config/nvim-ufo.lua | 1 - 3 files changed, 1 insertion(+), 4 deletions(-) diff --git a/lua/kide/core/basic.lua b/lua/kide/core/basic.lua index 1e4c6b8e..dc25d78c 100644 --- a/lua/kide/core/basic.lua +++ b/lua/kide/core/basic.lua @@ -123,7 +123,6 @@ vim.o.foldlevel = 99 -- Using ufo provider need a large value, feel free to decr vim.o.foldlevelstart = 99 vim.o.foldenable = true - vim.cmd([[ if exists('g:neovide') " let g:neovide_refresh_rate=60 diff --git a/lua/kide/lsp/pyright.lua b/lua/kide/lsp/pyright.lua index 97aeaddb..a5647075 100644 --- a/lua/kide/lsp/pyright.lua +++ b/lua/kide/lsp/pyright.lua @@ -1,2 +1 @@ -return { -} +return {} diff --git a/lua/kide/plugins/config/nvim-ufo.lua b/lua/kide/plugins/config/nvim-ufo.lua index 03226036..17b2c7e3 100644 --- a/lua/kide/plugins/config/nvim-ufo.lua +++ b/lua/kide/plugins/config/nvim-ufo.lua @@ -1,4 +1,3 @@ - require("kide.core.keybindings").ufo_mapkey() -- Option 3: treesitter as a main provider instead From 8441716c663d9455ec3d659f1b9baf38735ae252 Mon Sep 17 00:00:00 2001 From: luokai Date: Mon, 5 Sep 2022 20:32:03 +0800 Subject: [PATCH 0447/1278] =?UTF-8?q?=E6=8F=8F=E8=BF=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README.md b/README.md index 7b92be45..c5bbbd76 100644 --- a/README.md +++ b/README.md @@ -41,6 +41,8 @@ git clone https://github.com/JavaHello/nvim.git | 翻译 zh->en | `te` | | 内置终端 | `:ToggleTerm` | | Tasks 列表 | `ts` | +| 代码折叠 | `zc` | +| 代码展开 | `zo`or`l` | 更多配置参考 [keybindings](./lua/kide/core/keybindings.lua) 文件 From ec384286d7bdc5ac48630f52e327863195de8c60 Mon Sep 17 00:00:00 2001 From: luokai Date: Tue, 6 Sep 2022 10:08:47 +0800 Subject: [PATCH 0448/1278] =?UTF-8?q?=E6=8C=87=E5=AE=9A=E6=96=87=E4=BB=B6?= =?UTF-8?q?=E7=B1=BB=E5=9E=8B=E6=98=BE=E7=A4=BA=E4=B8=8D=E5=90=8C=E6=A0=BC?= =?UTF-8?q?=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ftplugin/c.lua | 3 +++ ftplugin/cpp.lua | 3 +++ ftplugin/html.lua | 2 ++ ftplugin/java.lua | 3 +++ ftplugin/lua.lua | 3 +++ ftplugin/rust.lua | 2 ++ lua/kide/core/basic.lua | 4 ---- lua/kide/lsp/init.lua | 2 ++ lua/kide/plugins/config/nvim-treesitter.lua | 1 + lua/kide/plugins/config/nvim-ufo.lua | 14 ++++++++++++-- 10 files changed, 31 insertions(+), 6 deletions(-) create mode 100644 ftplugin/c.lua create mode 100644 ftplugin/cpp.lua create mode 100644 ftplugin/html.lua create mode 100644 ftplugin/java.lua create mode 100644 ftplugin/lua.lua create mode 100644 ftplugin/rust.lua diff --git a/ftplugin/c.lua b/ftplugin/c.lua new file mode 100644 index 00000000..5603e941 --- /dev/null +++ b/ftplugin/c.lua @@ -0,0 +1,3 @@ +vim.opt_local.foldcolumn = "1" +vim.opt_local.foldenable = true +vim.opt_local.signcolumn = "yes" diff --git a/ftplugin/cpp.lua b/ftplugin/cpp.lua new file mode 100644 index 00000000..5603e941 --- /dev/null +++ b/ftplugin/cpp.lua @@ -0,0 +1,3 @@ +vim.opt_local.foldcolumn = "1" +vim.opt_local.foldenable = true +vim.opt_local.signcolumn = "yes" diff --git a/ftplugin/html.lua b/ftplugin/html.lua new file mode 100644 index 00000000..123c5e98 --- /dev/null +++ b/ftplugin/html.lua @@ -0,0 +1,2 @@ +vim.opt_local.foldcolumn = "1" +vim.opt_local.foldenable = true diff --git a/ftplugin/java.lua b/ftplugin/java.lua new file mode 100644 index 00000000..5603e941 --- /dev/null +++ b/ftplugin/java.lua @@ -0,0 +1,3 @@ +vim.opt_local.foldcolumn = "1" +vim.opt_local.foldenable = true +vim.opt_local.signcolumn = "yes" diff --git a/ftplugin/lua.lua b/ftplugin/lua.lua new file mode 100644 index 00000000..5603e941 --- /dev/null +++ b/ftplugin/lua.lua @@ -0,0 +1,3 @@ +vim.opt_local.foldcolumn = "1" +vim.opt_local.foldenable = true +vim.opt_local.signcolumn = "yes" diff --git a/ftplugin/rust.lua b/ftplugin/rust.lua new file mode 100644 index 00000000..123c5e98 --- /dev/null +++ b/ftplugin/rust.lua @@ -0,0 +1,2 @@ +vim.opt_local.foldcolumn = "1" +vim.opt_local.foldenable = true diff --git a/lua/kide/core/basic.lua b/lua/kide/core/basic.lua index dc25d78c..8c623fab 100644 --- a/lua/kide/core/basic.lua +++ b/lua/kide/core/basic.lua @@ -112,16 +112,12 @@ vim.opt.cul = true -- cursor line vim.opt.timeoutlen = 450 --- 始终显示符号列 -vim.opt.signcolumn = "yes" vim.opt.mouse = "a" -vim.o.foldcolumn = "1" -- 默认不要折叠 -- https://stackoverflow.com/questions/8316139/how-to-set-the-default-to-unfolded-when-you-open-a-file vim.o.foldlevel = 99 -- Using ufo provider need a large value, feel free to decrease the value vim.o.foldlevelstart = 99 -vim.o.foldenable = true vim.cmd([[ if exists('g:neovide') diff --git a/lua/kide/lsp/init.lua b/lua/kide/lsp/init.lua index 8ce78f10..6f5c1bbf 100644 --- a/lua/kide/lsp/init.lua +++ b/lua/kide/lsp/init.lua @@ -9,6 +9,7 @@ mason_lspconfig.setup({ "rust_analyzer", "sqls", "gopls", + "kotlin_language_server", }, }) @@ -26,6 +27,7 @@ local server_configs = { rust_analyzer = require("kide.lsp.rust_analyzer"), sqls = require("kide.lsp.sqls"), gopls = require("kide.lsp.gopls"), + kotlin_language_server = {}, } -- Setup lspconfig. diff --git a/lua/kide/plugins/config/nvim-treesitter.lua b/lua/kide/plugins/config/nvim-treesitter.lua index f3599aab..7c869c66 100644 --- a/lua/kide/plugins/config/nvim-treesitter.lua +++ b/lua/kide/plugins/config/nvim-treesitter.lua @@ -19,6 +19,7 @@ require("nvim-treesitter.configs").setup({ "markdown", "org", "norg", + "kotlin", }, -- Install languages synchronously (only applied to `ensure_installed`) diff --git a/lua/kide/plugins/config/nvim-ufo.lua b/lua/kide/plugins/config/nvim-ufo.lua index 17b2c7e3..ac490e39 100644 --- a/lua/kide/plugins/config/nvim-ufo.lua +++ b/lua/kide/plugins/config/nvim-ufo.lua @@ -3,9 +3,19 @@ require("kide.core.keybindings").ufo_mapkey() -- Option 3: treesitter as a main provider instead -- Only depend on `nvim-treesitter/queries/filetype/folds.scm`, -- performance and stability are better than `foldmethod=nvim_treesitter#foldexpr()` +local ftMap = { + c = { "treesitter" }, + cpp = { "treesitter" }, + rust = { "treesitter" }, + java = { "treesitter" }, + lua = { "treesitter" }, + html = { "treesitter" }, + vim = "indent", + python = { "indent" }, +} require("ufo").setup({ provider_selector = function(bufnr, filetype, buftype) - return { "treesitter", "indent" } + -- return { "treesitter", "indent" } + return ftMap[filetype] end, }) --- From ea720eac7c5f95a1b9a576440c222c4a24140e01 Mon Sep 17 00:00:00 2001 From: luokai Date: Tue, 6 Sep 2022 10:11:41 +0800 Subject: [PATCH 0449/1278] =?UTF-8?q?=E4=B8=8D=E5=90=8C=20filetype=20?= =?UTF-8?q?=E6=98=BE=E7=A4=BA=E4=B8=8D=E5=90=8C=E6=A0=B7=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ftplugin/Outline.lua | 1 - ftplugin/rust.lua | 1 + 2 files changed, 1 insertion(+), 1 deletion(-) delete mode 100644 ftplugin/Outline.lua diff --git a/ftplugin/Outline.lua b/ftplugin/Outline.lua deleted file mode 100644 index 9fd021a8..00000000 --- a/ftplugin/Outline.lua +++ /dev/null @@ -1 +0,0 @@ -vim.opt_local.signcolumn = "no" diff --git a/ftplugin/rust.lua b/ftplugin/rust.lua index 123c5e98..5603e941 100644 --- a/ftplugin/rust.lua +++ b/ftplugin/rust.lua @@ -1,2 +1,3 @@ vim.opt_local.foldcolumn = "1" vim.opt_local.foldenable = true +vim.opt_local.signcolumn = "yes" From c135d0e228216af67342cdb2e5fae8e4eb888f5b Mon Sep 17 00:00:00 2001 From: luokai Date: Tue, 6 Sep 2022 11:51:46 +0800 Subject: [PATCH 0450/1278] nginx --- ftplugin/nginx.lua | 3 +++ lua/kide/lsp/utils/init.lua | 1 + lua/kide/plugins/config/null-ls.lua | 1 + lua/kide/plugins/config/nvim-ufo.lua | 1 + 4 files changed, 6 insertions(+) create mode 100644 ftplugin/nginx.lua diff --git a/ftplugin/nginx.lua b/ftplugin/nginx.lua new file mode 100644 index 00000000..596d51a4 --- /dev/null +++ b/ftplugin/nginx.lua @@ -0,0 +1,3 @@ +vim.opt_local.foldcolumn = "1" +vim.opt_local.foldenable = true +vim.opt_local.signcolumn = "no" diff --git a/lua/kide/lsp/utils/init.lua b/lua/kide/lsp/utils/init.lua index a47d82ee..f43e5765 100644 --- a/lua/kide/lsp/utils/init.lua +++ b/lua/kide/lsp/utils/init.lua @@ -36,6 +36,7 @@ format_lsp_mapping["yaml"] = "null-ls" format_lsp_mapping["markdown"] = "null-ls" format_lsp_mapping["graphql"] = "null-ls" format_lsp_mapping["handlebars"] = "null-ls" +format_lsp_mapping["nginx"] = "null-ls" -- xmllint format_lsp_mapping["xml"] = "null-ls" diff --git a/lua/kide/plugins/config/null-ls.lua b/lua/kide/plugins/config/null-ls.lua index e473c5e1..c7eb0824 100644 --- a/lua/kide/plugins/config/null-ls.lua +++ b/lua/kide/plugins/config/null-ls.lua @@ -78,6 +78,7 @@ local sources = { -- "cpp", -- }, -- }), + null_ls.builtins.formatting.nginx_beautifier, } local lsp_formatting = function(bufnr) diff --git a/lua/kide/plugins/config/nvim-ufo.lua b/lua/kide/plugins/config/nvim-ufo.lua index ac490e39..3feb0fa6 100644 --- a/lua/kide/plugins/config/nvim-ufo.lua +++ b/lua/kide/plugins/config/nvim-ufo.lua @@ -10,6 +10,7 @@ local ftMap = { java = { "treesitter" }, lua = { "treesitter" }, html = { "treesitter" }, + nginx = { "indent" }, vim = "indent", python = { "indent" }, } From 816da680daac4b0abc9a683a5c64b8c513965701 Mon Sep 17 00:00:00 2001 From: luokai Date: Fri, 9 Sep 2022 10:00:40 +0800 Subject: [PATCH 0451/1278] path --- lua/kide/plugins/config/nvim-cmp.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lua/kide/plugins/config/nvim-cmp.lua b/lua/kide/plugins/config/nvim-cmp.lua index da8b08b3..1030cafd 100644 --- a/lua/kide/plugins/config/nvim-cmp.lua +++ b/lua/kide/plugins/config/nvim-cmp.lua @@ -30,8 +30,8 @@ cmp.setup({ -- -- For snippy users. -- { name = 'snippy' }, }, { - { name = "buffer" }, { name = "path" }, + { name = "buffer" }, }), -- 快捷键 From 2d8f9bfe469cd0dd2202adfe7269b3375da76266 Mon Sep 17 00:00:00 2001 From: luokai Date: Fri, 9 Sep 2022 22:46:46 +0800 Subject: [PATCH 0452/1278] update java lsp config --- lua/kide/core/keybindings.lua | 11 +++++++++++ lua/kide/core/vscode/init.lua | 12 +++++++----- lua/kide/lsp/java.lua | 23 +++++++++++++++-------- 3 files changed, 33 insertions(+), 13 deletions(-) diff --git a/lua/kide/core/keybindings.lua b/lua/kide/core/keybindings.lua index 44d39cec..58d813d7 100644 --- a/lua/kide/core/keybindings.lua +++ b/lua/kide/core/keybindings.lua @@ -223,6 +223,17 @@ M.maplsp = function(client, buffer) -- vim.api.nvim_buf_set_keymap(bufnr, "n", "xw", "Trouble workspace_diagnostics", opt) -- vim.api.nvim_buf_set_keymap(bufnr, "n", "xd", "Trouble document_diagnostics", opt) -- vim.api.nvim_buf_set_keymap(bufnr, "n", "xq", "Trouble quickfix", opt) + + -- <= 0.7.x + if client.resolved_capabilities["document_highlight"] then + vim.cmd(string.format("au CursorHold lua vim.lsp.buf.document_highlight()", buffer)) + vim.cmd(string.format("au CursorHoldI lua vim.lsp.buf.document_highlight()", buffer)) + vim.cmd(string.format("au CursorMoved lua vim.lsp.buf.clear_references()", buffer)) + end + if vim.lsp.codelens and client.resolved_capabilities["code_lens"] then + vim.api.nvim_buf_set_keymap(buffer, "n", "cr", "lua vim.lsp.codelens.refresh()", opt) + vim.api.nvim_buf_set_keymap(buffer, "n", "ce", "lua vim.lsp.codelens.run()", opt) + end end -- nvim-cmp 自动补全 diff --git a/lua/kide/core/vscode/init.lua b/lua/kide/core/vscode/init.lua index e8b0794e..1000037f 100644 --- a/lua/kide/core/vscode/init.lua +++ b/lua/kide/core/vscode/init.lua @@ -8,12 +8,14 @@ M.get_vscode_extensions = function() end M.find_one = function(extension_path) local v = vim.fn.glob(M.get_vscode_extensions() .. extension_path) - if type(v) == "string" then - return vim.split(v, "\n")[1] - elseif type(v) == "table" then - return v[1] + if v and v ~= "" then + if type(v) == "string" then + return vim.split(v, "\n")[1] + elseif type(v) == "table" then + return v[1] + end + return v end - return v end return M diff --git a/lua/kide/lsp/java.lua b/lua/kide/lsp/java.lua index b744c9a2..4dc26d18 100644 --- a/lua/kide/lsp/java.lua +++ b/lua/kide/lsp/java.lua @@ -82,6 +82,11 @@ vim.list_extend(bundles, vim.split(vim.fn.glob(java_decoompiler_path .. "/*.jar" local java_dependency_path = vscode.find_one("/vscjava.vscode-java-dependency-*/server") vim.list_extend(bundles, vim.split(vim.fn.glob(java_dependency_path .. "/*.jar"), "\n")) +local vscode_pde_path = vscode.find_one("/yaozheng.vscode-pde-*/server") +if vscode_pde_path then + vim.list_extend(bundles, vim.split(vim.fn.glob(vscode_pde_path .. "/*.jar"), "\n")) +end + local root_dir = require("jdtls.setup").find_root({ ".git", "mvnw", "gradlew" }) -- vim.notify("SETUP: " .. vim.api.nvim_buf_get_name(vim.api.nvim_get_current_buf()), vim.log.levels.INFO) @@ -155,8 +160,8 @@ local config = { "**/.idea/**", }, }, - -- referenceCodeLens = { enabled = true }, - -- implementationsCodeLens = { enabled = true }, + referenceCodeLens = { enabled = true }, + implementationsCodeLens = { enabled = true }, templates = { fileHeader = { "/**", @@ -289,12 +294,12 @@ config["on_attach"] = function(client, buffer) create_command(buffer, "OR", require("jdtls").organize_imports, { nargs = 0, }) - if vim.g.jdtls_dap_main_class_config_init then - vim.defer_fn(function() - require("jdtls.dap").setup_dap_main_class_configs({ verbose = true }) - end, 3000) - vim.g.jdtls_dap_main_class_config_init = false - end + -- if vim.g.jdtls_dap_main_class_config_init then + -- vim.defer_fn(function() + -- require("jdtls.dap").setup_dap_main_class_configs({ verbose = true }) + -- end, 3000) + -- vim.g.jdtls_dap_main_class_config_init = false + -- end require("nvim-navic").attach(client, buffer) -- require('java-deps').attach(client, bufnr) @@ -312,6 +317,8 @@ local capabilities = require("cmp_nvim_lsp").update_capabilities(vim.lsp.protoco -- } config.capabilities = capabilities +-- config.handlers = {} +-- config.handlers["language/status"] = function() end local function markdown_format(input) if input then From 5098a533aa895a4a167c606f500816d09c48c61a Mon Sep 17 00:00:00 2001 From: luokai Date: Fri, 9 Sep 2022 23:03:21 +0800 Subject: [PATCH 0453/1278] udpate --- README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README.md b/README.md index c5bbbd76..b9085858 100644 --- a/README.md +++ b/README.md @@ -2,6 +2,8 @@ 可配置 `Java`, `Rust`, `C/C++`, `JavaScript` 等编程语言开发环境。 极速启动 (60 ~ 100 ms), 注重细节。 +推荐使用 `neovim master` 版本,提前享受新功能 😊。 + ## 安装 ### Linux, Mac From 70ff67191bc1ab5fb77efddf2a5266b6d1ad7688 Mon Sep 17 00:00:00 2001 From: luokai Date: Fri, 9 Sep 2022 23:06:30 +0800 Subject: [PATCH 0454/1278] =?UTF-8?q?=E5=B7=B2=E4=BF=AE=E5=A4=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index b9085858..0740fc2a 100644 --- a/README.md +++ b/README.md @@ -55,7 +55,7 @@ git clone https://github.com/JavaHello/nvim.git [NVIM 打造 Java IDE](https://javahello.github.io/dev/tools/NVIM-LSP-Java-IDE-vscode.html) 更新了配置,全部使用 vscode 扩展,简化安装步骤。 -如果使用长时间后感觉卡顿,关闭下所有`buffer`, `:%bw`(当前会导致诊断列表不可用,正在修复中[neovim/issues/19322](https://github.com/neovim/neovim/issues/19322)) 。 +如果使用长时间后感觉卡顿,关闭下所有`buffer`, `:%bw`。 ### 功能演示 From 9e748fee12f21111221e2458f61b1e62f465ef89 Mon Sep 17 00:00:00 2001 From: luokai Date: Sat, 10 Sep 2022 16:18:21 +0800 Subject: [PATCH 0455/1278] JDTLS_HOME --- lua/kide/lsp/java.lua | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/lua/kide/lsp/java.lua b/lua/kide/lsp/java.lua index 4dc26d18..7ddcf32a 100644 --- a/lua/kide/lsp/java.lua +++ b/lua/kide/lsp/java.lua @@ -49,7 +49,11 @@ end)() local project_name = vim.fn.fnamemodify(vim.fn.getcwd(), ":p:h:t") local workspace_dir = get_jdtls_workspace() .. project_name -local jdtls_path = vscode.find_one("/redhat.java-*/server") +-- local jdtls_path = vscode.find_one("/redhat.java-*/server") +local function get_jdtls_path() + return or_default(env.JDTLS_HOME, vscode.find_one("/redhat.java-*/server")) +end +local jdtls_path = get_jdtls_path() local jdtls_launcher = vim.fn.glob(jdtls_path .. "/plugins/org.eclipse.equinox.launcher_*.jar") From 2edee23b98c8d63f549502554c398e16dd2d939a Mon Sep 17 00:00:00 2001 From: luokai Date: Mon, 12 Sep 2022 17:59:45 +0800 Subject: [PATCH 0456/1278] >= 0.8.x --- lua/kide/core/keybindings.lua | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/lua/kide/core/keybindings.lua b/lua/kide/core/keybindings.lua index 58d813d7..d525404b 100644 --- a/lua/kide/core/keybindings.lua +++ b/lua/kide/core/keybindings.lua @@ -224,13 +224,14 @@ M.maplsp = function(client, buffer) -- vim.api.nvim_buf_set_keymap(bufnr, "n", "xd", "Trouble document_diagnostics", opt) -- vim.api.nvim_buf_set_keymap(bufnr, "n", "xq", "Trouble quickfix", opt) - -- <= 0.7.x - if client.resolved_capabilities["document_highlight"] then + -- >= 0.8.x + if client.server_capabilities.documentHighlightProvider then vim.cmd(string.format("au CursorHold lua vim.lsp.buf.document_highlight()", buffer)) vim.cmd(string.format("au CursorHoldI lua vim.lsp.buf.document_highlight()", buffer)) vim.cmd(string.format("au CursorMoved lua vim.lsp.buf.clear_references()", buffer)) end - if vim.lsp.codelens and client.resolved_capabilities["code_lens"] then + local codeLensProvider = client.server_capabilities.codeLensProvider + if codeLensProvider then vim.api.nvim_buf_set_keymap(buffer, "n", "cr", "lua vim.lsp.codelens.refresh()", opt) vim.api.nvim_buf_set_keymap(buffer, "n", "ce", "lua vim.lsp.codelens.run()", opt) end From dfaaae80c998c5fe7c41b62cc4ac74eeb1908c1b Mon Sep 17 00:00:00 2001 From: luokai Date: Tue, 13 Sep 2022 11:33:47 +0800 Subject: [PATCH 0457/1278] vue --- lua/kide/lsp/init.lua | 2 ++ lua/kide/plugins/config/nvim-treesitter.lua | 1 + 2 files changed, 3 insertions(+) diff --git a/lua/kide/lsp/init.lua b/lua/kide/lsp/init.lua index 6f5c1bbf..f6ca6b82 100644 --- a/lua/kide/lsp/init.lua +++ b/lua/kide/lsp/init.lua @@ -10,6 +10,7 @@ mason_lspconfig.setup({ "sqls", "gopls", "kotlin_language_server", + "vuels", }, }) @@ -28,6 +29,7 @@ local server_configs = { sqls = require("kide.lsp.sqls"), gopls = require("kide.lsp.gopls"), kotlin_language_server = {}, + vuels = {}, } -- Setup lspconfig. diff --git a/lua/kide/plugins/config/nvim-treesitter.lua b/lua/kide/plugins/config/nvim-treesitter.lua index 7c869c66..d11d7285 100644 --- a/lua/kide/plugins/config/nvim-treesitter.lua +++ b/lua/kide/plugins/config/nvim-treesitter.lua @@ -20,6 +20,7 @@ require("nvim-treesitter.configs").setup({ "org", "norg", "kotlin", + "vue", }, -- Install languages synchronously (only applied to `ensure_installed`) From e20def3a0af54ad0b0087a8a9aca88650f6c09e2 Mon Sep 17 00:00:00 2001 From: luokai Date: Sat, 17 Sep 2022 20:13:10 +0800 Subject: [PATCH 0458/1278] =?UTF-8?q?=E9=BB=98=E8=AE=A4=E5=85=B3=E9=97=AD?= =?UTF-8?q?=20context?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lua/kide/plugins/config/nvim-treesitter-context.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lua/kide/plugins/config/nvim-treesitter-context.lua b/lua/kide/plugins/config/nvim-treesitter-context.lua index ccbde3a9..0d94ca73 100644 --- a/lua/kide/plugins/config/nvim-treesitter-context.lua +++ b/lua/kide/plugins/config/nvim-treesitter-context.lua @@ -1,5 +1,5 @@ require("treesitter-context").setup({ - enable = true, -- Enable this plugin (Can be enabled/disabled later via commands) + enable = false, -- Enable this plugin (Can be enabled/disabled later via commands) max_lines = 0, -- How many lines the window should span. Values <= 0 mean no limit. trim_scope = "outer", -- Which context lines to discard if `max_lines` is exceeded. Choices: 'inner', 'outer' patterns = { -- Match patterns for TS nodes. These get wrapped to match at word boundaries. From ba0b77355b6f1877f67d449f2801ed4b7bdd9edb Mon Sep 17 00:00:00 2001 From: luokai Date: Tue, 20 Sep 2022 09:31:14 +0800 Subject: [PATCH 0459/1278] jdtls --- lua/kide/lsp/utils/init.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lua/kide/lsp/utils/init.lua b/lua/kide/lsp/utils/init.lua index f43e5765..1c9bb836 100644 --- a/lua/kide/lsp/utils/init.lua +++ b/lua/kide/lsp/utils/init.lua @@ -15,7 +15,7 @@ end -- 指定格式化 lsp_client local format_lsp_mapping = {} -format_lsp_mapping["java"] = "jdt.ls" +format_lsp_mapping["java"] = "jdtls" -- sql_formatter format_lsp_mapping["sql"] = "null-ls" From da14e363d4e0f5589c91d48fb8b143fc5a79b25a Mon Sep 17 00:00:00 2001 From: luokai Date: Tue, 20 Sep 2022 14:12:07 +0800 Subject: [PATCH 0460/1278] debug UI --- lua/kide/plugins/config/nvim-dap.lua | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/lua/kide/plugins/config/nvim-dap.lua b/lua/kide/plugins/config/nvim-dap.lua index 1674eaea..6e27c158 100644 --- a/lua/kide/plugins/config/nvim-dap.lua +++ b/lua/kide/plugins/config/nvim-dap.lua @@ -31,15 +31,15 @@ dapui.setup({ dap.defaults.fallback.terminal_win_cmd = "belowright 12new | set filetype=dap-terminal" -dap.listeners.after.event_initialized["dapui_config"] = function() - dapui.open() -end -dap.listeners.before.event_terminated["dapui_config"] = function() - dapui.close() -end -dap.listeners.before.event_exited["dapui_config"] = function() - dapui.close() -end +-- dap.listeners.after.event_initialized["dapui_config"] = function() +-- dapui.open() +-- end +-- dap.listeners.before.event_terminated["dapui_config"] = function() +-- dapui.close() +-- end +-- dap.listeners.before.event_exited["dapui_config"] = function() +-- dapui.close() +-- end -- vim.fn.sign_define('DapBreakpoint', { text = '🔴', texthl = '', linehl = '', numhl = '' }) vim.fn.sign_define("DapBreakpoint", { text = "", texthl = "Debug", linehl = "", numhl = "" }) From 995540ad1b6fe804e392ff63bf20da4e68351472 Mon Sep 17 00:00:00 2001 From: luokai Date: Thu, 22 Sep 2022 09:37:49 +0800 Subject: [PATCH 0461/1278] =?UTF-8?q?=E6=8C=89=E9=9C=80=E5=8A=A0=E8=BD=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lua/kide/plugins/init.lua | 16 ++++------------ 1 file changed, 4 insertions(+), 12 deletions(-) diff --git a/lua/kide/plugins/init.lua b/lua/kide/plugins/init.lua index de9cb4f6..32b39a54 100644 --- a/lua/kide/plugins/init.lua +++ b/lua/kide/plugins/init.lua @@ -590,10 +590,7 @@ require("packer").startup({ use({ "dhruvasagar/vim-table-mode", opt = true, - setup = function() - -- on_file_open("vim-table-mode") - require("kide.core.layz_load").async_load("vim-table-mode") - end, + cmd = { "TableModeEnable" }, }) -- () 自动补全 @@ -704,19 +701,14 @@ require("packer").startup({ use({ "jbyuki/venn.nvim", opt = true, - setup = function() - -- on_file_open("venn.nvim") - require("kide.core.layz_load").async_load("venn.nvim") - end, + cmd = { "VBox" }, }) use({ "tversteeg/registers.nvim", opt = true, - setup = function() - -- on_file_open("registers.nvim") - require("kide.core.layz_load").async_load("registers.nvim") - end, + cmd = { "Registers" }, + keys = '"', }) -- databases From 90201dd736e5cb0a5d75abea584973fe55362e57 Mon Sep 17 00:00:00 2001 From: luokai Date: Fri, 23 Sep 2022 10:01:29 +0800 Subject: [PATCH 0462/1278] update --- lua/kide/core/basic.lua | 1 + 1 file changed, 1 insertion(+) diff --git a/lua/kide/core/basic.lua b/lua/kide/core/basic.lua index 8c623fab..571f0407 100644 --- a/lua/kide/core/basic.lua +++ b/lua/kide/core/basic.lua @@ -51,6 +51,7 @@ autocmd("FileType", { "http", "markdown", "lisp", + "sh", }, callback = function() vim.opt_local.tabstop = 2 From 8e40061e30a6aad6626f1c4ba1bb9a6bacd6958d Mon Sep 17 00:00:00 2001 From: luokai Date: Fri, 23 Sep 2022 10:16:33 +0800 Subject: [PATCH 0463/1278] sh fmt --- lua/kide/plugins/config/null-ls.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lua/kide/plugins/config/null-ls.lua b/lua/kide/plugins/config/null-ls.lua index c7eb0824..ce276014 100644 --- a/lua/kide/plugins/config/null-ls.lua +++ b/lua/kide/plugins/config/null-ls.lua @@ -29,7 +29,7 @@ local sources = { -- sh null_ls.builtins.code_actions.shellcheck, null_ls.builtins.diagnostics.shellcheck, - null_ls.builtins.formatting.shellharden, + null_ls.builtins.formatting.shfmt, -- lua null_ls.builtins.formatting.stylua, -- word From 85557b629888b183855542694353b65d1deb3b57 Mon Sep 17 00:00:00 2001 From: luokai Date: Fri, 7 Oct 2022 07:04:34 +0800 Subject: [PATCH 0464/1278] v0.8.0 --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 0740fc2a..dd5f5577 100644 --- a/README.md +++ b/README.md @@ -2,7 +2,7 @@ 可配置 `Java`, `Rust`, `C/C++`, `JavaScript` 等编程语言开发环境。 极速启动 (60 ~ 100 ms), 注重细节。 -推荐使用 `neovim master` 版本,提前享受新功能 😊。 +使用 `neovim v0.8.0` 版本。 ## 安装 From 97f0c3b320dc80293592f1733a2cac00bae1beca Mon Sep 17 00:00:00 2001 From: luokai Date: Fri, 7 Oct 2022 07:18:42 +0800 Subject: [PATCH 0465/1278] =?UTF-8?q?=E5=8E=BB=E6=8E=89=20lombok.jar=20vsc?= =?UTF-8?q?ode=20=E6=8F=92=E4=BB=B6=E4=BE=9D=E8=B5=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lua/kide/lsp/java.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lua/kide/lsp/java.lua b/lua/kide/lsp/java.lua index 7ddcf32a..4db4cb30 100644 --- a/lua/kide/lsp/java.lua +++ b/lua/kide/lsp/java.lua @@ -33,7 +33,7 @@ end local vscode = require("kide.core.vscode") local function get_lombok_jar() - return or_default(env.LOMBOK_JAR, vscode.find_one("/vscjava.vscode-lombok-*/server/lombok.jar")) + return or_default(env.LOMBOK_JAR, "/opt/software/lsp/lombok.jar") end local _config = (function() From 26d8bf1db6a71816f20d3918ad8e20f7d2b82087 Mon Sep 17 00:00:00 2001 From: luokai Date: Sat, 8 Oct 2022 17:13:44 +0800 Subject: [PATCH 0466/1278] toggleterm --- lua/kide/plugins/config/toggletasks.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lua/kide/plugins/config/toggletasks.lua b/lua/kide/plugins/config/toggletasks.lua index 771382ea..edfeaa8a 100644 --- a/lua/kide/plugins/config/toggletasks.lua +++ b/lua/kide/plugins/config/toggletasks.lua @@ -5,7 +5,7 @@ require("toggletasks").setup({ ".nvim/toggletasks", ".nvim/tasks", }, - defaults = { + toggleterm = { close_on_exit = true, }, }) From ab99521791b193af3a6873718bc780368d305e38 Mon Sep 17 00:00:00 2001 From: luokai Date: Fri, 14 Oct 2022 10:47:00 +0800 Subject: [PATCH 0467/1278] update mod name --- lua/kide/plugins/config/utils/treeutil.lua | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/lua/kide/plugins/config/utils/treeutil.lua b/lua/kide/plugins/config/utils/treeutil.lua index fd0e7605..524217a3 100644 --- a/lua/kide/plugins/config/utils/treeutil.lua +++ b/lua/kide/plugins/config/utils/treeutil.lua @@ -1,9 +1,10 @@ -local openfile = require("nvim-tree.actions.open-file") +local lib = require("nvim-tree.lib") +local openfile = require("nvim-tree.actions.node.open-file") local actions = require("telescope.actions") local action_state = require("telescope.actions.state") local M = {} -local view_selection = function(prompt_bufnr, _) +local view_selection = function(prompt_bufnr, map) actions.select_default:replace(function() actions.close(prompt_bufnr) local selection = action_state.get_selected_entry() From b006187dfe9e8e6070dd2d55274d80ec957758eb Mon Sep 17 00:00:00 2001 From: luokai Date: Mon, 17 Oct 2022 09:22:44 +0800 Subject: [PATCH 0468/1278] update api --- lua/kide/lsp/init.lua | 2 +- lua/kide/lsp/java.lua | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/lua/kide/lsp/init.lua b/lua/kide/lsp/init.lua index f6ca6b82..d2f8d6c7 100644 --- a/lua/kide/lsp/init.lua +++ b/lua/kide/lsp/init.lua @@ -33,7 +33,7 @@ local server_configs = { } -- Setup lspconfig. -local capabilities = require("cmp_nvim_lsp").update_capabilities(vim.lsp.protocol.make_client_capabilities()) +local capabilities = require("cmp_nvim_lsp").default_capabilities(vim.lsp.protocol.make_client_capabilities()) -- 没有确定使用效果参数 -- capabilities.textDocument.completion.completionItem.snippetSupport = true local utils = require("kide.core.utils") diff --git a/lua/kide/lsp/java.lua b/lua/kide/lsp/java.lua index 4db4cb30..67484973 100644 --- a/lua/kide/lsp/java.lua +++ b/lua/kide/lsp/java.lua @@ -310,7 +310,7 @@ config["on_attach"] = function(client, buffer) -- vim.notify(vim.api.nvim_buf_get_name(bufnr), vim.log.levels.INFO) end -local capabilities = require("cmp_nvim_lsp").update_capabilities(vim.lsp.protocol.make_client_capabilities()) +local capabilities = require("cmp_nvim_lsp").default_capabilities(vim.lsp.protocol.make_client_capabilities()) -- capabilities.experimental = { -- hoverActions = true, -- hoverRange = true, From 10ebe390546956019cb8e7ff4dc3d8268894f04d Mon Sep 17 00:00:00 2001 From: luokai Date: Mon, 17 Oct 2022 17:38:00 +0800 Subject: [PATCH 0469/1278] setup_dap_main_class_configs --- lua/kide/lsp/java.lua | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/lua/kide/lsp/java.lua b/lua/kide/lsp/java.lua index 67484973..c8a54e89 100644 --- a/lua/kide/lsp/java.lua +++ b/lua/kide/lsp/java.lua @@ -321,8 +321,13 @@ local capabilities = require("cmp_nvim_lsp").default_capabilities(vim.lsp.protoc -- } config.capabilities = capabilities --- config.handlers = {} --- config.handlers["language/status"] = function() end +config.handlers = {} +config.handlers["language/status"] = function(_, s) + print("jdtls " .. s.type .. ": " .. s.message) + if "ServiceReady" == s.type then + require("jdtls.dap").setup_dap_main_class_configs({ verbose = true }) + end +end local function markdown_format(input) if input then From 226981dbc773a20ddbedeab33c6b0fda9a221a4a Mon Sep 17 00:00:00 2001 From: luokai Date: Tue, 18 Oct 2022 09:34:57 +0800 Subject: [PATCH 0470/1278] jdtls config --- lua/kide/lsp/java.lua | 24 ++++++++++++++++++++++-- lua/kide/lsp/utils/jdtls.lua | 4 ++-- lua/kide/plugins/init.lua | 4 ++++ 3 files changed, 28 insertions(+), 4 deletions(-) diff --git a/lua/kide/lsp/java.lua b/lua/kide/lsp/java.lua index c8a54e89..221f5a02 100644 --- a/lua/kide/lsp/java.lua +++ b/lua/kide/lsp/java.lua @@ -441,14 +441,34 @@ end M.init = function() vim.g.jdtls_dap_main_class_config_init = true + -- au BufReadCmd jdt://* lua require('jdtls').open_jdt_link(vim.fn.expand('')) + -- command! JdtWipeDataAndRestart lua require('jdtls.setup').wipe_data_and_restart() + -- command! JdtShowLogs lua require('jdtls.setup').show_logs() + vim.api.nvim_create_autocmd({ "BufReadCmd" }, { + pattern = "jdt://*", + callback = function(e) + if e.file then + require("jdtls").open_jdt_link(e.file) + end + end, + }) + vim.api.nvim_create_user_command("JdtWipeDataAndRestart", "lua require('jdtls.setup').wipe_data_and_restart()", {}) + vim.api.nvim_create_user_command("JdtShowLogs", "lua require('jdtls.setup').show_logs()", {}) + local group = vim.api.nvim_create_augroup("kide_jdtls_java", { clear = true }) vim.api.nvim_create_autocmd({ "FileType" }, { group = group, pattern = { "java" }, desc = "jdtls", - callback = function(_) + callback = function(e) -- vim.notify("load: " .. o.buf, vim.log.levels.INFO) - M.setup() + -- print(vim.inspect(e)) + -- 忽略 telescope 预览的情况 + if e.file == "java" then + -- ignore + else + M.setup() + end end, }) return group diff --git a/lua/kide/lsp/utils/jdtls.lua b/lua/kide/lsp/utils/jdtls.lua index 6601e1df..8eb32f36 100644 --- a/lua/kide/lsp/utils/jdtls.lua +++ b/lua/kide/lsp/utils/jdtls.lua @@ -61,8 +61,8 @@ M.open_jdt_link = function(uri, buf, timeout) end vim.api.nvim_buf_set_option(buf, "modifiable", true) vim.api.nvim_buf_set_lines(buf, 0, -1, false, buf_content) - -- vim.api.nvim_buf_set_option(buf, "filetype", "java") - vim.api.nvim_buf_set_option(buf, "syntax", "java") + vim.api.nvim_buf_set_option(buf, "filetype", "java") + -- vim.api.nvim_buf_set_option(buf, "syntax", "java") vim.api.nvim_buf_set_option(buf, "modifiable", false) end return M diff --git a/lua/kide/plugins/init.lua b/lua/kide/plugins/init.lua index 32b39a54..76813da3 100644 --- a/lua/kide/plugins/init.lua +++ b/lua/kide/plugins/init.lua @@ -214,6 +214,10 @@ require("packer").startup({ "mfussenegger/nvim-jdtls", opt = true, ft = "java", + setup = function() + -- 不加载 nvim-jdtls.vim + vim.g.nvim_jdtls = 1 + end, config = function() require("kide.lsp.java").init() end, From fa9ee307bb1a7e955eee1f3c13575556e22ed094 Mon Sep 17 00:00:00 2001 From: luokai Date: Tue, 18 Oct 2022 09:36:02 +0800 Subject: [PATCH 0471/1278] update --- lua/kide/lsp/java.lua | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/lua/kide/lsp/java.lua b/lua/kide/lsp/java.lua index 221f5a02..19dd8506 100644 --- a/lua/kide/lsp/java.lua +++ b/lua/kide/lsp/java.lua @@ -447,9 +447,7 @@ M.init = function() vim.api.nvim_create_autocmd({ "BufReadCmd" }, { pattern = "jdt://*", callback = function(e) - if e.file then - require("jdtls").open_jdt_link(e.file) - end + require("jdtls").open_jdt_link(e.file) end, }) vim.api.nvim_create_user_command("JdtWipeDataAndRestart", "lua require('jdtls.setup').wipe_data_and_restart()", {}) From 7243b44b89414ab6838aa4000dc772e10b9abbd0 Mon Sep 17 00:00:00 2001 From: luokai Date: Tue, 18 Oct 2022 10:29:13 +0800 Subject: [PATCH 0472/1278] =?UTF-8?q?java=20=E6=9A=82=E6=97=B6=E5=85=BC?= =?UTF-8?q?=E5=AE=B9=20fidget?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lua/kide/lsp/java.lua | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/lua/kide/lsp/java.lua b/lua/kide/lsp/java.lua index 19dd8506..cfda8b94 100644 --- a/lua/kide/lsp/java.lua +++ b/lua/kide/lsp/java.lua @@ -274,6 +274,7 @@ local jdtls = require("jdtls") local extendedClientCapabilities = jdtls.extendedClientCapabilities extendedClientCapabilities.resolveAdditionalTextEditsSupport = true +extendedClientCapabilities.progressReportProvider = false config["init_options"] = { bundles = bundles, @@ -329,6 +330,10 @@ config.handlers["language/status"] = function(_, s) end end +-- java 暂时兼容 fidget, 等待上游支持 +vim.lsp.handlers["$/progress"] = nil +require("fidget").setup({}) + local function markdown_format(input) if input then -- input = string.gsub(input, "[\r\n]( +)(%*)", function (i1) From 33a5264c3fec6a41f4d4f3b4be2b15d911f4ff8d Mon Sep 17 00:00:00 2001 From: luokai Date: Tue, 18 Oct 2022 11:32:09 +0800 Subject: [PATCH 0473/1278] old_process --- lua/kide/lsp/java.lua | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/lua/kide/lsp/java.lua b/lua/kide/lsp/java.lua index cfda8b94..c662adc5 100644 --- a/lua/kide/lsp/java.lua +++ b/lua/kide/lsp/java.lua @@ -331,7 +331,12 @@ config.handlers["language/status"] = function(_, s) end -- java 暂时兼容 fidget, 等待上游支持 -vim.lsp.handlers["$/progress"] = nil +local old_progress = vim.lsp.handlers["$/progres"] +vim.lsp.handlers["$/progress"] = function(err, result, ctx, cfg) + if old_progress then + old_progress(err, result, ctx, cfg) + end +end require("fidget").setup({}) local function markdown_format(input) From 20517b3e23189f9fbd920c067cf2ccef882c439b Mon Sep 17 00:00:00 2001 From: luokai Date: Tue, 18 Oct 2022 11:44:47 +0800 Subject: [PATCH 0474/1278] progress = nil --- lua/kide/lsp/java.lua | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/lua/kide/lsp/java.lua b/lua/kide/lsp/java.lua index c662adc5..cfda8b94 100644 --- a/lua/kide/lsp/java.lua +++ b/lua/kide/lsp/java.lua @@ -331,12 +331,7 @@ config.handlers["language/status"] = function(_, s) end -- java 暂时兼容 fidget, 等待上游支持 -local old_progress = vim.lsp.handlers["$/progres"] -vim.lsp.handlers["$/progress"] = function(err, result, ctx, cfg) - if old_progress then - old_progress(err, result, ctx, cfg) - end -end +vim.lsp.handlers["$/progress"] = nil require("fidget").setup({}) local function markdown_format(input) From 92905d0f2d3c69b6f0291ba8ad69e4b0a756abe4 Mon Sep 17 00:00:00 2001 From: luokai Date: Tue, 18 Oct 2022 11:48:20 +0800 Subject: [PATCH 0475/1278] =?UTF-8?q?=E4=BD=BF=E7=94=A8=20progress=20?= =?UTF-8?q?=E6=9F=A5=E7=9C=8B=E7=8A=B6=E6=80=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lua/kide/lsp/java.lua | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lua/kide/lsp/java.lua b/lua/kide/lsp/java.lua index cfda8b94..bc965dfb 100644 --- a/lua/kide/lsp/java.lua +++ b/lua/kide/lsp/java.lua @@ -324,7 +324,8 @@ local capabilities = require("cmp_nvim_lsp").default_capabilities(vim.lsp.protoc config.capabilities = capabilities config.handlers = {} config.handlers["language/status"] = function(_, s) - print("jdtls " .. s.type .. ": " .. s.message) + -- 使用 progress 查看状态 + -- print("jdtls " .. s.type .. ": " .. s.message) if "ServiceReady" == s.type then require("jdtls.dap").setup_dap_main_class_configs({ verbose = true }) end From 75ddc0f8be3bded50cf2153ebdbf51d80a346bc7 Mon Sep 17 00:00:00 2001 From: luokai Date: Tue, 18 Oct 2022 12:00:21 +0800 Subject: [PATCH 0476/1278] get_java_ver_home --- lua/kide/lsp/java.lua | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/lua/kide/lsp/java.lua b/lua/kide/lsp/java.lua index bc965dfb..b9a827d5 100644 --- a/lua/kide/lsp/java.lua +++ b/lua/kide/lsp/java.lua @@ -22,6 +22,11 @@ end local function get_java_home() return or_default(env.JAVA_HOME, "/opt/software/java/zulu17.34.19-ca-jdk17.0.3-macosx_aarch64") end +local function get_java_ver_home(v, dv) + local java_home = os.getenv("JAVA_" .. v .. "_HOME") or dv + print(java_home) + return java_home; +end local function get_java() return get_java_home() .. "/bin/java" @@ -233,16 +238,16 @@ local config = { runtimes = { { name = "JavaSE-1.8", - path = "/opt/software/java/zulu8.62.0.19-ca-jdk8.0.332-macosx_aarch64", + path = get_java_ver_home("8", "/opt/software/java/zulu8.62.0.19-ca-jdk8.0.332-macosx_aarch64"), default = true, }, { name = "JavaSE-11", - path = "/opt/software/java/zulu11.56.19-ca-jdk11.0.15-macosx_aarch64", + path = get_java_ver_home("11", "/opt/software/java/zulu11.56.19-ca-jdk11.0.15-macosx_aarch64"), }, { name = "JavaSE-17", - path = "/opt/software/java/graalvm-ce-java17-22.1.0/Contents/Home", + path = get_java_ver_home("17", "/opt/software/java/graalvm-ce-java17-22.1.0/Contents/Home"), }, }, }, From d838fad6dcf818e7dfbe50daec6f11fa7ca9b7d8 Mon Sep 17 00:00:00 2001 From: luokai Date: Tue, 18 Oct 2022 12:00:40 +0800 Subject: [PATCH 0477/1278] update --- lua/kide/lsp/java.lua | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/lua/kide/lsp/java.lua b/lua/kide/lsp/java.lua index b9a827d5..d06c705d 100644 --- a/lua/kide/lsp/java.lua +++ b/lua/kide/lsp/java.lua @@ -23,9 +23,7 @@ local function get_java_home() return or_default(env.JAVA_HOME, "/opt/software/java/zulu17.34.19-ca-jdk17.0.3-macosx_aarch64") end local function get_java_ver_home(v, dv) - local java_home = os.getenv("JAVA_" .. v .. "_HOME") or dv - print(java_home) - return java_home; + return os.getenv("JAVA_" .. v .. "_HOME") or dv end local function get_java() From da02f40b0476a219b39aec35b5660b5191389efc Mon Sep 17 00:00:00 2001 From: luokai Date: Tue, 18 Oct 2022 13:47:13 +0800 Subject: [PATCH 0478/1278] =?UTF-8?q?=E5=8F=AF=E9=80=89=E6=89=A9=E5=B1=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lua/kide/lsp/java.lua | 26 +++++++++++++++++--------- 1 file changed, 17 insertions(+), 9 deletions(-) diff --git a/lua/kide/lsp/java.lua b/lua/kide/lsp/java.lua index d06c705d..7514f7ef 100644 --- a/lua/kide/lsp/java.lua +++ b/lua/kide/lsp/java.lua @@ -65,29 +65,37 @@ local jdtls_config = vim.fn.glob(jdtls_path .. "/" .. _config) local bundles = {} -- This bundles definition is the same as in the previous section (java-debug installation) local vscode_java_debug_path = vscode.find_one("/vscjava.vscode-java-debug-*/server") -vim.list_extend( - bundles, - vim.split(vim.fn.glob(vscode_java_debug_path .. "/com.microsoft.java.debug.plugin-*.jar"), "\n") -) +if vscode_java_debug_path then + vim.list_extend( + bundles, + vim.split(vim.fn.glob(vscode_java_debug_path .. "/com.microsoft.java.debug.plugin-*.jar"), "\n") + ) +end -- /opt/software/lsp/java/vscode-java-test/server -- vim.list_extend(bundles, vim.split(vim.fn.glob("/opt/software/lsp/java/vscode-java-test/server/*.jar"), "\n")); local vscode_java_test_path = vscode.find_one("/vscjava.vscode-java-test-*/server") -for _, bundle in ipairs(vim.split(vim.fn.glob(vscode_java_test_path .. "/*.jar"), "\n")) do - if not vim.endswith(bundle, "com.microsoft.java.test.runner-jar-with-dependencies.jar") then - table.insert(bundles, bundle) +if vscode_java_test_path then + for _, bundle in ipairs(vim.split(vim.fn.glob(vscode_java_test_path .. "/*.jar"), "\n")) do + if not vim.endswith(bundle, "com.microsoft.java.test.runner-jar-with-dependencies.jar") then + table.insert(bundles, bundle) + end end end -- /opt/software/lsp/java/vscode-java-decompiler/server/ local java_decoompiler_path = vscode.find_one("/dgileadi.java-decompiler-*/server") -vim.list_extend(bundles, vim.split(vim.fn.glob(java_decoompiler_path .. "/*.jar"), "\n")) +if java_decoompiler_path then + vim.list_extend(bundles, vim.split(vim.fn.glob(java_decoompiler_path .. "/*.jar"), "\n")) +end -- /opt/software/lsp/java/vscode-java-dependency/jdtls.ext/ -- vim.list_extend(bundles, vim.split(vim.fn.glob("/opt/software/lsp/java/vscode-java-dependency/jdtls.ext/com.microsoft.jdtls.ext.core/target/com.microsoft.jdtls.ext.core-*.jar"), "\n")); -- /opt/software/lsp/java/vscode-java-dependency/server/ local java_dependency_path = vscode.find_one("/vscjava.vscode-java-dependency-*/server") -vim.list_extend(bundles, vim.split(vim.fn.glob(java_dependency_path .. "/*.jar"), "\n")) +if java_dependency_path then + vim.list_extend(bundles, vim.split(vim.fn.glob(java_dependency_path .. "/*.jar"), "\n")) +end local vscode_pde_path = vscode.find_one("/yaozheng.vscode-pde-*/server") if vscode_pde_path then From 19873c57b1e5cc6d16ae86913a5e443542fe50fe Mon Sep 17 00:00:00 2001 From: luokai Date: Tue, 18 Oct 2022 14:22:30 +0800 Subject: [PATCH 0479/1278] symbols-outline highlight update --- lua/kide/lsp/lsp_ui.lua | 54 ++++++++++----------- lua/kide/plugins/config/symbols-outline.lua | 9 ++++ lua/kide/plugins/init.lua | 6 ++- 3 files changed, 41 insertions(+), 28 deletions(-) diff --git a/lua/kide/lsp/lsp_ui.lua b/lua/kide/lsp/lsp_ui.lua index 1e2af949..3aba0f5d 100644 --- a/lua/kide/lsp/lsp_ui.lua +++ b/lua/kide/lsp/lsp_ui.lua @@ -1,42 +1,42 @@ local M = {} M.symbol_map = { Text = { icon = "" }, - Method = { icon = "", hl = "TSMethod" }, - Function = { icon = "", hl = "TSFunction" }, - Constructor = { icon = "", hl = "TSConstructor" }, - Field = { icon = "ﰠ", hl = "TSField" }, - Variable = { icon = "", hl = "TSConstant" }, - Class = { icon = "ﴯ", hl = "TSType" }, - Interface = { icon = "", hl = "TSType" }, - Module = { icon = "", hl = "TSNamespace" }, - Property = { icon = "ﰠ", hl = "TSMethod" }, + Method = { icon = "", hl = "@method" }, + Function = { icon = "", hl = "@function" }, + Constructor = { icon = "", hl = "@constructor" }, + Field = { icon = "ﰠ", hl = "@field" }, + Variable = { icon = "", hl = "@constant" }, + Class = { icon = "ﴯ", hl = "@type" }, + Interface = { icon = "", hl = "@type" }, + Module = { icon = "", hl = "@namespace" }, + Property = { icon = "ﰠ", hl = "@method" }, Unit = { icon = "塞" }, Value = { icon = "" }, Enum = { icon = "", hl = "TSType" }, Keyword = { icon = "" }, Snippet = { icon = "" }, Color = { icon = "" }, - File = { icon = "", hl = "TSURI" }, + File = { icon = "", hl = "@text.uri" }, Reference = { icon = "" }, Folder = { icon = "" }, - EnumMember = { icon = "", hl = "TSField" }, - Constant = { icon = "", hl = "TSConstant" }, - Struct = { icon = "פּ", hl = "TSType" }, - Event = { icon = "", hl = "TSType" }, - Operator = { icon = "", hl = "TSOperator" }, - TypeParameter = { icon = "", hl = "TSParameter" }, + EnumMember = { icon = "", hl = "@field" }, + Constant = { icon = "", hl = "@constant" }, + Struct = { icon = "פּ", hl = "@type" }, + Event = { icon = "", hl = "@type" }, + Operator = { icon = "", hl = "@operator" }, + TypeParameter = { icon = "", hl = "@parameter" }, --------------------------------------------------------- - Namespace = { icon = "", hl = "TSNamespace" }, - Package = { icon = "", hl = "TSNamespace" }, - String = { icon = "", hl = "TSString" }, - Number = { icon = "", hl = "TSNumber" }, - Boolean = { icon = "", hl = "TSBoolean" }, - Array = { icon = "", hl = "TSConstant" }, - Object = { icon = "", hl = "TSType" }, - Key = { icon = "", hl = "TSType" }, - Null = { icon = "ﳠ", hl = "TSType" }, - Component = { icon = "", hl = "TSFunction" }, - Fragment = { icon = "", hl = "TSConstant" }, + Namespace = { icon = "", hl = "@namespace" }, + Package = { icon = "", hl = "@namespace" }, + String = { icon = "", hl = "@string" }, + Number = { icon = "", hl = "@number" }, + Boolean = { icon = "", hl = "@boolean" }, + Array = { icon = "", hl = "@constant" }, + Object = { icon = "", hl = "@type" }, + Key = { icon = "", hl = "@type" }, + Null = { icon = "ﳠ", hl = "@type" }, + Component = { icon = "", hl = "@function" }, + Fragment = { icon = "", hl = "@constant" }, } M.hover_actions = { diff --git a/lua/kide/plugins/config/symbols-outline.lua b/lua/kide/plugins/config/symbols-outline.lua index a54eb8cd..30d1789e 100644 --- a/lua/kide/plugins/config/symbols-outline.lua +++ b/lua/kide/plugins/config/symbols-outline.lua @@ -13,6 +13,10 @@ require("symbols-outline").setup({ show_relative_numbers = false, show_symbol_details = true, preview_bg_highlight = "Pmenu", + autofold_depth = nil, + auto_unfold_hover = true, + fold_markers = { "", "" }, + wrap = false, keymaps = { -- These keymaps can be a string or a table for multiple keys close = { "", "q" }, goto_location = "", @@ -21,6 +25,11 @@ require("symbols-outline").setup({ toggle_preview = "K", rename_symbol = "r", code_actions = "a", + fold = "h", + unfold = "l", + fold_all = "W", + unfold_all = "E", + fold_reset = "R", }, lsp_blacklist = {}, symbol_blacklist = {}, diff --git a/lua/kide/plugins/init.lua b/lua/kide/plugins/init.lua index 76813da3..a9cf8435 100644 --- a/lua/kide/plugins/init.lua +++ b/lua/kide/plugins/init.lua @@ -450,7 +450,11 @@ require("packer").startup({ use({ "simrat39/symbols-outline.nvim", opt = true, - cmd = { "SymbolsOutline" }, + cmd = { + "SymbolsOutline", + "SymbolsOutlineOpen", + "SymbolsOutlineClose", + }, config = function() require("kide.plugins.config.symbols-outline") end, From 8b06d6da7ec3bc36f2cca3fe78d4b712ddc19552 Mon Sep 17 00:00:00 2001 From: luokai Date: Tue, 18 Oct 2022 14:23:52 +0800 Subject: [PATCH 0480/1278] highlight --- lua/kide/lsp/lsp_ui.lua | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lua/kide/lsp/lsp_ui.lua b/lua/kide/lsp/lsp_ui.lua index 3aba0f5d..6d09b2bf 100644 --- a/lua/kide/lsp/lsp_ui.lua +++ b/lua/kide/lsp/lsp_ui.lua @@ -1,4 +1,6 @@ local M = {} + +-- remove obsolete TS* highlight groups https://github.com/nvim-treesitter/nvim-treesitter/pull/3656 M.symbol_map = { Text = { icon = "" }, Method = { icon = "", hl = "@method" }, From 81ca84b60b3f3db1bb2da1a3f8f10978dcb2ddae Mon Sep 17 00:00:00 2001 From: luokai Date: Tue, 18 Oct 2022 14:37:58 +0800 Subject: [PATCH 0481/1278] diagnostic.severity.ERROR --- lua/kide/core/keybindings.lua | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/lua/kide/core/keybindings.lua b/lua/kide/core/keybindings.lua index d525404b..d15421ce 100644 --- a/lua/kide/core/keybindings.lua +++ b/lua/kide/core/keybindings.lua @@ -218,6 +218,13 @@ M.maplsp = function(client, buffer) -- mapbuf('n', 'D', 'lua vim.lsp.buf.type_definition()', opt) vim.api.nvim_buf_set_keymap(buffer, "n", "xw", "Telescope diagnostics", opt) + vim.api.nvim_buf_set_keymap( + buffer, + "n", + "xe", + "lua require('telescope.builtin').diagnostics({ severity = vim.diagnostic.severity.ERROR })", + opt + ) -- vim.api.nvim_buf_set_keymap(bufnr, "n", "xw", "Trouble workspace_diagnostics", opt) -- vim.api.nvim_buf_set_keymap(bufnr, "n", "xx", "Trouble", opt) -- vim.api.nvim_buf_set_keymap(bufnr, "n", "xw", "Trouble workspace_diagnostics", opt) From 9b89fbaecc82068e32bbae86d668b8ae73e6f691 Mon Sep 17 00:00:00 2001 From: luokai Date: Tue, 18 Oct 2022 15:04:10 +0800 Subject: [PATCH 0482/1278] =?UTF-8?q?=E8=AE=B0=E5=BD=95=20eclipse.jdt.ls/p?= =?UTF-8?q?ull/2258?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lua/kide/lsp/java.lua | 1 + 1 file changed, 1 insertion(+) diff --git a/lua/kide/lsp/java.lua b/lua/kide/lsp/java.lua index 7514f7ef..06ecc9e9 100644 --- a/lua/kide/lsp/java.lua +++ b/lua/kide/lsp/java.lua @@ -343,6 +343,7 @@ config.handlers["language/status"] = function(_, s) end -- java 暂时兼容 fidget, 等待上游支持 +-- https://github.com/eclipse/eclipse.jdt.ls/pull/2258 vim.lsp.handlers["$/progress"] = nil require("fidget").setup({}) From cc8ad518742d1de4cda5ef973a6dc0b9a5aa949d Mon Sep 17 00:00:00 2001 From: luokai Date: Fri, 21 Oct 2022 14:43:59 +0800 Subject: [PATCH 0483/1278] javascript --- ftplugin/javascript.lua | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 ftplugin/javascript.lua diff --git a/ftplugin/javascript.lua b/ftplugin/javascript.lua new file mode 100644 index 00000000..5603e941 --- /dev/null +++ b/ftplugin/javascript.lua @@ -0,0 +1,3 @@ +vim.opt_local.foldcolumn = "1" +vim.opt_local.foldenable = true +vim.opt_local.signcolumn = "yes" From f09eb071f8b564ab000f945ce75e03ebb319cc43 Mon Sep 17 00:00:00 2001 From: luokai Date: Fri, 21 Oct 2022 14:53:48 +0800 Subject: [PATCH 0484/1278] =?UTF-8?q?codelldb=20=E5=8F=AF=E9=80=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lua/kide/dap/codelldb.lua | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/lua/kide/dap/codelldb.lua b/lua/kide/dap/codelldb.lua index 96928ad3..1b8b13db 100644 --- a/lua/kide/dap/codelldb.lua +++ b/lua/kide/dap/codelldb.lua @@ -3,10 +3,14 @@ local vscode = require("kide.core.vscode") local extension_path = vscode.find_one("/vadimcn.vscode-lldb-*") M.config = {} -M.config.codelldb_path = extension_path .. "/adapter/codelldb" -M.config.liblldb_path = extension_path .. "/lldb/lib/liblldb.dylib" M.setup = function(config) + if not extension_path then + vim.notify("codelldb not found", vim.log.levels.WARN) + return nil + end + M.config.codelldb_path = extension_path .. "/adapter/codelldb" + M.config.liblldb_path = extension_path .. "/lldb/lib/liblldb.dylib" if config then M.config = vim.tbl_deep_extend("force", M.config, config) end From 1fdf7ebeba07f9d0ea12074099610dc532cb8c89 Mon Sep 17 00:00:00 2001 From: luokai Date: Fri, 21 Oct 2022 14:55:27 +0800 Subject: [PATCH 0485/1278] update --- lua/kide/dap/codelldb.lua | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lua/kide/dap/codelldb.lua b/lua/kide/dap/codelldb.lua index 1b8b13db..3db24d59 100644 --- a/lua/kide/dap/codelldb.lua +++ b/lua/kide/dap/codelldb.lua @@ -10,7 +10,7 @@ M.setup = function(config) return nil end M.config.codelldb_path = extension_path .. "/adapter/codelldb" - M.config.liblldb_path = extension_path .. "/lldb/lib/liblldb.dylib" + -- M.config.liblldb_path = extension_path .. "/lldb/lib/liblldb.dylib" if config then M.config = vim.tbl_deep_extend("force", M.config, config) end @@ -28,7 +28,7 @@ M.setup = function(config) local stderr = vim.loop.new_pipe(false) local opts = { stdio = { nil, stdout, stderr }, - args = { "--port", tostring(port), "--liblldb", M.config.liblldb_path }, + args = { "--port", tostring(port) }, } local handle local pid_or_err From 277732ab0a31662ee83140e3303540e4bc714e86 Mon Sep 17 00:00:00 2001 From: luokai Date: Fri, 21 Oct 2022 15:13:15 +0800 Subject: [PATCH 0486/1278] =?UTF-8?q?=E4=BD=BF=E7=94=A8=E6=8A=80=E5=B7=A7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index dd5f5577..e9ef1bee 100644 --- a/README.md +++ b/README.md @@ -55,7 +55,8 @@ git clone https://github.com/JavaHello/nvim.git [NVIM 打造 Java IDE](https://javahello.github.io/dev/tools/NVIM-LSP-Java-IDE-vscode.html) 更新了配置,全部使用 vscode 扩展,简化安装步骤。 -如果使用长时间后感觉卡顿,关闭下所有`buffer`, `:%bw`。 +- 如果使用长时间后感觉卡顿,关闭下所有`buffer`, `:%bw`。 +- 搜索依赖`jar`包`class`很慢的问题。在搜索框输入会频繁的请求`LSP server`导致内存和`CPU`提升,通常需要好几秒才会返回结果。建议复制类名称到搜索框,或者选择类名后按下`fs`, 这样会很快搜索出相关的`class`。 ### 功能演示 From ccd9b18887e2c808686f36ad17d0725277c3b79e Mon Sep 17 00:00:00 2001 From: luokai Date: Sun, 23 Oct 2022 18:26:48 +0800 Subject: [PATCH 0487/1278] =?UTF-8?q?=E4=BD=BF=E7=94=A8=E8=AF=B4=E6=98=8E?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README.md b/README.md index e9ef1bee..b497dddf 100644 --- a/README.md +++ b/README.md @@ -13,6 +13,8 @@ cd ~/.config git clone https://github.com/JavaHello/nvim.git ``` +> 此配置在 Linux, Mac 长期使用 + ### Windows ```sh From cca689a334fa32d02d0ff790d092f14e5a8ae4d6 Mon Sep 17 00:00:00 2001 From: luokai Date: Sun, 23 Oct 2022 19:19:41 +0800 Subject: [PATCH 0488/1278] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E6=8F=8F=E8=BF=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index b497dddf..dfc98302 100644 --- a/README.md +++ b/README.md @@ -13,7 +13,7 @@ cd ~/.config git clone https://github.com/JavaHello/nvim.git ``` -> 此配置在 Linux, Mac 长期使用 +> 此配置在 Linux, Mac 系统上长期使用 ### Windows From da78e9bc1e86f05bc3b27d3e6d5a94e103f38437 Mon Sep 17 00:00:00 2001 From: luokai Date: Wed, 26 Oct 2022 11:37:57 +0800 Subject: [PATCH 0489/1278] update --- ftplugin/nginx.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ftplugin/nginx.lua b/ftplugin/nginx.lua index 596d51a4..5603e941 100644 --- a/ftplugin/nginx.lua +++ b/ftplugin/nginx.lua @@ -1,3 +1,3 @@ vim.opt_local.foldcolumn = "1" vim.opt_local.foldenable = true -vim.opt_local.signcolumn = "no" +vim.opt_local.signcolumn = "yes" From 1b21b15eace3b74aa0627b04293dc9ae6b377385 Mon Sep 17 00:00:00 2001 From: luokai Date: Thu, 27 Oct 2022 14:28:45 +0800 Subject: [PATCH 0490/1278] visual code action --- lua/kide/core/keybindings.lua | 1 + 1 file changed, 1 insertion(+) diff --git a/lua/kide/core/keybindings.lua b/lua/kide/core/keybindings.lua index d15421ce..458f1997 100644 --- a/lua/kide/core/keybindings.lua +++ b/lua/kide/core/keybindings.lua @@ -158,6 +158,7 @@ M.maplsp = function(client, buffer) -- mapbuf('n', 'rn', 'lua require("lspsaga.rename").rename()', opt) -- code action vim.api.nvim_buf_set_keymap(buffer, "n", "ca", "lua vim.lsp.buf.code_action()", opt) + vim.api.nvim_buf_set_keymap(buffer, "v", "ca", "lua vim.lsp.buf.code_action()", opt) -- mapbuf('n', 'ca', 'lua require("lspsaga.codeaction").code_action()', opt) -- go xx -- mapbuf('n', 'gd', 'lua vim.lsp.buf.definition()', opt) From c59e98114765117528843fb1d3f9420e1686922b Mon Sep 17 00:00:00 2001 From: luokai Date: Thu, 27 Oct 2022 14:37:12 +0800 Subject: [PATCH 0491/1278] =?UTF-8?q?=E5=8E=BB=E6=8E=89=20format=5Frange?= =?UTF-8?q?=20=E8=BF=87=E6=9C=9F=E5=87=BD=E6=95=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lua/kide/core/keybindings.lua | 23 ++++++++++++++++------- 1 file changed, 16 insertions(+), 7 deletions(-) diff --git a/lua/kide/core/keybindings.lua b/lua/kide/core/keybindings.lua index 458f1997..04d6d859 100644 --- a/lua/kide/core/keybindings.lua +++ b/lua/kide/core/keybindings.lua @@ -204,13 +204,22 @@ M.maplsp = function(client, buffer) end, }) end, opt) - vim.api.nvim_buf_set_keymap( - buffer, - "v", - "=", - 'lua require("kide.lsp.utils").format_range_operator()', - opt - ) + keymap("v", "=", function() + local bfn = vim.api.nvim_get_current_buf() + vim.lsp.buf.format({ + bufnr = bfn, + filter = function(c) + return require("kide.lsp.utils").filter_format_lsp_client(c, bfn) + end, + }) + end, opt) + -- vim.api.nvim_buf_set_keymap( + -- buffer, + -- "v", + -- "=", + -- 'lua require("kide.lsp.utils").format_range_operator()', + -- opt + -- ) -- mapbuf('v', '=', 'lua vim.lsp.buf.formatting()', opt) -- mapbuf('n', '', 'lua vim.lsp.buf.signature_help()', opt) -- mapbuf('n', 'wa', 'lua vim.lsp.buf.add_workspace_folder()', opt) From 48f2dc58a13a1535591263fd99a755271d22d9ad Mon Sep 17 00:00:00 2001 From: luokai Date: Thu, 27 Oct 2022 14:48:37 +0800 Subject: [PATCH 0492/1278] range format --- lua/kide/core/keybindings.lua | 23 +++++++---------------- lua/kide/lsp/utils/init.lua | 13 ++++++++++++- 2 files changed, 19 insertions(+), 17 deletions(-) diff --git a/lua/kide/core/keybindings.lua b/lua/kide/core/keybindings.lua index 04d6d859..458f1997 100644 --- a/lua/kide/core/keybindings.lua +++ b/lua/kide/core/keybindings.lua @@ -204,22 +204,13 @@ M.maplsp = function(client, buffer) end, }) end, opt) - keymap("v", "=", function() - local bfn = vim.api.nvim_get_current_buf() - vim.lsp.buf.format({ - bufnr = bfn, - filter = function(c) - return require("kide.lsp.utils").filter_format_lsp_client(c, bfn) - end, - }) - end, opt) - -- vim.api.nvim_buf_set_keymap( - -- buffer, - -- "v", - -- "=", - -- 'lua require("kide.lsp.utils").format_range_operator()', - -- opt - -- ) + vim.api.nvim_buf_set_keymap( + buffer, + "v", + "=", + 'lua require("kide.lsp.utils").format_range_operator()', + opt + ) -- mapbuf('v', '=', 'lua vim.lsp.buf.formatting()', opt) -- mapbuf('n', '', 'lua vim.lsp.buf.signature_help()', opt) -- mapbuf('n', 'wa', 'lua vim.lsp.buf.add_workspace_folder()', opt) diff --git a/lua/kide/lsp/utils/init.lua b/lua/kide/lsp/utils/init.lua index 1c9bb836..211d1501 100644 --- a/lua/kide/lsp/utils/init.lua +++ b/lua/kide/lsp/utils/init.lua @@ -5,7 +5,18 @@ M.format_range_operator = function() _G.op_func_formatting = function() local start = vim.api.nvim_buf_get_mark(0, "[") local finish = vim.api.nvim_buf_get_mark(0, "]") - vim.lsp.buf.range_formatting({}, start, finish) + + local bfn = vim.api.nvim_get_current_buf() + vim.lsp.buf.format({ + bufnr = bfn, + filter = function(c) + return require("kide.lsp.utils").filter_format_lsp_client(c, bfn) + end, + range = { + start, + finish, + }, + }) vim.go.operatorfunc = old_func _G.op_func_formatting = nil end From ad7bb5867a6851e37d6ec97209a520e46d98d4c0 Mon Sep 17 00:00:00 2001 From: luokai Date: Tue, 1 Nov 2022 11:49:36 +0800 Subject: [PATCH 0493/1278] jdk19 --- lua/kide/lsp/java.lua | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/lua/kide/lsp/java.lua b/lua/kide/lsp/java.lua index 06ecc9e9..79aa60ce 100644 --- a/lua/kide/lsp/java.lua +++ b/lua/kide/lsp/java.lua @@ -255,6 +255,10 @@ local config = { name = "JavaSE-17", path = get_java_ver_home("17", "/opt/software/java/graalvm-ce-java17-22.1.0/Contents/Home"), }, + { + name = "JavaSE-19", + path = get_java_ver_home("19", "/opt/software/java/graalvm-ce-java19-22.3.0/Contents/Home"), + }, }, }, -- referencesCodeLens = { From 341dba1aa80cfb3142399391bafe2bcf8ae46ceb Mon Sep 17 00:00:00 2001 From: luokai Date: Tue, 1 Nov 2022 23:10:59 +0800 Subject: [PATCH 0494/1278] jol_path --- lua/kide/lsp/java.lua | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/lua/kide/lsp/java.lua b/lua/kide/lsp/java.lua index 79aa60ce..6dbb9979 100644 --- a/lua/kide/lsp/java.lua +++ b/lua/kide/lsp/java.lua @@ -8,6 +8,7 @@ local env = { JDTLS_HOME = os.getenv("JDTLS_HOME"), JDTLS_WORKSPACE = os.getenv("JDTLS_WORKSPACE"), LOMBOK_JAR = os.getenv("LOMBOK_JAR"), + JOL_JAR = os.getenv("JOL_JAR"), } local function or_default(a, v) @@ -39,6 +40,10 @@ local function get_lombok_jar() return or_default(env.LOMBOK_JAR, "/opt/software/lsp/lombok.jar") end +local function get_jol_jar() + return env.JOL_JAR or "/opt/software/java/jol-cli-0.16-full.jar" +end + local _config = (function() if cutils.os_type() == cutils.Windows then return "config_win" @@ -286,6 +291,7 @@ local config = { } local jdtls = require("jdtls") +jdtls.jol_path = get_jol_jar() local extendedClientCapabilities = jdtls.extendedClientCapabilities extendedClientCapabilities.resolveAdditionalTextEditsSupport = true From 68e4491f259cc68dd04f5680334ecd8e0dd02249 Mon Sep 17 00:00:00 2001 From: luokai Date: Tue, 8 Nov 2022 23:09:54 +0800 Subject: [PATCH 0495/1278] =?UTF-8?q?telescope.nvim=20=E4=BD=BF=E7=94=A8?= =?UTF-8?q?=E7=A8=B3=E5=AE=9A=E7=89=88=E6=9C=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lua/kide/plugins/init.lua | 1 + 1 file changed, 1 insertion(+) diff --git a/lua/kide/plugins/init.lua b/lua/kide/plugins/init.lua index a9cf8435..4105ffb9 100644 --- a/lua/kide/plugins/init.lua +++ b/lua/kide/plugins/init.lua @@ -255,6 +255,7 @@ require("packer").startup({ module = "telescope", wants = "gruvbox.nvim", after = "gruvbox.nvim", + tag = "0.1.x", requires = { "nvim-lua/plenary.nvim", }, From c8f85b39ca3f60f7e7e31b16c6d20afc26528da5 Mon Sep 17 00:00:00 2001 From: luokai Date: Tue, 8 Nov 2022 23:10:35 +0800 Subject: [PATCH 0496/1278] bookmarks --- lua/kide/plugins/config/browse-nvim.lua | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/lua/kide/plugins/config/browse-nvim.lua b/lua/kide/plugins/config/browse-nvim.lua index 85ace03b..bfa2d657 100644 --- a/lua/kide/plugins/config/browse-nvim.lua +++ b/lua/kide/plugins/config/browse-nvim.lua @@ -6,11 +6,9 @@ browse.setup({ }) local bookmarks = { - "https://github.com/hoob3rt/lualine.nvim", - "https://github.com/neovim/neovim", - "https://neovim.discourse.group/", - "https://github.com/nvim-telescope/telescope.nvim", - "https://github.com/rockerBOO/awesome-neovim", + "https://docs.spring.io/spring-framework/docs/5.3.12/reference/html/", + "https://github.com/", + "https://stackoverflow.com/", } local function command(name, rhs, opts) From 4cf29c88f7059a0c20f85671a94b7ddcd07abe08 Mon Sep 17 00:00:00 2001 From: luokai Date: Tue, 8 Nov 2022 23:15:57 +0800 Subject: [PATCH 0497/1278] =?UTF-8?q?=EE=8D=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lua/kide/plugins/config/telescope.lua | 2 +- lua/kide/plugins/config/which-key.lua | 8 +++++--- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/lua/kide/plugins/config/telescope.lua b/lua/kide/plugins/config/telescope.lua index 0812074c..9fc899df 100644 --- a/lua/kide/plugins/config/telescope.lua +++ b/lua/kide/plugins/config/telescope.lua @@ -38,7 +38,7 @@ telescope.setup({ -- }, -- prompt_prefix = "  ", prompt_prefix = "  ", - selection_caret = "➜ ", + selection_caret = " ", entry_prefix = " ", initial_mode = "insert", selection_strategy = "reset", diff --git a/lua/kide/plugins/config/which-key.lua b/lua/kide/plugins/config/which-key.lua index 1929a225..7379abbe 100644 --- a/lua/kide/plugins/config/which-key.lua +++ b/lua/kide/plugins/config/which-key.lua @@ -1,6 +1,8 @@ local which_key = require("which-key") which_key.setup({ - -- your configuration comes here - -- or leave it empty to use the default settings - -- refer to the configuration section below + icons = { + breadcrumb = "»", -- symbol used in the command line area that shows your active key combo + separator = "", -- symbol used between a key and it's label + group = "+", -- symbol prepended to a group + }, }) From 187ddb5660d40c60502107113ecf080edc084951 Mon Sep 17 00:00:00 2001 From: luokai Date: Fri, 11 Nov 2022 21:34:09 +0800 Subject: [PATCH 0498/1278] =?UTF-8?q?=E5=A4=9A=E4=BD=99=E9=85=8D=E7=BD=AE?= =?UTF-8?q?=E5=8E=BB=E9=99=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lua/kide/plugins/config/nvim-tree.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lua/kide/plugins/config/nvim-tree.lua b/lua/kide/plugins/config/nvim-tree.lua index 8100a6e3..6e0e98d5 100644 --- a/lua/kide/plugins/config/nvim-tree.lua +++ b/lua/kide/plugins/config/nvim-tree.lua @@ -49,7 +49,7 @@ require("nvim-tree").setup({ }, view = { width = 34, - height = 40, + -- height = 40, hide_root_folder = true, side = "left", preserve_window_proportions = false, From 4c082587c5f3fbee017a7737d2d7a2374ba0a05b Mon Sep 17 00:00:00 2001 From: luokai Date: Fri, 11 Nov 2022 22:50:00 +0800 Subject: [PATCH 0499/1278] =?UTF-8?q?windows=E6=94=AF=E6=8C=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index dfc98302..2b8794ea 100644 --- a/README.md +++ b/README.md @@ -13,7 +13,6 @@ cd ~/.config git clone https://github.com/JavaHello/nvim.git ``` -> 此配置在 Linux, Mac 系统上长期使用 ### Windows @@ -22,6 +21,8 @@ cd $env:LOCALAPPDATA git clone https://github.com/JavaHello/nvim.git ``` +> 此配置在 Linux, Mac, Windows (推荐使用 scoop 安装依赖) 系统上长期使用 + ## 快捷键 | 功能 | 按键 | From 7db7a911a5fc9edc1b6c85b03e0a920bd8f35fe9 Mon Sep 17 00:00:00 2001 From: luokai Date: Sat, 12 Nov 2022 14:11:17 +0800 Subject: [PATCH 0500/1278] =?UTF-8?q?=E5=8F=AF=E9=80=89=E5=8F=82=E6=95=B0?= =?UTF-8?q?=E9=85=8D=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lua/kide/lsp/java.lua | 1 + 1 file changed, 1 insertion(+) diff --git a/lua/kide/lsp/java.lua b/lua/kide/lsp/java.lua index 6dbb9979..7c13ec62 100644 --- a/lua/kide/lsp/java.lua +++ b/lua/kide/lsp/java.lua @@ -125,6 +125,7 @@ local config = { "-Dlog.protocol=true", "-Dlog.level=ALL", "-Dsun.zip.disableMemoryMapping=true", + -- "-Djava.util.concurrent.ForkJoinPool.common.parallelism=16", -- "-noverify", -- '-XX:+UseParallelGC', -- '-XX:GCTimeRatio=4', From 07d2fdfd67a39fa82ddf48cd8a449b32e49ea995 Mon Sep 17 00:00:00 2001 From: luokai Date: Mon, 14 Nov 2022 17:45:17 +0800 Subject: [PATCH 0501/1278] next error --- lua/kide/core/keybindings.lua | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lua/kide/core/keybindings.lua b/lua/kide/core/keybindings.lua index 458f1997..9b9a2d23 100644 --- a/lua/kide/core/keybindings.lua +++ b/lua/kide/core/keybindings.lua @@ -190,6 +190,8 @@ M.maplsp = function(client, buffer) vim.api.nvim_buf_set_keymap(buffer, "n", "go", "lua vim.diagnostic.open_float()", opt) vim.api.nvim_buf_set_keymap(buffer, "n", "[g", "lua vim.diagnostic.goto_prev()", opt) vim.api.nvim_buf_set_keymap(buffer, "n", "]g", "lua vim.diagnostic.goto_next()", opt) + vim.api.nvim_buf_set_keymap(buffer, "n", "[e", "lua vim.diagnostic.goto_prev({ severity = vim.diagnostic.severity.ERROR })", opt) + vim.api.nvim_buf_set_keymap(buffer, "n", "]e", "lua vim.diagnostic.goto_next({ severity = vim.diagnostic.severity.ERROR })", opt) -- mapbuf('n', 'q', 'lua vim.diagnostic.setloclist()', opt) -- leader + = -- vim.api.nvim_buf_set_keymap(bufnr, 'n', '=', 'lua vim.lsp.buf.format()', opt) From 194b7e1bc0618bf11097aad4a7c58cff6f6a2290 Mon Sep 17 00:00:00 2001 From: luokai Date: Tue, 15 Nov 2022 15:23:11 +0800 Subject: [PATCH 0502/1278] JDTLS_RUN_JAVA --- lua/kide/lsp/java.lua | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lua/kide/lsp/java.lua b/lua/kide/lsp/java.lua index 7c13ec62..3473facc 100644 --- a/lua/kide/lsp/java.lua +++ b/lua/kide/lsp/java.lua @@ -5,6 +5,7 @@ local env = { JAVA_HOME = os.getenv("JAVA_HOME"), MAVEN_HOME = os.getenv("MAVEN_HOME"), MAVEN_SETTINGS = os.getenv("MAVEN_SETTINGS"), + JDTLS_RUN_JAVA = os.getenv("JDTLS_RUN_JAVA"), JDTLS_HOME = os.getenv("JDTLS_HOME"), JDTLS_WORKSPACE = os.getenv("JDTLS_WORKSPACE"), LOMBOK_JAR = os.getenv("LOMBOK_JAR"), @@ -28,7 +29,7 @@ local function get_java_ver_home(v, dv) end local function get_java() - return get_java_home() .. "/bin/java" + return or_default(env.JDTLS_RUN_JAVA, get_java_home() .. "/bin/java") end local function get_jdtls_workspace() From 2473ed18bacfb3a05d2e859602a28a40bdad9c8d Mon Sep 17 00:00:00 2001 From: luokai Date: Wed, 16 Nov 2022 15:48:40 +0800 Subject: [PATCH 0503/1278] maven --- lua/kide/core/utils/maven.lua | 27 +++++++++++++++++++++++++++ lua/kide/lsp/java.lua | 1 + 2 files changed, 28 insertions(+) create mode 100644 lua/kide/core/utils/maven.lua diff --git a/lua/kide/core/utils/maven.lua b/lua/kide/core/utils/maven.lua new file mode 100644 index 00000000..06b8cce9 --- /dev/null +++ b/lua/kide/core/utils/maven.lua @@ -0,0 +1,27 @@ +local M = {} + +local function settings_opt(settings) + if settings then + return " -s " .. settings + end + return "" +end + +M.maven_command = function(buf, settings) + vim.api.nvim_buf_create_user_command(buf, "MavenCompile", function() + require("toggleterm").exec("mvn compile test-compile" .. settings_opt(settings)) + end, { + nargs = 0, + }) + vim.api.nvim_buf_create_user_command(buf, "MavenInstll", function() + require("toggleterm").exec("mvn clean install" .. settings_opt(settings)) + end, { + nargs = 0, + }) + vim.api.nvim_buf_create_user_command(buf, "MavenPkg", function() + require("toggleterm").exec("mvn clean package" .. settings_opt(settings)) + end, { + nargs = 0, + }) +end +return M diff --git a/lua/kide/lsp/java.lua b/lua/kide/lsp/java.lua index 3473facc..fa61e44e 100644 --- a/lua/kide/lsp/java.lua +++ b/lua/kide/lsp/java.lua @@ -330,6 +330,7 @@ config["on_attach"] = function(client, buffer) -- end require("nvim-navic").attach(client, buffer) + require("kide.core.utils.maven").maven_command(buffer, get_maven_settings()) -- require('java-deps').attach(client, bufnr) -- vim.notify(vim.api.nvim_buf_get_name(bufnr), vim.log.levels.INFO) end From 5ebc5cf36295d6317561c1744cdf61ddd8f93403 Mon Sep 17 00:00:00 2001 From: luokai Date: Wed, 16 Nov 2022 15:58:58 +0800 Subject: [PATCH 0504/1278] maven cmd --- lua/kide/core/utils/maven.lua | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/lua/kide/core/utils/maven.lua b/lua/kide/core/utils/maven.lua index 06b8cce9..061907c5 100644 --- a/lua/kide/core/utils/maven.lua +++ b/lua/kide/core/utils/maven.lua @@ -18,10 +18,15 @@ M.maven_command = function(buf, settings) end, { nargs = 0, }) - vim.api.nvim_buf_create_user_command(buf, "MavenPkg", function() + vim.api.nvim_buf_create_user_command(buf, "MavenPpckage", function() require("toggleterm").exec("mvn clean package" .. settings_opt(settings)) end, { nargs = 0, }) + vim.api.nvim_buf_create_user_command(buf, "MavenDependency", function() + require("toggleterm").exec("mvn dependency:tree -Doutput=.dependency.txt" .. settings_opt(settings)) + end, { + nargs = 0, + }) end return M From 68064c5ce8bace4453ca40c5d8fa397b0916a8fc Mon Sep 17 00:00:00 2001 From: luokai Date: Thu, 17 Nov 2022 09:44:46 +0800 Subject: [PATCH 0505/1278] maven pom.xml --- lua/kide/core/init.lua | 1 + lua/kide/core/utils/maven.lua | 19 +++++++++++++++++++ 2 files changed, 20 insertions(+) diff --git a/lua/kide/core/init.lua b/lua/kide/core/init.lua index 791001cd..0b665159 100644 --- a/lua/kide/core/init.lua +++ b/lua/kide/core/init.lua @@ -2,4 +2,5 @@ require("kide.core.basic") vim.schedule(function() require("kide.core.utils.plantuml").setup() + require("kide.core.utils.maven").setup() end) diff --git a/lua/kide/core/utils/maven.lua b/lua/kide/core/utils/maven.lua index 061907c5..d042601c 100644 --- a/lua/kide/core/utils/maven.lua +++ b/lua/kide/core/utils/maven.lua @@ -28,5 +28,24 @@ M.maven_command = function(buf, settings) end, { nargs = 0, }) + vim.api.nvim_buf_create_user_command(buf, "MavenDownloadSources", function() + require("toggleterm").exec("mvn dependency:sources -DdownloadSources=true" .. settings_opt(settings)) + end, { + nargs = 0, + }) +end + +M.setup = function() + local group = vim.api.nvim_create_augroup("kide_jdtls_java_maven", { clear = true }) + vim.api.nvim_create_autocmd({ "FileType" }, { + group = group, + pattern = { "xml" }, + desc = "maven_command", + callback = function(e) + if vim.endswith(e.file, "pom.xml") then + M.maven_command(e.buf) + end + end, + }) end return M From 8278a616a108083493555d80bc9daf50502db46a Mon Sep 17 00:00:00 2001 From: luokai Date: Thu, 17 Nov 2022 09:53:56 +0800 Subject: [PATCH 0506/1278] update --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 2b8794ea..3f457518 100644 --- a/README.md +++ b/README.md @@ -2,7 +2,7 @@ 可配置 `Java`, `Rust`, `C/C++`, `JavaScript` 等编程语言开发环境。 极速启动 (60 ~ 100 ms), 注重细节。 -使用 `neovim v0.8.0` 版本。 +使用 `neovim v0.8.1 +` 版本。 ## 安装 From c9e3a1e39ffc8942e152cff5fc00cf396677044b Mon Sep 17 00:00:00 2001 From: luokai Date: Thu, 17 Nov 2022 09:55:23 +0800 Subject: [PATCH 0507/1278] scoop URL --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 3f457518..c50157e0 100644 --- a/README.md +++ b/README.md @@ -21,7 +21,7 @@ cd $env:LOCALAPPDATA git clone https://github.com/JavaHello/nvim.git ``` -> 此配置在 Linux, Mac, Windows (推荐使用 scoop 安装依赖) 系统上长期使用 +> 此配置在 Linux, Mac, Windows (推荐使用 [scoop](https://scoop.sh/) 安装依赖) 系统上长期使用 ## 快捷键 From 38c621173ac2adddba800db1f522418ab4853f52 Mon Sep 17 00:00:00 2001 From: luokai Date: Thu, 17 Nov 2022 20:33:29 +0800 Subject: [PATCH 0508/1278] leap -> hop --- lua/kide/core/keybindings.lua | 46 ----------------------------------- lua/kide/plugins/init.lua | 9 +++---- 2 files changed, 3 insertions(+), 52 deletions(-) diff --git a/lua/kide/core/keybindings.lua b/lua/kide/core/keybindings.lua index 9b9a2d23..7f6a646d 100644 --- a/lua/kide/core/keybindings.lua +++ b/lua/kide/core/keybindings.lua @@ -316,52 +316,6 @@ command! -buffer HttpLast :lua require'rest-nvim'.last() ]]) end -M.hop_mapkey = function() - -- hop.nvim - -- place this in one of your configuration file(s) - map( - "n", - "f", - "lua require'hop'.hint_char1({ direction = require'hop.hint'.HintDirection.AFTER_CURSOR, current_line_only = true })", - opt - ) - map( - "v", - "f", - "lua require'hop'.hint_char1({ direction = require'hop.hint'.HintDirection.AFTER_CURSOR, current_line_only = true })", - opt - ) - map( - "n", - "F", - "lua require'hop'.hint_char1({ direction = require'hop.hint'.HintDirection.BEFORE_CURSOR, current_line_only = true })", - opt - ) - map( - "v", - "F", - "lua require'hop'.hint_char1({ direction = require'hop.hint'.HintDirection.BEFORE_CURSOR, current_line_only = true })", - opt - ) - map( - "o", - "f", - "lua require'hop'.hint_char1({ direction = require'hop.hint'.HintDirection.AFTER_CURSOR, current_line_only = true, inclusive_jump = true })", - opt - ) - map( - "o", - "F", - "lua require'hop'.hint_char1({ direction = require'hop.hint'.HintDirection.BEFORE_CURSOR, current_line_only = true, inclusive_jump = true })", - opt - ) - -- map('', 't', "lua require'hop'.hint_char1({ direction = require'hop.hint'.HintDirection.AFTER_CURSOR, current_line_only = true })", opt) - -- map('', 'T', "lua require'hop'.hint_char1({ direction = require'hop.hint'.HintDirection.BEFORE_CURSOR, current_line_only = true })", opt) - -- map('n', 'e', " lua require'hop'.hint_words({ hint_position = require'hop.hint'.HintPosition.END })", opt) - -- map('v', 'e', " lua require'hop'.hint_words({ hint_position = require'hop.hint'.HintPosition.END })", opt) - -- map('o', 'e', " lua require'hop'.hint_words({ hint_position = require'hop.hint'.HintPosition.END, inclusive_jump = true })", opt) -end - M.ufo_mapkey = function() -- Using ufo provider need remap `zR` and `zM`. If Neovim is 0.6.1, remap yourself vim.keymap.set("n", "zR", require("ufo").openAllFolds) diff --git a/lua/kide/plugins/init.lua b/lua/kide/plugins/init.lua index 4105ffb9..5bdf2ae1 100644 --- a/lua/kide/plugins/init.lua +++ b/lua/kide/plugins/init.lua @@ -668,16 +668,13 @@ require("packer").startup({ -- 快速跳转 use({ - "phaazon/hop.nvim", + "ggandor/leap.nvim", opt = true, - branch = "v2", setup = function() - -- on_file_open("hop.nvim") - require("kide.core.layz_load").async_load("hop.nvim") + require("kide.core.layz_load").async_load("leap.nvim") end, config = function() - require("hop").setup({ keys = "etovxqpdygfblzhckisuran" }) - require("kide.core.keybindings").hop_mapkey() + require("leap").add_default_mappings() end, }) From b09e3e00f57284578071239de102aa057643b4ee Mon Sep 17 00:00:00 2001 From: luokai Date: Thu, 17 Nov 2022 20:46:07 +0800 Subject: [PATCH 0509/1278] key spectre open_visual --- lua/kide/core/keybindings.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lua/kide/core/keybindings.lua b/lua/kide/core/keybindings.lua index 7f6a646d..9d5c521b 100644 --- a/lua/kide/core/keybindings.lua +++ b/lua/kide/core/keybindings.lua @@ -139,7 +139,7 @@ nnoremap l map("n", "S", "lua require('spectre').open()", opt) -- search current word map("n", "fr", "lua require('spectre').open_visual({select_word=true})", opt) - map("v", "fr", "lua require('spectre').open_visual()", opt) + map("v", "fr", ":lua require('spectre').open_visual()", opt) -- search in current file -- map("n", "fp", "viw:lua require('spectre').open_file_search()", opt) -- run command :Spectre From b49a35512fd4bb6dfd0b4d8c78b5e96048187f21 Mon Sep 17 00:00:00 2001 From: luokai Date: Thu, 17 Nov 2022 21:16:40 +0800 Subject: [PATCH 0510/1278] leap conf --- lua/kide/plugins/init.lua | 3 +++ 1 file changed, 3 insertions(+) diff --git a/lua/kide/plugins/init.lua b/lua/kide/plugins/init.lua index 5bdf2ae1..a7d044ac 100644 --- a/lua/kide/plugins/init.lua +++ b/lua/kide/plugins/init.lua @@ -675,6 +675,9 @@ require("packer").startup({ end, config = function() require("leap").add_default_mappings() + require("leap").opts.safe_labels = {} + vim.keymap.del({ "x", "o" }, "x") + vim.keymap.del({ "x", "o" }, "X") end, }) From aeaa4dd60e1bc2c025d6f848d2a672574a854b7b Mon Sep 17 00:00:00 2001 From: luokai Date: Thu, 17 Nov 2022 22:27:46 +0800 Subject: [PATCH 0511/1278] List of unsupported navic --- lua/kide/lsp/init.lua | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/lua/kide/lsp/init.lua b/lua/kide/lsp/init.lua index d2f8d6c7..ab6722c5 100644 --- a/lua/kide/lsp/init.lua +++ b/lua/kide/lsp/init.lua @@ -37,6 +37,7 @@ local capabilities = require("cmp_nvim_lsp").default_capabilities(vim.lsp.protoc -- 没有确定使用效果参数 -- capabilities.textDocument.completion.completionItem.snippetSupport = true local utils = require("kide.core.utils") +local navic_unsupported = { "sqls" } require("mason-lspconfig").setup_handlers({ -- The first entry (without a key) will be the default handler @@ -54,7 +55,9 @@ require("mason-lspconfig").setup_handlers({ scfg.on_attach = function(client, buffer) -- 绑定快捷键 require("kide.core.keybindings").maplsp(client, buffer) - require("nvim-navic").attach(client, buffer) + if not navic_unsupported[client.name] then + require("nvim-navic").attach(client, buffer) + end if on_attach then on_attach(client, buffer) end From 1bc5022adfd331541e44c60cf6da475bd869deef Mon Sep 17 00:00:00 2001 From: luokai Date: Thu, 17 Nov 2022 22:35:30 +0800 Subject: [PATCH 0512/1278] update --- lua/kide/lsp/init.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lua/kide/lsp/init.lua b/lua/kide/lsp/init.lua index ab6722c5..5c5ca266 100644 --- a/lua/kide/lsp/init.lua +++ b/lua/kide/lsp/init.lua @@ -37,7 +37,7 @@ local capabilities = require("cmp_nvim_lsp").default_capabilities(vim.lsp.protoc -- 没有确定使用效果参数 -- capabilities.textDocument.completion.completionItem.snippetSupport = true local utils = require("kide.core.utils") -local navic_unsupported = { "sqls" } +local navic_unsupported = { sqls = true } require("mason-lspconfig").setup_handlers({ -- The first entry (without a key) will be the default handler From 5312a177806ce2703cee919a1e82a710475e3905 Mon Sep 17 00:00:00 2001 From: luokai Date: Fri, 18 Nov 2022 10:08:32 +0800 Subject: [PATCH 0513/1278] maven --- lua/kide/core/utils/maven.lua | 51 +++++++++++++++++++---------------- lua/kide/lsp/java.lua | 14 +++------- 2 files changed, 32 insertions(+), 33 deletions(-) diff --git a/lua/kide/core/utils/maven.lua b/lua/kide/core/utils/maven.lua index d042601c..38e7afe0 100644 --- a/lua/kide/core/utils/maven.lua +++ b/lua/kide/core/utils/maven.lua @@ -1,5 +1,10 @@ local M = {} +local maven_settings = os.getenv("MAVEN_HOME") .. "/conf/settings.xml" +M.get_maven_settings = function() + return os.getenv("MAVEN_SETTINGS") or maven_settings +end + local function settings_opt(settings) if settings then return " -s " .. settings @@ -7,34 +12,34 @@ local function settings_opt(settings) return "" end -M.maven_command = function(buf, settings) - vim.api.nvim_buf_create_user_command(buf, "MavenCompile", function() - require("toggleterm").exec("mvn compile test-compile" .. settings_opt(settings)) - end, { - nargs = 0, - }) - vim.api.nvim_buf_create_user_command(buf, "MavenInstll", function() - require("toggleterm").exec("mvn clean install" .. settings_opt(settings)) - end, { - nargs = 0, - }) - vim.api.nvim_buf_create_user_command(buf, "MavenPpckage", function() - require("toggleterm").exec("mvn clean package" .. settings_opt(settings)) - end, { - nargs = 0, - }) - vim.api.nvim_buf_create_user_command(buf, "MavenDependency", function() - require("toggleterm").exec("mvn dependency:tree -Doutput=.dependency.txt" .. settings_opt(settings)) - end, { - nargs = 0, - }) - vim.api.nvim_buf_create_user_command(buf, "MavenDownloadSources", function() - require("toggleterm").exec("mvn dependency:sources -DdownloadSources=true" .. settings_opt(settings)) +local function pom_file(file) + if file and vim.endswith(file, "pom.xml") then + return " -f " .. file + end + return "" +end + +local exec = function(cmd, pom) + require("toggleterm").exec(cmd .. settings_opt(M.get_maven_settings()) .. pom_file(pom)) +end +local function create_command(buf, name, cmd) + vim.api.nvim_buf_create_user_command(buf, name, function() + exec(cmd, vim.fn.expand("%")) end, { nargs = 0, }) end +M.maven_command = function(buf) + create_command(buf, "MavenCompile", "mvn compile test-compile") + create_command(buf, "MavenInstll", "mvn clean install") + create_command(buf, "MavenPpckage", "mvn clean package") + create_command(buf, "MavenDependencyTree", "mvn dependency:tree -Doutput=.dependency.txt") + create_command(buf, "MavenDependencyAnalyzeDuplicate", "mvn dependency:analyze-duplicate") + create_command(buf, "MavenDependencyAnalyzeOnly", "mvn dependency:analyze-only -Dverbose") + create_command(buf, "MavenDownloadSources", "mvn dependency:sources -DdownloadSources=true") +end + M.setup = function() local group = vim.api.nvim_create_augroup("kide_jdtls_java_maven", { clear = true }) vim.api.nvim_create_autocmd({ "FileType" }, { diff --git a/lua/kide/lsp/java.lua b/lua/kide/lsp/java.lua index fa61e44e..1d91650c 100644 --- a/lua/kide/lsp/java.lua +++ b/lua/kide/lsp/java.lua @@ -3,24 +3,18 @@ local cutils = require("kide.core.utils") local env = { HOME = vim.loop.os_homedir(), JAVA_HOME = os.getenv("JAVA_HOME"), - MAVEN_HOME = os.getenv("MAVEN_HOME"), - MAVEN_SETTINGS = os.getenv("MAVEN_SETTINGS"), JDTLS_RUN_JAVA = os.getenv("JDTLS_RUN_JAVA"), JDTLS_HOME = os.getenv("JDTLS_HOME"), JDTLS_WORKSPACE = os.getenv("JDTLS_WORKSPACE"), LOMBOK_JAR = os.getenv("LOMBOK_JAR"), JOL_JAR = os.getenv("JOL_JAR"), } +local maven = require("kide.core.utils.maven") local function or_default(a, v) return require("kide.core.utils").or_default(a, v) end -local maven_settings = env.MAVEN_HOME .. "/conf/settings.xml" -local function get_maven_settings() - return or_default(env.MAVEN_SETTINGS, maven_settings) -end - local function get_java_home() return or_default(env.JAVA_HOME, "/opt/software/java/zulu17.34.19-ca-jdk17.0.3-macosx_aarch64") end @@ -245,8 +239,8 @@ local config = { maven = { -- userSettings = "/opt/software/apache-maven-3.6.3/conf/settings.xml", -- globalSettings = "/opt/software/apache-maven-3.6.3/conf/settings.xml", - userSettings = get_maven_settings(), - globalSettings = get_maven_settings(), + userSettings = maven.get_maven_settings(), + globalSettings = maven.get_maven_settings(), }, runtimes = { { @@ -330,7 +324,7 @@ config["on_attach"] = function(client, buffer) -- end require("nvim-navic").attach(client, buffer) - require("kide.core.utils.maven").maven_command(buffer, get_maven_settings()) + maven.maven_command(buffer) -- require('java-deps').attach(client, bufnr) -- vim.notify(vim.api.nvim_buf_get_name(bufnr), vim.log.levels.INFO) end From cbd546cafb51d1aaaed75ad070f66009b9d7d07c Mon Sep 17 00:00:00 2001 From: luokai Date: Sun, 20 Nov 2022 21:51:40 +0800 Subject: [PATCH 0514/1278] =?UTF-8?q?maven=20setting=20=E5=8F=AF=E9=80=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lua/kide/core/utils/maven.lua | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/lua/kide/core/utils/maven.lua b/lua/kide/core/utils/maven.lua index 38e7afe0..68708e8b 100644 --- a/lua/kide/core/utils/maven.lua +++ b/lua/kide/core/utils/maven.lua @@ -1,8 +1,14 @@ local M = {} -local maven_settings = os.getenv("MAVEN_HOME") .. "/conf/settings.xml" +local function maven_settings() + local maven_home = os.getenv("MAVEN_HOME") + if maven_home then + return maven_home .. "/conf/settings.xml" + end +end + M.get_maven_settings = function() - return os.getenv("MAVEN_SETTINGS") or maven_settings + return os.getenv("MAVEN_SETTINGS") or maven_settings() end local function settings_opt(settings) From 8b2731e25f4a5baf2836a4105f42015b13e44b27 Mon Sep 17 00:00:00 2001 From: luokai Date: Sun, 20 Nov 2022 22:03:23 +0800 Subject: [PATCH 0515/1278] =?UTF-8?q?lsp=20=E5=8F=AF=E9=80=89=E5=AE=89?= =?UTF-8?q?=E8=A3=85?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lua/kide/dap/codelldb.lua | 3 ++- lua/kide/dap/init.lua | 6 +++++- lua/kide/lsp/init.lua | 9 --------- 3 files changed, 7 insertions(+), 11 deletions(-) diff --git a/lua/kide/dap/codelldb.lua b/lua/kide/dap/codelldb.lua index 3db24d59..104b5943 100644 --- a/lua/kide/dap/codelldb.lua +++ b/lua/kide/dap/codelldb.lua @@ -7,7 +7,7 @@ M.config = {} M.setup = function(config) if not extension_path then vim.notify("codelldb not found", vim.log.levels.WARN) - return nil + return false end M.config.codelldb_path = extension_path .. "/adapter/codelldb" -- M.config.liblldb_path = extension_path .. "/lldb/lib/liblldb.dylib" @@ -82,5 +82,6 @@ M.setup = function(config) } dap.configurations.c = dap.configurations.cpp dap.configurations.rust = dap.configurations.cpp + return true end return M diff --git a/lua/kide/dap/init.lua b/lua/kide/dap/init.lua index 690cb028..e0a2decf 100644 --- a/lua/kide/dap/init.lua +++ b/lua/kide/dap/init.lua @@ -1 +1,5 @@ -require("kide.dap.codelldb").setup() +vim.api.nvim_create_user_command("CodelldbLoad", function() + if not vim.g.codelldb_load then + vim.g.codelldb_load = require("kide.dap.codelldb").setup() + end +end, {}) diff --git a/lua/kide/lsp/init.lua b/lua/kide/lsp/init.lua index 5c5ca266..bd5a8c85 100644 --- a/lua/kide/lsp/init.lua +++ b/lua/kide/lsp/init.lua @@ -2,15 +2,6 @@ local mason_lspconfig = require("mason-lspconfig") mason_lspconfig.setup({ ensure_installed = { "sumneko_lua", - "clangd", - "tsserver", - "html", - "pyright", - "rust_analyzer", - "sqls", - "gopls", - "kotlin_language_server", - "vuels", }, }) From d85daf95abc812e768a7a4a76d685e3f3bc783f3 Mon Sep 17 00:00:00 2001 From: luokai Date: Mon, 21 Nov 2022 21:46:14 +0800 Subject: [PATCH 0516/1278] =?UTF-8?q?=E5=8F=AF=E9=80=89=20JDK?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lua/kide/lsp/java.lua | 57 ++++++++++++++++++++++++++++--------------- 1 file changed, 37 insertions(+), 20 deletions(-) diff --git a/lua/kide/lsp/java.lua b/lua/kide/lsp/java.lua index 1d91650c..3a18a7a3 100644 --- a/lua/kide/lsp/java.lua +++ b/lua/kide/lsp/java.lua @@ -49,6 +49,41 @@ local _config = (function() end end)() +local runtimes = (function() + local result = {} + for _, value in ipairs({ + { + name = "JavaSE-1.8", + version = "8", + default = true, + }, + { + name = "JavaSE-11", + version = "11", + }, + { + name = "JavaSE-17", + version = "17", + }, + { + name = "JavaSE-19", + version = "19", + }, + }) do + local java_home = get_java_ver_home(value.version) + if java_home then + table.insert(result, { + name = value.name, + path = java_home, + default = value.default, + }) + end + end + if #result == 0 then + vim.notify("Please config Java runtimes (JAVA_8_HOME...)") + end +end)() + local project_name = vim.fn.fnamemodify(vim.fn.getcwd(), ":p:h:t") local workspace_dir = get_jdtls_workspace() .. project_name @@ -242,25 +277,7 @@ local config = { userSettings = maven.get_maven_settings(), globalSettings = maven.get_maven_settings(), }, - runtimes = { - { - name = "JavaSE-1.8", - path = get_java_ver_home("8", "/opt/software/java/zulu8.62.0.19-ca-jdk8.0.332-macosx_aarch64"), - default = true, - }, - { - name = "JavaSE-11", - path = get_java_ver_home("11", "/opt/software/java/zulu11.56.19-ca-jdk11.0.15-macosx_aarch64"), - }, - { - name = "JavaSE-17", - path = get_java_ver_home("17", "/opt/software/java/graalvm-ce-java17-22.1.0/Contents/Home"), - }, - { - name = "JavaSE-19", - path = get_java_ver_home("19", "/opt/software/java/graalvm-ce-java19-22.3.0/Contents/Home"), - }, - }, + runtimes = runtimes, }, -- referencesCodeLens = { -- enabled = true, @@ -370,7 +387,7 @@ end local function split_lines(value) value = string.gsub(value, "\r\n?", "\n") - return vim.split(value, "\n", true) + return vim.split(value, "\n", { plain = true }) end function M.convert_input_to_markdown_lines(input, contents) contents = contents or {} From 0ea2847636bbcbefdf0875b26fb4d2f4ad6af2f1 Mon Sep 17 00:00:00 2001 From: luokai Date: Mon, 21 Nov 2022 22:05:35 +0800 Subject: [PATCH 0517/1278] maven --- lua/kide/core/utils/maven.lua | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lua/kide/core/utils/maven.lua b/lua/kide/core/utils/maven.lua index 68708e8b..ff044866 100644 --- a/lua/kide/core/utils/maven.lua +++ b/lua/kide/core/utils/maven.lua @@ -39,7 +39,9 @@ end M.maven_command = function(buf) create_command(buf, "MavenCompile", "mvn compile test-compile") create_command(buf, "MavenInstll", "mvn clean install") + create_command(buf, "MavenInstllSkipTest", "mvn clean install -DskipTests") create_command(buf, "MavenPpckage", "mvn clean package") + create_command(buf, "MavenPpckageSkipTest", "mvn clean package -DskipTests") create_command(buf, "MavenDependencyTree", "mvn dependency:tree -Doutput=.dependency.txt") create_command(buf, "MavenDependencyAnalyzeDuplicate", "mvn dependency:analyze-duplicate") create_command(buf, "MavenDependencyAnalyzeOnly", "mvn dependency:analyze-only -Dverbose") From be41a005bb17cd1f385b38c2afd1510d3ad89e3a Mon Sep 17 00:00:00 2001 From: luokai Date: Mon, 21 Nov 2022 22:29:19 +0800 Subject: [PATCH 0518/1278] result --- lua/kide/lsp/java.lua | 1 + 1 file changed, 1 insertion(+) diff --git a/lua/kide/lsp/java.lua b/lua/kide/lsp/java.lua index 3a18a7a3..846f6de1 100644 --- a/lua/kide/lsp/java.lua +++ b/lua/kide/lsp/java.lua @@ -82,6 +82,7 @@ local runtimes = (function() if #result == 0 then vim.notify("Please config Java runtimes (JAVA_8_HOME...)") end + return result; end)() local project_name = vim.fn.fnamemodify(vim.fn.getcwd(), ":p:h:t") From 9673fa3ca0019aee004b386fd2b544445eea45c2 Mon Sep 17 00:00:00 2001 From: luokai Date: Mon, 21 Nov 2022 23:32:07 +0800 Subject: [PATCH 0519/1278] complete --- lua/kide/core/utils/maven.lua | 54 ++++++++++++++++++++++++++++------- 1 file changed, 44 insertions(+), 10 deletions(-) diff --git a/lua/kide/core/utils/maven.lua b/lua/kide/core/utils/maven.lua index ff044866..ede1163a 100644 --- a/lua/kide/core/utils/maven.lua +++ b/lua/kide/core/utils/maven.lua @@ -28,24 +28,58 @@ end local exec = function(cmd, pom) require("toggleterm").exec(cmd .. settings_opt(M.get_maven_settings()) .. pom_file(pom)) end -local function create_command(buf, name, cmd) - vim.api.nvim_buf_create_user_command(buf, name, function() - exec(cmd, vim.fn.expand("%")) +local function create_command(buf, name, cmd, complete) + vim.api.nvim_buf_create_user_command(buf, name, function(opts) + if opts.args then + exec(cmd .. " " .. opts.args, vim.fn.expand("%")) + else + exec(cmd, vim.fn.expand("%")) + end end, { - nargs = 0, + nargs = "*", + complete = complete, }) end +local function maven_args_complete(complete, deduplicate) + if complete then + return function(_, cmd_line, _) + if deduplicate then + local args = vim.split(cmd_line, " ") + return vim.tbl_filter(function(item) + return not vim.tbl_contains(args, item) + end, complete) + else + return complete + end + end + end +end + M.maven_command = function(buf) - create_command(buf, "MavenCompile", "mvn compile test-compile") - create_command(buf, "MavenInstll", "mvn clean install") - create_command(buf, "MavenInstllSkipTest", "mvn clean install -DskipTests") - create_command(buf, "MavenPpckage", "mvn clean package") - create_command(buf, "MavenPpckageSkipTest", "mvn clean package -DskipTests") - create_command(buf, "MavenDependencyTree", "mvn dependency:tree -Doutput=.dependency.txt") + create_command(buf, "MavenCompile", "mvn compile", maven_args_complete({ "test-compile" }, true)) + create_command( + buf, + "MavenInstll", + "mvn clean install", + maven_args_complete({ "-DskipTests", "-Dmaven.test.skip=true" }, true) + ) + create_command( + buf, + "MavenPackage", + "mvn clean package", + maven_args_complete({ "-DskipTests", "-Dmaven.test.skip=true" }, true) + ) + create_command( + buf, + "MavenDependencyTree", + "mvn dependency:tree", + maven_args_complete({ "-Doutput=.dependency.txt" }, true) + ) create_command(buf, "MavenDependencyAnalyzeDuplicate", "mvn dependency:analyze-duplicate") create_command(buf, "MavenDependencyAnalyzeOnly", "mvn dependency:analyze-only -Dverbose") create_command(buf, "MavenDownloadSources", "mvn dependency:sources -DdownloadSources=true") + create_command(buf, "MavenTest", "mvn test", maven_args_complete({ "-Dtest=" })) end M.setup = function() From 3ac28e24fa4619ea9f0a3fe7f5fe8e034a63ec7c Mon Sep 17 00:00:00 2001 From: luokai Date: Wed, 23 Nov 2022 09:46:50 +0800 Subject: [PATCH 0520/1278] =?UTF-8?q?Java=20LSP=20progress=20=E9=97=AE?= =?UTF-8?q?=E9=A2=98=E5=B7=B2=E4=BF=AE=E5=A4=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lua/kide/lsp/java.lua | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/lua/kide/lsp/java.lua b/lua/kide/lsp/java.lua index 846f6de1..9065b368 100644 --- a/lua/kide/lsp/java.lua +++ b/lua/kide/lsp/java.lua @@ -82,7 +82,7 @@ local runtimes = (function() if #result == 0 then vim.notify("Please config Java runtimes (JAVA_8_HOME...)") end - return result; + return result end)() local project_name = vim.fn.fnamemodify(vim.fn.getcwd(), ":p:h:t") @@ -367,10 +367,13 @@ config.handlers["language/status"] = function(_, s) end end --- java 暂时兼容 fidget, 等待上游支持 --- https://github.com/eclipse/eclipse.jdt.ls/pull/2258 -vim.lsp.handlers["$/progress"] = nil -require("fidget").setup({}) +if not env.JDTLS_HOME then + -- java 暂时兼容 fidget, 等待上游支持 + -- https://github.com/eclipse/eclipse.jdt.ls/pull/2258 + -- 已合并,需要编译最新版本支持 + vim.lsp.handlers["$/progress"] = nil + require("fidget").setup({}) +end local function markdown_format(input) if input then From 4e1ca4ebdcc1765498a00c73d48fbc9a28dc245d Mon Sep 17 00:00:00 2001 From: luokai Date: Wed, 23 Nov 2022 09:47:41 +0800 Subject: [PATCH 0521/1278] update --- lua/kide/lsp/java.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lua/kide/lsp/java.lua b/lua/kide/lsp/java.lua index 9065b368..7a8a6269 100644 --- a/lua/kide/lsp/java.lua +++ b/lua/kide/lsp/java.lua @@ -367,10 +367,10 @@ config.handlers["language/status"] = function(_, s) end end +-- 已合并,需要编译最新版本支持 if not env.JDTLS_HOME then -- java 暂时兼容 fidget, 等待上游支持 -- https://github.com/eclipse/eclipse.jdt.ls/pull/2258 - -- 已合并,需要编译最新版本支持 vim.lsp.handlers["$/progress"] = nil require("fidget").setup({}) end From eaa6535ae5f6cbcbf1b95fd3037c009a147ed20c Mon Sep 17 00:00:00 2001 From: luokai Date: Fri, 25 Nov 2022 21:39:17 +0800 Subject: [PATCH 0522/1278] win wsl clipboard --- lua/kide/core/basic.lua | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/lua/kide/core/basic.lua b/lua/kide/core/basic.lua index 571f0407..19c06cd5 100644 --- a/lua/kide/core/basic.lua +++ b/lua/kide/core/basic.lua @@ -3,6 +3,21 @@ vim.opt.title = true vim.opt.clipboard = "unnamedplus" +if vim.fn.has("wsl") then + vim.g.clipboard = { + name = "win32yank-wsl", + copy = { + ["+"] = "win32yank.exe -i --crlf", + ["*"] = "win32yank.exe -i --crlf", + }, + paste = { + ["+"] = "win32yank.exe -o --lf", + ["*"] = "win32yank.exe -o --lf", + }, + cache_enabled = 0, + } +end + -- 行号 vim.opt.number = true vim.opt.relativenumber = true From 81a663f7b38f84806bcf31c773f216ee42b3f7ff Mon Sep 17 00:00:00 2001 From: luokai Date: Sat, 26 Nov 2022 09:59:36 +0800 Subject: [PATCH 0523/1278] has wsl --- lua/kide/core/basic.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lua/kide/core/basic.lua b/lua/kide/core/basic.lua index 19c06cd5..015e2b21 100644 --- a/lua/kide/core/basic.lua +++ b/lua/kide/core/basic.lua @@ -3,7 +3,7 @@ vim.opt.title = true vim.opt.clipboard = "unnamedplus" -if vim.fn.has("wsl") then +if vim.fn.has("wsl") == 1 then vim.g.clipboard = { name = "win32yank-wsl", copy = { From 7827cf84edb61a0d03557e3a6a70b379684db875 Mon Sep 17 00:00:00 2001 From: luokai Date: Sat, 26 Nov 2022 11:49:03 +0800 Subject: [PATCH 0524/1278] command --- lua/kide/core/utils/init.lua | 46 ++++++++++++ lua/kide/core/utils/maven.lua | 26 ++----- lua/kide/core/utils/plantuml.lua | 120 ++++++++++++++++++++++--------- 3 files changed, 140 insertions(+), 52 deletions(-) diff --git a/lua/kide/core/utils/init.lua b/lua/kide/core/utils/init.lua index 9fc91160..cf5e9fb5 100644 --- a/lua/kide/core/utils/init.lua +++ b/lua/kide/core/utils/init.lua @@ -193,4 +193,50 @@ M.os_type = function() return t end +--- complete +---@param complete {} +---@param opt {multiple:false, multiple_repeated:false, single:false} +M.command_args_complete = function(complete, opt) + local lopt = opt or {} + if complete then + return function(_, cmd_line, _) + if lopt.multiple then + local args = vim.split(cmd_line, " ") + return vim.tbl_filter(function(item) + return not vim.tbl_contains(args, item) + end, complete) + elseif lopt.single then + local args = vim.split(cmd_line, " ") + for _, value in ipairs(args) do + if vim.tbl_contains(complete, value) then + return {} + end + end + return complete + else + return complete + end + end + end +end + +M.open_fn = function(file) + local ok, system_open = pcall(require, "nvim-tree.actions.node.system-open") + if ok then + system_open.fn({ absolute_path = file }) + end +end + +M.get_filename = function(path) + local idx = path:match(".+()%.%w+$") + if idx then + return path:sub(1, idx - 1) + else + return path + end +end + +M.get_extension = function(str) + return str:match(".+%.(%w+)$") +end return M diff --git a/lua/kide/core/utils/maven.lua b/lua/kide/core/utils/maven.lua index ede1163a..b6871acb 100644 --- a/lua/kide/core/utils/maven.lua +++ b/lua/kide/core/utils/maven.lua @@ -1,3 +1,4 @@ +local utils = require("kide.core.utils") local M = {} local function maven_settings() @@ -41,45 +42,32 @@ local function create_command(buf, name, cmd, complete) }) end -local function maven_args_complete(complete, deduplicate) - if complete then - return function(_, cmd_line, _) - if deduplicate then - local args = vim.split(cmd_line, " ") - return vim.tbl_filter(function(item) - return not vim.tbl_contains(args, item) - end, complete) - else - return complete - end - end - end -end +local maven_args_complete = utils.command_args_complete M.maven_command = function(buf) - create_command(buf, "MavenCompile", "mvn compile", maven_args_complete({ "test-compile" }, true)) + create_command(buf, "MavenCompile", "mvn compile", maven_args_complete({ "test-compile" }, { multiple = true })) create_command( buf, "MavenInstll", "mvn clean install", - maven_args_complete({ "-DskipTests", "-Dmaven.test.skip=true" }, true) + maven_args_complete({ "-DskipTests", "-Dmaven.test.skip=true" }, { single = true }) ) create_command( buf, "MavenPackage", "mvn clean package", - maven_args_complete({ "-DskipTests", "-Dmaven.test.skip=true" }, true) + maven_args_complete({ "-DskipTests", "-Dmaven.test.skip=true" }, { single = true }) ) create_command( buf, "MavenDependencyTree", "mvn dependency:tree", - maven_args_complete({ "-Doutput=.dependency.txt" }, true) + maven_args_complete({ "-Doutput=.dependency.txt" }, { multiple = true }) ) create_command(buf, "MavenDependencyAnalyzeDuplicate", "mvn dependency:analyze-duplicate") create_command(buf, "MavenDependencyAnalyzeOnly", "mvn dependency:analyze-only -Dverbose") create_command(buf, "MavenDownloadSources", "mvn dependency:sources -DdownloadSources=true") - create_command(buf, "MavenTest", "mvn test", maven_args_complete({ "-Dtest=" })) + create_command(buf, "MavenTest", "mvn test", maven_args_complete({ "-Dtest=" }, {})) end M.setup = function() diff --git a/lua/kide/core/utils/plantuml.lua b/lua/kide/core/utils/plantuml.lua index 24ac015b..4fe9dc87 100644 --- a/lua/kide/core/utils/plantuml.lua +++ b/lua/kide/core/utils/plantuml.lua @@ -1,32 +1,46 @@ +local uv = vim.loop local utils = require("kide.core.utils") +local plantuml_args_complete = utils.command_args_complete local M = {} M.config = {} -M.config.jar_path = "/opt/software/puml/plantuml.jar" -M.config.cmd = "java -jar " .. M.config.jar_path +local function plantuml_jar(default_jar) + return os.getenv("PLANTUML_JAR") or default_jar +end +M.config.jar_path = plantuml_jar("/opt/software/puml/plantuml.jar") +M.config.cmd = "java" M.config.defaultTo = "svg" M.types = {} -M.types["png"] = true -M.types["svg"] = true -M.types["eps"] = true -M.types["pdf"] = true -M.types["vdx"] = true -M.types["xmi"] = true -M.types["scxml"] = true -M.types["html"] = true -M.types["txt"] = true -M.types["utxt"] = true -M.types["latex"] = true -M.types["latex:nopreamble"] = true +M.types["-tpng"] = "png" +M.types["-tsvg"] = "svg" +M.types["-teps"] = "eps" +M.types["-tpdf"] = "pdf" +M.types["-tvdx"] = "vdx" +M.types["-txmi"] = "xmi" +M.types["-tscxml"] = "scxml" +M.types["-thtml"] = "html" +M.types["-ttxt"] = "atxt" +M.types["-tutxt"] = "utxt" +M.types["-tlatex"] = "latex" +M.types["-tlatex:nopreamble"] = "latex" -local function to_type(type) - if M.types[type] then - return "-t" .. type +local complete_list = (function() + local cl = {} + for k, _ in pairs(M.types) do + table.insert(cl, k) end + return cl +end)() + +local function to_type() return "-t" .. M.config.defaultTo end -local function exec(cmd) +local function out_file(ot, file) + return utils.get_filename(file) .. "." .. ot +end + +local function exec(opt) if not vim.fn.filereadable(M.config.jar_path) then vim.notify("Plantuml: 没有文件 " .. M.config.jar_path, vim.log.levels.ERROR) return @@ -35,21 +49,55 @@ local function exec(cmd) vim.notify("Plantuml: 没有 java 环境", vim.log.levels.ERROR) return end - local p = vim.fn.expand("%:p:h") - local res = utils.run_cmd("cd " .. p .. " && " .. cmd) - if vim.fn.trim(res) == "" then - vim.notify("Plantuml: export success", vim.log.levels.INFO) - else - vim.notify("Plantuml: export error, " .. res, vim.log.levels.WARN) + local out_type = vim.tbl_filter(function(item) + if vim.startswith(item, "-t") then + return true + end + end, opt.args) + if not out_type or vim.tbl_count(out_type) == 0 then + local ot = to_type() + opt.args = { ot } + out_type = { ot } end -end - -M.run_export_opt = function(filename, args) - exec(M.config.cmd .. " " .. args .. " " .. filename) -end + local ot = M.types[out_type[1]] + if not ot then + vim.notify("Plantuml: 不支持的格式 " .. out_type[1], vim.log.levels.ERROR) + return + end + local ofile = out_file(ot, opt.file) -M.run_export_to = function(filename, type) - exec(M.config.cmd .. " " .. to_type(type) .. " " .. filename) + local p = vim.fn.expand("%:p:h") + table.insert(opt.args, 1, "-jar") + table.insert(opt.args, 2, M.config.jar_path) + table.insert(opt.args, opt.file) + table.insert(opt.args, "-o" .. p) + local process = { + cmd = M.config.cmd, + args = opt.args, + errors = "\n", + stderr = uv.new_pipe(false), + } + process.handle, process.pid = uv.spawn( + process.cmd, + { args = process.args, stdio = { nil, nil, process.stderr }, detached = true }, + function(code) + process.handle:close() + if code ~= 0 then + uv.read_start(process.stderr, function(_, data) + process.stderr:read_stop() + process.stderr:close() + if data then + vim.notify("Plantuml: " .. data, vim.log.levels.WARN) + else + vim.notify("Plantuml: export error " .. code, vim.log.levels.WARN) + end + end) + else + vim.notify("Plantuml: export success", vim.log.levels.INFO) + utils.open_fn(ofile) + end + end + ) end local function init() @@ -60,8 +108,14 @@ local function init() desc = "Export Plantuml file", callback = function(o) vim.api.nvim_buf_create_user_command(o.buf, "Plantuml", function(opts) - M.run_export_to(vim.fn.expand("%"), opts.args) - end, {}) + exec({ + args = opts.fargs, + file = o.file, + }) + end, { + nargs = "*", + complete = plantuml_args_complete(complete_list, { single = true }), + }) end, }) end From 445633c04c2b8aaa098f75bb26b64b581ab6fe72 Mon Sep 17 00:00:00 2001 From: luokai Date: Sat, 26 Nov 2022 11:50:09 +0800 Subject: [PATCH 0525/1278] fmt --- lua/kide/core/keybindings.lua | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/lua/kide/core/keybindings.lua b/lua/kide/core/keybindings.lua index 9d5c521b..ded6a662 100644 --- a/lua/kide/core/keybindings.lua +++ b/lua/kide/core/keybindings.lua @@ -190,8 +190,20 @@ M.maplsp = function(client, buffer) vim.api.nvim_buf_set_keymap(buffer, "n", "go", "lua vim.diagnostic.open_float()", opt) vim.api.nvim_buf_set_keymap(buffer, "n", "[g", "lua vim.diagnostic.goto_prev()", opt) vim.api.nvim_buf_set_keymap(buffer, "n", "]g", "lua vim.diagnostic.goto_next()", opt) - vim.api.nvim_buf_set_keymap(buffer, "n", "[e", "lua vim.diagnostic.goto_prev({ severity = vim.diagnostic.severity.ERROR })", opt) - vim.api.nvim_buf_set_keymap(buffer, "n", "]e", "lua vim.diagnostic.goto_next({ severity = vim.diagnostic.severity.ERROR })", opt) + vim.api.nvim_buf_set_keymap( + buffer, + "n", + "[e", + "lua vim.diagnostic.goto_prev({ severity = vim.diagnostic.severity.ERROR })", + opt + ) + vim.api.nvim_buf_set_keymap( + buffer, + "n", + "]e", + "lua vim.diagnostic.goto_next({ severity = vim.diagnostic.severity.ERROR })", + opt + ) -- mapbuf('n', 'q', 'lua vim.diagnostic.setloclist()', opt) -- leader + = -- vim.api.nvim_buf_set_keymap(bufnr, 'n', '=', 'lua vim.lsp.buf.format()', opt) From 3677a7e4bcb81d249edd1e164f70ea30b01b5936 Mon Sep 17 00:00:00 2001 From: luokai Date: Sat, 26 Nov 2022 12:42:37 +0800 Subject: [PATCH 0526/1278] pandoc --- lua/kide/plugins/config/pandoc.lua | 77 ++++++++++++++++++++++++++++++ lua/kide/plugins/init.lua | 10 +++- 2 files changed, 86 insertions(+), 1 deletion(-) create mode 100644 lua/kide/plugins/config/pandoc.lua diff --git a/lua/kide/plugins/config/pandoc.lua b/lua/kide/plugins/config/pandoc.lua new file mode 100644 index 00000000..e2c2f093 --- /dev/null +++ b/lua/kide/plugins/config/pandoc.lua @@ -0,0 +1,77 @@ +require("pandoc").setup({ + commands = { + enable = false, + }, +}) + +-- pandoc --pdf-engine=xelatex --highlight-style tango -N --toc -V CJKmainfont="Yuanti SC" -V mainfont="Hack" -V geometry:"top=2cm, bottom=1.5cm, left=2cm, right=2cm" test.md -o out.pdf +local function markdown_to_pdf() + local group = vim.api.nvim_create_augroup("kide_utils_pandoc", { clear = true }) + vim.api.nvim_create_autocmd({ "FileType" }, { + group = group, + pattern = { "markdown" }, + desc = "Markdown to PDF", + callback = function(o) + vim.api.nvim_buf_create_user_command(o.buf, "PandocMdToPdf", function(_) + require("pandoc.render").file({ + { "--pdf-engine", "xelatex" }, + { "--highlight-style", "tango" }, + { "--number-sections" }, + { "--toc" }, + { "--variable", "CJKmainfont=Yuanti SC" }, + { "--variable", "mainfont=Hack" }, + { "--variable", "geometry:top=2cm, bottom=1.5cm, left=2cm, right=2cm" }, + }) + end, { + nargs = "*", + complete = require("pandoc.utils").complete, + }) + end, + }) +end +markdown_to_pdf() + +local uv = vim.loop +require("pandoc.process").spawn = function(bin, args, callback) + local stdout = uv.new_pipe(false) + local stderr = uv.new_pipe(false) + + local p = vim.fn.expand("%:p:h") + local spawn_opts = { + args = args, + cwd = p, + stdio = { nil, stdout, stderr }, + } + + local result = {} + + local handle, pid + handle, pid = uv.spawn( + bin, + spawn_opts, + vim.schedule_wrap(function(exit_code, signal) + stdout:read_stop() + stderr:read_stop() + stdout:close() + stderr:close() + handle:close() + callback(result, exit_code, signal) + end) + ) + + if handle == nil then + error(("Failed to spawn process: cmd = %s, error = %s"):format(bin, pid)) + end + + local function on_read(err, data) + if err then + error(err) + end + if data then + table.insert(result, data) + end + end + + stderr:read_start(on_read) + stdout:read_start(on_read) +end diff --git a/lua/kide/plugins/init.lua b/lua/kide/plugins/init.lua index a7d044ac..5efb81c1 100644 --- a/lua/kide/plugins/init.lua +++ b/lua/kide/plugins/init.lua @@ -540,7 +540,15 @@ require("packer").startup({ }) end, }) - + -- pandoc 命令插件(用于md转pdf) + use({ + "aspeddro/pandoc.nvim", + opt = true, + ft = "markdown", + config = function() + require("kide.plugins.config.pandoc") + end, + }) -- 格式化插件 -> 使用 null-ls -- use 'mhartington/formatter.nvim' -- use 'sbdchd/neoformat' From c39216643304fd8e0e8d457d69b28a8924ad8ab3 Mon Sep 17 00:00:00 2001 From: luokai Date: Sat, 26 Nov 2022 22:03:33 +0800 Subject: [PATCH 0527/1278] font --- lua/kide/core/utils/init.lua | 4 ++++ lua/kide/plugins/config/pandoc.lua | 11 ++++++++++- 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/lua/kide/core/utils/init.lua b/lua/kide/core/utils/init.lua index cf5e9fb5..3ce77c70 100644 --- a/lua/kide/core/utils/init.lua +++ b/lua/kide/core/utils/init.lua @@ -193,6 +193,10 @@ M.os_type = function() return t end +M.is_win = M.os_type() == M.Windows +M.is_linux = M.os_type() == M.Linux +M.is_mac = M.os_type() == M.Mac + --- complete ---@param complete {} ---@param opt {multiple:false, multiple_repeated:false, single:false} diff --git a/lua/kide/plugins/config/pandoc.lua b/lua/kide/plugins/config/pandoc.lua index e2c2f093..cf4dcedf 100644 --- a/lua/kide/plugins/config/pandoc.lua +++ b/lua/kide/plugins/config/pandoc.lua @@ -1,9 +1,18 @@ +local utils = require("kide.core.utils") require("pandoc").setup({ commands = { enable = false, }, }) +local cjk_mainfont = function() + if utils.is_win then + return "Microsoft YaHei UI" + else + return "Yuanti SC" + end +end + -- pandoc --pdf-engine=xelatex --highlight-style tango -N --toc -V CJKmainfont="Yuanti SC" -V mainfont="Hack" -V geometry:"top=2cm, bottom=1.5cm, left=2cm, right=2cm" test.md -o out.pdf local function markdown_to_pdf() local group = vim.api.nvim_create_augroup("kide_utils_pandoc", { clear = true }) @@ -18,7 +27,7 @@ local function markdown_to_pdf() { "--highlight-style", "tango" }, { "--number-sections" }, { "--toc" }, - { "--variable", "CJKmainfont=Yuanti SC" }, + { "--variable", "CJKmainfont=" .. cjk_mainfont() }, { "--variable", "mainfont=Hack" }, { "--variable", "geometry:top=2cm, bottom=1.5cm, left=2cm, right=2cm" }, }) From d174303e91c2f62fb39907740771dd3026220c0d Mon Sep 17 00:00:00 2001 From: luokai Date: Wed, 30 Nov 2022 10:28:31 +0800 Subject: [PATCH 0528/1278] semgrep --- lua/kide/plugins/config/null-ls.lua | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/lua/kide/plugins/config/null-ls.lua b/lua/kide/plugins/config/null-ls.lua index ce276014..2996e6a3 100644 --- a/lua/kide/plugins/config/null-ls.lua +++ b/lua/kide/plugins/config/null-ls.lua @@ -108,6 +108,16 @@ local on_attach = function(client, bufnr) end end +if "1" == os.getenv("SEMGREP_ENABLE") then + table.insert( + sources, + null_ls.builtins.diagnostics.semgrep.with({ + filetypes = { "java" }, + extra_args = { "--config", os.getenv("SEMGREP_RULES_PATH") .. "/java" }, + }) + ) +end + null_ls.setup({ sources = sources, on_attach = function(client, bufnr) From 7ace430e96284a77c80c22cb7ede5bfda1917a24 Mon Sep 17 00:00:00 2001 From: luokai Date: Thu, 1 Dec 2022 22:10:40 +0800 Subject: [PATCH 0529/1278] rust --- lua/kide/lsp/rust_analyzer.lua | 49 +++++++++++++++++++++++++++++++--- 1 file changed, 45 insertions(+), 4 deletions(-) diff --git a/lua/kide/lsp/rust_analyzer.lua b/lua/kide/lsp/rust_analyzer.lua index 2d3eb4b5..7d5519d0 100644 --- a/lua/kide/lsp/rust_analyzer.lua +++ b/lua/kide/lsp/rust_analyzer.lua @@ -1,13 +1,54 @@ +local vscode = require("kide.core.vscode") +local utils = require("kide.core.utils") -- Update this path -local extension_path = "/Users/kailuo/.vscode/extensions/vadimcn.vscode-lldb-1.7.0/" -local codelldb_path = extension_path .. "adapter/codelldb" -local liblldb_path = extension_path .. "lldb/lib/liblldb.dylib" +local extension_path = vscode.find_one("/vadimcn.vscode-lldb-*") +local codelldb_path = (function() + if not extension_path then + return nil + end + if utils.is_win then + return extension_path .. "adapter\\codelldb.exe" + else + return extension_path .. "adapter/codelldb" + end +end)() +local liblldb_path = (function() + if not extension_path then + return nil + end + if utils.is_mac then + return extension_path .. "lldb/lib/liblldb.dylib" + elseif utils.is_win then + return extension_path .. "lldb\\lib\\liblldb.dll" + else + return extension_path .. "lldb/lib/liblldb.so" + end +end)() +local adapter = function() + if codelldb_path and liblldb_path then + print(codelldb_path) + return require("rust-tools.dap").get_codelldb_adapter(codelldb_path, liblldb_path) + end +end +local rt = require("rust-tools") return { dap = { - adapter = require("rust-tools.dap").get_codelldb_adapter(codelldb_path, liblldb_path), + adapter = adapter(), + }, + tools = { + inlay_hints = { + parameter_hints_prefix = " ", + other_hints_prefix = " ", + }, }, server = { + on_attach = function(_, bufnr) + -- Hover actions + vim.keymap.set("n", "ha", rt.hover_actions.hover_actions, { buffer = bufnr }) + -- Code action groups + vim.keymap.set("n", "ca", rt.code_action_group.code_action_group, { buffer = bufnr }) + end, standalone = false, settings = { ["rust-analyzer"] = { From a729a1b6162f1e687c7ea4fc38cd110ac448eef4 Mon Sep 17 00:00:00 2001 From: luokai Date: Thu, 1 Dec 2022 22:17:56 +0800 Subject: [PATCH 0530/1278] rust debug --- lua/kide/lsp/rust_analyzer.lua | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/lua/kide/lsp/rust_analyzer.lua b/lua/kide/lsp/rust_analyzer.lua index 7d5519d0..80edf3da 100644 --- a/lua/kide/lsp/rust_analyzer.lua +++ b/lua/kide/lsp/rust_analyzer.lua @@ -7,9 +7,9 @@ local codelldb_path = (function() return nil end if utils.is_win then - return extension_path .. "adapter\\codelldb.exe" + return vim.fn.glob(extension_path .. "/adapter/codelldb.exe") else - return extension_path .. "adapter/codelldb" + return vim.fn.glob(extension_path .. "/adapter/codelldb") end end)() local liblldb_path = (function() @@ -17,17 +17,16 @@ local liblldb_path = (function() return nil end if utils.is_mac then - return extension_path .. "lldb/lib/liblldb.dylib" + return vim.fn.glob(extension_path .. "/lldb/lib/liblldb.dylib") elseif utils.is_win then - return extension_path .. "lldb\\lib\\liblldb.dll" + return vim.fn.glob(extension_path .. "/lldb\\lib\\liblldb.dll") else - return extension_path .. "lldb/lib/liblldb.so" + return vim.fn.glob(extension_path .. "/lldb/lib/liblldb.so") end end)() local adapter = function() if codelldb_path and liblldb_path then - print(codelldb_path) return require("rust-tools.dap").get_codelldb_adapter(codelldb_path, liblldb_path) end end From 6d5f4e741315f2b8cf1689315db60073321897a7 Mon Sep 17 00:00:00 2001 From: luokai Date: Thu, 1 Dec 2022 22:25:23 +0800 Subject: [PATCH 0531/1278] win rust debug --- lua/kide/lsp/rust_analyzer.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lua/kide/lsp/rust_analyzer.lua b/lua/kide/lsp/rust_analyzer.lua index 80edf3da..77212392 100644 --- a/lua/kide/lsp/rust_analyzer.lua +++ b/lua/kide/lsp/rust_analyzer.lua @@ -19,7 +19,7 @@ local liblldb_path = (function() if utils.is_mac then return vim.fn.glob(extension_path .. "/lldb/lib/liblldb.dylib") elseif utils.is_win then - return vim.fn.glob(extension_path .. "/lldb\\lib\\liblldb.dll") + return vim.fn.glob(extension_path .. "/lldb/lib/liblldb.lib") else return vim.fn.glob(extension_path .. "/lldb/lib/liblldb.so") end From 9ee8500cc90c56f557019613381160d8e7af93a1 Mon Sep 17 00:00:00 2001 From: luokai Date: Thu, 1 Dec 2022 22:31:02 +0800 Subject: [PATCH 0532/1278] update --- lua/kide/lsp/rust_analyzer.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lua/kide/lsp/rust_analyzer.lua b/lua/kide/lsp/rust_analyzer.lua index 77212392..0b256855 100644 --- a/lua/kide/lsp/rust_analyzer.lua +++ b/lua/kide/lsp/rust_analyzer.lua @@ -19,7 +19,7 @@ local liblldb_path = (function() if utils.is_mac then return vim.fn.glob(extension_path .. "/lldb/lib/liblldb.dylib") elseif utils.is_win then - return vim.fn.glob(extension_path .. "/lldb/lib/liblldb.lib") + return vim.fn.glob(extension_path .. "/lldb/bin/liblldb.dll") else return vim.fn.glob(extension_path .. "/lldb/lib/liblldb.so") end From 963a6340055f451b1c2f319bfdb20ae6e5b437d7 Mon Sep 17 00:00:00 2001 From: luokai Date: Thu, 1 Dec 2022 22:37:28 +0800 Subject: [PATCH 0533/1278] codelldb --- lua/kide/dap/codelldb.lua | 30 ++++++++++++++++++++++++++---- lua/kide/lsp/rust_analyzer.lua | 32 +++----------------------------- 2 files changed, 29 insertions(+), 33 deletions(-) diff --git a/lua/kide/dap/codelldb.lua b/lua/kide/dap/codelldb.lua index 104b5943..ad8f25c8 100644 --- a/lua/kide/dap/codelldb.lua +++ b/lua/kide/dap/codelldb.lua @@ -1,15 +1,37 @@ local M = {} local vscode = require("kide.core.vscode") -local extension_path = vscode.find_one("/vadimcn.vscode-lldb-*") +local utils = require("kide.core.utils") +-- Update this path +M.extension_path = vscode.find_one("/vadimcn.vscode-lldb-*") +M.codelldb_path = (function() + if M.extension_path then + if utils.is_win then + return vim.fn.glob(M.extension_path .. "/adapter/codelldb.exe") + else + return vim.fn.glob(M.extension_path .. "/adapter/codelldb") + end + end +end)() +M.liblldb_path = (function() + if M.extension_path then + if utils.is_mac then + return vim.fn.glob(M.extension_path .. "/lldb/lib/liblldb.dylib") + elseif utils.is_win then + return vim.fn.glob(M.extension_path .. "/lldb/bin/liblldb.dll") + else + return vim.fn.glob(M.extension_path .. "/lldb/lib/liblldb.so") + end + end +end)() M.config = {} M.setup = function(config) - if not extension_path then + if not M.extension_path then vim.notify("codelldb not found", vim.log.levels.WARN) return false end - M.config.codelldb_path = extension_path .. "/adapter/codelldb" + M.config.codelldb_path = M.codelldb_path -- M.config.liblldb_path = extension_path .. "/lldb/lib/liblldb.dylib" if config then M.config = vim.tbl_deep_extend("force", M.config, config) @@ -28,7 +50,7 @@ M.setup = function(config) local stderr = vim.loop.new_pipe(false) local opts = { stdio = { nil, stdout, stderr }, - args = { "--port", tostring(port) }, + args = { "--liblldb", M.liblldb_path, "--port", tostring(port) }, } local handle local pid_or_err diff --git a/lua/kide/lsp/rust_analyzer.lua b/lua/kide/lsp/rust_analyzer.lua index 0b256855..5935a275 100644 --- a/lua/kide/lsp/rust_analyzer.lua +++ b/lua/kide/lsp/rust_analyzer.lua @@ -1,33 +1,7 @@ -local vscode = require("kide.core.vscode") -local utils = require("kide.core.utils") --- Update this path -local extension_path = vscode.find_one("/vadimcn.vscode-lldb-*") -local codelldb_path = (function() - if not extension_path then - return nil - end - if utils.is_win then - return vim.fn.glob(extension_path .. "/adapter/codelldb.exe") - else - return vim.fn.glob(extension_path .. "/adapter/codelldb") - end -end)() -local liblldb_path = (function() - if not extension_path then - return nil - end - if utils.is_mac then - return vim.fn.glob(extension_path .. "/lldb/lib/liblldb.dylib") - elseif utils.is_win then - return vim.fn.glob(extension_path .. "/lldb/bin/liblldb.dll") - else - return vim.fn.glob(extension_path .. "/lldb/lib/liblldb.so") - end -end)() - +local codelldb = require("kide.dap.codelldb") local adapter = function() - if codelldb_path and liblldb_path then - return require("rust-tools.dap").get_codelldb_adapter(codelldb_path, liblldb_path) + if codelldb.extension_path then + return require("rust-tools.dap").get_codelldb_adapter(codelldb.codelldb_path, codelldb.liblldb_path) end end local rt = require("rust-tools") From 8e8738f69ecee5e942aaeb339eb1d16fbee29d60 Mon Sep 17 00:00:00 2001 From: luokai Date: Thu, 1 Dec 2022 22:54:05 +0800 Subject: [PATCH 0534/1278] dapui --- lua/kide/plugins/config/nvim-dap.lua | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/lua/kide/plugins/config/nvim-dap.lua b/lua/kide/plugins/config/nvim-dap.lua index 6e27c158..f0759928 100644 --- a/lua/kide/plugins/config/nvim-dap.lua +++ b/lua/kide/plugins/config/nvim-dap.lua @@ -48,5 +48,15 @@ vim.fn.sign_define("DapBreakpoint", { text = "", texthl = "Debug", linehl = " -- vim.fn.sign_define('DapLogPoint', {text='L', texthl='', linehl='', numhl=''}) -- vim.fn.sign_define('DapStopped', {text='→', texthl='', linehl='debugPC', numhl=''}) +vim.api.nvim_create_user_command("DapUiOpen", function() + require("dapui").open({}) +end, {}) +vim.api.nvim_create_user_command("DapUiClose", function() + require("dapui").close({}) +end, {}) +vim.api.nvim_create_user_command("DapUiToggle", function() + require("dapui").toggle({}) +end, {}) + require("nvim-dap-virtual-text").setup({}) require("telescope").load_extension("dap") From fd6c570fa6d0098597f702cd56b672aed99a3a9e Mon Sep 17 00:00:00 2001 From: luokai Date: Thu, 1 Dec 2022 23:08:24 +0800 Subject: [PATCH 0535/1278] dapui --- lua/kide/plugins/config/nvim-dap.lua | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lua/kide/plugins/config/nvim-dap.lua b/lua/kide/plugins/config/nvim-dap.lua index f0759928..85cf88da 100644 --- a/lua/kide/plugins/config/nvim-dap.lua +++ b/lua/kide/plugins/config/nvim-dap.lua @@ -7,6 +7,7 @@ local dap = require("dap") -- } local dapui = require("dapui") dapui.setup({ + icons = { expanded = "", collapsed = "", current_frame = "" }, layouts = { { elements = { @@ -23,7 +24,7 @@ dapui.setup({ "repl", -- 'console', }, - size = 12, + size = 0.25, position = "bottom", }, }, From 743f43d2525757d998f9a471d9382c18e19c1dc3 Mon Sep 17 00:00:00 2001 From: luokai Date: Thu, 8 Dec 2022 10:57:29 +0800 Subject: [PATCH 0536/1278] packer_bootstrap --- lua/packer_bootstrap.lua | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lua/packer_bootstrap.lua b/lua/packer_bootstrap.lua index 4ef6ebb1..60d869e5 100644 --- a/lua/packer_bootstrap.lua +++ b/lua/packer_bootstrap.lua @@ -1,9 +1,8 @@ local fn = vim.fn local install_path = fn.stdpath("data") .. "/site/pack/packer/start/packer.nvim" -local packer_bootstrap = false if fn.empty(fn.glob(install_path)) > 0 then vim.notify(install_path, vim.log.levels.INFO) - packer_bootstrap = fn.system({ + fn.system({ "git", "clone", "--depth", @@ -11,5 +10,6 @@ if fn.empty(fn.glob(install_path)) > 0 then "https://github.com/wbthomason/packer.nvim", install_path, }) + return true end -return packer_bootstrap +return false From cceaf4b9663755bb118fb430310542047fc6e288 Mon Sep 17 00:00:00 2001 From: luokai Date: Fri, 9 Dec 2022 10:12:21 +0800 Subject: [PATCH 0537/1278] =?UTF-8?q?=E7=A6=81=E7=94=A8=20netrw?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lua/kide/core/basic.lua | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/lua/kide/core/basic.lua b/lua/kide/core/basic.lua index 015e2b21..d199c47e 100644 --- a/lua/kide/core/basic.lua +++ b/lua/kide/core/basic.lua @@ -3,6 +3,10 @@ vim.opt.title = true vim.opt.clipboard = "unnamedplus" +-- 禁用 netrw +vim.g.loaded_netrw = 1 +vim.g.loaded_netrwPlugin = 1 + if vim.fn.has("wsl") == 1 then vim.g.clipboard = { name = "win32yank-wsl", From 48eef768967fcaf77a320b632b5b978f9c474a9d Mon Sep 17 00:00:00 2001 From: luokai Date: Fri, 9 Dec 2022 10:34:25 +0800 Subject: [PATCH 0538/1278] =?UTF-8?q?=E9=87=8D=E5=91=BD=E5=90=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lua/kide/lsp/java.lua | 6 +++--- lua/kide/plugins/init.lua | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/lua/kide/lsp/java.lua b/lua/kide/lsp/java.lua index 7a8a6269..8cd7a885 100644 --- a/lua/kide/lsp/java.lua +++ b/lua/kide/lsp/java.lua @@ -481,11 +481,11 @@ source.resolve = function(self, completion_item, callback) end) end -M.setup = function() +M.start = function() jdtls.start_or_attach(config) end -M.init = function() +M.setup = function() vim.g.jdtls_dap_main_class_config_init = true -- au BufReadCmd jdt://* lua require('jdtls').open_jdt_link(vim.fn.expand('')) -- command! JdtWipeDataAndRestart lua require('jdtls.setup').wipe_data_and_restart() @@ -511,7 +511,7 @@ M.init = function() if e.file == "java" then -- ignore else - M.setup() + M.start() end end, }) diff --git a/lua/kide/plugins/init.lua b/lua/kide/plugins/init.lua index 5efb81c1..4918aa7f 100644 --- a/lua/kide/plugins/init.lua +++ b/lua/kide/plugins/init.lua @@ -219,7 +219,7 @@ require("packer").startup({ vim.g.nvim_jdtls = 1 end, config = function() - require("kide.lsp.java").init() + require("kide.lsp.java").setup() end, }) -- use 'NiYanhhhhh/lighttree-java' From 846eadc069391415d4c955e6c5f0b1e537a06f9f Mon Sep 17 00:00:00 2001 From: luokai Date: Fri, 9 Dec 2022 17:42:35 +0800 Subject: [PATCH 0539/1278] untracked --- lua/kide/plugins/config/gitsigns-nvim.lua | 1 + 1 file changed, 1 insertion(+) diff --git a/lua/kide/plugins/config/gitsigns-nvim.lua b/lua/kide/plugins/config/gitsigns-nvim.lua index 96c5bd48..78687bc5 100644 --- a/lua/kide/plugins/config/gitsigns-nvim.lua +++ b/lua/kide/plugins/config/gitsigns-nvim.lua @@ -5,6 +5,7 @@ require("gitsigns").setup({ delete = { hl = "DiffDelete", text = "", numhl = "GitSignsDeleteNr" }, topdelete = { hl = "DiffDelete", text = "‾", numhl = "GitSignsDeleteNr" }, changedelete = { hl = "DiffChangeDelete", text = "~", numhl = "GitSignsChangeNr" }, + untracked = { hl = "GitSignsAdd", text = "│", numhl = "GitSignsAddNr", linehl = "GitSignsAddLn" }, }, signcolumn = true, -- Toggle with `:Gitsigns toggle_signs` numhl = false, -- Toggle with `:Gitsigns toggle_numhl` From 55b10ebbc17472a85c92154e9dbd84c814b99456 Mon Sep 17 00:00:00 2001 From: luokai Date: Fri, 9 Dec 2022 21:27:54 +0800 Subject: [PATCH 0540/1278] ExecutionEnvironment --- lua/kide/lsp/java.lua | 77 +++++++++++++++++++++++++++++-------------- 1 file changed, 53 insertions(+), 24 deletions(-) diff --git a/lua/kide/lsp/java.lua b/lua/kide/lsp/java.lua index 8cd7a885..d1d4bd3b 100644 --- a/lua/kide/lsp/java.lua +++ b/lua/kide/lsp/java.lua @@ -21,6 +21,12 @@ end local function get_java_ver_home(v, dv) return os.getenv("JAVA_" .. v .. "_HOME") or dv end +local function get_java_ver_sources(v, dv) + return os.getenv("JAVA_" .. v .. "_SOURCES") or dv +end +local function get_java_ver_doc(v, dv) + return os.getenv("JAVA_" .. v .. "_DOC") or dv +end local function get_java() return or_default(env.JDTLS_RUN_JAVA, get_java_home() .. "/bin/java") @@ -40,42 +46,65 @@ local function get_jol_jar() end local _config = (function() - if cutils.os_type() == cutils.Windows then + if cutils.is_win then return "config_win" - elseif cutils.os_type() == cutils.Mac then + elseif cutils.is_mac then return "config_mac" else return "config_linux" end end)() +-- see https://github.com/eclipse/eclipse.jdt.ls/wiki/Running-the-JAVA-LS-server-from-the-command-line#initialize-request +local ExecutionEnvironment = { + J2SE_1_5 = "J2SE-1.5", + JavaSE_1_6 = "JavaSE-1.6", + JavaSE_1_7 = "JavaSE-1.7", + JavaSE_1_8 = "JavaSE-1.8", + JavaSE_9 = "JavaSE-9", + JavaSE_10 = "JavaSE-10", + JavaSE_11 = "JavaSE-11", + JavaSE_12 = "JavaSE-12", + JavaSE_13 = "JavaSE-13", + JavaSE_14 = "JavaSE-14", + JavaSE_15 = "JavaSE-15", + JavaSE_16 = "JavaSE-16", + JavaSE_17 = "JavaSE-17", + JavaSE_18 = "JavaSE-18", + JavaSE_19 = "JavaSE-19", +} + +local function fglob(path) + if path == "" then + return nil + end + return path +end + local runtimes = (function() local result = {} - for _, value in ipairs({ - { - name = "JavaSE-1.8", - version = "8", - default = true, - }, - { - name = "JavaSE-11", - version = "11", - }, - { - name = "JavaSE-17", - version = "17", - }, - { - name = "JavaSE-19", - version = "19", - }, - }) do - local java_home = get_java_ver_home(value.version) + for _, value in pairs(ExecutionEnvironment) do + local version = vim.fn.split(value, "-")[2] + if string.match(version, "%.") then + version = vim.split(version, "%.")[2] + end + local java_home = get_java_ver_home(version) + local default_jdk = false if java_home then + local java_sources = get_java_ver_sources( + version, + fglob(vim.fn.glob(java_home .. "/src.zip")) or fglob(vim.fn.glob(java_home .. "/lib/src.zip")) + ) + local javadoc = get_java_ver_doc(version, fglob(vim.fn.glob(java_home .. "/docs"))) + if ExecutionEnvironment.JavaSE_1_8 == value then + default_jdk = true + end table.insert(result, { - name = value.name, + name = value, path = java_home, - default = value.default, + sources = java_sources, + javadoc = javadoc, + default = default_jdk, }) end end From cc0f4691d6d37cfd57a74cd10cb473bfad394526 Mon Sep 17 00:00:00 2001 From: luokai Date: Fri, 9 Dec 2022 21:42:23 +0800 Subject: [PATCH 0541/1278] remove javadoc --- lua/kide/lsp/java.lua | 2 -- 1 file changed, 2 deletions(-) diff --git a/lua/kide/lsp/java.lua b/lua/kide/lsp/java.lua index d1d4bd3b..fe9c66cf 100644 --- a/lua/kide/lsp/java.lua +++ b/lua/kide/lsp/java.lua @@ -95,7 +95,6 @@ local runtimes = (function() version, fglob(vim.fn.glob(java_home .. "/src.zip")) or fglob(vim.fn.glob(java_home .. "/lib/src.zip")) ) - local javadoc = get_java_ver_doc(version, fglob(vim.fn.glob(java_home .. "/docs"))) if ExecutionEnvironment.JavaSE_1_8 == value then default_jdk = true end @@ -103,7 +102,6 @@ local runtimes = (function() name = value, path = java_home, sources = java_sources, - javadoc = javadoc, default = default_jdk, }) end From ea86dc9a973d836e48877bac657e28eaceb52e85 Mon Sep 17 00:00:00 2001 From: luokai Date: Sun, 11 Dec 2022 10:52:18 +0800 Subject: [PATCH 0542/1278] clean jdtls --- lua/kide/core/init.lua | 1 + lua/kide/core/utils/jdtls.lua | 32 ++++++++++++++++++++++++++++++++ 2 files changed, 33 insertions(+) create mode 100644 lua/kide/core/utils/jdtls.lua diff --git a/lua/kide/core/init.lua b/lua/kide/core/init.lua index 0b665159..45806a9c 100644 --- a/lua/kide/core/init.lua +++ b/lua/kide/core/init.lua @@ -3,4 +3,5 @@ require("kide.core.basic") vim.schedule(function() require("kide.core.utils.plantuml").setup() require("kide.core.utils.maven").setup() + require("kide.core.utils.jdtls").setup() end) diff --git a/lua/kide/core/utils/jdtls.lua b/lua/kide/core/utils/jdtls.lua new file mode 100644 index 00000000..485b29c6 --- /dev/null +++ b/lua/kide/core/utils/jdtls.lua @@ -0,0 +1,32 @@ +local M = {} + +local function delete_file(hf) + local files = vim.fn.system("fd -I -H " .. hf .. "$") + if files and files ~= "" then + for file in string.gmatch(files, "[^\r\n]+") do + vim.fn.system("rm -rf " .. file) + end + return files + end +end + +-- fd -I -H settings$ | xargs rm -rf +-- fd -I -H classpath$ | xargs rm -rf +-- fd -I -H project$ | xargs rm -rf +-- fd -I -H factorypath$ | xargs rm -rf +local function clean_jdtls() + local del_files = delete_file("settings") or "" + del_files = del_files .. (delete_file("classpath") or "") + del_files = del_files .. (delete_file("project") or "") + del_files = del_files .. (delete_file("factorypath") or "") + vim.notify("delete: \n" .. del_files, vim.log.levels.INFO) +end + +M.setup = function() + vim.api.nvim_create_user_command("CleanJdtls", function() + clean_jdtls() + end, { + nargs = 0, + }) +end +return M From 124bb40aa294dcf79e514950628e5302622a4157 Mon Sep 17 00:00:00 2001 From: luokai Date: Sun, 11 Dec 2022 10:55:07 +0800 Subject: [PATCH 0543/1278] =?UTF-8?q?=E5=8F=AA=E6=9C=89=20linux=20mac=20?= =?UTF-8?q?=E6=9C=89=20rm=20=E5=91=BD=E4=BB=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lua/kide/core/utils/jdtls.lua | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/lua/kide/core/utils/jdtls.lua b/lua/kide/core/utils/jdtls.lua index 485b29c6..4155400a 100644 --- a/lua/kide/core/utils/jdtls.lua +++ b/lua/kide/core/utils/jdtls.lua @@ -1,3 +1,4 @@ +local utils = require("kide.core.utils") local M = {} local function delete_file(hf) @@ -23,10 +24,12 @@ local function clean_jdtls() end M.setup = function() - vim.api.nvim_create_user_command("CleanJdtls", function() - clean_jdtls() - end, { - nargs = 0, - }) + if utils.is_mac or utils.is_linux then + vim.api.nvim_create_user_command("CleanJdtls", function() + clean_jdtls() + end, { + nargs = 0, + }) + end end return M From 86c86b6ea0ef8a2df7618ec8c5e90c6750a39f16 Mon Sep 17 00:00:00 2001 From: luokai Date: Sun, 11 Dec 2022 21:28:22 +0800 Subject: [PATCH 0544/1278] linux --- lua/kide/plugins/config/pandoc.lua | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lua/kide/plugins/config/pandoc.lua b/lua/kide/plugins/config/pandoc.lua index cf4dcedf..d613b2ff 100644 --- a/lua/kide/plugins/config/pandoc.lua +++ b/lua/kide/plugins/config/pandoc.lua @@ -8,6 +8,8 @@ require("pandoc").setup({ local cjk_mainfont = function() if utils.is_win then return "Microsoft YaHei UI" + elseif utils.is_linux then + return "Noto Sans CJK SC" else return "Yuanti SC" end From 3fc8cbf7a6e49d03feccfaeb256dcbbc2bcfae47 Mon Sep 17 00:00:00 2001 From: luokai Date: Tue, 13 Dec 2022 20:19:22 +0800 Subject: [PATCH 0545/1278] update --- lua/kide/plugins/config/gruvbox.lua | 5 ----- lua/kide/plugins/config/nvim-notify.lua | 6 ++++-- lua/kide/plugins/init.lua | 5 +---- 3 files changed, 5 insertions(+), 11 deletions(-) diff --git a/lua/kide/plugins/config/gruvbox.lua b/lua/kide/plugins/config/gruvbox.lua index cf2d7bc9..c1864f18 100644 --- a/lua/kide/plugins/config/gruvbox.lua +++ b/lua/kide/plugins/config/gruvbox.lua @@ -1,13 +1,8 @@ -- setup must be called before loading the colorscheme -- Default options: -local colors = require("gruvbox.palette") local kgrubox = require("kide.theme.gruvbox") local overrides = { - - NvimTreeFolderIcon = { - fg = colors.bright_green, - }, NormalFloat = { bg = kgrubox.colors.black3, }, diff --git a/lua/kide/plugins/config/nvim-notify.lua b/lua/kide/plugins/config/nvim-notify.lua index 6e4aef70..c99cfd56 100644 --- a/lua/kide/plugins/config/nvim-notify.lua +++ b/lua/kide/plugins/config/nvim-notify.lua @@ -1,5 +1,5 @@ -vim.notify = require("notify") -vim.notify.setup({ +local notify = require("notify") +notify.setup({ -- Animation style (see below for details) stages = "fade_in_slide_out", @@ -31,3 +31,5 @@ vim.notify.setup({ TRACE = "✎", }, }) + +vim.notify = notify diff --git a/lua/kide/plugins/init.lua b/lua/kide/plugins/init.lua index 4918aa7f..7800f8ca 100644 --- a/lua/kide/plugins/init.lua +++ b/lua/kide/plugins/init.lua @@ -149,11 +149,8 @@ require("packer").startup({ requires = { "kyazdani42/nvim-web-devicons", -- optional, for file icon }, - opt = true, tag = "nightly", - wants = "gruvbox.nvim", - after = "gruvbox.nvim", setup = function() require("kide.core.layz_load").async_load("nvim-tree.lua") end, @@ -469,7 +466,7 @@ require("packer").startup({ "rcarriga/nvim-notify", opt = true, setup = function() - require("kide.core.layz_load").sync_load("nvim-notify") + require("kide.core.layz_load").async_load("nvim-notify") end, config = function() require("kide.plugins.config.nvim-notify") From ee8d38fa95a26b0b02c90885d6b38394edb6c677 Mon Sep 17 00:00:00 2001 From: luokai Date: Thu, 15 Dec 2022 10:11:49 +0800 Subject: [PATCH 0546/1278] =?UTF-8?q?=E5=BB=B6=E8=BF=9F=E5=8A=A0=E8=BD=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lua/kide/core/keybindings.lua | 7 +++++-- lua/kide/plugins/config/nvim-tree.lua | 3 +++ 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/lua/kide/core/keybindings.lua b/lua/kide/core/keybindings.lua index ded6a662..c1bb3c08 100644 --- a/lua/kide/core/keybindings.lua +++ b/lua/kide/core/keybindings.lua @@ -10,8 +10,6 @@ local M = {} M.setup = function() -- Esc -- map('i', 'jk', '', opt) - -- nvimTree - map("n", "e", ":NvimTreeToggle", opt) -- n 模式下复制内容到系统剪切板 map("n", "c", '"+yy', opt) -- v 模式下复制内容到系统剪切板 @@ -333,4 +331,9 @@ M.ufo_mapkey = function() vim.keymap.set("n", "zR", require("ufo").openAllFolds) vim.keymap.set("n", "zM", require("ufo").closeAllFolds) end + +M.nvim_tree = function() + -- nvimTree + map("n", "e", ":NvimTreeToggle", opt) +end return M diff --git a/lua/kide/plugins/config/nvim-tree.lua b/lua/kide/plugins/config/nvim-tree.lua index 6e0e98d5..c8f72259 100644 --- a/lua/kide/plugins/config/nvim-tree.lua +++ b/lua/kide/plugins/config/nvim-tree.lua @@ -105,3 +105,6 @@ require("nvim-tree").setup({ -- symlink_open = "", -- }, -- } + +-- nvimTree +require("kide.core.keybindings").nvim_tree() From 9a170ed39a3a88db2a714067554914578bf3bf98 Mon Sep 17 00:00:00 2001 From: luokai Date: Mon, 19 Dec 2022 09:24:28 +0800 Subject: [PATCH 0547/1278] completeopt --- lua/kide/core/basic.lua | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lua/kide/core/basic.lua b/lua/kide/core/basic.lua index d199c47e..7a54eec0 100644 --- a/lua/kide/core/basic.lua +++ b/lua/kide/core/basic.lua @@ -140,6 +140,8 @@ vim.o.foldlevel = 99 -- Using ufo provider need a large value, feel free to decr vim.o.foldlevelstart = 99 vim.cmd([[ +set completeopt=menu,menuone,noselect + if exists('g:neovide') " let g:neovide_refresh_rate=60 let g:neovide_cursor_vfx_mode = "railgun" From 30ca8d41b24536dd76604a38f26b8b1a0ad1db1e Mon Sep 17 00:00:00 2001 From: luokai Date: Mon, 19 Dec 2022 12:31:07 +0800 Subject: [PATCH 0548/1278] chatgpt --- lua/kide/plugins/init.lua | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/lua/kide/plugins/init.lua b/lua/kide/plugins/init.lua index 7800f8ca..43c96e68 100644 --- a/lua/kide/plugins/init.lua +++ b/lua/kide/plugins/init.lua @@ -864,6 +864,32 @@ require("packer").startup({ end, }) + -- ui + use({ + "MunifTanjim/nui.nvim", + opt = true, + module = "nui", + }) + + -- chatgpt + use({ + "jackMort/ChatGPT.nvim", + opt = true, + cmd = { + "ChatGPT", + }, + config = function() + require("chatgpt").setup({ + -- optional configuration + }) + end, + requires = { + "MunifTanjim/nui.nvim", + "nvim-lua/plenary.nvim", + "nvim-telescope/telescope.nvim", + }, + }) + if bootstrap then require("packer").sync() end From 36a3246a9769e4b978978ce17d384edd6989320e Mon Sep 17 00:00:00 2001 From: luokai Date: Fri, 23 Dec 2022 11:47:53 +0800 Subject: [PATCH 0549/1278] clean --- lua/kide/core/utils/maven.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lua/kide/core/utils/maven.lua b/lua/kide/core/utils/maven.lua index b6871acb..54b02fa8 100644 --- a/lua/kide/core/utils/maven.lua +++ b/lua/kide/core/utils/maven.lua @@ -45,7 +45,7 @@ end local maven_args_complete = utils.command_args_complete M.maven_command = function(buf) - create_command(buf, "MavenCompile", "mvn compile", maven_args_complete({ "test-compile" }, { multiple = true })) + create_command(buf, "MavenCompile", "mvn clean compile", maven_args_complete({ "test-compile" }, { multiple = true })) create_command( buf, "MavenInstll", From b2f6131afc3617d924621028c9553201347b4daa Mon Sep 17 00:00:00 2001 From: luokai Date: Fri, 30 Dec 2022 10:22:32 +0800 Subject: [PATCH 0550/1278] =?UTF-8?q?=E5=8A=9F=E8=83=BD=E6=8E=A9=E9=A5=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 70 ++++++++++++++++++++++++++++++++++++++----------------- 1 file changed, 49 insertions(+), 21 deletions(-) diff --git a/README.md b/README.md index c50157e0..47d6a4b5 100644 --- a/README.md +++ b/README.md @@ -13,7 +13,6 @@ cd ~/.config git clone https://github.com/JavaHello/nvim.git ``` - ### Windows ```sh @@ -63,26 +62,55 @@ git clone https://github.com/JavaHello/nvim.git ### 功能演示 -- 启动页 - ![home](https://javahello.github.io/dev/nvim-lean/images/home.png) -- 查找文件 - ![find-file](https://javahello.github.io/dev/nvim-lean/images/telescope-theme-1.png) -- 全局搜索 - ![find-word](https://javahello.github.io/dev/nvim-lean/images/find-word.gif) -- 全局搜索替换 - ![fr](https://javahello.github.io/dev/nvim-lean/images/fr.gif) -- 文件管理 - ![file-tree](https://javahello.github.io/dev/nvim-lean/images/file-tree.gif) -- 大纲 - ![Outline](https://javahello.github.io/dev/nvim-lean/images/outline.gif) -- 查看引用 - ![001](https://javahello.github.io/dev/nvim-lean/images/java-ref-001.gif) -- 查看实现 - ![002](https://javahello.github.io/dev/nvim-lean/images/java-impl-002.gif) -- 搜索`class`,`method`,`field`等 - ![003](https://javahello.github.io/dev/nvim-lean/images/java-symbols-003.gif) -- Debug - ![Debug001](https://javahello.github.io/dev/nvim-lean/images/debug.gif) +
+启动页 + 启动页 +
+ +
+查找文件 + 查找文件 +
+ +
+全局搜索 + 全局搜索 +
+ +
+全局搜索替换 + 全局搜索替换 +
+ +
+文件管理 + 文件管理 +
+ +
+大纲 + 大纲 +
+ +
+查看引用 + 查看引用 +
+ +
+查看实现 + 查看实现 +
+ +
+搜索 symbols + 搜索`symbols` +
+ +
+Debug + Debug +
## 我的 VIM 插件列表 From 77f6ed59805fff7a6c0ca9bfa5696ea06b737ddb Mon Sep 17 00:00:00 2001 From: luokai Date: Sun, 1 Jan 2023 18:37:15 +0800 Subject: [PATCH 0551/1278] update deps view --- lua/java-deps.lua | 181 +++++++++++++++++++++------------------------- 1 file changed, 84 insertions(+), 97 deletions(-) diff --git a/lua/java-deps.lua b/lua/java-deps.lua index dd29275c..32d00d95 100644 --- a/lua/java-deps.lua +++ b/lua/java-deps.lua @@ -3,22 +3,26 @@ local M = {} local get_client = function() local clients = vim.lsp.get_active_clients() for _, client in ipairs(clients) do - if client.name == "jdt.ls" then + if client.name == "jdtls" then return client end end end local get_root_project_uri = function(client) - client = client or get_client() - if client then - return "file://" .. client.config.root_dir + M.client = client or get_client() + if M.client then + return "file://" .. M.client.config.root_dir end end local request = function(bufnr, method, params, handler) vim.lsp.buf_request(bufnr, method, params, handler) end +local request_sync = function(bufnr, method, params, timeout) + timeout = timeout or M.config.options.request_timeout + return vim.lsp.buf_request_sync(bufnr, method, params, timeout) +end M.NodeKind = { WORKSPACE = 1, @@ -33,6 +37,7 @@ M.NodeKind = { CLASS = 11, INTERFACE = 12, ENUM = 13, + JAR = 21, } M.symbols = {} M.symbols.kinds = { @@ -52,35 +57,45 @@ M.symbols.kinds = { } M.config = { + debug = false, options = { show_guides = true, - auto_clise = false, - width = 40, + auto_close = false, + width = 32, relative_width = true, + show_numbers = false, + show_relative_numbers = false, + request_timeout = 3000, symbols = { - FILE = { icon = "", hl = "TSURI" }, - WORKSPACE = { icon = "", hl = "TSNamespace" }, - CONTAINER = { icon = "", hl = "TSMethod" }, - PACKAGE = { icon = "", hl = "TSNamespace" }, - PRIMARYTYPE = { icon = "ﴯ", hl = "TSType" }, - PROJECT = { icon = "פּ", hl = "TSType" }, - PACKAGEROOT = { icon = "", hl = "TSType" }, - FOLDER = { icon = "", hl = "TSType" }, - CLASS = { icon = "C", hl = "TSType" }, - ENUM = { icon = "E", hl = "TSType" }, - INTERFACE = { icon = "I", hl = "TSType" }, - JAR = { icon = "", hl = "TSKeyword" }, + FILE = { icon = "", hl = "@text.uri" }, + WORKSPACE = { icon = "", hl = "@namespace" }, + CONTAINER = { icon = "", hl = "@namespace" }, + PACKAGE = { icon = "", hl = "@namespace" }, + PRIMARYTYPE = { icon = "ﴯ", hl = "@type" }, + PROJECT = { icon = "פּ", hl = "@namespace" }, + PACKAGEROOT = { icon = "", hl = "@namespace" }, + FOLDER = { icon = "", hl = "@type" }, + CLASS = { icon = "C", hl = "@type" }, + ENUM = { icon = "E", hl = "@type" }, + INTERFACE = { icon = "I", hl = "@type" }, + JAR = { icon = "", hl = "@namespace" }, }, }, } M.state = { - root_cache = nil, + attach = false, + root_cache = { + projects = nil, + project_uri = nil, + }, root_view = nil, jdt_dep_win = nil, jdt_dep_buf = nil, code_win = 0, code_buf = 0, + code_buf_uri = nil, } + M.project_list = function(code_buf, handler) local params = {} params.command = "java.project.list" @@ -96,7 +111,7 @@ M.project_list = function(code_buf, handler) end) end -M.get_package_data = function(buf, node, handler) +M.get_package_data = function(buf, node) buf = buf or 0 local params0 = {} @@ -127,13 +142,11 @@ M.get_package_data = function(buf, node, handler) params0.arguments.handlerIdentifier = node.handlerIdentifier end -- 获取项目结构 - request(buf, "workspace/executeCommand", params0, function(err0, packages) - if err0 then - print(err0.message) - elseif packages then - handler(node, packages) - end - end) + local resp, err = request_sync(buf, "workspace/executeCommand", params0) + if M.config.debug then + print(vim.inspect(resp)) + end + return resp, err end M.write_buf = function(bufnr, lines) @@ -212,12 +225,6 @@ M.parse_lines = function(root_view) end local function type_kind(node) - if node.metaData and node.metaData.TypeKind then - return node.metaData.TypeKind + 10 - end - if vim.endswith(node.name, ".jar") then - return 21 - end return node.kind end function M.flatten(items, depth) @@ -274,20 +281,20 @@ function M.add_highlights(bufnr, hl_info) end local function _auto_close(bufnr) - local clean_diagnostic = vim.api.nvim_create_augroup("clean_java_deps_view", { clear = true }) + local java_deps_view_close = vim.api.nvim_create_augroup("java_deps_view_close", { clear = true }) vim.api.nvim_create_autocmd("WinClosed", { - group = clean_diagnostic, + group = java_deps_view_close, buffer = bufnr, callback = function() - vim.api.nvim_del_augroup_by_id(clean_diagnostic) + vim.api.nvim_del_augroup_by_id(java_deps_view_close) M._clean() end, }) end local function _render() - M.state.root_view = M.flatten(M.state.root_cache.children) + M.state.root_view = M.flatten(M.state.root_cache.projects) local lines, hl_info = M.parse_lines(M.state.root_view) - if M.state.jdt_dep_buf == nil then + if M.state.jdt_dep_buf == nil or M.state.jdt_dep_win == nil then M.state.jdt_dep_buf, M.state.jdt_dep_win = M.setup_view() M.keymaps(M.state.jdt_dep_buf, true) _auto_close(M.state.jdt_dep_buf) @@ -296,13 +303,6 @@ local function _render() M.add_highlights(M.state.jdt_dep_buf, hl_info) end -local function setup_keymaps(bufnr) - local buf_map = function(key, action) - vim.api.nvim_buf_set_keymap(bufnr, "n", key, action, { silent = true, noremap = true }) - end - buf_map("o", ":lua require('java-deps')._open_file(false)") -end - local function get_cmp_uri(code_buf) local name = vim.api.nvim_buf_get_name(code_buf) if not vim.startswith(name, "jdt://") then @@ -310,24 +310,17 @@ local function get_cmp_uri(code_buf) end end local function handler_debs(bufnr, cnode) - if - cnode.kind == M.NodeKind.PRIMARYTYPE - or cnode.kind == M.NodeKind.FILE - or cnode.kind == M.NodeKind.CLASS - or cnode.kind == M.NodeKind.INTERFACE - or cnode.kind == M.NodeKind.ENUM - then - return - end if cnode.children then cnode.children = nil cnode.isLast = false _render() else - if M.state.code_buf_uri == nil then - M.state.code_buf_uri = get_cmp_uri(bufnr) + local resp, err = M.get_package_data(bufnr, cnode) + if err then + vim.notify("Failed: " .. err, vim.log.levels.ERROR) + return end - M.get_package_data(bufnr, cnode, function(node, iresp) + (function(node, iresp) node.children = {} for _, value in ipairs(iresp) do if value.uri and vim.startswith(value.uri, M.state.code_buf_uri) then @@ -336,29 +329,18 @@ local function handler_debs(bufnr, cnode) if M.NodeKind.CONTAINER == value.kind then value.root_project = node end - if M.NodeKind.PACKAGEROOT == value.kind and vim.startswith(value.name, "src/") then - value.order = 0 + if M.NodeKind.PACKAGEROOT == value.kind then + value.order = value.entryKind else - value.order = 1 + value.order = value.entryKind end - if - M.NodeKind.CONTAINER == value.kind - and not vim.startswith(value.name, "JRE System Library") - and not vim.startswith(value.name, "Maven Dependencies") - then - M.get_package_data(bufnr, value, function(inode, iiresp) - for _, iv in ipairs(iiresp) do - if M.NodeKind.PACKAGEROOT == iv.kind and vim.startswith(iv.name, "src/") then - iv.order = 0 - else - iv.order = 1 - end - iv.container = inode - table.insert(node.children, iv) - end - sort_node_c(node) - _render() - end) + if M.NodeKind.CONTAINER == value.kind then + if value.entryKind == value.kind then + handler_debs(bufnr, value) + table.insert(node.children, value.children[1]) + else + table.insert(node.children, value) + end else table.insert(node.children, value) end @@ -366,42 +348,43 @@ local function handler_debs(bufnr, cnode) node.isLast = true sort_node_c(node) _render() - end) + end)(cnode, resp[2].result) end end + M.java_projects = function() - if M.state.root_cache == nil then - M.state.root_cache = {} - M.state.root_cache.project_uri = get_root_project_uri() + if not M.state.attach then + vim.notify("Failed: You need to call attach", vim.log.levels.WARN) + return end if M.state.root_cache.project_uri == nil then - M.state.root_cache = nil vim.notify("Failed to get project root directory", vim.log.levels.WARN) return end - local code_buf = vim.api.nvim_get_current_buf() - M.state.code_buf = code_buf - M.state.code_buf_uri = get_cmp_uri(code_buf) if M.state.root_view == nil then M.state.root_view = {} end - M.project_list(code_buf, function(projects) + M.project_list(M.state.code_buf, function(projects) for _, project in ipairs(projects) do project.order = 0 end - M.state.root_cache.children = projects - for _, project in ipairs(M.state.root_cache.children) do - handler_debs(code_buf, project) + M.state.root_cache.projects = projects + for _, project in ipairs(M.state.root_cache.projects) do + handler_debs(M.state.code_buf, project) end _render() - setup_keymaps(M.state.jdt_dep_buf) end) end function M._open_file(change_focus) local current_line = vim.api.nvim_win_get_cursor(M.state.jdt_dep_win)[1] local node = M.state.root_view[current_line] - handler_debs(M.state.code_buf, node) + if node.kind == M.NodeKind.PRIMARYTYPE or node.kind == M.NodeKind.FILE then + -- todo open file + print("open: " .. node.path) + else + handler_debs(M.state.code_buf, node) + end if change_focus then vim.fn.win_gotoid(M.state.code_win) end @@ -462,7 +445,6 @@ end function M._clean() M.state.jdt_dep_buf = nil M.state.jdt_dep_win = nil - M.state.root_cache = nil end function M.close_jdt_dep() @@ -491,11 +473,13 @@ function M.setup(config) end end function M.attach(client, bufnr) - if M.state.root_cache == nil then - M.state.root_cache = {} + if not M.state.attach then + M.state.attach = true + M.state.code_buf = bufnr + M.state.code_buf_uri = get_cmp_uri(bufnr) M.state.root_cache.project_uri = get_root_project_uri(client) end - if M.state.root_cache.project_uri then + if M.client then M.keymaps(bufnr) end end @@ -503,9 +487,12 @@ function M.keymaps(bufnr, view) local buf_map = function(key, action) vim.api.nvim_buf_set_keymap(bufnr, "n", key, action, { silent = true, noremap = true }) end - buf_map("p", ":lua require('java-deps').java_deps_toggle(false)") if view then buf_map("q", ":lua require('java-deps').close_jdt_dep()") + buf_map("o", ":lua require('java-deps')._open_file(false)") + buf_map("p", ":lua require('java-deps').close_jdt_dep()") + else + buf_map("p", ":lua require('java-deps').java_deps_toggle(false)") end end From e1c0f6ab9f899fb7c299dce56d6b77fde8716de7 Mon Sep 17 00:00:00 2001 From: luokai Date: Sun, 1 Jan 2023 21:02:12 +0800 Subject: [PATCH 0552/1278] =?UTF-8?q?=E8=B0=83=E6=95=B4=E9=85=8D=E8=89=B2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lua/java-deps.lua | 67 +++++++++++++++++++++++++++++++++-------------- 1 file changed, 47 insertions(+), 20 deletions(-) diff --git a/lua/java-deps.lua b/lua/java-deps.lua index 32d00d95..df8e4ba6 100644 --- a/lua/java-deps.lua +++ b/lua/java-deps.lua @@ -34,10 +34,12 @@ M.NodeKind = { FOLDER = 7, FILE = 8, + -- metaData.TypeKind CLASS = 11, INTERFACE = 12, ENUM = 13, - JAR = 21, + + JAR = 24, } M.symbols = {} M.symbols.kinds = { @@ -50,10 +52,11 @@ M.symbols.kinds = { "FOLDER", "FILE", - [11] = "CLASS", - [12] = "INTERFACE", - [13] = "ENUM", - [21] = "JAR", + [M.NodeKind.CLASS] = "CLASS", + [M.NodeKind.INTERFACE] = "INTERFACE", + [M.NodeKind.ENUM] = "ENUM", + + [M.NodeKind.JAR] = "JAR", } M.config = { @@ -67,18 +70,18 @@ M.config = { show_relative_numbers = false, request_timeout = 3000, symbols = { - FILE = { icon = "", hl = "@text.uri" }, - WORKSPACE = { icon = "", hl = "@namespace" }, - CONTAINER = { icon = "", hl = "@namespace" }, - PACKAGE = { icon = "", hl = "@namespace" }, + WORKSPACE = { icon = "", hl = "@text.uri" }, + PROJECT = { icon = "", hl = "@text.uri" }, + CONTAINER = { icon = "", hl = "@text.uri" }, + PACKAGEROOT = { icon = "", hl = "@text.uri" }, + PACKAGE = { icon = "", hl = "@namespace" }, PRIMARYTYPE = { icon = "ﴯ", hl = "@type" }, - PROJECT = { icon = "פּ", hl = "@namespace" }, - PACKAGEROOT = { icon = "", hl = "@namespace" }, - FOLDER = { icon = "", hl = "@type" }, - CLASS = { icon = "C", hl = "@type" }, - ENUM = { icon = "E", hl = "@type" }, - INTERFACE = { icon = "I", hl = "@type" }, - JAR = { icon = "", hl = "@namespace" }, + FOLDER = { icon = "", hl = "@text.uri" }, + FILE = { icon = "", hl = "@text.uri" }, + CLASS = { icon = "ﴯ", hl = "@class" }, + ENUM = { icon = "", hl = "@enum" }, + INTERFACE = { icon = "", hl = "@interface" }, + JAR = { icon = "", hl = "@conditional" }, }, }, } @@ -225,9 +228,15 @@ M.parse_lines = function(root_view) end local function type_kind(node) + if node.metaData and node.metaData.TypeKind then + return node.metaData.TypeKind + 10 + end + if node.name and vim.endswith(node.name, ".jar") then + return M.NodeKind.JAR + end return node.kind end -function M.flatten(items, depth) +local function flatten(items, depth) if items and items[#items] then items[#items].isLast = true end @@ -239,7 +248,7 @@ function M.flatten(items, depth) value.icon = M.config.options.symbols[M.symbols.kinds[value.type_kind]].icon table.insert(ret, value) if value.children ~= nil then - local inner = M.flatten(value.children, idepth + 1) + local inner = flatten(value.children, idepth + 1) for _, value_inner in ipairs(inner) do table.insert(ret, value_inner) end @@ -292,7 +301,7 @@ local function _auto_close(bufnr) }) end local function _render() - M.state.root_view = M.flatten(M.state.root_cache.projects) + M.state.root_view = flatten(M.state.root_cache.projects) local lines, hl_info = M.parse_lines(M.state.root_view) if M.state.jdt_dep_buf == nil or M.state.jdt_dep_win == nil then M.state.jdt_dep_buf, M.state.jdt_dep_win = M.setup_view() @@ -376,12 +385,30 @@ M.java_projects = function() end) end +function M.resolve_path(buf, uri) + local command = { command = "java.resolvePath", arguments = uri } + local resp, err = request_sync(buf, "workspace/executeCommand", command) + if M.config.debug then + print(vim.inspect(resp)) + end + if err then + print("resolve_path error: " .. err) + return + end + return resp +end + function M._open_file(change_focus) local current_line = vim.api.nvim_win_get_cursor(M.state.jdt_dep_win)[1] local node = M.state.root_view[current_line] if node.kind == M.NodeKind.PRIMARYTYPE or node.kind == M.NodeKind.FILE then -- todo open file - print("open: " .. node.path) + local uri = node.uri + local resp = M.resolve_path(M.state.code_buf, uri) + + print("open: " .. vim.inspect(resp)) + -- vim.fn.execute("wincmd w") + -- vim.fn.execute("edit `=" .. uri .. "`") else handler_debs(M.state.code_buf, node) end From 81bab1073b2745772db75b0e2f3e05aaa4a2d164 Mon Sep 17 00:00:00 2001 From: luokai Date: Wed, 4 Jan 2023 17:39:45 +0800 Subject: [PATCH 0553/1278] java file --- lua/kide/core/utils/maven.lua | 4 ++-- lua/kide/lsp/java.lua | 1 - 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/lua/kide/core/utils/maven.lua b/lua/kide/core/utils/maven.lua index 54b02fa8..42994054 100644 --- a/lua/kide/core/utils/maven.lua +++ b/lua/kide/core/utils/maven.lua @@ -74,10 +74,10 @@ M.setup = function() local group = vim.api.nvim_create_augroup("kide_jdtls_java_maven", { clear = true }) vim.api.nvim_create_autocmd({ "FileType" }, { group = group, - pattern = { "xml" }, + pattern = { "xml", "java" }, desc = "maven_command", callback = function(e) - if vim.endswith(e.file, "pom.xml") then + if vim.endswith(e.file, "pom.xml") or vim.endswith(e.file, ".java") then M.maven_command(e.buf) end end, diff --git a/lua/kide/lsp/java.lua b/lua/kide/lsp/java.lua index fe9c66cf..7c6ccdff 100644 --- a/lua/kide/lsp/java.lua +++ b/lua/kide/lsp/java.lua @@ -369,7 +369,6 @@ config["on_attach"] = function(client, buffer) -- end require("nvim-navic").attach(client, buffer) - maven.maven_command(buffer) -- require('java-deps').attach(client, bufnr) -- vim.notify(vim.api.nvim_buf_get_name(bufnr), vim.log.levels.INFO) end From 77244e517f2e97b9b875ef0556d83ad2d17663ad Mon Sep 17 00:00:00 2001 From: luokai Date: Thu, 5 Jan 2023 09:39:45 +0800 Subject: [PATCH 0554/1278] xml lsp --- lua/kide/lsp/lemminx.lua | 1 + lua/kide/lsp/utils/init.lua | 2 +- lua/kide/lsp/yaml-language-server.lua | 1 + lua/kide/plugins/config/null-ls.lua | 2 +- 4 files changed, 4 insertions(+), 2 deletions(-) create mode 100644 lua/kide/lsp/lemminx.lua create mode 100644 lua/kide/lsp/yaml-language-server.lua diff --git a/lua/kide/lsp/lemminx.lua b/lua/kide/lsp/lemminx.lua new file mode 100644 index 00000000..a5647075 --- /dev/null +++ b/lua/kide/lsp/lemminx.lua @@ -0,0 +1 @@ +return {} diff --git a/lua/kide/lsp/utils/init.lua b/lua/kide/lsp/utils/init.lua index 211d1501..c42ecc82 100644 --- a/lua/kide/lsp/utils/init.lua +++ b/lua/kide/lsp/utils/init.lua @@ -50,7 +50,7 @@ format_lsp_mapping["handlebars"] = "null-ls" format_lsp_mapping["nginx"] = "null-ls" -- xmllint -format_lsp_mapping["xml"] = "null-ls" +format_lsp_mapping["xml"] = "lemminx" -- taplo format_lsp_mapping["toml"] = "null-ls" diff --git a/lua/kide/lsp/yaml-language-server.lua b/lua/kide/lsp/yaml-language-server.lua new file mode 100644 index 00000000..a5647075 --- /dev/null +++ b/lua/kide/lsp/yaml-language-server.lua @@ -0,0 +1 @@ +return {} diff --git a/lua/kide/plugins/config/null-ls.lua b/lua/kide/plugins/config/null-ls.lua index 2996e6a3..afcaabed 100644 --- a/lua/kide/plugins/config/null-ls.lua +++ b/lua/kide/plugins/config/null-ls.lua @@ -23,7 +23,7 @@ local sources = { }), -- null_ls.builtins.formatting.jq, -- xml - null_ls.builtins.formatting.xmllint, + -- null_ls.builtins.formatting.xmllint, -- toml null_ls.builtins.formatting.taplo, -- sh From a49a2cfa954e65cece47e1af91e1278667ad6178 Mon Sep 17 00:00:00 2001 From: luokai Date: Thu, 5 Jan 2023 09:47:31 +0800 Subject: [PATCH 0555/1278] diffview-nvim --- lua/kide/plugins/config/diffview-nvim.lua | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/lua/kide/plugins/config/diffview-nvim.lua b/lua/kide/plugins/config/diffview-nvim.lua index 60bf68ac..7e299816 100644 --- a/lua/kide/plugins/config/diffview-nvim.lua +++ b/lua/kide/plugins/config/diffview-nvim.lua @@ -26,12 +26,14 @@ require("diffview").setup({ }, }, file_history_panel = { - log_options = { -- See ':h diffview-config-log_options' - single_file = { - diff_merges = "combined", - }, - multi_file = { - diff_merges = "first-parent", + git = { + log_options = { -- See ':h diffview-config-log_options' + single_file = { + diff_merges = "combined", + }, + multi_file = { + diff_merges = "first-parent", + }, }, }, win_config = { -- See ':h diffview-config-win_config' From 79a818def01fdd7b25ef1ce3acf9b3a866b4b525 Mon Sep 17 00:00:00 2001 From: luokai Date: Thu, 5 Jan 2023 13:49:41 +0800 Subject: [PATCH 0556/1278] maven tools --- lua/kide/core/utils/init.lua | 8 +++--- lua/kide/core/utils/maven.lua | 47 +++++++++++++++++++++++++++-------- 2 files changed, 41 insertions(+), 14 deletions(-) diff --git a/lua/kide/core/utils/init.lua b/lua/kide/core/utils/init.lua index 3ce77c70..c6211a42 100644 --- a/lua/kide/core/utils/init.lua +++ b/lua/kide/core/utils/init.lua @@ -201,15 +201,15 @@ M.is_mac = M.os_type() == M.Mac ---@param complete {} ---@param opt {multiple:false, multiple_repeated:false, single:false} M.command_args_complete = function(complete, opt) - local lopt = opt or {} - if complete then + opt = opt or {} + if complete ~= nil then return function(_, cmd_line, _) - if lopt.multiple then + if opt.multiple ~= nil and opt.multiple then local args = vim.split(cmd_line, " ") return vim.tbl_filter(function(item) return not vim.tbl_contains(args, item) end, complete) - elseif lopt.single then + elseif opt.single ~= nil and opt.single then local args = vim.split(cmd_line, " ") for _, value in ipairs(args) do if vim.tbl_contains(complete, value) then diff --git a/lua/kide/core/utils/maven.lua b/lua/kide/core/utils/maven.lua index 42994054..82cf6f2a 100644 --- a/lua/kide/core/utils/maven.lua +++ b/lua/kide/core/utils/maven.lua @@ -26,15 +26,30 @@ local function pom_file(file) return "" end -local exec = function(cmd, pom) - require("toggleterm").exec(cmd .. settings_opt(M.get_maven_settings()) .. pom_file(pom)) +local exec = function(cmd, pom, opt) + opt = opt or {} + local Terminal = require("toggleterm.terminal").Terminal + -- require("toggleterm").exec(cmd .. settings_opt(M.get_maven_settings()) .. pom_file(pom)) + local mvn = Terminal:new({ + cmd = cmd .. settings_opt(M.get_maven_settings()) .. pom_file(pom), + close_on_exit = opt.close_on_exit, + auto_scroll = true, + on_exit = function(_) + if opt.update ~= nil and opt.update then + vim.defer_fn(function() + require("jdtls").update_project_config() + end, 500) + end + end, + }) + mvn:toggle() end -local function create_command(buf, name, cmd, complete) +local function create_command(buf, name, cmd, complete, opt) vim.api.nvim_buf_create_user_command(buf, name, function(opts) if opts.args then - exec(cmd .. " " .. opts.args, vim.fn.expand("%")) + exec(cmd .. " " .. opts.args, vim.fn.expand("%"), opt) else - exec(cmd, vim.fn.expand("%")) + exec(cmd, vim.fn.expand("%"), opt) end end, { nargs = "*", @@ -45,18 +60,26 @@ end local maven_args_complete = utils.command_args_complete M.maven_command = function(buf) - create_command(buf, "MavenCompile", "mvn clean compile", maven_args_complete({ "test-compile" }, { multiple = true })) + create_command( + buf, + "MavenCompile", + "mvn clean compile", + maven_args_complete({ "test-compile" }, { multiple = true }), + { update = true } + ) create_command( buf, "MavenInstll", "mvn clean install", - maven_args_complete({ "-DskipTests", "-Dmaven.test.skip=true" }, { single = true }) + maven_args_complete({ "-DskipTests", "-Dmaven.test.skip=true" }, { single = true }), + { update = true } ) create_command( buf, "MavenPackage", "mvn clean package", - maven_args_complete({ "-DskipTests", "-Dmaven.test.skip=true" }, { single = true }) + maven_args_complete({ "-DskipTests", "-Dmaven.test.skip=true" }, { single = true }), + { update = true } ) create_command( buf, @@ -64,8 +87,12 @@ M.maven_command = function(buf) "mvn dependency:tree", maven_args_complete({ "-Doutput=.dependency.txt" }, { multiple = true }) ) - create_command(buf, "MavenDependencyAnalyzeDuplicate", "mvn dependency:analyze-duplicate") - create_command(buf, "MavenDependencyAnalyzeOnly", "mvn dependency:analyze-only -Dverbose") + create_command(buf, "MavenDependencyAnalyzeDuplicate", "mvn dependency:analyze-duplicate", nil, { + close_on_exit = false, + }) + create_command(buf, "MavenDependencyAnalyzeOnly", "mvn dependency:analyze-only -Dverbose", nil, { + close_on_exit = false, + }) create_command(buf, "MavenDownloadSources", "mvn dependency:sources -DdownloadSources=true") create_command(buf, "MavenTest", "mvn test", maven_args_complete({ "-Dtest=" }, {})) end From b877bb4fcdb370f3b70e6d741eabf9bd0fd5e408 Mon Sep 17 00:00:00 2001 From: luokai Date: Thu, 5 Jan 2023 22:36:53 +0800 Subject: [PATCH 0557/1278] java-deps --- .gitignore | 1 + lua/java-deps.lua | 526 -------------------------------------- lua/kide/lsp/java.lua | 5 +- lua/kide/plugins/init.lua | 9 + 4 files changed, 14 insertions(+), 527 deletions(-) delete mode 100644 lua/java-deps.lua diff --git a/.gitignore b/.gitignore index 6e6a468f..61533499 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,3 @@ .netrwhist +.luarc.json plugin diff --git a/lua/java-deps.lua b/lua/java-deps.lua deleted file mode 100644 index df8e4ba6..00000000 --- a/lua/java-deps.lua +++ /dev/null @@ -1,526 +0,0 @@ -local M = {} - -local get_client = function() - local clients = vim.lsp.get_active_clients() - for _, client in ipairs(clients) do - if client.name == "jdtls" then - return client - end - end -end - -local get_root_project_uri = function(client) - M.client = client or get_client() - if M.client then - return "file://" .. M.client.config.root_dir - end -end - -local request = function(bufnr, method, params, handler) - vim.lsp.buf_request(bufnr, method, params, handler) -end -local request_sync = function(bufnr, method, params, timeout) - timeout = timeout or M.config.options.request_timeout - return vim.lsp.buf_request_sync(bufnr, method, params, timeout) -end - -M.NodeKind = { - WORKSPACE = 1, - PROJECT = 2, - CONTAINER = 3, - PACKAGEROOT = 4, - PACKAGE = 5, - PRIMARYTYPE = 6, - FOLDER = 7, - FILE = 8, - - -- metaData.TypeKind - CLASS = 11, - INTERFACE = 12, - ENUM = 13, - - JAR = 24, -} -M.symbols = {} -M.symbols.kinds = { - "WORKSPACE", - "PROJECT", - "CONTAINER", - "PACKAGEROOT", - "PACKAGE", - "PRIMARYTYPE", - "FOLDER", - "FILE", - - [M.NodeKind.CLASS] = "CLASS", - [M.NodeKind.INTERFACE] = "INTERFACE", - [M.NodeKind.ENUM] = "ENUM", - - [M.NodeKind.JAR] = "JAR", -} - -M.config = { - debug = false, - options = { - show_guides = true, - auto_close = false, - width = 32, - relative_width = true, - show_numbers = false, - show_relative_numbers = false, - request_timeout = 3000, - symbols = { - WORKSPACE = { icon = "", hl = "@text.uri" }, - PROJECT = { icon = "", hl = "@text.uri" }, - CONTAINER = { icon = "", hl = "@text.uri" }, - PACKAGEROOT = { icon = "", hl = "@text.uri" }, - PACKAGE = { icon = "", hl = "@namespace" }, - PRIMARYTYPE = { icon = "ﴯ", hl = "@type" }, - FOLDER = { icon = "", hl = "@text.uri" }, - FILE = { icon = "", hl = "@text.uri" }, - CLASS = { icon = "ﴯ", hl = "@class" }, - ENUM = { icon = "", hl = "@enum" }, - INTERFACE = { icon = "", hl = "@interface" }, - JAR = { icon = "", hl = "@conditional" }, - }, - }, -} -M.state = { - attach = false, - root_cache = { - projects = nil, - project_uri = nil, - }, - root_view = nil, - jdt_dep_win = nil, - jdt_dep_buf = nil, - code_win = 0, - code_buf = 0, - code_buf_uri = nil, -} - -M.project_list = function(code_buf, handler) - local params = {} - params.command = "java.project.list" - params.arguments = { - M.state.root_cache.project_uri, - } - request(code_buf, "workspace/executeCommand", params, function(err, projects) - if err then - vim.notify(err.message, vim.log.levels.WARN) - elseif projects then - handler(projects) - end - end) -end - -M.get_package_data = function(buf, node) - buf = buf or 0 - - local params0 = {} - params0.command = "java.getPackageData" - params0.arguments = { - kind = node.kind, - projectUri = M.state.root_cache.project_uri, - path = node.path, - } - if node.root_project then - params0.arguments.projectUri = node.root_project.uri - end - if node.container then - params0.arguments.projectUri = node.container.uri - end - if node.kind == M.NodeKind.PROJECT then - params0.arguments.projectUri = node.uri - end - - if node.kind == M.NodeKind.PACKAGEROOT then - params0.arguments.rootPath = M.state.root_cache.project_uri - params0.arguments.handlerIdentifier = node.handlerIdentifier - params0.arguments.isHierarchicalView = true - end - if node.kind == M.NodeKind.PACKAGE then - params0.arguments.isHierarchicalView = true - params0.arguments.path = node.name - params0.arguments.handlerIdentifier = node.handlerIdentifier - end - -- 获取项目结构 - local resp, err = request_sync(buf, "workspace/executeCommand", params0) - if M.config.debug then - print(vim.inspect(resp)) - end - return resp, err -end - -M.write_buf = function(bufnr, lines) - vim.api.nvim_buf_set_option(bufnr, "modifiable", true) - vim.api.nvim_buf_set_lines(bufnr, 0, -1, false, lines) - vim.api.nvim_buf_set_option(bufnr, "modifiable", false) -end -M.markers = { - bottom = "└", - middle = "├", - vertical = "│", - horizontal = "─", -} - -local function table_to_str(t) - local ret = "" - for _, value in ipairs(t) do - ret = ret .. tostring(value) - end - return ret -end -local function str_to_table(str) - local t = {} - for i = 1, #str do - t[i] = str:sub(i, i) - end - return t -end - -M.parse_lines = function(root_view) - local lines = {} - local hl_info = {} - -- .depth - for _, v in ipairs(root_view) do - local line = str_to_table(string.rep(" ", v.depth)) - - if M.config.options.show_guides then - -- makes the guides - for index, _ in ipairs(line) do - -- all items start with a space (or two) - if index == 1 then - line[index] = " " - -- if index is last, add a bottom marker if current item is last, - -- else add a middle marker - elseif index == #line then - if v.isLast then - line[index] = M.markers.bottom - else - line[index] = M.markers.middle - end - -- else if the parent was not the last in its group, add a - -- vertical marker because there are items under us and we need - -- to point to those - -- else - -- line[index] = M.markers.vertical - end - end - end - local final_prefix = {} - -- Add 1 space between the guides - for _, l in ipairs(line) do - table.insert(final_prefix, l) - table.insert(final_prefix, " ") - end - - local string_prefix = table_to_str(final_prefix) - local hl_start = #string_prefix - local hl_end = #string_prefix + #v.icon - - -- table.insert(lines, string_prefix .. v.icon .. " " .. v.name .. ":" .. v.kind .. ":" .. v.order) - table.insert(lines, string_prefix .. v.icon .. " " .. v.name) - local hl_type = M.config.options.symbols[M.symbols.kinds[v.type_kind]].hl - table.insert(hl_info, { hl_start, hl_end, hl_type }) - end - return lines, hl_info -end - -local function type_kind(node) - if node.metaData and node.metaData.TypeKind then - return node.metaData.TypeKind + 10 - end - if node.name and vim.endswith(node.name, ".jar") then - return M.NodeKind.JAR - end - return node.kind -end -local function flatten(items, depth) - if items and items[#items] then - items[#items].isLast = true - end - local ret = {} - for _, value in ipairs(items) do - local idepth = depth or value.depth or 1 - value.depth = idepth - value.type_kind = type_kind(value) - value.icon = M.config.options.symbols[M.symbols.kinds[value.type_kind]].icon - table.insert(ret, value) - if value.children ~= nil then - local inner = flatten(value.children, idepth + 1) - for _, value_inner in ipairs(inner) do - table.insert(ret, value_inner) - end - end - end - return ret -end - -local function sort_node_c(node) - if node == nil or node.children == nil then - return - end - table.sort(node.children, function(a, b) - if a.order ~= b.order then - return a.order < b.order - end - if a.kind == b.kind then - if - a.kind == M.NodeKind.PROJECT - or a.kind == M.NodeKind.PRIMARYTYPE - or a.kind == M.NodeKind.PACKAGEROOT - or a.kind == M.NodeKind.PACKAGE - then - if a.name ~= b.name then - return a.name:upper() < b.name:upper() - end - end - end - return false - end) -end - -local hlns = vim.api.nvim_create_namespace("java-deps-icon-highlight") -function M.add_highlights(bufnr, hl_info) - for line, line_hl in ipairs(hl_info) do - local hl_start, hl_end, hl_type = unpack(line_hl) - vim.api.nvim_buf_add_highlight(bufnr, hlns, hl_type, line - 1, hl_start, hl_end) - end -end - -local function _auto_close(bufnr) - local java_deps_view_close = vim.api.nvim_create_augroup("java_deps_view_close", { clear = true }) - vim.api.nvim_create_autocmd("WinClosed", { - group = java_deps_view_close, - buffer = bufnr, - callback = function() - vim.api.nvim_del_augroup_by_id(java_deps_view_close) - M._clean() - end, - }) -end -local function _render() - M.state.root_view = flatten(M.state.root_cache.projects) - local lines, hl_info = M.parse_lines(M.state.root_view) - if M.state.jdt_dep_buf == nil or M.state.jdt_dep_win == nil then - M.state.jdt_dep_buf, M.state.jdt_dep_win = M.setup_view() - M.keymaps(M.state.jdt_dep_buf, true) - _auto_close(M.state.jdt_dep_buf) - end - M.write_buf(M.state.jdt_dep_buf, lines) - M.add_highlights(M.state.jdt_dep_buf, hl_info) -end - -local function get_cmp_uri(code_buf) - local name = vim.api.nvim_buf_get_name(code_buf) - if not vim.startswith(name, "jdt://") then - return "file://" .. name - end -end -local function handler_debs(bufnr, cnode) - if cnode.children then - cnode.children = nil - cnode.isLast = false - _render() - else - local resp, err = M.get_package_data(bufnr, cnode) - if err then - vim.notify("Failed: " .. err, vim.log.levels.ERROR) - return - end - (function(node, iresp) - node.children = {} - for _, value in ipairs(iresp) do - if value.uri and vim.startswith(value.uri, M.state.code_buf_uri) then - value.current = true - end - if M.NodeKind.CONTAINER == value.kind then - value.root_project = node - end - if M.NodeKind.PACKAGEROOT == value.kind then - value.order = value.entryKind - else - value.order = value.entryKind - end - if M.NodeKind.CONTAINER == value.kind then - if value.entryKind == value.kind then - handler_debs(bufnr, value) - table.insert(node.children, value.children[1]) - else - table.insert(node.children, value) - end - else - table.insert(node.children, value) - end - end - node.isLast = true - sort_node_c(node) - _render() - end)(cnode, resp[2].result) - end -end - -M.java_projects = function() - if not M.state.attach then - vim.notify("Failed: You need to call attach", vim.log.levels.WARN) - return - end - if M.state.root_cache.project_uri == nil then - vim.notify("Failed to get project root directory", vim.log.levels.WARN) - return - end - if M.state.root_view == nil then - M.state.root_view = {} - end - M.project_list(M.state.code_buf, function(projects) - for _, project in ipairs(projects) do - project.order = 0 - end - M.state.root_cache.projects = projects - for _, project in ipairs(M.state.root_cache.projects) do - handler_debs(M.state.code_buf, project) - end - _render() - end) -end - -function M.resolve_path(buf, uri) - local command = { command = "java.resolvePath", arguments = uri } - local resp, err = request_sync(buf, "workspace/executeCommand", command) - if M.config.debug then - print(vim.inspect(resp)) - end - if err then - print("resolve_path error: " .. err) - return - end - return resp -end - -function M._open_file(change_focus) - local current_line = vim.api.nvim_win_get_cursor(M.state.jdt_dep_win)[1] - local node = M.state.root_view[current_line] - if node.kind == M.NodeKind.PRIMARYTYPE or node.kind == M.NodeKind.FILE then - -- todo open file - local uri = node.uri - local resp = M.resolve_path(M.state.code_buf, uri) - - print("open: " .. vim.inspect(resp)) - -- vim.fn.execute("wincmd w") - -- vim.fn.execute("edit `=" .. uri .. "`") - else - handler_debs(M.state.code_buf, node) - end - if change_focus then - vim.fn.win_gotoid(M.state.code_win) - end - if M.config.options.auto_close then - M.close_outline() - end -end - -function M.get_split_command() - if M.config.options.position == "left" then - return "topleft vs" - else - return "botright vs" - end -end -function M.get_window_width() - if M.config.options.relative_width then - return math.ceil(vim.o.columns * (M.config.options.width / 100)) - else - return M.options.width - end -end -M.setup_view = function() - -- create a scratch unlisted buffer - local bufnr = vim.api.nvim_create_buf(false, true) - - -- delete buffer when window is closed / buffer is hidden - vim.api.nvim_buf_set_option(bufnr, "bufhidden", "delete") - -- create a split - vim.cmd(M.get_split_command()) - -- resize to a % of the current window size - vim.cmd("vertical resize " .. M.get_window_width()) - - -- get current (outline) window and attach our buffer to it - local winnr = vim.api.nvim_get_current_win() - vim.api.nvim_win_set_buf(winnr, bufnr) - - -- window stuff - vim.api.nvim_win_set_option(winnr, "number", false) - vim.api.nvim_win_set_option(winnr, "relativenumber", false) - vim.api.nvim_win_set_option(winnr, "winfixwidth", true) - -- buffer stuff - vim.api.nvim_buf_set_name(bufnr, "Java Projects") - vim.api.nvim_buf_set_option(bufnr, "filetype", "JavaProjects") - vim.api.nvim_buf_set_option(bufnr, "modifiable", false) - - if M.config.options.show_numbers or M.config.options.show_relative_numbers then - vim.api.nvim_win_set_option(winnr, "nu", true) - end - - if M.config.options.show_relative_numbers then - vim.api.nvim_win_set_option(winnr, "rnu", true) - end - - return bufnr, winnr -end - -function M._clean() - M.state.jdt_dep_buf = nil - M.state.jdt_dep_win = nil -end - -function M.close_jdt_dep() - if M.state.jdt_dep_buf then - vim.api.nvim_win_close(M.state.jdt_dep_win, true) - M._clean() - end -end - -function M.open_jdt_dep() - if M.state.jdt_dep_buf == nil then - M.java_projects() - end -end -function M.java_deps_toggle() - if M.state.jdt_dep_buf == nil then - M.java_projects() - else - M.close_jdt_dep() - end -end - -function M.setup(config) - if config then - M.config = vim.tbl_extend("force", M.config, config) - end -end -function M.attach(client, bufnr) - if not M.state.attach then - M.state.attach = true - M.state.code_buf = bufnr - M.state.code_buf_uri = get_cmp_uri(bufnr) - M.state.root_cache.project_uri = get_root_project_uri(client) - end - if M.client then - M.keymaps(bufnr) - end -end -function M.keymaps(bufnr, view) - local buf_map = function(key, action) - vim.api.nvim_buf_set_keymap(bufnr, "n", key, action, { silent = true, noremap = true }) - end - if view then - buf_map("q", ":lua require('java-deps').close_jdt_dep()") - buf_map("o", ":lua require('java-deps')._open_file(false)") - buf_map("p", ":lua require('java-deps').close_jdt_dep()") - else - buf_map("p", ":lua require('java-deps').java_deps_toggle(false)") - end -end - -return M diff --git a/lua/kide/lsp/java.lua b/lua/kide/lsp/java.lua index 7c6ccdff..41baf29e 100644 --- a/lua/kide/lsp/java.lua +++ b/lua/kide/lsp/java.lua @@ -369,7 +369,10 @@ config["on_attach"] = function(client, buffer) -- end require("nvim-navic").attach(client, buffer) - -- require('java-deps').attach(client, bufnr) + require("java-deps").attach(client, buffer, root_dir) + create_command(buffer, "JavaProjects", require("java-deps").toggle_outline, { + nargs = 0, + }) -- vim.notify(vim.api.nvim_buf_get_name(bufnr), vim.log.levels.INFO) end diff --git a/lua/kide/plugins/init.lua b/lua/kide/plugins/init.lua index 43c96e68..d8b17667 100644 --- a/lua/kide/plugins/init.lua +++ b/lua/kide/plugins/init.lua @@ -219,6 +219,15 @@ require("packer").startup({ require("kide.lsp.java").setup() end, }) + use({ + "JavaHello/java-deps.nvim", + opt = true, + after = "nvim-jdtls", + ft = { "java" }, + config = function() + require("java-deps").setup() + end, + }) -- use 'NiYanhhhhh/lighttree-java' -- debug From c44dc0f900b9d6b6e82e87fd9debddb8d1697174 Mon Sep 17 00:00:00 2001 From: luokai Date: Thu, 5 Jan 2023 22:50:33 +0800 Subject: [PATCH 0558/1278] JavaProjects --- lua/kide/plugins/config/bufferline.lua | 7 +++++++ lua/kide/plugins/config/lualine.lua | 11 +++++++++++ 2 files changed, 18 insertions(+) diff --git a/lua/kide/plugins/config/bufferline.lua b/lua/kide/plugins/config/bufferline.lua index 044b635d..a722632c 100644 --- a/lua/kide/plugins/config/bufferline.lua +++ b/lua/kide/plugins/config/bufferline.lua @@ -64,6 +64,13 @@ require("bufferline").setup({ highlight = "Directory", text_align = "left", }, + { + filetype = "JavaProjects", + text = " JavaProjects", + padding = 1, + highlight = "Directory", + text_align = "left", + }, }, color_icons = true, show_buffer_close_icons = true, diff --git a/lua/kide/plugins/config/lualine.lua b/lua/kide/plugins/config/lualine.lua index 51a7cd03..f93062ac 100644 --- a/lua/kide/plugins/config/lualine.lua +++ b/lua/kide/plugins/config/lualine.lua @@ -121,4 +121,15 @@ dbui.filetypes = { } table.insert(config.extensions, dbui) +-- JavaProjects +local java_projects = {} +java_projects.sections = { + lualine_a = { + { "filename", file_status = false }, + }, +} +java_projects.filetypes = { + "JavaProjects", +} +table.insert(config.extensions, java_projects) require("lualine").setup(config) From 426169dc8962f4520bd8e4b5b63da5edb002ce53 Mon Sep 17 00:00:00 2001 From: luokai Date: Fri, 6 Jan 2023 09:13:52 +0800 Subject: [PATCH 0559/1278] nvim-navic --- lua/kide/lsp/init.lua | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/lua/kide/lsp/init.lua b/lua/kide/lsp/init.lua index bd5a8c85..6377211c 100644 --- a/lua/kide/lsp/init.lua +++ b/lua/kide/lsp/init.lua @@ -28,7 +28,6 @@ local capabilities = require("cmp_nvim_lsp").default_capabilities(vim.lsp.protoc -- 没有确定使用效果参数 -- capabilities.textDocument.completion.completionItem.snippetSupport = true local utils = require("kide.core.utils") -local navic_unsupported = { sqls = true } require("mason-lspconfig").setup_handlers({ -- The first entry (without a key) will be the default handler @@ -46,7 +45,7 @@ require("mason-lspconfig").setup_handlers({ scfg.on_attach = function(client, buffer) -- 绑定快捷键 require("kide.core.keybindings").maplsp(client, buffer) - if not navic_unsupported[client.name] then + if client.server_capabilities.documentSymbolProvider then require("nvim-navic").attach(client, buffer) end if on_attach then From f815d6ed778b20a74dcf7daf48c54f261d62526a Mon Sep 17 00:00:00 2001 From: luokai Date: Fri, 6 Jan 2023 10:10:43 +0800 Subject: [PATCH 0560/1278] update_project_config --- lua/kide/core/utils/maven.lua | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/lua/kide/core/utils/maven.lua b/lua/kide/core/utils/maven.lua index 82cf6f2a..1cb98f28 100644 --- a/lua/kide/core/utils/maven.lua +++ b/lua/kide/core/utils/maven.lua @@ -37,7 +37,10 @@ local exec = function(cmd, pom, opt) on_exit = function(_) if opt.update ~= nil and opt.update then vim.defer_fn(function() - require("jdtls").update_project_config() + local filetype = vim.api.nvim_buf_get_option(0, "filetype") + if filetype == "java" then + require("jdtls").update_project_config() + end end, 500) end end, From f15ac1a11d664ef41372d3093e3c56cca53d8cf2 Mon Sep 17 00:00:00 2001 From: luokai Date: Fri, 6 Jan 2023 10:31:03 +0800 Subject: [PATCH 0561/1278] maven tools --- lua/kide/core/utils/maven.lua | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/lua/kide/core/utils/maven.lua b/lua/kide/core/utils/maven.lua index 1cb98f28..6579aa1a 100644 --- a/lua/kide/core/utils/maven.lua +++ b/lua/kide/core/utils/maven.lua @@ -68,27 +68,28 @@ M.maven_command = function(buf) "MavenCompile", "mvn clean compile", maven_args_complete({ "test-compile" }, { multiple = true }), - { update = true } + { update = true, close_on_exit = false } ) create_command( buf, "MavenInstll", "mvn clean install", maven_args_complete({ "-DskipTests", "-Dmaven.test.skip=true" }, { single = true }), - { update = true } + { update = true, close_on_exit = false } ) create_command( buf, "MavenPackage", "mvn clean package", maven_args_complete({ "-DskipTests", "-Dmaven.test.skip=true" }, { single = true }), - { update = true } + { update = true, close_on_exit = false } ) create_command( buf, "MavenDependencyTree", "mvn dependency:tree", - maven_args_complete({ "-Doutput=.dependency.txt" }, { multiple = true }) + maven_args_complete({ "-Doutput=.dependency.txt" }, { multiple = true }), + { close_on_exit = false } ) create_command(buf, "MavenDependencyAnalyzeDuplicate", "mvn dependency:analyze-duplicate", nil, { close_on_exit = false, From 8a3b170267d42ab62b87c367f90bcc6d1489d51c Mon Sep 17 00:00:00 2001 From: luokai Date: Sat, 7 Jan 2023 20:03:31 +0800 Subject: [PATCH 0562/1278] JavaProjects --- README.md | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/README.md b/README.md index 47d6a4b5..bf47586a 100644 --- a/README.md +++ b/README.md @@ -112,6 +112,11 @@ git clone https://github.com/JavaHello/nvim.git Debug +
+JavaProjects + Debug +
+ ## 我的 VIM 插件列表 | 插件名称 | 插件描述 | 推荐等级 | 备注 | From 432b73be096655638862765c31703da508212688 Mon Sep 17 00:00:00 2001 From: luokai Date: Mon, 9 Jan 2023 11:49:22 +0800 Subject: [PATCH 0563/1278] ascli-header --- lua/kide/plugins/config/alpha-nvim.lua | 13 ++----------- lua/kide/plugins/config/ascli-header.lua | 10 ++++++++++ 2 files changed, 12 insertions(+), 11 deletions(-) diff --git a/lua/kide/plugins/config/alpha-nvim.lua b/lua/kide/plugins/config/alpha-nvim.lua index 1f137008..dcdbfaa4 100644 --- a/lua/kide/plugins/config/alpha-nvim.lua +++ b/lua/kide/plugins/config/alpha-nvim.lua @@ -1,20 +1,11 @@ local alpha = require("alpha") local dashboard = require("alpha.themes.dashboard") --- local ascli = require("kide.plugins.config.ascli-header") +local ascli = require("kide.plugins.config.ascli-header") dashboard.leader = "\\" -- Set header -- dashboard.section.header.val = ascli[math.random(0, #ascli)] -dashboard.section.header.val = { - " ", - " ███╗ ██╗███████╗ ██████╗ ██╗ ██╗██╗███╗ ███╗ ", - " ████╗ ██║██╔════╝██╔═══██╗██║ ██║██║████╗ ████║ ", - " ██╔██╗ ██║█████╗ ██║ ██║██║ ██║██║██╔████╔██║ ", - " ██║╚██╗██║██╔══╝ ██║ ██║╚██╗ ██╔╝██║██║╚██╔╝██║ ", - " ██║ ╚████║███████╗╚██████╔╝ ╚████╔╝ ██║██║ ╚═╝ ██║ ", - " ╚═╝ ╚═══╝╚══════╝ ╚═════╝ ╚═══╝ ╚═╝╚═╝ ╚═╝ ", - " ", -} +dashboard.section.header.val = ascli[33] local opt = { noremap = true, silent = true } -- Set menu dashboard.section.buttons.val = { diff --git a/lua/kide/plugins/config/ascli-header.lua b/lua/kide/plugins/config/ascli-header.lua index 86acf9df..add5934d 100644 --- a/lua/kide/plugins/config/ascli-header.lua +++ b/lua/kide/plugins/config/ascli-header.lua @@ -682,4 +682,14 @@ M[33] = { " ██║ ╚████║ ███████╗╚██████╔╝ ╚████╔╝ ██║ ██║ ╚═╝ ██║", " ╚═╝ ╚═══╝ ╚══════╝ ╚═════╝ ╚═══╝ ╚═╝ ╚═╝ ╚═╝", } + +M[34] = { + "", + "███╗ ██╗██╗ ██╗██╗███╗ ███╗ ██╗██████╗ ███████╗", + "████╗ ██║██║ ██║██║████╗ ████║ ██║██╔══██╗██╔════╝", + "██╔██╗ ██║██║ ██║██║██╔████╔██║ ██║██║ ██║█████╗ ", + "██║╚██╗██║╚██╗ ██╔╝██║██║╚██╔╝██║ ██║██║ ██║██╔══╝ ", + "██║ ╚████║ ╚████╔╝ ██║██║ ╚═╝ ██║ ██║██████╔╝███████╗", + "╚═╝ ╚═══╝ ╚═══╝ ╚═╝╚═╝ ╚═╝ ╚═╝╚═════╝ ╚══════╝", +} return M From b2a417fbd2fa3eac3cbacee3b475bdc51277cbe4 Mon Sep 17 00:00:00 2001 From: luokai Date: Mon, 16 Jan 2023 11:39:45 +0800 Subject: [PATCH 0564/1278] opt.close_on_exit --- lua/kide/core/utils/maven.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lua/kide/core/utils/maven.lua b/lua/kide/core/utils/maven.lua index 6579aa1a..e4525a61 100644 --- a/lua/kide/core/utils/maven.lua +++ b/lua/kide/core/utils/maven.lua @@ -35,7 +35,7 @@ local exec = function(cmd, pom, opt) close_on_exit = opt.close_on_exit, auto_scroll = true, on_exit = function(_) - if opt.update ~= nil and opt.update then + if opt.update ~= nil and opt.update and opt.close_on_exit ~= nil and opt.close_on_exit then vim.defer_fn(function() local filetype = vim.api.nvim_buf_get_option(0, "filetype") if filetype == "java" then From 96268dfdd682a9b9890608084cf1efced353a22a Mon Sep 17 00:00:00 2001 From: luokai Date: Mon, 16 Jan 2023 14:27:24 +0800 Subject: [PATCH 0565/1278] python fmt --- lua/kide/lsp/utils/init.lua | 4 ++++ lua/kide/plugins/config/null-ls.lua | 3 +++ 2 files changed, 7 insertions(+) diff --git a/lua/kide/lsp/utils/init.lua b/lua/kide/lsp/utils/init.lua index c42ecc82..43999ea6 100644 --- a/lua/kide/lsp/utils/init.lua +++ b/lua/kide/lsp/utils/init.lua @@ -72,6 +72,10 @@ format_lsp_mapping["go"] = "null-ls" format_lsp_mapping["c"] = "clangd" format_lsp_mapping["cpp"] = "clangd" + +-- black +format_lsp_mapping["python"] = "null-ls" + M.filter_format_lsp_client = function(client, bufnr) local filetype = vim.api.nvim_buf_get_option(bufnr, "filetype") local cn = format_lsp_mapping[filetype] diff --git a/lua/kide/plugins/config/null-ls.lua b/lua/kide/plugins/config/null-ls.lua index afcaabed..4f9aad2f 100644 --- a/lua/kide/plugins/config/null-ls.lua +++ b/lua/kide/plugins/config/null-ls.lua @@ -79,6 +79,9 @@ local sources = { -- }, -- }), null_ls.builtins.formatting.nginx_beautifier, + + -- python + null_ls.builtins.formatting.black, } local lsp_formatting = function(bufnr) From bc94ebe41f95b967389d3643567d3790bdfe7d1d Mon Sep 17 00:00:00 2001 From: luokai Date: Wed, 18 Jan 2023 09:39:29 +0800 Subject: [PATCH 0566/1278] PMD_ENABLE --- lua/kide/plugins/config/null-ls.lua | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/lua/kide/plugins/config/null-ls.lua b/lua/kide/plugins/config/null-ls.lua index 4f9aad2f..f9178381 100644 --- a/lua/kide/plugins/config/null-ls.lua +++ b/lua/kide/plugins/config/null-ls.lua @@ -120,6 +120,17 @@ if "1" == os.getenv("SEMGREP_ENABLE") then }) ) end +if "1" == os.getenv("PMD_ENABLE") then + table.insert( + sources, + null_ls.builtins.diagnostics.pmd.with({ + extra_args = { + "--rulesets", + "category/java/bestpractices.xml,category/jsp/bestpractices.xml", + }, + }) + ) +end null_ls.setup({ sources = sources, From ed0bb972e1a5eba277deef5b131a3fd5ba50236d Mon Sep 17 00:00:00 2001 From: luokai Date: Mon, 30 Jan 2023 13:04:53 +0800 Subject: [PATCH 0567/1278] dapui --- lua/kide/plugins/config/nvim-dap.lua | 40 +++++++--------------------- 1 file changed, 10 insertions(+), 30 deletions(-) diff --git a/lua/kide/plugins/config/nvim-dap.lua b/lua/kide/plugins/config/nvim-dap.lua index 85cf88da..50c7409e 100644 --- a/lua/kide/plugins/config/nvim-dap.lua +++ b/lua/kide/plugins/config/nvim-dap.lua @@ -8,39 +8,19 @@ local dap = require("dap") local dapui = require("dapui") dapui.setup({ icons = { expanded = "", collapsed = "", current_frame = "" }, - layouts = { - { - elements = { - "scopes", - "breakpoints", - "stacks", - "watches", - }, - size = 40, - position = "left", - }, - { - elements = { - "repl", - -- 'console', - }, - size = 0.25, - position = "bottom", - }, - }, }) -dap.defaults.fallback.terminal_win_cmd = "belowright 12new | set filetype=dap-terminal" +-- dap.defaults.fallback.terminal_win_cmd = "belowright 12new | set filetype=dap-terminal" --- dap.listeners.after.event_initialized["dapui_config"] = function() --- dapui.open() --- end --- dap.listeners.before.event_terminated["dapui_config"] = function() --- dapui.close() --- end --- dap.listeners.before.event_exited["dapui_config"] = function() --- dapui.close() --- end +dap.listeners.after.event_initialized["dapui_config"] = function() + dapui.open() +end +dap.listeners.before.event_terminated["dapui_config"] = function() + dapui.close() +end +dap.listeners.before.event_exited["dapui_config"] = function() + dapui.close() +end -- vim.fn.sign_define('DapBreakpoint', { text = '🔴', texthl = '', linehl = '', numhl = '' }) vim.fn.sign_define("DapBreakpoint", { text = "", texthl = "Debug", linehl = "", numhl = "" }) From e1e7544770267acf1341f54e8fa2dd6753e94b3d Mon Sep 17 00:00:00 2001 From: luokai Date: Fri, 3 Feb 2023 10:50:55 +0800 Subject: [PATCH 0568/1278] dapui --- lua/kide/plugins/config/nvim-dap.lua | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/lua/kide/plugins/config/nvim-dap.lua b/lua/kide/plugins/config/nvim-dap.lua index 50c7409e..c153c326 100644 --- a/lua/kide/plugins/config/nvim-dap.lua +++ b/lua/kide/plugins/config/nvim-dap.lua @@ -8,6 +8,31 @@ local dap = require("dap") local dapui = require("dapui") dapui.setup({ icons = { expanded = "", collapsed = "", current_frame = "" }, + layouts = { + { + -- You can change the order of elements in the sidebar + elements = { + -- Provide IDs as strings or tables with "id" and "size" keys + { + id = "scopes", + size = 0.25, -- Can be float or integer > 1 + }, + { id = "breakpoints", size = 0.25 }, + { id = "stacks", size = 0.25 }, + { id = "watches", size = 0.25 }, + }, + size = 40, + position = "left", + }, + { + elements = { + { id = "console", size = 0.5 }, + { id = "repl", size = 0.5 }, + }, + size = 12, + position = "bottom", + }, + }, }) -- dap.defaults.fallback.terminal_win_cmd = "belowright 12new | set filetype=dap-terminal" From 8313e822e852b7e0ed199db7f5c19e463a5f378d Mon Sep 17 00:00:00 2001 From: luokai Date: Sat, 4 Feb 2023 00:35:00 +0800 Subject: [PATCH 0569/1278] dap-ui --- lua/kide/plugins/config/nvim-dap.lua | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/lua/kide/plugins/config/nvim-dap.lua b/lua/kide/plugins/config/nvim-dap.lua index c153c326..f2ee6fc8 100644 --- a/lua/kide/plugins/config/nvim-dap.lua +++ b/lua/kide/plugins/config/nvim-dap.lua @@ -26,16 +26,16 @@ dapui.setup({ }, { elements = { - { id = "console", size = 0.5 }, - { id = "repl", size = 0.5 }, + { id = "repl", size = 1 }, + -- { id = "console", size = 0.5 }, }, - size = 12, + size = 0.25, position = "bottom", }, }, }) --- dap.defaults.fallback.terminal_win_cmd = "belowright 12new | set filetype=dap-terminal" +dap.defaults.fallback.terminal_win_cmd = "belowright 12new | set filetype=dap-terminal" dap.listeners.after.event_initialized["dapui_config"] = function() dapui.open() From 6fd9d6cce482014a276a361f03849e165d313b8c Mon Sep 17 00:00:00 2001 From: luokai Date: Mon, 6 Feb 2023 10:03:44 +0800 Subject: [PATCH 0570/1278] DIAGNOSTICS_ON_SAVE --- lua/kide/plugins/config/null-ls.lua | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lua/kide/plugins/config/null-ls.lua b/lua/kide/plugins/config/null-ls.lua index f9178381..1e57cd0b 100644 --- a/lua/kide/plugins/config/null-ls.lua +++ b/lua/kide/plugins/config/null-ls.lua @@ -117,6 +117,7 @@ if "1" == os.getenv("SEMGREP_ENABLE") then null_ls.builtins.diagnostics.semgrep.with({ filetypes = { "java" }, extra_args = { "--config", os.getenv("SEMGREP_RULES_PATH") .. "/java" }, + method = null_ls.methods.DIAGNOSTICS_ON_SAVE, }) ) end @@ -128,6 +129,7 @@ if "1" == os.getenv("PMD_ENABLE") then "--rulesets", "category/java/bestpractices.xml,category/jsp/bestpractices.xml", }, + method = null_ls.methods.DIAGNOSTICS_ON_SAVE, }) ) end From 2e74bfb950f0432957e915c6d86b0c2b5ec864fc Mon Sep 17 00:00:00 2001 From: luokai Date: Mon, 6 Feb 2023 13:38:50 +0800 Subject: [PATCH 0571/1278] debugprint --- lua/kide/plugins/init.lua | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/lua/kide/plugins/init.lua b/lua/kide/plugins/init.lua index d8b17667..f6b0a2a6 100644 --- a/lua/kide/plugins/init.lua +++ b/lua/kide/plugins/init.lua @@ -899,6 +899,36 @@ require("packer").startup({ }, }) + -- debugprint + use({ + "andrewferrier/debugprint.nvim", + opt = true, + ft = { + "bash", + "c", + "cpp", + "cs", + "dart", + "dockerfile", + "go", + "java", + "javascript", + "lua", + "make", + "php", + "python", + "ruby", + "rust", + "sh", + "typescript", + "vim", + "zsh", + }, + config = function() + require("debugprint").setup() + end, + }) + if bootstrap then require("packer").sync() end From 04405fea12f4db092e6a757e57ea5f0fd986975c Mon Sep 17 00:00:00 2001 From: luokai Date: Mon, 6 Feb 2023 14:53:54 +0800 Subject: [PATCH 0572/1278] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E6=8F=8F=E8=BF=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 52 +++++++++++++++++++++++++++++----------------------- 1 file changed, 29 insertions(+), 23 deletions(-) diff --git a/README.md b/README.md index bf47586a..d443fc68 100644 --- a/README.md +++ b/README.md @@ -24,29 +24,35 @@ git clone https://github.com/JavaHello/nvim.git ## 快捷键 -| 功能 | 按键 | -| :------------------: | :------------------: | -| 文件管理 | `e` | -| 文件搜索 | `ff` | -| 全局搜索 | `fg` | -| 全局搜索替换 | `fr` | -| 搜索 symbols | `fs` | -| Git 操作 | `:Neogit` | -| Outline | `o` | -| 查看实现 | `gi` | -| 查看引用 | `gr` | -| 查看声明 | `gd` | -| 格式化(LSP 提供支持) | `=` | -| 重命名 | `rn` | -| Code Action | `ca` | -| Debug | `F5`or`:DapContinue` | -| 断点 | `db` | -| 翻译 en->zh | `tz` | -| 翻译 zh->en | `te` | -| 内置终端 | `:ToggleTerm` | -| Tasks 列表 | `ts` | -| 代码折叠 | `zc` | -| 代码展开 | `zo`or`l` | +| 功能 | 模式 | 按键 | +| :-----------------------------: | :------------------: | :-----------------------: | +| 文件管理 | `Normal` | `e` | +| 文件搜索 | `Normal` | `ff` | +| 全局搜索 | `Normal` or `Visual` | `fg` | +| 全局搜索替换 | `Normal` or `Visual` | `fr` | +| 搜索 symbols | `Normal` or `Visual` | `fs` | +| Git 操作 | `Command` | `:Neogit` or `:Git` | +| Outline | `Normal` | `o` | +| 查看实现 | `Normal` | `gi` | +| 查看引用 | `Normal` | `gr` | +| 查看声明 | `Normal` | `gd` | +| 格式化(LSP 提供支持) | `Normal` or `Visual` | `=` | +| 重命名 | `Normal` | `rn` | +| Code Action | `Normal` | `ca` | +| Debug | `Normal` | `F5` or `:DapContinue` | +| 断点 | `Normal` | `db` | +| 翻译 en->zh | `Normal` or `Visual` | `tz` | +| 翻译 zh->en | `Normal` or `Visual` | `te` | +| 内置终端 | `Command` | `:ToggleTerm` | +| Tasks 列表 | `Normal` | `ts` | +| 代码折叠 | `Normal` | `zc` | +| 代码展开 | `Normal` | `zo` | +| Java: Junit Test Method | `Normal` | `dm` | +| Java: Junit Test Class | `Normal` | `dc` | +| Run Last | `Normal` | `dl` | +| Java: 更新项目配置 | `Command` | `:JdtUpdateConfig` | +| Java: 刷新 Main 方法 Debug 配置 | `Command` | `:JdtRefreshDebugConfigs` | +| Java: 预览项目依赖 | `Command` | `:JavaProjects` | 更多配置参考 [keybindings](./lua/kide/core/keybindings.lua) 文件 From 8a0235c219f8b9206dffd0581b4d9e1bc729ec07 Mon Sep 17 00:00:00 2001 From: luokai Date: Sat, 11 Feb 2023 01:14:46 +0800 Subject: [PATCH 0573/1278] lazy-nvim --- .gitignore | 1 + ftplugin/alpha.lua | 1 + lua/kide/core/keybindings.lua | 7 +- lua/kide/lsp/init.lua | 1 + lua/kide/plugins/config/alpha-nvim.lua | 35 +- lua/kide/plugins/config/luasnip.lua | 2 +- lua/kide/plugins/config/nvim-tree.lua | 2 - lua/kide/plugins/config/telescope.lua | 5 + lua/kide/plugins/init.lua | 915 +------------------------ lua/kide/plugins/lazy-nvim.lua | 648 +++++++++++++++++ lua/lazy_bootstrap.lua | 12 + lua/packer_bootstrap.lua | 15 - 12 files changed, 684 insertions(+), 960 deletions(-) create mode 100644 ftplugin/alpha.lua create mode 100644 lua/kide/plugins/lazy-nvim.lua create mode 100644 lua/lazy_bootstrap.lua delete mode 100644 lua/packer_bootstrap.lua diff --git a/.gitignore b/.gitignore index 61533499..3dee5639 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ .netrwhist .luarc.json plugin +lazy-lock.json diff --git a/ftplugin/alpha.lua b/ftplugin/alpha.lua new file mode 100644 index 00000000..4911e28c --- /dev/null +++ b/ftplugin/alpha.lua @@ -0,0 +1 @@ +vim.opt_local.foldenable = false diff --git a/lua/kide/core/keybindings.lua b/lua/kide/core/keybindings.lua index c1bb3c08..113f4ebe 100644 --- a/lua/kide/core/keybindings.lua +++ b/lua/kide/core/keybindings.lua @@ -144,6 +144,9 @@ nnoremap l -- ToggleTask map("n", "ts", "Telescope toggletasks spawn", opt) + + -- nvimTree + map("n", "e", ":NvimTreeToggle", opt) end -- lsp 回调函数快捷键设置 M.maplsp = function(client, buffer) @@ -332,8 +335,4 @@ M.ufo_mapkey = function() vim.keymap.set("n", "zM", require("ufo").closeAllFolds) end -M.nvim_tree = function() - -- nvimTree - map("n", "e", ":NvimTreeToggle", opt) -end return M diff --git a/lua/kide/lsp/init.lua b/lua/kide/lsp/init.lua index 6377211c..8b1ceb9c 100644 --- a/lua/kide/lsp/init.lua +++ b/lua/kide/lsp/init.lua @@ -29,6 +29,7 @@ local capabilities = require("cmp_nvim_lsp").default_capabilities(vim.lsp.protoc -- capabilities.textDocument.completion.completionItem.snippetSupport = true local utils = require("kide.core.utils") +require("fidget").setup({}) require("mason-lspconfig").setup_handlers({ -- The first entry (without a key) will be the default handler -- and will be called for each installed server that doesn't have diff --git a/lua/kide/plugins/config/alpha-nvim.lua b/lua/kide/plugins/config/alpha-nvim.lua index dcdbfaa4..b8fee2d3 100644 --- a/lua/kide/plugins/config/alpha-nvim.lua +++ b/lua/kide/plugins/config/alpha-nvim.lua @@ -1,42 +1,27 @@ local alpha = require("alpha") local dashboard = require("alpha.themes.dashboard") -local ascli = require("kide.plugins.config.ascli-header") +-- local ascli = require("kide.plugins.config.ascli-header") -dashboard.leader = "\\" -- Set header -- dashboard.section.header.val = ascli[math.random(0, #ascli)] -dashboard.section.header.val = ascli[33] +dashboard.section.header.val = { + " ███╗ ██╗ ███████╗ ██████╗ ██╗ ██╗ ██╗ ███╗ ███╗", + " ████╗ ██║ ██╔════╝██╔═══██╗ ██║ ██║ ██║ ████╗ ████║", + " ██╔██╗ ██║ █████╗ ██║ ██║ ██║ ██║ ██║ ██╔████╔██║", + " ██║╚██╗██║ ██╔══╝ ██║ ██║ ╚██╗ ██╔╝ ██║ ██║╚██╔╝██║", + " ██║ ╚████║ ███████╗╚██████╔╝ ╚████╔╝ ██║ ██║ ╚═╝ ██║", + " ╚═╝ ╚═══╝ ╚══════╝ ╚═════╝ ╚═══╝ ╚═╝ ╚═╝ ╚═╝", +} local opt = { noremap = true, silent = true } -- Set menu dashboard.section.buttons.val = { dashboard.button(" ff", " Find File", ":Telescope find_files", opt), dashboard.button(" fg", " Find Word ", ":Telescope live_grep", opt), - dashboard.button(" fp", " Recent Projects", ":Telescope projects", opt), + dashboard.button(" fp", " Recent Projects", ":Telescope project", opt), dashboard.button(" fo", " Recent File", ":Telescope oldfiles", opt), dashboard.button(" ns", " Settings", ":e $MYVIMRC | :cd %:p:h ", opt), dashboard.button(" q ", " Quit NVIM", ":qa", opt), } --- Set footer --- NOTE: This is currently a feature in my fork of alpha-nvim (opened PR #21, will update snippet if added to main) --- To see test this yourself, add the function as a dependecy in packer and uncomment the footer lines --- ```init.lua --- return require('packer').startup(function() --- use 'wbthomason/packer.nvim' --- use { --- 'goolord/alpha-nvim', branch = 'feature/startify-fortune', --- requires = {'BlakeJC94/alpha-nvim-fortune'}, --- config = function() require("config.alpha") end --- } --- end) --- ``` --- local fortune = require("alpha.fortune") --- dashboard.section.footer.val = fortune() - -- Send config to alpha alpha.setup(dashboard.opts) - --- Disable folding on alpha buffer -vim.cmd([[ - autocmd FileType alpha setlocal nofoldenable -]]) diff --git a/lua/kide/plugins/config/luasnip.lua b/lua/kide/plugins/config/luasnip.lua index 7ee923b1..73574b89 100644 --- a/lua/kide/plugins/config/luasnip.lua +++ b/lua/kide/plugins/config/luasnip.lua @@ -61,7 +61,7 @@ ls.config.set_config({ -- `nvim-treesitter/nvim-treesitter`). This allows correctly resolving -- the current filetype in eg. a markdown-code block or `vim.cmd()`. ft_func = function() - return vim.split(vim.bo.filetype, ".", true) + return vim.split(vim.bo.filetype, ".", { plain = true }) end, }) diff --git a/lua/kide/plugins/config/nvim-tree.lua b/lua/kide/plugins/config/nvim-tree.lua index c8f72259..8472eb39 100644 --- a/lua/kide/plugins/config/nvim-tree.lua +++ b/lua/kide/plugins/config/nvim-tree.lua @@ -106,5 +106,3 @@ require("nvim-tree").setup({ -- }, -- } --- nvimTree -require("kide.core.keybindings").nvim_tree() diff --git a/lua/kide/plugins/config/telescope.lua b/lua/kide/plugins/config/telescope.lua index 9fc899df..28e77717 100644 --- a/lua/kide/plugins/config/telescope.lua +++ b/lua/kide/plugins/config/telescope.lua @@ -153,3 +153,8 @@ vim.api.nvim_create_autocmd("BufRead", { }) end, }) + +require("telescope").load_extension("project") +require("telescope").load_extension("ui-select") +require("telescope").load_extension("fzf") +require("telescope").load_extension("env") diff --git a/lua/kide/plugins/init.lua b/lua/kide/plugins/init.lua index d8b17667..e84335cb 100644 --- a/lua/kide/plugins/init.lua +++ b/lua/kide/plugins/init.lua @@ -1,916 +1,5 @@ -local bootstrap = require("packer_bootstrap") -vim.cmd("packadd packer.nvim") - -require("packer").startup({ - function(use) - -- Packer can manage itself - use("wbthomason/packer.nvim") - use({ - "nvim-lua/plenary.nvim", - module = "plenary", - opt = true, - }) - - use({ - "kyazdani42/nvim-web-devicons", - module = "nvim-web-devicons", - opt = true, - }) - use({ - "williamboman/mason.nvim", - opt = true, - module = "mason", - setup = function() - require("kide.core.layz_load").async_load("mason.nvim") - end, - config = function() - require("kide.plugins.config.mason-nvim") - end, - }) - use({ - "williamboman/mason-lspconfig.nvim", - after = "mason.nvim", - module = "mason-lspconfig", - opt = true, - setup = function() - require("kide.core.layz_load").async_load("mason-lspconfig.nvim") - end, - }) - use({ - "neovim/nvim-lspconfig", - after = "mason-lspconfig.nvim", - module = "lspconfig", - setup = function() - require("kide.core.layz_load").async_load("nvim-lspconfig") - end, - config = function() - require("kide.lsp") - end, - }) - - -- 代码片段 - use({ - "rafamadriz/friendly-snippets", - event = "InsertEnter", - }) - -- nvim-cmp - use({ - "hrsh7th/nvim-cmp", - module = "cmp", - after = "friendly-snippets", - }) - -- LuaSnip - use({ - "L3MON4D3/LuaSnip", - module = "luasnip", - wants = "friendly-snippets", - after = "nvim-cmp", - config = function() - require("kide.plugins.config.luasnip") - end, - }) - use({ - "saadparwaiz1/cmp_luasnip", - after = "LuaSnip", - }) - - use({ - "hrsh7th/cmp-nvim-lsp", - module = "cmp_nvim_lsp", - after = "cmp_luasnip", - }) - use({ - "hrsh7th/cmp-buffer", - after = "cmp-nvim-lsp", - }) - use({ - "hrsh7th/cmp-path", - after = "cmp-buffer", - }) - -- lspkind - use({ - "onsails/lspkind-nvim", - after = "cmp-path", - config = function() - require("kide.plugins.config.nvim-cmp") - end, - }) - -- use 'hrsh7th/cmp-cmdline' -- { name = 'cmdline' } - - -- vsnip - -- use 'hrsh7th/cmp-vsnip' -- { name = 'vsnip' } - -- use 'hrsh7th/vim-vsnip' - - -- lsp 相关 - -- use 'folke/lsp-colors.nvim' - -- use("folke/trouble.nvim") - - -- java 不友好 - -- use({ "glepnir/lspsaga.nvim", branch = "main" }) - -- use 'arkav/lualine-lsp-progress' - -- use 'nvim-lua/lsp-status.nvim' - - -- use 'ray-x/lsp_signature.nvim' - - -- use 'RishabhRD/popfix' - -- use 'RishabhRD/nvim-lsputils' - - use({ - "jose-elias-alvarez/null-ls.nvim", - opt = true, - setup = function() - -- on_file_open("null-ls.nvim") - require("kide.core.layz_load").async_load("null-ls.nvim") - end, - config = function() - require("kide.plugins.config.null-ls") - end, - requires = { "nvim-lua/plenary.nvim" }, - }) - - -- 主题 - -- use 'morhetz/gruvbox' - use({ - "ellisonleao/gruvbox.nvim", - opt = true, - module = "gruvbox", - setup = function() - require("kide.core.layz_load").sync_load("gruvbox.nvim") - end, - config = function() - require("kide.plugins.config.gruvbox") - end, - }) - -- use 'sainnhe/gruvbox-material' - - -- 文件管理 - use({ - "kyazdani42/nvim-tree.lua", - requires = { - "kyazdani42/nvim-web-devicons", -- optional, for file icon - }, - opt = true, - tag = "nightly", - setup = function() - require("kide.core.layz_load").async_load("nvim-tree.lua") - end, - config = function() - require("kide.plugins.config.nvim-tree") - end, - }) - - -- using packer.nvim - use({ - "akinsho/bufferline.nvim", - opt = true, - tag = "v2.*", - wants = "gruvbox.nvim", - after = "gruvbox.nvim", - requires = "kyazdani42/nvim-web-devicons", - setup = function() - require("kide.core.layz_load").sync_load("bufferline.nvim") - end, - config = function() - require("kide.plugins.config.bufferline") - end, - }) - - -- treesitter (新增) - use({ - "nvim-treesitter/nvim-treesitter", - module = "nvim-treesitter", - wants = "gruvbox.nvim", - after = "gruvbox.nvim", - run = ":TSUpdate", - config = function() - require("kide.plugins.config.nvim-treesitter") - end, - }) - use({ - "nvim-treesitter/nvim-treesitter-textobjects", - opt = true, - after = "nvim-treesitter", - setup = function() - require("kide.core.layz_load").sync_load("nvim-treesitter-textobjects") - end, - }) - use({ - "nvim-treesitter/nvim-treesitter-context", - opt = true, - after = "nvim-treesitter", - setup = function() - require("kide.core.layz_load").async_load("nvim-treesitter-context") - end, - config = function() - require("kide.plugins.config.nvim-treesitter-context") - end, - }) - - -- java - use({ - "mfussenegger/nvim-jdtls", - opt = true, - ft = "java", - setup = function() - -- 不加载 nvim-jdtls.vim - vim.g.nvim_jdtls = 1 - end, - config = function() - require("kide.lsp.java").setup() - end, - }) - use({ - "JavaHello/java-deps.nvim", - opt = true, - after = "nvim-jdtls", - ft = { "java" }, - config = function() - require("java-deps").setup() - end, - }) - -- use 'NiYanhhhhh/lighttree-java' - - -- debug - use({ - "mfussenegger/nvim-dap", - opt = true, - module = "dap", - }) - use({ - "rcarriga/nvim-dap-ui", - opt = true, - module = "dapui", - after = "nvim-dap", - }) - use({ - "theHamsta/nvim-dap-virtual-text", - after = "nvim-dap-ui", - setup = function() - require("kide.core.layz_load").async_load("nvim-dap-virtual-text") - end, - config = function() - require("kide.plugins.config.nvim-dap") - require("kide.dap") - end, - }) - - -- 搜索插件 - use({ - "nvim-telescope/telescope.nvim", - opt = true, - module = "telescope", - wants = "gruvbox.nvim", - after = "gruvbox.nvim", - tag = "0.1.x", - requires = { - "nvim-lua/plenary.nvim", - }, - config = function() - require("kide.plugins.config.telescope") - end, - }) - use({ - "nvim-telescope/telescope-ui-select.nvim", - after = "telescope.nvim", - setup = function() - require("kide.core.layz_load").async_load("telescope-ui-select.nvim") - end, - config = function() - require("telescope").load_extension("ui-select") - end, - }) - use({ - "nvim-telescope/telescope-fzf-native.nvim", - run = "make", - after = "telescope.nvim", - setup = function() - require("kide.core.layz_load").async_load("telescope-fzf-native.nvim") - end, - config = function() - require("telescope").load_extension("fzf") - end, - }) - use({ - "nvim-telescope/telescope-dap.nvim", - after = "telescope.nvim", - opt = true, - }) - - -- use 'GustavoKatel/telescope-asynctasks.nvim' - -- use 'aloussase/telescope-gradle.nvim' - -- use 'aloussase/telescope-mvnsearch' - use({ - "LinArcX/telescope-env.nvim", - opt = true, - after = "telescope.nvim", - setup = function() - require("kide.core.layz_load").async_load("telescope-env.nvim") - end, - config = function() - require("telescope").load_extension("env") - end, - }) - - -- git - use({ - "tpope/vim-fugitive", - opt = true, - cmd = { "Git" }, - }) - use({ - "sindrets/diffview.nvim", - opt = true, - module = "diffview", - cmd = { - "DiffviewClose", - "DiffviewFileHistory", - "DiffviewFocusFiles", - "DiffviewLog", - "DiffviewOpen", - "DiffviewRefresh", - "DiffviewToggleFiles", - }, - config = function() - require("kide.plugins.config.diffview-nvim") - end, - }) - use({ - "TimUntersberger/neogit", - after = "diffview.nvim", - opt = true, - cmd = "Neogit", - config = function() - require("kide.plugins.config.neogit") - end, - requires = "nvim-lua/plenary.nvim", - }) - - -- LeaderF - -- use 'Yggdroot/LeaderF' - - -- git edit 状态显示插件 - use({ - "lewis6991/gitsigns.nvim", - opt = true, - setup = function() - require("kide.core.layz_load").async_load("gitsigns.nvim") - end, - requires = { - "nvim-lua/plenary.nvim", - }, - config = function() - require("kide.plugins.config.gitsigns-nvim") - end, - }) - - -- 浮动窗口插件 - -- use 'voldikss/vim-floaterm' - -- use 'voldikss/LeaderF-floaterm' - use({ - "akinsho/toggleterm.nvim", - module = "toggleterm", - opt = true, - config = function() - require("toggleterm").setup({ - shade_terminals = true, - -- shade_filetypes = { "none", "fzf" }, - direction = "float", - close_on_exit = true, - float_opts = { - border = "double", - winblend = 0, - }, - }) - end, - }) - - -- 异步任务执行插件 - -- use 'skywind3000/asynctasks.vim' - -- use 'skywind3000/asyncrun.vim' - use({ - "jedrzejboczar/toggletasks.nvim", - opt = true, - after = "toggleterm.nvim", - setup = function() - require("kide.core.layz_load").async_load("toggletasks.nvim") - end, - requires = { - "nvim-lua/plenary.nvim", - "akinsho/toggleterm.nvim", - "nvim-telescope/telescope.nvim", - }, - config = function() - require("kide.plugins.config.toggletasks") - end, - }) - - -- 多光标插件 - use({ - "mg979/vim-visual-multi", - opt = true, - setup = function() - -- on_file_open("vim-visual-multi") - require("kide.core.layz_load").async_load("vim-visual-multi") - end, - }) - - -- 状态栏插件 - -- use 'feline-nvim/feline.nvim' - use({ - "nvim-lualine/lualine.nvim", - opt = true, - wants = "gruvbox.nvim", - after = "gruvbox.nvim", - setup = function() - require("kide.core.layz_load").sync_load("lualine.nvim") - end, - config = function() - require("kide.plugins.config.lualine") - end, - }) - - -- blankline - use({ - "lukas-reineke/indent-blankline.nvim", - opt = true, - setup = function() - -- on_file_open("indent-blankline.nvim") - require("kide.core.layz_load").async_load("indent-blankline.nvim") - end, - config = function() - require("kide.plugins.config.indent-blankline") - end, - }) - - -- <>()等匹配插件 - -- use({ - -- "andymass/vim-matchup", - -- opt = true, - -- after = "nvim-treesitter", - -- setup = function() - -- -- on_file_open("vim-matchup") - -- require("kide.core.layz_load").async_load("vim-matchup") - -- end, - -- }) - -- 大纲插件 - -- use 'liuchengxu/vista.vim' - use({ - "simrat39/symbols-outline.nvim", - opt = true, - cmd = { - "SymbolsOutline", - "SymbolsOutlineOpen", - "SymbolsOutlineClose", - }, - config = function() - require("kide.plugins.config.symbols-outline") - end, - }) - -- use { - -- 'stevearc/aerial.nvim', - -- } - - -- 消息通知 - use({ - "rcarriga/nvim-notify", - opt = true, - setup = function() - require("kide.core.layz_load").async_load("nvim-notify") - end, - config = function() - require("kide.plugins.config.nvim-notify") - end, - }) - - -- wildmenu 补全美化 - use({ - "gelguy/wilder.nvim", - opt = true, - setup = function() - require("kide.core.layz_load").async_load("wilder.nvim") - end, - config = function() - require("kide.plugins.config.wilder") - end, - }) - - -- 颜色显示 - use({ - "norcalli/nvim-colorizer.lua", - opt = true, - setup = function() - -- on_file_open("nvim-colorizer.lua") - require("kide.core.layz_load").async_load("nvim-colorizer.lua") - end, - config = function() - require("kide.plugins.config.nvim-colorizer") - end, - }) - - use({ - "numToStr/Comment.nvim", - opt = true, - keys = { "gc", "gb" }, - config = function() - require("kide.plugins.config.comment") - end, - }) - use({ - "danymat/neogen", - opt = true, - module = "neogen", - config = function() - require("kide.plugins.config.neogen") - end, - }) - - -- mackdown 预览插件 - use({ - "iamcco/markdown-preview.nvim", - opt = true, - ft = "markdown", - run = "cd app && yarn install", - config = function() - require("kide.plugins.config.markdown-preview") - end, - }) - -- mackdown cli 预览插件 - use({ - "ellisonleao/glow.nvim", - opt = true, - ft = "markdown", - config = function() - require("glow").setup({ - style = "dark", - width = 120, - }) - end, - }) - -- pandoc 命令插件(用于md转pdf) - use({ - "aspeddro/pandoc.nvim", - opt = true, - ft = "markdown", - config = function() - require("kide.plugins.config.pandoc") - end, - }) - -- 格式化插件 -> 使用 null-ls - -- use 'mhartington/formatter.nvim' - -- use 'sbdchd/neoformat' - - -- 快捷键查看 - use({ - "folke/which-key.nvim", - opt = true, - setup = function() - require("kide.core.layz_load").async_load("which-key.nvim") - end, - config = function() - require("kide.plugins.config.which-key") - end, - }) - - -- 仪表盘 - -- use {'glepnir/dashboard-nvim'} - use({ - "goolord/alpha-nvim", - opt = true, - requires = { "kyazdani42/nvim-web-devicons" }, - setup = function() - require("kide.core.layz_load").sync_load("alpha-nvim") - end, - config = function() - require("kide.plugins.config.alpha-nvim") - end, - }) - - -- 翻译插件 - -- use 'voldikss/vim-translator' - use({ - "uga-rosa/translate.nvim", - opt = true, - setup = function() - -- on_file_open("translate.nvim") - require("kide.core.layz_load").async_load("translate.nvim") - end, - config = function() - require("kide.plugins.config.translate") - end, - }) - - -- 自动对齐插件 - use({ - "junegunn/vim-easy-align", - opt = true, - setup = function() - -- on_file_open("vim-easy-align") - require("kide.core.layz_load").async_load("vim-easy-align") - end, - }) - - -- 表格模式插件 - use({ - "dhruvasagar/vim-table-mode", - opt = true, - cmd = { "TableModeEnable" }, - }) - - -- () 自动补全 - use({ - "windwp/nvim-autopairs", - opt = true, - after = "nvim-cmp", - setup = function() - require("kide.core.layz_load").async_load("nvim-autopairs") - end, - config = function() - require("kide.plugins.config.nvim-autopairs") - end, - }) - - -- 任务插件 - use({ - "itchyny/calendar.vim", - opt = true, - cmd = { - "Calendar", - }, - }) - - -- rust - use({ - "simrat39/rust-tools.nvim", - opt = true, - module = "rust-tools", - }) - - -- use "Pocco81/AutoSave.nvim" - - use({ - "NTBBloodbath/rest.nvim", - ft = "http", - opt = true, - requires = { - "nvim-lua/plenary.nvim", - }, - config = function() - vim.cmd([[ - function! s:http_rest_init() abort - lua require('kide.plugins.config.rest-nvim') - lua require('kide.core.keybindings').rest_nvim() - endfunction - augroup http_rest - autocmd! - autocmd FileType http call s:http_rest_init() - augroup end - ]]) - end, - }) - - -- 选中高亮插件 - use({ - "RRethy/vim-illuminate", - opt = true, - setup = function() - require("kide.core.layz_load").async_load("vim-illuminate") - end, - config = function() - require("kide.plugins.config.vim-illuminate") - end, - }) - - -- 快速跳转 - use({ - "ggandor/leap.nvim", - opt = true, - setup = function() - require("kide.core.layz_load").async_load("leap.nvim") - end, - config = function() - require("leap").add_default_mappings() - require("leap").opts.safe_labels = {} - vim.keymap.del({ "x", "o" }, "x") - vim.keymap.del({ "x", "o" }, "X") - end, - }) - - -- LSP 进度 - use({ - "j-hui/fidget.nvim", - opt = true, - setup = function() - require("kide.core.layz_load").async_load("fidget.nvim") - end, - config = function() - require("fidget").setup({}) - end, - }) - - -- 查找替换 - use({ - "windwp/nvim-spectre", - opt = true, - setup = function() - -- on_file_open("nvim-spectre") - require("kide.core.layz_load").async_load("nvim-spectre") - end, - config = function() - require("spectre").setup() - end, - }) - - -- ASCII 图 - use({ - "jbyuki/venn.nvim", - opt = true, - cmd = { "VBox" }, - }) - - use({ - "tversteeg/registers.nvim", - opt = true, - cmd = { "Registers" }, - keys = '"', - }) - - -- databases - use({ - "nanotee/sqls.nvim", - ft = { "sql", "mysql" }, - opt = true, - }) - use({ - "tpope/vim-dadbod", - opt = true, - }) - use({ - "kristijanhusak/vim-dadbod-ui", - opt = true, - wants = "vim-dadbod", - after = "vim-dadbod", - cmd = { - "DBUI", - "DBUIToggle", - }, - setup = function() - require("kide.plugins.config.vim-dadbod") - end, - }) - - -- 项目管理 - use({ - "ahmedkhalf/project.nvim", - opt = true, - setup = function() - require("kide.core.layz_load").async_load("project.nvim") - end, - config = function() - require("project_nvim").setup({}) - require("telescope").load_extension("projects") - end, - }) - - use({ - "aklt/plantuml-syntax", - opt = true, - ft = "plantuml", - }) - - -- UI 美化 - -- use({ - -- "stevearc/dressing.nvim", - -- opt = true, - -- module = "dressing", - -- config = function() - -- require("kide.plugins.config.dressing-nvim") - -- end, - -- }) - - -- 浏览器搜索 - use({ - "lalitmee/browse.nvim", - opt = true, - cmd = { - "Browse", - }, - config = function() - require("kide.plugins.config.browse-nvim") - end, - }) - - -- 环绕输入 - use({ - "kylechui/nvim-surround", - opt = true, - setup = function() - require("kide.core.layz_load").async_load("nvim-surround") - end, - config = function() - require("nvim-surround").setup({ - -- Configuration here, or leave empty to use defaults - }) - end, - }) - - -- Create custom submodes and menus - use({ - "anuvyklack/hydra.nvim", - opt = true, - module = "hydra", - }) - - -- 代码状态栏导航 - use({ - "SmiteshP/nvim-navic", - opt = true, - module = "nvim-navic", - config = function() - require("kide.plugins.config.nvim-navic") - end, - }) - - -- markdown 背景设置 - -- use({ - -- "lukas-reineke/headlines.nvim", - -- opt = true, - -- ft = { "markdown", "norg", "org" }, - -- config = function() - -- require("headlines").setup() - -- end, - -- }) - - -- 笔记 - use({ - "mickael-menu/zk-nvim", - opt = true, - cmd = { - "ZkIndex", - "ZkNew", - "ZkNotes", - }, - config = function() - require("kide.plugins.config.zk-nvim") - end, - }) - - -- 折叠 - use({ - "kevinhwang91/promise-async", - opt = true, - module = "promise", - }) - use({ - "kevinhwang91/nvim-ufo", - opt = true, - require = "kevinhwang91/promise-async", - after = "promise-async", - setup = function() - require("kide.core.layz_load").async_load("nvim-ufo") - end, - config = function() - require("kide.plugins.config.nvim-ufo") - end, - }) - - -- ui - use({ - "MunifTanjim/nui.nvim", - opt = true, - module = "nui", - }) - - -- chatgpt - use({ - "jackMort/ChatGPT.nvim", - opt = true, - cmd = { - "ChatGPT", - }, - config = function() - require("chatgpt").setup({ - -- optional configuration - }) - end, - requires = { - "MunifTanjim/nui.nvim", - "nvim-lua/plenary.nvim", - "nvim-telescope/telescope.nvim", - }, - }) - - if bootstrap then - require("packer").sync() - end - end, - config = { - display = { - open_fn = require("packer.util").float, - }, - max_jobs = 10, - }, -}) - +require("lazy_bootstrap") +require("kide.plugins.lazy-nvim") vim.schedule(function() require("kide.core.keybindings").setup() end) diff --git a/lua/kide/plugins/lazy-nvim.lua b/lua/kide/plugins/lazy-nvim.lua new file mode 100644 index 00000000..f186170d --- /dev/null +++ b/lua/kide/plugins/lazy-nvim.lua @@ -0,0 +1,648 @@ +require("lazy").setup({ + + { + "nvim-lua/plenary.nvim", + lazy = true, + }, + + { + "kyazdani42/nvim-web-devicons", + lazy = true, + }, + { + "williamboman/mason.nvim", + lazy = true, + cmd = { "Mason", "MasonInstall", "MasonLog", "MasonUninstall" }, + config = function() + require("kide.plugins.config.mason-nvim") + end, + }, + { + "williamboman/mason-lspconfig.nvim", + lazy = true, + }, + { + "neovim/nvim-lspconfig", + event = { "BufReadPost" }, + config = function() + require("kide.lsp") + end, + }, + + -- 代码片段 + { + "rafamadriz/friendly-snippets", + event = { "InsertEnter" }, + lazy = true, + }, + -- nvim-cmp + { + "hrsh7th/nvim-cmp", + event = { "InsertEnter" }, + lazy = true, + config = function() + require("kide.plugins.config.nvim-cmp") + end, + }, + -- LuaSnip + { + "L3MON4D3/LuaSnip", + lazy = true, + event = { "InsertEnter" }, + dependencies = { "friendly-snippets" }, + config = function() + require("kide.plugins.config.luasnip") + end, + }, + { + "saadparwaiz1/cmp_luasnip", + dependencies = { "LuaSnip" }, + event = { "InsertEnter" }, + lazy = true, + }, + -- lspkind + { + "onsails/lspkind-nvim", + lazy = true, + event = { "InsertEnter" }, + }, + { + "hrsh7th/cmp-nvim-lsp", + lazy = true, + event = { "InsertEnter" }, + }, + { + "hrsh7th/cmp-buffer", + lazy = true, + event = { "InsertEnter" }, + }, + { + "hrsh7th/cmp-path", + lazy = true, + event = { "InsertEnter" }, + }, + + { + "jose-elias-alvarez/null-ls.nvim", + lazy = true, + event = { "BufReadPost" }, + config = function() + require("kide.plugins.config.null-ls") + end, + }, + + -- 主题 + -- use 'morhetz/gruvbox' + { + "ellisonleao/gruvbox.nvim", + priority = 100, + config = function() + require("kide.plugins.config.gruvbox") + end, + }, + -- use 'sainnhe/gruvbox-material' + + -- 文件管理 + { + "kyazdani42/nvim-tree.lua", + lazy = true, + cmd = "NvimTreeToggle", + tag = "nightly", + config = function() + require("kide.plugins.config.nvim-tree") + end, + }, + + -- using packer.nvim + { + "akinsho/bufferline.nvim", + tag = "v3.0.1", + dependencies = { "gruvbox.nvim" }, + requires = "kyazdani42/nvim-web-devicons", + config = function() + require("kide.plugins.config.bufferline") + end, + }, + + -- treesitter (新增) + { + "nvim-treesitter/nvim-treesitter", + priority = 90, + dependencies = { "gruvbox.nvim" }, + build = ":TSUpdate", + config = function() + require("kide.plugins.config.nvim-treesitter") + end, + }, + { + "nvim-treesitter/nvim-treesitter-textobjects", + dependencies = { "nvim-treesitter" }, + }, + { + "nvim-treesitter/nvim-treesitter-context", + dependencies = { "nvim-treesitter" }, + config = function() + require("kide.plugins.config.nvim-treesitter-context") + end, + }, + + -- java + { + "mfussenegger/nvim-jdtls", + lazy = true, + ft = "java", + init = function() + -- 不加载 nvim-jdtls.vim + vim.g.nvim_jdtls = 1 + end, + config = function() + require("kide.lsp.java").setup() + end, + }, + { + "JavaHello/java-deps.nvim", + lazy = true, + ft = { "java" }, + config = function() + require("java-deps").setup() + end, + }, + + -- debug + { + "mfussenegger/nvim-dap", + lazy = true, + }, + { + "rcarriga/nvim-dap-ui", + lazy = true, + }, + { + "theHamsta/nvim-dap-virtual-text", + lazy = true, + config = function() + require("kide.plugins.config.nvim-dap") + require("kide.dap") + end, + }, + + -- 搜索插件 + { + "nvim-telescope/telescope.nvim", + lazy = true, + dependencies = { "gruvbox.nvim" }, + cmd = { "Telescope" }, + tag = "0.1.1", + config = function() + require("kide.plugins.config.telescope") + end, + }, + { + "nvim-telescope/telescope-ui-select.nvim", + lazy = true, + }, + { + "nvim-telescope/telescope-fzf-native.nvim", + build = "make", + lazy = true, + }, + { + "nvim-telescope/telescope-dap.nvim", + lazy = true, + }, + + { + "LinArcX/telescope-env.nvim", + lazy = true, + }, + -- 项目管理 + { + "nvim-telescope/telescope-project.nvim", + lazy = true, + }, + + -- git + { + "tpope/vim-fugitive", + layz = true, + cmd = { "Git" }, + }, + { + "sindrets/diffview.nvim", + layz = true, + cmd = { + "DiffviewClose", + "DiffviewFileHistory", + "DiffviewFocusFiles", + "DiffviewLog", + "DiffviewOpen", + "DiffviewRefresh", + "DiffviewToggleFiles", + }, + config = function() + require("kide.plugins.config.diffview-nvim") + end, + }, + { + "TimUntersberger/neogit", + layz = true, + cmd = "Neogit", + config = function() + require("kide.plugins.config.neogit") + end, + }, + + -- git edit 状态显示插件 + { + "lewis6991/gitsigns.nvim", + layz = true, + config = function() + require("kide.plugins.config.gitsigns-nvim") + end, + }, + + -- 浮动窗口插件 + { + "akinsho/toggleterm.nvim", + lazy = true, + cmd = { "ToggleTerm" }, + config = function() + require("toggleterm").setup({ + shade_terminals = true, + -- shade_filetypes = { "none", "fzf" }, + direction = "float", + close_on_exit = true, + float_opts = { + border = "double", + winblend = 0, + }, + }) + end, + }, + + -- 异步任务执行插件 + { + "jedrzejboczar/toggletasks.nvim", + lazy = true, + config = function() + require("kide.plugins.config.toggletasks") + end, + }, + + -- 多光标插件 + { + "mg979/vim-visual-multi", + lazy = true, + keys = { "" }, + }, + + -- 状态栏插件 + { + "nvim-lualine/lualine.nvim", + dependencies = { "gruvbox.nvim" }, + config = function() + require("kide.plugins.config.lualine") + end, + }, + + -- blankline + { + "lukas-reineke/indent-blankline.nvim", + event = { "BufReadPost" }, + config = function() + require("kide.plugins.config.indent-blankline") + end, + }, + + -- 大纲插件 + { + "simrat39/symbols-outline.nvim", + lazy = true, + cmd = { + "SymbolsOutline", + "SymbolsOutlineOpen", + "SymbolsOutlineClose", + }, + config = function() + require("kide.plugins.config.symbols-outline") + end, + }, + + -- 消息通知 + { + "rcarriga/nvim-notify", + config = function() + require("kide.plugins.config.nvim-notify") + end, + }, + + -- wildmenu 补全美化 + { + "gelguy/wilder.nvim", + config = function() + require("kide.plugins.config.wilder") + end, + }, + + -- 颜色显示 + { + "norcalli/nvim-colorizer.lua", + event = { "BufReadPost", "InsertEnter" }, + config = function() + require("kide.plugins.config.nvim-colorizer") + end, + }, + + { + "numToStr/Comment.nvim", + keys = { "gc", "gb" }, + config = function() + require("kide.plugins.config.comment") + end, + }, + { + "danymat/neogen", + lazy = true, + config = function() + require("kide.plugins.config.neogen") + end, + }, + + -- mackdown 预览插件 + { + "iamcco/markdown-preview.nvim", + lazy = true, + ft = "markdown", + build = "cd app && yarn install", + config = function() + require("kide.plugins.config.markdown-preview") + end, + }, + -- mackdown cli 预览插件 + { + "ellisonleao/glow.nvim", + lazy = true, + ft = "markdown", + config = function() + require("glow").setup({ + style = "dark", + width = 120, + }) + end, + }, + -- pandoc 命令插件(用于md转pdf) + { + "aspeddro/pandoc.nvim", + lazy = true, + ft = "markdown", + config = function() + require("kide.plugins.config.pandoc") + end, + }, + + -- 快捷键查看 + { + "folke/which-key.nvim", + config = function() + require("kide.plugins.config.which-key") + end, + }, + + -- 仪表盘 + { + "goolord/alpha-nvim", + config = function() + require("kide.plugins.config.alpha-nvim") + end, + }, + + -- 翻译插件 + { + "uga-rosa/translate.nvim", + lazy = true, + config = function() + require("kide.plugins.config.translate") + end, + }, + + -- 自动对齐插件 + { + "junegunn/vim-easy-align", + lazy = true, + }, + + -- 表格模式插件 + { + "dhruvasagar/vim-table-mode", + lazy = true, + cmd = { "TableModeEnable" }, + }, + + -- () 自动补全 + { + "windwp/nvim-autopairs", + event = { "InsertEnter" }, + config = function() + require("kide.plugins.config.nvim-autopairs") + end, + }, + + -- 任务插件 + { + "itchyny/calendar.vim", + lazy = true, + cmd = { + "Calendar", + }, + }, + + -- rust + { + "simrat39/rust-tools.nvim", + lazy = true, + }, + + { + "NTBBloodbath/rest.nvim", + lazy = true, + ft = "http", + config = function() + vim.cmd([[ + function! s:http_rest_init() abort + lua require('kide.plugins.config.rest-nvim') + lua require('kide.core.keybindings').rest_nvim() + endfunction + augroup http_rest + autocmd! + autocmd FileType http call s:http_rest_init() + augroup end + ]]) + end, + }, + + -- 选中高亮插件 + { + "RRethy/vim-illuminate", + lazy = true, + event = { "BufReadPost" }, + config = function() + require("kide.plugins.config.vim-illuminate") + end, + }, + + -- 快速跳转 + { + "ggandor/leap.nvim", + lazy = true, + keys = { "s", "S" }, + config = function() + require("leap").add_default_mappings() + require("leap").opts.safe_labels = {} + vim.keymap.del({ "x", "o" }, "x") + vim.keymap.del({ "x", "o" }, "X") + end, + }, + + -- LSP 进度 + { + "j-hui/fidget.nvim", + lazy = true, + config = function() + require("fidget").setup({}) + end, + }, + + -- 查找替换 + { + "windwp/nvim-spectre", + lazy = true, + config = function() + require("spectre").setup() + end, + }, + + -- ASCII 图 + { + "jbyuki/venn.nvim", + lazy = true, + cmd = { "VBox" }, + }, + + { + "tversteeg/registers.nvim", + lazy = true, + cmd = { "Registers" }, + keys = '"', + }, + + -- databases + { + "nanotee/sqls.nvim", + lazy = true, + ft = { "sql", "mysql" }, + }, + { + "tpope/vim-dadbod", + lazy = true, + }, + { + "kristijanhusak/vim-dadbod-ui", + lazy = true, + cmd = { + "DBUI", + "DBUIToggle", + }, + init = function() + require("kide.plugins.config.vim-dadbod") + end, + }, + + { + "aklt/plantuml-syntax", + lazy = true, + ft = "plantuml", + }, + + -- 浏览器搜索 + { + "lalitmee/browse.nvim", + lazy = true, + cmd = { + "Browse", + }, + config = function() + require("kide.plugins.config.browse-nvim") + end, + }, + + -- 环绕输入 + { + "kylechui/nvim-surround", + lazy = true, + event = { "InsertEnter" }, + config = function() + require("nvim-surround").setup({}) + end, + }, + + -- Create custom submodes and menus + { + "anuvyklack/hydra.nvim", + lazy = true, + }, + + -- 代码状态栏导航 + { + "SmiteshP/nvim-navic", + lazy = true, + config = function() + require("kide.plugins.config.nvim-navic") + end, + }, + + -- 笔记 + { + "mickael-menu/zk-nvim", + lazy = true, + cmd = { + "ZkIndex", + "ZkNew", + "ZkNotes", + }, + config = function() + require("kide.plugins.config.zk-nvim") + end, + }, + + -- 折叠 + { + "kevinhwang91/promise-async", + lazy = true, + }, + { + "kevinhwang91/nvim-ufo", + lazy = true, + event = { "BufReadPost" }, + config = function() + require("kide.plugins.config.nvim-ufo") + end, + }, + + -- ui + { + "MunifTanjim/nui.nvim", + lazy = true, + }, + + -- chatgpt + { + "jackMort/ChatGPT.nvim", + lazy = true, + cmd = { + "ChatGPT", + }, + config = function() + require("chatgpt").setup({}) + end, + }, +}) diff --git a/lua/lazy_bootstrap.lua b/lua/lazy_bootstrap.lua new file mode 100644 index 00000000..d14f916e --- /dev/null +++ b/lua/lazy_bootstrap.lua @@ -0,0 +1,12 @@ +local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim" +if not vim.loop.fs_stat(lazypath) then + vim.fn.system({ + "git", + "clone", + "--filter=blob:none", + "https://github.com/folke/lazy.nvim.git", + "--branch=stable", -- latest stable release + lazypath, + }) +end +vim.opt.rtp:prepend(lazypath) diff --git a/lua/packer_bootstrap.lua b/lua/packer_bootstrap.lua deleted file mode 100644 index 60d869e5..00000000 --- a/lua/packer_bootstrap.lua +++ /dev/null @@ -1,15 +0,0 @@ -local fn = vim.fn -local install_path = fn.stdpath("data") .. "/site/pack/packer/start/packer.nvim" -if fn.empty(fn.glob(install_path)) > 0 then - vim.notify(install_path, vim.log.levels.INFO) - fn.system({ - "git", - "clone", - "--depth", - "1", - "https://github.com/wbthomason/packer.nvim", - install_path, - }) - return true -end -return false From a20e388c24b007d2f06726173c77c746ee066218 Mon Sep 17 00:00:00 2001 From: luokai Date: Sat, 11 Feb 2023 07:17:07 +0800 Subject: [PATCH 0574/1278] load --- lua/kide/plugins/lazy-nvim.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lua/kide/plugins/lazy-nvim.lua b/lua/kide/plugins/lazy-nvim.lua index f186170d..db39a618 100644 --- a/lua/kide/plugins/lazy-nvim.lua +++ b/lua/kide/plugins/lazy-nvim.lua @@ -23,7 +23,7 @@ require("lazy").setup({ }, { "neovim/nvim-lspconfig", - event = { "BufReadPost" }, + event = { "BufNewFile", "BufReadPost" }, config = function() require("kide.lsp") end, From 5e06475510ddecd9acfa67798610da5080563c97 Mon Sep 17 00:00:00 2001 From: luokai Date: Sat, 11 Feb 2023 07:57:00 +0800 Subject: [PATCH 0575/1278] layz config --- lua/kide/core/basic.lua | 3 ++- lua/kide/core/keybindings.lua | 5 +++-- lua/kide/plugins/lazy-nvim.lua | 26 +++++++++++++------------- 3 files changed, 18 insertions(+), 16 deletions(-) diff --git a/lua/kide/core/basic.lua b/lua/kide/core/basic.lua index 7a54eec0..96646ed1 100644 --- a/lua/kide/core/basic.lua +++ b/lua/kide/core/basic.lua @@ -125,11 +125,12 @@ vim.o.wildmenu = true vim.opt.confirm = true -- vim.g.python_host_prog='/opt/homebrew/bin/python3' -vim.g.python3_host_prog = "/opt/homebrew/bin/python3" +-- vim.g.python3_host_prog = "/opt/homebrew/bin/python3" vim.opt.list = true vim.opt.cul = true -- cursor line +vim.o.timeout = true vim.opt.timeoutlen = 450 vim.opt.mouse = "a" diff --git a/lua/kide/core/keybindings.lua b/lua/kide/core/keybindings.lua index 113f4ebe..f8be0306 100644 --- a/lua/kide/core/keybindings.lua +++ b/lua/kide/core/keybindings.lua @@ -112,7 +112,7 @@ nnoremap dl :lua require'dap'.run_last() -- nvim-dap-ui vim.cmd([[ -nnoremap dr :lua require("dapui").float_element(vim.Nil, { enter = true}) +nnoremap dr :lua require("dapui").float_element(vim.Nil, { enter = true}) ]]) -- bufferline.nvim @@ -263,7 +263,6 @@ end -- nvim-cmp 自动补全 M.cmp = function(cmp) local luasnip = require("luasnip") - local neogen = require("neogen") local has_words_before = function() local line, col = unpack(vim.api.nvim_win_get_cursor(0)) return col ~= 0 and vim.api.nvim_buf_get_lines(0, line - 1, line, true)[1]:sub(col, col):match("%s") == nil @@ -293,6 +292,7 @@ M.cmp = function(cmp) }), [""] = cmp.mapping(function(fallback) + local neogen = require("neogen") if cmp.visible() then cmp.select_next_item() elseif luasnip.expand_or_jumpable() then @@ -307,6 +307,7 @@ M.cmp = function(cmp) end, { "i", "s" }), [""] = cmp.mapping(function(fallback) + local neogen = require("neogen") if cmp.visible() then cmp.select_prev_item() elseif luasnip.jumpable(-1) then diff --git a/lua/kide/plugins/lazy-nvim.lua b/lua/kide/plugins/lazy-nvim.lua index db39a618..d0dc79d7 100644 --- a/lua/kide/plugins/lazy-nvim.lua +++ b/lua/kide/plugins/lazy-nvim.lua @@ -32,23 +32,12 @@ require("lazy").setup({ -- 代码片段 { "rafamadriz/friendly-snippets", - event = { "InsertEnter" }, - lazy = true, - }, - -- nvim-cmp - { - "hrsh7th/nvim-cmp", - event = { "InsertEnter" }, lazy = true, - config = function() - require("kide.plugins.config.nvim-cmp") - end, }, -- LuaSnip { "L3MON4D3/LuaSnip", lazy = true, - event = { "InsertEnter" }, dependencies = { "friendly-snippets" }, config = function() require("kide.plugins.config.luasnip") @@ -57,19 +46,26 @@ require("lazy").setup({ { "saadparwaiz1/cmp_luasnip", dependencies = { "LuaSnip" }, - event = { "InsertEnter" }, lazy = true, }, -- lspkind { "onsails/lspkind-nvim", lazy = true, + }, + -- nvim-cmp + { + "hrsh7th/nvim-cmp", event = { "InsertEnter" }, + dependencies = { "cmp_luasnip", "lspkind-nvim" }, + lazy = true, + config = function() + require("kide.plugins.config.nvim-cmp") + end, }, { "hrsh7th/cmp-nvim-lsp", lazy = true, - event = { "InsertEnter" }, }, { "hrsh7th/cmp-buffer", @@ -256,6 +252,7 @@ require("lazy").setup({ { "lewis6991/gitsigns.nvim", layz = true, + event = { "BufReadPost" }, config = function() require("kide.plugins.config.gitsigns-nvim") end, @@ -339,6 +336,7 @@ require("lazy").setup({ -- wildmenu 补全美化 { "gelguy/wilder.nvim", + keys = ":", config = function() require("kide.plugins.config.wilder") end, @@ -403,6 +401,8 @@ require("lazy").setup({ -- 快捷键查看 { "folke/which-key.nvim", + lazy = true, + keys = "", config = function() require("kide.plugins.config.which-key") end, From 9c32072f93a9c8fe113123d26476538a29a6c79d Mon Sep 17 00:00:00 2001 From: luokai Date: Sat, 11 Feb 2023 08:08:00 +0800 Subject: [PATCH 0576/1278] =?UTF-8?q?=E4=BC=98=E5=8C=96=E5=8A=A0=E8=BD=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lua/kide/plugins/lazy-nvim.lua | 1 + 1 file changed, 1 insertion(+) diff --git a/lua/kide/plugins/lazy-nvim.lua b/lua/kide/plugins/lazy-nvim.lua index d0dc79d7..d2d29e3e 100644 --- a/lua/kide/plugins/lazy-nvim.lua +++ b/lua/kide/plugins/lazy-nvim.lua @@ -188,6 +188,7 @@ require("lazy").setup({ lazy = true, dependencies = { "gruvbox.nvim" }, cmd = { "Telescope" }, + keys = { "" }, tag = "0.1.1", config = function() require("kide.plugins.config.telescope") From 4c4583168c59db71afb90a6eb4a7903b2696d2cc Mon Sep 17 00:00:00 2001 From: luokai Date: Sat, 11 Feb 2023 13:28:20 +0800 Subject: [PATCH 0577/1278] remove .idea --- lua/kide/lsp/java.lua | 2 -- 1 file changed, 2 deletions(-) diff --git a/lua/kide/lsp/java.lua b/lua/kide/lsp/java.lua index 41baf29e..f5b867e0 100644 --- a/lua/kide/lsp/java.lua +++ b/lua/kide/lsp/java.lua @@ -226,7 +226,6 @@ local config = { resourceFilters = { "node_modules", ".git", - ".idea", }, }, import = { @@ -236,7 +235,6 @@ local config = { "**/archetype-resources/**", "**/META-INF/maven/**", "**/.git/**", - "**/.idea/**", }, }, referenceCodeLens = { enabled = true }, From 14cab8ebf20dcbef1fab107f23882ffc2f65a195 Mon Sep 17 00:00:00 2001 From: luokai Date: Sat, 11 Feb 2023 23:16:16 +0800 Subject: [PATCH 0578/1278] dap lazy config --- .../config/{nvim-dap.lua => nvim-dap-ui.lua} | 3 --- lua/kide/plugins/lazy-nvim.lua | 14 ++++++++++++-- 2 files changed, 12 insertions(+), 5 deletions(-) rename lua/kide/plugins/config/{nvim-dap.lua => nvim-dap-ui.lua} (96%) diff --git a/lua/kide/plugins/config/nvim-dap.lua b/lua/kide/plugins/config/nvim-dap-ui.lua similarity index 96% rename from lua/kide/plugins/config/nvim-dap.lua rename to lua/kide/plugins/config/nvim-dap-ui.lua index f2ee6fc8..03ab7051 100644 --- a/lua/kide/plugins/config/nvim-dap.lua +++ b/lua/kide/plugins/config/nvim-dap-ui.lua @@ -63,6 +63,3 @@ end, {}) vim.api.nvim_create_user_command("DapUiToggle", function() require("dapui").toggle({}) end, {}) - -require("nvim-dap-virtual-text").setup({}) -require("telescope").load_extension("dap") diff --git a/lua/kide/plugins/lazy-nvim.lua b/lua/kide/plugins/lazy-nvim.lua index d2d29e3e..f1b733f2 100644 --- a/lua/kide/plugins/lazy-nvim.lua +++ b/lua/kide/plugins/lazy-nvim.lua @@ -168,17 +168,27 @@ require("lazy").setup({ { "mfussenegger/nvim-dap", lazy = true, + config = function() + require("kide.dap") + end, }, { "rcarriga/nvim-dap-ui", lazy = true, + dependencies = { "nvim-dap" }, + keys = { "d" }, + config = function() + require("kide.plugins.config.nvim-dap-ui") + end, }, { "theHamsta/nvim-dap-virtual-text", lazy = true, + dependencies = { "nvim-dap", "telescope.nvim" }, + keys = { "d" }, config = function() - require("kide.plugins.config.nvim-dap") - require("kide.dap") + require("nvim-dap-virtual-text").setup({}) + require("telescope").load_extension("dap") end, }, From 09293b8e94b8eb2fbe66afd305c003ab8c1e76fe Mon Sep 17 00:00:00 2001 From: luokai Date: Sat, 11 Feb 2023 23:26:33 +0800 Subject: [PATCH 0579/1278] lazy nvim-treesitter --- lua/kide/plugins/lazy-nvim.lua | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/lua/kide/plugins/lazy-nvim.lua b/lua/kide/plugins/lazy-nvim.lua index f1b733f2..cf690250 100644 --- a/lua/kide/plugins/lazy-nvim.lua +++ b/lua/kide/plugins/lazy-nvim.lua @@ -123,7 +123,7 @@ require("lazy").setup({ -- treesitter (新增) { "nvim-treesitter/nvim-treesitter", - priority = 90, + event = { "BufNewFile", "BufReadPost" }, dependencies = { "gruvbox.nvim" }, build = ":TSUpdate", config = function() @@ -133,13 +133,7 @@ require("lazy").setup({ { "nvim-treesitter/nvim-treesitter-textobjects", dependencies = { "nvim-treesitter" }, - }, - { - "nvim-treesitter/nvim-treesitter-context", - dependencies = { "nvim-treesitter" }, - config = function() - require("kide.plugins.config.nvim-treesitter-context") - end, + event = { "BufNewFile", "BufReadPost" }, }, -- java From fe1deee9a5aee7df65a0ea73a88791b59aac18b3 Mon Sep 17 00:00:00 2001 From: luokai Date: Sat, 11 Feb 2023 23:31:31 +0800 Subject: [PATCH 0580/1278] =?UTF-8?q?vim-dadbod=20=E9=85=8D=E7=BD=AE?= =?UTF-8?q?=E6=96=87=E4=BB=B6=E6=B8=85=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lua/kide/plugins/config/vim-dadbod.lua | 1 - lua/kide/plugins/lazy-nvim.lua | 2 +- 2 files changed, 1 insertion(+), 2 deletions(-) delete mode 100644 lua/kide/plugins/config/vim-dadbod.lua diff --git a/lua/kide/plugins/config/vim-dadbod.lua b/lua/kide/plugins/config/vim-dadbod.lua deleted file mode 100644 index 19c32cc3..00000000 --- a/lua/kide/plugins/config/vim-dadbod.lua +++ /dev/null @@ -1 +0,0 @@ -vim.g.db_ui_use_nerd_fonts = 1 diff --git a/lua/kide/plugins/lazy-nvim.lua b/lua/kide/plugins/lazy-nvim.lua index cf690250..dda51c39 100644 --- a/lua/kide/plugins/lazy-nvim.lua +++ b/lua/kide/plugins/lazy-nvim.lua @@ -558,7 +558,7 @@ require("lazy").setup({ "DBUIToggle", }, init = function() - require("kide.plugins.config.vim-dadbod") + vim.g.db_ui_use_nerd_fonts = 1 end, }, From 94d013b2b7eff65bc2ef87dad4a12bcaa1ea7b21 Mon Sep 17 00:00:00 2001 From: luokai Date: Sun, 12 Feb 2023 11:11:42 +0800 Subject: [PATCH 0581/1278] =?UTF-8?q?=E5=8A=A0=E8=BD=BD=E4=BC=98=E5=8C=96?= =?UTF-8?q?=E5=92=8C=E9=85=8D=E7=BD=AE=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lua/kide/dap/init.lua | 7 ++++ lua/kide/lsp/utils/init.lua | 1 - lua/kide/plugins/config/nvim-dap-ui.lua | 15 ++----- lua/kide/plugins/config/nvim-tree.lua | 1 - lua/kide/plugins/lazy-nvim.lua | 53 +++++++++++++++---------- 5 files changed, 43 insertions(+), 34 deletions(-) diff --git a/lua/kide/dap/init.lua b/lua/kide/dap/init.lua index e0a2decf..180f9ee1 100644 --- a/lua/kide/dap/init.lua +++ b/lua/kide/dap/init.lua @@ -3,3 +3,10 @@ vim.api.nvim_create_user_command("CodelldbLoad", function() vim.g.codelldb_load = require("kide.dap.codelldb").setup() end end, {}) + +vim.fn.sign_define("DapBreakpoint", { text = "", texthl = "Debug", linehl = "", numhl = "" }) +-- vim.fn.sign_define('DapBreakpoint', { text = '🔴', texthl = '', linehl = '', numhl = '' }) +-- vim.fn.sign_define("DapBreakpointCondition", { text = "C", texthl = "", linehl = "", numhl = "" }) +-- vim.fn.sign_define('DapBreakpointRejected', {text='R', texthl='', linehl='', numhl=''}) +-- vim.fn.sign_define('DapLogPoint', {text='L', texthl='', linehl='', numhl=''}) +-- vim.fn.sign_define('DapStopped', {text='→', texthl='', linehl='debugPC', numhl=''}) diff --git a/lua/kide/lsp/utils/init.lua b/lua/kide/lsp/utils/init.lua index 43999ea6..cfcf6832 100644 --- a/lua/kide/lsp/utils/init.lua +++ b/lua/kide/lsp/utils/init.lua @@ -72,7 +72,6 @@ format_lsp_mapping["go"] = "null-ls" format_lsp_mapping["c"] = "clangd" format_lsp_mapping["cpp"] = "clangd" - -- black format_lsp_mapping["python"] = "null-ls" diff --git a/lua/kide/plugins/config/nvim-dap-ui.lua b/lua/kide/plugins/config/nvim-dap-ui.lua index 03ab7051..8d0bc361 100644 --- a/lua/kide/plugins/config/nvim-dap-ui.lua +++ b/lua/kide/plugins/config/nvim-dap-ui.lua @@ -46,20 +46,13 @@ end dap.listeners.before.event_exited["dapui_config"] = function() dapui.close() end - --- vim.fn.sign_define('DapBreakpoint', { text = '🔴', texthl = '', linehl = '', numhl = '' }) -vim.fn.sign_define("DapBreakpoint", { text = "", texthl = "Debug", linehl = "", numhl = "" }) --- vim.fn.sign_define("DapBreakpointCondition", { text = "C", texthl = "", linehl = "", numhl = "" }) --- vim.fn.sign_define('DapBreakpointRejected', {text='R', texthl='', linehl='', numhl=''}) --- vim.fn.sign_define('DapLogPoint', {text='L', texthl='', linehl='', numhl=''}) --- vim.fn.sign_define('DapStopped', {text='→', texthl='', linehl='debugPC', numhl=''}) - -vim.api.nvim_create_user_command("DapUiOpen", function() +-- nvim-dap +vim.api.nvim_create_user_command("DapUIOpen", function() require("dapui").open({}) end, {}) -vim.api.nvim_create_user_command("DapUiClose", function() +vim.api.nvim_create_user_command("DapUIClose", function() require("dapui").close({}) end, {}) -vim.api.nvim_create_user_command("DapUiToggle", function() +vim.api.nvim_create_user_command("DapUIToggle", function() require("dapui").toggle({}) end, {}) diff --git a/lua/kide/plugins/config/nvim-tree.lua b/lua/kide/plugins/config/nvim-tree.lua index 8472eb39..6e0e98d5 100644 --- a/lua/kide/plugins/config/nvim-tree.lua +++ b/lua/kide/plugins/config/nvim-tree.lua @@ -105,4 +105,3 @@ require("nvim-tree").setup({ -- symlink_open = "", -- }, -- } - diff --git a/lua/kide/plugins/lazy-nvim.lua b/lua/kide/plugins/lazy-nvim.lua index dda51c39..812eedf0 100644 --- a/lua/kide/plugins/lazy-nvim.lua +++ b/lua/kide/plugins/lazy-nvim.lua @@ -38,14 +38,14 @@ require("lazy").setup({ { "L3MON4D3/LuaSnip", lazy = true, - dependencies = { "friendly-snippets" }, + dependencies = { "rafamadriz/friendly-snippets" }, config = function() require("kide.plugins.config.luasnip") end, }, { "saadparwaiz1/cmp_luasnip", - dependencies = { "LuaSnip" }, + dependencies = { "L3MON4D3/LuaSnip" }, lazy = true, }, -- lspkind @@ -57,7 +57,13 @@ require("lazy").setup({ { "hrsh7th/nvim-cmp", event = { "InsertEnter" }, - dependencies = { "cmp_luasnip", "lspkind-nvim" }, + dependencies = { + "hrsh7th/cmp-path", + "hrsh7th/cmp-nvim-lsp", + "hrsh7th/cmp-buffer", + "saadparwaiz1/cmp_luasnip", + "onsails/lspkind-nvim", + }, lazy = true, config = function() require("kide.plugins.config.nvim-cmp") @@ -70,18 +76,16 @@ require("lazy").setup({ { "hrsh7th/cmp-buffer", lazy = true, - event = { "InsertEnter" }, }, { "hrsh7th/cmp-path", lazy = true, - event = { "InsertEnter" }, }, { "jose-elias-alvarez/null-ls.nvim", lazy = true, - event = { "BufReadPost" }, + event = { "BufNewFile", "BufReadPost" }, config = function() require("kide.plugins.config.null-ls") end, @@ -91,7 +95,8 @@ require("lazy").setup({ -- use 'morhetz/gruvbox' { "ellisonleao/gruvbox.nvim", - priority = 100, + lazy = false, + priority = 1000, config = function() require("kide.plugins.config.gruvbox") end, @@ -113,7 +118,7 @@ require("lazy").setup({ { "akinsho/bufferline.nvim", tag = "v3.0.1", - dependencies = { "gruvbox.nvim" }, + dependencies = { "ellisonleao/gruvbox.nvim" }, requires = "kyazdani42/nvim-web-devicons", config = function() require("kide.plugins.config.bufferline") @@ -124,7 +129,7 @@ require("lazy").setup({ { "nvim-treesitter/nvim-treesitter", event = { "BufNewFile", "BufReadPost" }, - dependencies = { "gruvbox.nvim" }, + dependencies = { "ellisonleao/gruvbox.nvim" }, build = ":TSUpdate", config = function() require("kide.plugins.config.nvim-treesitter") @@ -132,7 +137,7 @@ require("lazy").setup({ }, { "nvim-treesitter/nvim-treesitter-textobjects", - dependencies = { "nvim-treesitter" }, + dependencies = { "nvim-treesitter/nvim-treesitter" }, event = { "BufNewFile", "BufReadPost" }, }, @@ -162,15 +167,25 @@ require("lazy").setup({ { "mfussenegger/nvim-dap", lazy = true, + event = { "BufNewFile", "BufReadPost" }, config = function() require("kide.dap") + require("nvim-dap-virtual-text").setup({}) + require("telescope").load_extension("dap") end, }, { "rcarriga/nvim-dap-ui", lazy = true, - dependencies = { "nvim-dap" }, - keys = { "d" }, + dependencies = { "mfussenegger/nvim-dap" }, + cmd = { + "DapUILoad", + }, + init = function() + vim.api.nvim_create_user_command("DapUILoad", function() + require("dapui") + end, {}) + end, config = function() require("kide.plugins.config.nvim-dap-ui") end, @@ -178,19 +193,14 @@ require("lazy").setup({ { "theHamsta/nvim-dap-virtual-text", lazy = true, - dependencies = { "nvim-dap", "telescope.nvim" }, - keys = { "d" }, - config = function() - require("nvim-dap-virtual-text").setup({}) - require("telescope").load_extension("dap") - end, + dependencies = { "mfussenegger/nvim-dap" }, }, -- 搜索插件 { "nvim-telescope/telescope.nvim", lazy = true, - dependencies = { "gruvbox.nvim" }, + dependencies = { "ellisonleao/gruvbox.nvim" }, cmd = { "Telescope" }, keys = { "" }, tag = "0.1.1", @@ -209,6 +219,7 @@ require("lazy").setup({ }, { "nvim-telescope/telescope-dap.nvim", + dependencies = { "mfussenegger/nvim-dap" }, lazy = true, }, @@ -301,7 +312,7 @@ require("lazy").setup({ -- 状态栏插件 { "nvim-lualine/lualine.nvim", - dependencies = { "gruvbox.nvim" }, + dependencies = { "ellisonleao/gruvbox.nvim" }, config = function() require("kide.plugins.config.lualine") end, @@ -341,7 +352,7 @@ require("lazy").setup({ -- wildmenu 补全美化 { "gelguy/wilder.nvim", - keys = ":", + keys = { ":", "/" }, config = function() require("kide.plugins.config.wilder") end, From d75a5c172a1cc94e9cc02dd680ac5a03eb4f1d5d Mon Sep 17 00:00:00 2001 From: luokai Date: Sun, 12 Feb 2023 11:58:08 +0800 Subject: [PATCH 0582/1278] =?UTF-8?q?=E6=8F=92=E4=BB=B6=E9=85=8D=E7=BD=AE?= =?UTF-8?q?=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lua/kide/lsp/init.lua | 3 ++- lua/kide/plugins/lazy-nvim.lua | 22 ++++++++++++++++++---- 2 files changed, 20 insertions(+), 5 deletions(-) diff --git a/lua/kide/lsp/init.lua b/lua/kide/lsp/init.lua index 8b1ceb9c..b60ba9a5 100644 --- a/lua/kide/lsp/init.lua +++ b/lua/kide/lsp/init.lua @@ -29,7 +29,8 @@ local capabilities = require("cmp_nvim_lsp").default_capabilities(vim.lsp.protoc -- capabilities.textDocument.completion.completionItem.snippetSupport = true local utils = require("kide.core.utils") -require("fidget").setup({}) +-- LSP 进度UI +require("fidget") require("mason-lspconfig").setup_handlers({ -- The first entry (without a key) will be the default handler -- and will be called for each installed server that doesn't have diff --git a/lua/kide/plugins/lazy-nvim.lua b/lua/kide/plugins/lazy-nvim.lua index 812eedf0..08a3e0e3 100644 --- a/lua/kide/plugins/lazy-nvim.lua +++ b/lua/kide/plugins/lazy-nvim.lua @@ -1,3 +1,9 @@ +local function loadPluginCmd(cmd, module) + vim.api.nvim_create_user_command(cmd, function() + require(module) + end, {}) +end + require("lazy").setup({ { @@ -179,12 +185,10 @@ require("lazy").setup({ lazy = true, dependencies = { "mfussenegger/nvim-dap" }, cmd = { - "DapUILoad", + "LoadDapUI", }, init = function() - vim.api.nvim_create_user_command("DapUILoad", function() - require("dapui") - end, {}) + loadPluginCmd("LoadDapUI", "dapui") end, config = function() require("kide.plugins.config.nvim-dap-ui") @@ -445,6 +449,12 @@ require("lazy").setup({ { "junegunn/vim-easy-align", lazy = true, + config = function() + vim.cmd([[ + xmap ga (EasyAlign) + nmap ga (EasyAlign) + ]]) + end, }, -- 表格模式插件 @@ -549,6 +559,9 @@ require("lazy").setup({ lazy = true, cmd = { "Registers" }, keys = '"', + config = function() + require("registers").setup() + end, }, -- databases @@ -564,6 +577,7 @@ require("lazy").setup({ { "kristijanhusak/vim-dadbod-ui", lazy = true, + dependencies = { "tpope/vim-dadbod" }, cmd = { "DBUI", "DBUIToggle", From 81411e4c21dfb093de220472fb905d97fd8f4eae Mon Sep 17 00:00:00 2001 From: luokai Date: Sun, 12 Feb 2023 13:00:16 +0800 Subject: [PATCH 0583/1278] EasyAlign --- lua/kide/plugins/lazy-nvim.lua | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/lua/kide/plugins/lazy-nvim.lua b/lua/kide/plugins/lazy-nvim.lua index 08a3e0e3..b7b853da 100644 --- a/lua/kide/plugins/lazy-nvim.lua +++ b/lua/kide/plugins/lazy-nvim.lua @@ -263,6 +263,7 @@ require("lazy").setup({ "TimUntersberger/neogit", layz = true, cmd = "Neogit", + dependencies = { "sindrets/diffview.nvim" }, config = function() require("kide.plugins.config.neogit") end, @@ -301,6 +302,7 @@ require("lazy").setup({ { "jedrzejboczar/toggletasks.nvim", lazy = true, + dependencies = { "akinsho/toggleterm.nvim" }, config = function() require("kide.plugins.config.toggletasks") end, @@ -373,7 +375,7 @@ require("lazy").setup({ { "numToStr/Comment.nvim", - keys = { "gc", "gb" }, + keys = { "gcc", "gb" }, config = function() require("kide.plugins.config.comment") end, @@ -444,11 +446,16 @@ require("lazy").setup({ require("kide.plugins.config.translate") end, }, - + -- StartupTime + { + "dstein64/vim-startuptime", + cmd = "StartupTime", + }, -- 自动对齐插件 { "junegunn/vim-easy-align", lazy = true, + cmd = "EasyAlign", config = function() vim.cmd([[ xmap ga (EasyAlign) From c478a6d167d26d2c21f696bd14959f25bd8ef567 Mon Sep 17 00:00:00 2001 From: luokai Date: Sun, 12 Feb 2023 13:11:58 +0800 Subject: [PATCH 0584/1278] =?UTF-8?q?=E6=B8=85=E7=90=86=E4=B8=8D=E4=BD=BF?= =?UTF-8?q?=E7=94=A8=E7=9A=84=E9=85=8D=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lua/kide/core/layz_load.lua | 51 ------- lua/kide/plugins/config/LeaderF.lua | 4 - lua/kide/plugins/config/asynctasks.lua | 63 --------- lua/kide/plugins/config/autosave.lua | 17 --- lua/kide/plugins/config/dashboard-nvim.lua | 19 --- lua/kide/plugins/config/dressing-nvim.lua | 155 --------------------- lua/kide/plugins/config/feline.lua | 1 - lua/kide/plugins/config/formatter.lua | 28 ---- lua/kide/plugins/config/lsp-colors.lua | 7 - lua/kide/plugins/config/lsp_signature.lua | 9 -- lua/kide/plugins/config/lspsaga.lua | 45 ------ lua/kide/plugins/config/nvim-lsputils.lua | 78 ----------- lua/kide/plugins/config/nvim-neorg.lua | 13 -- lua/kide/plugins/config/telescope-fzf.lua | 0 lua/kide/plugins/config/trouble.lua | 4 - lua/kide/plugins/config/vim-floaterm.lua | 6 - lua/kide/plugins/config/vista.lua | 3 - 17 files changed, 503 deletions(-) delete mode 100644 lua/kide/core/layz_load.lua delete mode 100644 lua/kide/plugins/config/LeaderF.lua delete mode 100644 lua/kide/plugins/config/asynctasks.lua delete mode 100644 lua/kide/plugins/config/autosave.lua delete mode 100644 lua/kide/plugins/config/dashboard-nvim.lua delete mode 100644 lua/kide/plugins/config/dressing-nvim.lua delete mode 100644 lua/kide/plugins/config/feline.lua delete mode 100644 lua/kide/plugins/config/formatter.lua delete mode 100644 lua/kide/plugins/config/lsp-colors.lua delete mode 100644 lua/kide/plugins/config/lsp_signature.lua delete mode 100644 lua/kide/plugins/config/lspsaga.lua delete mode 100644 lua/kide/plugins/config/nvim-lsputils.lua delete mode 100644 lua/kide/plugins/config/nvim-neorg.lua delete mode 100644 lua/kide/plugins/config/telescope-fzf.lua delete mode 100644 lua/kide/plugins/config/trouble.lua delete mode 100644 lua/kide/plugins/config/vim-floaterm.lua delete mode 100644 lua/kide/plugins/config/vista.lua diff --git a/lua/kide/core/layz_load.lua b/lua/kide/core/layz_load.lua deleted file mode 100644 index 9465dd7c..00000000 --- a/lua/kide/core/layz_load.lua +++ /dev/null @@ -1,51 +0,0 @@ -local M = {} -local autocmd = vim.api.nvim_create_autocmd - -M.lazy_load = function(tb) - autocmd(tb.events, { - pattern = "*", - group = vim.api.nvim_create_augroup(tb.augroup_name, {}), - callback = function() - if tb.condition() then - vim.api.nvim_del_augroup_by_name(tb.augroup_name) - - -- dont defer for treesitter as it will show slow highlighting - -- This deferring only happens only when we do "nvim filename" - if tb.plugins ~= "nvim-treesitter" then - vim.schedule(function() - vim.cmd("PackerLoad " .. tb.plugins) - end) - else - vim.cmd("PackerLoad " .. tb.plugins) - end - end - end, - }) -end - --- load certain plugins only when there's a file opened in the buffer --- if "nvim filename" is executed -> load the plugin after nvim gui loads --- This gives an instant preview of nvim with the file opened - -M.on_file_open = function(plugin_name) - M.lazy_load({ - events = { "BufRead", "BufWinEnter", "BufNewFile" }, - augroup_name = "BeLazyOnFileOpen" .. plugin_name, - plugins = plugin_name, - condition = function() - local file = vim.fn.expand("%") - return file ~= "NvimTree_1" and file ~= "[packer]" and file ~= "[Scratch]" and file ~= "" - end, - }) -end - -M.sync_load = function(plugin) - require("packer").loader(plugin) -end -M.async_load = function(plugin) - vim.schedule(function() - require("packer").loader(plugin) - end) -end - -return M diff --git a/lua/kide/plugins/config/LeaderF.lua b/lua/kide/plugins/config/LeaderF.lua deleted file mode 100644 index fbc56afe..00000000 --- a/lua/kide/plugins/config/LeaderF.lua +++ /dev/null @@ -1,4 +0,0 @@ -vim.g.Lf_WindowPosition = "popup" --- 不使用缓存(大型项目不推荐) -vim.g.Lf_UseCache = 0 -vim.g.Lf_UseMemoryCache = 0 diff --git a/lua/kide/plugins/config/asynctasks.lua b/lua/kide/plugins/config/asynctasks.lua deleted file mode 100644 index 1d8fb44e..00000000 --- a/lua/kide/plugins/config/asynctasks.lua +++ /dev/null @@ -1,63 +0,0 @@ -vim.g.asyncrun_open = 20 -vim.g.asyncrun_mode = "term" -vim.g.asynctasks_term_pos = "floaterm" --- 此配置无效(无效变量) -vim.g.asyncrun_term_pos = "floaterm" - --- vim.cmd( --- [[ --- function! s:lf_task_source(...) --- let rows = asynctasks#source(&columns * 48 / 100) --- let source = [] --- for row in rows --- let name = row[0] --- let source += [name . ' ' . row[1] . ' : ' . row[2] ] --- endfor --- return source --- endfunction --- --- --- function! s:lf_task_accept(line, arg) --- let pos = stridx(a:line, '<') --- if pos < 0 --- return --- endif --- let name = strpart(a:line, 0, pos) --- let name = substitute(name, '^\s*\(.\{-}\)\s*$', '\1', '') --- if name != '' --- exec "AsyncTask " . name --- endif --- endfunction --- --- function! s:lf_task_digest(line, mode) --- let pos = stridx(a:line, '<') --- if pos < 0 --- return [a:line, 0] --- endif --- let name = strpart(a:line, 0, pos) --- return [name, 0] --- endfunction --- --- function! s:lf_win_init(...) --- setlocal nonumber --- setlocal nowrap --- endfunction --- --- --- let g:Lf_Extensions = get(g:, 'Lf_Extensions', {}) --- let g:Lf_Extensions.task = { --- \ 'source': string(function('s:lf_task_source'))[10:-3], --- \ 'accept': string(function('s:lf_task_accept'))[10:-3], --- \ 'get_digest': string(function('s:lf_task_digest'))[10:-3], --- \ 'highlights_def': { --- \ 'Lf_hl_funcScope': '^\S\+', --- \ 'Lf_hl_funcDirname': '^\S\+\s*\zs<.*>\ze\s*:', --- \ }, --- \ 'help' : 'navigate available tasks from asynctasks.vim', --- \ } --- let g:asynctasks_extra_config = [ --- \ '~/.config/nvim/config/local_tasks.ini', --- \ ] --- ]]) --- 未实现 -vim.g.asynctasks_template = "~/.config/nvim/config/task_template.ini" diff --git a/lua/kide/plugins/config/autosave.lua b/lua/kide/plugins/config/autosave.lua deleted file mode 100644 index ffb8078d..00000000 --- a/lua/kide/plugins/config/autosave.lua +++ /dev/null @@ -1,17 +0,0 @@ -local autosave = require("autosave") - -autosave.setup({ - enabled = true, - execution_message = "AutoSave: saved at " .. vim.fn.strftime("%H:%M:%S"), - events = { "InsertLeave", "TextChanged" }, - conditions = { - exists = true, - filename_is_not = {}, - filetype_is_not = {}, - modifiable = true, - }, - write_all_buffers = false, - on_off_commands = true, - clean_command_line_interval = 0, - debounce_delay = 135, -}) diff --git a/lua/kide/plugins/config/dashboard-nvim.lua b/lua/kide/plugins/config/dashboard-nvim.lua deleted file mode 100644 index fad89a6a..00000000 --- a/lua/kide/plugins/config/dashboard-nvim.lua +++ /dev/null @@ -1,19 +0,0 @@ -local g = vim.g - --- g.dashboard_disable_at_vimenter = 0 --- g.dashboard_disable_statusline = 1 -g.dashboard_default_executive = "telescope" --- g.dashboard_custom_header = { --- } - -local startify_ascii_header = { - " ▟▙ ", - " ▝▘ ", - "██▃▅▇█▆▖ ▗▟████▙▖ ▄████▄ ██▄ ▄██ ██ ▗▟█▆▄▄▆█▙▖", - "██▛▔ ▝██ ██▄▄▄▄██ ██▛▔▔▜██ ▝██ ██▘ ██ ██▛▜██▛▜██", - "██ ██ ██▀▀▀▀▀▘ ██▖ ▗██ ▜█▙▟█▛ ██ ██ ██ ██", - "██ ██ ▜█▙▄▄▄▟▊ ▀██▙▟██▀ ▝████▘ ██ ██ ██ ██", - "▀▀ ▀▀ ▝▀▀▀▀▀ ▀▀▀▀ ▀▀ ▀▀ ▀▀ ▀▀ ▀▀", - "", -} -g.dashboard_custom_header = startify_ascii_header diff --git a/lua/kide/plugins/config/dressing-nvim.lua b/lua/kide/plugins/config/dressing-nvim.lua deleted file mode 100644 index b77db24c..00000000 --- a/lua/kide/plugins/config/dressing-nvim.lua +++ /dev/null @@ -1,155 +0,0 @@ -require("dressing").setup({ - input = { - -- Set to false to disable the vim.ui.input implementation - enabled = true, - - -- Default prompt string - default_prompt = "Input:", - - -- Can be 'left', 'right', or 'center' - prompt_align = "left", - - -- When true, will close the modal - insert_only = true, - - -- When true, input will start in insert mode. - start_in_insert = true, - - -- These are passed to nvim_open_win - anchor = "SW", - border = "rounded", - -- 'editor' and 'win' will default to being centered - relative = "cursor", - - -- These can be integers or a float between 0 and 1 (e.g. 0.4 for 40%) - prefer_width = 40, - width = nil, - -- min_width and max_width can be a list of mixed types. - -- min_width = {20, 0.2} means "the greater of 20 columns or 20% of total" - max_width = { 140, 0.9 }, - min_width = { 20, 0.2 }, - - -- Window transparency (0-100) - winblend = 10, - -- Change default highlight groups (see :help winhl) - winhighlight = "", - - -- Set to `false` to disable - mappings = { - n = { - [""] = "Close", - [""] = "Confirm", - }, - i = { - [""] = "Close", - [""] = "Confirm", - [""] = "HistoryPrev", - [""] = "HistoryNext", - }, - }, - - override = function(conf) - -- This is the config that will be passed to nvim_open_win. - -- Change values here to customize the layout - return conf - end, - - -- see :help dressing_get_config - get_config = nil, - }, - select = { - -- Set to false to disable the vim.ui.select implementation - enabled = true, - - -- Priority list of preferred vim.select implementations - backend = { "telescope", "fzf_lua", "fzf", "builtin", "nui" }, - - -- Trim trailing `:` from prompt - trim_prompt = true, - - -- Options for telescope selector - -- These are passed into the telescope picker directly. Can be used like: - -- telescope = require('telescope.themes').get_ivy({...}) - telescope = nil, - - -- Options for fzf selector - fzf = { - window = { - width = 0.5, - height = 0.4, - }, - }, - - -- Options for fzf_lua selector - fzf_lua = { - winopts = { - width = 0.5, - height = 0.4, - }, - }, - - -- Options for nui Menu - nui = { - position = "50%", - size = nil, - relative = "editor", - border = { - style = "rounded", - }, - buf_options = { - swapfile = false, - filetype = "DressingSelect", - }, - win_options = { - winblend = 10, - }, - max_width = 80, - max_height = 40, - min_width = 40, - min_height = 10, - }, - - -- Options for built-in selector - builtin = { - -- These are passed to nvim_open_win - anchor = "NW", - border = "rounded", - -- 'editor' and 'win' will default to being centered - relative = "editor", - - -- Window transparency (0-100) - winblend = 10, - -- Change default highlight groups (see :help winhl) - winhighlight = "", - - -- These can be integers or a float between 0 and 1 (e.g. 0.4 for 40%) - -- the min_ and max_ options can be a list of mixed types. - -- max_width = {140, 0.8} means "the lesser of 140 columns or 80% of total" - width = nil, - max_width = { 140, 0.8 }, - min_width = { 40, 0.2 }, - height = nil, - max_height = 0.9, - min_height = { 10, 0.2 }, - - -- Set to `false` to disable - mappings = { - [""] = "Close", - [""] = "Close", - [""] = "Confirm", - }, - - override = function(conf) - -- This is the config that will be passed to nvim_open_win. - -- Change values here to customize the layout - return conf - end, - }, - - -- Used to override format_item. See :help dressing-format - format_item_override = {}, - - -- see :help dressing_get_config - get_config = nil, - }, -}) diff --git a/lua/kide/plugins/config/feline.lua b/lua/kide/plugins/config/feline.lua deleted file mode 100644 index 30516e42..00000000 --- a/lua/kide/plugins/config/feline.lua +++ /dev/null @@ -1 +0,0 @@ -require("feline").setup() diff --git a/lua/kide/plugins/config/formatter.lua b/lua/kide/plugins/config/formatter.lua deleted file mode 100644 index 925e053b..00000000 --- a/lua/kide/plugins/config/formatter.lua +++ /dev/null @@ -1,28 +0,0 @@ -local prettierConfig = function() - return { - exe = "prettier", - args = { "--stdin-filepath", vim.fn.shellescape(vim.api.nvim_buf_get_name(0)), "--single-quote" }, - stdin = true, - } -end - -require("formatter").setup({ - filetype = { - -- lua = {function() return {exe = "lua-format", stdin = true} end}, - json = { prettierConfig }, - html = { prettierConfig }, - javascript = { prettierConfig }, - typescript = { prettierConfig }, - typescriptreact = { prettierConfig }, - markdown = { prettierConfig }, - sql = { - function() - return { - exe = "sql-formatter", - args = { vim.fn.shellescape(vim.api.nvim_buf_get_name(0)) }, - stdin = true, - } - end, - }, - }, -}) diff --git a/lua/kide/plugins/config/lsp-colors.lua b/lua/kide/plugins/config/lsp-colors.lua deleted file mode 100644 index cf7a458a..00000000 --- a/lua/kide/plugins/config/lsp-colors.lua +++ /dev/null @@ -1,7 +0,0 @@ --- Lua -require("lsp-colors").setup({ - Error = "#db4b4b", - Warning = "#e0af68", - Information = "#0db9d7", - Hint = "#10B981", -}) diff --git a/lua/kide/plugins/config/lsp_signature.lua b/lua/kide/plugins/config/lsp_signature.lua deleted file mode 100644 index 6ef5cc2a..00000000 --- a/lua/kide/plugins/config/lsp_signature.lua +++ /dev/null @@ -1,9 +0,0 @@ -require("lsp_signature").on_attach({ - bind = true, - use_lspsaga = false, - floating_window = true, - fix_pos = true, - hint_enable = true, - hi_parameter = "Search", - handler_opts = { "double" }, -}) diff --git a/lua/kide/plugins/config/lspsaga.lua b/lua/kide/plugins/config/lspsaga.lua deleted file mode 100644 index d850d99b..00000000 --- a/lua/kide/plugins/config/lspsaga.lua +++ /dev/null @@ -1,45 +0,0 @@ -local saga = require("lspsaga") - --- add your config value here --- default value --- use_saga_diagnostic_sign = true --- error_sign = '', --- warn_sign = '', --- hint_sign = '', --- infor_sign = '', --- dianostic_header_icon = '  ', --- code_action_icon = ' ', --- code_action_prompt = { --- enable = true, --- sign = true, --- sign_priority = 20, --- virtual_text = true, --- }, --- finder_definition_icon = ' ', --- finder_reference_icon = ' ', --- max_preview_lines = 10, -- preview lines of lsp_finder and definition preview --- finder_action_keys = { --- open = 'o', vsplit = 's',split = 'i',quit = 'q',scroll_down = '', scroll_up = '' -- quit can be a table --- }, --- code_action_keys = { --- quit = 'q',exec = '' --- }, --- rename_action_keys = { --- quit = '',exec = '' -- quit can be a table --- }, --- definition_preview_icon = ' ' --- "single" "double" "round" "plus" --- border_style = "single" --- rename_prompt_prefix = '➤', --- if you don't use nvim-lspconfig you must pass your server name and --- the related filetypes into this table --- like server_filetype_map = {metals = {'sbt', 'scala'}} --- server_filetype_map = {} -saga.init_lsp_saga({ - diagnostic_header = { " ", " ", " ", " " }, - code_action_icon = "", - max_preview_lines = 40, - server_filetype_map = { - metals = { "java" }, - }, -}) diff --git a/lua/kide/plugins/config/nvim-lsputils.lua b/lua/kide/plugins/config/nvim-lsputils.lua deleted file mode 100644 index a6710175..00000000 --- a/lua/kide/plugins/config/nvim-lsputils.lua +++ /dev/null @@ -1,78 +0,0 @@ -if vim.fn.has("nvim-0.5.1") == 1 then - vim.lsp.handlers["textDocument/codeAction"] = require("lsputil.codeAction").code_action_handler - vim.lsp.handlers["textDocument/references"] = require("lsputil.locations").references_handler - vim.lsp.handlers["textDocument/definition"] = require("lsputil.locations").definition_handler - vim.lsp.handlers["textDocument/declaration"] = require("lsputil.locations").declaration_handler - vim.lsp.handlers["textDocument/typeDefinition"] = require("lsputil.locations").typeDefinition_handler - vim.lsp.handlers["textDocument/implementation"] = require("lsputil.locations").implementation_handler - vim.lsp.handlers["textDocument/documentSymbol"] = require("lsputil.symbols").document_handler - vim.lsp.handlers["workspace/symbol"] = require("lsputil.symbols").workspace_handler -else - local bufnr = vim.api.nvim_buf_get_number(0) - - vim.lsp.handlers["textDocument/codeAction"] = function(_, _, actions) - require("lsputil.codeAction").code_action_handler(nil, actions, nil, nil, nil) - end - - vim.lsp.handlers["textDocument/references"] = function(_, _, result) - require("lsputil.locations").references_handler(nil, result, { bufnr = bufnr }, nil) - end - - vim.lsp.handlers["textDocument/definition"] = function(_, method, result) - require("lsputil.locations").definition_handler(nil, result, { bufnr = bufnr, method = method }, nil) - end - - vim.lsp.handlers["textDocument/declaration"] = function(_, method, result) - require("lsputil.locations").declaration_handler(nil, result, { bufnr = bufnr, method = method }, nil) - end - - vim.lsp.handlers["textDocument/typeDefinition"] = function(_, method, result) - require("lsputil.locations").typeDefinition_handler(nil, result, { bufnr = bufnr, method = method }, nil) - end - - vim.lsp.handlers["textDocument/implementation"] = function(_, method, result) - require("lsputil.locations").implementation_handler(nil, result, { bufnr = bufnr, method = method }, nil) - end - - vim.lsp.handlers["textDocument/documentSymbol"] = function(_, _, result, _, bufn) - require("lsputil.symbols").document_handler(nil, result, { bufnr = bufn }, nil) - end - - vim.lsp.handlers["textDocument/symbol"] = function(_, _, result, _, bufn) - require("lsputil.symbols").workspace_handler(nil, result, { bufnr = bufn }, nil) - end -end - -local border_chars = { - TOP_LEFT = "┌", - TOP_RIGHT = "┐", - MID_HORIZONTAL = "─", - MID_VERTICAL = "│", - BOTTOM_LEFT = "└", - BOTTOM_RIGHT = "┘", -} -vim.g.lsp_utils_location_opts = { - height = 24, - mode = "editor", - preview = { - title = "Location Preview", - border = true, - border_chars = border_chars, - }, - keymaps = { - n = { - [""] = "j", - [""] = "k", - }, - }, -} -vim.g.lsp_utils_symbols_opts = { - height = 24, - mode = "editor", - preview = { - title = "Symbols Preview", - border = true, - border_chars = border_chars, - }, - prompt = {}, -} diff --git a/lua/kide/plugins/config/nvim-neorg.lua b/lua/kide/plugins/config/nvim-neorg.lua deleted file mode 100644 index f54d94df..00000000 --- a/lua/kide/plugins/config/nvim-neorg.lua +++ /dev/null @@ -1,13 +0,0 @@ -require("neorg").setup({ - load = { - ["core.defaults"] = {}, - ["core.norg.dirman"] = { - config = { - workspaces = { - work = "~/notes/work", - home = "~/notes/home", - }, - }, - }, - }, -}) diff --git a/lua/kide/plugins/config/telescope-fzf.lua b/lua/kide/plugins/config/telescope-fzf.lua deleted file mode 100644 index e69de29b..00000000 diff --git a/lua/kide/plugins/config/trouble.lua b/lua/kide/plugins/config/trouble.lua deleted file mode 100644 index b6396257..00000000 --- a/lua/kide/plugins/config/trouble.lua +++ /dev/null @@ -1,4 +0,0 @@ -require("trouble").setup({ - use_diagnostic_signs = true, - auto_preview = false, -}) diff --git a/lua/kide/plugins/config/vim-floaterm.lua b/lua/kide/plugins/config/vim-floaterm.lua deleted file mode 100644 index cf1f7798..00000000 --- a/lua/kide/plugins/config/vim-floaterm.lua +++ /dev/null @@ -1,6 +0,0 @@ -vim.g.floaterm_position = "bottomright" -vim.g.floaterm_autoclose = 1 -vim.g.floaterm_wintype = "float" -vim.g.floaterm_width = 0.9 -vim.g.floaterm_height = 0.4 --- vim.g.floaterm_rootmarkers=['.project', '.git', '.hg', '.svn', '.root', '.gitignore'] diff --git a/lua/kide/plugins/config/vista.lua b/lua/kide/plugins/config/vista.lua deleted file mode 100644 index b708fb52..00000000 --- a/lua/kide/plugins/config/vista.lua +++ /dev/null @@ -1,3 +0,0 @@ -vim.g.vista_default_executive = "nvim_lsp" - -vim.g.vista_icon_indent = { "╰─▸ ", "├─▸ " } From 035771f6af6070b200d7114874ebe20e40ebb6a0 Mon Sep 17 00:00:00 2001 From: luokai Date: Sun, 12 Feb 2023 13:13:38 +0800 Subject: [PATCH 0585/1278] =?UTF-8?q?=E6=B8=85=E7=90=86=E4=B8=8D=E4=BD=BF?= =?UTF-8?q?=E7=94=A8=E7=9A=84=E9=85=8D=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- config/local_tasks.ini | 25 ---------- config/task_template.ini | 101 --------------------------------------- 2 files changed, 126 deletions(-) delete mode 100644 config/local_tasks.ini delete mode 100644 config/task_template.ini diff --git a/config/local_tasks.ini b/config/local_tasks.ini deleted file mode 100644 index 6f45877f..00000000 --- a/config/local_tasks.ini +++ /dev/null @@ -1,25 +0,0 @@ -[file-run] -command="$(VIM_FILEPATH)" -command:c,cpp="$(VIM_PATHNOEXT)" -command:go="$(VIM_PATHNOEXT)" -command:python=python "$(VIM_FILENAME)" -command:make=make -f "$(VIM_FILENAME)" run -command:emake=emake -e "$(VIM_FILENAME)" -command:javascript=node "$(VIM_FILENAME)" -command:sh=sh "$(VIM_FILENAME)" -command:lua=lua "$(VIM_FILENAME)" -command:perl=perl "$(VIM_FILENAME)" -command:ruby=ruby "$(VIM_FILENAME)" -command:zsh=zsh "$(VIM_FILENAME)" -command:bash=bash "$(VIM_FILENAME)" -command:fish=fish "$(VIM_FILENAME)" -command:php=php "$(VIM_FILENAME)" -command:erlang=escript "$(VIM_FILENAME)" -command:ps1=powershell -file "$(VIM_FILENAME)" -command:scala=scala "$(VIM_FILENAME)" -command:haskell=ghci "$(VIM_FILENAME)" -command:applescript=osascript "$(VIM_FILENAME)" -command:vim=:source % -output=terminal -cwd=$(VIM_FILEDIR) -save=2 diff --git a/config/task_template.ini b/config/task_template.ini deleted file mode 100644 index ab8a44c9..00000000 --- a/config/task_template.ini +++ /dev/null @@ -1,101 +0,0 @@ -{maven} - -[mvn-compile] -command=mvn clean compile test-compile -cwd=$(VIM_ROOT) -output=terminal -errorformat=%f:%l:%m -save=1 - -[mvn-package-skip-test] -command=mvn clean package -Dmaven.test.skip=true -U -cwd=$(VIM_ROOT) -output=terminal -errorformat=%f:%l:%m -save=1 - -[mvn-install-skip-test] -command=mvn clean install -Dmaven.test.skip=true -U -cwd=$(VIM_ROOT) -output=terminal -errorformat=%f:%l:%m -save=1 - -[mvn-test] -command=mvn test -cwd=$(VIM_ROOT) -output=terminal -errorformat=%f:%l:%m -save=1 - -[mvn-test-class] -command=mvn -Dtest=$(VIM_FILENOEXT) test -cwd=$(VIM_ROOT) -output=terminal -errorformat=%f:%l:%m -save=1 - - -[mvn-test-method] -command=mvn -Dtest=$(VIM_FILENOEXT)#$(VIM_CWORD) test -cwd=$(VIM_ROOT) -output=terminal -errorformat=%f:%l:%m -save=1 - - -{plantuml} - -[plantuml-to-svg] -command=java -jar /opt/emacs-pkg/plantuml/plantuml-1.2021.14.jar -svg $(VIM_RELNAME);open $(VIM_FILENOEXT).svg -cwd=$(VIM_ROOT) -output=terminal -errorformat=%f:%l:%m - - -{cargo} - -[cargo-run] -command=cargo run -cwd=$(VIM_ROOT) -output=terminal -errorformat=%f:%l:%m -save=1 - -[cargo-fmt] -command=cargo fmt -cwd=$(VIM_ROOT) -output=terminal -errorformat=%f:%l:%m -save=1 - -[cargo-check] -command=cargo check -cwd=$(VIM_ROOT) -output=terminal -errorformat=%f:%l:%m -save=1 - -[cargo-build] -command=cargo build -cwd=$(VIM_ROOT) -output=terminal -errorformat=%f:%l:%m -save=1 - -[cargo-build-release] -command=cargo build --release -cwd=$(VIM_ROOT) -output=terminal -errorformat=%f:%l:%m -save=1 - - -{markdown} - -[toc] -command=pandoc -s --toc --toc-depth=4 $(VIM_RELNAME) -o $(VIM_RELNAME) -cwd=$(VIM_ROOT) -output=terminal -errorformat=%f:%l:%m -save=1 From c68c5c1ba8ca4cf264210391edf93dfa42da972d Mon Sep 17 00:00:00 2001 From: luokai Date: Sun, 12 Feb 2023 13:42:48 +0800 Subject: [PATCH 0586/1278] sumneko_lua -> lua_ls --- lua/kide/lsp/init.lua | 8 +++++++- lua/kide/lsp/{sumneko_lua.lua => lua_ls.lua} | 0 2 files changed, 7 insertions(+), 1 deletion(-) rename lua/kide/lsp/{sumneko_lua.lua => lua_ls.lua} (100%) diff --git a/lua/kide/lsp/init.lua b/lua/kide/lsp/init.lua index b60ba9a5..cb20b88e 100644 --- a/lua/kide/lsp/init.lua +++ b/lua/kide/lsp/init.lua @@ -1,6 +1,7 @@ local mason_lspconfig = require("mason-lspconfig") mason_lspconfig.setup({ ensure_installed = { + -- "lua-language-server", "sumneko_lua", }, }) @@ -9,7 +10,8 @@ mason_lspconfig.setup({ -- https://github.com/williamboman/nvim-lsp-installer#available-lsps -- { key: 语言 value: 配置文件 } local server_configs = { - sumneko_lua = require("kide.lsp.sumneko_lua"), -- /lua/lsp/lua.lua + -- sumneko_lua -> lua_ls + lua_ls = require("kide.lsp.lua_ls"), -- /lua/lsp/lua.lua -- jdtls = require "lsp.java", -- /lua/lsp/jdtls.lua -- jsonls = require("lsp.jsonls"), clangd = require("kide.lsp.clangd"), @@ -36,6 +38,10 @@ require("mason-lspconfig").setup_handlers({ -- and will be called for each installed server that doesn't have -- a dedicated handler. function(server_name) -- default handler (optional) + -- sumneko_lua -> lua_ls + if server_name == "sumneko_lua" then + server_name = "lua_ls" + end local lspconfig = require("lspconfig") -- tools config local cfg = utils.or_default(server_configs[server_name], {}) diff --git a/lua/kide/lsp/sumneko_lua.lua b/lua/kide/lsp/lua_ls.lua similarity index 100% rename from lua/kide/lsp/sumneko_lua.lua rename to lua/kide/lsp/lua_ls.lua From f36dbae4c0739220f5df75e84bc4e603a0e63b0c Mon Sep 17 00:00:00 2001 From: luokai Date: Sun, 12 Feb 2023 13:48:00 +0800 Subject: [PATCH 0587/1278] highlight.on_yank --- lua/kide/core/basic.lua | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/lua/kide/core/basic.lua b/lua/kide/core/basic.lua index 96646ed1..5fd37c16 100644 --- a/lua/kide/core/basic.lua +++ b/lua/kide/core/basic.lua @@ -140,6 +140,14 @@ vim.opt.mouse = "a" vim.o.foldlevel = 99 -- Using ufo provider need a large value, feel free to decrease the value vim.o.foldlevelstart = 99 +-- Highlight on yank +vim.api.nvim_create_autocmd({ "TextYankPost" }, { + pattern = { "*" }, + callback = function() + vim.highlight.on_yank() + end, +}) + vim.cmd([[ set completeopt=menu,menuone,noselect From 4a7f6db90655c4e50ccf59994e64cf2582a3fbf3 Mon Sep 17 00:00:00 2001 From: luokai Date: Sun, 12 Feb 2023 14:18:00 +0800 Subject: [PATCH 0588/1278] README update --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index d443fc68..caddbde2 100644 --- a/README.md +++ b/README.md @@ -1,8 +1,8 @@ # NVIM IDE -可配置 `Java`, `Rust`, `C/C++`, `JavaScript` 等编程语言开发环境。 极速启动 (60 ~ 100 ms), 注重细节。 +可配置 `Java`, `Rust`, `C/C++`, `JavaScript` 等编程语言开发环境。 极速启动 (`startuptime` 20 ~ 70 ms)。 -使用 `neovim v0.8.1 +` 版本。 +使用 `neovim v0.8.3`+ 版本。 ## 安装 From 866a0b32802980bb682b80f17f9e85a34183e34f Mon Sep 17 00:00:00 2001 From: luokai Date: Sun, 12 Feb 2023 15:03:08 +0800 Subject: [PATCH 0589/1278] java-deps --- lua/kide/plugins/lazy-nvim.lua | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/lua/kide/plugins/lazy-nvim.lua b/lua/kide/plugins/lazy-nvim.lua index b7b853da..544c4062 100644 --- a/lua/kide/plugins/lazy-nvim.lua +++ b/lua/kide/plugins/lazy-nvim.lua @@ -163,9 +163,10 @@ require("lazy").setup({ { "JavaHello/java-deps.nvim", lazy = true, - ft = { "java" }, + ft = "java", + dependencies = "mfussenegger/nvim-jdtls", config = function() - require("java-deps").setup() + require("java-deps").setup({}) end, }, From befb26f388430b5c2c779d4e7e64526f0d60b101 Mon Sep 17 00:00:00 2001 From: luokai Date: Mon, 13 Feb 2023 09:13:01 +0800 Subject: [PATCH 0590/1278] lua_ls --- lua/kide/lsp/init.lua | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/lua/kide/lsp/init.lua b/lua/kide/lsp/init.lua index cb20b88e..2ddec97d 100644 --- a/lua/kide/lsp/init.lua +++ b/lua/kide/lsp/init.lua @@ -1,8 +1,7 @@ local mason_lspconfig = require("mason-lspconfig") mason_lspconfig.setup({ ensure_installed = { - -- "lua-language-server", - "sumneko_lua", + "lua_ls", }, }) @@ -38,10 +37,6 @@ require("mason-lspconfig").setup_handlers({ -- and will be called for each installed server that doesn't have -- a dedicated handler. function(server_name) -- default handler (optional) - -- sumneko_lua -> lua_ls - if server_name == "sumneko_lua" then - server_name = "lua_ls" - end local lspconfig = require("lspconfig") -- tools config local cfg = utils.or_default(server_configs[server_name], {}) From 2d4cd2482ce225fee75578af9a065f83d4547764 Mon Sep 17 00:00:00 2001 From: luokai Date: Mon, 13 Feb 2023 09:47:05 +0800 Subject: [PATCH 0591/1278] =?UTF-8?q?semgrep=20=E6=9A=82=E6=97=B6=E6=97=A0?= =?UTF-8?q?=E6=B3=95=E4=BD=BF=E7=94=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lua/kide/plugins/config/null-ls.lua | 14 +++----------- 1 file changed, 3 insertions(+), 11 deletions(-) diff --git a/lua/kide/plugins/config/null-ls.lua b/lua/kide/plugins/config/null-ls.lua index 1e57cd0b..6fbc0d79 100644 --- a/lua/kide/plugins/config/null-ls.lua +++ b/lua/kide/plugins/config/null-ls.lua @@ -111,17 +111,9 @@ local on_attach = function(client, bufnr) end end -if "1" == os.getenv("SEMGREP_ENABLE") then - table.insert( - sources, - null_ls.builtins.diagnostics.semgrep.with({ - filetypes = { "java" }, - extra_args = { "--config", os.getenv("SEMGREP_RULES_PATH") .. "/java" }, - method = null_ls.methods.DIAGNOSTICS_ON_SAVE, - }) - ) -end -if "1" == os.getenv("PMD_ENABLE") then +if "Y" == os.getenv("SEMGREP_ENABLE") then + table.insert(sources, null_ls.builtins.diagnostics.semgrep) +elseif "Y" == os.getenv("PMD_ENABLE") then table.insert( sources, null_ls.builtins.diagnostics.pmd.with({ From 89271c6d80095d129dd3cfb8e694cae60efb6b71 Mon Sep 17 00:00:00 2001 From: luokai Date: Tue, 14 Feb 2023 09:24:30 +0800 Subject: [PATCH 0592/1278] trans --- lua/kide/plugins/lazy-nvim.lua | 1 + 1 file changed, 1 insertion(+) diff --git a/lua/kide/plugins/lazy-nvim.lua b/lua/kide/plugins/lazy-nvim.lua index 544c4062..68a67ded 100644 --- a/lua/kide/plugins/lazy-nvim.lua +++ b/lua/kide/plugins/lazy-nvim.lua @@ -443,6 +443,7 @@ require("lazy").setup({ { "uga-rosa/translate.nvim", lazy = true, + cmd = "Translate", config = function() require("kide.plugins.config.translate") end, From 3a705be1db3c0540a1aa65ecc5e7c28cfb1fbf40 Mon Sep 17 00:00:00 2001 From: luokai Date: Wed, 15 Feb 2023 09:59:04 +0800 Subject: [PATCH 0593/1278] =?UTF-8?q?=E5=8E=BB=E6=8E=89=E2=9C=94=E5=AD=97?= =?UTF-8?q?=E7=AC=A6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lua/kide/plugins/lazy-nvim.lua | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/lua/kide/plugins/lazy-nvim.lua b/lua/kide/plugins/lazy-nvim.lua index 68a67ded..1d342e2b 100644 --- a/lua/kide/plugins/lazy-nvim.lua +++ b/lua/kide/plugins/lazy-nvim.lua @@ -543,7 +543,11 @@ require("lazy").setup({ "j-hui/fidget.nvim", lazy = true, config = function() - require("fidget").setup({}) + require("fidget").setup({ + text = { + done = "", + }, + }) end, }, @@ -684,4 +688,10 @@ require("lazy").setup({ require("chatgpt").setup({}) end, }, +}, { + ui = { + icons = { + task = " ", + }, + }, }) From 8e5499fe27330da24166567a448b80644a1ca146 Mon Sep 17 00:00:00 2001 From: luokai Date: Fri, 17 Feb 2023 15:30:09 +0800 Subject: [PATCH 0594/1278] make install_jsregexp --- lua/kide/plugins/lazy-nvim.lua | 1 + 1 file changed, 1 insertion(+) diff --git a/lua/kide/plugins/lazy-nvim.lua b/lua/kide/plugins/lazy-nvim.lua index 1d342e2b..afdf24db 100644 --- a/lua/kide/plugins/lazy-nvim.lua +++ b/lua/kide/plugins/lazy-nvim.lua @@ -45,6 +45,7 @@ require("lazy").setup({ "L3MON4D3/LuaSnip", lazy = true, dependencies = { "rafamadriz/friendly-snippets" }, + build = "make install_jsregexp", config = function() require("kide.plugins.config.luasnip") end, From 1d64be621cb93308dbba21583d261ab4c5f9525a Mon Sep 17 00:00:00 2001 From: luokai Date: Fri, 17 Feb 2023 15:48:27 +0800 Subject: [PATCH 0595/1278] lazy_load --- lua/kide/plugins/config/luasnip.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lua/kide/plugins/config/luasnip.lua b/lua/kide/plugins/config/luasnip.lua index 73574b89..818dfff1 100644 --- a/lua/kide/plugins/config/luasnip.lua +++ b/lua/kide/plugins/config/luasnip.lua @@ -503,4 +503,4 @@ ls.filetype_set("cpp", { "c" }) -- Mind that this will extend `ls.snippets` so you need to do it after your own snippets or you -- will need to extend the table yourself instead of setting a new one. -require("luasnip.loaders.from_vscode").load() -- Load only python snippets +require("luasnip.loaders.from_vscode").lazy_load() From 3821fef3c516c61b0168a04d7887d81e0b3d116d Mon Sep 17 00:00:00 2001 From: luokai Date: Sat, 18 Feb 2023 21:00:02 +0800 Subject: [PATCH 0596/1278] lua snippets --- lua/kide/core/keybindings.lua | 6 + lua/kide/plugins/config/luasnip.lua | 449 +--------------------------- lua/kide/snippets/java.lua | 80 +++++ 3 files changed, 88 insertions(+), 447 deletions(-) create mode 100644 lua/kide/snippets/java.lua diff --git a/lua/kide/core/keybindings.lua b/lua/kide/core/keybindings.lua index f8be0306..3cedeb71 100644 --- a/lua/kide/core/keybindings.lua +++ b/lua/kide/core/keybindings.lua @@ -147,6 +147,12 @@ nnoremap l -- nvimTree map("n", "e", ":NvimTreeToggle", opt) + + -- set keybinds for both INSERT and VISUAL. + vim.api.nvim_set_keymap("i", "", "luasnip-next-choice", {}) + vim.api.nvim_set_keymap("s", "", "luasnip-next-choice", {}) + vim.api.nvim_set_keymap("i", "", "luasnip-prev-choice", {}) + vim.api.nvim_set_keymap("s", "", "luasnip-prev-choice", {}) end -- lsp 回调函数快捷键设置 M.maplsp = function(client, buffer) diff --git a/lua/kide/plugins/config/luasnip.lua b/lua/kide/plugins/config/luasnip.lua index 818dfff1..d5e81e7e 100644 --- a/lua/kide/plugins/config/luasnip.lua +++ b/lua/kide/plugins/config/luasnip.lua @@ -1,37 +1,14 @@ local ls = require("luasnip") --- some shorthands... local s = ls.snippet -local sn = ls.snippet_node local t = ls.text_node -local i = ls.insert_node -local f = ls.function_node -local c = ls.choice_node -local d = ls.dynamic_node -local r = ls.restore_node -local l = require("luasnip.extras").lambda -local rep = require("luasnip.extras").rep -local p = require("luasnip.extras").partial -local m = require("luasnip.extras").match -local n = require("luasnip.extras").nonempty -local dl = require("luasnip.extras").dynamic_lambda -local fmt = require("luasnip.extras.fmt").fmt -local fmta = require("luasnip.extras.fmt").fmta local types = require("luasnip.util.types") -local conds = require("luasnip.extras.expand_conditions") - --- If you're reading this file for the first time, best skip to around line 190 --- where the actual snippet-definitions start. -- Every unspecified option will be set to the default. ls.config.set_config({ history = true, -- Update more often, :h events for more info. updateevents = "TextChanged,TextChangedI", - -- Snippets aren't automatically removed if their text is deleted. - -- `delete_check_events` determines on which events (:h events) a check for - -- deleted snippets is performed. - -- This can be especially useful when `history` is enabled. delete_check_events = "TextChanged", ext_opts = { [types.choiceNode] = { @@ -65,425 +42,6 @@ ls.config.set_config({ end, }) --- args is a table, where 1 is the text in Placeholder 1, 2 the text in --- placeholder 2,... -local function copy(args) - return args[1] -end - --- 'recursive' dynamic snippet. Expands to some text followed by itself. -local rec_ls -rec_ls = function() - return sn( - nil, - c(1, { - -- Order is important, sn(...) first would cause infinite loop of expansion. - t(""), - sn(nil, { t({ "", "\t\\item " }), i(1), d(2, rec_ls, {}) }), - }) - ) -end - --- complicated function for dynamicNode. -local function jdocsnip(args, _, old_state) - -- !!! old_state is used to preserve user-input here. DON'T DO IT THAT WAY! - -- Using a restoreNode instead is much easier. - -- View this only as an example on how old_state functions. - local nodes = { - t({ "/**", " * " }), - i(1, "A short Description"), - t({ "", "" }), - } - - -- These will be merged with the snippet; that way, should the snippet be updated, - -- some user input eg. text can be referred to in the new snippet. - local param_nodes = {} - - if old_state then - nodes[2] = i(1, old_state.descr:get_text()) - end - param_nodes.descr = nodes[2] - - -- At least one param. - if string.find(args[2][1], ", ") then - vim.list_extend(nodes, { t({ " * ", "" }) }) - end - - local insert = 2 - for indx, arg in ipairs(vim.split(args[2][1], ", ", true)) do - -- Get actual name parameter. - arg = vim.split(arg, " ", true)[2] - if arg then - local inode - -- if there was some text in this parameter, use it as static_text for this new snippet. - if old_state and old_state[arg] then - inode = i(insert, old_state["arg" .. arg]:get_text()) - else - inode = i(insert) - end - vim.list_extend(nodes, { t({ " * @param " .. arg .. " " }), inode, t({ "", "" }) }) - param_nodes["arg" .. arg] = inode - - insert = insert + 1 - end - end - - if args[1][1] ~= "void" then - local inode - if old_state and old_state.ret then - inode = i(insert, old_state.ret:get_text()) - else - inode = i(insert) - end - - vim.list_extend(nodes, { t({ " * ", " * @return " }), inode, t({ "", "" }) }) - param_nodes.ret = inode - insert = insert + 1 - end - - if vim.tbl_count(args[3]) ~= 1 then - local exc = string.gsub(args[3][2], " throws ", "") - local ins - if old_state and old_state.ex then - ins = i(insert, old_state.ex:get_text()) - else - ins = i(insert) - end - vim.list_extend(nodes, { t({ " * ", " * @throws " .. exc .. " " }), ins, t({ "", "" }) }) - param_nodes.ex = ins - insert = insert + 1 - end - - vim.list_extend(nodes, { t({ " */" }) }) - - local snip = sn(nil, nodes) - -- Error on attempting overwrite. - snip.old_state = param_nodes - return snip -end - --- Make sure to not pass an invalid command, as io.popen() may write over nvim-text. -local function bash(_, _, command) - local file = io.popen(command, "r") - local res = {} - for line in file:lines() do - table.insert(res, line) - end - return res -end - --- Returns a snippet_node wrapped around an insert_node whose initial --- text value is set to the current date in the desired format. -local date_input = function(args, state, fmt) - local fmt = fmt or "%Y-%m-%d" - return sn(nil, i(1, os.date(fmt))) -end - -ls.snippets = { - -- When trying to expand a snippet, luasnip first searches the tables for - -- each filetype specified in 'filetype' followed by 'all'. - -- If ie. the filetype is 'lua.c' - -- - luasnip.lua - -- - luasnip.c - -- - luasnip.all - -- are searched in that order. - all = { - -- trigger is `fn`, second argument to snippet-constructor are the nodes to insert into the buffer on expansion. - s("fn", { - -- Simple static text. - t("//Parameters: "), - -- function, first parameter is the function, second the Placeholders - -- whose text it gets as input. - f(copy, 2), - t({ "", "function " }), - -- Placeholder/Insert. - i(1), - t("("), - -- Placeholder with initial text. - i(2, "int foo"), - -- Linebreak - t({ ") {", "\t" }), - -- Last Placeholder, exit Point of the snippet. - i(0), - t({ "", "}" }), - }), - s("class", { - -- Choice: Switch between two different Nodes, first parameter is its position, second a list of nodes. - c(1, { - t("public "), - t("private "), - }), - t("class "), - i(2), - t(" "), - c(3, { - t("{"), - -- sn: Nested Snippet. Instead of a trigger, it has a position, just like insert-nodes. !!! These don't expect a 0-node!!!! - -- Inside Choices, Nodes don't need a position as the choice node is the one being jumped to. - sn(nil, { - t("extends "), - -- restoreNode: stores and restores nodes. - -- pass position, store-key and nodes. - r(1, "other_class", i(1)), - t(" {"), - }), - sn(nil, { - t("implements "), - -- no need to define the nodes for a given key a second time. - r(1, "other_class"), - t(" {"), - }), - }), - t({ "", "\t" }), - i(0), - t({ "", "}" }), - }), - -- Alternative printf-like notation for defining snippets. It uses format - -- string with placeholders similar to the ones used with Python's .format(). - s( - "fmt1", - fmt("To {title} {} {}.", { - i(2, "Name"), - i(3, "Surname"), - title = c(1, { t("Mr."), t("Ms.") }), - }) - ), - -- To escape delimiters use double them, e.g. `{}` -> `{{}}`. - -- Multi-line format strings by default have empty first/last line removed. - -- Indent common to all lines is also removed. Use the third `opts` argument - -- to control this behaviour. - s( - "fmt2", - fmt( - [[ - foo({1}, {3}) {{ - return {2} * {4} - }} - ]], - { - i(1, "x"), - rep(1), - i(2, "y"), - rep(2), - } - ) - ), - -- Empty placeholders are numbered automatically starting from 1 or the last - -- value of a numbered placeholder. Named placeholders do not affect numbering. - s( - "fmt3", - fmt("{} {a} {} {1} {}", { - t("1"), - t("2"), - a = t("A"), - }) - ), - -- The delimiters can be changed from the default `{}` to something else. - s("fmt4", fmt("foo() { return []; }", i(1, "x"), { delimiters = "[]" })), - -- `fmta` is a convenient wrapper that uses `<>` instead of `{}`. - s("fmt5", fmta("foo() { return <>; }", i(1, "x"))), - -- By default all args must be used. Use strict=false to disable the check - s("fmt6", fmt("use {} only", { t("this"), t("not this") }, { strict = false })), - -- Use a dynamic_node to interpolate the output of a - -- function (see date_input above) into the initial - -- value of an insert_node. - s("novel", { - t("It was a dark and stormy night on "), - d(1, date_input, {}, "%A, %B %d of %Y"), - t(" and the clocks were striking thirteen."), - }), - -- Parsing snippets: First parameter: Snippet-Trigger, Second: Snippet body. - -- Placeholders are parsed into choices with 1. the placeholder text(as a snippet) and 2. an empty string. - -- This means they are not SELECTed like in other editors/Snippet engines. - ls.parser.parse_snippet("lspsyn", "Wow! This ${1:Stuff} really ${2:works. ${3:Well, a bit.}}"), - - -- When wordTrig is set to false, snippets may also expand inside other words. - ls.parser.parse_snippet({ trig = "te", wordTrig = false }, "${1:cond} ? ${2:true} : ${3:false}"), - - -- When regTrig is set, trig is treated like a pattern, this snippet will expand after any number. - ls.parser.parse_snippet({ trig = "%d", regTrig = true }, "A Number!!"), - -- Using the condition, it's possible to allow expansion only in specific cases. - s("cond", { - t("will only expand in c-style comments"), - }, { - condition = function(line_to_cursor, matched_trigger, captures) - -- optional whitespace followed by // - return line_to_cursor:match("%s*//") - end, - }), - -- there's some built-in conditions in "luasnip.extras.expand_conditions". - s("cond2", { - t("will only expand at the beginning of the line"), - }, { - condition = conds.line_begin, - }), - -- The last entry of args passed to the user-function is the surrounding snippet. - s( - { trig = "a%d", regTrig = true }, - f(function(_, snip) - return "Triggered with " .. snip.trigger .. "." - end, {}) - ), - -- It's possible to use capture-groups inside regex-triggers. - s( - { trig = "b(%d)", regTrig = true }, - f(function(_, snip) - return "Captured Text: " .. snip.captures[1] .. "." - end, {}) - ), - s({ trig = "c(%d+)", regTrig = true }, { - t("will only expand for even numbers"), - }, { - condition = function(line_to_cursor, matched_trigger, captures) - return tonumber(captures[1]) % 2 == 0 - end, - }), - -- Use a function to execute any shell command and print its text. - s("bash", f(bash, {}, "ls")), - -- Short version for applying String transformations using function nodes. - s("transform", { - i(1, "initial text"), - t({ "", "" }), - -- lambda nodes accept an l._1,2,3,4,5, which in turn accept any string transformations. - -- This list will be applied in order to the first node given in the second argument. - l(l._1:match("[^i]*$"):gsub("i", "o"):gsub(" ", "_"):upper(), 1), - }), - s("transform2", { - i(1, "initial text"), - t("::"), - i(2, "replacement for e"), - t({ "", "" }), - -- Lambdas can also apply transforms USING the text of other nodes: - l(l._1:gsub("e", l._2), { 1, 2 }), - }), - s({ trig = "trafo(%d+)", regTrig = true }, { - -- env-variables and captures can also be used: - l(l.CAPTURE1:gsub("1", l.TM_FILENAME), {}), - }), - -- Set store_selection_keys = "" (for example) in your - -- luasnip.config.setup() call to populate - -- TM_SELECTED_TEXT/SELECT_RAW/SELECT_DEDENT. - -- In this case: select a URL, hit Tab, then expand this snippet. - s("link_url", { - t(''), - i(1), - t(""), - i(0), - }), - -- Shorthand for repeating the text in a given node. - s("repeat", { i(1, "text"), t({ "", "" }), rep(1) }), - -- Directly insert the ouput from a function evaluated at runtime. - s("part", p(os.date, "%Y")), - -- use matchNodes (`m(argnode, condition, then, else)`) to insert text - -- based on a pattern/function/lambda-evaluation. - -- It's basically a shortcut for simple functionNodes: - s("mat", { - i(1, { "sample_text" }), - t(": "), - m(1, "%d", "contains a number", "no number :("), - }), - -- The `then`-text defaults to the first capture group/the entire - -- match if there are none. - s("mat2", { - i(1, { "sample_text" }), - t(": "), - m(1, "[abc][abc][abc]"), - }), - -- It is even possible to apply gsubs' or other transformations - -- before matching. - s("mat3", { - i(1, { "sample_text" }), - t(": "), - m(1, l._1:gsub("[123]", ""):match("%d"), "contains a number that isn't 1, 2 or 3!"), - }), - -- `match` also accepts a function in place of the condition, which in - -- turn accepts the usual functionNode-args. - -- The condition is considered true if the function returns any - -- non-nil/false-value. - -- If that value is a string, it is used as the `if`-text if no if is explicitly given. - s("mat4", { - i(1, { "sample_text" }), - t(": "), - m(1, function(args) - -- args is a table of multiline-strings (as usual). - return (#args[1][1] % 2 == 0 and args[1]) or nil - end), - }), - -- The nonempty-node inserts text depending on whether the arg-node is - -- empty. - s("nempty", { - i(1, "sample_text"), - n(1, "i(1) is not empty!"), - }), - -- dynamic lambdas work exactly like regular lambdas, except that they - -- don't return a textNode, but a dynamicNode containing one insertNode. - -- This makes it easier to dynamically set preset-text for insertNodes. - s("dl1", { - i(1, "sample_text"), - t({ ":", "" }), - dl(2, l._1, 1), - }), - -- Obviously, it's also possible to apply transformations, just like lambdas. - s("dl2", { - i(1, "sample_text"), - i(2, "sample_text_2"), - t({ "", "" }), - dl(3, l._1:gsub("\n", " linebreak ") .. l._2, { 1, 2 }), - }), - }, - java = { - -- Very long example for a java class. - s("fn", { - d(6, jdocsnip, { 2, 4, 5 }), - t({ "", "" }), - c(1, { - t("public "), - t("private "), - }), - c(2, { - t("void"), - t("String"), - t("char"), - t("int"), - t("double"), - t("boolean"), - i(nil, ""), - }), - t(" "), - i(3, "myFunc"), - t("("), - i(4), - t(")"), - c(5, { - t(""), - sn(nil, { - t({ "", " throws " }), - i(1), - }), - }), - t({ " {", "\t" }), - i(0), - t({ "", "}" }), - }), - }, - tex = { - -- rec_ls is self-referencing. That makes this snippet 'infinite' eg. have as many - -- \item as necessary by utilizing a choiceNode. - s("ls", { - t({ "\\begin{itemize}", "\t\\item " }), - i(1), - d(2, rec_ls, {}), - t({ "", "\\end{itemize}" }), - }), - }, -} - -- autotriggered snippets have to be defined in a separate table, luasnip.autosnippets. ls.autosnippets = { all = { @@ -498,9 +56,6 @@ ls.filetype_extend("lua", { "c" }) -- in a cpp file: search c-snippets, then all-snippets only (no cpp-snippets!!). ls.filetype_set("cpp", { "c" }) --- Beside defining your own snippets you can also load snippets from "vscode-like" packages --- that expose snippets in json files, for example . --- Mind that this will extend `ls.snippets` so you need to do it after your own snippets or you --- will need to extend the table yourself instead of setting a new one. +-- require("luasnip.loaders.from_vscode").lazy_load() -require("luasnip.loaders.from_vscode").lazy_load() +require("kide.snippets.java") diff --git a/lua/kide/snippets/java.lua b/lua/kide/snippets/java.lua new file mode 100644 index 00000000..33fded53 --- /dev/null +++ b/lua/kide/snippets/java.lua @@ -0,0 +1,80 @@ +local ls = require("luasnip") + +-- some shorthands... +local s = ls.snippet +local sn = ls.snippet_node +local t = ls.text_node +local i = ls.insert_node +local f = ls.function_node +local c = ls.choice_node +local d = ls.dynamic_node +local r = ls.restore_node +local l = require("luasnip.extras").lambda +local rep = require("luasnip.extras").rep +local p = require("luasnip.extras").partial +local m = require("luasnip.extras").match +local n = require("luasnip.extras").nonempty +local dl = require("luasnip.extras").dynamic_lambda +local fmt = require("luasnip.extras.fmt").fmt +local fmta = require("luasnip.extras.fmt").fmta +local types = require("luasnip.util.types") +local conds = require("luasnip.extras.expand_conditions") + +ls.add_snippets("java", { + s("sout", { + t({ "System.out.println(" }), + i(1), + t({ ");" }), + }), + s("main", { + t({ "public static void main(String[] args) {" }), + t({ "", "\t" }), + i(0), + t({ "", "}" }), + }), + s("field", { + c(1, { + t("private"), + t("public"), + t("protected"), + }), + t(" "), + c(2, { + t(""), + t({ "static " }), + t({ "final static " }), + }), + i(3, "String"), + t(" "), + i(4, "name"), + t({ ";" }), + }), + s("fn", { + c(1, { + t("public"), + t("protected"), + t("private"), + }), + t(" "), + c(2, { + t(""), + t({ "static " }), + t({ "final static " }), + }), + i(3, "void"), + t(" "), + i(4, "name"), + t("()"), + c(5, { + t(""), + sn(nil, { + t({ " throws " }), + i(1, "Exception"), + }), + }), + t(" {"), + t({ "", "\t" }), + i(0), + t({ "", "}" }), + }), +}) From 80a56e405ce8987a722cbb15a5a160034ec9efa3 Mon Sep 17 00:00:00 2001 From: luokai Date: Sat, 18 Feb 2023 21:49:03 +0800 Subject: [PATCH 0597/1278] ifn, afn --- lua/kide/snippets/java.lua | 181 ++++++++++++++++++++++++++++++++++++- 1 file changed, 180 insertions(+), 1 deletion(-) diff --git a/lua/kide/snippets/java.lua b/lua/kide/snippets/java.lua index 33fded53..6c1f3bc7 100644 --- a/lua/kide/snippets/java.lua +++ b/lua/kide/snippets/java.lua @@ -64,8 +64,56 @@ ls.add_snippets("java", { i(3, "void"), t(" "), i(4, "name"), - t("()"), + t("("), c(5, { + t(""), + sn(nil, { + i(1, { "String" }), + t(" "), + i(2, { "arg1" }), + }), + sn(nil, { + i(1, { "String" }), + t(" "), + i(2, { "arg1" }), + t(", "), + i(3, { "String" }), + t(" "), + i(4, { "arg2" }), + }), + sn(nil, { + i(1, { "String" }), + t(" "), + i(2, { "arg1" }), + t(", "), + i(3, { "String" }), + t(" "), + i(4, { "arg2" }), + t(", "), + i(5, { "String" }), + t(" "), + i(6, { "arg3" }), + }), + sn(nil, { + i(1, { "String" }), + t(" "), + i(2, { "arg1" }), + t(", "), + i(3, { "String" }), + t(" "), + i(4, { "arg2" }), + t(", "), + i(5, { "String" }), + t(" "), + i(6, { "arg3" }), + t(", "), + i(7, { "String" }), + t(" "), + i(8, { "arg4" }), + }), + }), + t(")"), + c(6, { t(""), sn(nil, { t({ " throws " }), @@ -77,4 +125,135 @@ ls.add_snippets("java", { i(0), t({ "", "}" }), }), + + s("afn", { + c(1, { + t("protected"), + t("public"), + }), + t(" abstract "), + i(2, "void"), + t(" "), + i(3, "name"), + t("("), + c(4, { + t(""), + sn(nil, { + i(1, { "String" }), + t(" "), + i(2, { "arg1" }), + }), + sn(nil, { + i(1, { "String" }), + t(" "), + i(2, { "arg1" }), + t(", "), + i(3, { "String" }), + t(" "), + i(4, { "arg2" }), + }), + sn(nil, { + i(1, { "String" }), + t(" "), + i(2, { "arg1" }), + t(", "), + i(3, { "String" }), + t(" "), + i(4, { "arg2" }), + t(", "), + i(5, { "String" }), + t(" "), + i(6, { "arg3" }), + }), + sn(nil, { + i(1, { "String" }), + t(" "), + i(2, { "arg1" }), + t(", "), + i(3, { "String" }), + t(" "), + i(4, { "arg2" }), + t(", "), + i(5, { "String" }), + t(" "), + i(6, { "arg3" }), + t(", "), + i(7, { "String" }), + t(" "), + i(8, { "arg4" }), + }), + }), + t(")"), + c(5, { + t(""), + sn(nil, { + t({ " throws " }), + i(1, "Exception"), + }), + }), + t(";"), + }), + + s("ifn", { + i(1, "void"), + t(" "), + i(2, "name"), + t("("), + c(3, { + t(""), + sn(nil, { + i(1, { "String" }), + t(" "), + i(2, { "arg1" }), + }), + sn(nil, { + i(1, { "String" }), + t(" "), + i(2, { "arg1" }), + t(", "), + i(3, { "String" }), + t(" "), + i(4, { "arg2" }), + }), + sn(nil, { + i(1, { "String" }), + t(" "), + i(2, { "arg1" }), + t(", "), + i(3, { "String" }), + t(" "), + i(4, { "arg2" }), + t(", "), + i(5, { "String" }), + t(" "), + i(6, { "arg3" }), + }), + sn(nil, { + i(1, { "String" }), + t(" "), + i(2, { "arg1" }), + t(", "), + i(3, { "String" }), + t(" "), + i(4, { "arg2" }), + t(", "), + i(5, { "String" }), + t(" "), + i(6, { "arg3" }), + t(", "), + i(7, { "String" }), + t(" "), + i(8, { "arg4" }), + }), + }), + t(")"), + c(4, { + t(""), + sn(nil, { + t({ " throws " }), + i(1, "Exception"), + }), + }), + t(";"), + }), }) From cfeadfbfbf5dc7fe8222b1b571f8d430b388c079 Mon Sep 17 00:00:00 2001 From: luokai Date: Sun, 19 Feb 2023 10:50:28 +0800 Subject: [PATCH 0598/1278] final --- lua/kide/snippets/java.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lua/kide/snippets/java.lua b/lua/kide/snippets/java.lua index 6c1f3bc7..8843e85b 100644 --- a/lua/kide/snippets/java.lua +++ b/lua/kide/snippets/java.lua @@ -59,7 +59,7 @@ ls.add_snippets("java", { c(2, { t(""), t({ "static " }), - t({ "final static " }), + t({ "final " }), }), i(3, "void"), t(" "), From dd8d9a799976bb8c5f71ac7abffd7cc4978f9702 Mon Sep 17 00:00:00 2001 From: luokai Date: Sun, 19 Feb 2023 11:18:39 +0800 Subject: [PATCH 0599/1278] final --- lua/kide/snippets/java.lua | 1 + 1 file changed, 1 insertion(+) diff --git a/lua/kide/snippets/java.lua b/lua/kide/snippets/java.lua index 8843e85b..b858046d 100644 --- a/lua/kide/snippets/java.lua +++ b/lua/kide/snippets/java.lua @@ -42,6 +42,7 @@ ls.add_snippets("java", { c(2, { t(""), t({ "static " }), + t({ "final " }), t({ "final static " }), }), i(3, "String"), From bbd9dea121219106c06865541742997370551fdc Mon Sep 17 00:00:00 2001 From: luokai Date: Mon, 20 Feb 2023 09:25:49 +0800 Subject: [PATCH 0600/1278] =?UTF-8?q?=E5=88=A0=E9=99=A4=E8=BF=87=E6=97=B6?= =?UTF-8?q?=E9=80=89=E9=A1=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lua/kide/plugins/config/nvim-tree.lua | 2 -- 1 file changed, 2 deletions(-) diff --git a/lua/kide/plugins/config/nvim-tree.lua b/lua/kide/plugins/config/nvim-tree.lua index 6e0e98d5..93830b5f 100644 --- a/lua/kide/plugins/config/nvim-tree.lua +++ b/lua/kide/plugins/config/nvim-tree.lua @@ -4,8 +4,6 @@ end require("nvim-tree").setup({ disable_netrw = true, hijack_netrw = true, - open_on_setup = false, - ignore_ft_on_setup = { "dashboard", "alpha" }, -- auto_close = true, auto_reload_on_write = true, open_on_tab = false, From d6c2032798d67853cb698571d03896b82689d419 Mon Sep 17 00:00:00 2001 From: luokai Date: Mon, 20 Feb 2023 09:53:40 +0800 Subject: [PATCH 0601/1278] bufopts --- lua/kide/core/keybindings.lua | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lua/kide/core/keybindings.lua b/lua/kide/core/keybindings.lua index 3cedeb71..4d76a318 100644 --- a/lua/kide/core/keybindings.lua +++ b/lua/kide/core/keybindings.lua @@ -159,6 +159,7 @@ M.maplsp = function(client, buffer) vim.api.nvim_buf_set_option(buffer, "omnifunc", "v:lua.vim.lsp.omnifunc") vim.api.nvim_buf_set_option(buffer, "formatexpr", "v:lua.vim.lsp.formatexpr()") + local bufopts = { noremap = true, silent = true, buffer = buffer } vim.api.nvim_buf_set_keymap(buffer, "n", "K", "lua vim.lsp.buf.hover()", opt) -- rename vim.api.nvim_buf_set_keymap(buffer, "n", "rn", "lua vim.lsp.buf.rename()", opt) @@ -224,7 +225,7 @@ M.maplsp = function(client, buffer) return require("kide.lsp.utils").filter_format_lsp_client(c, bfn) end, }) - end, opt) + end, bufopts) vim.api.nvim_buf_set_keymap( buffer, "v", From 6af18ad8f34e56145299fe2945b067f0ca95ded8 Mon Sep 17 00:00:00 2001 From: luokai Date: Wed, 22 Feb 2023 23:40:53 +0800 Subject: [PATCH 0602/1278] =?UTF-8?q?=E9=85=8D=E7=BD=AE=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lua/kide/core/basic.lua | 58 ++++---- lua/kide/core/keybindings.lua | 132 +++++-------------- lua/kide/core/utils/init.lua | 9 +- lua/kide/plugins/config/markdown-preview.lua | 93 +------------ lua/kide/plugins/config/rest-nvim.lua | 10 ++ lua/kide/plugins/lazy-nvim.lua | 16 +-- 6 files changed, 72 insertions(+), 246 deletions(-) diff --git a/lua/kide/core/basic.lua b/lua/kide/core/basic.lua index 5fd37c16..c40df75d 100644 --- a/lua/kide/core/basic.lua +++ b/lua/kide/core/basic.lua @@ -32,7 +32,7 @@ vim.opt.ruler = false vim.wo.cursorline = true -- 右侧参考线,超过表示代码太长了,考虑换行 --- vim.wo.colorcolumn = "80" +vim.wo.colorcolumn = "120" -- 边搜索边高亮 vim.o.incsearch = true @@ -79,17 +79,6 @@ autocmd("FileType", { end, }) --- vim.cmd("autocmd Filetype lua setlocal ts=2 sw=2 expandtab") --- vim.cmd("autocmd Filetype js setlocal ts=2 sw=2 expandtab") --- vim.cmd("autocmd Filetype javascript setlocal ts=2 sw=2 expandtab") --- vim.cmd("autocmd Filetype json setlocal ts=2 sw=2 expandtab") --- vim.cmd("autocmd Filetype css setlocal ts=2 sw=2 expandtab") --- vim.cmd("autocmd Filetype html setlocal ts=2 sw=2 expandtab") --- vim.cmd("autocmd Filetype xml setlocal ts=2 sw=2 expandtab") --- vim.cmd("autocmd Filetype yaml setlocal ts=2 sw=2 expandtab") --- vim.cmd("autocmd Filetype http setlocal ts=2 sw=2 expandtab") --- vim.cmd("autocmd Filetype markdown setlocal ts=2 sw=2 expandtab") - -- 新行对齐当前行,空格替代tab vim.o.expandtab = true vim.bo.expandtab = true @@ -148,26 +137,25 @@ vim.api.nvim_create_autocmd({ "TextYankPost" }, { end, }) -vim.cmd([[ -set completeopt=menu,menuone,noselect - -if exists('g:neovide') - " let g:neovide_refresh_rate=60 - let g:neovide_cursor_vfx_mode = "railgun" - set guifont=Hack\ Nerd\ Font\ Mono,Hack:h13 - " let g:neovide_transparency=1 - let g:neovide_fullscreen=v:true - " let g:neovide_remember_window_size = v:true - let g:neovide_input_use_logo=v:true - let g:neovide_profiler = v:false -else -endif -if has("autocmd") - au BufReadPost * if line("'\"") > 1 && line("'\"") <= line("$") | exe "normal! g'\"" | endif -endif - -" set grepprg=rg\ --vimgrep -set grepprg=rg\ --vimgrep\ --no-heading\ --smart-case -" set grepformat^=%f:%l:%c:%m -set grepformat=%f:%l:%c:%m,%f:%l:%m -]]) +vim.opt_global.completeopt = "menu,menuone,noselect" +if vim.g.neovide then + vim.g.neovide_cursor_vfx_mode = "railgun" + vim.opt_global.guifont = "Hack Nerd Font Mono,Hack:h13" + vim.g.neovide_transparency = 1 + vim.g.neovide_fullscreen = true + vim.g.neovide_input_use_logo = true + vim.g.neovide_profiler = false +end + +autocmd("BufReadPost", { + pattern = "*", + callback = function() + local l = vim.fn.line("'\"") + if l > 1 and l <= vim.fn.line("$") then + vim.fn.execute("normal! g'\"") + end + end, +}) + +vim.opt_global.grepprg = "rg --vimgrep --no-heading --smart-case" +vim.opt_global.grepformat = "%f:%l:%c:%m,%f:%l:%m" diff --git a/lua/kide/core/keybindings.lua b/lua/kide/core/keybindings.lua index 4d76a318..311884d7 100644 --- a/lua/kide/core/keybindings.lua +++ b/lua/kide/core/keybindings.lua @@ -4,12 +4,11 @@ local map = vim.api.nvim_set_keymap local opt = { noremap = true, silent = true } local keymap = vim.keymap.set - local M = {} M.setup = function() -- Esc - -- map('i', 'jk', '', opt) + map("i", "jk", "", opt) -- n 模式下复制内容到系统剪切板 map("n", "c", '"+yy', opt) -- v 模式下复制内容到系统剪切板 @@ -18,9 +17,12 @@ M.setup = function() map("n", "v", '"+p', opt) -- 取消搜索高亮显示 map("n", "", ":nohlsearch", opt) - -- %bd 删除所有缓冲区, e# 打开最后一个缓冲区, bd# 关闭[No Name] - -- map('n', 'o', ':%bd|e#|bd#', opt) - -- map('n', 'o', 'lua require("kide.core.utils").close_other_bufline()', opt) + + keymap("n", "", "h", opt) + keymap("n", "", "j", opt) + keymap("n", "", "k", opt) + keymap("n", "", "l", opt) + vim.api.nvim_create_user_command("BufferCloseOther", function() require("kide.core.utils").close_other_bufline() end, {}) @@ -39,29 +41,12 @@ M.setup = function() map("t", "", "", opt) map("t", "jk", "", opt) - -- Leaderf - -- vim.g.Lf_ShortcutF = '' - -- map('n', '', ':=printf("Leaderf! rg -e %s ", expand(""))', {}) - -- map('v', '', ':=printf("Leaderf! rg -e %s ", leaderf#Rg#visual())', {}) - -- map('n', 'r', ':Leaderf --nowrap task', {}) - - -- vim-floaterm - -- vim.g.floaterm_keymap_new = 'ft' - -- map('n', '', ':FloatermToggle', opt) - -- map('t', ' ', '::FloatermToggle', opt) + -- ToggleTerm map("n", "", ":ToggleTerm", opt) -- symbols-outline.nvim map("n", "o", ":SymbolsOutline", opt) - -- trouble.nvim - -- see lsp map - -- map('n', 'x', 'Trouble', opt) - - -- lspsaga - -- map('n', 'K', ':Lspsaga hover_doc', opt) - -- map('n', 'gr', ':Lspsaga lsp_finder', opt) - -- Telescope map("n", "ff", "Telescope find_files", opt) keymap("v", "ff", function() @@ -88,59 +73,36 @@ M.setup = function() -- camel_case require("kide.core.utils").camel_case_init() - -- vim-easy-align - vim.cmd([[ -" Start interactive EasyAlign in visual mode (e.g. vipga) -xmap ga (EasyAlign) - -" Start interactive EasyAlign for a motion/text object (e.g. gaip) -nmap ga (EasyAlign) -]]) - -- nvim-dap - vim.cmd([[ -nnoremap :lua require'dap'.continue() -nnoremap :lua require'dap'.step_over() -nnoremap :lua require'dap'.step_into() -nnoremap :lua require'dap'.step_out() -nnoremap db :lua require'dap'.toggle_breakpoint() -nnoremap dB :lua require'dap'.set_breakpoint(vim.fn.input('Breakpoint condition: ')) -nnoremap dp :lua require'dap'.set_breakpoint(nil, nil, vim.fn.input('Log point message: ')) -nnoremap dr :lua require'dap'.repl.open() -nnoremap dl :lua require'dap'.run_last() -]]) + keymap("n", "", ":lua require'dap'.continue()", opt) + keymap("n", "", ":lua require'dap'.step_over()", opt) + keymap("n", "", ":lua require'dap'.step_into()", opt) + keymap("n", "", ":lua require'dap'.step_out()", opt) + keymap("n", "db", ":lua require'dap'.toggle_breakpoint()", opt) + keymap("n", "dB", ":lua require'dap'.set_breakpoint(vim.fn.input('Breakpoint condition: '))", opt) + keymap("n", "dp", ":lua require'dap'.set_breakpoint(nil, nil, vim.fn.input('Log point message: '))", opt) + keymap("n", "dr", ":lua require'dap'.repl.open()", opt) + keymap("n", "dl", ":lua require'dap'.run_last()", opt) -- nvim-dap-ui - vim.cmd([[ -nnoremap dr :lua require("dapui").float_element(vim.Nil, { enter = true}) -]]) + keymap("n", "ds", ':lua require("dapui").float_element(vim.Nil, { enter = true}) ', opt) -- bufferline.nvim - vim.cmd([[ -nnoremap 1 BufferLineGoToBuffer 1 -nnoremap 2 BufferLineGoToBuffer 2 -nnoremap 3 BufferLineGoToBuffer 3 -nnoremap 4 BufferLineGoToBuffer 4 -nnoremap 5 BufferLineGoToBuffer 5 -nnoremap 6 BufferLineGoToBuffer 6 -nnoremap 7 BufferLineGoToBuffer 7 -nnoremap 8 BufferLineGoToBuffer 8 -nnoremap 9 BufferLineGoToBuffer 9 - -nnoremap h -nnoremap j -nnoremap k -nnoremap l -]]) + keymap("n", "1", "BufferLineGoToBuffer 1", opt) + keymap("n", "2", "BufferLineGoToBuffer 2", opt) + keymap("n", "3", "BufferLineGoToBuffer 3", opt) + keymap("n", "4", "BufferLineGoToBuffer 4", opt) + keymap("n", "5", "BufferLineGoToBuffer 5", opt) + keymap("n", "6", "BufferLineGoToBuffer 6", opt) + keymap("n", "7", "BufferLineGoToBuffer 7", opt) + keymap("n", "8", "BufferLineGoToBuffer 8", opt) + keymap("n", "9", "BufferLineGoToBuffer 9", opt) -- nvim-spectre map("n", "S", "lua require('spectre').open()", opt) -- search current word map("n", "fr", "lua require('spectre').open_visual({select_word=true})", opt) map("v", "fr", ":lua require('spectre').open_visual()", opt) - -- search in current file - -- map("n", "fp", "viw:lua require('spectre').open_file_search()", opt) - -- run command :Spectre -- ToggleTask map("n", "ts", "Telescope toggletasks spawn", opt) @@ -212,10 +174,6 @@ M.maplsp = function(client, buffer) "lua vim.diagnostic.goto_next({ severity = vim.diagnostic.severity.ERROR })", opt ) - -- mapbuf('n', 'q', 'lua vim.diagnostic.setloclist()', opt) - -- leader + = - -- vim.api.nvim_buf_set_keymap(bufnr, 'n', '=', 'lua vim.lsp.buf.format()', opt) - -- vim.api.nvim_buf_set_keymap(bufnr, 'v', '=', 'lua vim.lsp.buf.range_formatting()', opt) keymap("n", "=", function() local bfn = vim.api.nvim_get_current_buf() @@ -233,12 +191,6 @@ M.maplsp = function(client, buffer) 'lua require("kide.lsp.utils").format_range_operator()', opt ) - -- mapbuf('v', '=', 'lua vim.lsp.buf.formatting()', opt) - -- mapbuf('n', '', 'lua vim.lsp.buf.signature_help()', opt) - -- mapbuf('n', 'wa', 'lua vim.lsp.buf.add_workspace_folder()', opt) - -- mapbuf('n', 'wr', 'lua vim.lsp.buf.remove_workspace_folder()', opt) - -- mapbuf('n', 'wl', 'lua print(vim.inspect(vim.lsp.buf.list_workspace_folders()))', opt) - -- mapbuf('n', 'D', 'lua vim.lsp.buf.type_definition()', opt) vim.api.nvim_buf_set_keymap(buffer, "n", "xw", "Telescope diagnostics", opt) vim.api.nvim_buf_set_keymap( @@ -248,12 +200,6 @@ M.maplsp = function(client, buffer) "lua require('telescope.builtin').diagnostics({ severity = vim.diagnostic.severity.ERROR })", opt ) - -- vim.api.nvim_buf_set_keymap(bufnr, "n", "xw", "Trouble workspace_diagnostics", opt) - -- vim.api.nvim_buf_set_keymap(bufnr, "n", "xx", "Trouble", opt) - -- vim.api.nvim_buf_set_keymap(bufnr, "n", "xw", "Trouble workspace_diagnostics", opt) - -- vim.api.nvim_buf_set_keymap(bufnr, "n", "xd", "Trouble document_diagnostics", opt) - -- vim.api.nvim_buf_set_keymap(bufnr, "n", "xq", "Trouble quickfix", opt) - -- >= 0.8.x if client.server_capabilities.documentHighlightProvider then vim.cmd(string.format("au CursorHold lua vim.lsp.buf.document_highlight()", buffer)) @@ -275,15 +221,6 @@ M.cmp = function(cmp) return col ~= 0 and vim.api.nvim_buf_get_lines(0, line - 1, line, true)[1]:sub(col, col):match("%s") == nil end return { - -- 上一个 - -- [''] = cmp.mapping.select_prev_item(), - -- 下一个 - -- [''] = cmp.mapping.select_next_item(), - -- [""] = cmp.mapping.select_prev_item(), - -- [''] = cmp.mapping.close(), - -- 确认 - -- Accept currently selected item. If none selected, `select` first item. - -- Set `select` to `false` to only confirm explicitly selected items. -- [""] = cmp.mapping.scroll_docs(-4), -- [""] = cmp.mapping.scroll_docs(4), [""] = cmp.mapping.select_prev_item(), @@ -328,19 +265,16 @@ M.cmp = function(cmp) } end -M.rest_nvim = function() - -- rest-nvim - vim.cmd([[ -command! -buffer Http :lua require'rest-nvim'.run() -command! -buffer HttpCurl :lua require'rest-nvim'.run(true) -command! -buffer HttpLast :lua require'rest-nvim'.last() -]]) -end - M.ufo_mapkey = function() -- Using ufo provider need remap `zR` and `zM`. If Neovim is 0.6.1, remap yourself vim.keymap.set("n", "zR", require("ufo").openAllFolds) vim.keymap.set("n", "zM", require("ufo").closeAllFolds) end +M.easy_align = function() + -- vim-easy-align + keymap("n", "ga", "(EasyAlign)") + keymap("x", "ga", "(EasyAlign)") +end + return M diff --git a/lua/kide/core/utils/init.lua b/lua/kide/core/utils/init.lua index c6211a42..2f21695e 100644 --- a/lua/kide/core/utils/init.lua +++ b/lua/kide/core/utils/init.lua @@ -148,12 +148,9 @@ M.test = function(a) print(a) end M.camel_case_init = function() - vim.cmd([[ - " command! -complete=customlist,coreutils#cmdline#complete -nargs=* -bang -range - command! -nargs=* -range - \ CamelCase - \ lua require('kide.core.utils').camel_case_start(, , ) -]]) + vim.api.nvim_create_user_command("CamelCase", function(o) + require("kide.core.utils").camel_case_start(o.range, o.line1, o.line2) + end, { range = 0, nargs = 0 }) end -- print(M.camel_case("helloWorldAaAaAxC")) diff --git a/lua/kide/plugins/config/markdown-preview.lua b/lua/kide/plugins/config/markdown-preview.lua index 13a23f5d..3c8ce8bf 100644 --- a/lua/kide/plugins/config/markdown-preview.lua +++ b/lua/kide/plugins/config/markdown-preview.lua @@ -1,92 +1 @@ -vim.cmd([[ -" set to 1, nvim will open the preview window after entering the markdown buffer -" default: 0 -let g:mkdp_auto_start = 0 - -" set to 1, the nvim will auto close current preview window when change -" from markdown buffer to another buffer -" default: 1 -let g:mkdp_auto_close = 1 - -" set to 1, the vim will refresh markdown when save the buffer or -" leave from insert mode, default 0 is auto refresh markdown as you edit or -" move the cursor -" default: 0 -let g:mkdp_refresh_slow = 0 - -" set to 1, the MarkdownPreview command can be use for all files, -" by default it can be use in markdown file -" default: 0 -let g:mkdp_command_for_global = 0 - -" set to 1, preview server available to others in your network -" by default, the server listens on localhost (127.0.0.1) -" default: 0 -let g:mkdp_open_to_the_world = 0 - -" use custom IP to open preview page -" useful when you work in remote vim and preview on local browser -" more detail see: https://github.com/iamcco/markdown-preview.nvim/pull/9 -" default empty -let g:mkdp_open_ip = '' - -" specify browser to open preview page -" default: '' -let g:mkdp_browser = '' - -" set to 1, echo preview page url in command line when open preview page -" default is 0 -let g:mkdp_echo_preview_url = 0 - -" a custom vim function name to open preview page -" this function will receive url as param -" default is empty -let g:mkdp_browserfunc = '' - -" options for markdown render -" mkit: markdown-it options for render -" katex: katex options for math -" uml: markdown-it-plantuml options -" maid: mermaid options -" disable_sync_scroll: if disable sync scroll, default 0 -" sync_scroll_type: 'middle', 'top' or 'relative', default value is 'middle' -" middle: mean the cursor position alway show at the middle of the preview page -" top: mean the vim top viewport alway show at the top of the preview page -" relative: mean the cursor position alway show at the relative positon of the preview page -" hide_yaml_meta: if hide yaml metadata, default is 1 -" sequence_diagrams: js-sequence-diagrams options -" content_editable: if enable content editable for preview page, default: v:false -" disable_filename: if disable filename header for preview page, default: 0 -let g:mkdp_preview_options = { - \ 'mkit': {}, - \ 'katex': {}, - \ 'uml': {}, - \ 'maid': {}, - \ 'disable_sync_scroll': 0, - \ 'sync_scroll_type': 'middle', - \ 'hide_yaml_meta': 1, - \ 'sequence_diagrams': {}, - \ 'flowchart_diagrams': {}, - \ 'content_editable': v:false, - \ 'disable_filename': 0 - \ } - -" use a custom markdown style must be absolute path -" like '/Users/username/markdown.css' or expand('~/markdown.css') -let g:mkdp_markdown_css = '' - -" use a custom highlight style must absolute path -" like '/Users/username/highlight.css' or expand('~/highlight.css') -let g:mkdp_highlight_css = '' - -" use a custom port to start server or random for empty -let g:mkdp_port = '' - -" preview page title -" ${name} will be replace with the file name -let g:mkdp_page_title = '${name}' - -" recognized filetypes -" these filetypes will have MarkdownPreview... commands -let g:mkdp_filetypes = ['markdown'] -]]) +vim.g.mkdp_page_title = "${name}" diff --git a/lua/kide/plugins/config/rest-nvim.lua b/lua/kide/plugins/config/rest-nvim.lua index 8efe3902..ecbc4ffe 100644 --- a/lua/kide/plugins/config/rest-nvim.lua +++ b/lua/kide/plugins/config/rest-nvim.lua @@ -20,3 +20,13 @@ require("rest-nvim").setup({ custom_dynamic_variables = {}, yank_dry_run = true, }) +local group = vim.api.nvim_create_augroup("kide_jdtls_rest_http", { clear = true }) +vim.api.nvim_create_autocmd({ "FileType" }, { + group = group, + pattern = { "http" }, + callback = function(o) + vim.api.nvim_buf_create_user_command(o.buf, "Http", ":lua require'rest-nvim'.run()", { nargs = 0 }) + vim.api.nvim_buf_create_user_command(o.buf, "HttpCurl", ":lua require'rest-nvim'.run(true)", { nargs = 0 }) + vim.api.nvim_buf_create_user_command(o.buf, "HttpLast", ":lua require'rest-nvim'.last()", { nargs = 0 }) + end, +}) diff --git a/lua/kide/plugins/lazy-nvim.lua b/lua/kide/plugins/lazy-nvim.lua index afdf24db..8a894479 100644 --- a/lua/kide/plugins/lazy-nvim.lua +++ b/lua/kide/plugins/lazy-nvim.lua @@ -460,10 +460,7 @@ require("lazy").setup({ lazy = true, cmd = "EasyAlign", config = function() - vim.cmd([[ - xmap ga (EasyAlign) - nmap ga (EasyAlign) - ]]) + require("kide.core.keybindings").easy_align() end, }, @@ -503,16 +500,7 @@ require("lazy").setup({ lazy = true, ft = "http", config = function() - vim.cmd([[ - function! s:http_rest_init() abort - lua require('kide.plugins.config.rest-nvim') - lua require('kide.core.keybindings').rest_nvim() - endfunction - augroup http_rest - autocmd! - autocmd FileType http call s:http_rest_init() - augroup end - ]]) + require("kide.plugins.config.rest-nvim") end, }, From 017299f6923725a7ecf3e02f66fb260ac6662704 Mon Sep 17 00:00:00 2001 From: luokai Date: Fri, 24 Feb 2023 20:43:52 +0800 Subject: [PATCH 0603/1278] try --- lua/kide/snippets/java.lua | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/lua/kide/snippets/java.lua b/lua/kide/snippets/java.lua index b858046d..72e3fedd 100644 --- a/lua/kide/snippets/java.lua +++ b/lua/kide/snippets/java.lua @@ -21,6 +21,17 @@ local types = require("luasnip.util.types") local conds = require("luasnip.extras.expand_conditions") ls.add_snippets("java", { + s("try_catch", { + t({ "try {" }), + t({ "", "\t" }), + i(1), + t({ "", "} catch (" }), + i(2, "Throwable"), + t({ " e) {" }), + t({ "", "\t" }), + i(3), + t({ "", "}" }), + }), s("sout", { t({ "System.out.println(" }), i(1), From 74fd6d39ee201759b42f0045d7e8c9261b1354d3 Mon Sep 17 00:00:00 2001 From: luokai Date: Fri, 24 Feb 2023 21:16:27 +0800 Subject: [PATCH 0604/1278] try_catch_finally --- lua/kide/snippets/java.lua | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/lua/kide/snippets/java.lua b/lua/kide/snippets/java.lua index 72e3fedd..77f95ca9 100644 --- a/lua/kide/snippets/java.lua +++ b/lua/kide/snippets/java.lua @@ -32,6 +32,29 @@ ls.add_snippets("java", { i(3), t({ "", "}" }), }), + s("try_finally", { + t({ "try {" }), + t({ "", "\t" }), + i(1), + t({ "", "} finally {" }), + t({ "", "\t" }), + i(2), + t({ "", "}" }), + }), + s("try_catch_finally", { + t({ "try {" }), + t({ "", "\t" }), + i(1), + t({ "", "} catch (" }), + i(2, "Throwable"), + t({ " e) {" }), + t({ "", "\t" }), + i(3), + t({ "", "} finally {" }), + t({ "", "\t" }), + i(4), + t({ "", "}" }), + }), s("sout", { t({ "System.out.println(" }), i(1), From a98e724c20b17adfed24f2222fce48b9423f1b56 Mon Sep 17 00:00:00 2001 From: luokai Date: Mon, 27 Feb 2023 15:17:05 +0800 Subject: [PATCH 0605/1278] todo-comments --- lua/kide/core/keybindings.lua | 9 +++++++++ lua/kide/plugins/lazy-nvim.lua | 7 +++++++ 2 files changed, 16 insertions(+) diff --git a/lua/kide/core/keybindings.lua b/lua/kide/core/keybindings.lua index 311884d7..84e3899e 100644 --- a/lua/kide/core/keybindings.lua +++ b/lua/kide/core/keybindings.lua @@ -115,6 +115,15 @@ M.setup = function() vim.api.nvim_set_keymap("s", "", "luasnip-next-choice", {}) vim.api.nvim_set_keymap("i", "", "luasnip-prev-choice", {}) vim.api.nvim_set_keymap("s", "", "luasnip-prev-choice", {}) + + -- todo-comments + vim.keymap.set("n", "]t", function() + require("todo-comments").jump_next() + end, { desc = "Next todo comment" }) + + vim.keymap.set("n", "[t", function() + require("todo-comments").jump_prev() + end, { desc = "Previous todo comment" }) end -- lsp 回调函数快捷键设置 M.maplsp = function(client, buffer) diff --git a/lua/kide/plugins/lazy-nvim.lua b/lua/kide/plugins/lazy-nvim.lua index 8a894479..f98b02ef 100644 --- a/lua/kide/plugins/lazy-nvim.lua +++ b/lua/kide/plugins/lazy-nvim.lua @@ -677,6 +677,13 @@ require("lazy").setup({ require("chatgpt").setup({}) end, }, + { + "folke/todo-comments.nvim", + lazy = true, + config = function() + require("todo-comments").setup({}) + end, + }, }, { ui = { icons = { From c798e00d6649136ebbe629f63f48b4cad0112946 Mon Sep 17 00:00:00 2001 From: luokai Date: Wed, 1 Mar 2023 20:12:34 +0800 Subject: [PATCH 0606/1278] scala --- lua/kide/lsp/metals.lua | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 lua/kide/lsp/metals.lua diff --git a/lua/kide/lsp/metals.lua b/lua/kide/lsp/metals.lua new file mode 100644 index 00000000..be770880 --- /dev/null +++ b/lua/kide/lsp/metals.lua @@ -0,0 +1,23 @@ +local M = {} +local metals_config = require("metals").bare_config() +metals_config.settings = { + showImplicitArguments = true, +} + +metals_config.on_attach = function(client, buffer) + require("kide.core.keybindings").maplsp(client, buffer) +end + +M.setup = function() + local group = vim.api.nvim_create_augroup("kide_metals", { clear = true }) + vim.api.nvim_create_autocmd({ "FileType" }, { + group = group, + pattern = { "scala" }, + callback = function() + require("metals").initialize_or_attach(metals_config) + end, + }) + return group +end + +return M From d78464c727a3aceb340a45fb1e6c8c845065302e Mon Sep 17 00:00:00 2001 From: luokai Date: Wed, 1 Mar 2023 20:12:38 +0800 Subject: [PATCH 0607/1278] scala lsp --- lua/kide/plugins/lazy-nvim.lua | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/lua/kide/plugins/lazy-nvim.lua b/lua/kide/plugins/lazy-nvim.lua index f98b02ef..df2e3233 100644 --- a/lua/kide/plugins/lazy-nvim.lua +++ b/lua/kide/plugins/lazy-nvim.lua @@ -170,7 +170,15 @@ require("lazy").setup({ require("java-deps").setup({}) end, }, - + { + "scalameta/nvim-metals", + lazy = true, + ft = "scala", + dependencies = { "nvim-lua/plenary.nvim" }, + config = function () + require("kide.lsp.metals").setup() + end + }, -- debug { "mfussenegger/nvim-dap", From 0d86d10c819590a476e0e43325d8d37f687a320c Mon Sep 17 00:00:00 2001 From: luokai Date: Fri, 3 Mar 2023 20:14:18 +0800 Subject: [PATCH 0608/1278] cursorcolumn --- lua/kide/core/basic.lua | 1 + 1 file changed, 1 insertion(+) diff --git a/lua/kide/core/basic.lua b/lua/kide/core/basic.lua index c40df75d..613658de 100644 --- a/lua/kide/core/basic.lua +++ b/lua/kide/core/basic.lua @@ -30,6 +30,7 @@ vim.opt.ruler = false -- 高亮所在行 vim.wo.cursorline = true +vim.wo.cursorcolumn = true -- 右侧参考线,超过表示代码太长了,考虑换行 vim.wo.colorcolumn = "120" From 4125f63893e7d535f8c5cd12f9e0a5692944e999 Mon Sep 17 00:00:00 2001 From: luokai Date: Sun, 5 Mar 2023 10:50:50 +0800 Subject: [PATCH 0609/1278] c snippets --- lua/kide/plugins/config/luasnip.lua | 2 +- lua/kide/snippets/c.lua | 31 +++++++++++++++++++++++++++++ lua/kide/snippets/init.lua | 8 ++++++++ 3 files changed, 40 insertions(+), 1 deletion(-) create mode 100644 lua/kide/snippets/c.lua create mode 100644 lua/kide/snippets/init.lua diff --git a/lua/kide/plugins/config/luasnip.lua b/lua/kide/plugins/config/luasnip.lua index d5e81e7e..edb99add 100644 --- a/lua/kide/plugins/config/luasnip.lua +++ b/lua/kide/plugins/config/luasnip.lua @@ -58,4 +58,4 @@ ls.filetype_set("cpp", { "c" }) -- require("luasnip.loaders.from_vscode").lazy_load() -require("kide.snippets.java") +require("kide.snippets").setup() diff --git a/lua/kide/snippets/c.lua b/lua/kide/snippets/c.lua new file mode 100644 index 00000000..a0989c86 --- /dev/null +++ b/lua/kide/snippets/c.lua @@ -0,0 +1,31 @@ +local ls = require("luasnip") + +-- some shorthands... +local s = ls.snippet +local sn = ls.snippet_node +local t = ls.text_node +local i = ls.insert_node +local f = ls.function_node +local c = ls.choice_node +local d = ls.dynamic_node +local r = ls.restore_node +local l = require("luasnip.extras").lambda +local rep = require("luasnip.extras").rep +local p = require("luasnip.extras").partial +local m = require("luasnip.extras").match +local n = require("luasnip.extras").nonempty +local dl = require("luasnip.extras").dynamic_lambda +local fmt = require("luasnip.extras.fmt").fmt +local fmta = require("luasnip.extras.fmt").fmta +local types = require("luasnip.util.types") +local conds = require("luasnip.extras.expand_conditions") + +ls.add_snippets("c", { + s("main", { + t({ "int main() {" }), + t({ "", "\t" }), + i(0), + t({ "", "\t return 0;" }), + t({ "", "}" }), + }), +}) diff --git a/lua/kide/snippets/init.lua b/lua/kide/snippets/init.lua new file mode 100644 index 00000000..cef1dde4 --- /dev/null +++ b/lua/kide/snippets/init.lua @@ -0,0 +1,8 @@ +local M = {} + +M.setup = function() + require("kide.snippets.c") + require("kide.snippets.java") +end + +return M From 0e7eb69b73471bbf5eeb937102ff9a982a446bb6 Mon Sep 17 00:00:00 2001 From: luokai Date: Mon, 6 Mar 2023 11:22:10 +0800 Subject: [PATCH 0610/1278] loaders.from_vscode --- lua/kide/snippets/init.lua | 3 +++ 1 file changed, 3 insertions(+) diff --git a/lua/kide/snippets/init.lua b/lua/kide/snippets/init.lua index cef1dde4..913cc0e8 100644 --- a/lua/kide/snippets/init.lua +++ b/lua/kide/snippets/init.lua @@ -3,6 +3,9 @@ local M = {} M.setup = function() require("kide.snippets.c") require("kide.snippets.java") + require("luasnip.loaders.from_vscode").lazy_load({ + include = { "go", "c", "python", "sh", "json", "lua", "gitcommit", "sql", "html" }, + }) end return M From 5d7dd6e012bc16f587f1b6f172e47f5f72c592dc Mon Sep 17 00:00:00 2001 From: luokai Date: Tue, 7 Mar 2023 14:41:09 +0800 Subject: [PATCH 0611/1278] =?UTF-8?q?=E6=9F=A5=E7=9C=8B=E5=85=A8=E8=B7=AF?= =?UTF-8?q?=E5=BE=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lua/kide/plugins/config/alpha-nvim.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lua/kide/plugins/config/alpha-nvim.lua b/lua/kide/plugins/config/alpha-nvim.lua index b8fee2d3..2f378a2f 100644 --- a/lua/kide/plugins/config/alpha-nvim.lua +++ b/lua/kide/plugins/config/alpha-nvim.lua @@ -17,7 +17,7 @@ local opt = { noremap = true, silent = true } dashboard.section.buttons.val = { dashboard.button(" ff", " Find File", ":Telescope find_files", opt), dashboard.button(" fg", " Find Word ", ":Telescope live_grep", opt), - dashboard.button(" fp", " Recent Projects", ":Telescope project", opt), + dashboard.button(" fp", " Recent Projects", ":lua require'telescope'.extensions.project.project{ display_type = 'full' }", opt), dashboard.button(" fo", " Recent File", ":Telescope oldfiles", opt), dashboard.button(" ns", " Settings", ":e $MYVIMRC | :cd %:p:h ", opt), dashboard.button(" q ", " Quit NVIM", ":qa", opt), From 97b79e0c12c5594101e851eff04f67e2e8db471b Mon Sep 17 00:00:00 2001 From: luokai Date: Wed, 8 Mar 2023 09:24:02 +0800 Subject: [PATCH 0612/1278] =?UTF-8?q?=E5=88=A0=E9=99=A4=E6=9C=AA=E4=BD=BF?= =?UTF-8?q?=E7=94=A8=E9=85=8D=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lua/kide/plugins/config/aerial.lua | 242 ----------------------------- 1 file changed, 242 deletions(-) delete mode 100644 lua/kide/plugins/config/aerial.lua diff --git a/lua/kide/plugins/config/aerial.lua b/lua/kide/plugins/config/aerial.lua deleted file mode 100644 index 2ee401c0..00000000 --- a/lua/kide/plugins/config/aerial.lua +++ /dev/null @@ -1,242 +0,0 @@ --- Call the setup function to change the default behavior -require("aerial").setup({ - -- Priority list of preferred backends for aerial. - -- This can be a filetype map (see :help aerial-filetype-map) - backends = { "treesitter", "lsp", "markdown" }, - - -- Enum: persist, close, auto, global - -- persist - aerial window will stay open until closed - -- close - aerial window will close when original file is no longer visible - -- auto - aerial window will stay open as long as there is a visible - -- buffer to attach to - -- global - same as 'persist', and will always show symbols for the current buffer - close_behavior = "auto", - - -- Set to false to remove the default keybindings for the aerial buffer - default_bindings = true, - - -- Enum: prefer_right, prefer_left, right, left, float - -- Determines the default direction to open the aerial window. The 'prefer' - -- options will open the window in the other direction *if* there is a - -- different buffer in the way of the preferred direction - default_direction = "prefer_right", - - -- Disable aerial on files with this many lines - disable_max_lines = 10000, - - -- Disable aerial on files this size or larger (in bytes) - disable_max_size = 2000000, -- Default 2MB - - -- A list of all symbols to display. Set to false to display all symbols. - -- This can be a filetype map (see :help aerial-filetype-map) - -- To see all available values, see :help SymbolKind - filter_kind = { - "Array", - "Boolean", - "Class", - "Constant", - "Constructor", - "Enum", - "EnumMember", - "Event", - "Field", - "File", - "Function", - "Interface", - "Key", - "Method", - "Module", - "Namespace", - "Null", - "Number", - "Object", - "Operator", - "Package", - "Property", - "String", - "Struct", - "TypeParameter", - "Variable", - }, - - -- Enum: split_width, full_width, last, none - -- Determines line highlighting mode when multiple splits are visible. - -- split_width Each open window will have its cursor location marked in the - -- aerial buffer. Each line will only be partially highlighted - -- to indicate which window is at that location. - -- full_width Each open window will have its cursor location marked as a - -- full-width highlight in the aerial buffer. - -- last Only the most-recently focused window will have its location - -- marked in the aerial buffer. - -- none Do not show the cursor locations in the aerial window. - highlight_mode = "split_width", - - -- Highlight the closest symbol if the cursor is not exactly on one. - highlight_closest = true, - - -- Highlight the symbol in the source buffer when cursor is in the aerial win - highlight_on_hover = false, - - -- When jumping to a symbol, highlight the line for this many ms. - -- Set to false to disable - highlight_on_jump = 300, - - -- Define symbol icons. You can also specify "Collapsed" to change the - -- icon when the tree is collapsed at that symbol, or "Collapsed" to specify a - -- default collapsed icon. The default icon set is determined by the - -- "nerd_font" option below. - -- If you have lspkind-nvim installed, it will be the default icon set. - -- This can be a filetype map (see :help aerial-filetype-map) - icons = {}, - - -- Control which windows and buffers aerial should ignore. - -- If close_behavior is "global", focusing an ignored window/buffer will - -- not cause the aerial window to update. - -- If open_automatic is true, focusing an ignored window/buffer will not - -- cause an aerial window to open. - -- If open_automatic is a function, ignore rules have no effect on aerial - -- window opening behavior; it's entirely handled by the open_automatic - -- function. - ignore = { - -- Ignore unlisted buffers. See :help buflisted - unlisted_buffers = true, - - -- List of filetypes to ignore. - filetypes = {}, - - -- Ignored buftypes. - -- Can be one of the following: - -- false or nil - No buftypes are ignored. - -- "special" - All buffers other than normal buffers are ignored. - -- table - A list of buftypes to ignore. See :help buftype for the - -- possible values. - -- function - A function that returns true if the buffer should be - -- ignored or false if it should not be ignored. - -- Takes two arguments, `bufnr` and `buftype`. - buftypes = "special", - - -- Ignored wintypes. - -- Can be one of the following: - -- false or nil - No wintypes are ignored. - -- "special" - All windows other than normal windows are ignored. - -- table - A list of wintypes to ignore. See :help win_gettype() for the - -- possible values. - -- function - A function that returns true if the window should be - -- ignored or false if it should not be ignored. - -- Takes two arguments, `winid` and `wintype`. - wintypes = "special", - }, - - -- When you fold code with za, zo, or zc, update the aerial tree as well. - -- Only works when manage_folds = true - link_folds_to_tree = false, - - -- Fold code when you open/collapse symbols in the tree. - -- Only works when manage_folds = true - link_tree_to_folds = true, - - -- Use symbol tree for folding. Set to true or false to enable/disable - -- 'auto' will manage folds if your previous foldmethod was 'manual' - manage_folds = false, - - -- These control the width of the aerial window. - -- They can be integers or a float between 0 and 1 (e.g. 0.4 for 40%) - -- min_width and max_width can be a list of mixed types. - -- max_width = {40, 0.2} means "the lesser of 40 columns or 20% of total" - max_width = { 40, 0.2 }, - width = nil, - min_width = 32, - - -- Set default symbol icons to use patched font icons (see https://www.nerdfonts.com/) - -- "auto" will set it to true if nvim-web-devicons or lspkind-nvim is installed. - nerd_font = "true", - - -- Call this function when aerial attaches to a buffer. - -- Useful for setting keymaps. Takes a single `bufnr` argument. - on_attach = nil, - - -- Call this function when aerial first sets symbols on a buffer. - -- Takes a single `bufnr` argument. - on_first_symbols = nil, - - -- Automatically open aerial when entering supported buffers. - -- This can be a function (see :help aerial-open-automatic) - open_automatic = false, - - -- Set to true to only open aerial at the far right/left of the editor - -- Default behavior opens aerial relative to current window - placement_editor_edge = false, - - -- Run this command after jumping to a symbol (false will disable) - post_jump_cmd = "normal! zz", - - -- When true, aerial will automatically close after jumping to a symbol - close_on_select = false, - - -- Show box drawing characters for the tree hierarchy - show_guides = false, - - -- The autocmds that trigger symbols update (not used for LSP backend) - update_events = "TextChanged,InsertLeave", - - -- Customize the characters used when show_guides = true - guides = { - -- When the child item has a sibling below it - mid_item = "├─", - -- When the child item is the last in the list - last_item = "└─", - -- When there are nested child guides to the right - nested_top = "│ ", - -- Raw indentation - whitespace = " ", - }, - - -- Options for opening aerial in a floating win - float = { - -- Controls border appearance. Passed to nvim_open_win - border = "rounded", - - -- Enum: cursor, editor, win - -- cursor - Opens float on top of the cursor - -- editor - Opens float centered in the editor - -- win - Opens float centered in the window - relative = "cursor", - - -- These control the height of the floating window. - -- They can be integers or a float between 0 and 1 (e.g. 0.4 for 40%) - -- min_height and max_height can be a list of mixed types. - -- min_height = {8, 0.1} means "the greater of 8 rows or 10% of total" - max_height = 0.9, - height = nil, - min_height = { 8, 0.1 }, - - override = function(conf) - -- This is the config that will be passed to nvim_open_win. - -- Change values here to customize the layout - return conf - end, - }, - - lsp = { - -- Fetch document symbols when LSP diagnostics update. - -- If false, will update on buffer changes. - diagnostics_trigger_update = true, - - -- Set to false to not update the symbols when there are LSP errors - update_when_errors = true, - - -- How long to wait (in ms) after a buffer change before updating - -- Only used when diagnostics_trigger_update = false - update_delay = 300, - }, - - treesitter = { - -- How long to wait (in ms) after a buffer change before updating - update_delay = 300, - }, - - markdown = { - -- How long to wait (in ms) after a buffer change before updating - update_delay = 300, - }, -}) From 912192368b6f69d5ec15fa4188a226724ec7834f Mon Sep 17 00:00:00 2001 From: luokai Date: Tue, 14 Mar 2023 12:54:18 +0800 Subject: [PATCH 0613/1278] =?UTF-8?q?=E8=B0=83=E6=95=B4telescope=E9=85=8D?= =?UTF-8?q?=E8=89=B2=E5=8A=A0=E8=BD=BD=E4=BC=98=E5=85=88=E7=BA=A7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lua/kide/plugins/config/gruvbox.lua | 2 -- lua/kide/plugins/config/telescope.lua | 2 ++ lua/kide/theme/gruvbox.lua | 11 ++++++++++- 3 files changed, 12 insertions(+), 3 deletions(-) diff --git a/lua/kide/plugins/config/gruvbox.lua b/lua/kide/plugins/config/gruvbox.lua index c1864f18..eecb6a3c 100644 --- a/lua/kide/plugins/config/gruvbox.lua +++ b/lua/kide/plugins/config/gruvbox.lua @@ -13,8 +13,6 @@ local overrides = { -- cmp, wilder } -overrides = vim.tbl_extend("force", overrides, kgrubox.flat_telescope) - require("gruvbox").setup({ undercurl = true, underline = true, diff --git a/lua/kide/plugins/config/telescope.lua b/lua/kide/plugins/config/telescope.lua index 28e77717..c4104ff6 100644 --- a/lua/kide/plugins/config/telescope.lua +++ b/lua/kide/plugins/config/telescope.lua @@ -158,3 +158,5 @@ require("telescope").load_extension("project") require("telescope").load_extension("ui-select") require("telescope").load_extension("fzf") require("telescope").load_extension("env") + +require("kide.theme.gruvbox").load_telescope_highlights() diff --git a/lua/kide/theme/gruvbox.lua b/lua/kide/theme/gruvbox.lua index 124abbf8..14a156c2 100644 --- a/lua/kide/theme/gruvbox.lua +++ b/lua/kide/theme/gruvbox.lua @@ -11,7 +11,7 @@ local colors = { yellow = "#fabd2f", } M.colors = colors -M.flat_telescope = { +local flat_telescope = { TelescopeBorder = { fg = colors.darker_black, @@ -65,4 +65,13 @@ M.flat_telescope = { TelescopeSelection = { bg = colors.black2, fg = colors.yellow }, } + +M.load_telescope_highlights = function() + M.load_highlights(flat_telescope) +end +M.load_highlights = function(hl_groups) + for hl, col in pairs(hl_groups) do + vim.api.nvim_set_hl(0, hl, col) + end +end return M From 751f7ef68cf3e713e613d7429539ba541f6c8155 Mon Sep 17 00:00:00 2001 From: luokai Date: Tue, 14 Mar 2023 12:56:16 +0800 Subject: [PATCH 0614/1278] q telescope close --- lua/kide/plugins/config/telescope.lua | 1 + 1 file changed, 1 insertion(+) diff --git a/lua/kide/plugins/config/telescope.lua b/lua/kide/plugins/config/telescope.lua index c4104ff6..8a345187 100644 --- a/lua/kide/plugins/config/telescope.lua +++ b/lua/kide/plugins/config/telescope.lua @@ -107,6 +107,7 @@ telescope.setup({ }, n = { -- [""] = trouble.open_with_trouble, + ["q"] = require("telescope.actions").close, }, }, }, From efa9d451046b254f1b00d47eac5c63b85b3914c0 Mon Sep 17 00:00:00 2001 From: luokai Date: Wed, 15 Mar 2023 00:17:01 +0800 Subject: [PATCH 0615/1278] dict --- lua/kide/plugins/config/nvim-cmp.lua | 2 ++ lua/kide/plugins/lazy-nvim.lua | 12 ++++++++++-- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/lua/kide/plugins/config/nvim-cmp.lua b/lua/kide/plugins/config/nvim-cmp.lua index 1030cafd..2c945728 100644 --- a/lua/kide/plugins/config/nvim-cmp.lua +++ b/lua/kide/plugins/config/nvim-cmp.lua @@ -32,6 +32,7 @@ cmp.setup({ }, { { name = "path" }, { name = "buffer" }, + { name = "cmp-dictionary-nanny" }, }), -- 快捷键 @@ -50,6 +51,7 @@ cmp.setup({ nvim_lsp = "[LSP]", luasnip = "[Lsnip]", path = "[Path]", + ["cmp-dictionary-nanny"] = "[Dict]", -- buffer = "[Buffer]", }, }), diff --git a/lua/kide/plugins/lazy-nvim.lua b/lua/kide/plugins/lazy-nvim.lua index df2e3233..61bfa1cd 100644 --- a/lua/kide/plugins/lazy-nvim.lua +++ b/lua/kide/plugins/lazy-nvim.lua @@ -175,9 +175,9 @@ require("lazy").setup({ lazy = true, ft = "scala", dependencies = { "nvim-lua/plenary.nvim" }, - config = function () + config = function() require("kide.lsp.metals").setup() - end + end, }, -- debug { @@ -692,6 +692,14 @@ require("lazy").setup({ require("todo-comments").setup({}) end, }, + { + "denstiny/cmp-dictionary-nanny", + build = "./install.sh", + config = function() + require("cmp-dictionary-nanny.config").setup({}) + end, + event = { "InsertEnter" }, + }, }, { ui = { icons = { From 4c5416c7991f8045245d2789a17e700b82917d31 Mon Sep 17 00:00:00 2001 From: luokai Date: Wed, 15 Mar 2023 10:38:29 +0800 Subject: [PATCH 0616/1278] fix send msg --- lua/kide/plugins/lazy-nvim.lua | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/lua/kide/plugins/lazy-nvim.lua b/lua/kide/plugins/lazy-nvim.lua index 61bfa1cd..84fea109 100644 --- a/lua/kide/plugins/lazy-nvim.lua +++ b/lua/kide/plugins/lazy-nvim.lua @@ -682,7 +682,11 @@ require("lazy").setup({ "ChatGPT", }, config = function() - require("chatgpt").setup({}) + require("chatgpt").setup({ + keymaps = { + submit = "", + }, + }) end, }, { From 8c7b3c1082d8a02c76777da61c113f3325248468 Mon Sep 17 00:00:00 2001 From: luokai Date: Thu, 16 Mar 2023 11:47:57 +0800 Subject: [PATCH 0617/1278] trans --- lua/kide/plugins/lazy-nvim.lua | 25 ++++++++++++++++ lua/kide/theme/gruvbox.lua | 52 ++++++++++++++++++++++++++++++++++ 2 files changed, 77 insertions(+) diff --git a/lua/kide/plugins/lazy-nvim.lua b/lua/kide/plugins/lazy-nvim.lua index 84fea109..65bcc3ae 100644 --- a/lua/kide/plugins/lazy-nvim.lua +++ b/lua/kide/plugins/lazy-nvim.lua @@ -704,6 +704,31 @@ require("lazy").setup({ end, event = { "InsertEnter" }, }, + { + "JuanZoran/Trans.nvim", + keys = { + -- 可以换成其他你想映射的键 + { "mm", mode = { "n", "x" }, "Translate", desc = " Translate" }, + { "mk", mode = { "n", "x" }, "TransPlay", desc = " 自动发音" }, + + -- 目前这个功能的视窗还没有做好,可以在配置里将view.i改成hover + { "mi", "TranslateInput", desc = " Translate From Input" }, + }, + dependencies = { "kkharji/sqlite.lua", lazy = true }, + config = function() + require("Trans").setup({ + db_path = "$HOME/.local/share/nvim/data/ultimate.db", + icon = { + star = "", + notfound = " ", + yes = "", + no = "", + cell = "■", + }, + }) + require("kide.theme.gruvbox").load_trans_highlights() + end, + }, }, { ui = { icons = { diff --git a/lua/kide/theme/gruvbox.lua b/lua/kide/theme/gruvbox.lua index 14a156c2..6cf7f7e2 100644 --- a/lua/kide/theme/gruvbox.lua +++ b/lua/kide/theme/gruvbox.lua @@ -9,6 +9,9 @@ local colors = { red = "#fb4934", green = "#b8bb26", yellow = "#fabd2f", + yellow2 = "#d79921", + blue = "#83a598", + blue2 = "#458588", } M.colors = colors local flat_telescope = { @@ -65,6 +68,51 @@ local flat_telescope = { TelescopeSelection = { bg = colors.black2, fg = colors.yellow }, } +local flat_trans = { + TransWord = { + fg = colors.green, + bold = true, + }, + TransPhonetic = { + link = "Linenr", + }, + TransTitle = { + fg = colors.white, + bg = colors.blue2, + bold = true, + }, + TransTitleRound = { + fg = colors.blue2, + }, + TransTag = { + fg = colors.yellow2, + }, + TransExchange = { + link = "TransTag", + }, + TransPos = { + link = "TransTag", + }, + TransTranslation = { + link = "TransWord", + }, + TransDefinition = { + link = "Moremsg", + }, + TransWin = { + link = "Normal", + }, + TransBorder = { + link = "FloatBorder", + }, + TransCollins = { + fg = colors.green, + bold = true, + }, + TransFailed = { + fg = colors.blue, + }, +} M.load_telescope_highlights = function() M.load_highlights(flat_telescope) @@ -74,4 +122,8 @@ M.load_highlights = function(hl_groups) vim.api.nvim_set_hl(0, hl, col) end end + +M.load_trans_highlights = function() + M.load_highlights(flat_trans) +end return M From ed3005abd394a5381490da83093d3a0c33bd237f Mon Sep 17 00:00:00 2001 From: luokai Date: Thu, 16 Mar 2023 11:48:02 +0800 Subject: [PATCH 0618/1278] fmt --- lua/kide/plugins/config/alpha-nvim.lua | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/lua/kide/plugins/config/alpha-nvim.lua b/lua/kide/plugins/config/alpha-nvim.lua index 2f378a2f..0fb04a6e 100644 --- a/lua/kide/plugins/config/alpha-nvim.lua +++ b/lua/kide/plugins/config/alpha-nvim.lua @@ -17,7 +17,12 @@ local opt = { noremap = true, silent = true } dashboard.section.buttons.val = { dashboard.button(" ff", " Find File", ":Telescope find_files", opt), dashboard.button(" fg", " Find Word ", ":Telescope live_grep", opt), - dashboard.button(" fp", " Recent Projects", ":lua require'telescope'.extensions.project.project{ display_type = 'full' }", opt), + dashboard.button( + " fp", + " Recent Projects", + ":lua require'telescope'.extensions.project.project{ display_type = 'full' }", + opt + ), dashboard.button(" fo", " Recent File", ":Telescope oldfiles", opt), dashboard.button(" ns", " Settings", ":e $MYVIMRC | :cd %:p:h ", opt), dashboard.button(" q ", " Quit NVIM", ":qa", opt), From 6995a787efddfd2bbfbb7c4a056baac61b950599 Mon Sep 17 00:00:00 2001 From: luokai Date: Thu, 16 Mar 2023 11:59:07 +0800 Subject: [PATCH 0619/1278] =?UTF-8?q?=E6=9A=82=E6=97=B6=E7=A6=81=E7=94=A8?= =?UTF-8?q?=20trans,=20=E4=BC=9A=E5=AF=BC=E8=87=B4=E6=96=87=E4=BB=B6?= =?UTF-8?q?=E4=BF=AE=E6=94=B9=EF=BC=8C=E9=A2=91=E7=B9=81=E8=AF=B7=E6=B1=82?= =?UTF-8?q?=20LSP=20server?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lua/kide/plugins/lazy-nvim.lua | 1 + 1 file changed, 1 insertion(+) diff --git a/lua/kide/plugins/lazy-nvim.lua b/lua/kide/plugins/lazy-nvim.lua index 65bcc3ae..a9dea65d 100644 --- a/lua/kide/plugins/lazy-nvim.lua +++ b/lua/kide/plugins/lazy-nvim.lua @@ -706,6 +706,7 @@ require("lazy").setup({ }, { "JuanZoran/Trans.nvim", + enabled = false, keys = { -- 可以换成其他你想映射的键 { "mm", mode = { "n", "x" }, "Translate", desc = " Translate" }, From 70cc1f19c8ae711300cfc48130f2886d7b436004 Mon Sep 17 00:00:00 2001 From: luokai Date: Thu, 16 Mar 2023 22:17:42 +0800 Subject: [PATCH 0620/1278] opt --- lua/kide/core/basic.lua | 62 +++++++++++++++++++---------------------- 1 file changed, 28 insertions(+), 34 deletions(-) diff --git a/lua/kide/core/basic.lua b/lua/kide/core/basic.lua index 613658de..ebbed11e 100644 --- a/lua/kide/core/basic.lua +++ b/lua/kide/core/basic.lua @@ -29,34 +29,31 @@ vim.opt.numberwidth = 2 vim.opt.ruler = false -- 高亮所在行 -vim.wo.cursorline = true -vim.wo.cursorcolumn = true +vim.opt.cursorline = true +vim.opt.cursorcolumn = true -- 右侧参考线,超过表示代码太长了,考虑换行 -vim.wo.colorcolumn = "120" +vim.opt.colorcolumn = "120" -- 边搜索边高亮 -vim.o.incsearch = true +vim.opt.incsearch = true -- 忽悠大小写 -vim.o.ignorecase = true +vim.opt.ignorecase = true -- 智能大小写 -vim.o.smartcase = true +vim.opt.smartcase = true -vim.g.encoding = "UTF-8" +vim.opt_global.encoding = "UTF-8" -vim.o.fileencoding = "UTF-8" +vim.opt.fileencoding = "UTF-8" -- jk移动时光标下上方保留8行 -vim.o.scrolloff = 3 -vim.o.sidescrolloff = 3 +vim.opt.scrolloff = 3 +vim.opt.sidescrolloff = 3 -- 缩进配置 -vim.o.tabstop = 4 -vim.bo.tabstop = 4 -vim.o.softtabstop = 4 --- vim.o.softround=true +vim.opt.tabstop = 4 +vim.opt.softtabstop = 4 -- > < 时移动长度 -vim.o.shiftwidth = 4 -vim.bo.shiftwidth = 4 +vim.opt.shiftwidth = 4 local autocmd = vim.api.nvim_create_autocmd autocmd("FileType", { @@ -81,36 +78,33 @@ autocmd("FileType", { }) -- 新行对齐当前行,空格替代tab -vim.o.expandtab = true -vim.bo.expandtab = true -vim.o.autoindent = true -vim.bo.autoindent = true -vim.o.smartindent = true +vim.opt.expandtab = true +vim.opt.autoindent = true +vim.opt.smartindent = true -- 使用增强状态栏后不再需要 vim 的模式提示 -vim.o.showmode = false +vim.opt.showmode = false -- 当文件被外部程序修改时,自动加载 -vim.o.autoread = true -vim.bo.autoread = true +vim.opt.autoread = true -- 禁止创建备份文件 -vim.o.backup = false -vim.o.writebackup = false -vim.o.swapfile = false +vim.opt.backup = false +vim.opt.writebackup = false +vim.opt.swapfile = false -- smaller updatetime -vim.o.updatetime = 300 +vim.opt.updatetime = 300 -- split window 从下边和右边出现 -vim.o.splitbelow = false -vim.o.splitright = true +vim.opt.splitbelow = false +vim.opt.splitright = true -- 样式 vim.opt.background = "dark" vim.opt.termguicolors = true -- 补全增强 -vim.o.wildmenu = true +vim.opt.wildmenu = true vim.opt.confirm = true @@ -120,15 +114,15 @@ vim.opt.confirm = true vim.opt.list = true vim.opt.cul = true -- cursor line -vim.o.timeout = true +vim.opt.timeout = true vim.opt.timeoutlen = 450 vim.opt.mouse = "a" -- 默认不要折叠 -- https://stackoverflow.com/questions/8316139/how-to-set-the-default-to-unfolded-when-you-open-a-file -vim.o.foldlevel = 99 -- Using ufo provider need a large value, feel free to decrease the value -vim.o.foldlevelstart = 99 +vim.opt.foldlevel = 99 -- Using ufo provider need a large value, feel free to decrease the value +vim.opt.foldlevelstart = 99 -- Highlight on yank vim.api.nvim_create_autocmd({ "TextYankPost" }, { From 098e4905d8ddf13122ca1891d89e5eb704c63bad Mon Sep 17 00:00:00 2001 From: luokai Date: Thu, 16 Mar 2023 22:52:20 +0800 Subject: [PATCH 0621/1278] visual-multi --- lua/kide/plugins/lazy-nvim.lua | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lua/kide/plugins/lazy-nvim.lua b/lua/kide/plugins/lazy-nvim.lua index a9dea65d..0a3aead4 100644 --- a/lua/kide/plugins/lazy-nvim.lua +++ b/lua/kide/plugins/lazy-nvim.lua @@ -322,7 +322,9 @@ require("lazy").setup({ { "mg979/vim-visual-multi", lazy = true, - keys = { "" }, + keys = { + { "", mode = { "n", "x" }, desc = "visual multi" }, + }, }, -- 状态栏插件 From 69558c4aee5b9a578a2d30949ee1a5bbb84a5089 Mon Sep 17 00:00:00 2001 From: luokai Date: Thu, 16 Mar 2023 23:17:19 +0800 Subject: [PATCH 0622/1278] Comment --- lua/kide/plugins/lazy-nvim.lua | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/lua/kide/plugins/lazy-nvim.lua b/lua/kide/plugins/lazy-nvim.lua index 0a3aead4..fb17ab2b 100644 --- a/lua/kide/plugins/lazy-nvim.lua +++ b/lua/kide/plugins/lazy-nvim.lua @@ -387,7 +387,10 @@ require("lazy").setup({ { "numToStr/Comment.nvim", - keys = { "gcc", "gb" }, + keys = { + { "gcc", mode = { "n" }, desc = "Comment" }, + { "gc", mode = { "x" }, desc = "Comment" }, + }, config = function() require("kide.plugins.config.comment") end, From e92aa75d6f69e040353342bb814858ad3e1e026d Mon Sep 17 00:00:00 2001 From: luokai Date: Sun, 19 Mar 2023 23:07:02 +0800 Subject: [PATCH 0623/1278] wilder.nvim -> cmp-cmdline --- lua/kide/plugins/config/nvim-cmp.lua | 30 +++++++++++++++------------- lua/kide/plugins/lazy-nvim.lua | 9 ++++++++- 2 files changed, 24 insertions(+), 15 deletions(-) diff --git a/lua/kide/plugins/config/nvim-cmp.lua b/lua/kide/plugins/config/nvim-cmp.lua index 2c945728..2f5a5e5f 100644 --- a/lua/kide/plugins/config/nvim-cmp.lua +++ b/lua/kide/plugins/config/nvim-cmp.lua @@ -58,18 +58,20 @@ cmp.setup({ }, }) --- Use buffer source for `/`. --- cmp.setup.cmdline('/', { --- sources = { --- { name = 'buffer' } --- } --- }) +-- Use buffer source for `/` and `?` (if you enabled `native_menu`, this won't work anymore). +cmp.setup.cmdline({ "/", "?" }, { + mapping = cmp.mapping.preset.cmdline(), + sources = { + { name = "buffer" }, + }, +}) --- Use cmdline & path source for ':'. --- cmp.setup.cmdline(':', { --- sources = cmp.config.sources({ --- { name = 'path' } --- }, { --- { name = 'cmdline' } --- }) --- }) +-- Use cmdline & path source for ':' (if you enabled `native_menu`, this won't work anymore). +cmp.setup.cmdline(":", { + mapping = cmp.mapping.preset.cmdline(), + sources = cmp.config.sources({ + { name = "path" }, + }, { + { name = "cmdline" }, + }), +}) diff --git a/lua/kide/plugins/lazy-nvim.lua b/lua/kide/plugins/lazy-nvim.lua index fb17ab2b..321d8f4d 100644 --- a/lua/kide/plugins/lazy-nvim.lua +++ b/lua/kide/plugins/lazy-nvim.lua @@ -64,10 +64,12 @@ require("lazy").setup({ { "hrsh7th/nvim-cmp", event = { "InsertEnter" }, + keys = { ":", "/", "?" }, dependencies = { "hrsh7th/cmp-path", "hrsh7th/cmp-nvim-lsp", "hrsh7th/cmp-buffer", + "hrsh7th/cmp-cmdline", "saadparwaiz1/cmp_luasnip", "onsails/lspkind-nvim", }, @@ -80,6 +82,10 @@ require("lazy").setup({ "hrsh7th/cmp-nvim-lsp", lazy = true, }, + { + "hrsh7th/cmp-cmdline", + lazy = true, + }, { "hrsh7th/cmp-buffer", lazy = true, @@ -370,7 +376,8 @@ require("lazy").setup({ -- wildmenu 补全美化 { "gelguy/wilder.nvim", - keys = { ":", "/" }, + enabled = false, + keys = { ":", "/", "?" }, config = function() require("kide.plugins.config.wilder") end, From 1f88c20717258743ceb3531fc347a781704d42e7 Mon Sep 17 00:00:00 2001 From: luokai Date: Tue, 21 Mar 2023 09:59:57 +0800 Subject: [PATCH 0624/1278] =?UTF-8?q?=E4=B8=8D=E5=86=8D=E7=BB=B4=E6=8A=A4?= =?UTF-8?q?=E6=9A=82=E6=97=B6=E7=A6=81=E7=94=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lua/kide/plugins/config/nvim-cmp.lua | 2 -- lua/kide/plugins/lazy-nvim.lua | 1 + 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/lua/kide/plugins/config/nvim-cmp.lua b/lua/kide/plugins/config/nvim-cmp.lua index 2f5a5e5f..90eca963 100644 --- a/lua/kide/plugins/config/nvim-cmp.lua +++ b/lua/kide/plugins/config/nvim-cmp.lua @@ -32,7 +32,6 @@ cmp.setup({ }, { { name = "path" }, { name = "buffer" }, - { name = "cmp-dictionary-nanny" }, }), -- 快捷键 @@ -51,7 +50,6 @@ cmp.setup({ nvim_lsp = "[LSP]", luasnip = "[Lsnip]", path = "[Path]", - ["cmp-dictionary-nanny"] = "[Dict]", -- buffer = "[Buffer]", }, }), diff --git a/lua/kide/plugins/lazy-nvim.lua b/lua/kide/plugins/lazy-nvim.lua index 321d8f4d..0a7ac760 100644 --- a/lua/kide/plugins/lazy-nvim.lua +++ b/lua/kide/plugins/lazy-nvim.lua @@ -710,6 +710,7 @@ require("lazy").setup({ }, { "denstiny/cmp-dictionary-nanny", + enabled = false, build = "./install.sh", config = function() require("cmp-dictionary-nanny.config").setup({}) From ebbd48f97385c4b2da612e833d5479d18dfc4d4c Mon Sep 17 00:00:00 2001 From: luokai Date: Tue, 21 Mar 2023 20:10:18 +0800 Subject: [PATCH 0625/1278] update gruvbox --- lua/kide/plugins/config/gruvbox.lua | 2 -- 1 file changed, 2 deletions(-) diff --git a/lua/kide/plugins/config/gruvbox.lua b/lua/kide/plugins/config/gruvbox.lua index eecb6a3c..89dfbbd1 100644 --- a/lua/kide/plugins/config/gruvbox.lua +++ b/lua/kide/plugins/config/gruvbox.lua @@ -16,8 +16,6 @@ local overrides = { require("gruvbox").setup({ undercurl = true, underline = true, - bold = true, - italic = true, -- will make italic comments and special strings inverse = true, -- invert background for search, diffs, statuslines and errors invert_selection = false, invert_signs = false, From b0d0ecc4f3c0f78b4bd3764e2ffa1d082a19b8f7 Mon Sep 17 00:00:00 2001 From: luokai Date: Wed, 22 Mar 2023 17:34:26 +0800 Subject: [PATCH 0626/1278] =?UTF-8?q?alpha=20=E4=B8=8D=E5=8A=A0=E8=BD=BD?= =?UTF-8?q?=20lualine?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lua/kide/plugins/config/lualine.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lua/kide/plugins/config/lualine.lua b/lua/kide/plugins/config/lualine.lua index f93062ac..8e4ac30b 100644 --- a/lua/kide/plugins/config/lualine.lua +++ b/lua/kide/plugins/config/lualine.lua @@ -7,7 +7,7 @@ local config = { component_separators = { left = "", right = "" }, section_separators = { left = "", right = "" }, disabled_filetypes = { - -- "dap-repl", "dapui_watches", "dapui_stacks", "dapui_breakpoints", "dapui_scopes" + "alpha", }, always_divide_middle = true, }, From dda30e7ac4e28b4626e34b5d77269665ea0d4874 Mon Sep 17 00:00:00 2001 From: luokai Date: Sun, 26 Mar 2023 13:44:43 +0800 Subject: [PATCH 0627/1278] copilot --- lua/kide/plugins/lazy-nvim.lua | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/lua/kide/plugins/lazy-nvim.lua b/lua/kide/plugins/lazy-nvim.lua index 0a7ac760..39336bfc 100644 --- a/lua/kide/plugins/lazy-nvim.lua +++ b/lua/kide/plugins/lazy-nvim.lua @@ -743,6 +743,14 @@ require("lazy").setup({ require("kide.theme.gruvbox").load_trans_highlights() end, }, + + { + "github/copilot.vim", + lazy = true, + cmd = { + "Copilot", + }, + }, }, { ui = { icons = { From 8192bdde1d48ec60163c43b87aa90cc33bfebb5d Mon Sep 17 00:00:00 2001 From: luokai Date: Sun, 26 Mar 2023 15:02:01 +0800 Subject: [PATCH 0628/1278] copilot --- lua/kide/core/keybindings.lua | 5 ++++- lua/kide/plugins/config/nvim-cmp.lua | 9 ++++++++- lua/kide/plugins/lazy-nvim.lua | 22 +++++++++++++++++----- 3 files changed, 29 insertions(+), 7 deletions(-) diff --git a/lua/kide/core/keybindings.lua b/lua/kide/core/keybindings.lua index 84e3899e..0556642f 100644 --- a/lua/kide/core/keybindings.lua +++ b/lua/kide/core/keybindings.lua @@ -226,8 +226,11 @@ end M.cmp = function(cmp) local luasnip = require("luasnip") local has_words_before = function() + if vim.api.nvim_buf_get_option(0, "buftype") == "prompt" then + return false + end local line, col = unpack(vim.api.nvim_win_get_cursor(0)) - return col ~= 0 and vim.api.nvim_buf_get_lines(0, line - 1, line, true)[1]:sub(col, col):match("%s") == nil + return col ~= 0 and vim.api.nvim_buf_get_text(0, line - 1, 0, line - 1, col, {})[1]:match("^%s*$") == nil end return { -- [""] = cmp.mapping.scroll_docs(-4), diff --git a/lua/kide/plugins/config/nvim-cmp.lua b/lua/kide/plugins/config/nvim-cmp.lua index 90eca963..57a24f84 100644 --- a/lua/kide/plugins/config/nvim-cmp.lua +++ b/lua/kide/plugins/config/nvim-cmp.lua @@ -1,6 +1,11 @@ local lspkind = require("lspkind") local cmp = require("cmp") - +lspkind.init({ + symbol_map = { + Copilot = "", + }, +}) +vim.api.nvim_set_hl(0, "CmpItemKindCopilot", { fg = "#6CC644" }) cmp.setup({ -- 指定 snippet 引擎 snippet = { @@ -20,6 +25,7 @@ cmp.setup({ }, -- 来源 sources = cmp.config.sources({ + { name = "copilot" }, { name = "nvim_lsp" }, -- For vsnip users. -- { name = 'vsnip' }, @@ -50,6 +56,7 @@ cmp.setup({ nvim_lsp = "[LSP]", luasnip = "[Lsnip]", path = "[Path]", + copilot = "[Copilot]", -- buffer = "[Buffer]", }, }), diff --git a/lua/kide/plugins/lazy-nvim.lua b/lua/kide/plugins/lazy-nvim.lua index 39336bfc..6bde7e5b 100644 --- a/lua/kide/plugins/lazy-nvim.lua +++ b/lua/kide/plugins/lazy-nvim.lua @@ -743,13 +743,25 @@ require("lazy").setup({ require("kide.theme.gruvbox").load_trans_highlights() end, }, - { - "github/copilot.vim", + "zbirenbaum/copilot.lua", lazy = true, - cmd = { - "Copilot", - }, + cmd = "Copilot", + config = function() + require("copilot").setup({ + suggestion = { enabled = false }, + panel = { enabled = false }, + }) + end, + }, + { + "zbirenbaum/copilot-cmp", + lazy = true, + dependencies = { "zbirenbaum/copilot.lua" }, + event = "InsertEnter", + config = function() + require("copilot_cmp").setup() + end, }, }, { ui = { From 2fa48b3f42e29c2351ac7cbc32bfa0bafc72ec3e Mon Sep 17 00:00:00 2001 From: luokai Date: Tue, 28 Mar 2023 15:32:17 +0800 Subject: [PATCH 0629/1278] open_classfile --- lua/kide/lsp/java.lua | 4 +- lua/kide/lsp/utils/jdtls.lua | 150 ++++++++++++++++---------- lua/kide/plugins/config/telescope.lua | 2 +- 3 files changed, 96 insertions(+), 60 deletions(-) diff --git a/lua/kide/lsp/java.lua b/lua/kide/lsp/java.lua index f5b867e0..60cb3453 100644 --- a/lua/kide/lsp/java.lua +++ b/lua/kide/lsp/java.lua @@ -520,7 +520,7 @@ M.setup = function() vim.api.nvim_create_autocmd({ "BufReadCmd" }, { pattern = "jdt://*", callback = function(e) - require("jdtls").open_jdt_link(e.file) + require("jdtls").open_classfile(e.file) end, }) vim.api.nvim_create_user_command("JdtWipeDataAndRestart", "lua require('jdtls.setup').wipe_data_and_restart()", {}) @@ -535,7 +535,7 @@ M.setup = function() -- vim.notify("load: " .. o.buf, vim.log.levels.INFO) -- print(vim.inspect(e)) -- 忽略 telescope 预览的情况 - if e.file == "java" then + if e.file == "java" and vim.bo[e.buf].buftype == "nofile" then -- ignore else M.start() diff --git a/lua/kide/lsp/utils/jdtls.lua b/lua/kide/lsp/utils/jdtls.lua index 8eb32f36..11ed90aa 100644 --- a/lua/kide/lsp/utils/jdtls.lua +++ b/lua/kide/lsp/utils/jdtls.lua @@ -1,68 +1,104 @@ +-- code from https://github.com/mfussenegger/nvim-jdtls/blob/f8fb45e05e/lua/jdtls.lua +local api = vim.api local M = {} -M.open_jdt_link = function(uri, buf, timeout) - local client - for _, c in ipairs(vim.lsp.get_active_clients()) do - if - c.config.init_options - and c.config.init_options.extendedClientCapabilities - and c.config.init_options.extendedClientCapabilities.classFileContentsSupport - then - client = c - break +function M.execute_command(command, callback, bufnr) + local clients = {} + local candidates = bufnr and vim.lsp.buf_get_clients(bufnr) or vim.lsp.get_active_clients() + for _, c in pairs(candidates) do + local command_provider = c.server_capabilities.executeCommandProvider + local commands = type(command_provider) == "table" and command_provider.commands or {} + if vim.tbl_contains(commands, command.command) then + table.insert(clients, c) end end - assert(client, "Must have a buffer open with a language client connected to eclipse.jdt.ls to load JDT URI") - local params = { - uri = uri, - } - local response = nil - local cb = function(err, result) - response = { err, result } - end - local ok, request_id = client.request("java/classFileContents", params, cb, buf) - assert(ok, "Request to `java/classFileContents` must succeed to open JDT URI. Client shutdown?") - local timeout_ms = timeout or 500 - local wait_ok, reason = vim.wait(timeout_ms, function() - return response - end) - local log_path = require("jdtls.path").join(vim.fn.stdpath("cache"), "lsp.log") - local buf_content - if wait_ok and #response == 2 and response[2] then - local content = response[2] - if content == "" then - buf_content = { - "Received response from server, but it was empty. Check the log file for errors", - log_path, - } + local num_clients = vim.tbl_count(clients) + if num_clients == 0 then + if bufnr then + -- User could've switched buffer to non-java file, try all clients + return M.execute_command(command, callback, nil) else - buf_content = vim.split(response[2], "\n", true) + vim.notify("No LSP client found that supports " .. command.command, vim.log.levels.ERROR) + return + end + end + + if num_clients > 1 then + vim.notify( + "Multiple LSP clients found that support " + .. command.command + .. " you should have at most one JDTLS server running", + vim.log.levels.WARN + ) + end + + local co + if not callback then + co = coroutine.running() + if co then + callback = function(err, resp) + coroutine.resume(co, err, resp) + end end + end + clients[1].request("workspace/executeCommand", command, callback) + if co then + return coroutine.yield() + end +end +--- Open `jdt://` uri or decompile class contents and load them into the buffer +--- +--- nvim-jdtls by defaults configures a `BufReadCmd` event which uses this function. +--- You shouldn't need to call this manually. +--- +---@param fname string +function M.open_classfile(fname, buf, timeout_ms) + local uri + local use_cmd + if vim.startswith(fname, "jdt://") then + uri = fname + use_cmd = false else - local error_msg - if not wait_ok then - client.cancel_request(request_id) - local wait_failure = { - [-1] = "timeout", - [-2] = "interrupted", - [-3] = "error", - } - error_msg = wait_failure[reason] - else - error_msg = response[1] + uri = vim.uri_from_fname(fname) + use_cmd = true + if not vim.startswith(uri, "file://") then + return end - buf_content = { - "Failed to load content for uri", - uri, - "", - "Error was: ", + end + vim.bo[buf].modifiable = true + vim.bo[buf].swapfile = false + vim.bo[buf].buftype = "nofile" + -- This triggers FileType event which should fire up the lsp client if not already running + vim.bo[buf].filetype = "java" + vim.wait(timeout_ms, function() + return next(vim.lsp.get_active_clients({ name = "jdtls" })) ~= nil + end) + local client = vim.lsp.get_active_clients({ name = "jdtls" })[1] + assert(client, "Must have a `jdtls` client to load class file or jdt uri") + + local content + local function handler(err, result) + assert(not err, vim.inspect(err)) + content = result + api.nvim_buf_set_lines(buf, 0, -1, false, vim.split(result, "\n", { plain = true })) + vim.bo[buf].modifiable = false + end + + if use_cmd then + local command = { + command = "java.decompile", + arguments = { uri }, } - vim.list_extend(buf_content, vim.split(vim.inspect(error_msg), "\n")) - vim.list_extend(buf_content, { "", "Check the log file for errors", log_path }) + M.execute_command(command, handler) + else + local params = { + uri = uri, + } + client.request("java/classFileContents", params, handler, buf) end - vim.api.nvim_buf_set_option(buf, "modifiable", true) - vim.api.nvim_buf_set_lines(buf, 0, -1, false, buf_content) - vim.api.nvim_buf_set_option(buf, "filetype", "java") - -- vim.api.nvim_buf_set_option(buf, "syntax", "java") - vim.api.nvim_buf_set_option(buf, "modifiable", false) + -- Need to block. Otherwise logic could run that sets the cursor to a position + -- that's still missing. + vim.wait(timeout_ms, function() + return content ~= nil + end) end return M diff --git a/lua/kide/plugins/config/telescope.lua b/lua/kide/plugins/config/telescope.lua index 8a345187..0285c399 100644 --- a/lua/kide/plugins/config/telescope.lua +++ b/lua/kide/plugins/config/telescope.lua @@ -91,7 +91,7 @@ telescope.setup({ timeout = 1000, filetype_hook = function(filepath, bufnr, opts) if vim.startswith(filepath, "jdt://") then - require("kide.lsp.utils.jdtls").open_jdt_link(filepath, bufnr, opts.preview.timeout) + require("kide.lsp.utils.jdtls").open_classfile(filepath, bufnr, opts.preview.timeout) end return true end, From 37b204398c1c6736e62a91f0da127791e353658c Mon Sep 17 00:00:00 2001 From: luokai Date: Tue, 28 Mar 2023 16:43:54 +0800 Subject: [PATCH 0630/1278] =?UTF-8?q?=E5=8F=AF=E9=80=89=E9=85=8D=E7=BD=AE?= =?UTF-8?q?=20copilot?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lua/kide/config.lua | 8 ++++++++ lua/kide/plugins/lazy-nvim.lua | 3 +++ 2 files changed, 11 insertions(+) create mode 100644 lua/kide/config.lua diff --git a/lua/kide/config.lua b/lua/kide/config.lua new file mode 100644 index 00000000..5631f65b --- /dev/null +++ b/lua/kide/config.lua @@ -0,0 +1,8 @@ +local M = { + plugin = { + copilot = { + enable = os.getenv("copilot_enable") or false, + }, + }, +} +return M diff --git a/lua/kide/plugins/lazy-nvim.lua b/lua/kide/plugins/lazy-nvim.lua index 6bde7e5b..757ad031 100644 --- a/lua/kide/plugins/lazy-nvim.lua +++ b/lua/kide/plugins/lazy-nvim.lua @@ -1,3 +1,4 @@ +local config = require("kide.config") local function loadPluginCmd(cmd, module) vim.api.nvim_create_user_command(cmd, function() require(module) @@ -745,6 +746,7 @@ require("lazy").setup({ }, { "zbirenbaum/copilot.lua", + enabled = config.plugin.copilot.enable, lazy = true, cmd = "Copilot", config = function() @@ -756,6 +758,7 @@ require("lazy").setup({ }, { "zbirenbaum/copilot-cmp", + enabled = config.plugin.copilot.enable, lazy = true, dependencies = { "zbirenbaum/copilot.lua" }, event = "InsertEnter", From b8a65a6560cf0215b6e00f713eca0c098e69c48b Mon Sep 17 00:00:00 2001 From: luokai Date: Wed, 22 Mar 2023 17:34:26 +0800 Subject: [PATCH 0631/1278] =?UTF-8?q?alpha=20=E4=B8=8D=E5=8A=A0=E8=BD=BD?= =?UTF-8?q?=20lualine?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lua/kide/plugins/config/lualine.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lua/kide/plugins/config/lualine.lua b/lua/kide/plugins/config/lualine.lua index f93062ac..8e4ac30b 100644 --- a/lua/kide/plugins/config/lualine.lua +++ b/lua/kide/plugins/config/lualine.lua @@ -7,7 +7,7 @@ local config = { component_separators = { left = "", right = "" }, section_separators = { left = "", right = "" }, disabled_filetypes = { - -- "dap-repl", "dapui_watches", "dapui_stacks", "dapui_breakpoints", "dapui_scopes" + "alpha", }, always_divide_middle = true, }, From 78183c9b1eaefc7da04ab8f45f8a9e0ddd4a3e8f Mon Sep 17 00:00:00 2001 From: luokai Date: Sun, 26 Mar 2023 13:44:43 +0800 Subject: [PATCH 0632/1278] copilot --- lua/kide/plugins/lazy-nvim.lua | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/lua/kide/plugins/lazy-nvim.lua b/lua/kide/plugins/lazy-nvim.lua index 0a7ac760..39336bfc 100644 --- a/lua/kide/plugins/lazy-nvim.lua +++ b/lua/kide/plugins/lazy-nvim.lua @@ -743,6 +743,14 @@ require("lazy").setup({ require("kide.theme.gruvbox").load_trans_highlights() end, }, + + { + "github/copilot.vim", + lazy = true, + cmd = { + "Copilot", + }, + }, }, { ui = { icons = { From db4b3d4b09dada3c77d955226a6c7014517d5eef Mon Sep 17 00:00:00 2001 From: luokai Date: Sun, 26 Mar 2023 15:02:01 +0800 Subject: [PATCH 0633/1278] copilot --- lua/kide/core/keybindings.lua | 5 ++++- lua/kide/plugins/config/nvim-cmp.lua | 9 ++++++++- lua/kide/plugins/lazy-nvim.lua | 22 +++++++++++++++++----- 3 files changed, 29 insertions(+), 7 deletions(-) diff --git a/lua/kide/core/keybindings.lua b/lua/kide/core/keybindings.lua index 84e3899e..0556642f 100644 --- a/lua/kide/core/keybindings.lua +++ b/lua/kide/core/keybindings.lua @@ -226,8 +226,11 @@ end M.cmp = function(cmp) local luasnip = require("luasnip") local has_words_before = function() + if vim.api.nvim_buf_get_option(0, "buftype") == "prompt" then + return false + end local line, col = unpack(vim.api.nvim_win_get_cursor(0)) - return col ~= 0 and vim.api.nvim_buf_get_lines(0, line - 1, line, true)[1]:sub(col, col):match("%s") == nil + return col ~= 0 and vim.api.nvim_buf_get_text(0, line - 1, 0, line - 1, col, {})[1]:match("^%s*$") == nil end return { -- [""] = cmp.mapping.scroll_docs(-4), diff --git a/lua/kide/plugins/config/nvim-cmp.lua b/lua/kide/plugins/config/nvim-cmp.lua index 90eca963..57a24f84 100644 --- a/lua/kide/plugins/config/nvim-cmp.lua +++ b/lua/kide/plugins/config/nvim-cmp.lua @@ -1,6 +1,11 @@ local lspkind = require("lspkind") local cmp = require("cmp") - +lspkind.init({ + symbol_map = { + Copilot = "", + }, +}) +vim.api.nvim_set_hl(0, "CmpItemKindCopilot", { fg = "#6CC644" }) cmp.setup({ -- 指定 snippet 引擎 snippet = { @@ -20,6 +25,7 @@ cmp.setup({ }, -- 来源 sources = cmp.config.sources({ + { name = "copilot" }, { name = "nvim_lsp" }, -- For vsnip users. -- { name = 'vsnip' }, @@ -50,6 +56,7 @@ cmp.setup({ nvim_lsp = "[LSP]", luasnip = "[Lsnip]", path = "[Path]", + copilot = "[Copilot]", -- buffer = "[Buffer]", }, }), diff --git a/lua/kide/plugins/lazy-nvim.lua b/lua/kide/plugins/lazy-nvim.lua index 39336bfc..6bde7e5b 100644 --- a/lua/kide/plugins/lazy-nvim.lua +++ b/lua/kide/plugins/lazy-nvim.lua @@ -743,13 +743,25 @@ require("lazy").setup({ require("kide.theme.gruvbox").load_trans_highlights() end, }, - { - "github/copilot.vim", + "zbirenbaum/copilot.lua", lazy = true, - cmd = { - "Copilot", - }, + cmd = "Copilot", + config = function() + require("copilot").setup({ + suggestion = { enabled = false }, + panel = { enabled = false }, + }) + end, + }, + { + "zbirenbaum/copilot-cmp", + lazy = true, + dependencies = { "zbirenbaum/copilot.lua" }, + event = "InsertEnter", + config = function() + require("copilot_cmp").setup() + end, }, }, { ui = { From 815469ed58065c399787f94adcaf6b1eee4b4d65 Mon Sep 17 00:00:00 2001 From: luokai Date: Tue, 28 Mar 2023 15:32:17 +0800 Subject: [PATCH 0634/1278] open_classfile --- lua/kide/lsp/java.lua | 4 +- lua/kide/lsp/utils/jdtls.lua | 150 ++++++++++++++++---------- lua/kide/plugins/config/telescope.lua | 2 +- 3 files changed, 96 insertions(+), 60 deletions(-) diff --git a/lua/kide/lsp/java.lua b/lua/kide/lsp/java.lua index f5b867e0..60cb3453 100644 --- a/lua/kide/lsp/java.lua +++ b/lua/kide/lsp/java.lua @@ -520,7 +520,7 @@ M.setup = function() vim.api.nvim_create_autocmd({ "BufReadCmd" }, { pattern = "jdt://*", callback = function(e) - require("jdtls").open_jdt_link(e.file) + require("jdtls").open_classfile(e.file) end, }) vim.api.nvim_create_user_command("JdtWipeDataAndRestart", "lua require('jdtls.setup').wipe_data_and_restart()", {}) @@ -535,7 +535,7 @@ M.setup = function() -- vim.notify("load: " .. o.buf, vim.log.levels.INFO) -- print(vim.inspect(e)) -- 忽略 telescope 预览的情况 - if e.file == "java" then + if e.file == "java" and vim.bo[e.buf].buftype == "nofile" then -- ignore else M.start() diff --git a/lua/kide/lsp/utils/jdtls.lua b/lua/kide/lsp/utils/jdtls.lua index 8eb32f36..11ed90aa 100644 --- a/lua/kide/lsp/utils/jdtls.lua +++ b/lua/kide/lsp/utils/jdtls.lua @@ -1,68 +1,104 @@ +-- code from https://github.com/mfussenegger/nvim-jdtls/blob/f8fb45e05e/lua/jdtls.lua +local api = vim.api local M = {} -M.open_jdt_link = function(uri, buf, timeout) - local client - for _, c in ipairs(vim.lsp.get_active_clients()) do - if - c.config.init_options - and c.config.init_options.extendedClientCapabilities - and c.config.init_options.extendedClientCapabilities.classFileContentsSupport - then - client = c - break +function M.execute_command(command, callback, bufnr) + local clients = {} + local candidates = bufnr and vim.lsp.buf_get_clients(bufnr) or vim.lsp.get_active_clients() + for _, c in pairs(candidates) do + local command_provider = c.server_capabilities.executeCommandProvider + local commands = type(command_provider) == "table" and command_provider.commands or {} + if vim.tbl_contains(commands, command.command) then + table.insert(clients, c) end end - assert(client, "Must have a buffer open with a language client connected to eclipse.jdt.ls to load JDT URI") - local params = { - uri = uri, - } - local response = nil - local cb = function(err, result) - response = { err, result } - end - local ok, request_id = client.request("java/classFileContents", params, cb, buf) - assert(ok, "Request to `java/classFileContents` must succeed to open JDT URI. Client shutdown?") - local timeout_ms = timeout or 500 - local wait_ok, reason = vim.wait(timeout_ms, function() - return response - end) - local log_path = require("jdtls.path").join(vim.fn.stdpath("cache"), "lsp.log") - local buf_content - if wait_ok and #response == 2 and response[2] then - local content = response[2] - if content == "" then - buf_content = { - "Received response from server, but it was empty. Check the log file for errors", - log_path, - } + local num_clients = vim.tbl_count(clients) + if num_clients == 0 then + if bufnr then + -- User could've switched buffer to non-java file, try all clients + return M.execute_command(command, callback, nil) else - buf_content = vim.split(response[2], "\n", true) + vim.notify("No LSP client found that supports " .. command.command, vim.log.levels.ERROR) + return + end + end + + if num_clients > 1 then + vim.notify( + "Multiple LSP clients found that support " + .. command.command + .. " you should have at most one JDTLS server running", + vim.log.levels.WARN + ) + end + + local co + if not callback then + co = coroutine.running() + if co then + callback = function(err, resp) + coroutine.resume(co, err, resp) + end end + end + clients[1].request("workspace/executeCommand", command, callback) + if co then + return coroutine.yield() + end +end +--- Open `jdt://` uri or decompile class contents and load them into the buffer +--- +--- nvim-jdtls by defaults configures a `BufReadCmd` event which uses this function. +--- You shouldn't need to call this manually. +--- +---@param fname string +function M.open_classfile(fname, buf, timeout_ms) + local uri + local use_cmd + if vim.startswith(fname, "jdt://") then + uri = fname + use_cmd = false else - local error_msg - if not wait_ok then - client.cancel_request(request_id) - local wait_failure = { - [-1] = "timeout", - [-2] = "interrupted", - [-3] = "error", - } - error_msg = wait_failure[reason] - else - error_msg = response[1] + uri = vim.uri_from_fname(fname) + use_cmd = true + if not vim.startswith(uri, "file://") then + return end - buf_content = { - "Failed to load content for uri", - uri, - "", - "Error was: ", + end + vim.bo[buf].modifiable = true + vim.bo[buf].swapfile = false + vim.bo[buf].buftype = "nofile" + -- This triggers FileType event which should fire up the lsp client if not already running + vim.bo[buf].filetype = "java" + vim.wait(timeout_ms, function() + return next(vim.lsp.get_active_clients({ name = "jdtls" })) ~= nil + end) + local client = vim.lsp.get_active_clients({ name = "jdtls" })[1] + assert(client, "Must have a `jdtls` client to load class file or jdt uri") + + local content + local function handler(err, result) + assert(not err, vim.inspect(err)) + content = result + api.nvim_buf_set_lines(buf, 0, -1, false, vim.split(result, "\n", { plain = true })) + vim.bo[buf].modifiable = false + end + + if use_cmd then + local command = { + command = "java.decompile", + arguments = { uri }, } - vim.list_extend(buf_content, vim.split(vim.inspect(error_msg), "\n")) - vim.list_extend(buf_content, { "", "Check the log file for errors", log_path }) + M.execute_command(command, handler) + else + local params = { + uri = uri, + } + client.request("java/classFileContents", params, handler, buf) end - vim.api.nvim_buf_set_option(buf, "modifiable", true) - vim.api.nvim_buf_set_lines(buf, 0, -1, false, buf_content) - vim.api.nvim_buf_set_option(buf, "filetype", "java") - -- vim.api.nvim_buf_set_option(buf, "syntax", "java") - vim.api.nvim_buf_set_option(buf, "modifiable", false) + -- Need to block. Otherwise logic could run that sets the cursor to a position + -- that's still missing. + vim.wait(timeout_ms, function() + return content ~= nil + end) end return M diff --git a/lua/kide/plugins/config/telescope.lua b/lua/kide/plugins/config/telescope.lua index 8a345187..0285c399 100644 --- a/lua/kide/plugins/config/telescope.lua +++ b/lua/kide/plugins/config/telescope.lua @@ -91,7 +91,7 @@ telescope.setup({ timeout = 1000, filetype_hook = function(filepath, bufnr, opts) if vim.startswith(filepath, "jdt://") then - require("kide.lsp.utils.jdtls").open_jdt_link(filepath, bufnr, opts.preview.timeout) + require("kide.lsp.utils.jdtls").open_classfile(filepath, bufnr, opts.preview.timeout) end return true end, From e36651e33e80517ac988ed932bd1c1563b120971 Mon Sep 17 00:00:00 2001 From: luokai Date: Tue, 28 Mar 2023 16:43:54 +0800 Subject: [PATCH 0635/1278] =?UTF-8?q?=E5=8F=AF=E9=80=89=E9=85=8D=E7=BD=AE?= =?UTF-8?q?=20copilot?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lua/kide/config.lua | 8 ++++++++ lua/kide/plugins/lazy-nvim.lua | 3 +++ 2 files changed, 11 insertions(+) create mode 100644 lua/kide/config.lua diff --git a/lua/kide/config.lua b/lua/kide/config.lua new file mode 100644 index 00000000..5631f65b --- /dev/null +++ b/lua/kide/config.lua @@ -0,0 +1,8 @@ +local M = { + plugin = { + copilot = { + enable = os.getenv("copilot_enable") or false, + }, + }, +} +return M diff --git a/lua/kide/plugins/lazy-nvim.lua b/lua/kide/plugins/lazy-nvim.lua index 6bde7e5b..757ad031 100644 --- a/lua/kide/plugins/lazy-nvim.lua +++ b/lua/kide/plugins/lazy-nvim.lua @@ -1,3 +1,4 @@ +local config = require("kide.config") local function loadPluginCmd(cmd, module) vim.api.nvim_create_user_command(cmd, function() require(module) @@ -745,6 +746,7 @@ require("lazy").setup({ }, { "zbirenbaum/copilot.lua", + enabled = config.plugin.copilot.enable, lazy = true, cmd = "Copilot", config = function() @@ -756,6 +758,7 @@ require("lazy").setup({ }, { "zbirenbaum/copilot-cmp", + enabled = config.plugin.copilot.enable, lazy = true, dependencies = { "zbirenbaum/copilot.lua" }, event = "InsertEnter", From 1ff6f3573d1195d0a181c224f6c402613839c3e1 Mon Sep 17 00:00:00 2001 From: luokai Date: Fri, 7 Apr 2023 09:39:16 +0800 Subject: [PATCH 0636/1278] sqlls --- lua/kide/lsp/init.lua | 2 +- lua/kide/lsp/{sqls.lua => sqlls.lua} | 0 2 files changed, 1 insertion(+), 1 deletion(-) rename lua/kide/lsp/{sqls.lua => sqlls.lua} (100%) diff --git a/lua/kide/lsp/init.lua b/lua/kide/lsp/init.lua index 2ddec97d..5861ef32 100644 --- a/lua/kide/lsp/init.lua +++ b/lua/kide/lsp/init.lua @@ -18,7 +18,7 @@ local server_configs = { html = require("kide.lsp.html"), pyright = require("kide.lsp.pyright"), rust_analyzer = require("kide.lsp.rust_analyzer"), - sqls = require("kide.lsp.sqls"), + sqlls = require("kide.lsp.sqlls"), gopls = require("kide.lsp.gopls"), kotlin_language_server = {}, vuels = {}, diff --git a/lua/kide/lsp/sqls.lua b/lua/kide/lsp/sqlls.lua similarity index 100% rename from lua/kide/lsp/sqls.lua rename to lua/kide/lsp/sqlls.lua From 72ab0ee82d35df4a697f5693710359f0a4135c6c Mon Sep 17 00:00:00 2001 From: luokai Date: Fri, 7 Apr 2023 10:18:11 +0800 Subject: [PATCH 0637/1278] udpate java md doc --- lua/kide/lsp/java.lua | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/lua/kide/lsp/java.lua b/lua/kide/lsp/java.lua index 60cb3453..255c1f96 100644 --- a/lua/kide/lsp/java.lua +++ b/lua/kide/lsp/java.lua @@ -407,11 +407,12 @@ local function markdown_format(input) -- input = string.gsub(input, "[\r\n]( +)(%*)", function (i1) -- return i1 .. "-" -- end) - input = string.gsub(input, "%[([^:/]*)%]", function(i1) + input = string.gsub(input, "%[([%a%$_]+[%.%w%(%)]*)%]%(file:/[^%)]+%)", function(i1) + return "`" .. i1 .. "`" + end) + input = string.gsub(input, "%[([%a%$_]+[%.%w%(%)]*)%]%(jdt://[^%)]+%)", function(i1) return "`" .. i1 .. "`" end) - input = string.gsub(input, "%(file:/[^%)]+%)", "") - input = string.gsub(input, "%(jdt://[^%)]+%)", "") end return input end From a92c791840d0adfb5f9264606b37afd2658c2e37 Mon Sep 17 00:00:00 2001 From: luokai Date: Fri, 7 Apr 2023 17:02:28 +0800 Subject: [PATCH 0638/1278] java md doc --- lua/kide/lsp/java.lua | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lua/kide/lsp/java.lua b/lua/kide/lsp/java.lua index 255c1f96..13618c20 100644 --- a/lua/kide/lsp/java.lua +++ b/lua/kide/lsp/java.lua @@ -407,10 +407,10 @@ local function markdown_format(input) -- input = string.gsub(input, "[\r\n]( +)(%*)", function (i1) -- return i1 .. "-" -- end) - input = string.gsub(input, "%[([%a%$_]+[%.%w%(%)]*)%]%(file:/[^%)]+%)", function(i1) + input = string.gsub(input, "%[([%a%$_]+[%.%w%(%),%s ]*)%]%(file:/[^%)]+%)", function(i1) return "`" .. i1 .. "`" end) - input = string.gsub(input, "%[([%a%$_]+[%.%w%(%)]*)%]%(jdt://[^%)]+%)", function(i1) + input = string.gsub(input, "%[([%a%$_]+[%.%w%(%),%s ]*)%]%(jdt://[^%)]+%)", function(i1) return "`" .. i1 .. "`" end) end From ddc9747b51567e33363d17b4bff0283535a159f4 Mon Sep 17 00:00:00 2001 From: luokai Date: Tue, 11 Apr 2023 10:00:45 +0800 Subject: [PATCH 0639/1278] =?UTF-8?q?=E6=9B=B4=E6=96=B0=20jdt.ls=20?= =?UTF-8?q?=E9=85=8D=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lua/kide/lsp/java.lua | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/lua/kide/lsp/java.lua b/lua/kide/lsp/java.lua index 13618c20..b16cb876 100644 --- a/lua/kide/lsp/java.lua +++ b/lua/kide/lsp/java.lua @@ -192,7 +192,7 @@ local config = { -- '-XX:+UseStringDeduplication', -- '-Xms512m', "-XX:+UseZGC", - "-Xmx4g", + "-Xmx1g", -- "-Xbootclasspath/a:" .. get_lombok_jar(), "-javaagent:" .. get_lombok_jar(), "--add-modules=ALL-SYSTEM", @@ -221,6 +221,12 @@ local config = { java = { maxConcurrentBuilds = 8, home = get_java_home(), + jdt = { + ls = { + -- 暂时不可用 + lombokSupport = { enabled = true }, + }, + }, project = { encoding = "UTF-8", resourceFilters = { @@ -228,6 +234,8 @@ local config = { ".git", }, }, + foldingRange = { enabled = true }, + selectionRange = { enabled = true }, import = { exclusions = { "**/node_modules/**", @@ -342,6 +350,7 @@ config["init_options"] = { } config["on_attach"] = function(client, buffer) + -- client.server_capabilities.semanticTokensProvider = nil -- With `hotcodereplace = 'auto' the debug adapter will try to apply code changes -- you make during a debug session immediately. -- Remove the option if you do not want that. From 6cb3b4c63350a7b3d29ff9c3c8f3769a965c434e Mon Sep 17 00:00:00 2001 From: luokai Date: Tue, 11 Apr 2023 10:22:18 +0800 Subject: [PATCH 0640/1278] autobuild --- lua/kide/lsp/java.lua | 3 +++ 1 file changed, 3 insertions(+) diff --git a/lua/kide/lsp/java.lua b/lua/kide/lsp/java.lua index b16cb876..56a7fd2e 100644 --- a/lua/kide/lsp/java.lua +++ b/lua/kide/lsp/java.lua @@ -237,6 +237,8 @@ local config = { foldingRange = { enabled = true }, selectionRange = { enabled = true }, import = { + gradle = { enabled = true }, + maven = { enabled = true }, exclusions = { "**/node_modules/**", "**/.metadata/**", @@ -245,6 +247,7 @@ local config = { "**/.git/**", }, }, + autobuild = { enabled = true }, referenceCodeLens = { enabled = true }, implementationsCodeLens = { enabled = true }, templates = { From 94fa9b14a91fbcd3fb473ee81c918ced13a2f8ac Mon Sep 17 00:00:00 2001 From: luokai Date: Tue, 11 Apr 2023 11:37:50 +0800 Subject: [PATCH 0641/1278] test --- lua/kide/lsp/java.lua | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lua/kide/lsp/java.lua b/lua/kide/lsp/java.lua index 56a7fd2e..f27562a0 100644 --- a/lua/kide/lsp/java.lua +++ b/lua/kide/lsp/java.lua @@ -419,10 +419,10 @@ local function markdown_format(input) -- input = string.gsub(input, "[\r\n]( +)(%*)", function (i1) -- return i1 .. "-" -- end) - input = string.gsub(input, "%[([%a%$_]+[%.%w%(%),%s ]*)%]%(file:/[^%)]+%)", function(i1) + input = string.gsub(input, "%[([%a%$_]?[%.%w%(%),\\_%s ]*)%]%(file:/[^%)]+%)", function(i1) return "`" .. i1 .. "`" end) - input = string.gsub(input, "%[([%a%$_]+[%.%w%(%),%s ]*)%]%(jdt://[^%)]+%)", function(i1) + input = string.gsub(input, "%[([%a%$_]?[%.%w%(%),\\_%s ]*)%]%(jdt://[^%)]+%)", function(i1) return "`" .. i1 .. "`" end) end From f438b6977a914a2f9d1a21e4ded4ec3a3f61cb97 Mon Sep 17 00:00:00 2001 From: luokai Date: Sun, 23 Apr 2023 09:09:06 +0800 Subject: [PATCH 0642/1278] maven --- lua/kide/core/utils/maven.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lua/kide/core/utils/maven.lua b/lua/kide/core/utils/maven.lua index e4525a61..1df5a0bb 100644 --- a/lua/kide/core/utils/maven.lua +++ b/lua/kide/core/utils/maven.lua @@ -98,7 +98,7 @@ M.maven_command = function(buf) close_on_exit = false, }) create_command(buf, "MavenDownloadSources", "mvn dependency:sources -DdownloadSources=true") - create_command(buf, "MavenTest", "mvn test", maven_args_complete({ "-Dtest=" }, {})) + create_command(buf, "MavenTest", "mvn test", maven_args_complete({ "-Dtest=" }, {}), { close_on_exit = false }) end M.setup = function() From a05af2ca319ae8ba3875afac282991fa565a9014 Mon Sep 17 00:00:00 2001 From: luokai Date: Mon, 24 Apr 2023 19:56:02 +0800 Subject: [PATCH 0643/1278] update jdtls --- lua/kide/lsp/java.lua | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/lua/kide/lsp/java.lua b/lua/kide/lsp/java.lua index f27562a0..286d9398 100644 --- a/lua/kide/lsp/java.lua +++ b/lua/kide/lsp/java.lua @@ -406,13 +406,8 @@ config.handlers["language/status"] = function(_, s) end end --- 已合并,需要编译最新版本支持 -if not env.JDTLS_HOME then - -- java 暂时兼容 fidget, 等待上游支持 - -- https://github.com/eclipse/eclipse.jdt.ls/pull/2258 - vim.lsp.handlers["$/progress"] = nil - require("fidget").setup({}) -end +vim.lsp.handlers["$/progress"] = nil +require("fidget").setup({}) local function markdown_format(input) if input then From 713c5f03d0d9ce31f0328fe53f27b0f1d478de9f Mon Sep 17 00:00:00 2001 From: luokai Date: Tue, 25 Apr 2023 18:09:26 +0800 Subject: [PATCH 0644/1278] lemminx --- README.md | 5 +++++ lua/kide/lsp/init.lua | 4 ++++ lua/kide/lsp/lemminx.lua | 25 ++++++++++++++++++++++++- 3 files changed, 33 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index caddbde2..015f1dbb 100644 --- a/README.md +++ b/README.md @@ -123,6 +123,11 @@ git clone https://github.com/JavaHello/nvim.git Debug +
+Maven(pom.xml 自动补全) + Debug +
+ ## 我的 VIM 插件列表 | 插件名称 | 插件描述 | 推荐等级 | 备注 | diff --git a/lua/kide/lsp/init.lua b/lua/kide/lsp/init.lua index 5861ef32..4fa289c7 100644 --- a/lua/kide/lsp/init.lua +++ b/lua/kide/lsp/init.lua @@ -22,6 +22,7 @@ local server_configs = { gopls = require("kide.lsp.gopls"), kotlin_language_server = {}, vuels = {}, + lemminx = require("kide.lsp.lemminx"), } -- Setup lspconfig. @@ -68,6 +69,9 @@ require("mason-lspconfig").setup_handlers({ end end, }) +if server_configs.lemminx.setup then + server_configs.lemminx.setup() +end -- LSP 相关美化参考 https://github.com/NvChad/NvChad local function lspSymbol(name, icon) diff --git a/lua/kide/lsp/lemminx.lua b/lua/kide/lsp/lemminx.lua index a5647075..1549713a 100644 --- a/lua/kide/lsp/lemminx.lua +++ b/lua/kide/lsp/lemminx.lua @@ -1 +1,24 @@ -return {} +local M = {} +local lemminx_home = os.getenv("LEMMINX_HOME") +if lemminx_home then + M.setup = function() + local lspconfig = require("lspconfig") + local utils = require("kide.core.utils") + + local lemminx_jars = {} + for _, bundle in ipairs(vim.split(vim.fn.glob(lemminx_home .. "/*.jar"), "\n")) do + table.insert(lemminx_jars, bundle) + end + vim.fn.join(lemminx_jars, utils.is_win and ";" or ":") + lspconfig["lemminx"].setup({ + cmd = { + "java", + "-cp", + vim.fn.join(lemminx_jars, ":"), + "org.eclipse.lemminx.XMLServerLauncher", + }, + }) + end +end + +return M From ee835ded746c19c0c90db5d87b986e41e37a071c Mon Sep 17 00:00:00 2001 From: luokai Date: Wed, 26 Apr 2023 18:17:43 +0800 Subject: [PATCH 0645/1278] =?UTF-8?q?=E4=B8=8D=E4=B9=A0=E6=83=AF=20jk?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lua/kide/core/keybindings.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lua/kide/core/keybindings.lua b/lua/kide/core/keybindings.lua index 0556642f..59f87790 100644 --- a/lua/kide/core/keybindings.lua +++ b/lua/kide/core/keybindings.lua @@ -8,7 +8,7 @@ local M = {} M.setup = function() -- Esc - map("i", "jk", "", opt) + -- map("i", "jk", "", opt) -- n 模式下复制内容到系统剪切板 map("n", "c", '"+yy', opt) -- v 模式下复制内容到系统剪切板 From 4a96059ad543f662bebfc22f399db0d9ee3c0135 Mon Sep 17 00:00:00 2001 From: luokai Date: Wed, 26 Apr 2023 20:06:32 +0800 Subject: [PATCH 0646/1278] =?UTF-8?q?=E5=BF=AB=E6=8D=B7=E9=94=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lua/kide/lsp/lemminx.lua | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/lua/kide/lsp/lemminx.lua b/lua/kide/lsp/lemminx.lua index 1549713a..f8907d23 100644 --- a/lua/kide/lsp/lemminx.lua +++ b/lua/kide/lsp/lemminx.lua @@ -17,6 +17,12 @@ if lemminx_home then vim.fn.join(lemminx_jars, ":"), "org.eclipse.lemminx.XMLServerLauncher", }, + on_attach = function(client, buffer) + require("kide.core.keybindings").maplsp(client, buffer) + if client.server_capabilities.documentSymbolProvider then + require("nvim-navic").attach(client, buffer) + end + end, }) end end From 2cd87cc46857c54ca779d74c038b44c883dcdd97 Mon Sep 17 00:00:00 2001 From: luokai Date: Wed, 26 Apr 2023 20:22:51 +0800 Subject: [PATCH 0647/1278] navic --- lua/kide/plugins/config/lualine.lua | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/lua/kide/plugins/config/lualine.lua b/lua/kide/plugins/config/lualine.lua index 8e4ac30b..e90dee9e 100644 --- a/lua/kide/plugins/config/lualine.lua +++ b/lua/kide/plugins/config/lualine.lua @@ -1,5 +1,3 @@ -local navic = require("nvim-navic") - local config = { options = { icons_enabled = true, @@ -30,7 +28,7 @@ local config = { end, }, "filename", - { navic.get_location, cond = navic.is_available }, + "navic", }, lualine_x = { "encoding", "fileformat", "filetype" }, lualine_y = { "progress" }, From 2a3d801548abfaca0e621cd7e33e1d20524dcefe Mon Sep 17 00:00:00 2001 From: luokai Date: Thu, 27 Apr 2023 11:47:23 +0800 Subject: [PATCH 0648/1278] load --- lua/kide/plugins/lazy-nvim.lua | 24 +++++++++--------------- 1 file changed, 9 insertions(+), 15 deletions(-) diff --git a/lua/kide/plugins/lazy-nvim.lua b/lua/kide/plugins/lazy-nvim.lua index 757ad031..63b76b9f 100644 --- a/lua/kide/plugins/lazy-nvim.lua +++ b/lua/kide/plugins/lazy-nvim.lua @@ -1,9 +1,4 @@ local config = require("kide.config") -local function loadPluginCmd(cmd, module) - vim.api.nvim_create_user_command(cmd, function() - require(module) - end, {}) -end require("lazy").setup({ @@ -190,23 +185,17 @@ require("lazy").setup({ { "mfussenegger/nvim-dap", lazy = true, - event = { "BufNewFile", "BufReadPost" }, + event = { "VeryLazy" }, config = function() require("kide.dap") - require("nvim-dap-virtual-text").setup({}) - require("telescope").load_extension("dap") + -- require("telescope").load_extension("dap") end, }, { "rcarriga/nvim-dap-ui", lazy = true, dependencies = { "mfussenegger/nvim-dap" }, - cmd = { - "LoadDapUI", - }, - init = function() - loadPluginCmd("LoadDapUI", "dapui") - end, + event = { "VeryLazy" }, config = function() require("kide.plugins.config.nvim-dap-ui") end, @@ -214,7 +203,11 @@ require("lazy").setup({ { "theHamsta/nvim-dap-virtual-text", lazy = true, + event = { "VeryLazy" }, dependencies = { "mfussenegger/nvim-dap" }, + config = function() + require("nvim-dap-virtual-text").setup({}) + end, }, -- 搜索插件 @@ -222,6 +215,7 @@ require("lazy").setup({ "nvim-telescope/telescope.nvim", lazy = true, dependencies = { "ellisonleao/gruvbox.nvim" }, + event = { "VeryLazy" }, cmd = { "Telescope" }, keys = { "" }, tag = "0.1.1", @@ -290,7 +284,7 @@ require("lazy").setup({ { "lewis6991/gitsigns.nvim", layz = true, - event = { "BufReadPost" }, + event = { "VeryLazy", "BufReadPost" }, config = function() require("kide.plugins.config.gitsigns-nvim") end, From 34119e452bdaba526603323890c4c73863859541 Mon Sep 17 00:00:00 2001 From: luokai Date: Thu, 27 Apr 2023 15:46:18 +0800 Subject: [PATCH 0649/1278] autoclose dapui_console --- lua/kide/plugins/config/lualine.lua | 1 + lua/kide/plugins/config/nvim-dap-ui.lua | 71 ++++++++++++++++++++----- 2 files changed, 59 insertions(+), 13 deletions(-) diff --git a/lua/kide/plugins/config/lualine.lua b/lua/kide/plugins/config/lualine.lua index e90dee9e..8380c28d 100644 --- a/lua/kide/plugins/config/lualine.lua +++ b/lua/kide/plugins/config/lualine.lua @@ -55,6 +55,7 @@ dap.sections = { } dap.filetypes = { "dap-terminal", + "dapui_console", } table.insert(config.extensions, dap) diff --git a/lua/kide/plugins/config/nvim-dap-ui.lua b/lua/kide/plugins/config/nvim-dap-ui.lua index 8d0bc361..99c5b727 100644 --- a/lua/kide/plugins/config/nvim-dap-ui.lua +++ b/lua/kide/plugins/config/nvim-dap-ui.lua @@ -26,33 +26,78 @@ dapui.setup({ }, { elements = { - { id = "repl", size = 1 }, - -- { id = "console", size = 0.5 }, + { id = "repl", size = 0.3 }, + { id = "console", size = 0.7 }, }, size = 0.25, position = "bottom", }, }, }) +local M = { dapui_active = false } -dap.defaults.fallback.terminal_win_cmd = "belowright 12new | set filetype=dap-terminal" - -dap.listeners.after.event_initialized["dapui_config"] = function() - dapui.open() +local function auto_close(bufnr) + local acid + acid = vim.api.nvim_create_autocmd({ "BufDelete", "BufHidden" }, { + buffer = bufnr, + callback = function() + if M.dapui_active then + require("dapui").close() + M.dapui_active = false + else + dap.repl.close() + end + vim.api.nvim_del_autocmd(acid) + end, + }) end -dap.listeners.before.event_terminated["dapui_config"] = function() - dapui.close() + +-- dap.defaults.fallback.terminal_win_cmd = "belowright 12new | set filetype=dap-terminal" +local dapui_console = dap.defaults.fallback.terminal_win_cmd +dap.defaults.fallback.terminal_win_cmd = function() + if M.dapui_active then + local bufnr = dapui_console() + auto_close(bufnr) + return bufnr + else + local cur_win = vim.api.nvim_get_current_win() + -- open terminal + vim.api.nvim_command("belowright 12new") + local bufnr = vim.api.nvim_get_current_buf() + vim.bo[bufnr].modifiable = false + vim.bo[bufnr].swapfile = false + vim.bo[bufnr].buftype = "nofile" + vim.bo[bufnr].filetype = "dap-terminal" + + local win = vim.api.nvim_get_current_win() + vim.api.nvim_set_current_win(cur_win) + auto_close(bufnr) + return bufnr, win + end end -dap.listeners.before.event_exited["dapui_config"] = function() - dapui.close() + +dap.listeners.after.event_initialized["dapui_config"] = function() + -- dapui.open() + if not M.dapui_active then + dap.repl.open() + end end +-- dap.listeners.before.event_terminated["dapui_config"] = function() +-- dapui.close() +-- end +-- dap.listeners.before.event_exited["dapui_config"] = function() +-- dapui.close() +-- end -- nvim-dap vim.api.nvim_create_user_command("DapUIOpen", function() - require("dapui").open({}) + M.dapui_active = true + require("dapui").open() end, {}) vim.api.nvim_create_user_command("DapUIClose", function() - require("dapui").close({}) + M.dapui_active = false + require("dapui").close() end, {}) vim.api.nvim_create_user_command("DapUIToggle", function() - require("dapui").toggle({}) + M.dapui_active = not M.dapui_active + require("dapui").toggle() end, {}) From 3e7d40f815a0053820a040080b3271bf7bfb09d7 Mon Sep 17 00:00:00 2001 From: luokai Date: Thu, 27 Apr 2023 16:23:51 +0800 Subject: [PATCH 0650/1278] update version --- lua/kide/plugins/config/bufferline.lua | 2 +- lua/kide/plugins/lazy-nvim.lua | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/lua/kide/plugins/config/bufferline.lua b/lua/kide/plugins/config/bufferline.lua index a722632c..937c8895 100644 --- a/lua/kide/plugins/config/bufferline.lua +++ b/lua/kide/plugins/config/bufferline.lua @@ -74,7 +74,7 @@ require("bufferline").setup({ }, color_icons = true, show_buffer_close_icons = true, - show_buffer_default_icon = true, + -- show_buffer_default_icon = true, show_close_icon = false, show_tab_indicators = true, -- separator_style = "slant" | "thick" | "thin" | { 'any', 'any' }, diff --git a/lua/kide/plugins/lazy-nvim.lua b/lua/kide/plugins/lazy-nvim.lua index 63b76b9f..fa7e1f82 100644 --- a/lua/kide/plugins/lazy-nvim.lua +++ b/lua/kide/plugins/lazy-nvim.lua @@ -126,7 +126,7 @@ require("lazy").setup({ -- using packer.nvim { "akinsho/bufferline.nvim", - tag = "v3.0.1", + version = "*", dependencies = { "ellisonleao/gruvbox.nvim" }, requires = "kyazdani42/nvim-web-devicons", config = function() From 79b5a674676206756c3ff3ec11597fe55f5db846 Mon Sep 17 00:00:00 2001 From: luokai Date: Thu, 27 Apr 2023 16:26:12 +0800 Subject: [PATCH 0651/1278] nvim-tree update --- lua/kide/plugins/config/nvim-tree.lua | 2 +- lua/kide/plugins/lazy-nvim.lua | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/lua/kide/plugins/config/nvim-tree.lua b/lua/kide/plugins/config/nvim-tree.lua index 93830b5f..a4590928 100644 --- a/lua/kide/plugins/config/nvim-tree.lua +++ b/lua/kide/plugins/config/nvim-tree.lua @@ -48,7 +48,6 @@ require("nvim-tree").setup({ view = { width = 34, -- height = 40, - hide_root_folder = true, side = "left", preserve_window_proportions = false, number = false, @@ -64,6 +63,7 @@ require("nvim-tree").setup({ }, }, renderer = { + hide_root_folder = true, indent_markers = { enable = false, icons = { diff --git a/lua/kide/plugins/lazy-nvim.lua b/lua/kide/plugins/lazy-nvim.lua index fa7e1f82..75327049 100644 --- a/lua/kide/plugins/lazy-nvim.lua +++ b/lua/kide/plugins/lazy-nvim.lua @@ -117,7 +117,7 @@ require("lazy").setup({ "kyazdani42/nvim-tree.lua", lazy = true, cmd = "NvimTreeToggle", - tag = "nightly", + version = "*", config = function() require("kide.plugins.config.nvim-tree") end, From 02bb8106f40e30d6582dd28b388b0bcc02287ed0 Mon Sep 17 00:00:00 2001 From: luokai Date: Thu, 27 Apr 2023 16:39:02 +0800 Subject: [PATCH 0652/1278] =?UTF-8?q?=E5=8E=BB=E6=8E=89=E8=BF=87=E6=97=B6?= =?UTF-8?q?=E6=96=B9=E6=B3=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lua/kide/plugins/config/nvim-tree.lua | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/lua/kide/plugins/config/nvim-tree.lua b/lua/kide/plugins/config/nvim-tree.lua index a4590928..b4ab81e6 100644 --- a/lua/kide/plugins/config/nvim-tree.lua +++ b/lua/kide/plugins/config/nvim-tree.lua @@ -49,21 +49,22 @@ require("nvim-tree").setup({ width = 34, -- height = 40, side = "left", + hide_root_folder = false, preserve_window_proportions = false, number = false, relativenumber = false, signcolumn = "yes", mappings = { custom_only = false, - list = { - - { key = "ff", cb = custom_callback("launch_find_files") }, - { key = "fg", cb = custom_callback("launch_live_grep") }, - }, + -- list = { + -- + -- { key = "ff", cb = custom_callback("launch_find_files") }, + -- { key = "fg", cb = custom_callback("launch_live_grep") }, + -- }, }, }, renderer = { - hide_root_folder = true, + root_folder_label = false, indent_markers = { enable = false, icons = { From 8e13cba2281aa4697b0b5c3188331d7ded737514 Mon Sep 17 00:00:00 2001 From: luokai Date: Tue, 2 May 2023 23:17:09 +0800 Subject: [PATCH 0653/1278] =?UTF-8?q?=E4=BC=98=E5=8C=96=E5=8A=A0=E8=BD=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lua/kide/plugins/lazy-nvim.lua | 30 +++++++++++++++++++++++++++--- 1 file changed, 27 insertions(+), 3 deletions(-) diff --git a/lua/kide/plugins/lazy-nvim.lua b/lua/kide/plugins/lazy-nvim.lua index 75327049..921443ef 100644 --- a/lua/kide/plugins/lazy-nvim.lua +++ b/lua/kide/plugins/lazy-nvim.lua @@ -158,9 +158,33 @@ require("lazy").setup({ init = function() -- 不加载 nvim-jdtls.vim vim.g.nvim_jdtls = 1 - end, - config = function() - require("kide.lsp.java").setup() + vim.api.nvim_create_autocmd({ "BufReadCmd" }, { + pattern = "jdt://*", + callback = function(e) + require("jdtls").open_classfile(e.file) + end, + }) + vim.api.nvim_create_user_command( + "JdtWipeDataAndRestart", + "lua require('jdtls.setup').wipe_data_and_restart()", + {} + ) + vim.api.nvim_create_user_command("JdtShowLogs", "lua require('jdtls.setup').show_logs()", {}) + + local group = vim.api.nvim_create_augroup("kide_jdtls_java", { clear = true }) + vim.api.nvim_create_autocmd({ "FileType" }, { + group = group, + pattern = { "java" }, + desc = "jdtls", + callback = function(e) + if e.file == "java" and vim.bo[e.buf].buftype == "nofile" then + -- ignore + else + require("kide.lsp.java").start() + end + end, + }) + return group end, }, { From df9c7f1f8ef64d96d253e7aee7dcd940f039a6aa Mon Sep 17 00:00:00 2001 From: luokai Date: Wed, 3 May 2023 10:01:42 +0800 Subject: [PATCH 0654/1278] =?UTF-8?q?=E6=9B=BF=E6=8D=A2=E8=BF=87=E6=9C=9F?= =?UTF-8?q?=E5=AD=97=E4=BD=93?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lua/kide/plugins/config/alpha-nvim.lua | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lua/kide/plugins/config/alpha-nvim.lua b/lua/kide/plugins/config/alpha-nvim.lua index 0fb04a6e..bb8293a5 100644 --- a/lua/kide/plugins/config/alpha-nvim.lua +++ b/lua/kide/plugins/config/alpha-nvim.lua @@ -16,16 +16,16 @@ local opt = { noremap = true, silent = true } -- Set menu dashboard.section.buttons.val = { dashboard.button(" ff", " Find File", ":Telescope find_files", opt), - dashboard.button(" fg", " Find Word ", ":Telescope live_grep", opt), + dashboard.button(" fg", "󰈭 Find Word ", ":Telescope live_grep", opt), dashboard.button( " fp", " Recent Projects", ":lua require'telescope'.extensions.project.project{ display_type = 'full' }", opt ), - dashboard.button(" fo", " Recent File", ":Telescope oldfiles", opt), + dashboard.button(" fo", " Recent File", ":Telescope oldfiles", opt), dashboard.button(" ns", " Settings", ":e $MYVIMRC | :cd %:p:h ", opt), - dashboard.button(" q ", " Quit NVIM", ":qa", opt), + dashboard.button(" q ", "󰅚 Quit NVIM", ":qa", opt), } -- Send config to alpha From 78187e225fb7a7a9594218b36aa2107857306a7d Mon Sep 17 00:00:00 2001 From: luokai Date: Wed, 3 May 2023 13:25:12 +0800 Subject: [PATCH 0655/1278] =?UTF-8?q?[]=20=E5=8C=B9=E9=85=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lua/kide/lsp/java.lua | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lua/kide/lsp/java.lua b/lua/kide/lsp/java.lua index 286d9398..4d63c0ab 100644 --- a/lua/kide/lsp/java.lua +++ b/lua/kide/lsp/java.lua @@ -414,10 +414,10 @@ local function markdown_format(input) -- input = string.gsub(input, "[\r\n]( +)(%*)", function (i1) -- return i1 .. "-" -- end) - input = string.gsub(input, "%[([%a%$_]?[%.%w%(%),\\_%s ]*)%]%(file:/[^%)]+%)", function(i1) + input = string.gsub(input, "%[([%a%$_]?[%.%w%(%),\\_%[%]%s ]*)%]%(file:/[^%)]+%)", function(i1) return "`" .. i1 .. "`" end) - input = string.gsub(input, "%[([%a%$_]?[%.%w%(%),\\_%s ]*)%]%(jdt://[^%)]+%)", function(i1) + input = string.gsub(input, "%[([%a%$_]?[%.%w%(%),\\_%[%]%s ]*)%]%(jdt://[^%)]+%)", function(i1) return "`" .. i1 .. "`" end) end From 53e0761cb6409e54b413eab4d80718b85306840e Mon Sep 17 00:00:00 2001 From: luokai Date: Wed, 3 May 2023 15:58:04 +0800 Subject: [PATCH 0656/1278] gdscript --- lua/kide/lsp/gdscript.lua | 6 ++++++ lua/kide/lsp/init.lua | 12 ++++++++++-- lua/kide/lsp/lemminx.lua | 8 +++++--- 3 files changed, 21 insertions(+), 5 deletions(-) create mode 100644 lua/kide/lsp/gdscript.lua diff --git a/lua/kide/lsp/gdscript.lua b/lua/kide/lsp/gdscript.lua new file mode 100644 index 00000000..4767469f --- /dev/null +++ b/lua/kide/lsp/gdscript.lua @@ -0,0 +1,6 @@ +local M = {} +M.setup = function(opt) + require("lspconfig").gdscript.setup(opt) +end + +return M diff --git a/lua/kide/lsp/init.lua b/lua/kide/lsp/init.lua index 4fa289c7..6fd9c826 100644 --- a/lua/kide/lsp/init.lua +++ b/lua/kide/lsp/init.lua @@ -23,6 +23,7 @@ local server_configs = { kotlin_language_server = {}, vuels = {}, lemminx = require("kide.lsp.lemminx"), + gdscript = require("kide.lsp.gdscript"), } -- Setup lspconfig. @@ -69,8 +70,15 @@ require("mason-lspconfig").setup_handlers({ end end, }) -if server_configs.lemminx.setup then - server_configs.lemminx.setup() + +for _, value in pairs(server_configs) do + if value.setup then + value.setup({ + flags = { + debounce_text_changes = 150, + }, + }) + end end -- LSP 相关美化参考 https://github.com/NvChad/NvChad diff --git a/lua/kide/lsp/lemminx.lua b/lua/kide/lsp/lemminx.lua index f8907d23..4483d61c 100644 --- a/lua/kide/lsp/lemminx.lua +++ b/lua/kide/lsp/lemminx.lua @@ -1,7 +1,7 @@ local M = {} local lemminx_home = os.getenv("LEMMINX_HOME") if lemminx_home then - M.setup = function() + M.setup = function(opt) local lspconfig = require("lspconfig") local utils = require("kide.core.utils") @@ -10,7 +10,8 @@ if lemminx_home then table.insert(lemminx_jars, bundle) end vim.fn.join(lemminx_jars, utils.is_win and ";" or ":") - lspconfig["lemminx"].setup({ + + local config = vim.tbl_deep_extend("keep", { cmd = { "java", "-cp", @@ -23,7 +24,8 @@ if lemminx_home then require("nvim-navic").attach(client, buffer) end end, - }) + }, opt) + lspconfig["lemminx"].setup(config) end end From 929247019039d9a3874d1fafdd0a6b5b12ec215c Mon Sep 17 00:00:00 2001 From: luokai Date: Wed, 3 May 2023 16:01:37 +0800 Subject: [PATCH 0657/1278] lsp config --- lua/kide/lsp/init.lua | 8 ++++++++ lua/kide/lsp/lemminx.lua | 6 ------ 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/lua/kide/lsp/init.lua b/lua/kide/lsp/init.lua index 6fd9c826..3025619d 100644 --- a/lua/kide/lsp/init.lua +++ b/lua/kide/lsp/init.lua @@ -77,6 +77,14 @@ for _, value in pairs(server_configs) do flags = { debounce_text_changes = 150, }, + capabilities = capabilities, + on_attach = function(client, buffer) + -- 绑定快捷键 + require("kide.core.keybindings").maplsp(client, buffer) + if client.server_capabilities.documentSymbolProvider then + require("nvim-navic").attach(client, buffer) + end + end, }) end end diff --git a/lua/kide/lsp/lemminx.lua b/lua/kide/lsp/lemminx.lua index 4483d61c..7ccb45d6 100644 --- a/lua/kide/lsp/lemminx.lua +++ b/lua/kide/lsp/lemminx.lua @@ -18,12 +18,6 @@ if lemminx_home then vim.fn.join(lemminx_jars, ":"), "org.eclipse.lemminx.XMLServerLauncher", }, - on_attach = function(client, buffer) - require("kide.core.keybindings").maplsp(client, buffer) - if client.server_capabilities.documentSymbolProvider then - require("nvim-navic").attach(client, buffer) - end - end, }, opt) lspconfig["lemminx"].setup(config) end From 054dc1160f1297dd897e15098909ebbfa7ee2909 Mon Sep 17 00:00:00 2001 From: luokai Date: Wed, 3 May 2023 16:08:40 +0800 Subject: [PATCH 0658/1278] gd expandtab=false --- lua/kide/core/basic.lua | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/lua/kide/core/basic.lua b/lua/kide/core/basic.lua index ebbed11e..946cc0ef 100644 --- a/lua/kide/core/basic.lua +++ b/lua/kide/core/basic.lua @@ -76,6 +76,18 @@ autocmd("FileType", { vim.opt_local.expandtab = true end, }) +autocmd("FileType", { + pattern = { + "gd", + "gdscript", + "gdscript3", + }, + callback = function() + vim.opt_local.tabstop = 4 + vim.opt_local.shiftwidth = 4 + vim.opt_local.expandtab = false + end, +}) -- 新行对齐当前行,空格替代tab vim.opt.expandtab = true From 733bed8160d0cb9fd08418e645c755e63052c699 Mon Sep 17 00:00:00 2001 From: luokai Date: Thu, 4 May 2023 10:39:09 +0800 Subject: [PATCH 0659/1278] update neovim version --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 015f1dbb..04742331 100644 --- a/README.md +++ b/README.md @@ -2,7 +2,7 @@ 可配置 `Java`, `Rust`, `C/C++`, `JavaScript` 等编程语言开发环境。 极速启动 (`startuptime` 20 ~ 70 ms)。 -使用 `neovim v0.8.3`+ 版本。 +使用 `neovim v0.9.0`+ 版本。 ## 安装 From 61f210f530e1addebe35a03daa0817094dd67c7d Mon Sep 17 00:00:00 2001 From: luokai Date: Sun, 7 May 2023 21:27:44 +0800 Subject: [PATCH 0660/1278] Esc noh --- lua/kide/core/keybindings.lua | 1 + 1 file changed, 1 insertion(+) diff --git a/lua/kide/core/keybindings.lua b/lua/kide/core/keybindings.lua index 59f87790..f458f049 100644 --- a/lua/kide/core/keybindings.lua +++ b/lua/kide/core/keybindings.lua @@ -17,6 +17,7 @@ M.setup = function() map("n", "v", '"+p', opt) -- 取消搜索高亮显示 map("n", "", ":nohlsearch", opt) + map("n", "", ":nohlsearch", opt) keymap("n", "", "h", opt) keymap("n", "", "j", opt) From 7763df18fe70e34cdfe375326c1f2d0e48f76fa1 Mon Sep 17 00:00:00 2001 From: luokai Date: Sun, 7 May 2023 22:00:41 +0800 Subject: [PATCH 0661/1278] =?UTF-8?q?=E6=8F=92=E4=BB=B6=E9=85=8D=E7=BD=AE?= =?UTF-8?q?=E6=B8=85=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lua/kide/core/keybindings.lua | 2 +- lua/kide/plugins/lazy-nvim.lua | 51 +++++++--------------------------- 2 files changed, 11 insertions(+), 42 deletions(-) diff --git a/lua/kide/core/keybindings.lua b/lua/kide/core/keybindings.lua index f458f049..f52e7705 100644 --- a/lua/kide/core/keybindings.lua +++ b/lua/kide/core/keybindings.lua @@ -142,7 +142,7 @@ M.maplsp = function(client, buffer) -- mapbuf('n', 'ca', 'lua require("lspsaga.codeaction").code_action()', opt) -- go xx -- mapbuf('n', 'gd', 'lua vim.lsp.buf.definition()', opt) - -- vim.api.nvim_buf_set_keymap(bufnr, 'n', 'gd', 'Trouble lsp_definitions', opt) + vim.api.nvim_buf_set_keymap(buffer, "n", "gD", "lua vim.lsp.buf.declaration()", opt) vim.api.nvim_buf_set_keymap(buffer, "n", "gd", "Telescope lsp_definitions", opt) vim.api.nvim_buf_set_keymap(buffer, "n", "gh", "lua vim.lsp.buf.hover()", opt) vim.api.nvim_buf_set_keymap(buffer, "n", "gs", "lua vim.lsp.buf.signature_help()", opt) diff --git a/lua/kide/plugins/lazy-nvim.lua b/lua/kide/plugins/lazy-nvim.lua index 921443ef..0b968422 100644 --- a/lua/kide/plugins/lazy-nvim.lua +++ b/lua/kide/plugins/lazy-nvim.lua @@ -9,6 +9,9 @@ require("lazy").setup({ { "kyazdani42/nvim-web-devicons", + config = function() + require("nvim-web-devicons").setup({}) + end, lazy = true, }, { @@ -59,7 +62,7 @@ require("lazy").setup({ -- nvim-cmp { "hrsh7th/nvim-cmp", - event = { "InsertEnter" }, + event = { "InsertEnter", "VeryLazy" }, keys = { ":", "/", "?" }, dependencies = { "hrsh7th/cmp-path", @@ -405,7 +408,7 @@ require("lazy").setup({ -- 颜色显示 { "norcalli/nvim-colorizer.lua", - event = { "BufReadPost", "InsertEnter" }, + event = { "BufReadPost", "InsertEnter", "VeryLazy" }, config = function() require("kide.plugins.config.nvim-colorizer") end, @@ -465,7 +468,7 @@ require("lazy").setup({ { "folke/which-key.nvim", lazy = true, - keys = "", + event = { "VeryLazy" }, config = function() require("kide.plugins.config.which-key") end, @@ -513,7 +516,7 @@ require("lazy").setup({ -- () 自动补全 { "windwp/nvim-autopairs", - event = { "InsertEnter" }, + event = { "InsertEnter", "VeryLazy" }, config = function() require("kide.plugins.config.nvim-autopairs") end, @@ -650,7 +653,8 @@ require("lazy").setup({ { "kylechui/nvim-surround", lazy = true, - event = { "InsertEnter" }, + version = "*", + event = { "VeryLazy" }, config = function() require("nvim-surround").setup({}) end, @@ -727,41 +731,6 @@ require("lazy").setup({ require("todo-comments").setup({}) end, }, - { - "denstiny/cmp-dictionary-nanny", - enabled = false, - build = "./install.sh", - config = function() - require("cmp-dictionary-nanny.config").setup({}) - end, - event = { "InsertEnter" }, - }, - { - "JuanZoran/Trans.nvim", - enabled = false, - keys = { - -- 可以换成其他你想映射的键 - { "mm", mode = { "n", "x" }, "Translate", desc = " Translate" }, - { "mk", mode = { "n", "x" }, "TransPlay", desc = " 自动发音" }, - - -- 目前这个功能的视窗还没有做好,可以在配置里将view.i改成hover - { "mi", "TranslateInput", desc = " Translate From Input" }, - }, - dependencies = { "kkharji/sqlite.lua", lazy = true }, - config = function() - require("Trans").setup({ - db_path = "$HOME/.local/share/nvim/data/ultimate.db", - icon = { - star = "", - notfound = " ", - yes = "", - no = "", - cell = "■", - }, - }) - require("kide.theme.gruvbox").load_trans_highlights() - end, - }, { "zbirenbaum/copilot.lua", enabled = config.plugin.copilot.enable, @@ -779,7 +748,7 @@ require("lazy").setup({ enabled = config.plugin.copilot.enable, lazy = true, dependencies = { "zbirenbaum/copilot.lua" }, - event = "InsertEnter", + event = { "InsertEnter", "VeryLazy" }, config = function() require("copilot_cmp").setup() end, From 4d82c85cf5d7df0d107d70da301151b4571775a4 Mon Sep 17 00:00:00 2001 From: luokai Date: Sun, 7 May 2023 22:06:59 +0800 Subject: [PATCH 0662/1278] event VeryLazy --- lua/kide/plugins/lazy-nvim.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lua/kide/plugins/lazy-nvim.lua b/lua/kide/plugins/lazy-nvim.lua index 0b968422..5497abd9 100644 --- a/lua/kide/plugins/lazy-nvim.lua +++ b/lua/kide/plugins/lazy-nvim.lua @@ -17,7 +17,7 @@ require("lazy").setup({ { "williamboman/mason.nvim", lazy = true, - cmd = { "Mason", "MasonInstall", "MasonLog", "MasonUninstall" }, + event = { "VeryLazy" }, config = function() require("kide.plugins.config.mason-nvim") end, From 8cc206f5a39cfb66dad84532a6a660a6538b7bd6 Mon Sep 17 00:00:00 2001 From: luokai Date: Mon, 8 May 2023 20:17:47 +0800 Subject: [PATCH 0663/1278] close_with_q --- lua/kide/core/basic.lua | 41 +++++++++++++++++++++++++++------- lua/kide/plugins/lazy-nvim.lua | 1 + 2 files changed, 34 insertions(+), 8 deletions(-) diff --git a/lua/kide/core/basic.lua b/lua/kide/core/basic.lua index 946cc0ef..562f83c1 100644 --- a/lua/kide/core/basic.lua +++ b/lua/kide/core/basic.lua @@ -136,14 +136,6 @@ vim.opt.mouse = "a" vim.opt.foldlevel = 99 -- Using ufo provider need a large value, feel free to decrease the value vim.opt.foldlevelstart = 99 --- Highlight on yank -vim.api.nvim_create_autocmd({ "TextYankPost" }, { - pattern = { "*" }, - callback = function() - vim.highlight.on_yank() - end, -}) - vim.opt_global.completeopt = "menu,menuone,noselect" if vim.g.neovide then vim.g.neovide_cursor_vfx_mode = "railgun" @@ -166,3 +158,36 @@ autocmd("BufReadPost", { vim.opt_global.grepprg = "rg --vimgrep --no-heading --smart-case" vim.opt_global.grepformat = "%f:%l:%c:%m,%f:%l:%m" + +--- see https://github.com/LazyVim/LazyVim/blob/main/lua/lazyvim/config/autocmds.lua +local function augroup(name) + return vim.api.nvim_create_augroup("kide" .. name, { clear = true }) +end +-- Highlight on yank +autocmd({ "TextYankPost" }, { + group = augroup("highlight_yank"), + callback = function() + vim.highlight.on_yank() + end, +}) + +-- close some filetypes with +autocmd("FileType", { + group = augroup("close_with_q"), + pattern = { + "PlenaryTestPopup", + "help", + "lspinfo", + "man", + "notify", + "qf", + "spectre_panel", + "startuptime", + "tsplayground", + "checkhealth", + }, + callback = function(event) + vim.bo[event.buf].buflisted = false + vim.keymap.set("n", "q", "close", { buffer = event.buf, silent = true }) + end, +}) diff --git a/lua/kide/plugins/lazy-nvim.lua b/lua/kide/plugins/lazy-nvim.lua index 5497abd9..665df275 100644 --- a/lua/kide/plugins/lazy-nvim.lua +++ b/lua/kide/plugins/lazy-nvim.lua @@ -427,6 +427,7 @@ require("lazy").setup({ { "danymat/neogen", lazy = true, + event = { "VeryLazy" }, config = function() require("kide.plugins.config.neogen") end, From 2b95004a66cd7e57c96b502d5954a8d3194d8f43 Mon Sep 17 00:00:00 2001 From: luokai Date: Mon, 8 May 2023 20:48:41 +0800 Subject: [PATCH 0664/1278] dap-python --- lua/kide/config.lua | 3 +++ lua/kide/lsp/pyright.lua | 12 +++++++++++- lua/kide/plugins/lazy-nvim.lua | 10 ++++++++++ 3 files changed, 24 insertions(+), 1 deletion(-) diff --git a/lua/kide/config.lua b/lua/kide/config.lua index 5631f65b..ecf905e2 100644 --- a/lua/kide/config.lua +++ b/lua/kide/config.lua @@ -1,4 +1,7 @@ local M = { + env = { + py_bin = os.getenv("py_bin") or "/usr/bin/python3", + }, plugin = { copilot = { enable = os.getenv("copilot_enable") or false, diff --git a/lua/kide/lsp/pyright.lua b/lua/kide/lsp/pyright.lua index a5647075..711bab84 100644 --- a/lua/kide/lsp/pyright.lua +++ b/lua/kide/lsp/pyright.lua @@ -1 +1,11 @@ -return {} +return { + server = { + on_attach = function(_, bufnr) + local dap_py = require("dap-python") + local opts = { silent = true, buffer = bufnr } + vim.keymap.set("n", "dc", dap_py.test_class, opts) + vim.keymap.set("n", "dm", dap_py.test_method, opts) + vim.keymap.set("v", "ds", dap_py.debug_selection, opts) + end, + }, +} diff --git a/lua/kide/plugins/lazy-nvim.lua b/lua/kide/plugins/lazy-nvim.lua index 665df275..a4ecd6b4 100644 --- a/lua/kide/plugins/lazy-nvim.lua +++ b/lua/kide/plugins/lazy-nvim.lua @@ -237,6 +237,16 @@ require("lazy").setup({ end, }, + { + "mfussenegger/nvim-dap-python", + lazy = true, + ft = "java", + dependencies = { "mfussenegger/nvim-dap" }, + config = function() + require("dap-python").setup(config.env.py_bin) + end, + }, + -- 搜索插件 { "nvim-telescope/telescope.nvim", From ab03ba4234eafe4281167041c6874db7060d87c2 Mon Sep 17 00:00:00 2001 From: luokai Date: Tue, 9 May 2023 18:15:11 +0800 Subject: [PATCH 0665/1278] toggleterm --- lua/kide/config.lua | 4 ++-- lua/kide/core/basic.lua | 12 ++++++++++++ lua/kide/core/keybindings.lua | 4 ++++ lua/kide/plugins/lazy-nvim.lua | 3 ++- 4 files changed, 20 insertions(+), 3 deletions(-) diff --git a/lua/kide/config.lua b/lua/kide/config.lua index ecf905e2..2a8fb60e 100644 --- a/lua/kide/config.lua +++ b/lua/kide/config.lua @@ -1,10 +1,10 @@ local M = { env = { - py_bin = os.getenv("py_bin") or "/usr/bin/python3", + py_bin = os.getenv("PY_BIN") or "/usr/bin/python3", }, plugin = { copilot = { - enable = os.getenv("copilot_enable") or false, + enable = os.getenv("COPILOT_ENABLE") or false, }, }, } diff --git a/lua/kide/core/basic.lua b/lua/kide/core/basic.lua index 562f83c1..6b076ac5 100644 --- a/lua/kide/core/basic.lua +++ b/lua/kide/core/basic.lua @@ -191,3 +191,15 @@ autocmd("FileType", { vim.keymap.set("n", "q", "close", { buffer = event.buf, silent = true }) end, }) + +-- toggle_term +autocmd("FileType", { + group = augroup("toggle_term"), + pattern = { + "toggleterm", + }, + callback = function(event) + vim.bo[event.buf].buflisted = false + vim.keymap.set("n", "tt", ":ToggleTerm", { buffer = event.buf, silent = true }) + end, +}) diff --git a/lua/kide/core/keybindings.lua b/lua/kide/core/keybindings.lua index f52e7705..f922e4be 100644 --- a/lua/kide/core/keybindings.lua +++ b/lua/kide/core/keybindings.lua @@ -44,6 +44,10 @@ M.setup = function() -- ToggleTerm map("n", "", ":ToggleTerm", opt) + map("t", "", ":ToggleTerm", opt) + map("n", "tt", ":ToggleTerm", opt) + map("v", "tt", ":ToggleTermSendVisualSelection", opt) + map("t", "tt", ":ToggleTerm", opt) -- symbols-outline.nvim map("n", "o", ":SymbolsOutline", opt) diff --git a/lua/kide/plugins/lazy-nvim.lua b/lua/kide/plugins/lazy-nvim.lua index a4ecd6b4..743019ff 100644 --- a/lua/kide/plugins/lazy-nvim.lua +++ b/lua/kide/plugins/lazy-nvim.lua @@ -181,7 +181,7 @@ require("lazy").setup({ desc = "jdtls", callback = function(e) if e.file == "java" and vim.bo[e.buf].buftype == "nofile" then - -- ignore + -- ignore else require("kide.lsp.java").start() end @@ -331,6 +331,7 @@ require("lazy").setup({ { "akinsho/toggleterm.nvim", lazy = true, + version = "*", cmd = { "ToggleTerm" }, config = function() require("toggleterm").setup({ From 0d94a9e1bd76325a71c5aeeaf6bb7bea5ccfeba3 Mon Sep 17 00:00:00 2001 From: luokai Date: Wed, 10 May 2023 18:06:42 +0800 Subject: [PATCH 0666/1278] =?UTF-8?q?=E4=B8=8D=E4=B9=A0=E6=83=AFjk?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lua/kide/core/keybindings.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lua/kide/core/keybindings.lua b/lua/kide/core/keybindings.lua index f922e4be..ac4e6daa 100644 --- a/lua/kide/core/keybindings.lua +++ b/lua/kide/core/keybindings.lua @@ -40,7 +40,7 @@ M.setup = function() -- " 退出 terminal 模式 map("t", "", "", opt) - map("t", "jk", "", opt) + -- map("t", "jk", "", opt) -- ToggleTerm map("n", "", ":ToggleTerm", opt) From e417dea45dde85caff7ab2e7d9965637b6f50702 Mon Sep 17 00:00:00 2001 From: luokai Date: Wed, 10 May 2023 21:01:13 +0800 Subject: [PATCH 0667/1278] lspkind_symbol_map --- lua/kide/lsp/lsp_ui.lua | 66 ++++++++++++++-------------- lua/kide/plugins/config/nvim-cmp.lua | 6 --- lua/kide/plugins/lazy-nvim.lua | 10 +++++ 3 files changed, 44 insertions(+), 38 deletions(-) diff --git a/lua/kide/lsp/lsp_ui.lua b/lua/kide/lsp/lsp_ui.lua index 6d09b2bf..66e55022 100644 --- a/lua/kide/lsp/lsp_ui.lua +++ b/lua/kide/lsp/lsp_ui.lua @@ -1,42 +1,44 @@ local M = {} +local lspkind_symbol_map = require("lspkind").symbol_map + -- remove obsolete TS* highlight groups https://github.com/nvim-treesitter/nvim-treesitter/pull/3656 M.symbol_map = { - Text = { icon = "" }, - Method = { icon = "", hl = "@method" }, - Function = { icon = "", hl = "@function" }, - Constructor = { icon = "", hl = "@constructor" }, - Field = { icon = "ﰠ", hl = "@field" }, - Variable = { icon = "", hl = "@constant" }, - Class = { icon = "ﴯ", hl = "@type" }, - Interface = { icon = "", hl = "@type" }, - Module = { icon = "", hl = "@namespace" }, - Property = { icon = "ﰠ", hl = "@method" }, - Unit = { icon = "塞" }, - Value = { icon = "" }, - Enum = { icon = "", hl = "TSType" }, - Keyword = { icon = "" }, - Snippet = { icon = "" }, - Color = { icon = "" }, - File = { icon = "", hl = "@text.uri" }, - Reference = { icon = "" }, - Folder = { icon = "" }, - EnumMember = { icon = "", hl = "@field" }, - Constant = { icon = "", hl = "@constant" }, - Struct = { icon = "פּ", hl = "@type" }, - Event = { icon = "", hl = "@type" }, - Operator = { icon = "", hl = "@operator" }, + Text = { icon = lspkind_symbol_map.Text }, + Method = { icon = lspkind_symbol_map.Method, hl = "@method" }, + Function = { icon = lspkind_symbol_map.Function, hl = "@function" }, + Constructor = { icon = lspkind_symbol_map.Constructor, hl = "@constructor" }, + Field = { icon = lspkind_symbol_map.Field, hl = "@field" }, + Variable = { icon = lspkind_symbol_map.Variable, hl = "@constant" }, + Class = { icon = lspkind_symbol_map.Class, hl = "@type" }, + Interface = { icon = lspkind_symbol_map.Interface, hl = "@type" }, + Module = { icon = lspkind_symbol_map.Module, hl = "@namespace" }, + Property = { icon = lspkind_symbol_map.Property, hl = "@method" }, + Unit = { icon = lspkind_symbol_map.Unit }, + Value = { icon = lspkind_symbol_map.Value }, + Enum = { icon = lspkind_symbol_map.Enum, hl = "TSType" }, + Keyword = { icon = lspkind_symbol_map.Keyword }, + Snippet = { icon = lspkind_symbol_map.Snippet }, + Color = { icon = lspkind_symbol_map.Color }, + File = { icon = lspkind_symbol_map.File, hl = "@text.uri" }, + Reference = { icon = lspkind_symbol_map.Reference }, + Folder = { icon = lspkind_symbol_map.Folder }, + EnumMember = { icon = lspkind_symbol_map.EnumMember, hl = "@field" }, + Constant = { icon = lspkind_symbol_map.Constant, hl = "@constant" }, + Struct = { icon = lspkind_symbol_map.Struct, hl = "@type" }, + Event = { icon = lspkind_symbol_map.Event, hl = "@type" }, + Operator = { icon = lspkind_symbol_map.Operator, hl = "@operator" }, TypeParameter = { icon = "", hl = "@parameter" }, --------------------------------------------------------- Namespace = { icon = "", hl = "@namespace" }, Package = { icon = "", hl = "@namespace" }, - String = { icon = "", hl = "@string" }, + String = { icon = "", hl = "@string" }, Number = { icon = "", hl = "@number" }, - Boolean = { icon = "", hl = "@boolean" }, + Boolean = { icon = "", hl = "@boolean" }, Array = { icon = "", hl = "@constant" }, Object = { icon = "", hl = "@type" }, - Key = { icon = "", hl = "@type" }, - Null = { icon = "ﳠ", hl = "@type" }, + Key = { icon = "󰌋", hl = "@type" }, + Null = { icon = "󰟢", hl = "@type" }, Component = { icon = "", hl = "@function" }, Fragment = { icon = "", hl = "@constant" }, } @@ -62,10 +64,10 @@ M.signs = { M.diagnostics = { icons = { - hint = "", - info = "", - warning = "", - error = "", + hint = "󰌶", + info = "", + warning = "", + error = "", }, } return M diff --git a/lua/kide/plugins/config/nvim-cmp.lua b/lua/kide/plugins/config/nvim-cmp.lua index 57a24f84..1f714a5e 100644 --- a/lua/kide/plugins/config/nvim-cmp.lua +++ b/lua/kide/plugins/config/nvim-cmp.lua @@ -1,11 +1,5 @@ local lspkind = require("lspkind") local cmp = require("cmp") -lspkind.init({ - symbol_map = { - Copilot = "", - }, -}) -vim.api.nvim_set_hl(0, "CmpItemKindCopilot", { fg = "#6CC644" }) cmp.setup({ -- 指定 snippet 引擎 snippet = { diff --git a/lua/kide/plugins/lazy-nvim.lua b/lua/kide/plugins/lazy-nvim.lua index 743019ff..53038992 100644 --- a/lua/kide/plugins/lazy-nvim.lua +++ b/lua/kide/plugins/lazy-nvim.lua @@ -58,6 +58,16 @@ require("lazy").setup({ { "onsails/lspkind-nvim", lazy = true, + event = { "VeryLazy" }, + config = function() + require("lspkind").init({ + -- preset = "codicons", + symbol_map = { + Copilot = "", + }, + }) + vim.api.nvim_set_hl(0, "CmpItemKindCopilot", { fg = "#6CC644" }) + end, }, -- nvim-cmp { From 5b1a9ca29984ba781e181b3e5c0c6161bf49201b Mon Sep 17 00:00:00 2001 From: luokai Date: Wed, 10 May 2023 21:21:12 +0800 Subject: [PATCH 0668/1278] gitsigns-nvim --- lua/kide/plugins/config/gitsigns-nvim.lua | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lua/kide/plugins/config/gitsigns-nvim.lua b/lua/kide/plugins/config/gitsigns-nvim.lua index 78687bc5..b2d37183 100644 --- a/lua/kide/plugins/config/gitsigns-nvim.lua +++ b/lua/kide/plugins/config/gitsigns-nvim.lua @@ -1,10 +1,10 @@ require("gitsigns").setup({ signs = { - add = { hl = "DiffAdd", text = "│", numhl = "GitSignsAddNr" }, + add = { hl = "DiffAdd", text = "", numhl = "GitSignsAddNr" }, change = { hl = "DiffChange", text = "│", numhl = "GitSignsChangeNr" }, - delete = { hl = "DiffDelete", text = "", numhl = "GitSignsDeleteNr" }, + delete = { hl = "DiffDelete", text = "", numhl = "GitSignsDeleteNr" }, topdelete = { hl = "DiffDelete", text = "‾", numhl = "GitSignsDeleteNr" }, - changedelete = { hl = "DiffChangeDelete", text = "~", numhl = "GitSignsChangeNr" }, + changedelete = { hl = "GitSignsChangedelete", text = "", numhl = "GitSignsChangedeleteNr" }, untracked = { hl = "GitSignsAdd", text = "│", numhl = "GitSignsAddNr", linehl = "GitSignsAddLn" }, }, signcolumn = true, -- Toggle with `:Gitsigns toggle_signs` From da0b45a6150ee4fa2bd1d7f8e77f89c63d1f0411 Mon Sep 17 00:00:00 2001 From: luokai Date: Wed, 10 May 2023 21:23:17 +0800 Subject: [PATCH 0669/1278] fmt --- lua/kide/lsp/lsp_ui.lua | 1 - 1 file changed, 1 deletion(-) diff --git a/lua/kide/lsp/lsp_ui.lua b/lua/kide/lsp/lsp_ui.lua index 66e55022..4f75a5b6 100644 --- a/lua/kide/lsp/lsp_ui.lua +++ b/lua/kide/lsp/lsp_ui.lua @@ -1,7 +1,6 @@ local M = {} local lspkind_symbol_map = require("lspkind").symbol_map - -- remove obsolete TS* highlight groups https://github.com/nvim-treesitter/nvim-treesitter/pull/3656 M.symbol_map = { Text = { icon = lspkind_symbol_map.Text }, From 14016941e89f734c25e93c4bebc22674954e6095 Mon Sep 17 00:00:00 2001 From: luokai Date: Wed, 10 May 2023 21:35:44 +0800 Subject: [PATCH 0670/1278] diagnostics icon --- lua/kide/lsp/lsp_ui.lua | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/lua/kide/lsp/lsp_ui.lua b/lua/kide/lsp/lsp_ui.lua index 4f75a5b6..434fd88f 100644 --- a/lua/kide/lsp/lsp_ui.lua +++ b/lua/kide/lsp/lsp_ui.lua @@ -63,10 +63,10 @@ M.signs = { M.diagnostics = { icons = { - hint = "󰌶", - info = "", - warning = "", - error = "", + hint = "", + info = "", + warning = "", + error = "", }, } return M From 2c98d764fde8018dd4583b855d5c174ac842dcd8 Mon Sep 17 00:00:00 2001 From: luokai Date: Wed, 10 May 2023 21:42:40 +0800 Subject: [PATCH 0671/1278] alpha icon --- lua/kide/plugins/config/alpha-nvim.lua | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lua/kide/plugins/config/alpha-nvim.lua b/lua/kide/plugins/config/alpha-nvim.lua index bb8293a5..a86b67ff 100644 --- a/lua/kide/plugins/config/alpha-nvim.lua +++ b/lua/kide/plugins/config/alpha-nvim.lua @@ -15,17 +15,17 @@ dashboard.section.header.val = { local opt = { noremap = true, silent = true } -- Set menu dashboard.section.buttons.val = { - dashboard.button(" ff", " Find File", ":Telescope find_files", opt), + dashboard.button(" ff", "󰈞 Find File", ":Telescope find_files", opt), dashboard.button(" fg", "󰈭 Find Word ", ":Telescope live_grep", opt), dashboard.button( " fp", - " Recent Projects", + " Recent Projects", ":lua require'telescope'.extensions.project.project{ display_type = 'full' }", opt ), dashboard.button(" fo", " Recent File", ":Telescope oldfiles", opt), dashboard.button(" ns", " Settings", ":e $MYVIMRC | :cd %:p:h ", opt), - dashboard.button(" q ", "󰅚 Quit NVIM", ":qa", opt), + dashboard.button(" q ", "󰅙 Quit NVIM", ":qa", opt), } -- Send config to alpha From 57f70af6a6de7afa47137e025accfe9dfb11cff9 Mon Sep 17 00:00:00 2001 From: luokai Date: Wed, 10 May 2023 22:11:19 +0800 Subject: [PATCH 0672/1278] colorscheme --- lua/kide/plugins/lazy-nvim.lua | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/lua/kide/plugins/lazy-nvim.lua b/lua/kide/plugins/lazy-nvim.lua index 53038992..41e15c8b 100644 --- a/lua/kide/plugins/lazy-nvim.lua +++ b/lua/kide/plugins/lazy-nvim.lua @@ -117,13 +117,27 @@ require("lazy").setup({ -- use 'morhetz/gruvbox' { "ellisonleao/gruvbox.nvim", + enabled = true, lazy = false, priority = 1000, config = function() require("kide.plugins.config.gruvbox") end, }, - -- use 'sainnhe/gruvbox-material' + { + "sainnhe/gruvbox-material", + enabled = false, + lazy = false, + priority = 1000, + config = function() + -- require("kide.plugins.config.gruvbox") + + vim.opt.background = "dark" + vim.g.gruvbox_material_background = "hard" + vim.g.gruvbox_material_better_performance = true + vim.cmd([[colorscheme gruvbox-material]]) + end, + }, -- 文件管理 { @@ -140,7 +154,6 @@ require("lazy").setup({ { "akinsho/bufferline.nvim", version = "*", - dependencies = { "ellisonleao/gruvbox.nvim" }, requires = "kyazdani42/nvim-web-devicons", config = function() require("kide.plugins.config.bufferline") @@ -151,7 +164,6 @@ require("lazy").setup({ { "nvim-treesitter/nvim-treesitter", event = { "BufNewFile", "BufReadPost" }, - dependencies = { "ellisonleao/gruvbox.nvim" }, build = ":TSUpdate", config = function() require("kide.plugins.config.nvim-treesitter") @@ -261,7 +273,6 @@ require("lazy").setup({ { "nvim-telescope/telescope.nvim", lazy = true, - dependencies = { "ellisonleao/gruvbox.nvim" }, event = { "VeryLazy" }, cmd = { "Telescope" }, keys = { "" }, @@ -379,7 +390,6 @@ require("lazy").setup({ -- 状态栏插件 { "nvim-lualine/lualine.nvim", - dependencies = { "ellisonleao/gruvbox.nvim" }, config = function() require("kide.plugins.config.lualine") end, From 2aa948b4e13df5ea7762559c195491a889a3b857 Mon Sep 17 00:00:00 2001 From: luokai Date: Wed, 10 May 2023 22:11:49 +0800 Subject: [PATCH 0673/1278] bufferline --- lua/kide/plugins/config/bufferline.lua | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lua/kide/plugins/config/bufferline.lua b/lua/kide/plugins/config/bufferline.lua index 937c8895..ef1c4fc6 100644 --- a/lua/kide/plugins/config/bufferline.lua +++ b/lua/kide/plugins/config/bufferline.lua @@ -5,7 +5,7 @@ require("bufferline").setup({ diagnostics_indicator = function(count, level, diagnostics_dict, context) local s = " " for e, n in pairs(diagnostics_dict) do - local sym = e == "error" and " " or (e == "warning" and " " or "") + local sym = e == "error" and " " or (e == "warning" and " " or " ") s = s .. n .. sym end return s @@ -78,6 +78,6 @@ require("bufferline").setup({ show_close_icon = false, show_tab_indicators = true, -- separator_style = "slant" | "thick" | "thin" | { 'any', 'any' }, - separator_style = "slant", + -- separator_style = "slant", }, }) From 0ad78c5d7eccc03960085ba550046cee0a2a8a33 Mon Sep 17 00:00:00 2001 From: luokai Date: Wed, 10 May 2023 22:55:47 +0800 Subject: [PATCH 0674/1278] =?UTF-8?q?=E5=A4=9A=E7=89=88=E6=9C=AC=E9=97=AE?= =?UTF-8?q?=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lua/kide/core/vscode/init.lua | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lua/kide/core/vscode/init.lua b/lua/kide/core/vscode/init.lua index 1000037f..070f74cd 100644 --- a/lua/kide/core/vscode/init.lua +++ b/lua/kide/core/vscode/init.lua @@ -10,7 +10,8 @@ M.find_one = function(extension_path) local v = vim.fn.glob(M.get_vscode_extensions() .. extension_path) if v and v ~= "" then if type(v) == "string" then - return vim.split(v, "\n")[1] + local pt = vim.split(v, "\n") + return pt[#pt] elseif type(v) == "table" then return v[1] end From 097a25c1a3ee029212cab8ed4181cd1719248e8c Mon Sep 17 00:00:00 2001 From: luokai Date: Thu, 11 May 2023 09:21:57 +0800 Subject: [PATCH 0675/1278] =?UTF-8?q?=E4=BD=BF=E7=94=A8=20jdtls=20?= =?UTF-8?q?=E8=84=9A=E6=9C=AC=E5=90=AF=E5=8A=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lua/kide/lsp/java.lua | 60 ++++++------------------------------------- 1 file changed, 8 insertions(+), 52 deletions(-) diff --git a/lua/kide/lsp/java.lua b/lua/kide/lsp/java.lua index 4d63c0ab..45289fd7 100644 --- a/lua/kide/lsp/java.lua +++ b/lua/kide/lsp/java.lua @@ -1,5 +1,4 @@ local M = {} -local cutils = require("kide.core.utils") local env = { HOME = vim.loop.os_homedir(), JAVA_HOME = os.getenv("JAVA_HOME"), @@ -24,13 +23,6 @@ end local function get_java_ver_sources(v, dv) return os.getenv("JAVA_" .. v .. "_SOURCES") or dv end -local function get_java_ver_doc(v, dv) - return os.getenv("JAVA_" .. v .. "_DOC") or dv -end - -local function get_java() - return or_default(env.JDTLS_RUN_JAVA, get_java_home() .. "/bin/java") -end local function get_jdtls_workspace() return or_default(env.JDTLS_WORKSPACE, env.HOME .. "/jdtls-workspace/") @@ -45,16 +37,6 @@ local function get_jol_jar() return env.JOL_JAR or "/opt/software/java/jol-cli-0.16-full.jar" end -local _config = (function() - if cutils.is_win then - return "config_win" - elseif cutils.is_mac then - return "config_mac" - else - return "config_linux" - end -end)() - -- see https://github.com/eclipse/eclipse.jdt.ls/wiki/Running-the-JAVA-LS-server-from-the-command-line#initialize-request local ExecutionEnvironment = { J2SE_1_5 = "J2SE-1.5", @@ -121,9 +103,8 @@ local function get_jdtls_path() end local jdtls_path = get_jdtls_path() -local jdtls_launcher = vim.fn.glob(jdtls_path .. "/plugins/org.eclipse.equinox.launcher_*.jar") +local jdtls_launcher = vim.fn.glob(jdtls_path .. "/bin/jdtls") -local jdtls_config = vim.fn.glob(jdtls_path .. "/" .. _config) local bundles = {} -- This bundles definition is the same as in the previous section (java-debug installation) @@ -173,39 +154,14 @@ local config = { -- The command that starts the language server -- See: https://github.com/eclipse/eclipse.jdt.ls#running-from-the-command-line cmd = { - get_java(), -- or '/path/to/java11_or_newer/bin/java' - "-Declipse.application=org.eclipse.jdt.ls.core.id1", - "-Dosgi.bundles.defaultStartLevel=4", - "-Declipse.product=org.eclipse.jdt.ls.core.product", - -- "-Dosgi.configuration.cascaded=true", - -- "-Dosgi.sharedConfiguration.area=" .. get_jdtls_home() .. "/config_mac", - -- "-Dosgi.sharedConfiguration.area.readOnly=true", - "-Dlog.protocol=true", - "-Dlog.level=ALL", - "-Dsun.zip.disableMemoryMapping=true", - -- "-Djava.util.concurrent.ForkJoinPool.common.parallelism=16", - -- "-noverify", - -- '-XX:+UseParallelGC', - -- '-XX:GCTimeRatio=4', - -- '-XX:AdaptiveSizePolicyWeight=90', - -- '-XX:+UseG1GC', - -- '-XX:+UseStringDeduplication', - -- '-Xms512m', - "-XX:+UseZGC", - "-Xmx1g", - -- "-Xbootclasspath/a:" .. get_lombok_jar(), - "-javaagent:" .. get_lombok_jar(), - "--add-modules=ALL-SYSTEM", - "--add-opens", - "java.base/java.util=ALL-UNNAMED", - "--add-opens", - "java.base/java.lang=ALL-UNNAMED", - "-jar", jdtls_launcher, - "-configuration", - jdtls_config, - "-data", - workspace_dir, + "--jvm-arg=-Dlog.protocol=true", + "--jvm-arg=-Dlog.level=ALL", + "--jvm-arg=-Dsun.zip.disableMemoryMapping=true", + "--jvm-arg=" .. "-javaagent:" .. get_lombok_jar(), + "--jvm-arg=" .. "-XX:+UseZGC", + "--jvm-arg=" .. "-Xmx1g", + "-data=" .. workspace_dir, }, filetypes = { "java" }, From c9a51ba0ea38d20114d02f7a109ad294e1e30f7f Mon Sep 17 00:00:00 2001 From: luokai Date: Fri, 12 May 2023 21:08:22 +0800 Subject: [PATCH 0676/1278] git q close --- lua/kide/core/basic.lua | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/lua/kide/core/basic.lua b/lua/kide/core/basic.lua index 6b076ac5..72ad3f44 100644 --- a/lua/kide/core/basic.lua +++ b/lua/kide/core/basic.lua @@ -185,6 +185,9 @@ autocmd("FileType", { "startuptime", "tsplayground", "checkhealth", + "fugitive", + "gitcommit", + "git", }, callback = function(event) vim.bo[event.buf].buflisted = false @@ -192,6 +195,15 @@ autocmd("FileType", { end, }) +autocmd({ "BufReadCmd" }, { + group = augroup("git_close_with_q"), + pattern = "fugitive://*", + callback = function(event) + vim.bo[event.buf].buflisted = false + vim.keymap.set("n", "q", "close", { buffer = event.buf, silent = true }) + end, +}) + -- toggle_term autocmd("FileType", { group = augroup("toggle_term"), From c21385490d0833aff83e7cfe6e9df6cd6691861e Mon Sep 17 00:00:00 2001 From: luokai Date: Sun, 14 May 2023 12:04:12 +0800 Subject: [PATCH 0677/1278] font --- lua/kide/plugins/config/pandoc.lua | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lua/kide/plugins/config/pandoc.lua b/lua/kide/plugins/config/pandoc.lua index d613b2ff..2d5b1256 100644 --- a/lua/kide/plugins/config/pandoc.lua +++ b/lua/kide/plugins/config/pandoc.lua @@ -31,6 +31,8 @@ local function markdown_to_pdf() { "--toc" }, { "--variable", "CJKmainfont=" .. cjk_mainfont() }, { "--variable", "mainfont=Hack" }, + { "--variable", "sansfont=Hack" }, + { "--variable", "monofont=Hack" }, { "--variable", "geometry:top=2cm, bottom=1.5cm, left=2cm, right=2cm" }, }) end, { From 84e303f290f8d45feb8edf58a668578de11269b0 Mon Sep 17 00:00:00 2001 From: luokai Date: Sun, 14 May 2023 12:11:27 +0800 Subject: [PATCH 0678/1278] pandoc --- lua/kide/core/init.lua | 1 + lua/kide/core/utils/pandoc.lua | 44 ++++++++++++++++++++++++++++++ lua/kide/lsp/java.lua | 1 - lua/kide/plugins/config/pandoc.lua | 39 -------------------------- 4 files changed, 45 insertions(+), 40 deletions(-) create mode 100644 lua/kide/core/utils/pandoc.lua diff --git a/lua/kide/core/init.lua b/lua/kide/core/init.lua index 45806a9c..ff1ebaad 100644 --- a/lua/kide/core/init.lua +++ b/lua/kide/core/init.lua @@ -4,4 +4,5 @@ vim.schedule(function() require("kide.core.utils.plantuml").setup() require("kide.core.utils.maven").setup() require("kide.core.utils.jdtls").setup() + require("kide.core.utils.pandoc").setup() end) diff --git a/lua/kide/core/utils/pandoc.lua b/lua/kide/core/utils/pandoc.lua new file mode 100644 index 00000000..e8ccaee8 --- /dev/null +++ b/lua/kide/core/utils/pandoc.lua @@ -0,0 +1,44 @@ +local utils = require("kide.core.utils") +local M = {} +local cjk_mainfont = function() + if utils.is_win then + return "Microsoft YaHei UI" + elseif utils.is_linux then + return "Noto Sans CJK SC" + else + return "Yuanti SC" + end +end + +-- pandoc --pdf-engine=xelatex --highlight-style tango -N --toc -V CJKmainfont="Yuanti SC" -V mainfont="Hack" -V geometry:"top=2cm, bottom=1.5cm, left=2cm, right=2cm" test.md -o out.pdf +M.markdown_to_pdf = function() + local group = vim.api.nvim_create_augroup("kide_utils_pandoc", { clear = true }) + vim.api.nvim_create_autocmd({ "FileType" }, { + group = group, + pattern = { "markdown" }, + desc = "Markdown to PDF", + callback = function(o) + vim.api.nvim_buf_create_user_command(o.buf, "PandocMdToPdf", function(_) + require("pandoc.render").file({ + { "--pdf-engine", "xelatex" }, + { "--highlight-style", "tango" }, + { "--number-sections" }, + { "--toc" }, + { "--variable", "CJKmainfont=" .. cjk_mainfont() }, + { "--variable", "mainfont=Hack" }, + { "--variable", "sansfont=Hack" }, + { "--variable", "monofont=Hack" }, + { "--variable", "geometry:top=2cm, bottom=1.5cm, left=2cm, right=2cm" }, + }) + end, { + nargs = "*", + complete = require("pandoc.utils").complete, + }) + end, + }) +end + +M.setup = function() + M.markdown_to_pdf() +end +return M diff --git a/lua/kide/lsp/java.lua b/lua/kide/lsp/java.lua index 45289fd7..fbdf7acd 100644 --- a/lua/kide/lsp/java.lua +++ b/lua/kide/lsp/java.lua @@ -105,7 +105,6 @@ local jdtls_path = get_jdtls_path() local jdtls_launcher = vim.fn.glob(jdtls_path .. "/bin/jdtls") - local bundles = {} -- This bundles definition is the same as in the previous section (java-debug installation) local vscode_java_debug_path = vscode.find_one("/vscjava.vscode-java-debug-*/server") diff --git a/lua/kide/plugins/config/pandoc.lua b/lua/kide/plugins/config/pandoc.lua index 2d5b1256..e22bbfca 100644 --- a/lua/kide/plugins/config/pandoc.lua +++ b/lua/kide/plugins/config/pandoc.lua @@ -5,45 +5,6 @@ require("pandoc").setup({ }, }) -local cjk_mainfont = function() - if utils.is_win then - return "Microsoft YaHei UI" - elseif utils.is_linux then - return "Noto Sans CJK SC" - else - return "Yuanti SC" - end -end - --- pandoc --pdf-engine=xelatex --highlight-style tango -N --toc -V CJKmainfont="Yuanti SC" -V mainfont="Hack" -V geometry:"top=2cm, bottom=1.5cm, left=2cm, right=2cm" test.md -o out.pdf -local function markdown_to_pdf() - local group = vim.api.nvim_create_augroup("kide_utils_pandoc", { clear = true }) - vim.api.nvim_create_autocmd({ "FileType" }, { - group = group, - pattern = { "markdown" }, - desc = "Markdown to PDF", - callback = function(o) - vim.api.nvim_buf_create_user_command(o.buf, "PandocMdToPdf", function(_) - require("pandoc.render").file({ - { "--pdf-engine", "xelatex" }, - { "--highlight-style", "tango" }, - { "--number-sections" }, - { "--toc" }, - { "--variable", "CJKmainfont=" .. cjk_mainfont() }, - { "--variable", "mainfont=Hack" }, - { "--variable", "sansfont=Hack" }, - { "--variable", "monofont=Hack" }, - { "--variable", "geometry:top=2cm, bottom=1.5cm, left=2cm, right=2cm" }, - }) - end, { - nargs = "*", - complete = require("pandoc.utils").complete, - }) - end, - }) -end -markdown_to_pdf() - local uv = vim.loop require("pandoc.process").spawn = function(bin, args, callback) local stdout = uv.new_pipe(false) From 40b2b8a15f8874bb80f4b5fd60428d0d50afff34 Mon Sep 17 00:00:00 2001 From: luokai Date: Sun, 14 May 2023 19:31:31 +0800 Subject: [PATCH 0679/1278] telescope --- lua/kide/plugins/config/telescope.lua | 34 +++++++------------ lua/kide/theme/gruvbox.lua | 48 --------------------------- 2 files changed, 12 insertions(+), 70 deletions(-) diff --git a/lua/kide/plugins/config/telescope.lua b/lua/kide/plugins/config/telescope.lua index 0285c399..99bd5aea 100644 --- a/lua/kide/plugins/config/telescope.lua +++ b/lua/kide/plugins/config/telescope.lua @@ -27,16 +27,16 @@ end telescope.setup({ defaults = { - -- vimgrep_arguments = { - -- "rg", - -- "--color=never", - -- "--no-heading", - -- "--with-filename", - -- "--line-number", - -- "--column", - -- "--smart-case", - -- }, - -- prompt_prefix = "  ", + vimgrep_arguments = { + "rg", + "-L", + "--color=never", + "--no-heading", + "--with-filename", + "--line-number", + "--column", + "--smart-case", + }, prompt_prefix = "  ", selection_caret = " ", entry_prefix = " ", @@ -59,20 +59,10 @@ telescope.setup({ }, winblend = 0, -- border = {}, - -- borderchars = { "─", "│", "─", "│", "╭", "╮", "╯", "╰" }, - -- borderchars = { - -- prompt = { '▀', '▐', '▄', '▌', '▛', '▜', '▟', '▙' }; - -- results = { '▀', '▐', '▄', '▌', '▛', '▜', '▟', '▙' }; - -- preview = { '▀', '▐', '▄', '▌', '▛', '▜', '▟', '▙' }; - -- }, - -- borderchars = { - -- prompt = { '▀', '▐', '▄', '▌', '▛', '▜', '▟', '▙' }; - -- results = { ' ', '▐', '▄', '▌', '▌', '▐', '▟', '▙' }; - -- preview = { '▀', '▐', '▄', '▌', '▛', '▜', '▟', '▙' }; - -- }, + borderchars = { "─", "│", "─", "│", "╭", "╮", "╯", "╰" }, color_devicons = true, -- use_less = true, - -- set_env = { ["COLORTERM"] = "gruvbox" }, -- default = nil, + set_env = { ["COLORTERM"] = "truecolor" }, -- default = nil, -- file_sorter = require("telescope.sorters").get_fuzzy_file, file_ignore_patterns = { "node_modules" }, -- generic_sorter = require("telescope.sorters").get_generic_fuzzy_sorter, diff --git a/lua/kide/theme/gruvbox.lua b/lua/kide/theme/gruvbox.lua index 6cf7f7e2..e0e3ef92 100644 --- a/lua/kide/theme/gruvbox.lua +++ b/lua/kide/theme/gruvbox.lua @@ -68,51 +68,6 @@ local flat_telescope = { TelescopeSelection = { bg = colors.black2, fg = colors.yellow }, } -local flat_trans = { - TransWord = { - fg = colors.green, - bold = true, - }, - TransPhonetic = { - link = "Linenr", - }, - TransTitle = { - fg = colors.white, - bg = colors.blue2, - bold = true, - }, - TransTitleRound = { - fg = colors.blue2, - }, - TransTag = { - fg = colors.yellow2, - }, - TransExchange = { - link = "TransTag", - }, - TransPos = { - link = "TransTag", - }, - TransTranslation = { - link = "TransWord", - }, - TransDefinition = { - link = "Moremsg", - }, - TransWin = { - link = "Normal", - }, - TransBorder = { - link = "FloatBorder", - }, - TransCollins = { - fg = colors.green, - bold = true, - }, - TransFailed = { - fg = colors.blue, - }, -} M.load_telescope_highlights = function() M.load_highlights(flat_telescope) @@ -123,7 +78,4 @@ M.load_highlights = function(hl_groups) end end -M.load_trans_highlights = function() - M.load_highlights(flat_trans) -end return M From 2f1ed518406a74900d82a28fe2c10f46888211df Mon Sep 17 00:00:00 2001 From: luokai Date: Sun, 14 May 2023 22:04:20 +0800 Subject: [PATCH 0680/1278] icon --- lua/kide/lsp/lsp_ui.lua | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/lua/kide/lsp/lsp_ui.lua b/lua/kide/lsp/lsp_ui.lua index 434fd88f..f40a449b 100644 --- a/lua/kide/lsp/lsp_ui.lua +++ b/lua/kide/lsp/lsp_ui.lua @@ -27,19 +27,19 @@ M.symbol_map = { Struct = { icon = lspkind_symbol_map.Struct, hl = "@type" }, Event = { icon = lspkind_symbol_map.Event, hl = "@type" }, Operator = { icon = lspkind_symbol_map.Operator, hl = "@operator" }, - TypeParameter = { icon = "", hl = "@parameter" }, + TypeParameter = { icon = "󰗴", hl = "@parameter" }, --------------------------------------------------------- - Namespace = { icon = "", hl = "@namespace" }, + Namespace = { icon = "", hl = "@namespace" }, Package = { icon = "", hl = "@namespace" }, String = { icon = "", hl = "@string" }, Number = { icon = "", hl = "@number" }, Boolean = { icon = "", hl = "@boolean" }, - Array = { icon = "", hl = "@constant" }, - Object = { icon = "", hl = "@type" }, + Array = { icon = "", hl = "@constant" }, + Object = { icon = "", hl = "@type" }, Key = { icon = "󰌋", hl = "@type" }, Null = { icon = "󰟢", hl = "@type" }, - Component = { icon = "", hl = "@function" }, - Fragment = { icon = "", hl = "@constant" }, + Component = { icon = "󰡀", hl = "@function" }, + Fragment = { icon = "", hl = "@constant" }, } M.hover_actions = { From 89d4e6751274ed6eafb8be8fdf5eda6291d76347 Mon Sep 17 00:00:00 2001 From: luokai Date: Sun, 14 May 2023 22:08:31 +0800 Subject: [PATCH 0681/1278] Constructor --- lua/kide/lsp/lsp_ui.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lua/kide/lsp/lsp_ui.lua b/lua/kide/lsp/lsp_ui.lua index f40a449b..380233ac 100644 --- a/lua/kide/lsp/lsp_ui.lua +++ b/lua/kide/lsp/lsp_ui.lua @@ -27,7 +27,7 @@ M.symbol_map = { Struct = { icon = lspkind_symbol_map.Struct, hl = "@type" }, Event = { icon = lspkind_symbol_map.Event, hl = "@type" }, Operator = { icon = lspkind_symbol_map.Operator, hl = "@operator" }, - TypeParameter = { icon = "󰗴", hl = "@parameter" }, + TypeParameter = { icon = "", hl = "@parameter" }, --------------------------------------------------------- Namespace = { icon = "", hl = "@namespace" }, Package = { icon = "", hl = "@namespace" }, From 1e78648051992b286fbebfc283c62e4d53ee5957 Mon Sep 17 00:00:00 2001 From: luokai Date: Sun, 14 May 2023 23:20:40 +0800 Subject: [PATCH 0682/1278] color --- lua/kide/plugins/config/gruvbox.lua | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/lua/kide/plugins/config/gruvbox.lua b/lua/kide/plugins/config/gruvbox.lua index 89dfbbd1..ecf2573f 100644 --- a/lua/kide/plugins/config/gruvbox.lua +++ b/lua/kide/plugins/config/gruvbox.lua @@ -16,14 +16,24 @@ local overrides = { require("gruvbox").setup({ undercurl = true, underline = true, - inverse = true, -- invert background for search, diffs, statuslines and errors + bold = true, + italic = { + strings = true, + comments = true, + operators = false, + folds = true, + }, + strikethrough = true, invert_selection = false, invert_signs = false, invert_tabline = false, invert_intend_guides = false, - contrast = "", -- can be "hard" or "soft" + inverse = true, -- invert background for search, diffs, statuslines and errors + contrast = "", -- can be "hard", "soft" or empty string + palette_overrides = {}, overrides = overrides, + dim_inactive = false, + transparent_mode = false, }) - vim.opt.background = "dark" vim.cmd([[colorscheme gruvbox]]) From 0746a7ca28c8ac85ce324942256a9a49d4cc76e8 Mon Sep 17 00:00:00 2001 From: luokai Date: Mon, 15 May 2023 09:22:24 +0800 Subject: [PATCH 0683/1278] color --- lua/kide/plugins/config/gruvbox.lua | 22 +++++----------------- 1 file changed, 5 insertions(+), 17 deletions(-) diff --git a/lua/kide/plugins/config/gruvbox.lua b/lua/kide/plugins/config/gruvbox.lua index ecf2573f..fa2ad52d 100644 --- a/lua/kide/plugins/config/gruvbox.lua +++ b/lua/kide/plugins/config/gruvbox.lua @@ -1,18 +1,3 @@ --- setup must be called before loading the colorscheme --- Default options: - -local kgrubox = require("kide.theme.gruvbox") -local overrides = { - NormalFloat = { - bg = kgrubox.colors.black3, - }, - Pmenu = { - bg = kgrubox.colors.black2, - }, - - -- cmp, wilder -} - require("gruvbox").setup({ undercurl = true, underline = true, @@ -30,8 +15,11 @@ require("gruvbox").setup({ invert_intend_guides = false, inverse = true, -- invert background for search, diffs, statuslines and errors contrast = "", -- can be "hard", "soft" or empty string - palette_overrides = {}, - overrides = overrides, + palette_overrides = { + dark1 = "#313131", + dark2 = "#2e2e2e", + }, + overrides = {}, dim_inactive = false, transparent_mode = false, }) From 2d0034ea0b02b4f927cb336b94cce52635c09ed6 Mon Sep 17 00:00:00 2001 From: luokai Date: Mon, 15 May 2023 09:48:35 +0800 Subject: [PATCH 0684/1278] =?UTF-8?q?jdtls=20=E9=85=8D=E7=BD=AE=E4=BF=AE?= =?UTF-8?q?=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lua/kide/lsp/java.lua | 25 ------------------------- 1 file changed, 25 deletions(-) diff --git a/lua/kide/lsp/java.lua b/lua/kide/lsp/java.lua index fbdf7acd..be85abab 100644 --- a/lua/kide/lsp/java.lua +++ b/lua/kide/lsp/java.lua @@ -163,10 +163,6 @@ local config = { "-data=" .. workspace_dir, }, filetypes = { "java" }, - - -- 💀 - -- This is the default if not provided, you can remove it. Or adjust as needed. - -- One dedicated LSP server & client will be started per unique root_dir root_dir = root_dir, -- Here you can configure eclipse.jdt.ls specific settings @@ -176,18 +172,8 @@ local config = { java = { maxConcurrentBuilds = 8, home = get_java_home(), - jdt = { - ls = { - -- 暂时不可用 - lombokSupport = { enabled = true }, - }, - }, project = { encoding = "UTF-8", - resourceFilters = { - "node_modules", - ".git", - }, }, foldingRange = { enabled = true }, selectionRange = { enabled = true }, @@ -222,9 +208,6 @@ local config = { eclipse = { downloadSources = true, }, - server = { - launchMode = "Hybrid", - }, maven = { downloadSources = true, updateSnapshots = true, @@ -264,19 +247,11 @@ local config = { }, configuration = { maven = { - -- userSettings = "/opt/software/apache-maven-3.6.3/conf/settings.xml", - -- globalSettings = "/opt/software/apache-maven-3.6.3/conf/settings.xml", userSettings = maven.get_maven_settings(), globalSettings = maven.get_maven_settings(), }, runtimes = runtimes, }, - -- referencesCodeLens = { - -- enabled = true, - -- }, - -- implementationsCodeLens = { - -- enabled = true, - -- }, }, }, From 98c28daea078fe8e7a0b82f035ae184f4db0fdd3 Mon Sep 17 00:00:00 2001 From: luokai Date: Mon, 15 May 2023 09:52:42 +0800 Subject: [PATCH 0685/1278] color --- lua/kide/plugins/config/gruvbox.lua | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lua/kide/plugins/config/gruvbox.lua b/lua/kide/plugins/config/gruvbox.lua index fa2ad52d..279b8164 100644 --- a/lua/kide/plugins/config/gruvbox.lua +++ b/lua/kide/plugins/config/gruvbox.lua @@ -16,8 +16,8 @@ require("gruvbox").setup({ inverse = true, -- invert background for search, diffs, statuslines and errors contrast = "", -- can be "hard", "soft" or empty string palette_overrides = { - dark1 = "#313131", - dark2 = "#2e2e2e", + -- dark1 = "#313131", + -- dark2 = "#2e2e2e", }, overrides = {}, dim_inactive = false, From 32157888d958925f11be2bd539b3fd79c4be1e6a Mon Sep 17 00:00:00 2001 From: luokai Date: Mon, 15 May 2023 10:00:32 +0800 Subject: [PATCH 0686/1278] lsp_ui --- lua/kide/lsp/lsp_ui.lua | 20 ++++++++++---------- lua/kide/plugins/config/gruvbox.lua | 12 ++++++++---- 2 files changed, 18 insertions(+), 14 deletions(-) diff --git a/lua/kide/lsp/lsp_ui.lua b/lua/kide/lsp/lsp_ui.lua index 380233ac..7787134c 100644 --- a/lua/kide/lsp/lsp_ui.lua +++ b/lua/kide/lsp/lsp_ui.lua @@ -44,16 +44,16 @@ M.symbol_map = { M.hover_actions = { width = 120, - border = { - { "╭", "FloatBorder" }, - { "─", "FloatBorder" }, - { "╮", "FloatBorder" }, - { "│", "FloatBorder" }, - { "╯", "FloatBorder" }, - { "─", "FloatBorder" }, - { "╰", "FloatBorder" }, - { "│", "FloatBorder" }, - }, + -- border = { + -- { "╭", "FloatBorder" }, + -- { "─", "FloatBorder" }, + -- { "╮", "FloatBorder" }, + -- { "│", "FloatBorder" }, + -- { "╯", "FloatBorder" }, + -- { "─", "FloatBorder" }, + -- { "╰", "FloatBorder" }, + -- { "│", "FloatBorder" }, + -- }, } M.signs = { diff --git a/lua/kide/plugins/config/gruvbox.lua b/lua/kide/plugins/config/gruvbox.lua index 279b8164..1fc878b1 100644 --- a/lua/kide/plugins/config/gruvbox.lua +++ b/lua/kide/plugins/config/gruvbox.lua @@ -15,11 +15,15 @@ require("gruvbox").setup({ invert_intend_guides = false, inverse = true, -- invert background for search, diffs, statuslines and errors contrast = "", -- can be "hard", "soft" or empty string - palette_overrides = { - -- dark1 = "#313131", - -- dark2 = "#2e2e2e", + palette_overrides = {}, + overrides = { + NormalFloat = { + bg = "#313131", + }, + Pmenu = { + bg = "#2e2e2e", + }, }, - overrides = {}, dim_inactive = false, transparent_mode = false, }) From 7e3e0227c83e3d128bb169051386db66bebfd634 Mon Sep 17 00:00:00 2001 From: luokai Date: Mon, 15 May 2023 17:19:27 +0800 Subject: [PATCH 0687/1278] dbout --- lua/kide/core/basic.lua | 1 + 1 file changed, 1 insertion(+) diff --git a/lua/kide/core/basic.lua b/lua/kide/core/basic.lua index 72ad3f44..83352d49 100644 --- a/lua/kide/core/basic.lua +++ b/lua/kide/core/basic.lua @@ -188,6 +188,7 @@ autocmd("FileType", { "fugitive", "gitcommit", "git", + "dbout", }, callback = function(event) vim.bo[event.buf].buflisted = false From 2f60cbfcbd389315820bf65fcc6bc7d3308aa71e Mon Sep 17 00:00:00 2001 From: luokai Date: Mon, 15 May 2023 17:22:22 +0800 Subject: [PATCH 0688/1278] dbui,dbout --- lua/kide/core/basic.lua | 1 + lua/kide/plugins/config/indent-blankline.lua | 2 ++ lua/kide/plugins/config/lualine.lua | 1 + lua/kide/plugins/config/nvim-tree.lua | 2 +- 4 files changed, 5 insertions(+), 1 deletion(-) diff --git a/lua/kide/core/basic.lua b/lua/kide/core/basic.lua index 83352d49..f2e9e10a 100644 --- a/lua/kide/core/basic.lua +++ b/lua/kide/core/basic.lua @@ -188,6 +188,7 @@ autocmd("FileType", { "fugitive", "gitcommit", "git", + "dbui", "dbout", }, callback = function(event) diff --git a/lua/kide/plugins/config/indent-blankline.lua b/lua/kide/plugins/config/indent-blankline.lua index 676f0f62..10edd347 100644 --- a/lua/kide/plugins/config/indent-blankline.lua +++ b/lua/kide/plugins/config/indent-blankline.lua @@ -28,6 +28,8 @@ require("indent_blankline").setup({ "TelescopePrompt", "TelescopeResults", "", + "dbui", + "dbout", }, buftype_exclude = { "terminal" }, use_treesitter = true, diff --git a/lua/kide/plugins/config/lualine.lua b/lua/kide/plugins/config/lualine.lua index 8380c28d..d47ff60c 100644 --- a/lua/kide/plugins/config/lualine.lua +++ b/lua/kide/plugins/config/lualine.lua @@ -117,6 +117,7 @@ dbui.sections = { } dbui.filetypes = { "dbui", + "dbout", } table.insert(config.extensions, dbui) diff --git a/lua/kide/plugins/config/nvim-tree.lua b/lua/kide/plugins/config/nvim-tree.lua index b4ab81e6..df72aacc 100644 --- a/lua/kide/plugins/config/nvim-tree.lua +++ b/lua/kide/plugins/config/nvim-tree.lua @@ -21,7 +21,7 @@ require("nvim-tree").setup({ enable = true, chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890", exclude = { - filetype = { "notify", "packer", "qf", "diff", "fugitive", "fugitiveblame" }, + filetype = { "notify", "packer", "qf", "diff", "fugitive", "fugitiveblame", "dbui", "dbout" }, buftype = { "nofile", "terminal", "help" }, }, }, From 5471b5db2796a232045c5896617f8122105b8d69 Mon Sep 17 00:00:00 2001 From: luokai Date: Mon, 15 May 2023 20:01:14 +0800 Subject: [PATCH 0689/1278] type_definition --- lua/kide/core/keybindings.lua | 1 + 1 file changed, 1 insertion(+) diff --git a/lua/kide/core/keybindings.lua b/lua/kide/core/keybindings.lua index ac4e6daa..031bb753 100644 --- a/lua/kide/core/keybindings.lua +++ b/lua/kide/core/keybindings.lua @@ -147,6 +147,7 @@ M.maplsp = function(client, buffer) -- go xx -- mapbuf('n', 'gd', 'lua vim.lsp.buf.definition()', opt) vim.api.nvim_buf_set_keymap(buffer, "n", "gD", "lua vim.lsp.buf.declaration()", opt) + vim.api.nvim_buf_set_keymap(buffer, "n", "gt", "lua vim.lsp.buf.type_definition()", opt) vim.api.nvim_buf_set_keymap(buffer, "n", "gd", "Telescope lsp_definitions", opt) vim.api.nvim_buf_set_keymap(buffer, "n", "gh", "lua vim.lsp.buf.hover()", opt) vim.api.nvim_buf_set_keymap(buffer, "n", "gs", "lua vim.lsp.buf.signature_help()", opt) From b3bde9580aadf41f7ea31e238f06324edd99da4f Mon Sep 17 00:00:00 2001 From: luokai Date: Tue, 16 May 2023 09:21:58 +0800 Subject: [PATCH 0690/1278] vim.env --- lua/kide/config.lua | 4 ++-- lua/kide/core/utils/maven.lua | 4 ++-- lua/kide/core/utils/plantuml.lua | 2 +- lua/kide/core/vscode/init.lua | 2 +- lua/kide/lsp/java.lua | 16 ++++++++-------- lua/kide/lsp/lemminx.lua | 2 +- lua/kide/plugins/config/null-ls.lua | 4 ++-- 7 files changed, 17 insertions(+), 17 deletions(-) diff --git a/lua/kide/config.lua b/lua/kide/config.lua index 2a8fb60e..1203525e 100644 --- a/lua/kide/config.lua +++ b/lua/kide/config.lua @@ -1,10 +1,10 @@ local M = { env = { - py_bin = os.getenv("PY_BIN") or "/usr/bin/python3", + py_bin = vim.env["PY_BIN"] or "/usr/bin/python3", }, plugin = { copilot = { - enable = os.getenv("COPILOT_ENABLE") or false, + enable = vim.env["COPILOT_ENABLE"] == "Y" and true or false, }, }, } diff --git a/lua/kide/core/utils/maven.lua b/lua/kide/core/utils/maven.lua index 1df5a0bb..95bb9cef 100644 --- a/lua/kide/core/utils/maven.lua +++ b/lua/kide/core/utils/maven.lua @@ -2,14 +2,14 @@ local utils = require("kide.core.utils") local M = {} local function maven_settings() - local maven_home = os.getenv("MAVEN_HOME") + local maven_home = vim.env["MAVEN_HOME"] if maven_home then return maven_home .. "/conf/settings.xml" end end M.get_maven_settings = function() - return os.getenv("MAVEN_SETTINGS") or maven_settings() + return vim.env["MAVEN_SETTINGS"] or maven_settings() end local function settings_opt(settings) diff --git a/lua/kide/core/utils/plantuml.lua b/lua/kide/core/utils/plantuml.lua index 4fe9dc87..0cec7a82 100644 --- a/lua/kide/core/utils/plantuml.lua +++ b/lua/kide/core/utils/plantuml.lua @@ -5,7 +5,7 @@ local M = {} M.config = {} local function plantuml_jar(default_jar) - return os.getenv("PLANTUML_JAR") or default_jar + return vim.env["PLANTUML_JAR"] or default_jar end M.config.jar_path = plantuml_jar("/opt/software/puml/plantuml.jar") M.config.cmd = "java" diff --git a/lua/kide/core/vscode/init.lua b/lua/kide/core/vscode/init.lua index 070f74cd..6604f08f 100644 --- a/lua/kide/core/vscode/init.lua +++ b/lua/kide/core/vscode/init.lua @@ -1,7 +1,7 @@ local M = {} local env = { HOME = vim.loop.os_homedir(), - VSCODE_EXTENSIONS = os.getenv("VSCODE_EXTENSIONS"), + VSCODE_EXTENSIONS = vim.env["VSCODE_EXTENSIONS"], } M.get_vscode_extensions = function() return env.VSCODE_EXTENSIONS or "~/.vscode/extensions" diff --git a/lua/kide/lsp/java.lua b/lua/kide/lsp/java.lua index be85abab..6fc030e9 100644 --- a/lua/kide/lsp/java.lua +++ b/lua/kide/lsp/java.lua @@ -1,12 +1,12 @@ local M = {} local env = { HOME = vim.loop.os_homedir(), - JAVA_HOME = os.getenv("JAVA_HOME"), - JDTLS_RUN_JAVA = os.getenv("JDTLS_RUN_JAVA"), - JDTLS_HOME = os.getenv("JDTLS_HOME"), - JDTLS_WORKSPACE = os.getenv("JDTLS_WORKSPACE"), - LOMBOK_JAR = os.getenv("LOMBOK_JAR"), - JOL_JAR = os.getenv("JOL_JAR"), + JAVA_HOME = vim.env["JAVA_HOME"], + JDTLS_RUN_JAVA = vim.env["JDTLS_RUN_JAVA"], + JDTLS_HOME = vim.env["JDTLS_HOME"], + JDTLS_WORKSPACE = vim.env["JDTLS_WORKSPACE"], + LOMBOK_JAR = vim.env["LOMBOK_JAR"], + JOL_JAR = vim.env["JOL_JAR"], } local maven = require("kide.core.utils.maven") @@ -18,10 +18,10 @@ local function get_java_home() return or_default(env.JAVA_HOME, "/opt/software/java/zulu17.34.19-ca-jdk17.0.3-macosx_aarch64") end local function get_java_ver_home(v, dv) - return os.getenv("JAVA_" .. v .. "_HOME") or dv + return vim.env["JAVA_" .. v .. "_HOME"] or dv end local function get_java_ver_sources(v, dv) - return os.getenv("JAVA_" .. v .. "_SOURCES") or dv + return vim.env["JAVA_" .. v .. "_SOURCES"] or dv end local function get_jdtls_workspace() diff --git a/lua/kide/lsp/lemminx.lua b/lua/kide/lsp/lemminx.lua index 7ccb45d6..97dc18b8 100644 --- a/lua/kide/lsp/lemminx.lua +++ b/lua/kide/lsp/lemminx.lua @@ -1,5 +1,5 @@ local M = {} -local lemminx_home = os.getenv("LEMMINX_HOME") +local lemminx_home = vim.env["LEMMINX_HOME"] if lemminx_home then M.setup = function(opt) local lspconfig = require("lspconfig") diff --git a/lua/kide/plugins/config/null-ls.lua b/lua/kide/plugins/config/null-ls.lua index 6fbc0d79..fb84773d 100644 --- a/lua/kide/plugins/config/null-ls.lua +++ b/lua/kide/plugins/config/null-ls.lua @@ -111,9 +111,9 @@ local on_attach = function(client, bufnr) end end -if "Y" == os.getenv("SEMGREP_ENABLE") then +if "Y" == vim.env["SEMGREP_ENABLE"] then table.insert(sources, null_ls.builtins.diagnostics.semgrep) -elseif "Y" == os.getenv("PMD_ENABLE") then +elseif "Y" == vim.env["PMD_ENABLE"] then table.insert( sources, null_ls.builtins.diagnostics.pmd.with({ From 3ddc408798c48f6a022631126229247fcdca92f5 Mon Sep 17 00:00:00 2001 From: luokai Date: Thu, 18 May 2023 00:02:10 +0800 Subject: [PATCH 0691/1278] python3_host_prog --- lua/kide/core/basic.lua | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lua/kide/core/basic.lua b/lua/kide/core/basic.lua index f2e9e10a..b0289782 100644 --- a/lua/kide/core/basic.lua +++ b/lua/kide/core/basic.lua @@ -1,3 +1,4 @@ +local config = require('kide.config') vim.g.mapleader = " " vim.opt.title = true @@ -121,7 +122,7 @@ vim.opt.wildmenu = true vim.opt.confirm = true -- vim.g.python_host_prog='/opt/homebrew/bin/python3' --- vim.g.python3_host_prog = "/opt/homebrew/bin/python3" +vim.g.python3_host_prog = config.env.py_bin vim.opt.list = true vim.opt.cul = true -- cursor line From 10936c70c1e4734eb0e98d4826f9fde1c40a4582 Mon Sep 17 00:00:00 2001 From: luokai Date: Thu, 18 May 2023 13:39:16 +0800 Subject: [PATCH 0692/1278] =?UTF-8?q?=E5=85=BC=E5=AE=B9=20mason?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lua/kide/lsp/java.lua | 34 +++++++++++++++++++++++++++++----- 1 file changed, 29 insertions(+), 5 deletions(-) diff --git a/lua/kide/lsp/java.lua b/lua/kide/lsp/java.lua index 6fc030e9..4e5ee172 100644 --- a/lua/kide/lsp/java.lua +++ b/lua/kide/lsp/java.lua @@ -101,13 +101,29 @@ local workspace_dir = get_jdtls_workspace() .. project_name local function get_jdtls_path() return or_default(env.JDTLS_HOME, vscode.find_one("/redhat.java-*/server")) end -local jdtls_path = get_jdtls_path() -local jdtls_launcher = vim.fn.glob(jdtls_path .. "/bin/jdtls") +local function jdtls_launcher() + local jdtls_path = get_jdtls_path() + if jdtls_path then + return vim.fn.glob(jdtls_path .. "/bin/jdtls") + end + if require("mason-registry").has_package("jdtls") then + return require("mason-registry").get_package("jdtls"):get_install_path() + end +end local bundles = {} -- This bundles definition is the same as in the previous section (java-debug installation) -local vscode_java_debug_path = vscode.find_one("/vscjava.vscode-java-debug-*/server") + +local vscode_java_debug_path = (function() + local p = vscode.find_one("/vscjava.vscode-java-debug-*/server") + if p then + return p + end + if require("mason-registry").has_package("java-debug-adapter") then + return require("mason-registry").get_package("java-debug-adapter"):get_install_path() .. "/extension/server" + end +end)() if vscode_java_debug_path then vim.list_extend( bundles, @@ -117,7 +133,15 @@ end -- /opt/software/lsp/java/vscode-java-test/server -- vim.list_extend(bundles, vim.split(vim.fn.glob("/opt/software/lsp/java/vscode-java-test/server/*.jar"), "\n")); -local vscode_java_test_path = vscode.find_one("/vscjava.vscode-java-test-*/server") +local vscode_java_test_path = (function() + local p = vscode.find_one("/vscjava.vscode-java-test-*/server") + if p then + return p + end + if require("mason-registry").has_package("java-test") then + return require("mason-registry").get_package("java-test"):get_install_path() .. "/extension/server" + end +end)() if vscode_java_test_path then for _, bundle in ipairs(vim.split(vim.fn.glob(vscode_java_test_path .. "/*.jar"), "\n")) do if not vim.endswith(bundle, "com.microsoft.java.test.runner-jar-with-dependencies.jar") then @@ -153,7 +177,7 @@ local config = { -- The command that starts the language server -- See: https://github.com/eclipse/eclipse.jdt.ls#running-from-the-command-line cmd = { - jdtls_launcher, + jdtls_launcher(), "--jvm-arg=-Dlog.protocol=true", "--jvm-arg=-Dlog.level=ALL", "--jvm-arg=-Dsun.zip.disableMemoryMapping=true", From f9dd4cc43fda4ecd8ab89282059f67913848d3a7 Mon Sep 17 00:00:00 2001 From: luokai Date: Thu, 18 May 2023 14:49:47 +0800 Subject: [PATCH 0693/1278] jdtls bin --- lua/kide/lsp/java.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lua/kide/lsp/java.lua b/lua/kide/lsp/java.lua index 4e5ee172..990caa04 100644 --- a/lua/kide/lsp/java.lua +++ b/lua/kide/lsp/java.lua @@ -108,7 +108,7 @@ local function jdtls_launcher() return vim.fn.glob(jdtls_path .. "/bin/jdtls") end if require("mason-registry").has_package("jdtls") then - return require("mason-registry").get_package("jdtls"):get_install_path() + return require("mason-registry").get_package("jdtls"):get_install_path() .. "/bin/jdtls" end end From 5ae43f3cd49ff93b7f363089869efee21dca0c91 Mon Sep 17 00:00:00 2001 From: luokai Date: Thu, 18 May 2023 15:00:04 +0800 Subject: [PATCH 0694/1278] lspconfig ignore jdtls --- lua/kide/lsp/init.lua | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lua/kide/lsp/init.lua b/lua/kide/lsp/init.lua index 3025619d..25430bed 100644 --- a/lua/kide/lsp/init.lua +++ b/lua/kide/lsp/init.lua @@ -65,6 +65,8 @@ require("mason-lspconfig").setup_handlers({ -- Initialize the LSP via rust-tools instead cfg.server = scfg require("rust-tools").setup(cfg) + elseif server_name == "jdtls" then + -- ignore else lspconfig[server_name].setup(scfg) end From 3e6874c2c2038649a5c645a577c4aefa6752fa25 Mon Sep 17 00:00:00 2001 From: luokai Date: Thu, 18 May 2023 17:08:34 +0800 Subject: [PATCH 0695/1278] =?UTF-8?q?=E6=9B=B4=E6=96=B0=E5=AE=89=E8=A3=85?= =?UTF-8?q?=E4=BE=9D=E8=B5=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/README.md b/README.md index 04742331..82ac8a78 100644 --- a/README.md +++ b/README.md @@ -20,6 +20,17 @@ cd $env:LOCALAPPDATA git clone https://github.com/JavaHello/nvim.git ``` +## 依赖 + +- [ripgrep](https://github.com/BurntSushi/ripgrep) +- [fd](https://github.com/sharkdp/fd) +- [JDK](https://openjdk.org/) 8/17+ +- [maven](https://maven.apache.org/) +- [nodejs](https://nodejs.org/en) +- [yarn](https://yarnpkg.com/) + +其他依赖可选安装,使用 [mason.nvim](https://github.com/williamboman/mason.nvim) + > 此配置在 Linux, Mac, Windows (推荐使用 [scoop](https://scoop.sh/) 安装依赖) 系统上长期使用 ## 快捷键 From ca952984b227613505e2983f7fb7f85f44f8e999 Mon Sep 17 00:00:00 2001 From: luokai Date: Fri, 19 May 2023 10:12:55 +0800 Subject: [PATCH 0696/1278] =?UTF-8?q?lombok=20=E5=8F=AF=E9=80=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lua/kide/lsp/java.lua | 36 ++++++++++++++++++++---------------- 1 file changed, 20 insertions(+), 16 deletions(-) diff --git a/lua/kide/lsp/java.lua b/lua/kide/lsp/java.lua index 990caa04..91218f95 100644 --- a/lua/kide/lsp/java.lua +++ b/lua/kide/lsp/java.lua @@ -29,9 +29,6 @@ local function get_jdtls_workspace() end local vscode = require("kide.core.vscode") -local function get_lombok_jar() - return or_default(env.LOMBOK_JAR, "/opt/software/lsp/lombok.jar") -end local function get_jol_jar() return env.JOL_JAR or "/opt/software/java/jol-cli-0.16-full.jar" @@ -105,11 +102,27 @@ end local function jdtls_launcher() local jdtls_path = get_jdtls_path() if jdtls_path then - return vim.fn.glob(jdtls_path .. "/bin/jdtls") + jdtls_path = vim.fn.glob(jdtls_path .. "/bin/jdtls") + elseif require("mason-registry").has_package("jdtls") then + jdtls_path = require("mason-registry").get_package("jdtls"):get_install_path() .. "/bin/jdtls" + end + if not jdtls_path then + vim.notify("jdtls_path is empty", vim.log.levels.ERROR) + return end - if require("mason-registry").has_package("jdtls") then - return require("mason-registry").get_package("jdtls"):get_install_path() .. "/bin/jdtls" + local cmd = { + jdtls_path, + "--jvm-arg=-Dlog.protocol=true", + "--jvm-arg=-Dlog.level=ALL", + "--jvm-arg=-Dsun.zip.disableMemoryMapping=true", + "--jvm-arg=" .. "-XX:+UseZGC", + "--jvm-arg=" .. "-Xmx1g", + } + if env.LOMBOK_JAR then + table.insert(cmd, "--jvm-arg=-javaagent:" .. env.LOMBOK_JAR) end + table.insert(cmd, "-data=" .. workspace_dir) + return cmd end local bundles = {} @@ -176,16 +189,7 @@ local root_dir = require("jdtls.setup").find_root({ ".git", "mvnw", "gradlew" }) local config = { -- The command that starts the language server -- See: https://github.com/eclipse/eclipse.jdt.ls#running-from-the-command-line - cmd = { - jdtls_launcher(), - "--jvm-arg=-Dlog.protocol=true", - "--jvm-arg=-Dlog.level=ALL", - "--jvm-arg=-Dsun.zip.disableMemoryMapping=true", - "--jvm-arg=" .. "-javaagent:" .. get_lombok_jar(), - "--jvm-arg=" .. "-XX:+UseZGC", - "--jvm-arg=" .. "-Xmx1g", - "-data=" .. workspace_dir, - }, + cmd = jdtls_launcher(), filetypes = { "java" }, root_dir = root_dir, From 77661666b8c94fe5ba0f068f2819a646a757f690 Mon Sep 17 00:00:00 2001 From: luokai Date: Sat, 20 May 2023 21:26:02 +0800 Subject: [PATCH 0697/1278] http --- lua/kide/plugins/config/rest-nvim.lua | 10 ---------- lua/kide/plugins/lazy-nvim.lua | 12 ++++++++++++ 2 files changed, 12 insertions(+), 10 deletions(-) diff --git a/lua/kide/plugins/config/rest-nvim.lua b/lua/kide/plugins/config/rest-nvim.lua index ecbc4ffe..8efe3902 100644 --- a/lua/kide/plugins/config/rest-nvim.lua +++ b/lua/kide/plugins/config/rest-nvim.lua @@ -20,13 +20,3 @@ require("rest-nvim").setup({ custom_dynamic_variables = {}, yank_dry_run = true, }) -local group = vim.api.nvim_create_augroup("kide_jdtls_rest_http", { clear = true }) -vim.api.nvim_create_autocmd({ "FileType" }, { - group = group, - pattern = { "http" }, - callback = function(o) - vim.api.nvim_buf_create_user_command(o.buf, "Http", ":lua require'rest-nvim'.run()", { nargs = 0 }) - vim.api.nvim_buf_create_user_command(o.buf, "HttpCurl", ":lua require'rest-nvim'.run(true)", { nargs = 0 }) - vim.api.nvim_buf_create_user_command(o.buf, "HttpLast", ":lua require'rest-nvim'.last()", { nargs = 0 }) - end, -}) diff --git a/lua/kide/plugins/lazy-nvim.lua b/lua/kide/plugins/lazy-nvim.lua index 41e15c8b..8bad50d1 100644 --- a/lua/kide/plugins/lazy-nvim.lua +++ b/lua/kide/plugins/lazy-nvim.lua @@ -573,6 +573,18 @@ require("lazy").setup({ "NTBBloodbath/rest.nvim", lazy = true, ft = "http", + init = function() + local group = vim.api.nvim_create_augroup("kide_jdtls_rest_http", { clear = true }) + vim.api.nvim_create_autocmd({ "FileType" }, { + group = group, + pattern = { "http" }, + callback = function(o) + vim.api.nvim_buf_create_user_command(o.buf, "Http", ":lua require'rest-nvim'.run()", { nargs = 0 }) + vim.api.nvim_buf_create_user_command(o.buf, "HttpCurl", ":lua require'rest-nvim'.run(true)", { nargs = 0 }) + vim.api.nvim_buf_create_user_command(o.buf, "HttpLast", ":lua require'rest-nvim'.last()", { nargs = 0 }) + end, + }) + end, config = function() require("kide.plugins.config.rest-nvim") end, From 0021a59e78ef8418ba6de882bc6e6b03e809c477 Mon Sep 17 00:00:00 2001 From: luokai Date: Sat, 20 May 2023 22:38:36 +0800 Subject: [PATCH 0698/1278] gitcommit --- lua/kide/core/basic.lua | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/lua/kide/core/basic.lua b/lua/kide/core/basic.lua index b0289782..7dfe3f18 100644 --- a/lua/kide/core/basic.lua +++ b/lua/kide/core/basic.lua @@ -1,4 +1,4 @@ -local config = require('kide.config') +local config = require("kide.config") vim.g.mapleader = " " vim.opt.title = true @@ -187,7 +187,6 @@ autocmd("FileType", { "tsplayground", "checkhealth", "fugitive", - "gitcommit", "git", "dbui", "dbout", @@ -218,3 +217,9 @@ autocmd("FileType", { vim.keymap.set("n", "tt", ":ToggleTerm", { buffer = event.buf, silent = true }) end, }) + +autocmd("FileType", { + group = augroup("gitcommit"), + pattern = { "gitcommit" }, + command = "setlocal spell", +}) From a0d17c35e4f4dbecc4503c850617ee3257034bfb Mon Sep 17 00:00:00 2001 From: luokai Date: Sun, 21 May 2023 09:00:59 +0800 Subject: [PATCH 0699/1278] =?UTF-8?q?=E6=89=81=E5=B9=B3=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lua/kide/plugins/config/gruvbox.lua | 25 ++++++++++++++++--------- lua/kide/plugins/config/lualine.lua | 4 ++-- 2 files changed, 18 insertions(+), 11 deletions(-) diff --git a/lua/kide/plugins/config/gruvbox.lua b/lua/kide/plugins/config/gruvbox.lua index 1fc878b1..ad1fbac0 100644 --- a/lua/kide/plugins/config/gruvbox.lua +++ b/lua/kide/plugins/config/gruvbox.lua @@ -1,3 +1,17 @@ +local transparent_mode = false +local overrides = {} +if transparent_mode then + overrides.Pmenu = { + bg = "none", + } +else + overrides.NormalFloat = { + bg = "#313131", + } + overrides.Pmenu = { + bg = "#2e2e2e", + } +end require("gruvbox").setup({ undercurl = true, underline = true, @@ -16,16 +30,9 @@ require("gruvbox").setup({ inverse = true, -- invert background for search, diffs, statuslines and errors contrast = "", -- can be "hard", "soft" or empty string palette_overrides = {}, - overrides = { - NormalFloat = { - bg = "#313131", - }, - Pmenu = { - bg = "#2e2e2e", - }, - }, + overrides = overrides, dim_inactive = false, - transparent_mode = false, + transparent_mode = transparent_mode, }) vim.opt.background = "dark" vim.cmd([[colorscheme gruvbox]]) diff --git a/lua/kide/plugins/config/lualine.lua b/lua/kide/plugins/config/lualine.lua index d47ff60c..feaab383 100644 --- a/lua/kide/plugins/config/lualine.lua +++ b/lua/kide/plugins/config/lualine.lua @@ -2,8 +2,8 @@ local config = { options = { icons_enabled = true, theme = "gruvbox", - component_separators = { left = "", right = "" }, - section_separators = { left = "", right = "" }, + component_separators = { left = "", right = "" }, + section_separators = { left = "", right = "" }, disabled_filetypes = { "alpha", }, From a885f48096edb64dfdd48c9c306357ba2eef0f54 Mon Sep 17 00:00:00 2001 From: luokai Date: Sun, 21 May 2023 11:29:36 +0800 Subject: [PATCH 0700/1278] java doc fmt --- lua/kide/lsp/java.lua | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lua/kide/lsp/java.lua b/lua/kide/lsp/java.lua index 91218f95..11f2d130 100644 --- a/lua/kide/lsp/java.lua +++ b/lua/kide/lsp/java.lua @@ -372,10 +372,10 @@ local function markdown_format(input) -- input = string.gsub(input, "[\r\n]( +)(%*)", function (i1) -- return i1 .. "-" -- end) - input = string.gsub(input, "%[([%a%$_]?[%.%w%(%),\\_%[%]%s ]*)%]%(file:/[^%)]+%)", function(i1) + input = string.gsub(input, "%[([%a%$_]?[%.%w%(%),\\_%[%]%s :]*)%]%(file:/[^%)]+%)", function(i1) return "`" .. i1 .. "`" end) - input = string.gsub(input, "%[([%a%$_]?[%.%w%(%),\\_%[%]%s ]*)%]%(jdt://[^%)]+%)", function(i1) + input = string.gsub(input, "%[([%a%$_]?[%.%w%(%),\\_%[%]%s :]*)%]%(jdt://[^%)]+%)", function(i1) return "`" .. i1 .. "`" end) end From 7c58207a638529832baceb204294be30ac8fdc3e Mon Sep 17 00:00:00 2001 From: luokai Date: Sun, 21 May 2023 12:25:28 +0800 Subject: [PATCH 0701/1278] =?UTF-8?q?LSP=20=E7=BB=9F=E4=B8=80=E4=B8=A4?= =?UTF-8?q?=E7=A7=8D=E5=90=AF=E5=8A=A8=E6=96=B9=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lua/kide/lsp/init.lua | 17 +++++++---------- lua/kide/lsp/java.lua | 19 +------------------ lua/kide/lsp/metals.lua | 12 ++++++------ lua/kide/lsp/rust_analyzer.lua | 27 +++++++++++++++++++-------- lua/kide/plugins/lazy-nvim.lua | 34 ---------------------------------- 5 files changed, 33 insertions(+), 76 deletions(-) diff --git a/lua/kide/lsp/init.lua b/lua/kide/lsp/init.lua index 25430bed..dcd5cae8 100644 --- a/lua/kide/lsp/init.lua +++ b/lua/kide/lsp/init.lua @@ -11,7 +11,8 @@ mason_lspconfig.setup({ local server_configs = { -- sumneko_lua -> lua_ls lua_ls = require("kide.lsp.lua_ls"), -- /lua/lsp/lua.lua - -- jdtls = require "lsp.java", -- /lua/lsp/jdtls.lua + jdtls = require("kide.lsp.java"), -- /lua/lsp/jdtls.lua + metals = require("kide.lsp.metals"), -- /lua/lsp/jdtls.lua -- jsonls = require("lsp.jsonls"), clangd = require("kide.lsp.clangd"), tsserver = require("kide.lsp.tsserver"), @@ -42,6 +43,10 @@ require("mason-lspconfig").setup_handlers({ local lspconfig = require("lspconfig") -- tools config local cfg = utils.or_default(server_configs[server_name], {}) + -- 自定义启动方式 + if cfg.setup then + return + end -- lspconfig local scfg = utils.or_default(cfg.server, {}) @@ -61,15 +66,7 @@ require("mason-lspconfig").setup_handlers({ debounce_text_changes = 150, } scfg.capabilities = capabilities - if server_name == "rust_analyzer" then - -- Initialize the LSP via rust-tools instead - cfg.server = scfg - require("rust-tools").setup(cfg) - elseif server_name == "jdtls" then - -- ignore - else - lspconfig[server_name].setup(scfg) - end + lspconfig[server_name].setup(scfg) end, }) diff --git a/lua/kide/lsp/java.lua b/lua/kide/lsp/java.lua index 11f2d130..20023df8 100644 --- a/lua/kide/lsp/java.lua +++ b/lua/kide/lsp/java.lua @@ -479,35 +479,18 @@ M.start = function() end M.setup = function() - vim.g.jdtls_dap_main_class_config_init = true - -- au BufReadCmd jdt://* lua require('jdtls').open_jdt_link(vim.fn.expand('')) - -- command! JdtWipeDataAndRestart lua require('jdtls.setup').wipe_data_and_restart() - -- command! JdtShowLogs lua require('jdtls.setup').show_logs() - vim.api.nvim_create_autocmd({ "BufReadCmd" }, { - pattern = "jdt://*", - callback = function(e) - require("jdtls").open_classfile(e.file) - end, - }) - vim.api.nvim_create_user_command("JdtWipeDataAndRestart", "lua require('jdtls.setup').wipe_data_and_restart()", {}) - vim.api.nvim_create_user_command("JdtShowLogs", "lua require('jdtls.setup').show_logs()", {}) - local group = vim.api.nvim_create_augroup("kide_jdtls_java", { clear = true }) vim.api.nvim_create_autocmd({ "FileType" }, { group = group, pattern = { "java" }, desc = "jdtls", callback = function(e) - -- vim.notify("load: " .. o.buf, vim.log.levels.INFO) - -- print(vim.inspect(e)) - -- 忽略 telescope 预览的情况 if e.file == "java" and vim.bo[e.buf].buftype == "nofile" then -- ignore else - M.start() + require("kide.lsp.java").start() end end, }) - return group end return M diff --git a/lua/kide/lsp/metals.lua b/lua/kide/lsp/metals.lua index be770880..73d42645 100644 --- a/lua/kide/lsp/metals.lua +++ b/lua/kide/lsp/metals.lua @@ -4,11 +4,12 @@ metals_config.settings = { showImplicitArguments = true, } -metals_config.on_attach = function(client, buffer) - require("kide.core.keybindings").maplsp(client, buffer) -end - -M.setup = function() +M.setup = function(opt) + metals_config.on_attach = function(client, buffer) + if opt.on_attach then + opt.on_attach(client, buffer) + end + end local group = vim.api.nvim_create_augroup("kide_metals", { clear = true }) vim.api.nvim_create_autocmd({ "FileType" }, { group = group, @@ -17,7 +18,6 @@ M.setup = function() require("metals").initialize_or_attach(metals_config) end, }) - return group end return M diff --git a/lua/kide/lsp/rust_analyzer.lua b/lua/kide/lsp/rust_analyzer.lua index 5935a275..0b480686 100644 --- a/lua/kide/lsp/rust_analyzer.lua +++ b/lua/kide/lsp/rust_analyzer.lua @@ -1,11 +1,11 @@ +local M = {} local codelldb = require("kide.dap.codelldb") local adapter = function() if codelldb.extension_path then return require("rust-tools.dap").get_codelldb_adapter(codelldb.codelldb_path, codelldb.liblldb_path) end end -local rt = require("rust-tools") -return { +local config = { dap = { adapter = adapter(), }, @@ -16,12 +16,6 @@ return { }, }, server = { - on_attach = function(_, bufnr) - -- Hover actions - vim.keymap.set("n", "ha", rt.hover_actions.hover_actions, { buffer = bufnr }) - -- Code action groups - vim.keymap.set("n", "ca", rt.code_action_group.code_action_group, { buffer = bufnr }) - end, standalone = false, settings = { ["rust-analyzer"] = { @@ -37,3 +31,20 @@ return { }, }, } +M.setup = function(opt) + local rt = require("rust-tools") + local on_attach = opt.on_attach + config.server = vim.tbl_deep_extend("keep", config.server, opt) + config.server.on_attach = function(client, bufnr) + if on_attach then + on_attach(client, bufnr) + end + -- Hover actions + vim.keymap.set("n", "ha", rt.hover_actions.hover_actions, { buffer = bufnr }) + -- Code action groups + vim.keymap.set("n", "ca", rt.code_action_group.code_action_group, { buffer = bufnr }) + end + rt.setup(config) +end + +return M diff --git a/lua/kide/plugins/lazy-nvim.lua b/lua/kide/plugins/lazy-nvim.lua index 8bad50d1..82f6dee6 100644 --- a/lua/kide/plugins/lazy-nvim.lua +++ b/lua/kide/plugins/lazy-nvim.lua @@ -180,37 +180,6 @@ require("lazy").setup({ "mfussenegger/nvim-jdtls", lazy = true, ft = "java", - init = function() - -- 不加载 nvim-jdtls.vim - vim.g.nvim_jdtls = 1 - vim.api.nvim_create_autocmd({ "BufReadCmd" }, { - pattern = "jdt://*", - callback = function(e) - require("jdtls").open_classfile(e.file) - end, - }) - vim.api.nvim_create_user_command( - "JdtWipeDataAndRestart", - "lua require('jdtls.setup').wipe_data_and_restart()", - {} - ) - vim.api.nvim_create_user_command("JdtShowLogs", "lua require('jdtls.setup').show_logs()", {}) - - local group = vim.api.nvim_create_augroup("kide_jdtls_java", { clear = true }) - vim.api.nvim_create_autocmd({ "FileType" }, { - group = group, - pattern = { "java" }, - desc = "jdtls", - callback = function(e) - if e.file == "java" and vim.bo[e.buf].buftype == "nofile" then - -- ignore - else - require("kide.lsp.java").start() - end - end, - }) - return group - end, }, { "JavaHello/java-deps.nvim", @@ -226,9 +195,6 @@ require("lazy").setup({ lazy = true, ft = "scala", dependencies = { "nvim-lua/plenary.nvim" }, - config = function() - require("kide.lsp.metals").setup() - end, }, -- debug { From a34696dfd45e4eab08926ba97d58f5a19921a59f Mon Sep 17 00:00:00 2001 From: luokai Date: Sun, 21 May 2023 12:28:17 +0800 Subject: [PATCH 0702/1278] M.start --- lua/kide/lsp/java.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lua/kide/lsp/java.lua b/lua/kide/lsp/java.lua index 20023df8..b293c317 100644 --- a/lua/kide/lsp/java.lua +++ b/lua/kide/lsp/java.lua @@ -488,7 +488,7 @@ M.setup = function() if e.file == "java" and vim.bo[e.buf].buftype == "nofile" then -- ignore else - require("kide.lsp.java").start() + M.start() end end, }) From 9634e10060f8aaa8cac193292756bd11e76de9ab Mon Sep 17 00:00:00 2001 From: luokai Date: Thu, 25 May 2023 15:44:03 +0800 Subject: [PATCH 0703/1278] doc fmt --- lua/kide/lsp/init.lua | 112 +++++++++++++++++++++++++++++++++++++----- lua/kide/lsp/java.lua | 111 +---------------------------------------- 2 files changed, 102 insertions(+), 121 deletions(-) diff --git a/lua/kide/lsp/init.lua b/lua/kide/lsp/init.lua index dcd5cae8..8d15f605 100644 --- a/lua/kide/lsp/init.lua +++ b/lua/kide/lsp/init.lua @@ -111,14 +111,104 @@ vim.diagnostic.config({ vim.lsp.handlers["textDocument/hover"] = vim.lsp.with(vim.lsp.handlers.hover, lsp_ui.hover_actions) vim.lsp.handlers["textDocument/signatureHelp"] = vim.lsp.with(vim.lsp.handlers.signature_help, lsp_ui.hover_actions) --- suppress error messages from lang servers --- vim.notify = function(msg, log_level) --- if msg:match "exit code" then --- return --- end --- if log_level == vim.log.levels.ERROR then --- vim.api.nvim_err_writeln(msg) --- else --- vim.api.nvim_echo({ { msg } }, true, {}) --- end --- end +local function markdown_format(input) + if input then + input = string.gsub(input, "%[([%a%$_]?[%.%w%(%),\\_%[%]%s :-]*)%]%(file:/[^%)]+%)", function(i1) + return "`" .. i1 .. "`" + end) + input = string.gsub(input, "%[([%a%$_]?[%.%w%(%),\\_%[%]%s :-]*)%]%(jdt://[^%)]+%)", function(i1) + return "`" .. i1 .. "`" + end) + end + return input +end + +local function split_lines(value) + value = string.gsub(value, "\r\n?", "\n") + return vim.split(value, "\n", { plain = true }) +end +local function convert_input_to_markdown_lines(input, contents) + contents = contents or {} + -- MarkedString variation 1 + if type(input) == "string" then + input = markdown_format(input) + vim.list_extend(contents, split_lines(input)) + else + assert(type(input) == "table", "Expected a table for Hover.contents") + -- MarkupContent + if input.kind then + -- The kind can be either plaintext or markdown. + -- If it's plaintext, then wrap it in a block + + -- Some servers send input.value as empty, so let's ignore this :( + local value = input.value or "" + + if input.kind == "plaintext" then + -- wrap this in a block so that stylize_markdown + -- can properly process it as plaintext + value = string.format("\n%s\n", value) + end + + -- assert(type(value) == 'string') + vim.list_extend(contents, split_lines(value)) + -- MarkupString variation 2 + elseif input.language then + -- Some servers send input.value as empty, so let's ignore this :( + -- assert(type(input.value) == 'string') + table.insert(contents, "```" .. input.language) + vim.list_extend(contents, split_lines(input.value or "")) + table.insert(contents, "```") + -- By deduction, this must be MarkedString[] + else + -- Use our existing logic to handle MarkedString + for _, marked_string in ipairs(input) do + convert_input_to_markdown_lines(marked_string, contents) + end + end + end + if (contents[1] == "" or contents[1] == nil) and #contents == 1 then + return {} + end + return contents +end + +local function jhover(_, result, ctx, c) + c = c or {} + c.focus_id = ctx.method + c.stylize_markdown = true + if not (result and result.contents) then + vim.notify("No information available") + return + end + local markdown_lines = convert_input_to_markdown_lines(result.contents) + markdown_lines = vim.lsp.util.trim_empty_lines(markdown_lines) + if vim.tbl_isempty(markdown_lines) then + vim.notify("No information available") + return + end + local b, w = vim.lsp.util.open_floating_preview(markdown_lines, "markdown", c) + return b, w +end + +vim.lsp.handlers["textDocument/hover"] = vim.lsp.with(jhover, lsp_ui.hover_actions) +local source = require("cmp_nvim_lsp.source") +source.resolve = function(self, completion_item, callback) + -- client is stopped. + if self.client.is_stopped() then + return callback() + end + + -- client has no completion capability. + if not self:_get(self.client.server_capabilities, { "completionProvider", "resolveProvider" }) then + return callback() + end + + self:_request("completionItem/resolve", completion_item, function(_, response) + -- print(vim.inspect(response)) + if response and response.documentation then + response.documentation.value = markdown_format(response.documentation.value) + end + -- print(vim.inspect(response)) + callback(response or completion_item) + end) +end diff --git a/lua/kide/lsp/java.lua b/lua/kide/lsp/java.lua index b293c317..fdb33ce3 100644 --- a/lua/kide/lsp/java.lua +++ b/lua/kide/lsp/java.lua @@ -364,116 +364,6 @@ config.handlers["language/status"] = function(_, s) end end -vim.lsp.handlers["$/progress"] = nil -require("fidget").setup({}) - -local function markdown_format(input) - if input then - -- input = string.gsub(input, "[\r\n]( +)(%*)", function (i1) - -- return i1 .. "-" - -- end) - input = string.gsub(input, "%[([%a%$_]?[%.%w%(%),\\_%[%]%s :]*)%]%(file:/[^%)]+%)", function(i1) - return "`" .. i1 .. "`" - end) - input = string.gsub(input, "%[([%a%$_]?[%.%w%(%),\\_%[%]%s :]*)%]%(jdt://[^%)]+%)", function(i1) - return "`" .. i1 .. "`" - end) - end - return input -end - -local function split_lines(value) - value = string.gsub(value, "\r\n?", "\n") - return vim.split(value, "\n", { plain = true }) -end -function M.convert_input_to_markdown_lines(input, contents) - contents = contents or {} - -- MarkedString variation 1 - if type(input) == "string" then - input = markdown_format(input) - vim.list_extend(contents, split_lines(input)) - else - assert(type(input) == "table", "Expected a table for Hover.contents") - -- MarkupContent - if input.kind then - -- The kind can be either plaintext or markdown. - -- If it's plaintext, then wrap it in a block - - -- Some servers send input.value as empty, so let's ignore this :( - local value = input.value or "" - - if input.kind == "plaintext" then - -- wrap this in a block so that stylize_markdown - -- can properly process it as plaintext - value = string.format("\n%s\n", value) - end - - -- assert(type(value) == 'string') - vim.list_extend(contents, split_lines(value)) - -- MarkupString variation 2 - elseif input.language then - -- Some servers send input.value as empty, so let's ignore this :( - -- assert(type(input.value) == 'string') - table.insert(contents, "```" .. input.language) - vim.list_extend(contents, split_lines(input.value or "")) - table.insert(contents, "```") - -- By deduction, this must be MarkedString[] - else - -- Use our existing logic to handle MarkedString - for _, marked_string in ipairs(input) do - M.convert_input_to_markdown_lines(marked_string, contents) - end - end - end - if (contents[1] == "" or contents[1] == nil) and #contents == 1 then - return {} - end - return contents -end - -local function jhover(_, result, ctx, c) - c = c or {} - c.focus_id = ctx.method - c.stylize_markdown = true - if not (result and result.contents) then - vim.notify("No information available") - return - end - local markdown_lines = M.convert_input_to_markdown_lines(result.contents) - markdown_lines = vim.lsp.util.trim_empty_lines(markdown_lines) - if vim.tbl_isempty(markdown_lines) then - vim.notify("No information available") - return - end - local b, w = vim.lsp.util.open_floating_preview(markdown_lines, "markdown", c) - -- vim.api.nvim_win_set_option(w, "winblend", 10) - return b, w -end - -local lsp_ui = require("kide.lsp.lsp_ui") -vim.lsp.handlers["textDocument/hover"] = vim.lsp.with(jhover, lsp_ui.hover_actions) -local source = require("cmp_nvim_lsp.source") -source.resolve = function(self, completion_item, callback) - -- client is stopped. - if self.client.is_stopped() then - return callback() - end - - -- client has no completion capability. - if not self:_get(self.client.server_capabilities, { "completionProvider", "resolveProvider" }) then - return callback() - end - - self:_request("completionItem/resolve", completion_item, function(_, response) - -- print(vim.inspect(response)) - if response and response.documentation then - response.documentation.value = markdown_format(response.documentation.value) - end - -- print(vim.inspect(response)) - callback(response or completion_item) - end) -end - M.start = function() jdtls.start_or_attach(config) end @@ -493,4 +383,5 @@ M.setup = function() end, }) end + return M From e39fa141bfadbb4d6cd37f647a1291befae567b7 Mon Sep 17 00:00:00 2001 From: luokai Date: Tue, 30 May 2023 16:06:35 +0800 Subject: [PATCH 0704/1278] codelldb --- lua/kide/dap/codelldb.lua | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/lua/kide/dap/codelldb.lua b/lua/kide/dap/codelldb.lua index ad8f25c8..62c6f8c9 100644 --- a/lua/kide/dap/codelldb.lua +++ b/lua/kide/dap/codelldb.lua @@ -2,7 +2,14 @@ local M = {} local vscode = require("kide.core.vscode") local utils = require("kide.core.utils") -- Update this path -M.extension_path = vscode.find_one("/vadimcn.vscode-lldb-*") +M.extension_path = (function() + local epath = vscode.find_one("/vadimcn.vscode-lldb-*") + if epath then + return epath + elseif require("mason-registry").has_package("codelldb") then + return require("mason-registry").get_package("codelldb"):get_install_path() + end +end)() M.codelldb_path = (function() if M.extension_path then if utils.is_win then From 9ff89ca89cb2c98d6e24857c580a9b743d3044ce Mon Sep 17 00:00:00 2001 From: luokai Date: Tue, 30 May 2023 16:11:37 +0800 Subject: [PATCH 0705/1278] extension --- lua/kide/dap/codelldb.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lua/kide/dap/codelldb.lua b/lua/kide/dap/codelldb.lua index 62c6f8c9..79e40af3 100644 --- a/lua/kide/dap/codelldb.lua +++ b/lua/kide/dap/codelldb.lua @@ -7,7 +7,7 @@ M.extension_path = (function() if epath then return epath elseif require("mason-registry").has_package("codelldb") then - return require("mason-registry").get_package("codelldb"):get_install_path() + return require("mason-registry").get_package("codelldb"):get_install_path() .. "/extension" end end)() M.codelldb_path = (function() From 521916e6415bd2066d5376ae9b2731455c569b6b Mon Sep 17 00:00:00 2001 From: luokai Date: Tue, 30 May 2023 21:55:49 +0800 Subject: [PATCH 0706/1278] clangd utf-16 --- lua/kide/lsp/init.lua | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/lua/kide/lsp/init.lua b/lua/kide/lsp/init.lua index 8d15f605..41955347 100644 --- a/lua/kide/lsp/init.lua +++ b/lua/kide/lsp/init.lua @@ -65,7 +65,12 @@ require("mason-lspconfig").setup_handlers({ scfg.flags = { debounce_text_changes = 150, } - scfg.capabilities = capabilities + if server_name == "clangd" then + scfg.capabilities = require("cmp_nvim_lsp").default_capabilities(vim.lsp.protocol.make_client_capabilities()) + scfg.capabilities.offsetEncoding = { "utf-16" } + else + scfg.capabilities = capabilities + end lspconfig[server_name].setup(scfg) end, }) From ab6fc22bde5652aa1a5933930a8e953bb73543a7 Mon Sep 17 00:00:00 2001 From: luokai Date: Tue, 30 May 2023 22:10:55 +0800 Subject: [PATCH 0707/1278] config lsp, nvim-web-devicons --- lua/kide/lsp/init.lua | 8 ++------ lua/kide/plugins/lazy-nvim.lua | 5 +---- 2 files changed, 3 insertions(+), 10 deletions(-) diff --git a/lua/kide/lsp/init.lua b/lua/kide/lsp/init.lua index 41955347..e68cabc2 100644 --- a/lua/kide/lsp/init.lua +++ b/lua/kide/lsp/init.lua @@ -27,8 +27,6 @@ local server_configs = { gdscript = require("kide.lsp.gdscript"), } --- Setup lspconfig. -local capabilities = require("cmp_nvim_lsp").default_capabilities(vim.lsp.protocol.make_client_capabilities()) -- 没有确定使用效果参数 -- capabilities.textDocument.completion.completionItem.snippetSupport = true local utils = require("kide.core.utils") @@ -65,11 +63,9 @@ require("mason-lspconfig").setup_handlers({ scfg.flags = { debounce_text_changes = 150, } + scfg.capabilities = require("cmp_nvim_lsp").default_capabilities(vim.lsp.protocol.make_client_capabilities()) if server_name == "clangd" then - scfg.capabilities = require("cmp_nvim_lsp").default_capabilities(vim.lsp.protocol.make_client_capabilities()) scfg.capabilities.offsetEncoding = { "utf-16" } - else - scfg.capabilities = capabilities end lspconfig[server_name].setup(scfg) end, @@ -81,7 +77,7 @@ for _, value in pairs(server_configs) do flags = { debounce_text_changes = 150, }, - capabilities = capabilities, + capabilities = require("cmp_nvim_lsp").default_capabilities(vim.lsp.protocol.make_client_capabilities()), on_attach = function(client, buffer) -- 绑定快捷键 require("kide.core.keybindings").maplsp(client, buffer) diff --git a/lua/kide/plugins/lazy-nvim.lua b/lua/kide/plugins/lazy-nvim.lua index 82f6dee6..f18f8f1c 100644 --- a/lua/kide/plugins/lazy-nvim.lua +++ b/lua/kide/plugins/lazy-nvim.lua @@ -8,10 +8,7 @@ require("lazy").setup({ }, { - "kyazdani42/nvim-web-devicons", - config = function() - require("nvim-web-devicons").setup({}) - end, + "nvim-tree/nvim-web-devicons", lazy = true, }, { From 97e26f895c2fd9490a66251b93f7e2b038b2169b Mon Sep 17 00:00:00 2001 From: luokai Date: Wed, 31 May 2023 09:51:08 +0800 Subject: [PATCH 0708/1278] telescope jdt --- lua/kide/plugins/config/telescope.lua | 18 +++--------------- 1 file changed, 3 insertions(+), 15 deletions(-) diff --git a/lua/kide/plugins/config/telescope.lua b/lua/kide/plugins/config/telescope.lua index 99bd5aea..aad67349 100644 --- a/lua/kide/plugins/config/telescope.lua +++ b/lua/kide/plugins/config/telescope.lua @@ -6,21 +6,8 @@ local telescope = require("telescope") local form_entry = require("telescope.from_entry") local f_path = form_entry.path form_entry.path = function(entry, validate, escape) - escape = vim.F.if_nil(escape, true) - local path - if escape then - path = entry.path and vim.fn.fnameescape(entry.path) or nil - else - path = entry.path - end - if path == nil then - path = entry.filename - end - if path == nil then - path = entry.value - end - if vim.startswith(path, "jdt://") then - return path + if entry.filename and vim.startswith(entry.filename, "jdt://") then + return entry.filename end return f_path(entry, validate, escape) end @@ -82,6 +69,7 @@ telescope.setup({ filetype_hook = function(filepath, bufnr, opts) if vim.startswith(filepath, "jdt://") then require("kide.lsp.utils.jdtls").open_classfile(filepath, bufnr, opts.preview.timeout) + return false; end return true end, From 0d8331c692bf7f2b4770337fd24c768520d48127 Mon Sep 17 00:00:00 2001 From: luokai Date: Wed, 31 May 2023 09:53:45 +0800 Subject: [PATCH 0709/1278] vim.lsp.buf.definition --- lua/kide/core/keybindings.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lua/kide/core/keybindings.lua b/lua/kide/core/keybindings.lua index 031bb753..51ba027c 100644 --- a/lua/kide/core/keybindings.lua +++ b/lua/kide/core/keybindings.lua @@ -148,7 +148,7 @@ M.maplsp = function(client, buffer) -- mapbuf('n', 'gd', 'lua vim.lsp.buf.definition()', opt) vim.api.nvim_buf_set_keymap(buffer, "n", "gD", "lua vim.lsp.buf.declaration()", opt) vim.api.nvim_buf_set_keymap(buffer, "n", "gt", "lua vim.lsp.buf.type_definition()", opt) - vim.api.nvim_buf_set_keymap(buffer, "n", "gd", "Telescope lsp_definitions", opt) + vim.api.nvim_buf_set_keymap(buffer, "n", "gd", "lua vim.lsp.buf.definition()", opt) vim.api.nvim_buf_set_keymap(buffer, "n", "gh", "lua vim.lsp.buf.hover()", opt) vim.api.nvim_buf_set_keymap(buffer, "n", "gs", "lua vim.lsp.buf.signature_help()", opt) -- mapbuf('n', 'gD', 'lua vim.lsp.buf.declaration()', opt) From 0db2502980784d5b15825f66cb33a6c56ee31eb9 Mon Sep 17 00:00:00 2001 From: luokai Date: Wed, 31 May 2023 10:08:00 +0800 Subject: [PATCH 0710/1278] =?UTF-8?q?jdk://=20=20file://=20=E8=BF=87?= =?UTF-8?q?=E6=BB=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lua/kide/lsp/init.lua | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/lua/kide/lsp/init.lua b/lua/kide/lsp/init.lua index e68cabc2..aeb60bbb 100644 --- a/lua/kide/lsp/init.lua +++ b/lua/kide/lsp/init.lua @@ -114,10 +114,11 @@ vim.lsp.handlers["textDocument/signatureHelp"] = vim.lsp.with(vim.lsp.handlers.s local function markdown_format(input) if input then - input = string.gsub(input, "%[([%a%$_]?[%.%w%(%),\\_%[%]%s :-]*)%]%(file:/[^%)]+%)", function(i1) + print(input) + input = string.gsub(input, "%[([^%]]*)%]%(file:/[^%)]+%)", function(i1) return "`" .. i1 .. "`" end) - input = string.gsub(input, "%[([%a%$_]?[%.%w%(%),\\_%[%]%s :-]*)%]%(jdt://[^%)]+%)", function(i1) + input = string.gsub(input, "%[([^%]]*)%]%(jdt://[^%)]+%)", function(i1) return "`" .. i1 .. "`" end) end From 032af0087fcdbd71566af8b87dd3ca040e197d15 Mon Sep 17 00:00:00 2001 From: luokai Date: Wed, 31 May 2023 10:34:03 +0800 Subject: [PATCH 0711/1278] support lsp --- lua/kide/core/keybindings.lua | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/lua/kide/core/keybindings.lua b/lua/kide/core/keybindings.lua index 51ba027c..c67db85f 100644 --- a/lua/kide/core/keybindings.lua +++ b/lua/kide/core/keybindings.lua @@ -148,7 +148,12 @@ M.maplsp = function(client, buffer) -- mapbuf('n', 'gd', 'lua vim.lsp.buf.definition()', opt) vim.api.nvim_buf_set_keymap(buffer, "n", "gD", "lua vim.lsp.buf.declaration()", opt) vim.api.nvim_buf_set_keymap(buffer, "n", "gt", "lua vim.lsp.buf.type_definition()", opt) - vim.api.nvim_buf_set_keymap(buffer, "n", "gd", "lua vim.lsp.buf.definition()", opt) + + if client.server_capabilities.definitionProvider then + vim.api.nvim_buf_set_keymap(buffer, "n", "gd", "Telescope lsp_definitions", opt) + else + vim.api.nvim_buf_set_keymap(buffer, "n", "gd", "lua vim.lsp.buf.definition()", opt) + end vim.api.nvim_buf_set_keymap(buffer, "n", "gh", "lua vim.lsp.buf.hover()", opt) vim.api.nvim_buf_set_keymap(buffer, "n", "gs", "lua vim.lsp.buf.signature_help()", opt) -- mapbuf('n', 'gD', 'lua vim.lsp.buf.declaration()', opt) From d7411e1f3c4c98dc2be4dbf9b4d16d7f52f7d601 Mon Sep 17 00:00:00 2001 From: luokai Date: Wed, 31 May 2023 14:19:43 +0800 Subject: [PATCH 0712/1278] update --- lua/kide/lsp/init.lua | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/lua/kide/lsp/init.lua b/lua/kide/lsp/init.lua index aeb60bbb..ddb9683d 100644 --- a/lua/kide/lsp/init.lua +++ b/lua/kide/lsp/init.lua @@ -114,11 +114,10 @@ vim.lsp.handlers["textDocument/signatureHelp"] = vim.lsp.with(vim.lsp.handlers.s local function markdown_format(input) if input then - print(input) - input = string.gsub(input, "%[([^%]]*)%]%(file:/[^%)]+%)", function(i1) + input = string.gsub(input, "%[([%a%$_]?[%.%w%(%),\\_%[%]%s :%-@]*)%]%(file:/[^%)]+%)", function(i1) return "`" .. i1 .. "`" end) - input = string.gsub(input, "%[([^%]]*)%]%(jdt://[^%)]+%)", function(i1) + input = string.gsub(input, "%[([%a%$_]?[%.%w%(%),\\_%[%]%s :%-@]*)%]%(jdt://[^%)]+%)", function(i1) return "`" .. i1 .. "`" end) end From c4e23d289e6163d352b49f7cf0f08346561f4c57 Mon Sep 17 00:00:00 2001 From: luokai Date: Wed, 31 May 2023 17:38:36 +0800 Subject: [PATCH 0713/1278] =?UTF-8?q?=E6=89=93=E5=BC=80=20jdt://=20?= =?UTF-8?q?=E4=BF=AE=E5=A4=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lua/kide/plugins/config/telescope.lua | 58 ++++++++++++++++++++++++++- 1 file changed, 57 insertions(+), 1 deletion(-) diff --git a/lua/kide/plugins/config/telescope.lua b/lua/kide/plugins/config/telescope.lua index aad67349..3515c24f 100644 --- a/lua/kide/plugins/config/telescope.lua +++ b/lua/kide/plugins/config/telescope.lua @@ -12,6 +12,62 @@ form_entry.path = function(entry, validate, escape) return f_path(entry, validate, escape) end +local utils = require("telescope.utils") +local set = require("telescope.actions.set") +local action_state = require("telescope.actions.state") +local l_edit = set.edit +set.edit = function(prompt_bufnr, command) + local entry = action_state.get_selected_entry() + + if not entry then + utils.notify("actions.set.edit", { + msg = "Nothing currently selected", + level = "WARN", + }) + return + end + + local filename, row, col + + filename = entry.path or entry.filename + if not vim.startswith(filename, "jdt://") then + l_edit(prompt_bufnr, command) + return + end + + row = entry.row or entry.lnum + col = vim.F.if_nil(entry.col, 1) + + local picker = action_state.get_current_picker(prompt_bufnr) + require("telescope.pickers").on_close_prompt(prompt_bufnr) + pcall(vim.api.nvim_set_current_win, picker.original_win_id) + local win_id = picker.get_selection_window(picker, entry) + + if picker.push_cursor_on_edit then + vim.cmd("normal! m'") + end + + if picker.push_tagstack_on_edit then + local from = { vim.fn.bufnr("%"), vim.fn.line("."), vim.fn.col("."), 0 } + local items = { { tagname = vim.fn.expand(""), from = from } } + vim.fn.settagstack(vim.fn.win_getid(), { items = items }, "t") + end + + if win_id ~= 0 and a.nvim_get_current_win() ~= win_id then + vim.api.nvim_set_current_win(win_id) + end + + if vim.api.nvim_buf_get_name(0) ~= filename or command ~= "edit" then + local bufnr = vim.uri_to_bufnr(filename) + vim.bo[bufnr].buflisted = true + vim.api.nvim_win_set_buf(win_id, bufnr) + end + + if row and col then + pcall(vim.api.nvim_win_set_cursor, 0, { row, col }) + end +end + telescope.setup({ defaults = { vimgrep_arguments = { @@ -69,7 +125,7 @@ telescope.setup({ filetype_hook = function(filepath, bufnr, opts) if vim.startswith(filepath, "jdt://") then require("kide.lsp.utils.jdtls").open_classfile(filepath, bufnr, opts.preview.timeout) - return false; + return false end return true end, From a56b01161d91a3804a250b153beba8f724d2bccb Mon Sep 17 00:00:00 2001 From: luokai Date: Thu, 1 Jun 2023 11:21:46 +0800 Subject: [PATCH 0714/1278] client.supports_method --- lua/kide/core/keybindings.lua | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/lua/kide/core/keybindings.lua b/lua/kide/core/keybindings.lua index c67db85f..53f6c4b6 100644 --- a/lua/kide/core/keybindings.lua +++ b/lua/kide/core/keybindings.lua @@ -132,9 +132,6 @@ M.setup = function() end -- lsp 回调函数快捷键设置 M.maplsp = function(client, buffer) - vim.api.nvim_buf_set_option(buffer, "omnifunc", "v:lua.vim.lsp.omnifunc") - vim.api.nvim_buf_set_option(buffer, "formatexpr", "v:lua.vim.lsp.formatexpr()") - local bufopts = { noremap = true, silent = true, buffer = buffer } vim.api.nvim_buf_set_keymap(buffer, "n", "K", "lua vim.lsp.buf.hover()", opt) -- rename @@ -149,7 +146,7 @@ M.maplsp = function(client, buffer) vim.api.nvim_buf_set_keymap(buffer, "n", "gD", "lua vim.lsp.buf.declaration()", opt) vim.api.nvim_buf_set_keymap(buffer, "n", "gt", "lua vim.lsp.buf.type_definition()", opt) - if client.server_capabilities.definitionProvider then + if client.supports_method("textDocument/definition") then vim.api.nvim_buf_set_keymap(buffer, "n", "gd", "Telescope lsp_definitions", opt) else vim.api.nvim_buf_set_keymap(buffer, "n", "gd", "lua vim.lsp.buf.definition()", opt) @@ -221,13 +218,12 @@ M.maplsp = function(client, buffer) opt ) -- >= 0.8.x - if client.server_capabilities.documentHighlightProvider then + if client.supports_method("textDocument/documentHighlightProvider") then vim.cmd(string.format("au CursorHold lua vim.lsp.buf.document_highlight()", buffer)) vim.cmd(string.format("au CursorHoldI lua vim.lsp.buf.document_highlight()", buffer)) vim.cmd(string.format("au CursorMoved lua vim.lsp.buf.clear_references()", buffer)) end - local codeLensProvider = client.server_capabilities.codeLensProvider - if codeLensProvider then + if client.supports_method("codeLens/resolve") then vim.api.nvim_buf_set_keymap(buffer, "n", "cr", "lua vim.lsp.codelens.refresh()", opt) vim.api.nvim_buf_set_keymap(buffer, "n", "ce", "lua vim.lsp.codelens.run()", opt) end From d97f3dea0e3585ef211f27c54f5a4e13560a17de Mon Sep 17 00:00:00 2001 From: luokai Date: Thu, 1 Jun 2023 11:43:50 +0800 Subject: [PATCH 0715/1278] cmp sorting --- lua/kide/plugins/config/nvim-cmp.lua | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/lua/kide/plugins/config/nvim-cmp.lua b/lua/kide/plugins/config/nvim-cmp.lua index 1f714a5e..707ad218 100644 --- a/lua/kide/plugins/config/nvim-cmp.lua +++ b/lua/kide/plugins/config/nvim-cmp.lua @@ -1,6 +1,32 @@ local lspkind = require("lspkind") local cmp = require("cmp") +local config = require("kide.config") + +local function sorting() + local comparators = { + -- Below is the default comparitor list and order for nvim-cmp + cmp.config.compare.offset, + -- cmp.config.compare.scopes, --this is commented in nvim-cmp too + cmp.config.compare.exact, + cmp.config.compare.score, + cmp.config.compare.recently_used, + cmp.config.compare.locality, + cmp.config.compare.kind, + cmp.config.compare.sort_text, + cmp.config.compare.length, + cmp.config.compare.order, + } + if config.plugin.copilot then + table.insert(comparators, 1, require("copilot_cmp.comparators").prioritize) + end + return { + priority_weight = 2, + comparators = comparators, + } +end + cmp.setup({ + sorting = sorting(), -- 指定 snippet 引擎 snippet = { expand = function(args) From 0dadc532a52e17dc7c67fbc175b25dfd83e2c2e2 Mon Sep 17 00:00:00 2001 From: luokai Date: Thu, 1 Jun 2023 11:44:36 +0800 Subject: [PATCH 0716/1278] update --- lua/kide/plugins/config/nvim-cmp.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lua/kide/plugins/config/nvim-cmp.lua b/lua/kide/plugins/config/nvim-cmp.lua index 707ad218..649edf59 100644 --- a/lua/kide/plugins/config/nvim-cmp.lua +++ b/lua/kide/plugins/config/nvim-cmp.lua @@ -16,7 +16,7 @@ local function sorting() cmp.config.compare.length, cmp.config.compare.order, } - if config.plugin.copilot then + if config.plugin.copilot.enable then table.insert(comparators, 1, require("copilot_cmp.comparators").prioritize) end return { From e56c5dc842aa4c6fe997440a35d4d9e9b830105e Mon Sep 17 00:00:00 2001 From: luokai Date: Thu, 1 Jun 2023 11:54:39 +0800 Subject: [PATCH 0717/1278] doc --- lua/kide/lsp/init.lua | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lua/kide/lsp/init.lua b/lua/kide/lsp/init.lua index ddb9683d..69fc020e 100644 --- a/lua/kide/lsp/init.lua +++ b/lua/kide/lsp/init.lua @@ -114,10 +114,10 @@ vim.lsp.handlers["textDocument/signatureHelp"] = vim.lsp.with(vim.lsp.handlers.s local function markdown_format(input) if input then - input = string.gsub(input, "%[([%a%$_]?[%.%w%(%),\\_%[%]%s :%-@]*)%]%(file:/[^%)]+%)", function(i1) + input = string.gsub(input, "%[([%a%$_]?[%.%w%(%),\\_%[%]%s :%-@\"]*)%]%(file:/[^%)]+%)", function(i1) return "`" .. i1 .. "`" end) - input = string.gsub(input, "%[([%a%$_]?[%.%w%(%),\\_%[%]%s :%-@]*)%]%(jdt://[^%)]+%)", function(i1) + input = string.gsub(input, "%[([%a%$_]?[%.%w%(%),\\_%[%]%s :%-@\"]*)%]%(jdt://[^%)]+%)", function(i1) return "`" .. i1 .. "`" end) end From 8d7c0fa6e2bddd74ab3f9dff7e8a2039299c38a4 Mon Sep 17 00:00:00 2001 From: luokai Date: Fri, 2 Jun 2023 09:56:26 +0800 Subject: [PATCH 0718/1278] assertj --- lua/kide/lsp/java.lua | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/lua/kide/lsp/java.lua b/lua/kide/lsp/java.lua index fdb33ce3..c9fa4e71 100644 --- a/lua/kide/lsp/java.lua +++ b/lua/kide/lsp/java.lua @@ -250,10 +250,11 @@ local config = { completion = { favoriteStaticMembers = { "org.junit.Assert.*", - "org.hamcrest.MatcherAssert.assertThat", - "org.hamcrest.Matchers.*", - "org.hamcrest.CoreMatchers.*", - "org.junit.jupiter.api.Assertions.*", + "org.assertj.core.api.Assertions.*", + -- "org.hamcrest.MatcherAssert.assertThat", + -- "org.hamcrest.Matchers.*", + -- "org.hamcrest.CoreMatchers.*", + -- "org.junit.jupiter.api.Assertions.*", "java.util.Objects.requireNonNull", "java.util.Objects.requireNonNullElse", "org.mockito.Mockito.*", From 573377359b54bde6c4fb3d74558a163c583e776a Mon Sep 17 00:00:00 2001 From: luokai Date: Fri, 2 Jun 2023 10:39:43 +0800 Subject: [PATCH 0719/1278] definitionProvider --- lua/kide/lsp/java.lua | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lua/kide/lsp/java.lua b/lua/kide/lsp/java.lua index c9fa4e71..b550d4ab 100644 --- a/lua/kide/lsp/java.lua +++ b/lua/kide/lsp/java.lua @@ -318,6 +318,8 @@ config["on_attach"] = function(client, buffer) -- Remove the option if you do not want that. require("jdtls").setup_dap({ hotcodereplace = "auto" }) require("jdtls.setup").add_commands() + -- TODO: 不知道为什么这个值一会有一会没有 + client.server_capabilities["definitionProvider"] = true require("kide.core.keybindings").maplsp(client, buffer) -- require('jdtls.dap').setup_dap_main_class_configs({ verbose = true }) local opts = { silent = true, buffer = buffer } From d897574f2219c949fd1680cee55a9227f26992cf Mon Sep 17 00:00:00 2001 From: luokai Date: Fri, 2 Jun 2023 10:48:21 +0800 Subject: [PATCH 0720/1278] nvim_buf_is_valid --- lua/kide/lsp/utils/jdtls.lua | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/lua/kide/lsp/utils/jdtls.lua b/lua/kide/lsp/utils/jdtls.lua index 11ed90aa..f9f618c4 100644 --- a/lua/kide/lsp/utils/jdtls.lua +++ b/lua/kide/lsp/utils/jdtls.lua @@ -78,9 +78,11 @@ function M.open_classfile(fname, buf, timeout_ms) local content local function handler(err, result) assert(not err, vim.inspect(err)) - content = result - api.nvim_buf_set_lines(buf, 0, -1, false, vim.split(result, "\n", { plain = true })) - vim.bo[buf].modifiable = false + if api.nvim_buf_is_valid(buf) then + content = result + api.nvim_buf_set_lines(buf, 0, -1, false, vim.split(result, "\n", { plain = true })) + vim.bo[buf].modifiable = false + end end if use_cmd then From e051ba9b53795f90f50739085170db4b97ee27f1 Mon Sep 17 00:00:00 2001 From: luokai Date: Fri, 2 Jun 2023 12:45:22 +0800 Subject: [PATCH 0721/1278] nvim_buf_is_valid --- lua/kide/lsp/utils/jdtls.lua | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/lua/kide/lsp/utils/jdtls.lua b/lua/kide/lsp/utils/jdtls.lua index f9f618c4..6f9d2fd7 100644 --- a/lua/kide/lsp/utils/jdtls.lua +++ b/lua/kide/lsp/utils/jdtls.lua @@ -85,6 +85,10 @@ function M.open_classfile(fname, buf, timeout_ms) end end + if not api.nvim_buf_is_valid(buf) then + return + end + if use_cmd then local command = { command = "java.decompile", From b5ea1e33374aa8d58b6240091048868e3b0ec909 Mon Sep 17 00:00:00 2001 From: luokai Date: Sun, 11 Jun 2023 11:01:52 +0800 Subject: [PATCH 0722/1278] =?UTF-8?q?null-ls=20=E5=BF=AB=E6=8D=B7=E9=94=AE?= =?UTF-8?q?=E7=BB=91=E5=AE=9A=E5=88=A4=E6=96=AD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lua/kide/core/keybindings.lua | 61 +++++++++++++---------------- lua/kide/lsp/init.lua | 4 +- lua/kide/plugins/config/null-ls.lua | 2 +- 3 files changed, 31 insertions(+), 36 deletions(-) diff --git a/lua/kide/core/keybindings.lua b/lua/kide/core/keybindings.lua index 53f6c4b6..bce397c4 100644 --- a/lua/kide/core/keybindings.lua +++ b/lua/kide/core/keybindings.lua @@ -131,7 +131,7 @@ M.setup = function() end, { desc = "Previous todo comment" }) end -- lsp 回调函数快捷键设置 -M.maplsp = function(client, buffer) +M.maplsp = function(client, buffer, null_ls) local bufopts = { noremap = true, silent = true, buffer = buffer } vim.api.nvim_buf_set_keymap(buffer, "n", "K", "lua vim.lsp.buf.hover()", opt) -- rename @@ -141,38 +141,6 @@ M.maplsp = function(client, buffer) vim.api.nvim_buf_set_keymap(buffer, "n", "ca", "lua vim.lsp.buf.code_action()", opt) vim.api.nvim_buf_set_keymap(buffer, "v", "ca", "lua vim.lsp.buf.code_action()", opt) -- mapbuf('n', 'ca', 'lua require("lspsaga.codeaction").code_action()', opt) - -- go xx - -- mapbuf('n', 'gd', 'lua vim.lsp.buf.definition()', opt) - vim.api.nvim_buf_set_keymap(buffer, "n", "gD", "lua vim.lsp.buf.declaration()", opt) - vim.api.nvim_buf_set_keymap(buffer, "n", "gt", "lua vim.lsp.buf.type_definition()", opt) - - if client.supports_method("textDocument/definition") then - vim.api.nvim_buf_set_keymap(buffer, "n", "gd", "Telescope lsp_definitions", opt) - else - vim.api.nvim_buf_set_keymap(buffer, "n", "gd", "lua vim.lsp.buf.definition()", opt) - end - vim.api.nvim_buf_set_keymap(buffer, "n", "gh", "lua vim.lsp.buf.hover()", opt) - vim.api.nvim_buf_set_keymap(buffer, "n", "gs", "lua vim.lsp.buf.signature_help()", opt) - -- mapbuf('n', 'gD', 'lua vim.lsp.buf.declaration()', opt) - -- mapbuf('n', 'gD', 'lua vim.lsp.buf.type_definition()', opt) - -- vim.api.nvim_buf_set_keymap(bufnr, "n", "gD", "Trouble lsp_type_definitions", opt) - -- mapbuf('n', 'gi', 'lua vim.lsp.buf.implementation()', opt) - -- vim.api.nvim_buf_set_keymap(bufnr, "n", "gi", "Trouble lsp_implementations", opt) - vim.api.nvim_buf_set_keymap(buffer, "n", "gi", "Telescope lsp_implementations", opt) - -- mapbuf('n', 'gr', 'lua vim.lsp.buf.references()', opt) - -- vim.api.nvim_buf_set_keymap(bufnr, "n", "gr", "Trouble lsp_references", opt) - vim.api.nvim_buf_set_keymap(buffer, "n", "gr", "Telescope lsp_references", opt) - -- mapbuf('n', 'gr', 'lua require"lspsaga.provider".lsp_finder()', opt) - -- mapbuf('n', 's', 'lua vim.lsp.buf.workspace_symbol()', opt) - -- mapbuf('n', 's', 'lua require"telescope.builtin".lsp_workspace_symbols({ query = vim.fn.input("Query> ") })', opt) - vim.api.nvim_buf_set_keymap(buffer, "n", "fs", "Telescope lsp_dynamic_workspace_symbols", opt) - keymap("v", "fs", function() - local tb = require("telescope.builtin") - local text = require("kide.core.utils").get_visual_selection() - tb.lsp_workspace_symbols({ default_text = text, query = text }) - end, opt) - - vim.api.nvim_buf_set_keymap(buffer, "n", "fo", "Telescope lsp_document_symbols", opt) -- diagnostic vim.api.nvim_buf_set_keymap(buffer, "n", "go", "lua vim.diagnostic.open_float()", opt) vim.api.nvim_buf_set_keymap(buffer, "n", "[g", "lua vim.diagnostic.goto_prev()", opt) @@ -217,6 +185,33 @@ M.maplsp = function(client, buffer) "lua require('telescope.builtin').diagnostics({ severity = vim.diagnostic.severity.ERROR })", opt ) + + -- -------- null_ls 不支持快捷键不绑定 ------------------------------- + if null_ls then + return + end + -- go xx + -- mapbuf('n', 'gd', 'lua vim.lsp.buf.definition()', opt) + vim.api.nvim_buf_set_keymap(buffer, "n", "gD", "lua vim.lsp.buf.declaration()", opt) + vim.api.nvim_buf_set_keymap(buffer, "n", "gt", "lua vim.lsp.buf.type_definition()", opt) + + if client.supports_method("textDocument/definition") then + vim.api.nvim_buf_set_keymap(buffer, "n", "gd", "Telescope lsp_definitions", opt) + else + vim.api.nvim_buf_set_keymap(buffer, "n", "gd", "lua vim.lsp.buf.definition()", opt) + end + vim.api.nvim_buf_set_keymap(buffer, "n", "gh", "lua vim.lsp.buf.hover()", opt) + vim.api.nvim_buf_set_keymap(buffer, "n", "gs", "lua vim.lsp.buf.signature_help()", opt) + vim.api.nvim_buf_set_keymap(buffer, "n", "gi", "Telescope lsp_implementations", opt) + vim.api.nvim_buf_set_keymap(buffer, "n", "gr", "Telescope lsp_references", opt) + vim.api.nvim_buf_set_keymap(buffer, "n", "fs", "Telescope lsp_dynamic_workspace_symbols", opt) + keymap("v", "fs", function() + local tb = require("telescope.builtin") + local text = require("kide.core.utils").get_visual_selection() + tb.lsp_workspace_symbols({ default_text = text, query = text }) + end, opt) + + vim.api.nvim_buf_set_keymap(buffer, "n", "fo", "Telescope lsp_document_symbols", opt) -- >= 0.8.x if client.supports_method("textDocument/documentHighlightProvider") then vim.cmd(string.format("au CursorHold lua vim.lsp.buf.document_highlight()", buffer)) diff --git a/lua/kide/lsp/init.lua b/lua/kide/lsp/init.lua index 69fc020e..6321a360 100644 --- a/lua/kide/lsp/init.lua +++ b/lua/kide/lsp/init.lua @@ -114,10 +114,10 @@ vim.lsp.handlers["textDocument/signatureHelp"] = vim.lsp.with(vim.lsp.handlers.s local function markdown_format(input) if input then - input = string.gsub(input, "%[([%a%$_]?[%.%w%(%),\\_%[%]%s :%-@\"]*)%]%(file:/[^%)]+%)", function(i1) + input = string.gsub(input, '%[([%a%$_]?[%.%w%(%),\\_%[%]%s :%-@"]*)%]%(file:/[^%)]+%)', function(i1) return "`" .. i1 .. "`" end) - input = string.gsub(input, "%[([%a%$_]?[%.%w%(%),\\_%[%]%s :%-@\"]*)%]%(jdt://[^%)]+%)", function(i1) + input = string.gsub(input, '%[([%a%$_]?[%.%w%(%),\\_%[%]%s :%-@"]*)%]%(jdt://[^%)]+%)', function(i1) return "`" .. i1 .. "`" end) end diff --git a/lua/kide/plugins/config/null-ls.lua b/lua/kide/plugins/config/null-ls.lua index fb84773d..02699582 100644 --- a/lua/kide/plugins/config/null-ls.lua +++ b/lua/kide/plugins/config/null-ls.lua @@ -129,7 +129,7 @@ end null_ls.setup({ sources = sources, on_attach = function(client, bufnr) - require("kide.core.keybindings").maplsp(client, bufnr) + require("kide.core.keybindings").maplsp(client, bufnr, true) -- on_attach(client, bufnr) end, -- debug = true, From 7805fae510f15c5954d35164c3633b236d005e5d Mon Sep 17 00:00:00 2001 From: luokai Date: Mon, 12 Jun 2023 09:42:03 +0800 Subject: [PATCH 0723/1278] fidget --- lua/kide/lsp/init.lua | 1 - lua/kide/plugins/lazy-nvim.lua | 2 ++ 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/lua/kide/lsp/init.lua b/lua/kide/lsp/init.lua index 6321a360..8738ce96 100644 --- a/lua/kide/lsp/init.lua +++ b/lua/kide/lsp/init.lua @@ -32,7 +32,6 @@ local server_configs = { local utils = require("kide.core.utils") -- LSP 进度UI -require("fidget") require("mason-lspconfig").setup_handlers({ -- The first entry (without a key) will be the default handler -- and will be called for each installed server that doesn't have diff --git a/lua/kide/plugins/lazy-nvim.lua b/lua/kide/plugins/lazy-nvim.lua index f18f8f1c..b9ee66bb 100644 --- a/lua/kide/plugins/lazy-nvim.lua +++ b/lua/kide/plugins/lazy-nvim.lua @@ -580,6 +580,8 @@ require("lazy").setup({ { "j-hui/fidget.nvim", lazy = true, + tag = "legacy", + event = "VeryLazy", config = function() require("fidget").setup({ text = { From 326a6dfb8593be0cd98685965ee6f96eebe4edb0 Mon Sep 17 00:00:00 2001 From: luokai Date: Sat, 17 Jun 2023 22:29:57 +0800 Subject: [PATCH 0724/1278] vim.uv --- lua/lazy_bootstrap.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lua/lazy_bootstrap.lua b/lua/lazy_bootstrap.lua index d14f916e..83b6b8e5 100644 --- a/lua/lazy_bootstrap.lua +++ b/lua/lazy_bootstrap.lua @@ -1,5 +1,5 @@ local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim" -if not vim.loop.fs_stat(lazypath) then +if not vim.uv.fs_stat(lazypath) then vim.fn.system({ "git", "clone", From c1d90b6766f059f31b0a877e28c21c67746ca728 Mon Sep 17 00:00:00 2001 From: luokai Date: Sat, 17 Jun 2023 22:33:32 +0800 Subject: [PATCH 0725/1278] vim.uv --- lua/kide/core/utils/plantuml.lua | 2 +- lua/kide/core/vscode/init.lua | 2 +- lua/kide/dap/codelldb.lua | 8 ++++---- lua/kide/lsp/java.lua | 2 +- lua/kide/plugins/config/pandoc.lua | 2 +- 5 files changed, 8 insertions(+), 8 deletions(-) diff --git a/lua/kide/core/utils/plantuml.lua b/lua/kide/core/utils/plantuml.lua index 0cec7a82..c1fd2bbf 100644 --- a/lua/kide/core/utils/plantuml.lua +++ b/lua/kide/core/utils/plantuml.lua @@ -1,4 +1,4 @@ -local uv = vim.loop +local uv = vim.uv local utils = require("kide.core.utils") local plantuml_args_complete = utils.command_args_complete local M = {} diff --git a/lua/kide/core/vscode/init.lua b/lua/kide/core/vscode/init.lua index 6604f08f..4a30e561 100644 --- a/lua/kide/core/vscode/init.lua +++ b/lua/kide/core/vscode/init.lua @@ -1,6 +1,6 @@ local M = {} local env = { - HOME = vim.loop.os_homedir(), + HOME = vim.uv.os_homedir(), VSCODE_EXTENSIONS = vim.env["VSCODE_EXTENSIONS"], } M.get_vscode_extensions = function() diff --git a/lua/kide/dap/codelldb.lua b/lua/kide/dap/codelldb.lua index 79e40af3..c60a8af3 100644 --- a/lua/kide/dap/codelldb.lua +++ b/lua/kide/dap/codelldb.lua @@ -46,22 +46,22 @@ M.setup = function(config) local dap = require("dap") dap.adapters.codelldb = function(on_adapter) -- This asks the system for a free port - local tcp = vim.loop.new_tcp() + local tcp = vim.uv.new_tcp() tcp:bind("127.0.0.1", 0) local port = tcp:getsockname().port tcp:shutdown() tcp:close() -- Start codelldb with the port - local stdout = vim.loop.new_pipe(false) - local stderr = vim.loop.new_pipe(false) + local stdout = vim.uv.new_pipe(false) + local stderr = vim.uv.new_pipe(false) local opts = { stdio = { nil, stdout, stderr }, args = { "--liblldb", M.liblldb_path, "--port", tostring(port) }, } local handle local pid_or_err - handle, pid_or_err = vim.loop.spawn(M.config.codelldb_path, opts, function(code) + handle, pid_or_err = vim.uv.spawn(M.config.codelldb_path, opts, function(code) stdout:close() stderr:close() handle:close() diff --git a/lua/kide/lsp/java.lua b/lua/kide/lsp/java.lua index b550d4ab..2458a520 100644 --- a/lua/kide/lsp/java.lua +++ b/lua/kide/lsp/java.lua @@ -1,6 +1,6 @@ local M = {} local env = { - HOME = vim.loop.os_homedir(), + HOME = vim.uv.os_homedir(), JAVA_HOME = vim.env["JAVA_HOME"], JDTLS_RUN_JAVA = vim.env["JDTLS_RUN_JAVA"], JDTLS_HOME = vim.env["JDTLS_HOME"], diff --git a/lua/kide/plugins/config/pandoc.lua b/lua/kide/plugins/config/pandoc.lua index e22bbfca..3de0341e 100644 --- a/lua/kide/plugins/config/pandoc.lua +++ b/lua/kide/plugins/config/pandoc.lua @@ -5,7 +5,7 @@ require("pandoc").setup({ }, }) -local uv = vim.loop +local uv = vim.uv require("pandoc.process").spawn = function(bin, args, callback) local stdout = uv.new_pipe(false) local stderr = uv.new_pipe(false) From bdc902a5e7bc60f0d36f4119c62bacb0d2714aea Mon Sep 17 00:00:00 2001 From: luokai Date: Sat, 17 Jun 2023 22:36:24 +0800 Subject: [PATCH 0726/1278] del --- lua/kide/core/vscode/init.lua | 1 - 1 file changed, 1 deletion(-) diff --git a/lua/kide/core/vscode/init.lua b/lua/kide/core/vscode/init.lua index 4a30e561..e3d71896 100644 --- a/lua/kide/core/vscode/init.lua +++ b/lua/kide/core/vscode/init.lua @@ -1,6 +1,5 @@ local M = {} local env = { - HOME = vim.uv.os_homedir(), VSCODE_EXTENSIONS = vim.env["VSCODE_EXTENSIONS"], } M.get_vscode_extensions = function() From 6824317f1204d22eb2cf0b653d0adb486e5710c2 Mon Sep 17 00:00:00 2001 From: luokai Date: Fri, 23 Jun 2023 21:39:03 +0800 Subject: [PATCH 0727/1278] cmp-dap --- lua/kide/plugins/config/nvim-cmp.lua | 9 +++++++++ lua/kide/plugins/lazy-nvim.lua | 6 +++++- 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/lua/kide/plugins/config/nvim-cmp.lua b/lua/kide/plugins/config/nvim-cmp.lua index 649edf59..74c0bbb5 100644 --- a/lua/kide/plugins/config/nvim-cmp.lua +++ b/lua/kide/plugins/config/nvim-cmp.lua @@ -26,6 +26,9 @@ local function sorting() end cmp.setup({ + enabled = function() + return vim.api.nvim_buf_get_option(0, "buftype") ~= "prompt" or require("cmp_dap").is_dap_buffer() + end, sorting = sorting(), -- 指定 snippet 引擎 snippet = { @@ -100,3 +103,9 @@ cmp.setup.cmdline(":", { { name = "cmdline" }, }), }) + +cmp.setup.filetype({ "dap-repl", "dapui_watches", "dapui_hover" }, { + sources = { + { name = "dap" }, + }, +}) diff --git a/lua/kide/plugins/lazy-nvim.lua b/lua/kide/plugins/lazy-nvim.lua index b9ee66bb..fd6021b6 100644 --- a/lua/kide/plugins/lazy-nvim.lua +++ b/lua/kide/plugins/lazy-nvim.lua @@ -78,6 +78,7 @@ require("lazy").setup({ "hrsh7th/cmp-cmdline", "saadparwaiz1/cmp_luasnip", "onsails/lspkind-nvim", + "rcarriga/cmp-dap", }, lazy = true, config = function() @@ -100,7 +101,10 @@ require("lazy").setup({ "hrsh7th/cmp-path", lazy = true, }, - + { + "rcarriga/cmp-dap", + lazy = true, + }, { "jose-elias-alvarez/null-ls.nvim", lazy = true, From 3e91e48fd74cfddffe0a04f388f51c5f83f3f4f6 Mon Sep 17 00:00:00 2001 From: luokai Date: Fri, 23 Jun 2023 22:17:22 +0800 Subject: [PATCH 0728/1278] codelldb --- lua/kide/dap/codelldb.lua | 75 +++++++-------------------------------- lua/kide/dap/init.lua | 7 +--- 2 files changed, 14 insertions(+), 68 deletions(-) diff --git a/lua/kide/dap/codelldb.lua b/lua/kide/dap/codelldb.lua index c60a8af3..48493449 100644 --- a/lua/kide/dap/codelldb.lua +++ b/lua/kide/dap/codelldb.lua @@ -31,71 +31,22 @@ M.liblldb_path = (function() end end)() -M.config = {} - -M.setup = function(config) +M.setup = function() if not M.extension_path then vim.notify("codelldb not found", vim.log.levels.WARN) return false end - M.config.codelldb_path = M.codelldb_path - -- M.config.liblldb_path = extension_path .. "/lldb/lib/liblldb.dylib" - if config then - M.config = vim.tbl_deep_extend("force", M.config, config) - end local dap = require("dap") - dap.adapters.codelldb = function(on_adapter) - -- This asks the system for a free port - local tcp = vim.uv.new_tcp() - tcp:bind("127.0.0.1", 0) - local port = tcp:getsockname().port - tcp:shutdown() - tcp:close() - - -- Start codelldb with the port - local stdout = vim.uv.new_pipe(false) - local stderr = vim.uv.new_pipe(false) - local opts = { - stdio = { nil, stdout, stderr }, - args = { "--liblldb", M.liblldb_path, "--port", tostring(port) }, - } - local handle - local pid_or_err - handle, pid_or_err = vim.uv.spawn(M.config.codelldb_path, opts, function(code) - stdout:close() - stderr:close() - handle:close() - if code ~= 0 then - print("codelldb exited with code", code) - end - end) - if not handle then - vim.notify("Error running codelldb: " .. tostring(pid_or_err), vim.log.levels.ERROR) - stdout:close() - stderr:close() - return - end - vim.notify("codelldb started. pid=" .. pid_or_err) - stderr:read_start(function(err, chunk) - assert(not err, err) - if chunk then - vim.schedule(function() - require("dap.repl").append(chunk) - end) - end - end) - local adapter = { - type = "server", - host = "127.0.0.1", - port = port, - } - -- 💀 - -- Wait for codelldb to get ready and start listening before telling nvim-dap to connect - -- If you get connect errors, try to increase 500 to a higher value, or check the stderr (Open the REPL) - vim.defer_fn(function() - on_adapter(adapter) - end, 500) - end + dap.adapters.codelldb = { + type = "server", + port = "${port}", + executable = { + command = M.codelldb_path, + args = { "--liblldb", M.liblldb_path, "--port", "${port}" }, + -- On windows you may have to uncomment this: + -- detached = false, + }, + } dap.configurations.cpp = { { @@ -106,11 +57,11 @@ M.setup = function(config) return vim.fn.input("Path to executable: ", vim.fn.getcwd() .. "/", "file") end, cwd = "${workspaceFolder}", - stopOnEntry = true, + stopOnEntry = false, }, } dap.configurations.c = dap.configurations.cpp - dap.configurations.rust = dap.configurations.cpp + -- dap.configurations.rust = dap.configurations.cpp return true end return M diff --git a/lua/kide/dap/init.lua b/lua/kide/dap/init.lua index 180f9ee1..610267e0 100644 --- a/lua/kide/dap/init.lua +++ b/lua/kide/dap/init.lua @@ -1,9 +1,4 @@ -vim.api.nvim_create_user_command("CodelldbLoad", function() - if not vim.g.codelldb_load then - vim.g.codelldb_load = require("kide.dap.codelldb").setup() - end -end, {}) - +require("kide.dap.codelldb").setup() vim.fn.sign_define("DapBreakpoint", { text = "", texthl = "Debug", linehl = "", numhl = "" }) -- vim.fn.sign_define('DapBreakpoint', { text = '🔴', texthl = '', linehl = '', numhl = '' }) -- vim.fn.sign_define("DapBreakpointCondition", { text = "C", texthl = "", linehl = "", numhl = "" }) From 56bec6cda9425d470cd6b0d2023f645cd420d684 Mon Sep 17 00:00:00 2001 From: luokai Date: Fri, 23 Jun 2023 23:07:52 +0800 Subject: [PATCH 0729/1278] nvim-gdb --- lua/kide/plugins/lazy-nvim.lua | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/lua/kide/plugins/lazy-nvim.lua b/lua/kide/plugins/lazy-nvim.lua index fd6021b6..c2ae4653 100644 --- a/lua/kide/plugins/lazy-nvim.lua +++ b/lua/kide/plugins/lazy-nvim.lua @@ -235,6 +235,24 @@ require("lazy").setup({ require("dap-python").setup(config.env.py_bin) end, }, + { + "sakhnik/nvim-gdb", + lazy = true, + cmd = { + "GdbStart", + "GdbStartLLDB", + "GdbStartPDB", + "GdbStartBashDB", + "GdbStartRR", + }, + init = function() + vim.g.nvimgdb_disable_start_keymaps = 1 + vim.g.nvimgdb_use_find_executables = 0 + vim.g.nvimgdb_use_cmake_to_find_executables = 0 + end, + config = function() end, + build = ":!./install.sh", + }, -- 搜索插件 { From c3a48deebdc3913a6ac03733ac7296f5041da307 Mon Sep 17 00:00:00 2001 From: luokai Date: Sun, 25 Jun 2023 12:01:33 +0800 Subject: [PATCH 0730/1278] del tt --- lua/kide/core/basic.lua | 11 ----------- lua/kide/core/keybindings.lua | 2 +- 2 files changed, 1 insertion(+), 12 deletions(-) diff --git a/lua/kide/core/basic.lua b/lua/kide/core/basic.lua index 7dfe3f18..5eb814e3 100644 --- a/lua/kide/core/basic.lua +++ b/lua/kide/core/basic.lua @@ -206,17 +206,6 @@ autocmd({ "BufReadCmd" }, { end, }) --- toggle_term -autocmd("FileType", { - group = augroup("toggle_term"), - pattern = { - "toggleterm", - }, - callback = function(event) - vim.bo[event.buf].buflisted = false - vim.keymap.set("n", "tt", ":ToggleTerm", { buffer = event.buf, silent = true }) - end, -}) autocmd("FileType", { group = augroup("gitcommit"), diff --git a/lua/kide/core/keybindings.lua b/lua/kide/core/keybindings.lua index bce397c4..45536d2c 100644 --- a/lua/kide/core/keybindings.lua +++ b/lua/kide/core/keybindings.lua @@ -47,7 +47,7 @@ M.setup = function() map("t", "", ":ToggleTerm", opt) map("n", "tt", ":ToggleTerm", opt) map("v", "tt", ":ToggleTermSendVisualSelection", opt) - map("t", "tt", ":ToggleTerm", opt) + -- map("t", "tt", ":ToggleTerm", opt) -- symbols-outline.nvim map("n", "o", ":SymbolsOutline", opt) From 896dd9ee1a74868b1433d46eff46bb7315da84ce Mon Sep 17 00:00:00 2001 From: luokai Date: Sun, 25 Jun 2023 21:48:48 +0800 Subject: [PATCH 0731/1278] junit --- lua/kide/lsp/java.lua | 2 + lua/kide/lsp/utils/jdtls.lua | 77 ++++++++++++++++++++++++++++++++++++ 2 files changed, 79 insertions(+) diff --git a/lua/kide/lsp/java.lua b/lua/kide/lsp/java.lua index 2458a520..cc3044e8 100644 --- a/lua/kide/lsp/java.lua +++ b/lua/kide/lsp/java.lua @@ -371,7 +371,9 @@ M.start = function() jdtls.start_or_attach(config) end + M.setup = function() + require('kide.lsp.utils.jdtls').customize_jdtls() local group = vim.api.nvim_create_augroup("kide_jdtls_java", { clear = true }) vim.api.nvim_create_autocmd({ "FileType" }, { group = group, diff --git a/lua/kide/lsp/utils/jdtls.lua b/lua/kide/lsp/utils/jdtls.lua index 6f9d2fd7..d3e8ecb4 100644 --- a/lua/kide/lsp/utils/jdtls.lua +++ b/lua/kide/lsp/utils/jdtls.lua @@ -107,4 +107,81 @@ function M.open_classfile(fname, buf, timeout_ms) return content ~= nil end) end + +M.customize_jdtls = function() + local function mk_buf_loop(sock, handle_buffer) + local buffer = "" + return function(err, chunk) + assert(not err, err) + if chunk then + buffer = buffer .. chunk + else + sock:close() + handle_buffer(buffer) + end + end + end + + -- 零时修改等上游修复后删除 + -- @see https://github.com/mfussenegger/nvim-jdtls/blob/master/lua/jdtls/junit.lua + local junit = require("jdtls.junit") + junit.mk_test_results = function(bufnr) + local tests = {} + local handle_buffer = function(buf) + junit.__parse(buf, tests) + end + return { + show = function() + local items = {} + local repl = require("dap.repl") + local num_failures = 0 + for _, test in ipairs(tests) do + if test.failed then + num_failures = num_failures + 1 + if test.method then + repl.append(" " .. test.method, "$") + end + for _, msg in ipairs(test.traces) do + local match = msg:match(string.format("at %s.%s", test.fq_class, test.method) .. "%(([%a%p]*:%d+)%)") + if match then + local lnum = vim.split(match, ":")[2] + local trace = table.concat(test.traces, "\n") + if #trace > 140 then + trace = trace:sub(1, 140) .. "..." + end + table.insert(items, { + bufnr = bufnr, + lnum = lnum, + text = test.method .. " " .. trace, + }) + end + repl.append(msg, "$") + end + else + repl.append(" " .. test.method, "$") + end + end + + if num_failures > 0 then + vim.fn.setqflist({}, "r", { + title = "jdtls-tests", + items = items, + }) + print( + "Tests finished. Results printed to dap-repl.", + #items > 0 and "Errors added to quickfix list" or "", + string.format("( %d / %d)", num_failures, #tests) + ) + else + print("Tests finished. Results printed to dap-repl. All", #tests, "succeeded") + end + return items + end, + mk_reader = function(sock) + return vim.schedule_wrap(mk_buf_loop(sock, handle_buffer)) + end, + } + end +end + return M From 25aa42dd43de1dd5e47b55117612533c0523588c Mon Sep 17 00:00:00 2001 From: luokai Date: Wed, 28 Jun 2023 11:16:09 +0800 Subject: [PATCH 0732/1278] inlayhints --- lua/kide/lsp/init.lua | 2 ++ lua/kide/lsp/java.lua | 16 +++++++++++----- lua/kide/lsp/rust_analyzer.lua | 1 + lua/kide/plugins/lazy-nvim.lua | 9 +++++++++ 4 files changed, 23 insertions(+), 5 deletions(-) diff --git a/lua/kide/lsp/init.lua b/lua/kide/lsp/init.lua index 8738ce96..8a0f8f21 100644 --- a/lua/kide/lsp/init.lua +++ b/lua/kide/lsp/init.lua @@ -52,6 +52,7 @@ require("mason-lspconfig").setup_handlers({ scfg.on_attach = function(client, buffer) -- 绑定快捷键 require("kide.core.keybindings").maplsp(client, buffer) + require("lsp-inlayhints").on_attach(client, buffer) if client.server_capabilities.documentSymbolProvider then require("nvim-navic").attach(client, buffer) end @@ -80,6 +81,7 @@ for _, value in pairs(server_configs) do on_attach = function(client, buffer) -- 绑定快捷键 require("kide.core.keybindings").maplsp(client, buffer) + require("lsp-inlayhints").on_attach(client, buffer) if client.server_capabilities.documentSymbolProvider then require("nvim-navic").attach(client, buffer) end diff --git a/lua/kide/lsp/java.lua b/lua/kide/lsp/java.lua index cc3044e8..a3ed10e4 100644 --- a/lua/kide/lsp/java.lua +++ b/lua/kide/lsp/java.lua @@ -216,6 +216,9 @@ local config = { "**/.git/**", }, }, + inlayhints = { + parameterNames = { enabled = true }, + }, autobuild = { enabled = true }, referenceCodeLens = { enabled = true }, implementationsCodeLens = { enabled = true }, @@ -340,6 +343,7 @@ config["on_attach"] = function(client, buffer) -- end require("nvim-navic").attach(client, buffer) + require("lsp-inlayhints").on_attach(client, buffer) require("java-deps").attach(client, buffer, root_dir) create_command(buffer, "JavaProjects", require("java-deps").toggle_outline, { nargs = 0, @@ -358,6 +362,9 @@ local capabilities = require("cmp_nvim_lsp").default_capabilities(vim.lsp.protoc -- } config.capabilities = capabilities +config.flags = { + debounce_text_changes = 150, +} config.handlers = {} config.handlers["language/status"] = function(_, s) -- 使用 progress 查看状态 @@ -367,13 +374,12 @@ config.handlers["language/status"] = function(_, s) end end -M.start = function() +M.start = function(_opts) jdtls.start_or_attach(config) end - -M.setup = function() - require('kide.lsp.utils.jdtls').customize_jdtls() +M.setup = function(opts) + require("kide.lsp.utils.jdtls").customize_jdtls() local group = vim.api.nvim_create_augroup("kide_jdtls_java", { clear = true }) vim.api.nvim_create_autocmd({ "FileType" }, { group = group, @@ -383,7 +389,7 @@ M.setup = function() if e.file == "java" and vim.bo[e.buf].buftype == "nofile" then -- ignore else - M.start() + M.start(opts) end end, }) diff --git a/lua/kide/lsp/rust_analyzer.lua b/lua/kide/lsp/rust_analyzer.lua index 0b480686..1c5ac30d 100644 --- a/lua/kide/lsp/rust_analyzer.lua +++ b/lua/kide/lsp/rust_analyzer.lua @@ -11,6 +11,7 @@ local config = { }, tools = { inlay_hints = { + auto = false, parameter_hints_prefix = " ", other_hints_prefix = " ", }, diff --git a/lua/kide/plugins/lazy-nvim.lua b/lua/kide/plugins/lazy-nvim.lua index c2ae4653..889ef8da 100644 --- a/lua/kide/plugins/lazy-nvim.lua +++ b/lua/kide/plugins/lazy-nvim.lua @@ -706,6 +706,15 @@ require("lazy").setup({ end, }, + -- lsp-inlayhints + { + "lvimuser/lsp-inlayhints.nvim", + lazy = true, + config = function() + require("lsp-inlayhints").setup() + end, + }, + -- 笔记 { "mickael-menu/zk-nvim", From 08676f22f1d7251ca6f6ce13b664468a775b4834 Mon Sep 17 00:00:00 2001 From: luokai Date: Wed, 28 Jun 2023 12:30:37 +0800 Subject: [PATCH 0733/1278] TODO --- lua/kide/plugins/lazy-nvim.lua | 1 + 1 file changed, 1 insertion(+) diff --git a/lua/kide/plugins/lazy-nvim.lua b/lua/kide/plugins/lazy-nvim.lua index 889ef8da..f996ce01 100644 --- a/lua/kide/plugins/lazy-nvim.lua +++ b/lua/kide/plugins/lazy-nvim.lua @@ -707,6 +707,7 @@ require("lazy").setup({ }, -- lsp-inlayhints + -- TODO: 等待内置,然后删除 { "lvimuser/lsp-inlayhints.nvim", lazy = true, From 44e0fb6d449e708f1f0b316b46779c21730f65d7 Mon Sep 17 00:00:00 2001 From: luokai Date: Wed, 28 Jun 2023 12:43:45 +0800 Subject: [PATCH 0734/1278] =?UTF-8?q?LspAttach=20=E4=BA=8B=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lua/kide/lsp/init.lua | 40 ++++++++++++++++++++++++++++++++-------- lua/kide/lsp/java.lua | 2 -- 2 files changed, 32 insertions(+), 10 deletions(-) diff --git a/lua/kide/lsp/init.lua b/lua/kide/lsp/init.lua index 8a0f8f21..e4ac5890 100644 --- a/lua/kide/lsp/init.lua +++ b/lua/kide/lsp/init.lua @@ -52,10 +52,6 @@ require("mason-lspconfig").setup_handlers({ scfg.on_attach = function(client, buffer) -- 绑定快捷键 require("kide.core.keybindings").maplsp(client, buffer) - require("lsp-inlayhints").on_attach(client, buffer) - if client.server_capabilities.documentSymbolProvider then - require("nvim-navic").attach(client, buffer) - end if on_attach then on_attach(client, buffer) end @@ -81,10 +77,6 @@ for _, value in pairs(server_configs) do on_attach = function(client, buffer) -- 绑定快捷键 require("kide.core.keybindings").maplsp(client, buffer) - require("lsp-inlayhints").on_attach(client, buffer) - if client.server_capabilities.documentSymbolProvider then - require("nvim-navic").attach(client, buffer) - end end, }) end @@ -113,6 +105,38 @@ vim.diagnostic.config({ vim.lsp.handlers["textDocument/hover"] = vim.lsp.with(vim.lsp.handlers.hover, lsp_ui.hover_actions) vim.lsp.handlers["textDocument/signatureHelp"] = vim.lsp.with(vim.lsp.handlers.signature_help, lsp_ui.hover_actions) +-- LspAttach 事件 +vim.api.nvim_create_augroup("LspAttach_inlayhints", {}) +vim.api.nvim_create_autocmd("LspAttach", { + group = "LspAttach_inlayhints", + callback = function(args) + if not (args.data and args.data.client_id) then + return + end + + local bufnr = args.buf + local client = vim.lsp.get_client_by_id(args.data.client_id) + require("lsp-inlayhints").on_attach(client, bufnr) + end, +}) + +vim.api.nvim_create_augroup("LspAttach_navic", {}) +vim.api.nvim_create_autocmd("LspAttach", { + group = "LspAttach_navic", + callback = function(args) + if not (args.data and args.data.client_id) then + return + end + + local bufnr = args.buf + local client = vim.lsp.get_client_by_id(args.data.client_id) + if client.server_capabilities.documentSymbolProvider then + require("nvim-navic").attach(client, bufnr) + end + end, +}) + +-- 文档格式化 local function markdown_format(input) if input then input = string.gsub(input, '%[([%a%$_]?[%.%w%(%),\\_%[%]%s :%-@"]*)%]%(file:/[^%)]+%)', function(i1) diff --git a/lua/kide/lsp/java.lua b/lua/kide/lsp/java.lua index a3ed10e4..8d16bc71 100644 --- a/lua/kide/lsp/java.lua +++ b/lua/kide/lsp/java.lua @@ -342,8 +342,6 @@ config["on_attach"] = function(client, buffer) -- vim.g.jdtls_dap_main_class_config_init = false -- end - require("nvim-navic").attach(client, buffer) - require("lsp-inlayhints").on_attach(client, buffer) require("java-deps").attach(client, buffer, root_dir) create_command(buffer, "JavaProjects", require("java-deps").toggle_outline, { nargs = 0, From d940af54273a511849c5b5655e108b1dda742875 Mon Sep 17 00:00:00 2001 From: luokai Date: Wed, 28 Jun 2023 12:49:57 +0800 Subject: [PATCH 0735/1278] =?UTF-8?q?anticonceal=20=E5=88=86=E6=94=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lua/kide/plugins/lazy-nvim.lua | 1 + 1 file changed, 1 insertion(+) diff --git a/lua/kide/plugins/lazy-nvim.lua b/lua/kide/plugins/lazy-nvim.lua index f996ce01..ea2fff40 100644 --- a/lua/kide/plugins/lazy-nvim.lua +++ b/lua/kide/plugins/lazy-nvim.lua @@ -711,6 +711,7 @@ require("lazy").setup({ { "lvimuser/lsp-inlayhints.nvim", lazy = true, + branch = "anticonceal", config = function() require("lsp-inlayhints").setup() end, From 1929e57b4af8a9fb1d37837ad30165a63b9f5222 Mon Sep 17 00:00:00 2001 From: luokai Date: Wed, 28 Jun 2023 12:54:09 +0800 Subject: [PATCH 0736/1278] lua hint --- lua/kide/lsp/lua_ls.lua | 3 +++ 1 file changed, 3 insertions(+) diff --git a/lua/kide/lsp/lua_ls.lua b/lua/kide/lsp/lua_ls.lua index 0402e67b..5524b980 100644 --- a/lua/kide/lsp/lua_ls.lua +++ b/lua/kide/lsp/lua_ls.lua @@ -11,6 +11,9 @@ return { -- Setup your lua path -- path = runtime_path, }, + hint = { + enable = true, + }, diagnostics = { -- Get the language server to recognize the `vim` global globals = { "vim" }, From 4b5d33a3dffaf94227c5a5e7ad53e1b92dfd6236 Mon Sep 17 00:00:00 2001 From: luokai Date: Wed, 28 Jun 2023 13:02:28 +0800 Subject: [PATCH 0737/1278] =?UTF-8?q?=E4=BD=BF=E7=94=A8=20Native=20LSP=20I?= =?UTF-8?q?nlay=20Hint?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lua/kide/lsp/init.lua | 17 +++++------------ lua/kide/plugins/lazy-nvim.lua | 11 ----------- 2 files changed, 5 insertions(+), 23 deletions(-) diff --git a/lua/kide/lsp/init.lua b/lua/kide/lsp/init.lua index e4ac5890..33ac0089 100644 --- a/lua/kide/lsp/init.lua +++ b/lua/kide/lsp/init.lua @@ -106,18 +106,11 @@ vim.lsp.handlers["textDocument/hover"] = vim.lsp.with(vim.lsp.handlers.hover, ls vim.lsp.handlers["textDocument/signatureHelp"] = vim.lsp.with(vim.lsp.handlers.signature_help, lsp_ui.hover_actions) -- LspAttach 事件 -vim.api.nvim_create_augroup("LspAttach_inlayhints", {}) -vim.api.nvim_create_autocmd("LspAttach", { - group = "LspAttach_inlayhints", - callback = function(args) - if not (args.data and args.data.client_id) then - return - end - - local bufnr = args.buf - local client = vim.lsp.get_client_by_id(args.data.client_id) - require("lsp-inlayhints").on_attach(client, bufnr) - end, +vim.api.nvim_create_autocmd({ 'InsertEnter' }, { + callback = function () vim.lsp.buf.inlay_hint(0, true) end, +}) +vim.api.nvim_create_autocmd({ 'InsertLeave' }, { + callback = function () vim.lsp.buf.inlay_hint(0, false) end, }) vim.api.nvim_create_augroup("LspAttach_navic", {}) diff --git a/lua/kide/plugins/lazy-nvim.lua b/lua/kide/plugins/lazy-nvim.lua index ea2fff40..c2ae4653 100644 --- a/lua/kide/plugins/lazy-nvim.lua +++ b/lua/kide/plugins/lazy-nvim.lua @@ -706,17 +706,6 @@ require("lazy").setup({ end, }, - -- lsp-inlayhints - -- TODO: 等待内置,然后删除 - { - "lvimuser/lsp-inlayhints.nvim", - lazy = true, - branch = "anticonceal", - config = function() - require("lsp-inlayhints").setup() - end, - }, - -- 笔记 { "mickael-menu/zk-nvim", From 33c29def1ea68ed62c5bb09a579fbdc90e092c1d Mon Sep 17 00:00:00 2001 From: luokai Date: Wed, 28 Jun 2023 15:12:51 +0800 Subject: [PATCH 0738/1278] InlayHint --- lua/kide/core/keybindings.lua | 8 +++---- lua/kide/lsp/init.lua | 40 +++++++++++++++++------------------ lua/kide/lsp/java.lua | 11 +++++----- 3 files changed, 28 insertions(+), 31 deletions(-) diff --git a/lua/kide/core/keybindings.lua b/lua/kide/core/keybindings.lua index 45536d2c..49b513e4 100644 --- a/lua/kide/core/keybindings.lua +++ b/lua/kide/core/keybindings.lua @@ -213,15 +213,13 @@ M.maplsp = function(client, buffer, null_ls) vim.api.nvim_buf_set_keymap(buffer, "n", "fo", "Telescope lsp_document_symbols", opt) -- >= 0.8.x - if client.supports_method("textDocument/documentHighlightProvider") then + if client.server_capabilities.documentHighlightProvider then vim.cmd(string.format("au CursorHold lua vim.lsp.buf.document_highlight()", buffer)) vim.cmd(string.format("au CursorHoldI lua vim.lsp.buf.document_highlight()", buffer)) vim.cmd(string.format("au CursorMoved lua vim.lsp.buf.clear_references()", buffer)) end - if client.supports_method("codeLens/resolve") then - vim.api.nvim_buf_set_keymap(buffer, "n", "cr", "lua vim.lsp.codelens.refresh()", opt) - vim.api.nvim_buf_set_keymap(buffer, "n", "ce", "lua vim.lsp.codelens.run()", opt) - end + vim.api.nvim_buf_set_keymap(buffer, "n", "cr", "lua vim.lsp.codelens.refresh()", opt) + vim.api.nvim_buf_set_keymap(buffer, "n", "ce", "lua vim.lsp.codelens.run()", opt) end -- nvim-cmp 自动补全 diff --git a/lua/kide/lsp/init.lua b/lua/kide/lsp/init.lua index 33ac0089..7ac9fc40 100644 --- a/lua/kide/lsp/init.lua +++ b/lua/kide/lsp/init.lua @@ -5,15 +5,11 @@ mason_lspconfig.setup({ }, }) --- 安装列表 --- https://github.com/williamboman/nvim-lsp-installer#available-lsps -- { key: 语言 value: 配置文件 } local server_configs = { - -- sumneko_lua -> lua_ls - lua_ls = require("kide.lsp.lua_ls"), -- /lua/lsp/lua.lua - jdtls = require("kide.lsp.java"), -- /lua/lsp/jdtls.lua - metals = require("kide.lsp.metals"), -- /lua/lsp/jdtls.lua - -- jsonls = require("lsp.jsonls"), + lua_ls = require("kide.lsp.lua_ls"), + jdtls = require("kide.lsp.java"), + metals = require("kide.lsp.metals"), clangd = require("kide.lsp.clangd"), tsserver = require("kide.lsp.tsserver"), html = require("kide.lsp.html"), @@ -27,16 +23,10 @@ local server_configs = { gdscript = require("kide.lsp.gdscript"), } --- 没有确定使用效果参数 --- capabilities.textDocument.completion.completionItem.snippetSupport = true local utils = require("kide.core.utils") --- LSP 进度UI require("mason-lspconfig").setup_handlers({ - -- The first entry (without a key) will be the default handler - -- and will be called for each installed server that doesn't have - -- a dedicated handler. - function(server_name) -- default handler (optional) + function(server_name) local lspconfig = require("lspconfig") -- tools config local cfg = utils.or_default(server_configs[server_name], {}) @@ -47,7 +37,6 @@ require("mason-lspconfig").setup_handlers({ -- lspconfig local scfg = utils.or_default(cfg.server, {}) - -- scfg = vim.tbl_deep_extend("force", server:get_default_options(), scfg) local on_attach = scfg.on_attach scfg.on_attach = function(client, buffer) -- 绑定快捷键 @@ -67,6 +56,7 @@ require("mason-lspconfig").setup_handlers({ end, }) +-- 自定义 LSP 启动方式 for _, value in pairs(server_configs) do if value.setup then value.setup({ @@ -106,11 +96,21 @@ vim.lsp.handlers["textDocument/hover"] = vim.lsp.with(vim.lsp.handlers.hover, ls vim.lsp.handlers["textDocument/signatureHelp"] = vim.lsp.with(vim.lsp.handlers.signature_help, lsp_ui.hover_actions) -- LspAttach 事件 -vim.api.nvim_create_autocmd({ 'InsertEnter' }, { - callback = function () vim.lsp.buf.inlay_hint(0, true) end, -}) -vim.api.nvim_create_autocmd({ 'InsertLeave' }, { - callback = function () vim.lsp.buf.inlay_hint(0, false) end, + +vim.api.nvim_create_augroup("LspAttach_inlay_hint", {}) +vim.api.nvim_create_autocmd("LspAttach", { + group = "LspAttach_inlay_hint", + callback = function(args) + if not (args.data and args.data.client_id) then + return + end + + local bufnr = args.buf + local client = vim.lsp.get_client_by_id(args.data.client_id) + if client.server_capabilities.inlayHintProvider then + vim.lsp.buf.inlay_hint(bufnr, true) + end + end, }) vim.api.nvim_create_augroup("LspAttach_navic", {}) diff --git a/lua/kide/lsp/java.lua b/lua/kide/lsp/java.lua index 8d16bc71..6239e75f 100644 --- a/lua/kide/lsp/java.lua +++ b/lua/kide/lsp/java.lua @@ -335,12 +335,11 @@ config["on_attach"] = function(client, buffer) create_command(buffer, "OR", require("jdtls").organize_imports, { nargs = 0, }) - -- if vim.g.jdtls_dap_main_class_config_init then - -- vim.defer_fn(function() - -- require("jdtls.dap").setup_dap_main_class_configs({ verbose = true }) - -- end, 3000) - -- vim.g.jdtls_dap_main_class_config_init = false - -- end + create_command(buffer, "InlayHint", function() + vim.lsp.buf.inlay_hint(0) + end, { + nargs = 0, + }) require("java-deps").attach(client, buffer, root_dir) create_command(buffer, "JavaProjects", require("java-deps").toggle_outline, { From a416a32e00b74860b33b4d6791fb81d97d44cfc6 Mon Sep 17 00:00:00 2001 From: luokai Date: Thu, 29 Jun 2023 15:31:44 +0800 Subject: [PATCH 0739/1278] Flutter --- lua/kide/plugins/config/lualine.lua | 13 +++++++++++++ lua/kide/plugins/lazy-nvim.lua | 11 +++++++++++ 2 files changed, 24 insertions(+) diff --git a/lua/kide/plugins/config/lualine.lua b/lua/kide/plugins/config/lualine.lua index feaab383..aca8c8e3 100644 --- a/lua/kide/plugins/config/lualine.lua +++ b/lua/kide/plugins/config/lualine.lua @@ -132,4 +132,17 @@ java_projects.filetypes = { "JavaProjects", } table.insert(config.extensions, java_projects) + +-- Flutter +local flutter = {} +flutter.sections = { + lualine_a = { + { "filename", file_status = false }, + }, +} +flutter.filetypes = { + "flutterToolsOutline", +} +table.insert(config.extensions, flutter) + require("lualine").setup(config) diff --git a/lua/kide/plugins/lazy-nvim.lua b/lua/kide/plugins/lazy-nvim.lua index c2ae4653..e93f711d 100644 --- a/lua/kide/plugins/lazy-nvim.lua +++ b/lua/kide/plugins/lazy-nvim.lua @@ -734,6 +734,17 @@ require("lazy").setup({ end, }, + { + "akinsho/flutter-tools.nvim", + lazy = false, + dependencies = { + "nvim-lua/plenary.nvim", + }, + config = function() + require("flutter-tools").setup({}) -- use defaults + end, + }, + -- ui { "MunifTanjim/nui.nvim", From b1afd809d3a202429d6eb0ed0b0986a2ecdc7480 Mon Sep 17 00:00:00 2001 From: luokai Date: Thu, 29 Jun 2023 15:33:19 +0800 Subject: [PATCH 0740/1278] lazy --- lua/kide/plugins/lazy-nvim.lua | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lua/kide/plugins/lazy-nvim.lua b/lua/kide/plugins/lazy-nvim.lua index e93f711d..aa8aecf3 100644 --- a/lua/kide/plugins/lazy-nvim.lua +++ b/lua/kide/plugins/lazy-nvim.lua @@ -736,7 +736,8 @@ require("lazy").setup({ { "akinsho/flutter-tools.nvim", - lazy = false, + lazy = true, + ft = { "dart" }, dependencies = { "nvim-lua/plenary.nvim", }, From 508227b3684c4a02a347ae458c95816cdac2b24f Mon Sep 17 00:00:00 2001 From: luokai Date: Thu, 29 Jun 2023 15:46:59 +0800 Subject: [PATCH 0741/1278] LspAttach_keymap --- lua/kide/lsp/init.lua | 29 +++++++++++++++++------------ lua/kide/lsp/java.lua | 1 - lua/kide/plugins/config/null-ls.lua | 5 ----- 3 files changed, 17 insertions(+), 18 deletions(-) diff --git a/lua/kide/lsp/init.lua b/lua/kide/lsp/init.lua index 7ac9fc40..072dd69f 100644 --- a/lua/kide/lsp/init.lua +++ b/lua/kide/lsp/init.lua @@ -37,14 +37,6 @@ require("mason-lspconfig").setup_handlers({ -- lspconfig local scfg = utils.or_default(cfg.server, {}) - local on_attach = scfg.on_attach - scfg.on_attach = function(client, buffer) - -- 绑定快捷键 - require("kide.core.keybindings").maplsp(client, buffer) - if on_attach then - on_attach(client, buffer) - end - end scfg.flags = { debounce_text_changes = 150, } @@ -64,10 +56,6 @@ for _, value in pairs(server_configs) do debounce_text_changes = 150, }, capabilities = require("cmp_nvim_lsp").default_capabilities(vim.lsp.protocol.make_client_capabilities()), - on_attach = function(client, buffer) - -- 绑定快捷键 - require("kide.core.keybindings").maplsp(client, buffer) - end, }) end end @@ -96,6 +84,23 @@ vim.lsp.handlers["textDocument/hover"] = vim.lsp.with(vim.lsp.handlers.hover, ls vim.lsp.handlers["textDocument/signatureHelp"] = vim.lsp.with(vim.lsp.handlers.signature_help, lsp_ui.hover_actions) -- LspAttach 事件 +vim.api.nvim_create_augroup("LspAttach_keymap", {}) +vim.api.nvim_create_autocmd("LspAttach", { + group = "LspAttach_keymap", + callback = function(args) + if not (args.data and args.data.client_id) then + return + end + + local bufnr = args.buf + local client = vim.lsp.get_client_by_id(args.data.client_id) + if client.name == "copilot" then + return + end + -- 绑定快捷键 + require("kide.core.keybindings").maplsp(client, bufnr, client.name == "null-ls") + end, +}) vim.api.nvim_create_augroup("LspAttach_inlay_hint", {}) vim.api.nvim_create_autocmd("LspAttach", { diff --git a/lua/kide/lsp/java.lua b/lua/kide/lsp/java.lua index 6239e75f..784251b4 100644 --- a/lua/kide/lsp/java.lua +++ b/lua/kide/lsp/java.lua @@ -323,7 +323,6 @@ config["on_attach"] = function(client, buffer) require("jdtls.setup").add_commands() -- TODO: 不知道为什么这个值一会有一会没有 client.server_capabilities["definitionProvider"] = true - require("kide.core.keybindings").maplsp(client, buffer) -- require('jdtls.dap').setup_dap_main_class_configs({ verbose = true }) local opts = { silent = true, buffer = buffer } vim.keymap.set("n", "dc", jdtls.test_class, opts) diff --git a/lua/kide/plugins/config/null-ls.lua b/lua/kide/plugins/config/null-ls.lua index 02699582..aaf89820 100644 --- a/lua/kide/plugins/config/null-ls.lua +++ b/lua/kide/plugins/config/null-ls.lua @@ -128,9 +128,4 @@ end null_ls.setup({ sources = sources, - on_attach = function(client, bufnr) - require("kide.core.keybindings").maplsp(client, bufnr, true) - -- on_attach(client, bufnr) - end, - -- debug = true, }) From fa6c3e3742318bc007d3a4db65ae9e6025fb0ab7 Mon Sep 17 00:00:00 2001 From: luokai Date: Thu, 29 Jun 2023 16:29:26 +0800 Subject: [PATCH 0742/1278] InlayHint --- lua/kide/lsp/init.lua | 6 ++++++ lua/kide/lsp/java.lua | 5 ----- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/lua/kide/lsp/init.lua b/lua/kide/lsp/init.lua index 072dd69f..50612e58 100644 --- a/lua/kide/lsp/init.lua +++ b/lua/kide/lsp/init.lua @@ -112,6 +112,12 @@ vim.api.nvim_create_autocmd("LspAttach", { local bufnr = args.buf local client = vim.lsp.get_client_by_id(args.data.client_id) + + vim.api.nvim_buf_create_user_command(bufnr, "InlayHint", function() + vim.lsp.buf.inlay_hint(0) + end, { + nargs = 0, + }) if client.server_capabilities.inlayHintProvider then vim.lsp.buf.inlay_hint(bufnr, true) end diff --git a/lua/kide/lsp/java.lua b/lua/kide/lsp/java.lua index 784251b4..f27e8304 100644 --- a/lua/kide/lsp/java.lua +++ b/lua/kide/lsp/java.lua @@ -334,11 +334,6 @@ config["on_attach"] = function(client, buffer) create_command(buffer, "OR", require("jdtls").organize_imports, { nargs = 0, }) - create_command(buffer, "InlayHint", function() - vim.lsp.buf.inlay_hint(0) - end, { - nargs = 0, - }) require("java-deps").attach(client, buffer, root_dir) create_command(buffer, "JavaProjects", require("java-deps").toggle_outline, { From 568568fb8f418dac7ecaa9f534fd585e799b40d1 Mon Sep 17 00:00:00 2001 From: luokai Date: Thu, 29 Jun 2023 22:51:18 +0800 Subject: [PATCH 0743/1278] flutter-tools config --- lua/kide/config.lua | 1 + lua/kide/plugins/config/flutter-tools.lua | 31 +++++++++++++++++++++++ lua/kide/plugins/lazy-nvim.lua | 2 +- 3 files changed, 33 insertions(+), 1 deletion(-) create mode 100644 lua/kide/plugins/config/flutter-tools.lua diff --git a/lua/kide/config.lua b/lua/kide/config.lua index 1203525e..1d66a9ab 100644 --- a/lua/kide/config.lua +++ b/lua/kide/config.lua @@ -1,6 +1,7 @@ local M = { env = { py_bin = vim.env["PY_BIN"] or "/usr/bin/python3", + flutter_home = vim.env["FLUTTER_HOME"] or "/opt/software/flutter", }, plugin = { copilot = { diff --git a/lua/kide/plugins/config/flutter-tools.lua b/lua/kide/plugins/config/flutter-tools.lua new file mode 100644 index 00000000..c05bcfad --- /dev/null +++ b/lua/kide/plugins/config/flutter-tools.lua @@ -0,0 +1,31 @@ +local config = require("kide.config") + +require("flutter-tools").setup({ + lsp = { + color = { -- show the derived colours for dart variables + enabled = true, -- whether or not to highlight color variables at all, only supported on flutter >= 2.10 + background = false, -- highlight the background + background_color = nil, -- required, when background is transparent (i.e. background_color = { r = 19, g = 17, b = 24},) + foreground = false, -- highlight the foreground + virtual_text = true, -- show the highlight using virtual text + virtual_text_str = "■", -- the virtual text character to highlight + }, + flags = { + debounce_text_changes = 150, + }, + capabilities = function(c) + require("cmp_nvim_lsp").default_capabilities(c) + return c + end, + -- see the link below for details on each option: + -- https://github.com/dart-lang/sdk/blob/master/pkg/analysis_server/tool/lsp_spec/README.md#client-workspace-configuration + settings = { + showTodos = true, + completeFunctionCalls = true, + renameFilesWithClasses = "prompt", -- "always" + enableSnippets = true, + updateImportsOnRename = true, -- Whether to update imports and other directives when files are renamed. Required for `FlutterRename` command. + }, + }, +}) +require("telescope").load_extension("flutter") diff --git a/lua/kide/plugins/lazy-nvim.lua b/lua/kide/plugins/lazy-nvim.lua index aa8aecf3..92425e3a 100644 --- a/lua/kide/plugins/lazy-nvim.lua +++ b/lua/kide/plugins/lazy-nvim.lua @@ -742,7 +742,7 @@ require("lazy").setup({ "nvim-lua/plenary.nvim", }, config = function() - require("flutter-tools").setup({}) -- use defaults + require("kide.plugins.config.flutter-tools") end, }, From 7adedebdede52e0fb08127f99578b0447ad2a0b4 Mon Sep 17 00:00:00 2001 From: luokai Date: Thu, 29 Jun 2023 23:25:54 +0800 Subject: [PATCH 0744/1278] flutter lsp config --- lua/kide/config.lua | 1 - lua/kide/core/keybindings.lua | 2 +- lua/kide/lsp/utils/init.lua | 3 +++ lua/kide/plugins/config/bufferline.lua | 7 +++++++ lua/kide/plugins/config/flutter-tools.lua | 2 -- lua/kide/plugins/config/indent-blankline.lua | 1 + lua/kide/plugins/lazy-nvim.lua | 16 ++++++++++++++++ 7 files changed, 28 insertions(+), 4 deletions(-) diff --git a/lua/kide/config.lua b/lua/kide/config.lua index 1d66a9ab..1203525e 100644 --- a/lua/kide/config.lua +++ b/lua/kide/config.lua @@ -1,7 +1,6 @@ local M = { env = { py_bin = vim.env["PY_BIN"] or "/usr/bin/python3", - flutter_home = vim.env["FLUTTER_HOME"] or "/opt/software/flutter", }, plugin = { copilot = { diff --git a/lua/kide/core/keybindings.lua b/lua/kide/core/keybindings.lua index 49b513e4..feb8ce77 100644 --- a/lua/kide/core/keybindings.lua +++ b/lua/kide/core/keybindings.lua @@ -50,7 +50,7 @@ M.setup = function() -- map("t", "tt", ":ToggleTerm", opt) -- symbols-outline.nvim - map("n", "o", ":SymbolsOutline", opt) + map("n", "o", ":SymbolsOutline", opt) -- Telescope map("n", "ff", "Telescope find_files", opt) diff --git a/lua/kide/lsp/utils/init.lua b/lua/kide/lsp/utils/init.lua index cfcf6832..ed72127e 100644 --- a/lua/kide/lsp/utils/init.lua +++ b/lua/kide/lsp/utils/init.lua @@ -78,6 +78,9 @@ format_lsp_mapping["python"] = "null-ls" M.filter_format_lsp_client = function(client, bufnr) local filetype = vim.api.nvim_buf_get_option(bufnr, "filetype") local cn = format_lsp_mapping[filetype] + if cn == nil then + return true + end return client.name == cn end diff --git a/lua/kide/plugins/config/bufferline.lua b/lua/kide/plugins/config/bufferline.lua index ef1c4fc6..afcdcbd5 100644 --- a/lua/kide/plugins/config/bufferline.lua +++ b/lua/kide/plugins/config/bufferline.lua @@ -50,6 +50,13 @@ require("bufferline").setup({ highlight = "Directory", text_align = "left", }, + { + filetype = "flutterToolsOutline", + text = " Outline", + padding = 1, + highlight = "Directory", + text_align = "left", + }, { filetype = "dapui_watches", text = "Debug", diff --git a/lua/kide/plugins/config/flutter-tools.lua b/lua/kide/plugins/config/flutter-tools.lua index c05bcfad..404f2d2c 100644 --- a/lua/kide/plugins/config/flutter-tools.lua +++ b/lua/kide/plugins/config/flutter-tools.lua @@ -1,5 +1,3 @@ -local config = require("kide.config") - require("flutter-tools").setup({ lsp = { color = { -- show the derived colours for dart variables diff --git a/lua/kide/plugins/config/indent-blankline.lua b/lua/kide/plugins/config/indent-blankline.lua index 10edd347..3bd06dad 100644 --- a/lua/kide/plugins/config/indent-blankline.lua +++ b/lua/kide/plugins/config/indent-blankline.lua @@ -20,6 +20,7 @@ require("indent_blankline").setup({ "dashboard", "alpha", "Outline", + "flutterToolsOutline", "TelescopePrompt", "TelescopeResults", "NeogitStatus", diff --git a/lua/kide/plugins/lazy-nvim.lua b/lua/kide/plugins/lazy-nvim.lua index 92425e3a..3b5df294 100644 --- a/lua/kide/plugins/lazy-nvim.lua +++ b/lua/kide/plugins/lazy-nvim.lua @@ -738,6 +738,22 @@ require("lazy").setup({ "akinsho/flutter-tools.nvim", lazy = true, ft = { "dart" }, + init = function() + vim.api.nvim_create_autocmd("FileType", { + group = vim.api.nvim_create_augroup("kide_FlutterOutlineToggle", { clear = true }), + pattern = "dart", + callback = function(event) + vim.keymap.set("n", "o", "FlutterOutlineToggle", { buffer = event.buf, silent = true }) + end, + }) + vim.api.nvim_create_autocmd("BufNewFile", { + group = vim.api.nvim_create_augroup("kide__FlutterOutlineToggle", { clear = true }), + pattern = "Flutter Outline", + callback = function(event) + vim.keymap.set("n", "o", "FlutterOutlineToggle", { buffer = event.buf, silent = true }) + end, + }) + end, dependencies = { "nvim-lua/plenary.nvim", }, From a7b1a9f0bf4dff3777b36e58217b8bb35cf63ac1 Mon Sep 17 00:00:00 2001 From: luokai Date: Fri, 30 Jun 2023 09:32:11 +0800 Subject: [PATCH 0745/1278] =?UTF-8?q?=E6=8C=89=E9=9C=80=E5=AE=89=E8=A3=85?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lua/kide/plugins/config/nvim-treesitter.lua | 11 ----------- 1 file changed, 11 deletions(-) diff --git a/lua/kide/plugins/config/nvim-treesitter.lua b/lua/kide/plugins/config/nvim-treesitter.lua index d11d7285..96153326 100644 --- a/lua/kide/plugins/config/nvim-treesitter.lua +++ b/lua/kide/plugins/config/nvim-treesitter.lua @@ -1,17 +1,8 @@ require("nvim-treesitter.configs").setup({ -- One of "all", "maintained" (parsers with maintainers), or a list of languages ensure_installed = { - "lua", - "java", - "javascript", - "typescript", "html", "css", - "c", - "cpp", - "go", - "rust", - "python", "vim", "yaml", "http", @@ -19,8 +10,6 @@ require("nvim-treesitter.configs").setup({ "markdown", "org", "norg", - "kotlin", - "vue", }, -- Install languages synchronously (only applied to `ensure_installed`) From cfc99613ddb8ea2f66847024009047b37a3f69f2 Mon Sep 17 00:00:00 2001 From: luokai Date: Fri, 30 Jun 2023 10:26:34 +0800 Subject: [PATCH 0746/1278] dart --- lua/kide/core/basic.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lua/kide/core/basic.lua b/lua/kide/core/basic.lua index 5eb814e3..62512cd0 100644 --- a/lua/kide/core/basic.lua +++ b/lua/kide/core/basic.lua @@ -70,6 +70,7 @@ autocmd("FileType", { "markdown", "lisp", "sh", + "dart", }, callback = function() vim.opt_local.tabstop = 2 @@ -206,7 +207,6 @@ autocmd({ "BufReadCmd" }, { end, }) - autocmd("FileType", { group = augroup("gitcommit"), pattern = { "gitcommit" }, From 8bbc0547632000ddf5f31ebe93d7f2cafae24984 Mon Sep 17 00:00:00 2001 From: luokai Date: Sun, 2 Jul 2023 12:46:37 +0800 Subject: [PATCH 0747/1278] LOMBOK_JAR --- lua/kide/lsp/java.lua | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/lua/kide/lsp/java.lua b/lua/kide/lsp/java.lua index f27e8304..a6a55c0d 100644 --- a/lua/kide/lsp/java.lua +++ b/lua/kide/lsp/java.lua @@ -110,6 +110,12 @@ local function jdtls_launcher() vim.notify("jdtls_path is empty", vim.log.levels.ERROR) return end + + local lombok_jar = env.LOMBOK_JAR + if not lombok_jar and require("mason-registry").has_package("jdtls") then + lombok_jar = require("mason-registry").get_package("jdtls"):get_install_path() .. "/lombok.jar" + end + local cmd = { jdtls_path, "--jvm-arg=-Dlog.protocol=true", @@ -118,8 +124,8 @@ local function jdtls_launcher() "--jvm-arg=" .. "-XX:+UseZGC", "--jvm-arg=" .. "-Xmx1g", } - if env.LOMBOK_JAR then - table.insert(cmd, "--jvm-arg=-javaagent:" .. env.LOMBOK_JAR) + if lombok_jar then + table.insert(cmd, "--jvm-arg=-javaagent:" .. lombok_jar) end table.insert(cmd, "-data=" .. workspace_dir) return cmd From 90279a873a74fe9b30fdd3d92744e6f77a2819db Mon Sep 17 00:00:00 2001 From: luokai Date: Sun, 2 Jul 2023 18:58:16 +0800 Subject: [PATCH 0748/1278] neovim-nightly --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 82ac8a78..6ade1277 100644 --- a/README.md +++ b/README.md @@ -2,7 +2,7 @@ 可配置 `Java`, `Rust`, `C/C++`, `JavaScript` 等编程语言开发环境。 极速启动 (`startuptime` 20 ~ 70 ms)。 -使用 `neovim v0.9.0`+ 版本。 +使用 `neovim-nightly` 版本。 ## 安装 From 1aff02fb612fb6365d39affd04148ae643a9566b Mon Sep 17 00:00:00 2001 From: luokai Date: Sun, 2 Jul 2023 19:12:26 +0800 Subject: [PATCH 0749/1278] =?UTF-8?q?lombok=20jar=20=E6=97=A0=E9=A1=BB?= =?UTF-8?q?=E5=8D=95=E7=8B=AC=E4=B8=8B=E8=BD=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lua/kide/lsp/java.lua | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/lua/kide/lsp/java.lua b/lua/kide/lsp/java.lua index a6a55c0d..9b58ea95 100644 --- a/lua/kide/lsp/java.lua +++ b/lua/kide/lsp/java.lua @@ -5,7 +5,7 @@ local env = { JDTLS_RUN_JAVA = vim.env["JDTLS_RUN_JAVA"], JDTLS_HOME = vim.env["JDTLS_HOME"], JDTLS_WORKSPACE = vim.env["JDTLS_WORKSPACE"], - LOMBOK_JAR = vim.env["LOMBOK_JAR"], + LOMBOK_ENABLE = vim.env["LOMBOK_ENABLE"] or "Y", JOL_JAR = vim.env["JOL_JAR"], } local maven = require("kide.core.utils.maven") @@ -111,9 +111,12 @@ local function jdtls_launcher() return end - local lombok_jar = env.LOMBOK_JAR - if not lombok_jar and require("mason-registry").has_package("jdtls") then - lombok_jar = require("mason-registry").get_package("jdtls"):get_install_path() .. "/lombok.jar" + local lombok_jar = nil + if env.LOMBOK_ENABLE == "Y" then + lombok_jar = vscode.find_one("/redhat.java-*/lombok/lombok-*.jar") + if lombok_jar == nil and require("mason-registry").has_package("jdtls") then + lombok_jar = require("mason-registry").get_package("jdtls"):get_install_path() .. "/lombok.jar" + end end local cmd = { @@ -124,7 +127,7 @@ local function jdtls_launcher() "--jvm-arg=" .. "-XX:+UseZGC", "--jvm-arg=" .. "-Xmx1g", } - if lombok_jar then + if lombok_jar ~= nil then table.insert(cmd, "--jvm-arg=-javaagent:" .. lombok_jar) end table.insert(cmd, "-data=" .. workspace_dir) From 208b18faa9ca39d3a0b176ad911e8e47ac941f25 Mon Sep 17 00:00:00 2001 From: luokai Date: Mon, 3 Jul 2023 09:27:58 +0800 Subject: [PATCH 0750/1278] inlay_hint --- lua/kide/lsp/init.lua | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lua/kide/lsp/init.lua b/lua/kide/lsp/init.lua index 50612e58..93c15c15 100644 --- a/lua/kide/lsp/init.lua +++ b/lua/kide/lsp/init.lua @@ -114,12 +114,12 @@ vim.api.nvim_create_autocmd("LspAttach", { local client = vim.lsp.get_client_by_id(args.data.client_id) vim.api.nvim_buf_create_user_command(bufnr, "InlayHint", function() - vim.lsp.buf.inlay_hint(0) + vim.lsp.inlay_hint(0) end, { nargs = 0, }) if client.server_capabilities.inlayHintProvider then - vim.lsp.buf.inlay_hint(bufnr, true) + vim.lsp.inlay_hint(bufnr, true) end end, }) From e548ee0f799175b4060d6babe8c7b6f1b7a24606 Mon Sep 17 00:00:00 2001 From: luokai Date: Mon, 3 Jul 2023 09:29:45 +0800 Subject: [PATCH 0751/1278] neogit --- lua/kide/plugins/lazy-nvim.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lua/kide/plugins/lazy-nvim.lua b/lua/kide/plugins/lazy-nvim.lua index 3b5df294..c90ef25b 100644 --- a/lua/kide/plugins/lazy-nvim.lua +++ b/lua/kide/plugins/lazy-nvim.lua @@ -314,7 +314,7 @@ require("lazy").setup({ end, }, { - "TimUntersberger/neogit", + "NeogitOrg/neogit", layz = true, cmd = "Neogit", dependencies = { "sindrets/diffview.nvim" }, From 7f9dce2ade38ce51daea381db20e27f58a602808 Mon Sep 17 00:00:00 2001 From: luokai Date: Tue, 4 Jul 2023 23:00:46 +0800 Subject: [PATCH 0752/1278] jdt:// buffer_previewer --- lua/kide/plugins/config/telescope.lua | 3 + .../config/telescope/buffer_previewer.lua | 1197 +++++++++++++++++ lua/kide/plugins/lazy-nvim.lua | 1 - 3 files changed, 1200 insertions(+), 1 deletion(-) create mode 100644 lua/kide/plugins/config/telescope/buffer_previewer.lua diff --git a/lua/kide/plugins/config/telescope.lua b/lua/kide/plugins/config/telescope.lua index 3515c24f..ad399dba 100644 --- a/lua/kide/plugins/config/telescope.lua +++ b/lua/kide/plugins/config/telescope.lua @@ -68,6 +68,9 @@ set.edit = function(prompt_bufnr, command) end end +local previewers = require("telescope.previewers") +previewers.buffer_previewer_maker = require("kide.plugins.config.telescope.buffer_previewer").file_maker + telescope.setup({ defaults = { vimgrep_arguments = { diff --git a/lua/kide/plugins/config/telescope/buffer_previewer.lua b/lua/kide/plugins/config/telescope/buffer_previewer.lua new file mode 100644 index 00000000..3775404f --- /dev/null +++ b/lua/kide/plugins/config/telescope/buffer_previewer.lua @@ -0,0 +1,1197 @@ +local from_entry = require "telescope.from_entry" +local Path = require "plenary.path" +local utils = require "telescope.utils" +local putils = require "telescope.previewers.utils" +local Previewer = require "telescope.previewers.previewer" +local conf = require("telescope.config").values + +local pscan = require "plenary.scandir" + +local buf_delete = utils.buf_delete + +local previewers = {} + +local ns_previewer = vim.api.nvim_create_namespace "telescope.previewers" + +local has_file = 1 == vim.fn.executable "file" + +-- TODO(fdschmidt93) switch to Job once file_maker callbacks get cleaned up with plenary async +-- avoids SIGABRT from utils.get_os_command_output due to vim.time in fs_stat cb +local function capture(cmd, raw) + local f = assert(io.popen(cmd, "r")) + local s = assert(f:read "*a") + f:close() + if raw then + return s + end + s = string.gsub(s, "^%s+", "") + s = string.gsub(s, "%s+$", "") + s = string.gsub(s, "[\n\r]+", " ") + return s +end + +local function defaulter(f, default_opts) + default_opts = default_opts or {} + return { + new = function(opts) + if conf.preview == false and not opts.preview then + return false + end + opts.preview = type(opts.preview) ~= "table" and {} or opts.preview + if type(conf.preview) == "table" then + for k, v in pairs(conf.preview) do + opts.preview[k] = vim.F.if_nil(opts.preview[k], v) + end + end + return f(opts) + end, + __call = function() + local ok, err = pcall(f(default_opts)) + if not ok then + error(debug.traceback(err)) + end + end, + } +end + +-- modified vim.split to incorporate a timer +local function split(s, sep, plain, opts) + opts = opts or {} + local t = {} + for c in vim.gsplit(s, sep, plain) do + local line = opts.file_encoding and vim.iconv(c, opts.file_encoding, "utf8") or c + table.insert(t, line) + if opts.preview.timeout then + local diff_time = (vim.loop.hrtime() - opts.start_time) / 1e6 + if diff_time > opts.preview.timeout then + return + end + end + end + return t +end +local bytes_to_megabytes = math.pow(1024, 2) + +local color_hash = { + ["p"] = "TelescopePreviewPipe", + ["c"] = "TelescopePreviewCharDev", + ["d"] = "TelescopePreviewDirectory", + ["b"] = "TelescopePreviewBlock", + ["l"] = "TelescopePreviewLink", + ["s"] = "TelescopePreviewSocket", + ["."] = "TelescopePreviewNormal", + ["r"] = "TelescopePreviewRead", + ["w"] = "TelescopePreviewWrite", + ["x"] = "TelescopePreviewExecute", + ["-"] = "TelescopePreviewHyphen", + ["T"] = "TelescopePreviewSticky", + ["S"] = "TelescopePreviewSticky", + [2] = "TelescopePreviewSize", + [3] = "TelescopePreviewUser", + [4] = "TelescopePreviewGroup", + [5] = "TelescopePreviewDate", +} +color_hash[6] = function(line) + return color_hash[line:sub(1, 1)] +end + +local colorize_ls_long = function(bufnr, data, sections) + local windows_add = Path.path.sep == "\\" and 2 or 0 + for lnum, line in ipairs(data) do + local section = sections[lnum] + for i = 1, section[1].end_index - 1 do -- Highlight permissions + local c = line:sub(i, i) + vim.api.nvim_buf_add_highlight(bufnr, ns_previewer, color_hash[c], lnum - 1, i - 1, i) + end + for i = 2, #section do -- highlights size, (user, group), date and name + local hl_group = color_hash[i + (i ~= 2 and windows_add or 0)] + vim.api.nvim_buf_add_highlight( + bufnr, + ns_previewer, + type(hl_group) == "function" and hl_group(line) or hl_group, + lnum - 1, + section[i].start_index - 1, + section[i].end_index - 1 + ) + end + end +end + +local handle_directory_preview = function(filepath, bufnr, opts) + opts.preview.ls_short = vim.F.if_nil(opts.preview.ls_short, false) + + local set_colorize_lines + if opts.preview.ls_short then + set_colorize_lines = function(data, sections) + local PATH_SECTION = Path.path.sep == "\\" and 4 or 6 + local paths = {} + for i, line in ipairs(data) do + local section = sections[i][PATH_SECTION] + local path = line:sub(section.start_index, section.end_index) + table.insert(paths, path) + end + vim.api.nvim_buf_set_lines(bufnr, 0, -1, false, paths) + for i, path in ipairs(paths) do + local hl = color_hash[6](data[i]) + vim.api.nvim_buf_add_highlight(bufnr, ns_previewer, hl, i - 1, 0, #path) + end + end + else + set_colorize_lines = function(data, sections) + vim.api.nvim_buf_set_lines(bufnr, 0, -1, false, data) + colorize_ls_long(bufnr, data, sections) + end + end + + pscan.ls_async(filepath, { + hidden = true, + group_directories_first = true, + on_exit = vim.schedule_wrap(function(data, sections) + set_colorize_lines(data, sections) + if opts.callback then + opts.callback(bufnr) + end + end), + }) +end + +local handle_file_preview = function(filepath, bufnr, stat, opts) + vim.schedule(function() + opts.ft = opts.use_ft_detect and putils.filetype_detect(filepath) + local possible_binary = false + if type(opts.preview.filetype_hook) == "function" and opts.ft ~= nil and opts.ft ~= "" then + if not opts.preview.filetype_hook(filepath, bufnr, opts) then + return + end + end + if opts.preview.check_mime_type == true and has_file and (opts.ft == nil or opts.ft == "") then + -- avoid SIGABRT in buffer previewer happening with utils.get_os_command_output + local output = capture(string.format([[file --mime-type -b "%s"]], filepath)) + local mime_type = vim.split(output, "/") + if mime_type[1] ~= "text" and mime_type[1] ~= "inode" and mime_type[2] ~= "json" then + if type(opts.preview.mime_hook) == "function" then + opts.preview.mime_hook(filepath, bufnr, opts) + return + else + possible_binary = true + end + end + if mime_type[2] == "json" then + opts.ft = "json" + end + end + + if opts.preview.filesize_limit then + local mb_filesize = math.floor(stat.size / bytes_to_megabytes) + if mb_filesize > opts.preview.filesize_limit then + if type(opts.preview.filesize_hook) == "function" then + opts.preview.filesize_hook(filepath, bufnr, opts) + else + putils.set_preview_message(bufnr, opts.winid, "File exceeds preview size limit", opts.preview.msg_bg_fillchar) + end + return + end + end + + opts.start_time = vim.loop.hrtime() + Path:new(filepath):_read_async(vim.schedule_wrap(function(data) + if not vim.api.nvim_buf_is_valid(bufnr) then + return + end + local processed_data = split(data, "[\r]?\n", nil, opts) + + if processed_data then + local ok = pcall(vim.api.nvim_buf_set_lines, bufnr, 0, -1, false, processed_data) + if not ok then + return + end + -- last resort, if ft is still empty at this point in time, + -- we need to determine the filetype using the buffer contents + if opts.ft == nil or opts.ft == "" then + opts.ft = vim.filetype.match { filename = filepath, buf = bufnr } + end + -- we need to attempt to call filetype hook at this point "again" + -- previously only if we had a valid filetype, now every time + -- also if there will never be a filetype + if type(opts.preview.filetype_hook) == "function" then + if not opts.preview.filetype_hook(filepath, bufnr, opts) then + return + end + end + -- if we still dont have a ft we need to display the binary message + if (opts.ft == nil or opts.ft == "") and possible_binary then + putils.set_preview_message(bufnr, opts.winid, "Binary cannot be previewed", opts.preview.msg_bg_fillchar) + return + end + + if opts.callback then + opts.callback(bufnr) + end + putils.highlighter(bufnr, opts.ft, opts) + else + if type(opts.preview.timeout_hook) == "function" then + opts.preview.timeout_hook(filepath, bufnr, opts) + else + putils.set_preview_message(bufnr, opts.winid, "Previewer timed out", opts.preview.msg_bg_fillchar) + end + return + end + end)) + end) +end + +local PREVIEW_TIMEOUT_MS = 250 +local PREVIEW_FILESIZE_MB = 25 + +previewers.file_maker = function(filepath, bufnr, opts) + opts = vim.F.if_nil(opts, {}) + opts.preview = vim.F.if_nil(opts.preview, {}) + opts.preview.timeout = vim.F.if_nil(opts.preview.timeout, PREVIEW_TIMEOUT_MS) + opts.preview.filesize_limit = vim.F.if_nil(opts.preview.filesize_limit, PREVIEW_FILESIZE_MB) + opts.preview.msg_bg_fillchar = vim.F.if_nil(opts.preview.msg_bg_fillchar, "╱") + opts.preview.treesitter = vim.F.if_nil(opts.preview.treesitter, true) + if opts.use_ft_detect == nil then + opts.use_ft_detect = true + end + if opts.bufname ~= filepath then + if not vim.in_fast_event() then + filepath = vim.fn.expand(filepath) + end + -- jdt:// path is a special case, we need to call the filetype hook + if vim.startswith(filepath, "jdt://") and type(opts.preview.filetype_hook) == "function" then + if not opts.preview.filetype_hook(filepath, bufnr, opts) then + return + end + end + + vim.uv.fs_stat(filepath, function(_, stat) + if not stat then + return + end + if stat.type == "directory" then + handle_directory_preview(filepath, bufnr, opts) + else + handle_file_preview(filepath, bufnr, stat, opts) + end + end) + else + if opts.callback then + if vim.in_fast_event() then + vim.schedule(function() + opts.callback(bufnr) + end) + else + opts.callback(bufnr) + end + end + end +end + +local search_cb_jump = function(self, bufnr, query) + if not query then + return + end + vim.api.nvim_buf_call(bufnr, function() + pcall(vim.fn.matchdelete, self.state.hl_id, self.state.winid) + vim.cmd "norm! gg" + vim.fn.search(query, "W") + vim.cmd "norm! zz" + + self.state.hl_id = vim.fn.matchadd("TelescopePreviewMatch", query) + end) +end + +local search_teardown = function(self) + if self.state and self.state.hl_id then + pcall(vim.fn.matchdelete, self.state.hl_id, self.state.hl_win) + self.state.hl_id = nil + end +end + +local scroll_fn = function(self, direction) + if not self.state then + return + end + + local input = direction > 0 and [[]] or [[]] + local count = math.abs(direction) + + vim.api.nvim_win_call(self.state.winid, function() + vim.cmd([[normal! ]] .. count .. input) + end) +end + +local scroll_horizontal_fn = function(self, direction) + if not self.state then + return + end + + local input = direction > 0 and [[zl]] or [[zh]] + local count = math.abs(direction) + + vim.api.nvim_win_call(self.state.winid, function() + vim.cmd([[normal! ]] .. count .. input) + end) +end + +previewers.new_buffer_previewer = function(opts) + opts = opts or {} + + assert(opts.define_preview, "define_preview is a required function") + assert(not opts.preview_fn, "preview_fn not allowed") + + local opt_setup = opts.setup + local opt_teardown = opts.teardown + + local old_bufs = {} + local bufname_table = {} + + local global_state = require "telescope.state" + local preview_window_id + + local function get_bufnr(self) + if not self.state then + return nil + end + return self.state.bufnr + end + + local function set_bufnr(self, value) + if self.state then + self.state.bufnr = value + table.insert(old_bufs, value) + end + end + + local function get_bufnr_by_bufname(self, value) + if not self.state then + return nil + end + return bufname_table[value] + end + + local function set_bufname(self, value) + if self.state then + self.state.bufname = value + if value then + bufname_table[value] = get_bufnr(self) + end + end + end + + function opts.setup(self) + local state = {} + if opt_setup then + vim.tbl_deep_extend("force", state, opt_setup(self)) + end + return state + end + + function opts.teardown(self) + if opt_teardown then + opt_teardown(self) + end + + local last_nr + if opts.keep_last_buf then + last_nr = global_state.get_global_key "last_preview_bufnr" + -- Push in another buffer so the last one will not be cleaned up + if preview_window_id then + local bufnr = vim.api.nvim_create_buf(false, true) + utils.win_set_buf_noautocmd(preview_window_id, bufnr) + end + end + + set_bufnr(self, nil) + set_bufname(self, nil) + + for _, bufnr in ipairs(old_bufs) do + if bufnr ~= last_nr then + buf_delete(bufnr) + end + end + -- enable resuming picker with existing previewer to avoid lookup of deleted bufs + bufname_table = {} + end + + function opts.preview_fn(self, entry, status) + if get_bufnr(self) == nil then + set_bufnr(self, vim.api.nvim_win_get_buf(status.preview_win)) + preview_window_id = status.preview_win + end + + if opts.get_buffer_by_name and get_bufnr_by_bufname(self, opts.get_buffer_by_name(self, entry)) then + self.state.bufname = opts.get_buffer_by_name(self, entry) + self.state.bufnr = get_bufnr_by_bufname(self, self.state.bufname) + utils.win_set_buf_noautocmd(status.preview_win, self.state.bufnr) + else + local bufnr = vim.api.nvim_create_buf(false, true) + set_bufnr(self, bufnr) + + vim.schedule(function() + if vim.api.nvim_buf_is_valid(bufnr) then + utils.win_set_buf_noautocmd(status.preview_win, bufnr) + end + end) + + vim.api.nvim_win_set_option(status.preview_win, "winhl", "Normal:TelescopePreviewNormal") + vim.api.nvim_win_set_option(status.preview_win, "signcolumn", "no") + vim.api.nvim_win_set_option(status.preview_win, "foldlevel", 100) + vim.api.nvim_win_set_option(status.preview_win, "wrap", false) + vim.api.nvim_win_set_option(status.preview_win, "scrollbind", false) + + self.state.winid = status.preview_win + self.state.bufname = nil + end + + if opts.keep_last_buf then + global_state.set_global_key("last_preview_bufnr", self.state.bufnr) + end + + opts.define_preview(self, entry, status) + + vim.schedule(function() + if not self or not self.state or not self.state.bufnr then + return + end + + if vim.api.nvim_buf_is_valid(self.state.bufnr) then + vim.api.nvim_buf_call(self.state.bufnr, function() + vim.api.nvim_exec_autocmds("User", { + pattern = "TelescopePreviewerLoaded", + data = { + title = entry.preview_title, + bufname = self.state.bufname, + filetype = putils.filetype_detect(self.state.bufname or ""), + }, + }) + end) + end + end) + + if opts.get_buffer_by_name then + set_bufname(self, opts.get_buffer_by_name(self, entry)) + end + end + + if not opts.scroll_fn then + opts.scroll_fn = scroll_fn + end + + if not opts.scroll_horizontal_fn then + opts.scroll_horizontal_fn = scroll_horizontal_fn + end + + return Previewer:new(opts) +end + +previewers.cat = defaulter(function(opts) + opts = opts or {} + local cwd = opts.cwd or vim.loop.cwd() + return previewers.new_buffer_previewer { + title = "File Preview", + dyn_title = function(_, entry) + return Path:new(from_entry.path(entry, false, false)):normalize(cwd) + end, + + get_buffer_by_name = function(_, entry) + return from_entry.path(entry, false) + end, + + define_preview = function(self, entry) + local p = from_entry.path(entry, true) + if p == nil or p == "" then + return + end + conf.buffer_previewer_maker(p, self.state.bufnr, { + bufname = self.state.bufname, + winid = self.state.winid, + preview = opts.preview, + file_encoding = opts.file_encoding, + }) + end, + } +end, {}) + +previewers.vimgrep = defaulter(function(opts) + opts = opts or {} + local cwd = opts.cwd or vim.loop.cwd() + + local jump_to_line = function(self, bufnr, lnum) + pcall(vim.api.nvim_buf_clear_namespace, bufnr, ns_previewer, 0, -1) + if lnum and lnum > 0 then + pcall(vim.api.nvim_buf_add_highlight, bufnr, ns_previewer, "TelescopePreviewLine", lnum - 1, 0, -1) + pcall(vim.api.nvim_win_set_cursor, self.state.winid, { lnum, 0 }) + vim.api.nvim_buf_call(bufnr, function() + vim.cmd "norm! zz" + end) + end + end + + return previewers.new_buffer_previewer { + title = "Grep Preview", + dyn_title = function(_, entry) + return Path:new(from_entry.path(entry, false, false)):normalize(cwd) + end, + + get_buffer_by_name = function(_, entry) + return from_entry.path(entry, false) + end, + + define_preview = function(self, entry) + -- builtin.buffers: bypass path validation for terminal buffers that don't have appropriate path + local has_buftype = entry.bufnr and vim.api.nvim_buf_get_option(entry.bufnr, "buftype") ~= "" or false + local p + if not has_buftype then + p = from_entry.path(entry, true) + if p == nil or p == "" then + return + end + end + + -- Workaround for unnamed buffer when using builtin.buffer + if entry.bufnr and (p == "[No Name]" or has_buftype) then + local lines = vim.api.nvim_buf_get_lines(entry.bufnr, 0, -1, false) + vim.api.nvim_buf_set_lines(self.state.bufnr, 0, -1, false, lines) + jump_to_line(self, self.state.bufnr, entry.lnum) + else + conf.buffer_previewer_maker(p, self.state.bufnr, { + bufname = self.state.bufname, + winid = self.state.winid, + preview = opts.preview, + callback = function(bufnr) + jump_to_line(self, bufnr, entry.lnum) + end, + file_encoding = opts.file_encoding, + }) + end + end, + } +end, {}) + +previewers.qflist = previewers.vimgrep + +previewers.ctags = defaulter(function(_) + local determine_jump = function(entry) + if entry.scode then + return function(self) + -- un-escape / then escape required + -- special chars for vim.fn.search() + -- ] ~ * + local scode = entry.scode:gsub([[\/]], "/"):gsub("[%]~*]", function(x) + return "\\" .. x + end) + + pcall(vim.fn.matchdelete, self.state.hl_id, self.state.winid) + vim.cmd "norm! gg" + vim.fn.search(scode, "W") + vim.cmd "norm! zz" + + self.state.hl_id = vim.fn.matchadd("TelescopePreviewMatch", scode) + end + else + return function(self, bufnr) + if self.state.last_set_bufnr then + pcall(vim.api.nvim_buf_clear_namespace, self.state.last_set_bufnr, ns_previewer, 0, -1) + end + pcall(vim.api.nvim_buf_add_highlight, bufnr, ns_previewer, "TelescopePreviewMatch", entry.lnum - 1, 0, -1) + pcall(vim.api.nvim_win_set_cursor, self.state.winid, { entry.lnum, 0 }) + self.state.last_set_bufnr = bufnr + end + end + end + + return previewers.new_buffer_previewer { + title = "Tags Preview", + teardown = function(self) + if self.state and self.state.hl_id then + pcall(vim.fn.matchdelete, self.state.hl_id, self.state.hl_win) + self.state.hl_id = nil + elseif self.state and self.state.last_set_bufnr and vim.api.nvim_buf_is_valid(self.state.last_set_bufnr) then + vim.api.nvim_buf_clear_namespace(self.state.last_set_bufnr, ns_previewer, 0, -1) + end + end, + + get_buffer_by_name = function(_, entry) + return entry.filename + end, + + define_preview = function(self, entry) + conf.buffer_previewer_maker(entry.filename, self.state.bufnr, { + bufname = self.state.bufname, + winid = self.state.winid, + callback = function(bufnr) + pcall(vim.api.nvim_buf_call, bufnr, function() + determine_jump(entry)(self, bufnr) + end) + end, + }) + end, + } +end, {}) + +previewers.builtin = defaulter(function(_) + return previewers.new_buffer_previewer { + title = "Grep Preview", + teardown = search_teardown, + + get_buffer_by_name = function(_, entry) + return entry.filename + end, + + define_preview = function(self, entry) + local module_name = vim.fn.fnamemodify(vim.fn.fnamemodify(entry.filename, ":h"), ":t") + local text + if entry.text:sub(1, #module_name) ~= module_name then + text = module_name .. "." .. entry.text + else + text = entry.text:gsub("_", ".", 1) + end + + conf.buffer_previewer_maker(entry.filename, self.state.bufnr, { + bufname = self.state.bufname, + winid = self.state.winid, + callback = function(bufnr) + search_cb_jump(self, bufnr, text) + end, + }) + end, + } +end, {}) + +previewers.help = defaulter(function(_) + return previewers.new_buffer_previewer { + title = "Help Preview", + teardown = search_teardown, + + get_buffer_by_name = function(_, entry) + return entry.filename + end, + + define_preview = function(self, entry) + local query = entry.cmd + query = query:sub(2) + query = [[\V]] .. query + + conf.buffer_previewer_maker(entry.filename, self.state.bufnr, { + bufname = self.state.bufname, + winid = self.state.winid, + callback = function(bufnr) + putils.regex_highlighter(bufnr, "help") + search_cb_jump(self, bufnr, query) + end, + }) + end, + } +end, {}) + +previewers.man = defaulter(function(opts) + local pager = utils.get_lazy_default(opts.PAGER, function() + return vim.fn.executable "col" == 1 and { "col", "-bx" } or { "cat" } + end) + return previewers.new_buffer_previewer { + title = "Man Preview", + get_buffer_by_name = function(_, entry) + return entry.value .. "/" .. entry.section + end, + + define_preview = function(self, entry) + local win_width = vim.api.nvim_win_get_width(self.state.winid) + putils.job_maker(vim.deepcopy(pager), self.state.bufnr, { + writer = { "man", entry.section, entry.value }, + env = { ["MANWIDTH"] = win_width, PATH = vim.env.PATH, MANPATH = vim.env.MANPATH }, + value = entry.value .. "/" .. entry.section, + bufname = self.state.bufname, + }) + putils.regex_highlighter(self.state.bufnr, "man") + end, + } +end) + +previewers.git_branch_log = defaulter(function(opts) + local highlight_buffer = function(bufnr, content) + for i = 1, #content do + local line = content[i] + local _, hstart = line:find "[%*%s|]*" + if hstart then + local hend = hstart + 7 + if hend < #line then + pcall( + vim.api.nvim_buf_add_highlight, + bufnr, + ns_previewer, + "TelescopeResultsIdentifier", + i - 1, + hstart - 1, + hend + ) + end + end + local _, cstart = line:find "- %(" + if cstart then + local cend = string.find(line, "%) ") + if cend then + pcall( + vim.api.nvim_buf_add_highlight, + bufnr, + ns_previewer, + "TelescopeResultsConstant", + i - 1, + cstart - 1, + cend + ) + end + end + local dstart, _ = line:find " %(%d" + if dstart then + pcall( + vim.api.nvim_buf_add_highlight, + bufnr, + ns_previewer, + "TelescopeResultsSpecialComment", + i - 1, + dstart, + #line + ) + end + end + end + + return previewers.new_buffer_previewer { + title = "Git Branch Preview", + get_buffer_by_name = function(_, entry) + return entry.value + end, + + define_preview = function(self, entry) + local cmd = { + "git", + "--no-pager", + "log", + "--graph", + "--pretty=format:%h -%d %s (%cr)", + "--abbrev-commit", + "--date=relative", + entry.value, + } + + putils.job_maker(cmd, self.state.bufnr, { + value = entry.value, + bufname = self.state.bufname, + cwd = opts.cwd, + callback = function(bufnr, content) + if not content then + return + end + highlight_buffer(bufnr, content) + end, + }) + end, + } +end, {}) + +previewers.git_stash_diff = defaulter(function(opts) + return previewers.new_buffer_previewer { + title = "Git Stash Preview", + get_buffer_by_name = function(_, entry) + return entry.value + end, + + define_preview = function(self, entry, _) + putils.job_maker({ "git", "--no-pager", "stash", "show", "-p", entry.value }, self.state.bufnr, { + value = entry.value, + bufname = self.state.bufname, + cwd = opts.cwd, + callback = function(bufnr) + if vim.api.nvim_buf_is_valid(bufnr) then + putils.regex_highlighter(bufnr, "diff") + end + end, + }) + end, + } +end, {}) + +previewers.git_commit_diff_to_parent = defaulter(function(opts) + return previewers.new_buffer_previewer { + title = "Git Diff to Parent Preview", + teardown = search_teardown, + get_buffer_by_name = function(_, entry) + return entry.value + end, + + define_preview = function(self, entry) + local cmd = { "git", "--no-pager", "diff", entry.value .. "^!" } + if opts.current_file then + table.insert(cmd, "--") + table.insert(cmd, opts.current_file) + end + + putils.job_maker(cmd, self.state.bufnr, { + value = entry.value, + bufname = self.state.bufname, + cwd = opts.cwd, + callback = function(bufnr) + if vim.api.nvim_buf_is_valid(bufnr) then + search_cb_jump(self, bufnr, opts.current_line) + putils.regex_highlighter(bufnr, "diff") + end + end, + }) + end, + } +end, {}) + +previewers.git_commit_diff_to_head = defaulter(function(opts) + return previewers.new_buffer_previewer { + title = "Git Diff to Head Preview", + teardown = search_teardown, + + get_buffer_by_name = function(_, entry) + return entry.value + end, + + define_preview = function(self, entry) + local cmd = { "git", "--no-pager", "diff", "--cached", entry.value } + if opts.current_file then + table.insert(cmd, "--") + table.insert(cmd, opts.current_file) + end + + putils.job_maker(cmd, self.state.bufnr, { + value = entry.value, + bufname = self.state.bufname, + cwd = opts.cwd, + callback = function(bufnr) + if vim.api.nvim_buf_is_valid(bufnr) then + search_cb_jump(self, bufnr, opts.current_line) + putils.regex_highlighter(bufnr, "diff") + end + end, + }) + end, + } +end, {}) + +previewers.git_commit_diff_as_was = defaulter(function(opts) + return previewers.new_buffer_previewer { + title = "Git Show Preview", + teardown = search_teardown, + + get_buffer_by_name = function(_, entry) + return entry.value + end, + + define_preview = function(self, entry) + local cmd = { "git", "--no-pager", "show" } + local cf = opts.current_file and Path:new(opts.current_file):make_relative(opts.cwd) + local value = cf and (entry.value .. ":" .. cf) or entry.value + local ft = cf and putils.filetype_detect(value) or "diff" + table.insert(cmd, value) + + putils.job_maker(cmd, self.state.bufnr, { + value = entry.value, + bufname = self.state.bufname, + cwd = opts.cwd, + callback = function(bufnr) + if vim.api.nvim_buf_is_valid(bufnr) then + search_cb_jump(self, bufnr, opts.current_line) + putils.regex_highlighter(bufnr, ft) + end + end, + }) + end, + } +end, {}) + +previewers.git_commit_message = defaulter(function(opts) + local hl_map = { + "TelescopeResultsIdentifier", + "TelescopePreviewUser", + "TelescopePreviewDate", + } + return previewers.new_buffer_previewer { + title = "Git Message", + get_buffer_by_name = function(_, entry) + return entry.value + end, + + define_preview = function(self, entry) + local cmd = { "git", "--no-pager", "log", "-n 1", entry.value } + + putils.job_maker(cmd, self.state.bufnr, { + value = entry.value, + bufname = self.state.bufname, + cwd = opts.cwd, + callback = function(bufnr, content) + if not content then + return + end + for k, v in ipairs(hl_map) do + local _, s = content[k]:find "%s" + if s then + vim.api.nvim_buf_add_highlight(bufnr, ns_previewer, v, k - 1, s, #content[k]) + end + end + end, + }) + end, + } +end, {}) + +previewers.git_file_diff = defaulter(function(opts) + return previewers.new_buffer_previewer { + title = "Git File Diff Preview", + get_buffer_by_name = function(_, entry) + return entry.value + end, + + define_preview = function(self, entry) + if entry.status and (entry.status == "??" or entry.status == "A ") then + local p = from_entry.path(entry, true) + if p == nil or p == "" then + return + end + conf.buffer_previewer_maker(p, self.state.bufnr, { + bufname = self.state.bufname, + winid = self.state.winid, + }) + else + putils.job_maker({ "git", "--no-pager", "diff", "HEAD", "--", entry.value }, self.state.bufnr, { + value = entry.value, + bufname = self.state.bufname, + cwd = opts.cwd, + callback = function(bufnr) + if vim.api.nvim_buf_is_valid(bufnr) then + putils.regex_highlighter(bufnr, "diff") + end + end, + }) + end + end, + } +end, {}) + +previewers.autocommands = defaulter(function(_) + return previewers.new_buffer_previewer { + title = "Autocommands Preview", + teardown = function(self) + if self.state and self.state.last_set_bufnr and vim.api.nvim_buf_is_valid(self.state.last_set_bufnr) then + pcall(vim.api.nvim_buf_clear_namespace, self.state.last_set_bufnr, ns_previewer, 0, -1) + end + end, + + get_buffer_by_name = function(_, entry) + return entry.value.group_name + end, + + define_preview = function(self, entry, status) + local results = vim.tbl_filter(function(x) + return x.value.group_name == entry.value.group_name + end, status.picker.finder.results) + + if self.state.last_set_bufnr then + pcall(vim.api.nvim_buf_clear_namespace, self.state.last_set_bufnr, ns_previewer, 0, -1) + end + + local selected_row = 0 + if self.state.bufname ~= entry.value.group_name then + local display = {} + table.insert(display, string.format(" augroup: %s - [ %d entries ]", entry.value.group_name, #results)) + -- TODO: calculate banner width/string in setup() + -- TODO: get column characters to be the same HL group as border + table.insert(display, string.rep("─", vim.fn.getwininfo(status.preview_win)[1].width)) + + for idx, item in ipairs(results) do + if item == entry then + selected_row = idx + end + table.insert( + display, + string.format(" %-14s▏%-08s %s", item.value.event, item.value.pattern, item.value.command) + ) + end + + vim.api.nvim_buf_set_option(self.state.bufnr, "filetype", "vim") + vim.api.nvim_buf_set_lines(self.state.bufnr, 0, -1, false, display) + vim.api.nvim_buf_add_highlight(self.state.bufnr, 0, "TelescopeBorder", 1, 0, -1) + else + for idx, item in ipairs(results) do + if item == entry then + selected_row = idx + break + end + end + end + + vim.api.nvim_buf_add_highlight(self.state.bufnr, ns_previewer, "TelescopePreviewLine", selected_row + 1, 0, -1) + -- set the cursor position after self.state.bufnr is connected to the + -- preview window (which is scheduled in new_buffer_previewer) + vim.schedule(function() + pcall(vim.api.nvim_win_set_cursor, status.preview_win, { selected_row, 0 }) + end) + + self.state.last_set_bufnr = self.state.bufnr + end, + } +end, {}) + +previewers.highlights = defaulter(function(_) + return previewers.new_buffer_previewer { + title = "Highlights Preview", + teardown = function(self) + if self.state and self.state.last_set_bufnr and vim.api.nvim_buf_is_valid(self.state.last_set_bufnr) then + vim.api.nvim_buf_clear_namespace(self.state.last_set_bufnr, ns_previewer, 0, -1) + end + end, + + get_buffer_by_name = function() + return "highlights" + end, + + define_preview = function(self, entry) + if not self.state.bufname then + local output = vim.split(vim.fn.execute "highlight", "\n") + local hl_groups = {} + for _, v in ipairs(output) do + if v ~= "" then + if v:sub(1, 1) == " " then + local part_of_old = v:match "%s+(.*)" + hl_groups[#hl_groups] = hl_groups[#hl_groups] .. part_of_old + else + table.insert(hl_groups, v) + end + end + end + + vim.api.nvim_buf_set_lines(self.state.bufnr, 0, -1, false, hl_groups) + for k, v in ipairs(hl_groups) do + local startPos = string.find(v, "xxx", 1, true) - 1 + local endPos = startPos + 3 + local hlgroup = string.match(v, "([^ ]*)%s+.*") + pcall(vim.api.nvim_buf_add_highlight, self.state.bufnr, 0, hlgroup, k - 1, startPos, endPos) + end + end + + vim.schedule(function() + vim.api.nvim_buf_call(self.state.bufnr, function() + vim.cmd "norm! gg" + vim.fn.search(entry.value .. " ") + local lnum = vim.api.nvim_win_get_cursor(self.state.winid)[1] + -- That one is actually a match but its better to use it like that then matchadd + pcall(vim.api.nvim_buf_clear_namespace, self.state.bufnr, ns_previewer, 0, -1) + vim.api.nvim_buf_add_highlight( + self.state.bufnr, + ns_previewer, + "TelescopePreviewMatch", + lnum - 1, + 0, + #entry.value + ) + -- we need to zz after the highlighting otherwise highlighting doesnt work + vim.cmd "norm! zz" + end) + end) + end, + } +end, {}) + +previewers.pickers = defaulter(function(_) + local ns_telescope_multiselection = vim.api.nvim_create_namespace "telescope_mulitselection" + local get_row = function(picker, preview_height, index) + if picker.sorting_strategy == "ascending" then + return index - 1 + else + return preview_height - index + end + end + return previewers.new_buffer_previewer { + + dyn_title = function(_, entry) + if entry.value.default_text and entry.value.default_text ~= "" then + return string.format("%s ─ %s", entry.value.prompt_title, entry.value.default_text) + end + return entry.value.prompt_title + end, + + get_buffer_by_name = function(_, entry) + return tostring(entry.value.prompt_bufnr) + end, + + teardown = function(self) + if self.state and self.state.last_set_bufnr and vim.api.nvim_buf_is_valid(self.state.last_set_bufnr) then + vim.api.nvim_buf_clear_namespace(self.state.last_set_bufnr, ns_telescope_multiselection, 0, -1) + end + end, + + define_preview = function(self, entry) + vim.api.nvim_buf_call(self.state.bufnr, function() + local ns_telescope_entry = vim.api.nvim_create_namespace "telescope_entry" + local preview_height = vim.api.nvim_win_get_height(self.state.winid) + + if self.state.bufname then + return + end + + local picker = entry.value + -- prefill buffer to be able to set lines individually + local placeholder = utils.repeated_table(preview_height, "") + vim.api.nvim_buf_set_lines(self.state.bufnr, 0, -1, false, placeholder) + + for index = 1, math.min(preview_height, picker.manager:num_results()) do + local row = get_row(picker, preview_height, index) + local e = picker.manager:get_entry(index) + + local display, display_highlight + -- if-clause as otherwise function return values improperly unpacked + if type(e.display) == "function" then + display, display_highlight = e:display() + else + display = e.display + end + + vim.api.nvim_buf_set_lines(self.state.bufnr, row, row + 1, false, { display }) + + if display_highlight ~= nil then + for _, hl_block in ipairs(display_highlight) do + vim.api.nvim_buf_add_highlight( + self.state.bufnr, + ns_telescope_entry, + hl_block[2], + row, + hl_block[1][1], + hl_block[1][2] + ) + end + end + if picker._multi:is_selected(e) then + vim.api.nvim_buf_add_highlight( + self.state.bufnr, + ns_telescope_multiselection, + "TelescopeMultiSelection", + row, + 0, + -1 + ) + end + end + end) + end, + } +end, {}) + +previewers.display_content = defaulter(function(_) + return previewers.new_buffer_previewer { + define_preview = function(self, entry) + assert( + type(entry.preview_command) == "function", + "entry must provide a preview_command function which will put the content into the buffer" + ) + vim.api.nvim_buf_call(self.state.bufnr, function() + entry.preview_command(entry, self.state.bufnr) + end) + end, + } +end, {}) + +return previewers diff --git a/lua/kide/plugins/lazy-nvim.lua b/lua/kide/plugins/lazy-nvim.lua index c90ef25b..65f20ee3 100644 --- a/lua/kide/plugins/lazy-nvim.lua +++ b/lua/kide/plugins/lazy-nvim.lua @@ -261,7 +261,6 @@ require("lazy").setup({ event = { "VeryLazy" }, cmd = { "Telescope" }, keys = { "" }, - tag = "0.1.1", config = function() require("kide.plugins.config.telescope") end, From aa6f712c80c4a287c201471d7d509b9f73cc543d Mon Sep 17 00:00:00 2001 From: luokai Date: Tue, 4 Jul 2023 23:12:09 +0800 Subject: [PATCH 0753/1278] lsp_references --- lua/kide/core/keybindings.lua | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/lua/kide/core/keybindings.lua b/lua/kide/core/keybindings.lua index feb8ce77..22f63284 100644 --- a/lua/kide/core/keybindings.lua +++ b/lua/kide/core/keybindings.lua @@ -200,10 +200,17 @@ M.maplsp = function(client, buffer, null_ls) else vim.api.nvim_buf_set_keymap(buffer, "n", "gd", "lua vim.lsp.buf.definition()", opt) end + vim.api.nvim_buf_set_keymap(buffer, "n", "gh", "lua vim.lsp.buf.hover()", opt) vim.api.nvim_buf_set_keymap(buffer, "n", "gs", "lua vim.lsp.buf.signature_help()", opt) vim.api.nvim_buf_set_keymap(buffer, "n", "gi", "Telescope lsp_implementations", opt) - vim.api.nvim_buf_set_keymap(buffer, "n", "gr", "Telescope lsp_references", opt) + vim.api.nvim_buf_set_keymap( + buffer, + "n", + "gr", + "lua require('telescope.builtin').lsp_references({jump_type='never'})", + opt + ) vim.api.nvim_buf_set_keymap(buffer, "n", "fs", "Telescope lsp_dynamic_workspace_symbols", opt) keymap("v", "fs", function() local tb = require("telescope.builtin") From 4287808d2236195f614af8b0e3f3eaeebc7b3d39 Mon Sep 17 00:00:00 2001 From: luokai Date: Tue, 4 Jul 2023 23:22:17 +0800 Subject: [PATCH 0754/1278] edit --- lua/kide/plugins/config/telescope.lua | 55 +-- .../plugins/config/telescope/actions/set.lua | 313 ++++++++++++++++++ 2 files changed, 314 insertions(+), 54 deletions(-) create mode 100644 lua/kide/plugins/config/telescope/actions/set.lua diff --git a/lua/kide/plugins/config/telescope.lua b/lua/kide/plugins/config/telescope.lua index ad399dba..c82a465c 100644 --- a/lua/kide/plugins/config/telescope.lua +++ b/lua/kide/plugins/config/telescope.lua @@ -12,61 +12,8 @@ form_entry.path = function(entry, validate, escape) return f_path(entry, validate, escape) end -local utils = require("telescope.utils") local set = require("telescope.actions.set") -local action_state = require("telescope.actions.state") -local l_edit = set.edit -set.edit = function(prompt_bufnr, command) - local entry = action_state.get_selected_entry() - - if not entry then - utils.notify("actions.set.edit", { - msg = "Nothing currently selected", - level = "WARN", - }) - return - end - - local filename, row, col - - filename = entry.path or entry.filename - if not vim.startswith(filename, "jdt://") then - l_edit(prompt_bufnr, command) - return - end - - row = entry.row or entry.lnum - col = vim.F.if_nil(entry.col, 1) - - local picker = action_state.get_current_picker(prompt_bufnr) - require("telescope.pickers").on_close_prompt(prompt_bufnr) - pcall(vim.api.nvim_set_current_win, picker.original_win_id) - local win_id = picker.get_selection_window(picker, entry) - - if picker.push_cursor_on_edit then - vim.cmd("normal! m'") - end - - if picker.push_tagstack_on_edit then - local from = { vim.fn.bufnr("%"), vim.fn.line("."), vim.fn.col("."), 0 } - local items = { { tagname = vim.fn.expand(""), from = from } } - vim.fn.settagstack(vim.fn.win_getid(), { items = items }, "t") - end - - if win_id ~= 0 and a.nvim_get_current_win() ~= win_id then - vim.api.nvim_set_current_win(win_id) - end - - if vim.api.nvim_buf_get_name(0) ~= filename or command ~= "edit" then - local bufnr = vim.uri_to_bufnr(filename) - vim.bo[bufnr].buflisted = true - vim.api.nvim_win_set_buf(win_id, bufnr) - end - - if row and col then - pcall(vim.api.nvim_win_set_cursor, 0, { row, col }) - end -end +set.edit = require("kide.plugins.config.telescope.actions.set").edit local previewers = require("telescope.previewers") previewers.buffer_previewer_maker = require("kide.plugins.config.telescope.buffer_previewer").file_maker diff --git a/lua/kide/plugins/config/telescope/actions/set.lua b/lua/kide/plugins/config/telescope/actions/set.lua new file mode 100644 index 00000000..b9f78b2f --- /dev/null +++ b/lua/kide/plugins/config/telescope/actions/set.lua @@ -0,0 +1,313 @@ +---@tag telescope.actions.set +---@config { ["module"] = "telescope.actions.set", ["name"] = "ACTIONS_SET" } + +---@brief [[ +--- Telescope action sets are used to provide an interface for managing +--- actions that all primarily do the same thing, but with slight tweaks. +--- +--- For example, when editing files you may want it in the current split, +--- a vertical split, etc. Instead of making users have to overwrite EACH +--- of those every time they want to change this behavior, they can instead +--- replace the `set` itself and then it will work great and they're done. +---@brief ]] + +local a = vim.api + +local log = require "telescope.log" +local Path = require "plenary.path" +local state = require "telescope.state" +local utils = require "telescope.utils" + +local action_state = require "telescope.actions.state" + +local transform_mod = require("telescope.actions.mt").transform_mod + +local action_set = setmetatable({}, { + __index = function(_, k) + error("'telescope.actions.set' does not have a value: " .. tostring(k)) + end, +}) + +--- Move the current selection of a picker {change} rows. +--- Handles not overflowing / underflowing the list. +---@param prompt_bufnr number: The prompt bufnr +---@param change number: The amount to shift the selection by +action_set.shift_selection = function(prompt_bufnr, change) + local count = vim.v.count + count = count == 0 and 1 or count + count = a.nvim_get_mode().mode == "n" and count or 1 + action_state.get_current_picker(prompt_bufnr):move_selection(change * count) +end + +--- Select the current entry. This is the action set to overwrite common +--- actions by the user. +--- +--- By default maps to editing a file. +---@param prompt_bufnr number: The prompt bufnr +---@param type string: The type of selection to make +-- Valid types include: "default", "horizontal", "vertical", "tabedit" +action_set.select = function(prompt_bufnr, type) + return action_set.edit(prompt_bufnr, action_state.select_key_to_edit_key(type)) +end + +-- goal: currently we have a workaround in actions/init.lua where we do this for all files +-- action_set.select = { +-- -- Will not be called if `select_default` is replaced rather than `action_set.select` because we never get here +-- pre = function(prompt_bufnr) +-- action_state.get_current_history():append( +-- action_state.get_current_line(), +-- action_state.get_current_picker(prompt_bufnr) +-- ) +-- end, +-- action = function(prompt_bufnr, type) +-- return action_set.edit(prompt_bufnr, action_state.select_key_to_edit_key(type)) +-- end +-- } + +local edit_buffer +do + local map = { + drop = "drop", + ["tab drop"] = "tab drop", + edit = "buffer", + new = "sbuffer", + vnew = "vert sbuffer", + ["leftabove new"] = "leftabove sbuffer", + ["leftabove vnew"] = "leftabove vert sbuffer", + ["rightbelow new"] = "rightbelow sbuffer", + ["rightbelow vnew"] = "rightbelow vert sbuffer", + ["topleft new"] = "topleft sbuffer", + ["topleft vnew"] = "topleft vert sbuffer", + ["botright new"] = "botright sbuffer", + ["botright vnew"] = "botright vert sbuffer", + tabedit = "tab sb", + } + + edit_buffer = function(command, bufnr) + local buf_command = map[command] + if buf_command == nil then + local valid_commands = vim.tbl_map(function(cmd) + return string.format("%q", cmd) + end, vim.tbl_keys(map)) + table.sort(valid_commands) + error( + string.format( + "There was no associated buffer command for %q.\nValid commands are: %s.", + command, + table.concat(valid_commands, ", ") + ) + ) + end + if buf_command ~= "drop" and buf_command ~= "tab drop" then + vim.cmd(string.format("%s %d", buf_command, bufnr)) + else + vim.cmd(string.format("%s %s", buf_command, vim.fn.fnameescape(vim.api.nvim_buf_get_name(bufnr)))) + end + end +end + +--- Edit a file based on the current selection. +---@param prompt_bufnr number: The prompt bufnr +---@param command string: The command to use to open the file. +-- Valid commands are: +-- - "edit" +-- - "new" +-- - "vedit" +-- - "tabedit" +-- - "drop" +-- - "tab drop" +-- - "leftabove new" +-- - "leftabove vnew" +-- - "rightbelow new" +-- - "rightbelow vnew" +-- - "topleft new" +-- - "topleft vnew" +-- - "botright new" +-- - "botright vnew" +action_set.edit = function(prompt_bufnr, command) + local entry = action_state.get_selected_entry() + + if not entry then + utils.notify("actions.set.edit", { + msg = "Nothing currently selected", + level = "WARN", + }) + return + end + + local filename, row, col + + if entry.path or entry.filename then + filename = entry.path or entry.filename + + -- TODO: Check for off-by-one + row = entry.row or entry.lnum + col = entry.col + elseif not entry.bufnr then + -- TODO: Might want to remove this and force people + -- to put stuff into `filename` + local value = entry.value + if not value then + utils.notify("actions.set.edit", { + msg = "Could not do anything with blank line...", + level = "WARN", + }) + return + end + + if type(value) == "table" then + value = entry.display + end + + local sections = vim.split(value, ":") + + filename = sections[1] + row = tonumber(sections[2]) + col = tonumber(sections[3]) + end + + local entry_bufnr = entry.bufnr + + local picker = action_state.get_current_picker(prompt_bufnr) + require("telescope.pickers").on_close_prompt(prompt_bufnr) + pcall(vim.api.nvim_set_current_win, picker.original_win_id) + local win_id = picker.get_selection_window(picker, entry) + + if picker.push_cursor_on_edit then + vim.cmd "normal! m'" + end + + if picker.push_tagstack_on_edit then + local from = { vim.fn.bufnr "%", vim.fn.line ".", vim.fn.col ".", 0 } + local items = { { tagname = vim.fn.expand "", from = from } } + vim.fn.settagstack(vim.fn.win_getid(), { items = items }, "t") + end + + if win_id ~= 0 and a.nvim_get_current_win() ~= win_id then + vim.api.nvim_set_current_win(win_id) + end + + if entry_bufnr then + if not vim.api.nvim_buf_get_option(entry_bufnr, "buflisted") then + vim.api.nvim_buf_set_option(entry_bufnr, "buflisted", true) + end + edit_buffer(command, entry_bufnr) + else + -- check if we didn't pick a different buffer + -- prevents restarting lsp server + if vim.api.nvim_buf_get_name(0) ~= filename or command ~= "edit" then + if vim.startswith(filename, "jdt://") then + local bufnr = vim.uri_to_bufnr(filename) + vim.bo[bufnr].buflisted = true + vim.api.nvim_win_set_buf(win_id, bufnr) + else + filename = Path:new(filename):normalize(vim.uv.cwd()) + pcall(vim.cmd, string.format("%s %s", command, vim.fn.fnameescape(filename))) + end + end + end + + local pos = vim.api.nvim_win_get_cursor(0) + if col == nil then + if row == pos[1] then + col = pos[2] + 1 + elseif row == nil then + row, col = pos[1], pos[2] + 1 + else + col = 1 + end + end + + if row and col then + local ok, err_msg = pcall(a.nvim_win_set_cursor, 0, { row, col }) + if not ok then + log.debug("Failed to move to cursor:", err_msg, row, col) + end + end +end + +--- Scrolls the previewer up or down. +--- Defaults to a half page scroll, but can be overridden using the `scroll_speed` +--- option in `layout_config`. See |telescope.layout| for more details. +---@param prompt_bufnr number: The prompt bufnr +---@param direction number: The direction of the scrolling +-- Valid directions include: "1", "-1" +action_set.scroll_previewer = function(prompt_bufnr, direction) + local previewer = action_state.get_current_picker(prompt_bufnr).previewer + local status = state.get_status(prompt_bufnr) + + -- Check if we actually have a previewer and a preview window + if type(previewer) ~= "table" or previewer.scroll_fn == nil or status.preview_win == nil then + return + end + + local default_speed = vim.api.nvim_win_get_height(status.preview_win) / 2 + local speed = status.picker.layout_config.scroll_speed or default_speed + + previewer:scroll_fn(math.floor(speed * direction)) +end + +--- Scrolls the previewer to the left or right. +--- Defaults to a half page scroll, but can be overridden using the `scroll_speed` +--- option in `layout_config`. See |telescope.layout| for more details. +---@param prompt_bufnr number: The prompt bufnr +---@param direction number: The direction of the scrolling +-- Valid directions include: "1", "-1" +action_set.scroll_horizontal_previewer = function(prompt_bufnr, direction) + local previewer = action_state.get_current_picker(prompt_bufnr).previewer + local status = state.get_status(prompt_bufnr) + + -- Check if we actually have a previewer and a preview window + if type(previewer) ~= "table" or previewer.scroll_horizontal_fn == nil or status.preview_win == nil then + return + end + + local default_speed = vim.api.nvim_win_get_height(status.preview_win) / 2 + local speed = status.picker.layout_config.scroll_speed or default_speed + + previewer:scroll_horizontal_fn(math.floor(speed * direction)) +end + +--- Scrolls the results up or down. +--- Defaults to a half page scroll, but can be overridden using the `scroll_speed` +--- option in `layout_config`. See |telescope.layout| for more details. +---@param prompt_bufnr number: The prompt bufnr +---@param direction number: The direction of the scrolling +-- Valid directions include: "1", "-1" +action_set.scroll_results = function(prompt_bufnr, direction) + local status = state.get_status(prompt_bufnr) + local default_speed = vim.api.nvim_win_get_height(status.results_win) / 2 + local speed = status.picker.layout_config.scroll_speed or default_speed + + local input = direction > 0 and [[]] or [[]] + + vim.api.nvim_win_call(status.results_win, function() + vim.cmd([[normal! ]] .. math.floor(speed) .. input) + end) + + action_set.shift_selection(prompt_bufnr, math.floor(speed) * direction) +end + +--- Scrolls the results to the left or right. +--- Defaults to a half page scroll, but can be overridden using the `scroll_speed` +--- option in `layout_config`. See |telescope.layout| for more details. +---@param prompt_bufnr number: The prompt bufnr +---@param direction number: The direction of the scrolling +-- Valid directions include: "1", "-1" +action_set.scroll_horizontal_results = function(prompt_bufnr, direction) + local status = state.get_status(prompt_bufnr) + local default_speed = vim.api.nvim_win_get_height(status.results_win) / 2 + local speed = status.picker.layout_config.scroll_speed or default_speed + + local input = direction > 0 and [[zl]] or [[zh]] + + vim.api.nvim_win_call(status.results_win, function() + vim.cmd([[normal! ]] .. math.floor(speed) .. input) + end) +end + +-- ================================================== +-- Transforms modules and sets the corect metatables. +-- ================================================== +action_set = transform_mod(action_set) +return action_set From 66dd61a398c51928ee27f24279a39aba01e7ced7 Mon Sep 17 00:00:00 2001 From: luokai Date: Wed, 5 Jul 2023 09:16:41 +0800 Subject: [PATCH 0755/1278] rime_ls --- lua/kide/config.lua | 1 + lua/kide/lsp/init.lua | 1 + lua/kide/lsp/rime_ls.lua | 95 ++++++++++++++++++++++++++++++++++++++++ 3 files changed, 97 insertions(+) create mode 100644 lua/kide/lsp/rime_ls.lua diff --git a/lua/kide/config.lua b/lua/kide/config.lua index 1203525e..c4da878d 100644 --- a/lua/kide/config.lua +++ b/lua/kide/config.lua @@ -1,6 +1,7 @@ local M = { env = { py_bin = vim.env["PY_BIN"] or "/usr/bin/python3", + rime_ls_bin = vim.env["RIME_LS_BIN"], }, plugin = { copilot = { diff --git a/lua/kide/lsp/init.lua b/lua/kide/lsp/init.lua index 93c15c15..4b4cad4b 100644 --- a/lua/kide/lsp/init.lua +++ b/lua/kide/lsp/init.lua @@ -21,6 +21,7 @@ local server_configs = { vuels = {}, lemminx = require("kide.lsp.lemminx"), gdscript = require("kide.lsp.gdscript"), + rime_ls = require("kide.lsp.rime_ls"), } local utils = require("kide.core.utils") diff --git a/lua/kide/lsp/rime_ls.lua b/lua/kide/lsp/rime_ls.lua new file mode 100644 index 00000000..d3a92ca7 --- /dev/null +++ b/lua/kide/lsp/rime_ls.lua @@ -0,0 +1,95 @@ +local config = require("kide.config") +local utils = require("kide.core.utils") + +local M = {} + +function M.setup(opts) + if not config.env.rime_ls_bin then + return + end + -- global status + vim.g.rime_enabled = false + + -- update lualine + local function rime_status() + if vim.g.rime_enabled then + return "ㄓ" + else + return "" + end + end + + require("lualine").setup({ + sections = { + lualine_x = { rime_status, "encoding", "fileformat", "filetype" }, + }, + }) + + -- add rime-ls to lspconfig as a custom server + -- see `:h lspconfig-new` + local lspconfig = require("lspconfig") + local configs = require("lspconfig.configs") + if not configs.rime_ls then + configs.rime_ls = { + default_config = { + name = "rime_ls", + cmd = { config.env.rime_ls_bin }, + -- cmd = vim.lsp.rpc.connect('127.0.0.1', 9257), + filetypes = { "*" }, + single_file_support = true, + }, + settings = {}, + docs = { + description = [[ +https://www.github.com/wlh320/rime-ls + +A language server for librime +]], + }, + } + end + + local rime_on_attach = function(client, _) + local toggle_rime = function() + client.request("workspace/executeCommand", { command = "rime-ls.toggle-rime" }, function(_, result, ctx, _) + if ctx.client_id == client.id then + vim.g.rime_enabled = result + end + end) + end + -- keymaps for executing command + vim.keymap.set("n", "", function() + toggle_rime() + end) + vim.keymap.set("i", "", function() + toggle_rime() + end) + vim.keymap.set("n", "rs", function() + vim.lsp.buf.execute_command({ command = "rime-ls.sync-user-data" }) + end) + end + + local shared_data_dir = nil + if utils.is_mac then + shared_data_dir = "/Library/Input Methods/Squirrel.app/Contents/SharedSupport" + else + shared_data_dir = "/usr/share/rime-data" + end + + lspconfig.rime_ls.setup({ + init_options = { + enabled = vim.g.rime_enabled, + shared_data_dir = shared_data_dir, + user_data_dir = "~/.local/share/rime-ls", + log_dir = "~/.local/share/rime-ls", + max_candidates = 9, + trigger_characters = {}, + schema_trigger_character = "&", -- [since v0.2.0] 当输入此字符串时请求补全会触发 “方案选单” + }, + on_attach = rime_on_attach, + flags = opts.flags, + capabilities = opts.capabilities, + }) +end + +return M From 1fa18785f3a8cf73dd810315e4b3a6390d677314 Mon Sep 17 00:00:00 2001 From: luokai Date: Wed, 5 Jul 2023 09:47:22 +0800 Subject: [PATCH 0756/1278] cmp sort --- lua/kide/plugins/config/nvim-cmp.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lua/kide/plugins/config/nvim-cmp.lua b/lua/kide/plugins/config/nvim-cmp.lua index 74c0bbb5..123ea215 100644 --- a/lua/kide/plugins/config/nvim-cmp.lua +++ b/lua/kide/plugins/config/nvim-cmp.lua @@ -4,6 +4,7 @@ local config = require("kide.config") local function sorting() local comparators = { + cmp.config.compare.sort_text, -- Below is the default comparitor list and order for nvim-cmp cmp.config.compare.offset, -- cmp.config.compare.scopes, --this is commented in nvim-cmp too @@ -12,7 +13,6 @@ local function sorting() cmp.config.compare.recently_used, cmp.config.compare.locality, cmp.config.compare.kind, - cmp.config.compare.sort_text, cmp.config.compare.length, cmp.config.compare.order, } From 0918d17ec71af9dee2d6053dd1b623428be9e834 Mon Sep 17 00:00:00 2001 From: luokai Date: Wed, 5 Jul 2023 21:33:59 +0800 Subject: [PATCH 0757/1278] nvim-cmp --- lua/kide/lsp/init.lua | 29 +++++++++++++++----------- lua/kide/plugins/config/nvim-cmp.lua | 31 +++++++++++++++++++--------- lua/kide/plugins/lazy-nvim.lua | 5 +++++ 3 files changed, 43 insertions(+), 22 deletions(-) diff --git a/lua/kide/lsp/init.lua b/lua/kide/lsp/init.lua index 4b4cad4b..f9ceb1ff 100644 --- a/lua/kide/lsp/init.lua +++ b/lua/kide/lsp/init.lua @@ -81,7 +81,6 @@ vim.diagnostic.config({ severity_sort = false, }) -vim.lsp.handlers["textDocument/hover"] = vim.lsp.with(vim.lsp.handlers.hover, lsp_ui.hover_actions) vim.lsp.handlers["textDocument/signatureHelp"] = vim.lsp.with(vim.lsp.handlers.signature_help, lsp_ui.hover_actions) -- LspAttach 事件 @@ -203,25 +202,31 @@ local function convert_input_to_markdown_lines(input, contents) return contents end -local function jhover(_, result, ctx, c) - c = c or {} - c.focus_id = ctx.method - c.stylize_markdown = true +local function jhover(_, result, ctx, config) + config = config or {} + config.focus_id = ctx.method + if vim.api.nvim_get_current_buf() ~= ctx.bufnr then + -- Ignore result since buffer changed. This happens for slow language servers. + return + end if not (result and result.contents) then - vim.notify("No information available") + if config.silent ~= true then + vim.notify("No information available") + end return end local markdown_lines = convert_input_to_markdown_lines(result.contents) markdown_lines = vim.lsp.util.trim_empty_lines(markdown_lines) if vim.tbl_isempty(markdown_lines) then - vim.notify("No information available") + if config.silent ~= true then + vim.notify("No information available") + end return end - local b, w = vim.lsp.util.open_floating_preview(markdown_lines, "markdown", c) - return b, w + return vim.lsp.util.open_floating_preview(markdown_lines, "markdown", config) end - vim.lsp.handlers["textDocument/hover"] = vim.lsp.with(jhover, lsp_ui.hover_actions) + local source = require("cmp_nvim_lsp.source") source.resolve = function(self, completion_item, callback) -- client is stopped. @@ -235,8 +240,8 @@ source.resolve = function(self, completion_item, callback) end self:_request("completionItem/resolve", completion_item, function(_, response) - -- print(vim.inspect(response)) - if response and response.documentation then + -- jdtls 文档格式化 + if self.client.name == "jdtls" and response and response.documentation then response.documentation.value = markdown_format(response.documentation.value) end -- print(vim.inspect(response)) diff --git a/lua/kide/plugins/config/nvim-cmp.lua b/lua/kide/plugins/config/nvim-cmp.lua index 123ea215..a231f3cd 100644 --- a/lua/kide/plugins/config/nvim-cmp.lua +++ b/lua/kide/plugins/config/nvim-cmp.lua @@ -25,6 +25,13 @@ local function sorting() } end +local menu = { + nvim_lsp = "[LSP]", + luasnip = "[Lsnip]", + path = "[Path]", + copilot = "[Copilot]", + -- buffer = "[Buffer]", +} cmp.setup({ enabled = function() return vim.api.nvim_buf_get_option(0, "buftype") ~= "prompt" or require("cmp_dap").is_dap_buffer() @@ -69,25 +76,29 @@ cmp.setup({ formatting = { format = lspkind.cmp_format({ with_text = true, -- do not show text alongside icons - maxwidth = 50, -- prevent the popup from showing more than provided characters (e.g 50 will not show more than 50 characters) + maxwidth = 50, before = function(entry, vim_item) -- Source 显示提示来源 - vim_item.menu = "[" .. string.upper(entry.source.name) .. "]" + vim_item.kind = lspkind.symbolic(vim_item.kind, {}) + local m = vim_item.kind and vim_item.kind .. " " or "" + local ms = menu[entry.source.name] and m .. menu[entry.source.name] or m + vim_item.kind = ms return vim_item end, - menu = { - nvim_lsp = "[LSP]", - luasnip = "[Lsnip]", - path = "[Path]", - copilot = "[Copilot]", - -- buffer = "[Buffer]", - }, }), }, }) -- Use buffer source for `/` and `?` (if you enabled `native_menu`, this won't work anymore). -cmp.setup.cmdline({ "/", "?" }, { +cmp.setup.cmdline({ "/" }, { + mapping = cmp.mapping.preset.cmdline(), + sources = cmp.config.sources({ + { name = "nvim_lsp_document_symbol" }, + }, { + { name = "buffer" }, + }), +}) +cmp.setup.cmdline({ "?" }, { mapping = cmp.mapping.preset.cmdline(), sources = { { name = "buffer" }, diff --git a/lua/kide/plugins/lazy-nvim.lua b/lua/kide/plugins/lazy-nvim.lua index 65f20ee3..f73c178f 100644 --- a/lua/kide/plugins/lazy-nvim.lua +++ b/lua/kide/plugins/lazy-nvim.lua @@ -79,6 +79,7 @@ require("lazy").setup({ "saadparwaiz1/cmp_luasnip", "onsails/lspkind-nvim", "rcarriga/cmp-dap", + "hrsh7th/cmp-nvim-lsp-document-symbol", }, lazy = true, config = function() @@ -105,6 +106,10 @@ require("lazy").setup({ "rcarriga/cmp-dap", lazy = true, }, + { + "hrsh7th/cmp-nvim-lsp-document-symbol", + lazy = true, + }, { "jose-elias-alvarez/null-ls.nvim", lazy = true, From 9c3af3e6c72c1be06d5e8d1236963ae88ab32122 Mon Sep 17 00:00:00 2001 From: luokai Date: Wed, 5 Jul 2023 22:03:45 +0800 Subject: [PATCH 0758/1278] cmp fmt --- lua/kide/plugins/config/nvim-cmp.lua | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/lua/kide/plugins/config/nvim-cmp.lua b/lua/kide/plugins/config/nvim-cmp.lua index a231f3cd..011f3368 100644 --- a/lua/kide/plugins/config/nvim-cmp.lua +++ b/lua/kide/plugins/config/nvim-cmp.lua @@ -79,10 +79,10 @@ cmp.setup({ maxwidth = 50, before = function(entry, vim_item) -- Source 显示提示来源 - vim_item.kind = lspkind.symbolic(vim_item.kind, {}) - local m = vim_item.kind and vim_item.kind .. " " or "" - local ms = menu[entry.source.name] and m .. menu[entry.source.name] or m - vim_item.kind = ms + vim_item.menu = lspkind.symbolic(vim_item.menu, {}) + local m = vim_item.menu and vim_item.menu .. " " or "" + local ms = menu[entry.source.name] and menu[entry.source.name] .. m or m + vim_item.menu = ms return vim_item end, }), From 7dfa09cda5af3e3d058fcab232d3b0e5370fbd07 Mon Sep 17 00:00:00 2001 From: luokai Date: Wed, 5 Jul 2023 22:09:10 +0800 Subject: [PATCH 0759/1278] pumheight --- lua/kide/core/basic.lua | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lua/kide/core/basic.lua b/lua/kide/core/basic.lua index 62512cd0..293817e3 100644 --- a/lua/kide/core/basic.lua +++ b/lua/kide/core/basic.lua @@ -49,7 +49,8 @@ vim.opt.fileencoding = "UTF-8" -- jk移动时光标下上方保留8行 vim.opt.scrolloff = 3 vim.opt.sidescrolloff = 3 - +vim.opt.signcolumn = "auto" +vim.opt.pumheight = 20 -- 缩进配置 vim.opt.tabstop = 4 vim.opt.softtabstop = 4 From 6df0676ff59cb2a654d8546e05046de108e369f3 Mon Sep 17 00:00:00 2001 From: luokai Date: Wed, 5 Jul 2023 22:33:00 +0800 Subject: [PATCH 0760/1278] assertj --- lua/kide/lsp/java.lua | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/lua/kide/lsp/java.lua b/lua/kide/lsp/java.lua index 9b58ea95..ca0d67d2 100644 --- a/lua/kide/lsp/java.lua +++ b/lua/kide/lsp/java.lua @@ -261,12 +261,10 @@ local config = { contentProvider = { preferred = "fernflower" }, completion = { favoriteStaticMembers = { - "org.junit.Assert.*", - "org.assertj.core.api.Assertions.*", - -- "org.hamcrest.MatcherAssert.assertThat", - -- "org.hamcrest.Matchers.*", - -- "org.hamcrest.CoreMatchers.*", - -- "org.junit.jupiter.api.Assertions.*", + "org.assertj.core.api.Assertions.assertThat", + "org.assertj.core.api.Assertions.assertThatThrownBy", + "org.assertj.core.api.Assertions.assertThatExceptionOfType", + "org.assertj.core.api.Assertions.catchThrowable", "java.util.Objects.requireNonNull", "java.util.Objects.requireNonNullElse", "org.mockito.Mockito.*", From a8ab690788c257219bb02fc2228379b6d2eac177 Mon Sep 17 00:00:00 2001 From: luokai Date: Wed, 5 Jul 2023 23:03:53 +0800 Subject: [PATCH 0761/1278] rime --- lua/kide/plugins/config/nvim-cmp.lua | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/lua/kide/plugins/config/nvim-cmp.lua b/lua/kide/plugins/config/nvim-cmp.lua index 011f3368..ff30e474 100644 --- a/lua/kide/plugins/config/nvim-cmp.lua +++ b/lua/kide/plugins/config/nvim-cmp.lua @@ -80,8 +80,18 @@ cmp.setup({ before = function(entry, vim_item) -- Source 显示提示来源 vim_item.menu = lspkind.symbolic(vim_item.menu, {}) - local m = vim_item.menu and vim_item.menu .. " " or "" - local ms = menu[entry.source.name] and menu[entry.source.name] .. m or m + local m = vim_item.menu and vim_item.menu or "" + + local ms + if entry.source.source.client then + if entry.source.source.client.name == "rime_ls" then + ms = "[rime]" + else + ms = menu[entry.source.name] and menu[entry.source.name] .. m or m + end + else + ms = m + end vim_item.menu = ms return vim_item end, From 304c6696008ef045304e0ff5b9d2062a0934e1fd Mon Sep 17 00:00:00 2001 From: luokai Date: Wed, 5 Jul 2023 23:17:53 +0800 Subject: [PATCH 0762/1278] cmp fmt --- lua/kide/plugins/config/nvim-cmp.lua | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/lua/kide/plugins/config/nvim-cmp.lua b/lua/kide/plugins/config/nvim-cmp.lua index ff30e474..f23440dd 100644 --- a/lua/kide/plugins/config/nvim-cmp.lua +++ b/lua/kide/plugins/config/nvim-cmp.lua @@ -83,14 +83,10 @@ cmp.setup({ local m = vim_item.menu and vim_item.menu or "" local ms - if entry.source.source.client then - if entry.source.source.client.name == "rime_ls" then - ms = "[rime]" - else - ms = menu[entry.source.name] and menu[entry.source.name] .. m or m - end + if entry.source.source.client and entry.source.source.client.name == "rime_ls" then + ms = "[rime]" else - ms = m + ms = menu[entry.source.name] and menu[entry.source.name] .. m or m end vim_item.menu = ms return vim_item From df361ed74f89d4378b0cda6296dcc7943f5e6b3d Mon Sep 17 00:00:00 2001 From: luokai Date: Wed, 5 Jul 2023 23:21:45 +0800 Subject: [PATCH 0763/1278] =?UTF-8?q?copilot=20=E6=8E=92=E9=99=A4=20java?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lua/kide/plugins/lazy-nvim.lua | 3 +++ 1 file changed, 3 insertions(+) diff --git a/lua/kide/plugins/lazy-nvim.lua b/lua/kide/plugins/lazy-nvim.lua index f73c178f..88962859 100644 --- a/lua/kide/plugins/lazy-nvim.lua +++ b/lua/kide/plugins/lazy-nvim.lua @@ -801,6 +801,9 @@ require("lazy").setup({ cmd = "Copilot", config = function() require("copilot").setup({ + filetypes = { + java = false, + }, suggestion = { enabled = false }, panel = { enabled = false }, }) From ed886f59a0ce07bc919a7856a13cff737b236d71 Mon Sep 17 00:00:00 2001 From: luokai Date: Thu, 6 Jul 2023 10:42:52 +0800 Subject: [PATCH 0764/1278] =?UTF-8?q?=E7=BB=9F=E4=B8=80=20lsp=20ui=20?= =?UTF-8?q?=E6=A0=B7=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lua/kide/lsp/init.lua | 9 ++++++- lua/kide/lsp/lsp_ui.lua | 35 +++++++++++++++++++--------- lua/kide/plugins/config/gruvbox.lua | 12 +++++----- lua/kide/plugins/config/nvim-cmp.lua | 11 +++++++++ 4 files changed, 49 insertions(+), 18 deletions(-) diff --git a/lua/kide/lsp/init.lua b/lua/kide/lsp/init.lua index f9ceb1ff..b4d31b5d 100644 --- a/lua/kide/lsp/init.lua +++ b/lua/kide/lsp/init.lua @@ -223,9 +223,16 @@ local function jhover(_, result, ctx, config) end return end - return vim.lsp.util.open_floating_preview(markdown_lines, "markdown", config) + local bufnr, winnr = vim.lsp.util.open_floating_preview(markdown_lines, "markdown", config) + vim.api.nvim_win_set_option(winnr, "winhighlight", lsp_ui.window.winhighlight) + return bufnr, winnr end vim.lsp.handlers["textDocument/hover"] = vim.lsp.with(jhover, lsp_ui.hover_actions) +vim.lsp.handlers["textDocument/signatureHelp"] = vim.lsp.with(function(a, result, ctx, b) + local bufnr, winnr = vim.lsp.handlers.signature_help(a, result, ctx, b) + vim.api.nvim_win_set_option(winnr, "winhighlight", lsp_ui.window.winhighlight) + return bufnr, winnr +end, lsp_ui.hover_actions) local source = require("cmp_nvim_lsp.source") source.resolve = function(self, completion_item, callback) diff --git a/lua/kide/lsp/lsp_ui.lua b/lua/kide/lsp/lsp_ui.lua index 7787134c..4142cccd 100644 --- a/lua/kide/lsp/lsp_ui.lua +++ b/lua/kide/lsp/lsp_ui.lua @@ -42,18 +42,31 @@ M.symbol_map = { Fragment = { icon = "", hl = "@constant" }, } +M.window = { + winhighlight = "Normal:Normal,FloatBorder:Normal,CursorLine:Visual,Search:None", +} + M.hover_actions = { - width = 120, - -- border = { - -- { "╭", "FloatBorder" }, - -- { "─", "FloatBorder" }, - -- { "╮", "FloatBorder" }, - -- { "│", "FloatBorder" }, - -- { "╯", "FloatBorder" }, - -- { "─", "FloatBorder" }, - -- { "╰", "FloatBorder" }, - -- { "│", "FloatBorder" }, - -- }, + border = { + { "╭", "FloatBorder" }, + { "─", "FloatBorder" }, + { "╮", "FloatBorder" }, + { "│", "FloatBorder" }, + { "╯", "FloatBorder" }, + { "─", "FloatBorder" }, + { "╰", "FloatBorder" }, + { "│", "FloatBorder" }, + }, + style = "fillchars", + -- Maximal width of the hover window. Nil means no max. + max_width = nil, + + -- Maximal height of the hover window. Nil means no max. + max_height = nil, + + -- whether the hover action window gets automatically focused + -- default: false + auto_focus = false, } M.signs = { diff --git a/lua/kide/plugins/config/gruvbox.lua b/lua/kide/plugins/config/gruvbox.lua index ad1fbac0..e2fd69f5 100644 --- a/lua/kide/plugins/config/gruvbox.lua +++ b/lua/kide/plugins/config/gruvbox.lua @@ -5,12 +5,12 @@ if transparent_mode then bg = "none", } else - overrides.NormalFloat = { - bg = "#313131", - } - overrides.Pmenu = { - bg = "#2e2e2e", - } + -- overrides.NormalFloat = { + -- bg = "#313131", + -- } + -- overrides.Pmenu = { + -- bg = "#2e2e2e", + -- } end require("gruvbox").setup({ undercurl = true, diff --git a/lua/kide/plugins/config/nvim-cmp.lua b/lua/kide/plugins/config/nvim-cmp.lua index f23440dd..22c25353 100644 --- a/lua/kide/plugins/config/nvim-cmp.lua +++ b/lua/kide/plugins/config/nvim-cmp.lua @@ -32,10 +32,21 @@ local menu = { copilot = "[Copilot]", -- buffer = "[Buffer]", } +local lsp_ui = require("kide.lsp.lsp_ui") cmp.setup({ enabled = function() return vim.api.nvim_buf_get_option(0, "buftype") ~= "prompt" or require("cmp_dap").is_dap_buffer() end, + window = { + completion = cmp.config.window.bordered({ + border = lsp_ui.hover_actions.border, + winhighlight = lsp_ui.window.highlight, + }), + documentation = cmp.config.window.bordered({ + border = lsp_ui.hover_actions.border, + winhighlight = lsp_ui.window.highlight, + }), + }, sorting = sorting(), -- 指定 snippet 引擎 snippet = { From a3a237f7edf01d2c0405ac9c154705e2f7a6416a Mon Sep 17 00:00:00 2001 From: luokai Date: Thu, 6 Jul 2023 22:41:14 +0800 Subject: [PATCH 0765/1278] LineNr --- lua/kide/lsp/lsp_ui.lua | 2 +- lua/kide/plugins/config/nvim-cmp.lua | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/lua/kide/lsp/lsp_ui.lua b/lua/kide/lsp/lsp_ui.lua index 4142cccd..0b3fa0e8 100644 --- a/lua/kide/lsp/lsp_ui.lua +++ b/lua/kide/lsp/lsp_ui.lua @@ -43,7 +43,7 @@ M.symbol_map = { } M.window = { - winhighlight = "Normal:Normal,FloatBorder:Normal,CursorLine:Visual,Search:None", + winhighlight = "Normal:Normal,FloatBorder:LineNr,CursorLine:Visual,Search:None", } M.hover_actions = { diff --git a/lua/kide/plugins/config/nvim-cmp.lua b/lua/kide/plugins/config/nvim-cmp.lua index 22c25353..a94806f7 100644 --- a/lua/kide/plugins/config/nvim-cmp.lua +++ b/lua/kide/plugins/config/nvim-cmp.lua @@ -40,11 +40,11 @@ cmp.setup({ window = { completion = cmp.config.window.bordered({ border = lsp_ui.hover_actions.border, - winhighlight = lsp_ui.window.highlight, + winhighlight = lsp_ui.window.winhighlight, }), documentation = cmp.config.window.bordered({ border = lsp_ui.hover_actions.border, - winhighlight = lsp_ui.window.highlight, + winhighlight = lsp_ui.window.winhighlight, }), }, sorting = sorting(), From f3f349fd8aa28542fafbc7850496f1b7dba3b72a Mon Sep 17 00:00:00 2001 From: luokai Date: Thu, 6 Jul 2023 22:55:30 +0800 Subject: [PATCH 0766/1278] FloatBorder --- lua/kide/lsp/lsp_ui.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lua/kide/lsp/lsp_ui.lua b/lua/kide/lsp/lsp_ui.lua index 0b3fa0e8..b9f35f12 100644 --- a/lua/kide/lsp/lsp_ui.lua +++ b/lua/kide/lsp/lsp_ui.lua @@ -43,7 +43,7 @@ M.symbol_map = { } M.window = { - winhighlight = "Normal:Normal,FloatBorder:LineNr,CursorLine:Visual,Search:None", + winhighlight = "Normal:Normal,FloatBorder:FloatBorder,CursorLine:Visual,Search:None", } M.hover_actions = { From 9361e490e40230b495a7b154c31b4e0a83f2b56b Mon Sep 17 00:00:00 2001 From: luokai Date: Thu, 6 Jul 2023 23:08:33 +0800 Subject: [PATCH 0767/1278] FloatBorder --- lua/kide/plugins/config/gruvbox.lua | 3 +++ 1 file changed, 3 insertions(+) diff --git a/lua/kide/plugins/config/gruvbox.lua b/lua/kide/plugins/config/gruvbox.lua index e2fd69f5..a9212974 100644 --- a/lua/kide/plugins/config/gruvbox.lua +++ b/lua/kide/plugins/config/gruvbox.lua @@ -11,6 +11,9 @@ else -- overrides.Pmenu = { -- bg = "#2e2e2e", -- } + overrides.FloatBorder = { + fg = "#a89984", + } end require("gruvbox").setup({ undercurl = true, From 1735a10bf9cbdfd0376c4fde3a84bb7cb856824a Mon Sep 17 00:00:00 2001 From: luokai Date: Fri, 7 Jul 2023 23:32:10 +0800 Subject: [PATCH 0768/1278] nvim-colorizer --- lua/kide/plugins/config/nvim-colorizer.lua | 49 ++++++++++++---------- lua/kide/plugins/lazy-nvim.lua | 2 +- 2 files changed, 28 insertions(+), 23 deletions(-) diff --git a/lua/kide/plugins/config/nvim-colorizer.lua b/lua/kide/plugins/config/nvim-colorizer.lua index 31326e84..326e542c 100644 --- a/lua/kide/plugins/config/nvim-colorizer.lua +++ b/lua/kide/plugins/config/nvim-colorizer.lua @@ -1,22 +1,27 @@ -local present, colorizer = pcall(require, "colorizer") -if present then - local default = { - filetypes = { - "*", - }, - user_default_options = { - RGB = true, -- #RGB hex codes - RRGGBB = true, -- #RRGGBB hex codes - names = false, -- "Name" codes like Blue - RRGGBBAA = false, -- #RRGGBBAA hex codes - rgb_fn = false, -- CSS rgb() and rgba() functions - hsl_fn = false, -- CSS hsl() and hsla() functions - css = false, -- Enable all CSS features: rgb_fn, hsl_fn, names, RGB, RRGGBB - css_fn = false, -- Enable all CSS *functions*: rgb_fn, hsl_fn - - -- Available modes: foreground, background - mode = "background", -- Set the display mode. - }, - } - colorizer.setup(default["filetypes"], default["user_default_options"]) -end +require("colorizer").setup({ + filetypes = { "*" }, + user_default_options = { + RGB = true, -- #RGB hex codes + RRGGBB = true, -- #RRGGBB hex codes + names = true, -- "Name" codes like Blue or blue + RRGGBBAA = false, -- #RRGGBBAA hex codes + AARRGGBB = false, -- 0xAARRGGBB hex codes + rgb_fn = false, -- CSS rgb() and rgba() functions + hsl_fn = false, -- CSS hsl() and hsla() functions + css = false, -- Enable all CSS features: rgb_fn, hsl_fn, names, RGB, RRGGBB + css_fn = false, -- Enable all CSS *functions*: rgb_fn, hsl_fn + -- Available modes for `mode`: foreground, background, virtualtext + mode = "background", -- Set the display mode. + -- Available methods are false / true / "normal" / "lsp" / "both" + -- True is same as normal + tailwind = false, -- Enable tailwind colors + -- parsers can contain values used in |user_default_options| + sass = { enable = false, parsers = { "css" } }, -- Enable sass colors + virtualtext = "■", + -- update color values even if buffer is not focused + -- example use: cmp_menu, cmp_docs + always_update = false, + }, + -- all the sub-options of filetypes apply to buftypes + buftypes = {}, +}) diff --git a/lua/kide/plugins/lazy-nvim.lua b/lua/kide/plugins/lazy-nvim.lua index 88962859..2b94da83 100644 --- a/lua/kide/plugins/lazy-nvim.lua +++ b/lua/kide/plugins/lazy-nvim.lua @@ -427,7 +427,7 @@ require("lazy").setup({ -- 颜色显示 { - "norcalli/nvim-colorizer.lua", + "NvChad/nvim-colorizer.lua", event = { "BufReadPost", "InsertEnter", "VeryLazy" }, config = function() require("kide.plugins.config.nvim-colorizer") From f8c935838974d17b19c5d3f8ddce786d18e38733 Mon Sep 17 00:00:00 2001 From: luokai Date: Fri, 7 Jul 2023 23:45:11 +0800 Subject: [PATCH 0769/1278] fix: lazy config --- lua/kide/plugins/lazy-nvim.lua | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/lua/kide/plugins/lazy-nvim.lua b/lua/kide/plugins/lazy-nvim.lua index 2b94da83..f6608382 100644 --- a/lua/kide/plugins/lazy-nvim.lua +++ b/lua/kide/plugins/lazy-nvim.lua @@ -160,7 +160,7 @@ require("lazy").setup({ { "akinsho/bufferline.nvim", version = "*", - requires = "kyazdani42/nvim-web-devicons", + dependencies = { "nvim-tree/nvim-web-devicons" }, config = function() require("kide.plugins.config.bufferline") end, @@ -298,7 +298,7 @@ require("lazy").setup({ -- git { "tpope/vim-fugitive", - layz = true, + lazy = true, cmd = { "Git" }, }, { @@ -319,8 +319,8 @@ require("lazy").setup({ }, { "NeogitOrg/neogit", - layz = true, - cmd = "Neogit", + lazy = true, + cmd = { "Neogit" }, dependencies = { "sindrets/diffview.nvim" }, config = function() require("kide.plugins.config.neogit") @@ -330,7 +330,7 @@ require("lazy").setup({ -- git edit 状态显示插件 { "lewis6991/gitsigns.nvim", - layz = true, + lazy = true, event = { "VeryLazy", "BufReadPost" }, config = function() require("kide.plugins.config.gitsigns-nvim") From 65109d0c67442f550bafa9d9c55e4dd52eac5a57 Mon Sep 17 00:00:00 2001 From: luokai Date: Sat, 8 Jul 2023 09:43:13 +0800 Subject: [PATCH 0770/1278] which-key color --- lua/kide/plugins/config/which-key.lua | 2 ++ lua/kide/theme/gruvbox.lua | 6 ++++++ 2 files changed, 8 insertions(+) diff --git a/lua/kide/plugins/config/which-key.lua b/lua/kide/plugins/config/which-key.lua index 7379abbe..990049e5 100644 --- a/lua/kide/plugins/config/which-key.lua +++ b/lua/kide/plugins/config/which-key.lua @@ -6,3 +6,5 @@ which_key.setup({ group = "+", -- symbol prepended to a group }, }) + +require("kide.theme.gruvbox").load_which_key_highlights() diff --git a/lua/kide/theme/gruvbox.lua b/lua/kide/theme/gruvbox.lua index e0e3ef92..602fd42d 100644 --- a/lua/kide/theme/gruvbox.lua +++ b/lua/kide/theme/gruvbox.lua @@ -78,4 +78,10 @@ M.load_highlights = function(hl_groups) end end +M.load_which_key_highlights = function() + M.load_highlights({ + WhichKeyFloat = { bg = colors.black3 }, + }) +end + return M From 8f1d7ba4267c31ca19c4c8a3f9983f5828317b51 Mon Sep 17 00:00:00 2001 From: luokai Date: Sat, 8 Jul 2023 09:50:34 +0800 Subject: [PATCH 0771/1278] =?UTF-8?q?=E5=8E=BB=E9=99=A4=E5=86=B2=E7=AA=81?= =?UTF-8?q?=E5=BF=AB=E6=8D=B7=E9=94=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lua/kide/core/keybindings.lua | 6 ------ lua/kide/plugins/lazy-nvim.lua | 3 --- 2 files changed, 9 deletions(-) diff --git a/lua/kide/core/keybindings.lua b/lua/kide/core/keybindings.lua index 22f63284..d063f6e8 100644 --- a/lua/kide/core/keybindings.lua +++ b/lua/kide/core/keybindings.lua @@ -290,10 +290,4 @@ M.ufo_mapkey = function() vim.keymap.set("n", "zM", require("ufo").closeAllFolds) end -M.easy_align = function() - -- vim-easy-align - keymap("n", "ga", "(EasyAlign)") - keymap("x", "ga", "(EasyAlign)") -end - return M diff --git a/lua/kide/plugins/lazy-nvim.lua b/lua/kide/plugins/lazy-nvim.lua index f6608382..3dd1fac9 100644 --- a/lua/kide/plugins/lazy-nvim.lua +++ b/lua/kide/plugins/lazy-nvim.lua @@ -522,9 +522,6 @@ require("lazy").setup({ "junegunn/vim-easy-align", lazy = true, cmd = "EasyAlign", - config = function() - require("kide.core.keybindings").easy_align() - end, }, -- 表格模式插件 From ae8dd1243fa5a4ad5b4e718e6bbddc128bb8679d Mon Sep 17 00:00:00 2001 From: luokai Date: Sat, 8 Jul 2023 09:57:45 +0800 Subject: [PATCH 0772/1278] config --- lua/kide/plugins/lazy-nvim.lua | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/lua/kide/plugins/lazy-nvim.lua b/lua/kide/plugins/lazy-nvim.lua index 3dd1fac9..9dac64d5 100644 --- a/lua/kide/plugins/lazy-nvim.lua +++ b/lua/kide/plugins/lazy-nvim.lua @@ -25,7 +25,7 @@ require("lazy").setup({ }, { "neovim/nvim-lspconfig", - event = { "BufNewFile", "BufReadPost" }, + event = { "VeryLazy", "BufNewFile", "BufReadPost" }, config = function() require("kide.lsp") end, @@ -113,7 +113,7 @@ require("lazy").setup({ { "jose-elias-alvarez/null-ls.nvim", lazy = true, - event = { "BufNewFile", "BufReadPost" }, + event = { "VeryLazy", "BufNewFile", "BufReadPost" }, config = function() require("kide.plugins.config.null-ls") end, @@ -169,7 +169,7 @@ require("lazy").setup({ -- treesitter (新增) { "nvim-treesitter/nvim-treesitter", - event = { "BufNewFile", "BufReadPost" }, + event = { "VeryLazy", "BufNewFile", "BufReadPost" }, build = ":TSUpdate", config = function() require("kide.plugins.config.nvim-treesitter") @@ -178,7 +178,7 @@ require("lazy").setup({ { "nvim-treesitter/nvim-treesitter-textobjects", dependencies = { "nvim-treesitter/nvim-treesitter" }, - event = { "BufNewFile", "BufReadPost" }, + event = { "VeryLazy", "BufNewFile", "BufReadPost" }, }, -- java @@ -265,7 +265,6 @@ require("lazy").setup({ lazy = true, event = { "VeryLazy" }, cmd = { "Telescope" }, - keys = { "" }, config = function() require("kide.plugins.config.telescope") end, From 73a4ec0e7bb17e56d2f7bb1a462bef9abcee9e7f Mon Sep 17 00:00:00 2001 From: luokai Date: Sat, 8 Jul 2023 10:16:02 +0800 Subject: [PATCH 0773/1278] =?UTF-8?q?diffview-nvim=20=E4=BD=BF=E7=94=A8?= =?UTF-8?q?=E9=BB=98=E8=AE=A4=E9=85=8D=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lua/kide/plugins/config/diffview-nvim.lua | 121 +--------------------- 1 file changed, 1 insertion(+), 120 deletions(-) diff --git a/lua/kide/plugins/config/diffview-nvim.lua b/lua/kide/plugins/config/diffview-nvim.lua index 7e299816..23f0d163 100644 --- a/lua/kide/plugins/config/diffview-nvim.lua +++ b/lua/kide/plugins/config/diffview-nvim.lua @@ -1,120 +1 @@ --- Lua -local actions = require("diffview.actions") - -require("diffview").setup({ - diff_binaries = false, -- Show diffs for binaries - enhanced_diff_hl = false, -- See ':h diffview-config-enhanced_diff_hl' - git_cmd = { "git" }, -- The git executable followed by default args. - use_icons = true, -- Requires nvim-web-devicons - icons = { -- Only applies when use_icons is true. - folder_closed = "", - folder_open = "", - }, - signs = { - fold_closed = "", - fold_open = "", - }, - file_panel = { - listing_style = "tree", -- One of 'list' or 'tree' - tree_options = { -- Only applies when listing_style is 'tree' - flatten_dirs = true, -- Flatten dirs that only contain one single dir - folder_statuses = "only_folded", -- One of 'never', 'only_folded' or 'always'. - }, - win_config = { -- See ':h diffview-config-win_config' - position = "left", - width = 35, - }, - }, - file_history_panel = { - git = { - log_options = { -- See ':h diffview-config-log_options' - single_file = { - diff_merges = "combined", - }, - multi_file = { - diff_merges = "first-parent", - }, - }, - }, - win_config = { -- See ':h diffview-config-win_config' - position = "bottom", - height = 16, - }, - }, - commit_log_panel = { - win_config = {}, -- See ':h diffview-config-win_config' - }, - default_args = { -- Default args prepended to the arg-list for the listed commands - DiffviewOpen = {}, - DiffviewFileHistory = {}, - }, - hooks = {}, -- See ':h diffview-config-hooks' - keymaps = { - disable_defaults = false, -- Disable the default keymaps - view = { - -- The `view` bindings are active in the diff buffers, only when the current - -- tabpage is a Diffview. - [""] = actions.select_next_entry, -- Open the diff for the next file - [""] = actions.select_prev_entry, -- Open the diff for the previous file - ["gf"] = actions.goto_file, -- Open the file in a new split in the previous tabpage - [""] = actions.goto_file_split, -- Open the file in a new split - ["gf"] = actions.goto_file_tab, -- Open the file in a new tabpage - ["e"] = actions.focus_files, -- Bring focus to the files panel - ["b"] = actions.toggle_files, -- Toggle the files panel. - }, - file_panel = { - ["j"] = actions.next_entry, -- Bring the cursor to the next file entry - [""] = actions.next_entry, - ["k"] = actions.prev_entry, -- Bring the cursor to the previous file entry. - [""] = actions.prev_entry, - [""] = actions.select_entry, -- Open the diff for the selected entry. - ["o"] = actions.select_entry, - ["<2-LeftMouse>"] = actions.select_entry, - ["-"] = actions.toggle_stage_entry, -- Stage / unstage the selected entry. - ["S"] = actions.stage_all, -- Stage all entries. - ["U"] = actions.unstage_all, -- Unstage all entries. - ["X"] = actions.restore_entry, -- Restore entry to the state on the left side. - ["R"] = actions.refresh_files, -- Update stats and entries in the file list. - ["L"] = actions.open_commit_log, -- Open the commit log panel. - [""] = actions.scroll_view(-0.25), -- Scroll the view up - [""] = actions.scroll_view(0.25), -- Scroll the view down - [""] = actions.select_next_entry, - [""] = actions.select_prev_entry, - ["gf"] = actions.goto_file, - [""] = actions.goto_file_split, - ["gf"] = actions.goto_file_tab, - ["i"] = actions.listing_style, -- Toggle between 'list' and 'tree' views - ["f"] = actions.toggle_flatten_dirs, -- Flatten empty subdirectories in tree listing style. - ["e"] = actions.focus_files, - ["b"] = actions.toggle_files, - }, - file_history_panel = { - ["g!"] = actions.options, -- Open the option panel - [""] = actions.open_in_diffview, -- Open the entry under the cursor in a diffview - ["y"] = actions.copy_hash, -- Copy the commit hash of the entry under the cursor - ["L"] = actions.open_commit_log, - ["zR"] = actions.open_all_folds, - ["zM"] = actions.close_all_folds, - ["j"] = actions.next_entry, - [""] = actions.next_entry, - ["k"] = actions.prev_entry, - [""] = actions.prev_entry, - [""] = actions.select_entry, - ["o"] = actions.select_entry, - ["<2-LeftMouse>"] = actions.select_entry, - [""] = actions.scroll_view(-0.25), - [""] = actions.scroll_view(0.25), - [""] = actions.select_next_entry, - [""] = actions.select_prev_entry, - ["gf"] = actions.goto_file, - [""] = actions.goto_file_split, - ["gf"] = actions.goto_file_tab, - ["e"] = actions.focus_files, - ["b"] = actions.toggle_files, - }, - option_panel = { - [""] = actions.select_entry, - ["q"] = actions.close, - }, - }, -}) +require("diffview").setup({}) From 19bae5f2f592c8789a69b8870663eddcd2ca9a9e Mon Sep 17 00:00:00 2001 From: luokai Date: Sat, 8 Jul 2023 22:43:04 +0800 Subject: [PATCH 0774/1278] maven --- lua/kide/core/utils/init.lua | 7 ++-- lua/kide/core/utils/maven.lua | 61 ++++++++++++++++++++++++++++++++--- 2 files changed, 59 insertions(+), 9 deletions(-) diff --git a/lua/kide/core/utils/init.lua b/lua/kide/core/utils/init.lua index 2f21695e..5f3a968d 100644 --- a/lua/kide/core/utils/init.lua +++ b/lua/kide/core/utils/init.lua @@ -195,18 +195,17 @@ M.is_linux = M.os_type() == M.Linux M.is_mac = M.os_type() == M.Mac --- complete ----@param complete {} ----@param opt {multiple:false, multiple_repeated:false, single:false} +---@param opt {model:"single"|"multiple"} M.command_args_complete = function(complete, opt) opt = opt or {} if complete ~= nil then return function(_, cmd_line, _) - if opt.multiple ~= nil and opt.multiple then + if opt.model == "multiple" then local args = vim.split(cmd_line, " ") return vim.tbl_filter(function(item) return not vim.tbl_contains(args, item) end, complete) - elseif opt.single ~= nil and opt.single then + elseif opt.model == "single" then local args = vim.split(cmd_line, " ") for _, value in ipairs(args) do if vim.tbl_contains(complete, value) then diff --git a/lua/kide/core/utils/maven.lua b/lua/kide/core/utils/maven.lua index 95bb9cef..f6343932 100644 --- a/lua/kide/core/utils/maven.lua +++ b/lua/kide/core/utils/maven.lua @@ -49,6 +49,13 @@ local exec = function(cmd, pom, opt) end local function create_command(buf, name, cmd, complete, opt) vim.api.nvim_buf_create_user_command(buf, name, function(opts) + if type(cmd) == "function" then + cmd = cmd(opts) + end + if cmd == nil then + return + end + if opts.args then exec(cmd .. " " .. opts.args, vim.fn.expand("%"), opt) else @@ -62,33 +69,71 @@ end local maven_args_complete = utils.command_args_complete +local function get_class_name() + if require("nvim-treesitter.query").has_query_files("java", "indents") then + local ts_utils = require("nvim-treesitter.ts_utils") + local node = ts_utils.get_node_at_cursor() + if node ~= nil and node:type() ~= "identifier" then + node = node:parent() + end + if node ~= nil and node:type() == "identifier" then + return vim.treesitter.get_node_text(node, 0) + end + end +end + M.maven_command = function(buf) + create_command( + buf, + "Maven", + "mvn", + maven_args_complete({ + "clean", + "compile", + "test-compile", + "verify", + "package", + "install", + "deploy", + }, { model = "multiple" }), + { update = true, close_on_exit = false } + ) + -- 判断为 java 文件 + if vim.api.nvim_buf_get_option(buf, "filetype") == "java" then + create_command(buf, "MavenExecJava", function(_) + local filename = vim.fn.expand("%:p") + filename = string.gsub(filename, "^[%-/%w%s]*%/src%/main%/java%/", "") + filename = string.gsub(filename, "[/\\]", ".") + filename = string.gsub(filename, "%.java$", "") + return 'mvn exec:java -Dexec.mainClass="' .. filename .. '"' + end, nil, { update = true, close_on_exit = false }) + end create_command( buf, "MavenCompile", "mvn clean compile", - maven_args_complete({ "test-compile" }, { multiple = true }), + maven_args_complete({ "test-compile" }, { model = "multiple" }), { update = true, close_on_exit = false } ) create_command( buf, "MavenInstll", "mvn clean install", - maven_args_complete({ "-DskipTests", "-Dmaven.test.skip=true" }, { single = true }), + maven_args_complete({ "-DskipTests", "-Dmaven.test.skip=true" }, { model = "single" }), { update = true, close_on_exit = false } ) create_command( buf, "MavenPackage", "mvn clean package", - maven_args_complete({ "-DskipTests", "-Dmaven.test.skip=true" }, { single = true }), + maven_args_complete({ "-DskipTests", "-Dmaven.test.skip=true" }, { model = "single" }), { update = true, close_on_exit = false } ) create_command( buf, "MavenDependencyTree", "mvn dependency:tree", - maven_args_complete({ "-Doutput=.dependency.txt" }, { multiple = true }), + maven_args_complete({ "-Doutput=.dependency.txt" }, { model = "single" }), { close_on_exit = false } ) create_command(buf, "MavenDependencyAnalyzeDuplicate", "mvn dependency:analyze-duplicate", nil, { @@ -98,7 +143,13 @@ M.maven_command = function(buf) close_on_exit = false, }) create_command(buf, "MavenDownloadSources", "mvn dependency:sources -DdownloadSources=true") - create_command(buf, "MavenTest", "mvn test", maven_args_complete({ "-Dtest=" }, {}), { close_on_exit = false }) + create_command( + buf, + "MavenTest", + "mvn test", + maven_args_complete({ "-Dtest=" }, { model = "single" }), + { close_on_exit = false } + ) end M.setup = function() From 535c39c5d855649e76e6bb7e40ad531ab0b313ed Mon Sep 17 00:00:00 2001 From: luokai Date: Mon, 10 Jul 2023 16:58:40 +0800 Subject: [PATCH 0775/1278] jdt path --- lua/kide/core/utils/url.lua | 532 ++++++++++++++++++ lua/kide/plugins/config/telescope.lua | 4 + .../config/telescope/buffer_previewer.lua | 10 +- 3 files changed, 545 insertions(+), 1 deletion(-) create mode 100644 lua/kide/core/utils/url.lua diff --git a/lua/kide/core/utils/url.lua b/lua/kide/core/utils/url.lua new file mode 100644 index 00000000..f167c437 --- /dev/null +++ b/lua/kide/core/utils/url.lua @@ -0,0 +1,532 @@ +-- https://github.com/golgote/neturl/blob/master/lib/net/url.lua +-- net/url.lua - a robust url parser and builder +-- +-- Bertrand Mansion, 2011-2021; License MIT +-- @module net.url +-- @alias M + +local M = {} +M.version = "1.1.0" + +--- url options +-- - `separator` is set to `&` by default but could be anything like `&amp;` or `;` +-- - `cumulative_parameters` is false by default. If true, query parameters with the same name will be stored in a table. +-- - `legal_in_path` is a table of characters that will not be url encoded in path components +-- - `legal_in_query` is a table of characters that will not be url encoded in query values. Query parameters only support a small set of legal characters (-_.). +-- - `query_plus_is_space` is true by default, so a plus sign in a query value will be converted to %20 (space), not %2B (plus) +-- @todo Add option to limit the size of the argument table +-- @todo Add option to limit the depth of the argument table +-- @todo Add option to process dots in parameter names, ie. `param.filter=1` +M.options = { + separator = '&', + cumulative_parameters = false, + legal_in_path = { + [":"] = true, ["-"] = true, ["_"] = true, ["."] = true, + ["!"] = true, ["~"] = true, ["*"] = true, ["'"] = true, + ["("] = true, [")"] = true, ["@"] = true, ["&"] = true, + ["="] = true, ["$"] = true, [","] = true, + [";"] = true + }, + legal_in_query = { + [":"] = true, ["-"] = true, ["_"] = true, ["."] = true, + [","] = true, ["!"] = true, ["~"] = true, ["*"] = true, + ["'"] = true, [";"] = true, ["("] = true, [")"] = true, + ["@"] = true, ["$"] = true, + }, + query_plus_is_space = true +} + +--- list of known and common scheme ports +-- as documented in IANA URI scheme list +M.services = { + acap = 674, + cap = 1026, + dict = 2628, + ftp = 21, + gopher = 70, + http = 80, + https = 443, + iax = 4569, + icap = 1344, + imap = 143, + ipp = 631, + ldap = 389, + mtqp = 1038, + mupdate = 3905, + news = 2009, + nfs = 2049, + nntp = 119, + rtsp = 554, + sip = 5060, + snmp = 161, + telnet = 23, + tftp = 69, + vemmi = 575, + afs = 1483, + jms = 5673, + rsync = 873, + prospero = 191, + videotex = 516 +} + +local function decode(str) + return (str:gsub("%%(%x%x)", function(c) + return string.char(tonumber(c, 16)) + end)) +end + +local function encode(str, legal) + return (str:gsub("([^%w])", function(v) + if legal[v] then + return v + end + return string.upper(string.format("%%%02x", string.byte(v))) + end)) +end + +-- for query values, + can mean space if configured as such +local function decodeValue(str) + if M.options.query_plus_is_space then + str = str:gsub('+', ' ') + end + return decode(str) +end + +local function concat(a, b) + if type(a) == 'table' then + return a:build() .. b + else + return a .. b:build() + end +end + +function M:addSegment(path) + if type(path) == 'string' then + self.path = self.path .. '/' .. encode(path:gsub("^/+", ""), M.options.legal_in_path) + end + return self +end + +--- builds the url +-- @return a string representing the built url +function M:build() + local url = '' + if self.path then + local path = self.path + url = url .. tostring(path) + end + if self.query then + local qstring = tostring(self.query) + if qstring ~= "" then + url = url .. '?' .. qstring + end + end + if self.host then + local authority = self.host + if self.port and self.scheme and M.services[self.scheme] ~= self.port then + authority = authority .. ':' .. self.port + end + local userinfo + if self.user and self.user ~= "" then + userinfo = self.user + if self.password then + userinfo = userinfo .. ':' .. self.password + end + end + if userinfo and userinfo ~= "" then + authority = userinfo .. '@' .. authority + end + if authority then + if url ~= "" then + url = '//' .. authority .. '/' .. url:gsub('^/+', '') + else + url = '//' .. authority + end + end + end + if self.scheme then + url = self.scheme .. ':' .. url + end + if self.fragment then + url = url .. '#' .. self.fragment + end + return url +end + +--- builds the querystring +-- @param tab The key/value parameters +-- @param sep The separator to use (optional) +-- @param key The parent key if the value is multi-dimensional (optional) +-- @return a string representing the built querystring +function M.buildQuery(tab, sep, key) + local query = {} + if not sep then + sep = M.options.separator or '&' + end + local keys = {} + for k in pairs(tab) do + keys[#keys+1] = k + end + table.sort(keys, function (a, b) + local function padnum(n, rest) return ("%03d"..rest):format(tonumber(n)) end + return tostring(a):gsub("(%d+)(%.)",padnum) < tostring(b):gsub("(%d+)(%.)",padnum) + end) + for _,name in ipairs(keys) do + local value = tab[name] + name = encode(tostring(name), {["-"] = true, ["_"] = true, ["."] = true}) + if key then + if M.options.cumulative_parameters and string.find(name, '^%d+$') then + name = tostring(key) + else + name = string.format('%s[%s]', tostring(key), tostring(name)) + end + end + if type(value) == 'table' then + query[#query+1] = M.buildQuery(value, sep, name) + else + local value = encode(tostring(value), M.options.legal_in_query) + if value ~= "" then + query[#query+1] = string.format('%s=%s', name, value) + else + query[#query+1] = name + end + end + end + return table.concat(query, sep) +end + +--- Parses the querystring to a table +-- This function can parse multidimensional pairs and is mostly compatible +-- with PHP usage of brackets in key names like ?param[key]=value +-- @param str The querystring to parse +-- @param sep The separator between key/value pairs, defaults to `&` +-- @todo limit the max number of parameters with M.options.max_parameters +-- @return a table representing the query key/value pairs +function M.parseQuery(str, sep) + if not sep then + sep = M.options.separator or '&' + end + + local values = {} + for key,val in str:gmatch(string.format('([^%q=]+)(=*[^%q=]*)', sep, sep)) do + local key = decodeValue(key) + local keys = {} + key = key:gsub('%[([^%]]*)%]', function(v) + -- extract keys between balanced brackets + if string.find(v, "^-?%d+$") then + v = tonumber(v) + else + v = decodeValue(v) + end + table.insert(keys, v) + return "=" + end) + key = key:gsub('=+.*$', "") + key = key:gsub('%s', "_") -- remove spaces in parameter name + val = val:gsub('^=+', "") + + if not values[key] then + values[key] = {} + end + if #keys > 0 and type(values[key]) ~= 'table' then + values[key] = {} + elseif #keys == 0 and type(values[key]) == 'table' then + values[key] = decodeValue(val) + elseif M.options.cumulative_parameters + and type(values[key]) == 'string' then + values[key] = { values[key] } + table.insert(values[key], decodeValue(val)) + end + + local t = values[key] + for i,k in ipairs(keys) do + if type(t) ~= 'table' then + t = {} + end + if k == "" then + k = #t+1 + end + if not t[k] then + t[k] = {} + end + if i == #keys then + t[k] = val + end + t = t[k] + end + + end + setmetatable(values, { __tostring = M.buildQuery }) + return values +end + +--- set the url query +-- @param query Can be a string to parse or a table of key/value pairs +-- @return a table representing the query key/value pairs +function M:setQuery(query) + local query = query + if type(query) == 'table' then + query = M.buildQuery(query) + end + self.query = M.parseQuery(query) + return query +end + +--- set the authority part of the url +-- The authority is parsed to find the user, password, port and host if available. +-- @param authority The string representing the authority +-- @return a string with what remains after the authority was parsed +function M:setAuthority(authority) + self.authority = authority + self.port = nil + self.host = nil + self.userinfo = nil + self.user = nil + self.password = nil + + authority = authority:gsub('^([^@]*)@', function(v) + self.userinfo = v + return '' + end) + + authority = authority:gsub(':(%d+)$', function(v) + self.port = tonumber(v) + return '' + end) + + local function getIP(str) + -- ipv4 + local chunks = { str:match("^(%d+)%.(%d+)%.(%d+)%.(%d+)$") } + if #chunks == 4 then + for _, v in pairs(chunks) do + if tonumber(v) > 255 then + return false + end + end + return str + end + -- ipv6 + local chunks = { str:match("^%["..(("([a-fA-F0-9]*):"):rep(8):gsub(":$","%%]$"))) } + if #chunks == 8 or #chunks < 8 and + str:match('::') and not str:gsub("::", "", 1):match('::') then + for _,v in pairs(chunks) do + if #v > 0 and tonumber(v, 16) > 65535 then + return false + end + end + return str + end + return nil + end + + local ip = getIP(authority) + if ip then + self.host = ip + elseif type(ip) == 'nil' then + -- domain + if authority ~= '' and not self.host then + local host = authority:lower() + if string.match(host, '^[%d%a%-%.]+$') ~= nil and + string.sub(host, 0, 1) ~= '.' and + string.sub(host, -1) ~= '.' and + string.find(host, '%.%.') == nil then + self.host = host + end + end + end + + if self.userinfo then + local userinfo = self.userinfo + userinfo = userinfo:gsub(':([^:]*)$', function(v) + self.password = v + return '' + end) + if string.find(userinfo, "^[%w%+%.]+$") then + self.user = userinfo + else + -- incorrect userinfo + self.userinfo = nil + self.user = nil + self.password = nil + end + end + + return authority +end + +--- Parse the url into the designated parts. +-- Depending on the url, the following parts can be available: +-- scheme, userinfo, user, password, authority, host, port, path, +-- query, fragment +-- @param url Url string +-- @return a table with the different parts and a few other functions +function M.parse(url) + local comp = {} + M.setAuthority(comp, "") + M.setQuery(comp, "") + + local url = tostring(url or '') + url = url:gsub('#(.*)$', function(v) + comp.fragment = v + return '' + end) + url =url:gsub('^([%w][%w%+%-%.]*)%:', function(v) + comp.scheme = v:lower() + return '' + end) + url = url:gsub('%?(.*)', function(v) + M.setQuery(comp, v) + return '' + end) + url = url:gsub('^//([^/]*)', function(v) + M.setAuthority(comp, v) + return '' + end) + + comp.path = url:gsub("([^/]+)", function (s) return encode(decode(s), M.options.legal_in_path) end) + + setmetatable(comp, { + __index = M, + __tostring = M.build, + __concat = concat, + __div = M.addSegment + }) + return comp +end + +--- removes dots and slashes in urls when possible +-- This function will also remove multiple slashes +-- @param path The string representing the path to clean +-- @return a string of the path without unnecessary dots and segments +function M.removeDotSegments(path) + local fields = {} + if string.len(path) == 0 then + return "" + end + local startslash = false + local endslash = false + if string.sub(path, 1, 1) == "/" then + startslash = true + end + if (string.len(path) > 1 or startslash == false) and string.sub(path, -1) == "/" then + endslash = true + end + + path:gsub('[^/]+', function(c) table.insert(fields, c) end) + + local new = {} + local j = 0 + + for i,c in ipairs(fields) do + if c == '..' then + if j > 0 then + j = j - 1 + end + elseif c ~= "." then + j = j + 1 + new[j] = c + end + end + local ret = "" + if #new > 0 and j > 0 then + ret = table.concat(new, '/', 1, j) + else + ret = "" + end + if startslash then + ret = '/'..ret + end + if endslash then + ret = ret..'/' + end + return ret +end + +local function reducePath(base_path, relative_path) + if string.sub(relative_path, 1, 1) == "/" then + return '/' .. string.gsub(relative_path, '^[%./]+', '') + end + local path = base_path + local startslash = string.sub(path, 1, 1) ~= "/"; + if relative_path ~= "" then + path = (startslash and '' or '/') .. path:gsub("[^/]*$", "") + end + path = path .. relative_path + path = path:gsub("([^/]*%./)", function (s) + if s ~= "./" then return s else return "" end + end) + path = string.gsub(path, "/%.$", "/") + local reduced + while reduced ~= path do + reduced = path + path = string.gsub(reduced, "([^/]*/%.%./)", function (s) + if s ~= "../../" then return "" else return s end + end) + end + path = string.gsub(path, "([^/]*/%.%.?)$", function (s) + if s ~= "../.." then return "" else return s end + end) + local reduced + while reduced ~= path do + reduced = path + path = string.gsub(reduced, '^/?%.%./', '') + end + return (startslash and '' or '/') .. path +end + +--- builds a new url by using the one given as parameter and resolving paths +-- @param other A string or a table representing a url +-- @return a new url table +function M:resolve(other) + if type(self) == "string" then + self = M.parse(self) + end + if type(other) == "string" then + other = M.parse(other) + end + if other.scheme then + return other + else + other.scheme = self.scheme + if not other.authority or other.authority == "" then + other:setAuthority(self.authority) + if not other.path or other.path == "" then + other.path = self.path + local query = other.query + if not query or not next(query) then + other.query = self.query + end + else + other.path = reducePath(self.path, other.path) + end + end + return other + end +end + +--- normalize a url path following some common normalization rules +-- described on The URL normalization page of Wikipedia +-- @return the normalized path +function M:normalize() + if type(self) == 'string' then + self = M.parse(self) + end + if self.path then + local path = self.path + path = reducePath(path, "") + -- normalize multiple slashes + path = string.gsub(path, "//+", "/") + self.path = path + end + return self +end + +local hex_to_char = function(x) + return string.char(tonumber(x, 16)) +end + +M.unescape = function(url) + return url:gsub("%%(%x%x)", hex_to_char) +end + +return M diff --git a/lua/kide/plugins/config/telescope.lua b/lua/kide/plugins/config/telescope.lua index c82a465c..8205e3a6 100644 --- a/lua/kide/plugins/config/telescope.lua +++ b/lua/kide/plugins/config/telescope.lua @@ -18,6 +18,10 @@ set.edit = require("kide.plugins.config.telescope.actions.set").edit local previewers = require("telescope.previewers") previewers.buffer_previewer_maker = require("kide.plugins.config.telescope.buffer_previewer").file_maker +local conf = require("telescope.config").values +conf["qflist_previewer"] = function(...) + return require("kide.plugins.config.telescope.buffer_previewer").qflist.new(...) +end telescope.setup({ defaults = { vimgrep_arguments = { diff --git a/lua/kide/plugins/config/telescope/buffer_previewer.lua b/lua/kide/plugins/config/telescope/buffer_previewer.lua index 3775404f..fe43d9b6 100644 --- a/lua/kide/plugins/config/telescope/buffer_previewer.lua +++ b/lua/kide/plugins/config/telescope/buffer_previewer.lua @@ -531,7 +531,15 @@ previewers.vimgrep = defaulter(function(opts) return previewers.new_buffer_previewer { title = "Grep Preview", dyn_title = function(_, entry) - return Path:new(from_entry.path(entry, false, false)):normalize(cwd) + local fp = from_entry.path(entry, false, false) + if vim.startswith(fp, 'jdt://') then + local url = require('kide.core.utils.url') + -- fp = url.unescape(fp) + fp = string.gsub(fp, '%%5C', '') + local u = url.parse(fp) + return u.path + end + return Path:new(fp):normalize(cwd) end, get_buffer_by_name = function(_, entry) From c5dddb22731e8808ac909d1f777c52413ce9730c Mon Sep 17 00:00:00 2001 From: luokai Date: Tue, 11 Jul 2023 20:52:27 +0800 Subject: [PATCH 0776/1278] use sqlls --- lua/kide/lsp/sqlls.lua | 6 ------ lua/kide/plugins/lazy-nvim.lua | 5 ----- 2 files changed, 11 deletions(-) diff --git a/lua/kide/lsp/sqlls.lua b/lua/kide/lsp/sqlls.lua index dc935810..97aeaddb 100644 --- a/lua/kide/lsp/sqlls.lua +++ b/lua/kide/lsp/sqlls.lua @@ -1,8 +1,2 @@ -vim.g.sql_type_default = "mysql" return { - server = { - on_attach = function(client, bufnr) - require("sqls").on_attach(client, bufnr) - end, - }, } diff --git a/lua/kide/plugins/lazy-nvim.lua b/lua/kide/plugins/lazy-nvim.lua index 9dac64d5..4934585e 100644 --- a/lua/kide/plugins/lazy-nvim.lua +++ b/lua/kide/plugins/lazy-nvim.lua @@ -640,11 +640,6 @@ require("lazy").setup({ }, -- databases - { - "nanotee/sqls.nvim", - lazy = true, - ft = { "sql", "mysql" }, - }, { "tpope/vim-dadbod", lazy = true, From 680f44d441e5115d22ab90c5a010cd7900791510 Mon Sep 17 00:00:00 2001 From: luokai Date: Tue, 11 Jul 2023 21:04:58 +0800 Subject: [PATCH 0777/1278] =?UTF-8?q?=E4=B8=8D=E6=98=AF=20cmp?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lua/kide/plugins/config/nvim-cmp.lua | 4 ---- lua/kide/plugins/lazy-nvim.lua | 10 ++-------- 2 files changed, 2 insertions(+), 12 deletions(-) diff --git a/lua/kide/plugins/config/nvim-cmp.lua b/lua/kide/plugins/config/nvim-cmp.lua index a94806f7..d7002180 100644 --- a/lua/kide/plugins/config/nvim-cmp.lua +++ b/lua/kide/plugins/config/nvim-cmp.lua @@ -1,6 +1,5 @@ local lspkind = require("lspkind") local cmp = require("cmp") -local config = require("kide.config") local function sorting() local comparators = { @@ -16,9 +15,6 @@ local function sorting() cmp.config.compare.length, cmp.config.compare.order, } - if config.plugin.copilot.enable then - table.insert(comparators, 1, require("copilot_cmp.comparators").prioritize) - end return { priority_weight = 2, comparators = comparators, diff --git a/lua/kide/plugins/lazy-nvim.lua b/lua/kide/plugins/lazy-nvim.lua index 4934585e..81d52ac6 100644 --- a/lua/kide/plugins/lazy-nvim.lua +++ b/lua/kide/plugins/lazy-nvim.lua @@ -791,18 +791,12 @@ require("lazy").setup({ lazy = true, cmd = "Copilot", config = function() - require("copilot").setup({ - filetypes = { - java = false, - }, - suggestion = { enabled = false }, - panel = { enabled = false }, - }) + require("copilot").setup({}) end, }, { "zbirenbaum/copilot-cmp", - enabled = config.plugin.copilot.enable, + enabled = false, lazy = true, dependencies = { "zbirenbaum/copilot.lua" }, event = { "InsertEnter", "VeryLazy" }, From e0a6e16ea7abddfc9ff6c488f101284e903590b8 Mon Sep 17 00:00:00 2001 From: luokai Date: Thu, 13 Jul 2023 23:06:37 +0800 Subject: [PATCH 0778/1278] lsp_ui --- lua/kide/lsp/init.lua | 4 ++-- lua/kide/lsp/lsp_ui.lua | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/lua/kide/lsp/init.lua b/lua/kide/lsp/init.lua index b4d31b5d..6ea2e670 100644 --- a/lua/kide/lsp/init.lua +++ b/lua/kide/lsp/init.lua @@ -143,10 +143,10 @@ vim.api.nvim_create_autocmd("LspAttach", { -- 文档格式化 local function markdown_format(input) if input then - input = string.gsub(input, '%[([%a%$_]?[%.%w%(%),\\_%[%]%s :%-@"]*)%]%(file:/[^%)]+%)', function(i1) + input = string.gsub(input, '%[([%a%$_]?[%.%w%(%)*"+,\\_%[%]%s :%-@"]*)%]%(file:/[^%)]+%)', function(i1) return "`" .. i1 .. "`" end) - input = string.gsub(input, '%[([%a%$_]?[%.%w%(%),\\_%[%]%s :%-@"]*)%]%(jdt://[^%)]+%)', function(i1) + input = string.gsub(input, '%[([%a%$_]?[%.%w%(%)*"+,\\_%[%]%s :%-@"]*)%]%(jdt://[^%)]+%)', function(i1) return "`" .. i1 .. "`" end) end diff --git a/lua/kide/lsp/lsp_ui.lua b/lua/kide/lsp/lsp_ui.lua index b9f35f12..649fddda 100644 --- a/lua/kide/lsp/lsp_ui.lua +++ b/lua/kide/lsp/lsp_ui.lua @@ -59,10 +59,10 @@ M.hover_actions = { }, style = "fillchars", -- Maximal width of the hover window. Nil means no max. - max_width = nil, + max_width = 80, -- Maximal height of the hover window. Nil means no max. - max_height = nil, + max_height = 20, -- whether the hover action window gets automatically focused -- default: false From c69d8906af9af30ce846f114eb6d1e97e4f06dfe Mon Sep 17 00:00:00 2001 From: luokai Date: Fri, 14 Jul 2023 18:30:01 +0800 Subject: [PATCH 0779/1278] =?UTF-8?q?=E4=BD=BF=E7=94=A8=E6=8A=A4=E7=9C=BC?= =?UTF-8?q?=E4=B8=BB=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lua/kide/core/basic.lua | 3 +++ lua/kide/lsp/lsp_ui.lua | 2 +- lua/kide/plugins/config/lualine.lua | 2 +- lua/kide/plugins/lazy-nvim.lua | 10 +++++----- 4 files changed, 10 insertions(+), 7 deletions(-) diff --git a/lua/kide/core/basic.lua b/lua/kide/core/basic.lua index 293817e3..715c2147 100644 --- a/lua/kide/core/basic.lua +++ b/lua/kide/core/basic.lua @@ -1,6 +1,9 @@ local config = require("kide.config") vim.g.mapleader = " " vim.opt.title = true +vim.opt.exrc = true +vim.opt.secure = false +vim.opt.ttyfast = true vim.opt.clipboard = "unnamedplus" diff --git a/lua/kide/lsp/lsp_ui.lua b/lua/kide/lsp/lsp_ui.lua index 649fddda..806e3278 100644 --- a/lua/kide/lsp/lsp_ui.lua +++ b/lua/kide/lsp/lsp_ui.lua @@ -43,7 +43,7 @@ M.symbol_map = { } M.window = { - winhighlight = "Normal:Normal,FloatBorder:FloatBorder,CursorLine:Visual,Search:None", + winhighlight = "Normal:Normal,FloatBorder:Normal,CursorLine:Visual,Search:None", } M.hover_actions = { diff --git a/lua/kide/plugins/config/lualine.lua b/lua/kide/plugins/config/lualine.lua index aca8c8e3..318943da 100644 --- a/lua/kide/plugins/config/lualine.lua +++ b/lua/kide/plugins/config/lualine.lua @@ -1,7 +1,7 @@ local config = { options = { icons_enabled = true, - theme = "gruvbox", + theme = "gruvbox-material", component_separators = { left = "", right = "" }, section_separators = { left = "", right = "" }, disabled_filetypes = { diff --git a/lua/kide/plugins/lazy-nvim.lua b/lua/kide/plugins/lazy-nvim.lua index 81d52ac6..c008b7c3 100644 --- a/lua/kide/plugins/lazy-nvim.lua +++ b/lua/kide/plugins/lazy-nvim.lua @@ -123,7 +123,7 @@ require("lazy").setup({ -- use 'morhetz/gruvbox' { "ellisonleao/gruvbox.nvim", - enabled = true, + enabled = false, lazy = false, priority = 1000, config = function() @@ -132,15 +132,15 @@ require("lazy").setup({ }, { "sainnhe/gruvbox-material", - enabled = false, + enabled = true, lazy = false, priority = 1000, config = function() - -- require("kide.plugins.config.gruvbox") - vim.opt.background = "dark" - vim.g.gruvbox_material_background = "hard" + vim.g.gruvbox_material_background = "medium" vim.g.gruvbox_material_better_performance = true + vim.g.gruvbox_material_diagnostic_virtual_text = "colored" + vim.g.gruvbox_material_current_word = "underline" vim.cmd([[colorscheme gruvbox-material]]) end, }, From 11546a13a5e6f2c7a262d3f788295b3f1be10efa Mon Sep 17 00:00:00 2001 From: luokai Date: Sat, 15 Jul 2023 18:38:06 +0800 Subject: [PATCH 0780/1278] ui update --- lua/kide/plugins/config/symbols-outline.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lua/kide/plugins/config/symbols-outline.lua b/lua/kide/plugins/config/symbols-outline.lua index 30d1789e..cdcc6af2 100644 --- a/lua/kide/plugins/config/symbols-outline.lua +++ b/lua/kide/plugins/config/symbols-outline.lua @@ -12,7 +12,7 @@ require("symbols-outline").setup({ show_numbers = false, show_relative_numbers = false, show_symbol_details = true, - preview_bg_highlight = "Pmenu", + preview_bg_highlight = "Normal,FloatBorder:Normal,CursorLine:Visual,Search:None", autofold_depth = nil, auto_unfold_hover = true, fold_markers = { "", "" }, From 742fc1ca9c150a8d40e3c4a62e2fc5e8ca2d9ce7 Mon Sep 17 00:00:00 2001 From: luokai Date: Sat, 15 Jul 2023 19:00:00 +0800 Subject: [PATCH 0781/1278] treeutils --- lua/kide/plugins/config/nvim-tree.lua | 21 ++++++++++++++------- lua/kide/plugins/config/utils/treeutil.lua | 8 ++------ 2 files changed, 16 insertions(+), 13 deletions(-) diff --git a/lua/kide/plugins/config/nvim-tree.lua b/lua/kide/plugins/config/nvim-tree.lua index df72aacc..4da22de4 100644 --- a/lua/kide/plugins/config/nvim-tree.lua +++ b/lua/kide/plugins/config/nvim-tree.lua @@ -1,7 +1,19 @@ -local function custom_callback(callback_name) - return string.format(":lua require('kide.plugins.config.utils.treeutil').%s()", callback_name) +local function on_attach(bufnr) + local api = require("nvim-tree.api") + + local function opts(desc) + return { desc = "nvim-tree: " .. desc, buffer = bufnr, noremap = true, silent = true, nowait = true } + end + api.config.mappings.default_on_attach(bufnr) + + local treeutils = require("kide.plugins.config.utils.treeutil") + + vim.keymap.set("n", "ff", treeutils.launch_find_files, opts("Launch Find Files")) + vim.keymap.set("n", "fg", treeutils.launch_live_grep, opts("Launch Live Grep")) end + require("nvim-tree").setup({ + on_attach = on_attach, disable_netrw = true, hijack_netrw = true, -- auto_close = true, @@ -56,11 +68,6 @@ require("nvim-tree").setup({ signcolumn = "yes", mappings = { custom_only = false, - -- list = { - -- - -- { key = "ff", cb = custom_callback("launch_find_files") }, - -- { key = "fg", cb = custom_callback("launch_live_grep") }, - -- }, }, }, renderer = { diff --git a/lua/kide/plugins/config/utils/treeutil.lua b/lua/kide/plugins/config/utils/treeutil.lua index 524217a3..ee57ba4e 100644 --- a/lua/kide/plugins/config/utils/treeutil.lua +++ b/lua/kide/plugins/config/utils/treeutil.lua @@ -1,4 +1,4 @@ -local lib = require("nvim-tree.lib") +local api = require("nvim-tree.api") local openfile = require("nvim-tree.actions.node.open-file") local actions = require("telescope.actions") local action_state = require("telescope.actions.state") @@ -30,11 +30,7 @@ function M.launch_telescope(func_name, opts) if not telescope_status_ok then return end - local lib_status_ok, lib = pcall(require, "nvim-tree.lib") - if not lib_status_ok then - return - end - local node = lib.get_node_at_cursor() + local node = api.tree.get_node_under_cursor() local is_folder = node.fs_stat and node.fs_stat.type == "directory" or false local basedir = is_folder and node.absolute_path or vim.fn.fnamemodify(node.absolute_path, ":h") if node.name == ".." and TreeExplorer ~= nil then From 2f03099502954edd8933a3d19a6ac4fecb568b82 Mon Sep 17 00:00:00 2001 From: luokai Date: Sat, 15 Jul 2023 21:21:08 +0800 Subject: [PATCH 0782/1278] broder single --- lua/kide/plugins/lazy-nvim.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lua/kide/plugins/lazy-nvim.lua b/lua/kide/plugins/lazy-nvim.lua index c008b7c3..6a134e38 100644 --- a/lua/kide/plugins/lazy-nvim.lua +++ b/lua/kide/plugins/lazy-nvim.lua @@ -349,7 +349,7 @@ require("lazy").setup({ direction = "float", close_on_exit = true, float_opts = { - border = "double", + border = "single", winblend = 0, }, }) From 6b54e037b040a9e194e0fa5ddd9d5d367b025906 Mon Sep 17 00:00:00 2001 From: luokai Date: Sat, 15 Jul 2023 21:28:12 +0800 Subject: [PATCH 0783/1278] ft TermSelect --- lua/kide/core/keybindings.lua | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lua/kide/core/keybindings.lua b/lua/kide/core/keybindings.lua index d063f6e8..fe11e24e 100644 --- a/lua/kide/core/keybindings.lua +++ b/lua/kide/core/keybindings.lua @@ -109,6 +109,8 @@ M.setup = function() map("n", "fr", "lua require('spectre').open_visual({select_word=true})", opt) map("v", "fr", ":lua require('spectre').open_visual()", opt) + -- ToggleTerm + map("n", "ft", "TermSelect", opt) -- ToggleTask map("n", "ts", "Telescope toggletasks spawn", opt) From 8cf0f9001a8477a69ca85c7c541c300aa7fd7515 Mon Sep 17 00:00:00 2001 From: luokai Date: Sat, 15 Jul 2023 21:36:10 +0800 Subject: [PATCH 0784/1278] toggleterm --- lua/kide/plugins/lazy-nvim.lua | 2 -- 1 file changed, 2 deletions(-) diff --git a/lua/kide/plugins/lazy-nvim.lua b/lua/kide/plugins/lazy-nvim.lua index 6a134e38..42bc2319 100644 --- a/lua/kide/plugins/lazy-nvim.lua +++ b/lua/kide/plugins/lazy-nvim.lua @@ -345,12 +345,10 @@ require("lazy").setup({ config = function() require("toggleterm").setup({ shade_terminals = true, - -- shade_filetypes = { "none", "fzf" }, direction = "float", close_on_exit = true, float_opts = { border = "single", - winblend = 0, }, }) end, From e57e82ef8653264df26c91bd8b3865e86dad6598 Mon Sep 17 00:00:00 2001 From: luokai Date: Sat, 15 Jul 2023 21:52:54 +0800 Subject: [PATCH 0785/1278] resize key --- lua/kide/core/basic.lua | 5 +++++ lua/kide/core/keybindings.lua | 9 +++++++++ lua/kide/plugins/lazy-nvim.lua | 2 +- 3 files changed, 15 insertions(+), 1 deletion(-) diff --git a/lua/kide/core/basic.lua b/lua/kide/core/basic.lua index 715c2147..614dffb7 100644 --- a/lua/kide/core/basic.lua +++ b/lua/kide/core/basic.lua @@ -216,3 +216,8 @@ autocmd("FileType", { pattern = { "gitcommit" }, command = "setlocal spell", }) +autocmd({ "BufRead", "BufNewFile" }, { + group = augroup("spell"), + pattern = "*.md", + command = "setlocal spell", +}) diff --git a/lua/kide/core/keybindings.lua b/lua/kide/core/keybindings.lua index fe11e24e..04eab992 100644 --- a/lua/kide/core/keybindings.lua +++ b/lua/kide/core/keybindings.lua @@ -24,6 +24,15 @@ M.setup = function() keymap("n", "", "k", opt) keymap("n", "", "l", opt) + map("n", "", ":res +5", opt) + map("n", "", ":res -5", opt) + map("n", "", ":res -5", opt) + map("n", "", ":res +5", opt) + map("n", "", ":vertical resize+5", opt) + map("n", "", ":vertical resize-5", opt) + map("n", "", ":vertical resize-5", opt) + map("n", "", ":vertical resize+5", opt) + vim.api.nvim_create_user_command("BufferCloseOther", function() require("kide.core.utils").close_other_bufline() end, {}) diff --git a/lua/kide/plugins/lazy-nvim.lua b/lua/kide/plugins/lazy-nvim.lua index 42bc2319..de688d04 100644 --- a/lua/kide/plugins/lazy-nvim.lua +++ b/lua/kide/plugins/lazy-nvim.lua @@ -345,7 +345,7 @@ require("lazy").setup({ config = function() require("toggleterm").setup({ shade_terminals = true, - direction = "float", + direction = "horizontal", close_on_exit = true, float_opts = { border = "single", From 9af2d2ac286f1cf6c4d6ff8ddf4bcb6dc3288848 Mon Sep 17 00:00:00 2001 From: luokai Date: Sat, 15 Jul 2023 21:59:52 +0800 Subject: [PATCH 0786/1278] terminal_color --- lua/kide/plugins/config/nvim-colorizer.lua | 2 +- lua/kide/theme/gruvbox.lua | 10 ++++------ 2 files changed, 5 insertions(+), 7 deletions(-) diff --git a/lua/kide/plugins/config/nvim-colorizer.lua b/lua/kide/plugins/config/nvim-colorizer.lua index 326e542c..577b1cdf 100644 --- a/lua/kide/plugins/config/nvim-colorizer.lua +++ b/lua/kide/plugins/config/nvim-colorizer.lua @@ -3,7 +3,7 @@ require("colorizer").setup({ user_default_options = { RGB = true, -- #RGB hex codes RRGGBB = true, -- #RRGGBB hex codes - names = true, -- "Name" codes like Blue or blue + names = false, -- "Name" codes like Blue or blue RRGGBBAA = false, -- #RRGGBBAA hex codes AARRGGBB = false, -- 0xAARRGGBB hex codes rgb_fn = false, -- CSS rgb() and rgba() functions diff --git a/lua/kide/theme/gruvbox.lua b/lua/kide/theme/gruvbox.lua index 602fd42d..7ad47c9f 100644 --- a/lua/kide/theme/gruvbox.lua +++ b/lua/kide/theme/gruvbox.lua @@ -6,12 +6,10 @@ local colors = { black2 = "#2e2e2e", black3 = "#313131", gray = "#928374", - red = "#fb4934", - green = "#b8bb26", - yellow = "#fabd2f", - yellow2 = "#d79921", - blue = "#83a598", - blue2 = "#458588", + red = vim.g.terminal_color_1 or "#fb4934", + green = vim.g.terminal_color_2 or "#b8bb26", + yellow = vim.g.terminal_color_3 or "#fabd2f", + blue = vim.g.terminal_color_4 or "#83a598", } M.colors = colors local flat_telescope = { From 542de3b02a95178ac5f7b1c8d553ffa24baf83e8 Mon Sep 17 00:00:00 2001 From: luokai Date: Sun, 16 Jul 2023 11:16:29 +0800 Subject: [PATCH 0787/1278] ui update --- lua/kide/lsp/lsp_ui.lua | 8 ++++---- lua/kide/plugins/config/indent-blankline.lua | 21 ++++++-------------- lua/kide/plugins/lazy-nvim.lua | 3 ++- 3 files changed, 12 insertions(+), 20 deletions(-) diff --git a/lua/kide/lsp/lsp_ui.lua b/lua/kide/lsp/lsp_ui.lua index 806e3278..e63a5599 100644 --- a/lua/kide/lsp/lsp_ui.lua +++ b/lua/kide/lsp/lsp_ui.lua @@ -48,13 +48,13 @@ M.window = { M.hover_actions = { border = { - { "╭", "FloatBorder" }, + { "┌", "FloatBorder" }, { "─", "FloatBorder" }, - { "╮", "FloatBorder" }, + { "┐", "FloatBorder" }, { "│", "FloatBorder" }, - { "╯", "FloatBorder" }, + { "┘", "FloatBorder" }, { "─", "FloatBorder" }, - { "╰", "FloatBorder" }, + { "└", "FloatBorder" }, { "│", "FloatBorder" }, }, style = "fillchars", diff --git a/lua/kide/plugins/config/indent-blankline.lua b/lua/kide/plugins/config/indent-blankline.lua index 3bd06dad..5c97f3c0 100644 --- a/lua/kide/plugins/config/indent-blankline.lua +++ b/lua/kide/plugins/config/indent-blankline.lua @@ -9,10 +9,15 @@ require("indent_blankline").setup({ disable_with_nolist = true, -- filetype_exclude = { "help", "terminal", "packer", "NvimTree", "git", "text" }, filetype_exclude = { + "lspinfo", + "packer", + "checkhealth", + "man", "help", "terminal", "packer", - "markdown", + "packer", + -- "markdown", "git", "text", "txt", @@ -32,19 +37,5 @@ require("indent_blankline").setup({ "dbui", "dbout", }, - buftype_exclude = { "terminal" }, use_treesitter = true, - context_patterns = { - "class", - "function", - "method", - "block", - "list_literal", - "selector", - "^if", - "^table", - "if_statement", - "while", - "for", - }, }) diff --git a/lua/kide/plugins/lazy-nvim.lua b/lua/kide/plugins/lazy-nvim.lua index de688d04..33728a0a 100644 --- a/lua/kide/plugins/lazy-nvim.lua +++ b/lua/kide/plugins/lazy-nvim.lua @@ -384,7 +384,8 @@ require("lazy").setup({ -- blankline { "lukas-reineke/indent-blankline.nvim", - event = { "BufReadPost" }, + enabled = true, + event = { "UIEnter" }, config = function() require("kide.plugins.config.indent-blankline") end, From aa72124b1564a10a186af65944ff9c31a2aaeb8a Mon Sep 17 00:00:00 2001 From: luokai Date: Sun, 16 Jul 2023 11:17:18 +0800 Subject: [PATCH 0788/1278] udpate --- lua/kide/plugins/config/indent-blankline.lua | 1 - 1 file changed, 1 deletion(-) diff --git a/lua/kide/plugins/config/indent-blankline.lua b/lua/kide/plugins/config/indent-blankline.lua index 5c97f3c0..7d1c47e9 100644 --- a/lua/kide/plugins/config/indent-blankline.lua +++ b/lua/kide/plugins/config/indent-blankline.lua @@ -16,7 +16,6 @@ require("indent_blankline").setup({ "help", "terminal", "packer", - "packer", -- "markdown", "git", "text", From 33a77f44cae68f662ff89cb7882d59753289b3c5 Mon Sep 17 00:00:00 2001 From: luokai Date: Sun, 16 Jul 2023 11:32:29 +0800 Subject: [PATCH 0789/1278] indent-blankline color --- lua/kide/plugins/config/indent-blankline.lua | 2 ++ lua/kide/theme/gruvbox.lua | 6 ++++++ 2 files changed, 8 insertions(+) diff --git a/lua/kide/plugins/config/indent-blankline.lua b/lua/kide/plugins/config/indent-blankline.lua index 7d1c47e9..18a8d31c 100644 --- a/lua/kide/plugins/config/indent-blankline.lua +++ b/lua/kide/plugins/config/indent-blankline.lua @@ -38,3 +38,5 @@ require("indent_blankline").setup({ }, use_treesitter = true, }) + +require("kide.theme.gruvbox").load_indent_blankline_highlights() diff --git a/lua/kide/theme/gruvbox.lua b/lua/kide/theme/gruvbox.lua index 7ad47c9f..b2f75586 100644 --- a/lua/kide/theme/gruvbox.lua +++ b/lua/kide/theme/gruvbox.lua @@ -82,4 +82,10 @@ M.load_which_key_highlights = function() }) end +M.load_indent_blankline_highlights = function() + M.load_highlights({ + IndentBlanklineContextChar = { fg = colors.red }, + }) +end + return M From 2062424c39e5b22cd52935baf3b98705b9a9f0c2 Mon Sep 17 00:00:00 2001 From: luokai Date: Wed, 19 Jul 2023 14:04:19 +0800 Subject: [PATCH 0790/1278] fix: neogit config --- lua/kide/plugins/config/neogit.lua | 8 -------- 1 file changed, 8 deletions(-) diff --git a/lua/kide/plugins/config/neogit.lua b/lua/kide/plugins/config/neogit.lua index 1e94e5ea..740376a8 100644 --- a/lua/kide/plugins/config/neogit.lua +++ b/lua/kide/plugins/config/neogit.lua @@ -62,14 +62,6 @@ neogit.setup({ folded = true, }, }, - -- override/add mappings - mappings = { - -- modify status buffer mappings - status = { - -- Adds a mapping with "B" as key that does the "BranchPopup" command - ["B"] = "BranchPopup", - }, - }, status = { recent_commit_count = 40, }, From b5196989192f4ecba51326473fbdd6681f3412c8 Mon Sep 17 00:00:00 2001 From: luokai Date: Wed, 19 Jul 2023 20:49:01 +0800 Subject: [PATCH 0791/1278] gruvbox --- lua/kide/plugins/config/gruvbox.lua | 29 ----------------------------- lua/kide/plugins/config/lualine.lua | 2 +- lua/kide/plugins/lazy-nvim.lua | 18 +++++++++++++++--- 3 files changed, 16 insertions(+), 33 deletions(-) diff --git a/lua/kide/plugins/config/gruvbox.lua b/lua/kide/plugins/config/gruvbox.lua index a9212974..fdb23d9a 100644 --- a/lua/kide/plugins/config/gruvbox.lua +++ b/lua/kide/plugins/config/gruvbox.lua @@ -4,37 +4,8 @@ if transparent_mode then overrides.Pmenu = { bg = "none", } -else - -- overrides.NormalFloat = { - -- bg = "#313131", - -- } - -- overrides.Pmenu = { - -- bg = "#2e2e2e", - -- } - overrides.FloatBorder = { - fg = "#a89984", - } end require("gruvbox").setup({ - undercurl = true, - underline = true, - bold = true, - italic = { - strings = true, - comments = true, - operators = false, - folds = true, - }, - strikethrough = true, - invert_selection = false, - invert_signs = false, - invert_tabline = false, - invert_intend_guides = false, - inverse = true, -- invert background for search, diffs, statuslines and errors - contrast = "", -- can be "hard", "soft" or empty string - palette_overrides = {}, - overrides = overrides, - dim_inactive = false, transparent_mode = transparent_mode, }) vim.opt.background = "dark" diff --git a/lua/kide/plugins/config/lualine.lua b/lua/kide/plugins/config/lualine.lua index 318943da..aca8c8e3 100644 --- a/lua/kide/plugins/config/lualine.lua +++ b/lua/kide/plugins/config/lualine.lua @@ -1,7 +1,7 @@ local config = { options = { icons_enabled = true, - theme = "gruvbox-material", + theme = "gruvbox", component_separators = { left = "", right = "" }, section_separators = { left = "", right = "" }, disabled_filetypes = { diff --git a/lua/kide/plugins/lazy-nvim.lua b/lua/kide/plugins/lazy-nvim.lua index 33728a0a..a3966261 100644 --- a/lua/kide/plugins/lazy-nvim.lua +++ b/lua/kide/plugins/lazy-nvim.lua @@ -123,16 +123,18 @@ require("lazy").setup({ -- use 'morhetz/gruvbox' { "ellisonleao/gruvbox.nvim", - enabled = false, + enabled = true, lazy = false, priority = 1000, config = function() - require("kide.plugins.config.gruvbox") + require("gruvbox").setup({}) + vim.opt.background = "dark" + vim.cmd([[colorscheme gruvbox]]) end, }, { "sainnhe/gruvbox-material", - enabled = true, + enabled = false, lazy = false, priority = 1000, config = function() @@ -144,6 +146,16 @@ require("lazy").setup({ vim.cmd([[colorscheme gruvbox-material]]) end, }, + { + "morhetz/gruvbox", + enabled = false, + lazy = false, + priority = 1000, + config = function() + vim.opt.background = "dark" + vim.cmd([[colorscheme gruvbox]]) + end, + }, -- 文件管理 { From e090e3e7928fb197b1a85ddb78d235f3b9561cd1 Mon Sep 17 00:00:00 2001 From: luokai Date: Wed, 19 Jul 2023 20:51:52 +0800 Subject: [PATCH 0792/1278] del --- lua/kide/plugins/config/gruvbox.lua | 12 ------------ 1 file changed, 12 deletions(-) delete mode 100644 lua/kide/plugins/config/gruvbox.lua diff --git a/lua/kide/plugins/config/gruvbox.lua b/lua/kide/plugins/config/gruvbox.lua deleted file mode 100644 index fdb23d9a..00000000 --- a/lua/kide/plugins/config/gruvbox.lua +++ /dev/null @@ -1,12 +0,0 @@ -local transparent_mode = false -local overrides = {} -if transparent_mode then - overrides.Pmenu = { - bg = "none", - } -end -require("gruvbox").setup({ - transparent_mode = transparent_mode, -}) -vim.opt.background = "dark" -vim.cmd([[colorscheme gruvbox]]) From 91cfadf3ea1ce3093b44d5ba26e8f8535f88f50f Mon Sep 17 00:00:00 2001 From: luokai Date: Sat, 22 Jul 2023 09:41:39 +0800 Subject: [PATCH 0793/1278] lsp ui update --- lua/kide/lsp/init.lua | 139 +------------------------------- lua/kide/lsp/lsp_ui.lua | 140 +++++++++++++++++++++++++++++++++ lua/kide/plugins/lazy-nvim.lua | 2 +- 3 files changed, 142 insertions(+), 139 deletions(-) diff --git a/lua/kide/lsp/init.lua b/lua/kide/lsp/init.lua index 6ea2e670..c96068bf 100644 --- a/lua/kide/lsp/init.lua +++ b/lua/kide/lsp/init.lua @@ -1,3 +1,4 @@ +require("kide.lsp.lsp_ui").init() local mason_lspconfig = require("mason-lspconfig") mason_lspconfig.setup({ ensure_installed = { @@ -61,28 +62,6 @@ for _, value in pairs(server_configs) do end end --- LSP 相关美化参考 https://github.com/NvChad/NvChad -local function lspSymbol(name, icon) - local hl = "DiagnosticSign" .. name - vim.fn.sign_define(hl, { text = icon, numhl = hl, texthl = hl }) -end - -local lsp_ui = require("kide.lsp.lsp_ui") -lspSymbol("Error", lsp_ui.diagnostics.icons.error) -lspSymbol("Info", lsp_ui.diagnostics.icons.info) -lspSymbol("Hint", lsp_ui.diagnostics.icons.hint) -lspSymbol("Warn", lsp_ui.diagnostics.icons.warning) - -vim.diagnostic.config({ - virtual_text = true, - signs = true, - underline = true, - update_in_insert = false, - severity_sort = false, -}) - -vim.lsp.handlers["textDocument/signatureHelp"] = vim.lsp.with(vim.lsp.handlers.signature_help, lsp_ui.hover_actions) - -- LspAttach 事件 vim.api.nvim_create_augroup("LspAttach_keymap", {}) vim.api.nvim_create_autocmd("LspAttach", { @@ -139,119 +118,3 @@ vim.api.nvim_create_autocmd("LspAttach", { end end, }) - --- 文档格式化 -local function markdown_format(input) - if input then - input = string.gsub(input, '%[([%a%$_]?[%.%w%(%)*"+,\\_%[%]%s :%-@"]*)%]%(file:/[^%)]+%)', function(i1) - return "`" .. i1 .. "`" - end) - input = string.gsub(input, '%[([%a%$_]?[%.%w%(%)*"+,\\_%[%]%s :%-@"]*)%]%(jdt://[^%)]+%)', function(i1) - return "`" .. i1 .. "`" - end) - end - return input -end - -local function split_lines(value) - value = string.gsub(value, "\r\n?", "\n") - return vim.split(value, "\n", { plain = true }) -end -local function convert_input_to_markdown_lines(input, contents) - contents = contents or {} - -- MarkedString variation 1 - if type(input) == "string" then - input = markdown_format(input) - vim.list_extend(contents, split_lines(input)) - else - assert(type(input) == "table", "Expected a table for Hover.contents") - -- MarkupContent - if input.kind then - -- The kind can be either plaintext or markdown. - -- If it's plaintext, then wrap it in a block - - -- Some servers send input.value as empty, so let's ignore this :( - local value = input.value or "" - - if input.kind == "plaintext" then - -- wrap this in a block so that stylize_markdown - -- can properly process it as plaintext - value = string.format("\n%s\n", value) - end - - -- assert(type(value) == 'string') - vim.list_extend(contents, split_lines(value)) - -- MarkupString variation 2 - elseif input.language then - -- Some servers send input.value as empty, so let's ignore this :( - -- assert(type(input.value) == 'string') - table.insert(contents, "```" .. input.language) - vim.list_extend(contents, split_lines(input.value or "")) - table.insert(contents, "```") - -- By deduction, this must be MarkedString[] - else - -- Use our existing logic to handle MarkedString - for _, marked_string in ipairs(input) do - convert_input_to_markdown_lines(marked_string, contents) - end - end - end - if (contents[1] == "" or contents[1] == nil) and #contents == 1 then - return {} - end - return contents -end - -local function jhover(_, result, ctx, config) - config = config or {} - config.focus_id = ctx.method - if vim.api.nvim_get_current_buf() ~= ctx.bufnr then - -- Ignore result since buffer changed. This happens for slow language servers. - return - end - if not (result and result.contents) then - if config.silent ~= true then - vim.notify("No information available") - end - return - end - local markdown_lines = convert_input_to_markdown_lines(result.contents) - markdown_lines = vim.lsp.util.trim_empty_lines(markdown_lines) - if vim.tbl_isempty(markdown_lines) then - if config.silent ~= true then - vim.notify("No information available") - end - return - end - local bufnr, winnr = vim.lsp.util.open_floating_preview(markdown_lines, "markdown", config) - vim.api.nvim_win_set_option(winnr, "winhighlight", lsp_ui.window.winhighlight) - return bufnr, winnr -end -vim.lsp.handlers["textDocument/hover"] = vim.lsp.with(jhover, lsp_ui.hover_actions) -vim.lsp.handlers["textDocument/signatureHelp"] = vim.lsp.with(function(a, result, ctx, b) - local bufnr, winnr = vim.lsp.handlers.signature_help(a, result, ctx, b) - vim.api.nvim_win_set_option(winnr, "winhighlight", lsp_ui.window.winhighlight) - return bufnr, winnr -end, lsp_ui.hover_actions) - -local source = require("cmp_nvim_lsp.source") -source.resolve = function(self, completion_item, callback) - -- client is stopped. - if self.client.is_stopped() then - return callback() - end - - -- client has no completion capability. - if not self:_get(self.client.server_capabilities, { "completionProvider", "resolveProvider" }) then - return callback() - end - - self:_request("completionItem/resolve", completion_item, function(_, response) - -- jdtls 文档格式化 - if self.client.name == "jdtls" and response and response.documentation then - response.documentation.value = markdown_format(response.documentation.value) - end - -- print(vim.inspect(response)) - callback(response or completion_item) - end) -end diff --git a/lua/kide/lsp/lsp_ui.lua b/lua/kide/lsp/lsp_ui.lua index e63a5599..a33fbca6 100644 --- a/lua/kide/lsp/lsp_ui.lua +++ b/lua/kide/lsp/lsp_ui.lua @@ -82,4 +82,144 @@ M.diagnostics = { error = "", }, } + +-- LSP 相关美化参考 https://github.com/NvChad/NvChad +local function lspSymbol(name, icon) + local hl = "DiagnosticSign" .. name + vim.fn.sign_define(hl, { text = icon, numhl = hl, texthl = hl }) +end +M.init = function() + local lsp_ui = M + lspSymbol("Error", lsp_ui.diagnostics.icons.error) + lspSymbol("Info", lsp_ui.diagnostics.icons.info) + lspSymbol("Hint", lsp_ui.diagnostics.icons.hint) + lspSymbol("Warn", lsp_ui.diagnostics.icons.warning) + + vim.diagnostic.config({ + virtual_text = true, + signs = true, + underline = true, + update_in_insert = false, + severity_sort = false, + }) + + vim.lsp.handlers["textDocument/signatureHelp"] = vim.lsp.with(vim.lsp.handlers.signature_help, lsp_ui.hover_actions) + + -- 文档格式化 + local function markdown_format(input) + if input then + input = string.gsub(input, '%[([%a%$_]?[%.%w%(%)*"+,\\_%[%]%s :%-@"]*)%]%(file:/[^%)]+%)', function(i1) + return "`" .. i1 .. "`" + end) + input = string.gsub(input, '%[([%a%$_]?[%.%w%(%)*"+,\\_%[%]%s :%-@"]*)%]%(jdt://[^%)]+%)', function(i1) + return "`" .. i1 .. "`" + end) + end + return input + end + + local function split_lines(value) + value = string.gsub(value, "\r\n?", "\n") + return vim.split(value, "\n", { plain = true }) + end + local function convert_input_to_markdown_lines(input, contents) + contents = contents or {} + -- MarkedString variation 1 + if type(input) == "string" then + input = markdown_format(input) + vim.list_extend(contents, split_lines(input)) + else + assert(type(input) == "table", "Expected a table for Hover.contents") + -- MarkupContent + if input.kind then + -- The kind can be either plaintext or markdown. + -- If it's plaintext, then wrap it in a block + + -- Some servers send input.value as empty, so let's ignore this :( + local value = input.value or "" + + if input.kind == "plaintext" then + -- wrap this in a block so that stylize_markdown + -- can properly process it as plaintext + value = string.format("\n%s\n", value) + end + + -- assert(type(value) == 'string') + vim.list_extend(contents, split_lines(value)) + -- MarkupString variation 2 + elseif input.language then + -- Some servers send input.value as empty, so let's ignore this :( + -- assert(type(input.value) == 'string') + table.insert(contents, "```" .. input.language) + vim.list_extend(contents, split_lines(input.value or "")) + table.insert(contents, "```") + -- By deduction, this must be MarkedString[] + else + -- Use our existing logic to handle MarkedString + for _, marked_string in ipairs(input) do + convert_input_to_markdown_lines(marked_string, contents) + end + end + end + if (contents[1] == "" or contents[1] == nil) and #contents == 1 then + return {} + end + return contents + end + + local function jhover(_, result, ctx, config) + config = config or {} + config.focus_id = ctx.method + if vim.api.nvim_get_current_buf() ~= ctx.bufnr then + -- Ignore result since buffer changed. This happens for slow language servers. + return + end + if not (result and result.contents) then + if config.silent ~= true then + vim.notify("No information available") + end + return + end + local markdown_lines = convert_input_to_markdown_lines(result.contents) + markdown_lines = vim.lsp.util.trim_empty_lines(markdown_lines) + if vim.tbl_isempty(markdown_lines) then + if config.silent ~= true then + vim.notify("No information available") + end + return + end + local bufnr, winnr = vim.lsp.util.open_floating_preview(markdown_lines, "markdown", config) + vim.api.nvim_win_set_option(winnr, "winhighlight", lsp_ui.window.winhighlight) + return bufnr, winnr + end + vim.lsp.handlers["textDocument/hover"] = vim.lsp.with(jhover, lsp_ui.hover_actions) + vim.lsp.handlers["textDocument/signatureHelp"] = vim.lsp.with(function(a, result, ctx, b) + local bufnr, winnr = vim.lsp.handlers.signature_help(a, result, ctx, b) + vim.api.nvim_win_set_option(winnr, "winhighlight", lsp_ui.window.winhighlight) + return bufnr, winnr + end, lsp_ui.hover_actions) + + local source = require("cmp_nvim_lsp.source") + source.resolve = function(self, completion_item, callback) + -- client is stopped. + if self.client.is_stopped() then + return callback() + end + + -- client has no completion capability. + if not self:_get(self.client.server_capabilities, { "completionProvider", "resolveProvider" }) then + return callback() + end + + self:_request("completionItem/resolve", completion_item, function(_, response) + -- jdtls 文档格式化 + if self.client.name == "jdtls" and response and response.documentation then + response.documentation.value = markdown_format(response.documentation.value) + end + -- print(vim.inspect(response)) + callback(response or completion_item) + end) + end +end + return M diff --git a/lua/kide/plugins/lazy-nvim.lua b/lua/kide/plugins/lazy-nvim.lua index a3966261..d8fd5c0c 100644 --- a/lua/kide/plugins/lazy-nvim.lua +++ b/lua/kide/plugins/lazy-nvim.lua @@ -614,7 +614,7 @@ require("lazy").setup({ "j-hui/fidget.nvim", lazy = true, tag = "legacy", - event = "VeryLazy", + event = "LspAttach", config = function() require("fidget").setup({ text = { From 4422f3f0dfdb25b80987f3ffaa1ff79dacf3ba86 Mon Sep 17 00:00:00 2001 From: luokai Date: Sat, 22 Jul 2023 09:52:20 +0800 Subject: [PATCH 0794/1278] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E8=AF=B4=E6=98=8E?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/README.md b/README.md index 6ade1277..e63db12f 100644 --- a/README.md +++ b/README.md @@ -69,6 +69,9 @@ git clone https://github.com/JavaHello/nvim.git ## Java 配置 +- 查找支持查找`jar` 包 `class` +- 美化 `lsp_hover/doc` 显示 + > 如果不使用 `Java` 语言开发,无需配置 [NVIM 打造 Java IDE](https://javahello.github.io/dev/tools/NVIM-LSP-Java-IDE-vscode.html) From 8575a3d5447c76f75ed90b361f34e657c43d6c32 Mon Sep 17 00:00:00 2001 From: luokai Date: Sat, 22 Jul 2023 09:53:53 +0800 Subject: [PATCH 0795/1278] update --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index e63db12f..f37bdb0b 100644 --- a/README.md +++ b/README.md @@ -69,7 +69,7 @@ git clone https://github.com/JavaHello/nvim.git ## Java 配置 -- 查找支持查找`jar` 包 `class` +- 添加了`telescope`支持查找`jar` 包 `class` - 美化 `lsp_hover/doc` 显示 > 如果不使用 `Java` 语言开发,无需配置 From ffd73d77c9a5bb97f852ad26d092d0487513e906 Mon Sep 17 00:00:00 2001 From: luokai Date: Sat, 22 Jul 2023 10:06:23 +0800 Subject: [PATCH 0796/1278] nvim-lastplace --- lua/kide/core/basic.lua | 19 ++++++++++--------- lua/kide/plugins/lazy-nvim.lua | 13 +++++++++++++ 2 files changed, 23 insertions(+), 9 deletions(-) diff --git a/lua/kide/core/basic.lua b/lua/kide/core/basic.lua index 614dffb7..21f514e5 100644 --- a/lua/kide/core/basic.lua +++ b/lua/kide/core/basic.lua @@ -152,15 +152,16 @@ if vim.g.neovide then vim.g.neovide_profiler = false end -autocmd("BufReadPost", { - pattern = "*", - callback = function() - local l = vim.fn.line("'\"") - if l > 1 and l <= vim.fn.line("$") then - vim.fn.execute("normal! g'\"") - end - end, -}) +-- use ethanholz/nvim-lastplace +-- autocmd("BufReadPost", { +-- pattern = "*", +-- callback = function() +-- local l = vim.fn.line("'\"") +-- if l > 1 and l <= vim.fn.line("$") then +-- vim.fn.execute("normal! g'\"") +-- end +-- end, +-- }) vim.opt_global.grepprg = "rg --vimgrep --no-heading --smart-case" vim.opt_global.grepformat = "%f:%l:%c:%m,%f:%l:%m" diff --git a/lua/kide/plugins/lazy-nvim.lua b/lua/kide/plugins/lazy-nvim.lua index d8fd5c0c..1ea25867 100644 --- a/lua/kide/plugins/lazy-nvim.lua +++ b/lua/kide/plugins/lazy-nvim.lua @@ -740,6 +740,19 @@ require("lazy").setup({ end, }, + { + "ethanholz/nvim-lastplace", + lazy = true, + event = { "BufReadPost" }, + config = function() + require("nvim-lastplace").setup({ + lastplace_ignore_buftype = { "quickfix", "nofile", "help" }, + lastplace_ignore_filetype = { "gitcommit", "gitrebase", "svn", "hgcommit" }, + lastplace_open_folds = true, + }) + end, + }, + { "akinsho/flutter-tools.nvim", lazy = true, From f1ae11f9e6679e528c72e9bb4767cbd2a7afa0c3 Mon Sep 17 00:00:00 2001 From: luokai Date: Sat, 22 Jul 2023 10:58:38 +0800 Subject: [PATCH 0797/1278] textobjects --- .../config/nvim-treesitter-context.lua | 39 ---------- lua/kide/plugins/config/nvim-treesitter.lua | 59 -------------- lua/kide/plugins/lazy-nvim.lua | 77 ++++++++++++++++++- 3 files changed, 76 insertions(+), 99 deletions(-) delete mode 100644 lua/kide/plugins/config/nvim-treesitter-context.lua delete mode 100644 lua/kide/plugins/config/nvim-treesitter.lua diff --git a/lua/kide/plugins/config/nvim-treesitter-context.lua b/lua/kide/plugins/config/nvim-treesitter-context.lua deleted file mode 100644 index 0d94ca73..00000000 --- a/lua/kide/plugins/config/nvim-treesitter-context.lua +++ /dev/null @@ -1,39 +0,0 @@ -require("treesitter-context").setup({ - enable = false, -- Enable this plugin (Can be enabled/disabled later via commands) - max_lines = 0, -- How many lines the window should span. Values <= 0 mean no limit. - trim_scope = "outer", -- Which context lines to discard if `max_lines` is exceeded. Choices: 'inner', 'outer' - patterns = { -- Match patterns for TS nodes. These get wrapped to match at word boundaries. - -- For all filetypes - -- Note that setting an entry here replaces all other patterns for this entry. - -- By setting the 'default' entry below, you can control which nodes you want to - -- appear in the context window. - default = { - "class", - "function", - "method", - -- 'for', -- These won't appear in the context - -- 'while', - -- 'if', - -- 'switch', - -- 'case', - }, - -- Example for a specific filetype. - -- If a pattern is missing, *open a PR* so everyone can benefit. - -- rust = { - -- 'impl_item', - -- }, - }, - exact_patterns = { - -- Example for a specific filetype with Lua patterns - -- Treat patterns.rust as a Lua pattern (i.e "^impl_item$" will - -- exactly match "impl_item" only) - -- rust = true, - }, - - -- [!] The options below are exposed but shouldn't require your attention, - -- you can safely ignore them. - - zindex = 20, -- The Z-index of the context window - mode = "cursor", -- Line used to calculate context. Choices: 'cursor', 'topline' - separator = nil, -- Separator between context and content. Should be a single character string, like '-'. -}) diff --git a/lua/kide/plugins/config/nvim-treesitter.lua b/lua/kide/plugins/config/nvim-treesitter.lua deleted file mode 100644 index 96153326..00000000 --- a/lua/kide/plugins/config/nvim-treesitter.lua +++ /dev/null @@ -1,59 +0,0 @@ -require("nvim-treesitter.configs").setup({ - -- One of "all", "maintained" (parsers with maintainers), or a list of languages - ensure_installed = { - "html", - "css", - "vim", - "yaml", - "http", - "bash", - "markdown", - "org", - "norg", - }, - - -- Install languages synchronously (only applied to `ensure_installed`) - sync_install = false, - - -- List of parsers to ignore installing - ignore_install = {}, - - highlight = { - -- `false` will disable the whole extension - enable = true, - - -- list of language that will be disabled - disable = {}, - - -- Setting this to true will run `:h syntax` and tree-sitter at the same time. - -- Set this to `true` if you depend on 'syntax' being enabled (like for indentation). - -- Using this option may slow down your editor, and you may see some duplicate highlights. - -- Instead of true it can also be a list of languages - additional_vim_regex_highlighting = false, - }, - textobjects = { - move = { - enable = true, - set_jumps = true, -- whether to set jumps in the jumplist - goto_next_start = { - ["]m"] = "@function.outer", - ["]]"] = "@class.outer", - }, - goto_next_end = { - ["]M"] = "@function.outer", - ["]["] = "@class.outer", - }, - goto_previous_start = { - ["[m"] = "@function.outer", - ["[["] = "@class.outer", - }, - goto_previous_end = { - ["[M"] = "@function.outer", - ["[]"] = "@class.outer", - }, - }, - }, -}) --- 开启 Folding -vim.wo.foldmethod = "expr" -vim.wo.foldexpr = "nvim_treesitter#foldexpr()" diff --git a/lua/kide/plugins/lazy-nvim.lua b/lua/kide/plugins/lazy-nvim.lua index 1ea25867..72b28e29 100644 --- a/lua/kide/plugins/lazy-nvim.lua +++ b/lua/kide/plugins/lazy-nvim.lua @@ -184,7 +184,82 @@ require("lazy").setup({ event = { "VeryLazy", "BufNewFile", "BufReadPost" }, build = ":TSUpdate", config = function() - require("kide.plugins.config.nvim-treesitter") + require("nvim-treesitter.configs").setup({ + ensure_installed = { + "markdown", + }, + sync_install = false, + ignore_install = {}, + + highlight = { + enable = true, + disable = {}, + additional_vim_regex_highlighting = false, + }, + textobjects = { + move = { + enable = true, + set_jumps = true, -- whether to set jumps in the jumplist + goto_next_start = { + ["]m"] = "@function.outer", + ["]]"] = { query = "@class.outer", desc = "Next class start" }, + ["]o"] = "@loop.*", + ["]s"] = { query = "@scope", query_group = "locals", desc = "Next scope" }, + ["]z"] = { query = "@fold", query_group = "folds", desc = "Next fold" }, + }, + goto_next_end = { + ["]M"] = "@function.outer", + ["]["] = "@class.outer", + }, + goto_previous_start = { + ["[m"] = "@function.outer", + ["[["] = "@class.outer", + ["[o"] = "@loop.*", + ["[s"] = { query = "@scope", query_group = "locals", desc = "Next scope" }, + ["[z"] = { query = "@fold", query_group = "folds", desc = "Next fold" }, + }, + goto_previous_end = { + ["[M"] = "@function.outer", + ["[]"] = "@class.outer", + }, + goto_next = { + ["]d"] = "@conditional.outer", + }, + goto_previous = { + ["[d"] = "@conditional.outer", + }, + }, + select = { + enable = true, + lookahead = true, + keymaps = { + ["af"] = "@function.outer", + ["if"] = "@function.inner", + ["ac"] = "@class.outer", + ["ic"] = { query = "@class.inner", desc = "Select inner part of a class region" }, + ["as"] = { query = "@scope", query_group = "locals", desc = "Select language scope" }, + }, + selection_modes = { + ["@parameter.outer"] = "v", -- charwise + ["@function.outer"] = "V", -- linewise + ["@class.outer"] = "", -- blockwise + }, + include_surrounding_whitespace = false, + }, + swap = { + enable = true, + swap_next = { + ["a"] = "@parameter.inner", + }, + swap_previous = { + ["A"] = "@parameter.inner", + }, + }, + }, + }) + -- 开启 Folding + vim.wo.foldmethod = "expr" + vim.wo.foldexpr = "nvim_treesitter#foldexpr()" end, }, { From 91ffbb3fede1c3fbea3939c519bbcfa069ff8009 Mon Sep 17 00:00:00 2001 From: luokai Date: Sat, 22 Jul 2023 11:30:14 +0800 Subject: [PATCH 0798/1278] incremental_selection --- lua/kide/plugins/lazy-nvim.lua | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/lua/kide/plugins/lazy-nvim.lua b/lua/kide/plugins/lazy-nvim.lua index 72b28e29..5ef5838e 100644 --- a/lua/kide/plugins/lazy-nvim.lua +++ b/lua/kide/plugins/lazy-nvim.lua @@ -196,6 +196,18 @@ require("lazy").setup({ disable = {}, additional_vim_regex_highlighting = false, }, + indent = { + enable = true, + }, + incremental_selection = { + enable = true, + keymaps = { + init_selection = "gnn", + node_incremental = "grn", + scope_incremental = "grc", + node_decremental = "grm", + }, + }, textobjects = { move = { enable = true, From 7777ad5dd8b8da1ade004c09c42ec06e1d3c8fb6 Mon Sep 17 00:00:00 2001 From: luokai Date: Sun, 23 Jul 2023 10:27:51 +0800 Subject: [PATCH 0799/1278] ui update --- ftplugin/alpha.lua | 1 - ftplugin/c.lua | 3 -- ftplugin/cpp.lua | 3 -- ftplugin/html.lua | 2 - ftplugin/java.lua | 3 -- ftplugin/javascript.lua | 3 -- ftplugin/lua.lua | 3 -- ftplugin/nginx.lua | 3 -- ftplugin/rust.lua | 3 -- init.lua | 28 +++++++++++ lua/kide/core/basic.lua | 14 ++---- lua/kide/lsp/java.lua | 4 ++ lua/kide/plugins/config/nvim-ufo.lua | 22 --------- lua/kide/plugins/lazy-nvim.lua | 71 +++++++++++++++++++++++++--- lua/kide/theme/gruvbox.lua | 6 ++- 15 files changed, 107 insertions(+), 62 deletions(-) delete mode 100644 ftplugin/alpha.lua delete mode 100644 ftplugin/c.lua delete mode 100644 ftplugin/cpp.lua delete mode 100644 ftplugin/html.lua delete mode 100644 ftplugin/java.lua delete mode 100644 ftplugin/javascript.lua delete mode 100644 ftplugin/lua.lua delete mode 100644 ftplugin/nginx.lua delete mode 100644 ftplugin/rust.lua delete mode 100644 lua/kide/plugins/config/nvim-ufo.lua diff --git a/ftplugin/alpha.lua b/ftplugin/alpha.lua deleted file mode 100644 index 4911e28c..00000000 --- a/ftplugin/alpha.lua +++ /dev/null @@ -1 +0,0 @@ -vim.opt_local.foldenable = false diff --git a/ftplugin/c.lua b/ftplugin/c.lua deleted file mode 100644 index 5603e941..00000000 --- a/ftplugin/c.lua +++ /dev/null @@ -1,3 +0,0 @@ -vim.opt_local.foldcolumn = "1" -vim.opt_local.foldenable = true -vim.opt_local.signcolumn = "yes" diff --git a/ftplugin/cpp.lua b/ftplugin/cpp.lua deleted file mode 100644 index 5603e941..00000000 --- a/ftplugin/cpp.lua +++ /dev/null @@ -1,3 +0,0 @@ -vim.opt_local.foldcolumn = "1" -vim.opt_local.foldenable = true -vim.opt_local.signcolumn = "yes" diff --git a/ftplugin/html.lua b/ftplugin/html.lua deleted file mode 100644 index 123c5e98..00000000 --- a/ftplugin/html.lua +++ /dev/null @@ -1,2 +0,0 @@ -vim.opt_local.foldcolumn = "1" -vim.opt_local.foldenable = true diff --git a/ftplugin/java.lua b/ftplugin/java.lua deleted file mode 100644 index 5603e941..00000000 --- a/ftplugin/java.lua +++ /dev/null @@ -1,3 +0,0 @@ -vim.opt_local.foldcolumn = "1" -vim.opt_local.foldenable = true -vim.opt_local.signcolumn = "yes" diff --git a/ftplugin/javascript.lua b/ftplugin/javascript.lua deleted file mode 100644 index 5603e941..00000000 --- a/ftplugin/javascript.lua +++ /dev/null @@ -1,3 +0,0 @@ -vim.opt_local.foldcolumn = "1" -vim.opt_local.foldenable = true -vim.opt_local.signcolumn = "yes" diff --git a/ftplugin/lua.lua b/ftplugin/lua.lua deleted file mode 100644 index 5603e941..00000000 --- a/ftplugin/lua.lua +++ /dev/null @@ -1,3 +0,0 @@ -vim.opt_local.foldcolumn = "1" -vim.opt_local.foldenable = true -vim.opt_local.signcolumn = "yes" diff --git a/ftplugin/nginx.lua b/ftplugin/nginx.lua deleted file mode 100644 index 5603e941..00000000 --- a/ftplugin/nginx.lua +++ /dev/null @@ -1,3 +0,0 @@ -vim.opt_local.foldcolumn = "1" -vim.opt_local.foldenable = true -vim.opt_local.signcolumn = "yes" diff --git a/ftplugin/rust.lua b/ftplugin/rust.lua deleted file mode 100644 index 5603e941..00000000 --- a/ftplugin/rust.lua +++ /dev/null @@ -1,3 +0,0 @@ -vim.opt_local.foldcolumn = "1" -vim.opt_local.foldenable = true -vim.opt_local.signcolumn = "yes" diff --git a/init.lua b/init.lua index e7ae4853..73c8edcd 100644 --- a/init.lua +++ b/init.lua @@ -1,3 +1,31 @@ -- math.randomseed(os.time()) +vim.g.transparent_mode = false + +if vim.g.neovide then + vim.g.transparent_mode = true + vim.g.neovide_cursor_vfx_mode = "railgun" + vim.opt_global.guifont = "Hack Nerd Font Mono,Hack:h13" + vim.g.neovide_fullscreen = false + vim.g.neovide_input_use_logo = true + local alpha = function() + return string.format("%x", math.floor(255 * vim.g.transparency or 0.8)) + end + -- g:neovide_transparency should be 0 if you want to unify transparency of content and title bar. + vim.g.neovide_transparency = 0.0 + vim.g.transparency = 0.8 + vim.g.neovide_background_color = "#282828" .. alpha() + + vim.g.neovide_floating_blur_amount_x = 2.0 + vim.g.neovide_floating_blur_amount_y = 2.0 + + vim.g.neovide_hide_mouse_when_typing = true + + vim.g.neovide_profiler = false + vim.g.neovide_padding_top = 0 + vim.g.neovide_padding_bottom = 0 + vim.g.neovide_padding_right = 0 + vim.g.neovide_padding_left = 0 +end + require("kide.core") require("kide.plugins") diff --git a/lua/kide/core/basic.lua b/lua/kide/core/basic.lua index 21f514e5..26b800de 100644 --- a/lua/kide/core/basic.lua +++ b/lua/kide/core/basic.lua @@ -52,7 +52,6 @@ vim.opt.fileencoding = "UTF-8" -- jk移动时光标下上方保留8行 vim.opt.scrolloff = 3 vim.opt.sidescrolloff = 3 -vim.opt.signcolumn = "auto" vim.opt.pumheight = 20 -- 缩进配置 vim.opt.tabstop = 4 @@ -137,20 +136,17 @@ vim.opt.timeoutlen = 450 vim.opt.mouse = "a" +-- vim.o.fillchars = [[eob: ,fold: ,foldopen:,foldsep: ,foldclose:]] +vim.opt.foldcolumn = "0" +vim.opt.foldenable = true +vim.opt.signcolumn = "auto" + -- 默认不要折叠 -- https://stackoverflow.com/questions/8316139/how-to-set-the-default-to-unfolded-when-you-open-a-file vim.opt.foldlevel = 99 -- Using ufo provider need a large value, feel free to decrease the value vim.opt.foldlevelstart = 99 vim.opt_global.completeopt = "menu,menuone,noselect" -if vim.g.neovide then - vim.g.neovide_cursor_vfx_mode = "railgun" - vim.opt_global.guifont = "Hack Nerd Font Mono,Hack:h13" - vim.g.neovide_transparency = 1 - vim.g.neovide_fullscreen = true - vim.g.neovide_input_use_logo = true - vim.g.neovide_profiler = false -end -- use ethanholz/nvim-lastplace -- autocmd("BufReadPost", { diff --git a/lua/kide/lsp/java.lua b/lua/kide/lsp/java.lua index ca0d67d2..ee7f2de7 100644 --- a/lua/kide/lsp/java.lua +++ b/lua/kide/lsp/java.lua @@ -350,6 +350,10 @@ config["on_attach"] = function(client, buffer) end local capabilities = require("cmp_nvim_lsp").default_capabilities(vim.lsp.protocol.make_client_capabilities()) +capabilities.textDocument.foldingRange = { + dynamicRegistration = false, + lineFoldingOnly = true, +} -- capabilities.experimental = { -- hoverActions = true, -- hoverRange = true, diff --git a/lua/kide/plugins/config/nvim-ufo.lua b/lua/kide/plugins/config/nvim-ufo.lua deleted file mode 100644 index 3feb0fa6..00000000 --- a/lua/kide/plugins/config/nvim-ufo.lua +++ /dev/null @@ -1,22 +0,0 @@ -require("kide.core.keybindings").ufo_mapkey() - --- Option 3: treesitter as a main provider instead --- Only depend on `nvim-treesitter/queries/filetype/folds.scm`, --- performance and stability are better than `foldmethod=nvim_treesitter#foldexpr()` -local ftMap = { - c = { "treesitter" }, - cpp = { "treesitter" }, - rust = { "treesitter" }, - java = { "treesitter" }, - lua = { "treesitter" }, - html = { "treesitter" }, - nginx = { "indent" }, - vim = "indent", - python = { "indent" }, -} -require("ufo").setup({ - provider_selector = function(bufnr, filetype, buftype) - -- return { "treesitter", "indent" } - return ftMap[filetype] - end, -}) diff --git a/lua/kide/plugins/lazy-nvim.lua b/lua/kide/plugins/lazy-nvim.lua index 5ef5838e..45b3e7ca 100644 --- a/lua/kide/plugins/lazy-nvim.lua +++ b/lua/kide/plugins/lazy-nvim.lua @@ -127,7 +127,9 @@ require("lazy").setup({ lazy = false, priority = 1000, config = function() - require("gruvbox").setup({}) + require("gruvbox").setup({ + transparent_mode = vim.g.transparent_mode, + }) vim.opt.background = "dark" vim.cmd([[colorscheme gruvbox]]) end, @@ -269,9 +271,9 @@ require("lazy").setup({ }, }, }) - -- 开启 Folding - vim.wo.foldmethod = "expr" - vim.wo.foldexpr = "nvim_treesitter#foldexpr()" + -- 开启 Folding see nvim-ufo + -- vim.wo.foldmethod = "expr" + -- vim.wo.foldexpr = "nvim_treesitter#foldexpr()" end, }, { @@ -821,9 +823,66 @@ require("lazy").setup({ { "kevinhwang91/nvim-ufo", lazy = true, - event = { "BufReadPost" }, + event = { "VeryLazy" }, config = function() - require("kide.plugins.config.nvim-ufo") + -- lsp->treesitter->indent + local ftMap = { + vim = "indent", + python = { "indent" }, + git = "", + } + + local function customizeSelector(bufnr) + local function handleFallbackException(err, providerName) + if type(err) == "string" and err:match("UfoFallbackException") then + return require("ufo").getFolds(bufnr, providerName) + else + return require("promise").reject(err) + end + end + + return require("ufo").getFolds(bufnr, "lsp") + :catch(function(err) + return handleFallbackException(err, "treesitter") + end) + :catch(function(err) + return handleFallbackException(err, "indent") + end) + end + local handler = function(virtText, lnum, endLnum, width, truncate) + local newVirtText = {} + local suffix = (" 󰁂 %d "):format(endLnum - lnum) + local sufWidth = vim.fn.strdisplaywidth(suffix) + local targetWidth = width - sufWidth + local curWidth = 0 + for _, chunk in ipairs(virtText) do + local chunkText = chunk[1] + local chunkWidth = vim.fn.strdisplaywidth(chunkText) + if targetWidth > curWidth + chunkWidth then + table.insert(newVirtText, chunk) + else + chunkText = truncate(chunkText, targetWidth - curWidth) + local hlGroup = chunk[2] + table.insert(newVirtText, { chunkText, hlGroup }) + chunkWidth = vim.fn.strdisplaywidth(chunkText) + -- str width returned from truncate() may less than 2nd argument, need padding + if curWidth + chunkWidth < targetWidth then + suffix = suffix .. (" "):rep(targetWidth - curWidth - chunkWidth) + end + break + end + curWidth = curWidth + chunkWidth + end + table.insert(newVirtText, { suffix, "MoreMsg" }) + return newVirtText + end + require("ufo").setup({ + provider_selector = function(bufnr, filetype, buftype) + return ftMap[filetype] or customizeSelector + end, + fold_virt_text_handler = handler, + }) + require("kide.core.keybindings").ufo_mapkey() end, }, diff --git a/lua/kide/theme/gruvbox.lua b/lua/kide/theme/gruvbox.lua index b2f75586..750341b9 100644 --- a/lua/kide/theme/gruvbox.lua +++ b/lua/kide/theme/gruvbox.lua @@ -77,8 +77,12 @@ M.load_highlights = function(hl_groups) end M.load_which_key_highlights = function() + local bg + if not vim.g.transparent_mode then + bg = colors.black3 + end M.load_highlights({ - WhichKeyFloat = { bg = colors.black3 }, + WhichKeyFloat = { bg = bg }, }) end From 9ea643e9d2a4804cf3961dceac7340367c68f028 Mon Sep 17 00:00:00 2001 From: luokai Date: Sun, 23 Jul 2023 10:51:10 +0800 Subject: [PATCH 0800/1278] =?UTF-8?q?=E7=AE=80=E5=8C=96=E9=85=8D=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lua/kide/plugins/config/alpha-nvim.lua | 32 - lua/kide/plugins/config/ascli-header.lua | 695 ------------------- lua/kide/plugins/config/comment.lua | 1 - lua/kide/plugins/config/diffview-nvim.lua | 1 - lua/kide/plugins/config/markdown-preview.lua | 1 - lua/kide/plugins/config/mason-nvim.lua | 1 - lua/kide/plugins/config/neogen.lua | 6 - lua/kide/plugins/config/nvim-autopairs.lua | 5 - lua/kide/plugins/config/nvim-colorizer.lua | 27 - lua/kide/plugins/config/nvim-notify.lua | 35 - lua/kide/plugins/config/rest-nvim.lua | 22 - lua/kide/plugins/config/toggletasks.lua | 13 - lua/kide/plugins/config/translate.lua | 12 - lua/kide/plugins/config/wilder.lua | 39 -- lua/kide/plugins/lazy-nvim.lua | 154 +++- 15 files changed, 133 insertions(+), 911 deletions(-) delete mode 100644 lua/kide/plugins/config/alpha-nvim.lua delete mode 100644 lua/kide/plugins/config/ascli-header.lua delete mode 100644 lua/kide/plugins/config/comment.lua delete mode 100644 lua/kide/plugins/config/diffview-nvim.lua delete mode 100644 lua/kide/plugins/config/markdown-preview.lua delete mode 100644 lua/kide/plugins/config/mason-nvim.lua delete mode 100644 lua/kide/plugins/config/neogen.lua delete mode 100644 lua/kide/plugins/config/nvim-autopairs.lua delete mode 100644 lua/kide/plugins/config/nvim-colorizer.lua delete mode 100644 lua/kide/plugins/config/nvim-notify.lua delete mode 100644 lua/kide/plugins/config/rest-nvim.lua delete mode 100644 lua/kide/plugins/config/toggletasks.lua delete mode 100644 lua/kide/plugins/config/translate.lua delete mode 100644 lua/kide/plugins/config/wilder.lua diff --git a/lua/kide/plugins/config/alpha-nvim.lua b/lua/kide/plugins/config/alpha-nvim.lua deleted file mode 100644 index a86b67ff..00000000 --- a/lua/kide/plugins/config/alpha-nvim.lua +++ /dev/null @@ -1,32 +0,0 @@ -local alpha = require("alpha") -local dashboard = require("alpha.themes.dashboard") --- local ascli = require("kide.plugins.config.ascli-header") - --- Set header --- dashboard.section.header.val = ascli[math.random(0, #ascli)] -dashboard.section.header.val = { - " ███╗ ██╗ ███████╗ ██████╗ ██╗ ██╗ ██╗ ███╗ ███╗", - " ████╗ ██║ ██╔════╝██╔═══██╗ ██║ ██║ ██║ ████╗ ████║", - " ██╔██╗ ██║ █████╗ ██║ ██║ ██║ ██║ ██║ ██╔████╔██║", - " ██║╚██╗██║ ██╔══╝ ██║ ██║ ╚██╗ ██╔╝ ██║ ██║╚██╔╝██║", - " ██║ ╚████║ ███████╗╚██████╔╝ ╚████╔╝ ██║ ██║ ╚═╝ ██║", - " ╚═╝ ╚═══╝ ╚══════╝ ╚═════╝ ╚═══╝ ╚═╝ ╚═╝ ╚═╝", -} -local opt = { noremap = true, silent = true } --- Set menu -dashboard.section.buttons.val = { - dashboard.button(" ff", "󰈞 Find File", ":Telescope find_files", opt), - dashboard.button(" fg", "󰈭 Find Word ", ":Telescope live_grep", opt), - dashboard.button( - " fp", - " Recent Projects", - ":lua require'telescope'.extensions.project.project{ display_type = 'full' }", - opt - ), - dashboard.button(" fo", " Recent File", ":Telescope oldfiles", opt), - dashboard.button(" ns", " Settings", ":e $MYVIMRC | :cd %:p:h ", opt), - dashboard.button(" q ", "󰅙 Quit NVIM", ":qa", opt), -} - --- Send config to alpha -alpha.setup(dashboard.opts) diff --git a/lua/kide/plugins/config/ascli-header.lua b/lua/kide/plugins/config/ascli-header.lua deleted file mode 100644 index add5934d..00000000 --- a/lua/kide/plugins/config/ascli-header.lua +++ /dev/null @@ -1,695 +0,0 @@ -local M = {} -M[0] = { - " ▄█ █ █▄ ", - " ▐██ ▄█ ███ █▄ ██▌ ", - " ▐██▌ ██████████████ ▐██▌ ", - " ████ ████████████████ ████ ", - " ▐█████ ██████████████████ █████▌ ", - " ████████████████████████████████ ", - " ███████▀▀████████████▀▀███████ ", - " █████▌ ▄▄ ▀████▀ ▄▄ ▐█████ ", - " ▄▄██████▄ ▀▀ ████ ▀▀ ▄██████▄▄ ", - " ██████████████████████████████████ ", - " ████████████████████████████████████ ", - " ██████ ███████▀▄██▄▀███████ ██████▌ ", - "▐█████ ██████████████████ █████▌ ", - " ▐█████ ██████▀ ▀██████ █████▌ ", - " █████▄ ███ ███ ▄█████ ", - " ██████ █ █ ██████ ", - " █████ █████ ", - " █████ █████ ", - " ████ ▄ ▄ ████ ", - " ████ ██ ██ ████ ", - " ████████ ▄██▄ ████████ ", - " ████████████████████████ ", - " ████████████████████████ ", - " ▀█████████▀▀█████████▀ ", - " ▀███▀ ▀███▀ ", -} - -M[1] = { - " ███████████████████████████ ", - " ███████▀▀▀░░░░░░░▀▀▀███████ ", - " ████▀░░░░░░░░░░░░░░░░░▀████ ", - " ███│░░░░░░░░░░░░░░░░░░░│███ ", - " ██▌│░░░░░░░░░░░░░░░░░░░│▐██ ", - " ██░└┐░░░░░░░░░░░░░░░░░┌┘░██ ", - " ██░░└┐░░░░░░░░░░░░░░░┌┘░░██ ", - " ██░░┌┘▄▄▄▄▄░░░░░▄▄▄▄▄└┐░░██ ", - " ██▌░│██████▌░░░▐██████│░▐██ ", - " ███░│▐███▀▀░░▄░░▀▀███▌│░███ ", - " ██▀─┘░░░░░░░▐█▌░░░░░░░└─▀██ ", - " ██▄░░░▄▄▄▓░░▀█▀░░▓▄▄▄░░░▄██ ", - " ████▄─┘██▌░░░░░░░▐██└─▄████ ", - " █████░░▐█─┬┬┬┬┬┬┬─█▌░░█████ ", - " ████▌░░░▀┬┼┼┼┼┼┼┼┬▀░░░▐████ ", - " █████▄░░░└┴┴┴┴┴┴┴┘░░░▄█████ ", - " ███████▄░░░░░░░░░░░▄███████ ", - " ██████████▄▄▄▄▄▄▄██████████ ", -} - -M[2] = { - " ▄▄▄▄▄███████████████████▄▄▄▄▄ ", - " ▄██████████▀▀▀▀▀▀▀▀▀▀██████▀████▄ ", - " █▀████████▄ ▀▀████ ▀██▄ ", - " █▄▄██████████████████▄▄▄ ▄██▀ ", - " ▀█████████████████████████▄ ▄██▀ ", - " ▀████▀▀▀▀▀▀▀▀▀▀▀▀█████████▄▄██▀ ", - " ▀███▄ ▀██████▀ ", - " ▀██████▄ ▄████▀ ", - " ▀█████▄▄▄▄▄▄▄███▀ ", - " ▀████▀▀▀████▀ ", - " ▀███▄███▀ ", - " ▀█▀ ", -} - -M[3] = { - " ⠀⠀⠀⠀⠀⠀⠀⡴⠞⠉⢉⣭⣿⣿⠿⣳⣤⠴⠖⠛⣛⣿⣿⡷⠖⣶⣤⡀⠀⠀⠀ ", - " ⠀⠀⠀⠀⠀⠀⠀⣼⠁⢀⣶⢻⡟⠿⠋⣴⠿⢻⣧⡴⠟⠋⠿⠛⠠⠾⢛⣵⣿⠀⠀⠀⠀ ", - " ⣼⣿⡿⢶⣄⠀⢀⡇⢀⡿⠁⠈⠀⠀⣀⣉⣀⠘⣿⠀⠀⣀⣀⠀⠀⠀⠛⡹⠋⠀⠀⠀⠀ ", - " ⣭⣤⡈⢑⣼⣻⣿⣧⡌⠁⠀⢀⣴⠟⠋⠉⠉⠛⣿⣴⠟⠋⠙⠻⣦⡰⣞⠁⢀⣤⣦⣤⠀ ", - " ⠀⠀⣰⢫⣾⠋⣽⠟⠑⠛⢠⡟⠁⠀⠀⠀⠀⠀⠈⢻⡄⠀⠀⠀⠘⣷⡈⠻⣍⠤⢤⣌⣀ ", - " ⢀⡞⣡⡌⠁⠀⠀⠀⠀⢀⣿⠁⠀⠀⠀⠀⠀⠀⠀⠀⢿⡀⠀⠀⠀⠸⣇⠀⢾⣷⢤⣬⣉ ", - " ⡞⣼⣿⣤⣄⠀⠀⠀⠀⢸⡇⠀⠀⠀⠀⠀⠀⠀⠀⠀⢸⡇⠀⠀⠀⠀⣿⠀⠸⣿⣇⠈⠻ ", - " ⢰⣿⡿⢹⠃⠀⣠⠤⠶⣼⡇⠀⠀⠀⠀⠀⠀⠀⠀⠀⢸⡇⠀⠀⠀⠀⣿⠀⠀⣿⠛⡄⠀ ", - " ⠈⠉⠁⠀⠀⠀⡟⡀⠀⠈⡗⠲⠶⠦⢤⣤⣤⣄⣀⣀⣸⣧⣤⣤⠤⠤⣿⣀⡀⠉⣼⡇⠀ ", - " ⣿⣴⣴⡆⠀⠀⠻⣄⠀⠀⠡⠀⠀⠀⠈⠛⠋⠀⠀⠀⡈⠀⠻⠟⠀⢀⠋⠉⠙⢷⡿⡇⠀ ", - " ⣻⡿⠏⠁⠀⠀⢠⡟⠀⠀⠀⠣⡀⠀⠀⠀⠀⠀⢀⣄⠀⠀⠀⠀⢀⠈⠀⢀⣀⡾⣴⠃⠀ ", - " ⢿⠛⠀⠀⠀⠀⢸⠁⠀⠀⠀⠀⠈⠢⠄⣀⠠⠼⣁⠀⡱⠤⠤⠐⠁⠀⠀⣸⠋⢻⡟⠀⠀ ", - " ⠈⢧⣀⣤⣶⡄⠘⣆⠀⠀⠀⠀⠀⠀⠀⢀⣤⠖⠛⠻⣄⠀⠀⠀⢀⣠⡾⠋⢀⡞⠀⠀⠀ ", - " ⠀⠀⠻⣿⣿⡇⠀⠈⠓⢦⣤⣤⣤⡤⠞⠉⠀⠀⠀⠀⠈⠛⠒⠚⢩⡅⣠⡴⠋⠀⠀⠀⠀ ", - " ⠀⠀⠀⠈⠻⢧⣀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠐⣻⠿⠋⠀⠀⠀⠀⠀⠀ ", - " ⠀⠀⠀⠀⠀⠀⠉⠓⠶⣤⣄⣀⡀⠀⠀⠀⠀⠀⢀⣀⣠⡴⠖⠋⠁⠀⠀⠀⠀⠀⠀⠀⠀ ", -} - -M[4] = { - " ⠀⠀⠀⠀⠀⠀⠀⠀⢀⣠⣤⣴⣶⣶⣶⣶⣶⠶⣶⣤⣤⣀⠀⠀⠀⠀⠀⠀ ", - " ⠀⠀⠀⠀⠀⠀⠀⢀⣤⣾⣿⣿⣿⠁⠀⢀⠈⢿⢀⣀⠀⠹⣿⣿⣿⣦⣄⠀⠀⠀ ", - " ⠀⠀⠀⠀⠀⠀⣴⣿⣿⣿⣿⣿⠿⠀⠀⣟⡇⢘⣾⣽⠀⠀⡏⠉⠙⢛⣿⣷⡖⠀ ", - " ⠀⠀⠀⠀⠀⣾⣿⣿⡿⠿⠷⠶⠤⠙⠒⠀⠒⢻⣿⣿⡷⠋⠀⠴⠞⠋⠁⢙⣿⣄ ", - " ⠀⠀⠀⠀⢸⣿⣿⣯⣤⣤⣤⣤⣤⡄⠀⠀⠀⠀⠉⢹⡄⠀⠀⠀⠛⠛⠋⠉⠹⡇ ", - " ⠀⠀⠀⠀⢸⣿⣿⠀⠀⠀⣀⣠⣤⣤⣤⣤⣤⣤⣤⣼⣇⣀⣀⣀⣛⣛⣒⣲⢾⡷ ", - " ⢀⠤⠒⠒⢼⣿⣿⠶⠞⢻⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⡿⠁⠀⣼⠃ ", - " ⢮⠀⠀⠀⠀⣿⣿⣆⠀⠀⠻⣿⡿⠛⠉⠉⠁⠀⠉⠉⠛⠿⣿⣿⠟⠁⠀⣼⠃⠀ ", - " ⠈⠓⠶⣶⣾⣿⣿⣿⣧⡀⠀⠈⠒⢤⣀⣀⡀⠀⠀⣀⣀⡠⠚⠁⠀⢀⡼⠃⠀⠀ ", - " ⠀⠀⠀⠈⢿⣿⣿⣿⣿⣿⣷⣤⣤⣤⣤⣭⣭⣭⣭⣭⣥⣤⣤⣤⣴⣟⠁ ", -} - -M[5] = { - " ▄▄▄▄▄▄▄▄▄ ", - " ▄█████████████▄ ", - " █████ █████████████████ █████ ", - " ▐████▌ ▀███▄ ▄███▀ ▐████▌ ", - " █████▄ ▀███▄ ▄███▀ ▄█████ ", - " ▐██▀███▄ ▀███▄███▀ ▄███▀██▌ ", - " ███▄▀███▄ ▀███▀ ▄███▀▄███ ", - " ▐█▄▀█▄▀███ ▄ ▀ ▄ ███▀▄█▀▄█▌ ", - " ███▄▀█▄██ ██▄██ ██▄█▀▄███ ", - " ▀███▄▀██ █████ ██▀▄███▀ ", - " █▄ ▀█████ █████ █████▀ ▄█ ", - " ███ ███ ███ ", - " ███▄ ▄█ ███ █▄ ▄███ ", - " █████ ▄███ ███ ███▄ █████ ", - " █████ ████ ███ ████ █████ ", - " █████ ████▄▄▄▄▄████ █████ ", - " ▀███ █████████████ ███▀ ", - " ▀█ ███ ▄▄▄▄▄ ███ █▀ ", - " ▀█▌▐█████▌▐█▀ ", - " ███████ ", -} - -M[6] = { - " ████ ████ ", - " ███ ███ ", - " ███ ███ ", - " ███ ███ ", - " ███ ███ ", - "████ ████ ", - "████ ████ ", - "██████ ███████ ██████ ", - "█████████████████████████████████ ", - " ███████████████████████████████ ", - " ████ ███████████████████ ████ ", - " ███▀███████████▀███ ", - " ████──▀███████▀──████ ", - " █████───█████───█████ ", - " ███████████████████ ", - " █████████████████ ", - " ███████████████ ", - " █████████████ ", - " ███████████ ", - " ███──▀▀▀──███ ", - " ███─█████─███ ", - " ███─███─███ ", - " █████████ ", -} - -M[7] = { - " ▄█ ", - " ▄██░█ ", - " ██ ██░░░░█ ", - " ██░░█ █░░░░░░█ ", - " ▄█░░░███░░░░░██ ", - " █░░░░█░░░░░░██████████▀ ", - " █░░░░▄▄▄▄▄░░░░░░░░░░█ ", - " ▀███████░▐░░░░░░░░░▌░░░░░█ ", - " ██░░░░▐░░▄██████████▄░█ ", - " █░░░░▌▄███████▀▀▀▀█▀█▀ ", - " ██░░▄▄████████░░░░▌░██ ", - " █▐██████▌███▌░░░░▐░░██ ", - " ██▌████▐██▐░░░░░▐░░░░██ ", - " █▐█▐▌█▀███▀▀░░░░░▐░░░░░██ ", - " █░░██▐█░░▄░░░▄█░░░▐░░░░░░██ ", - " █░░░▐▌█▌▀▀░░░█░█▌░░▐░░░░████ ", - " █░░░░▐▀▀░░░░▄█░░█▌░░▌░░███ ", - " ▄██░░░░░▌░░░▄██░▄██▌░▐░███ ", - " ██░░░▐░░▀█▄░▄███▌░▐░░█ ", - " ███░░█░░░██▀▀░█░░▌░░░█ ", - " █░░░▌░░▐█████░▐░░░░██ ", - " █░░░░░▀▄▄░░░░░█░░░░░░██ ", - " ██░░░░░░░░▀▄▄▄▀░░████████▄ ", - " █░█████░░░░░█░░░░█ ", - " ██ ██░░░░██░░░█ ", - " █ █░░░█ ███░░█ ", - " █░░░█ ██░█ ", - " █░░░█ ██ ", - " █░█ ", -} - -M[8] = { - " ▄▄██████████▄▄ ", - " ▀▀▀ ██ ▀▀▀ ", - " ▄██▄ ▄▄████████████▄▄ ▄██▄ ", - " ▄███▀ ▄████▀▀▀ ▀▀▀████▄ ▀███▄ ", - " ████▄ ▄███▀ ▀███▄ ▄████ ", - " ███▀█████▀▄████▄ ▄████▄▀█████▀███ ", - " ██▀ ███▀ ██████ ██████ ▀███ ▀██ ", - " ▀ ▄██▀ ▀████▀ ▄▄ ▀████▀ ▀██▄ ▀ ", - " ███ ▀▀ ███ ", - " ██████████████████████████████ ", - " ▄█ ▀██ ███ ██ ██ ███ ██▀ █▄ ", - " ███ ███ ███ ██ ██ ███▄███ ███ ", - " ▀██▄████████ ██ ██ ████████▄██▀ ", - " ▀███▀ ▀████ ██ ██ ████▀ ▀███▀ ", - " ▀███▄ ▀███████ ███████▀ ▄███▀ ", - " ▀███ ▀▀██████████▀▀▀ ███▀ ", - " ▀ ▄▄▄ ██ ▄▄▄ ▀ ", - " ▀████████████▀ ", -} - -M[9] = { - " ▄▄▀▀▀▀▀▀▀▀▄▄ ", - " ▄▀▀ ▀▄▄ ", - " ▄▀ ▀▄ ", - " ▌ ▀▄ ▀▀▄ ", - " ▌ ▀▌ ▌ ", - " ▐ ▌ ▐ ", - " ▌▐ ▐ ▐ ▌ ▌ ", - " ▐ ▌ ▌ ▐ ▌ ▐ ▌▐ ▐ ", - " ▐ ▌ ▌▄▄▀▀▌▌ ▐▀▌▀▌▄ ▐ ▌ ▌ ", - " ▌▌ ▐▀▄▌▌▐▐ ▐▐▐ ▐ ▌▌ ▐ ▌▄▐ ", - " ▄▀▄▐ ▌▌▄▀▄▐ ▌▌ ▐ ▌▄▀▄ ▐ ▐ ▌ ▀▄ ", - " ▀▄▀ ▌ ▄▀ ▌█▐ ▐▐▀ ▌█▐ ▀▄▐ ▌▌ ▀ ", - " ▀▀▄▄▐ ▀▄▀ ▀▄▀ ▀▄▀▄▀ ▌ ▐ ", - " ▀▐▀▄ ▀▄ ▐ ▀▌▐ ", - " ▌ ▌▐ ▀ ▐ ▐ ", - " ▐ ▐ ▌ ▄▄▀▀▀▀▄ ▌ ▐ ", - " ▌▐ ▐▄ ▐ ▌ ▄▀ ▐ ", - " ▐ ▌▐▐▀▄ ▀▄▄▄▀ ▄▀▐ ▐ ", - " ▌▌ ▌▐ ▌ ▀▄▄ ▄▌▐ ▌ ▐ ", - " ▐ ▐ ▐▐ ▌ ▀▀▄▀▌▐ ▌ ▌ ", - " ▌ ▌▐ ▌ ▐▀▄▌ ▐ ", -} - -M[10] = { - " ▀████▀▄▄ ▄█ ", - " █▀ ▀▀▄▄▄▄▄ ▄▄▀▀█ ", - " ▄ █ ▀▀▀▀▄ ▄▀ ", - " ▄▀ ▀▄ ▀▄ ▀▄▀ ", - " ▄▀ █ █▀ ▄█▀▄ ▄█ ", - " ▀▄ ▀▄ █ ▀██▀ ██▄█ ", - " ▀▄ ▄▀ █ ▄██▄ ▄ ▄ ▀▀ █ ", - " █ ▄▀ █ ▀██▀ ▀▀ ▀▀ ▄▀ ", - " █ █ █ ▄▄ ▄▀ ", -} - -M[11] = { - " ▄████████▄ ", - " ▄█▀▒▒▒▒▒▒▒▀██▄ ", - " ▄█▀▒▒▒▒▒▒▄▒▒▒▒▒▒▐█▌ ", - " ▄█▒▒▒▒▒▒▒▒▒▒▀█▒▒▒▄██ ", - " ▄█▒▒▒▒▒▒▒▒▒▒▒▒▒▒██▀▒▒▒█▄ ", - " ▄█▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒█▄ ", - " ▄█▒▒▒▄██████▄▒▒▒▒▄█████▄▒▒▒▒█ ", - " █▒▒▒█▀░░░░░▀█ ▒▒▒█▀░░░░▀█▒▒▒█ ", - " █▒▒▒█░░▄░░░░▀████▀░░░▄░░█▒▒▒█ ", - " ▄███▄▒█▄░▐▀▄░░░░░░░░░▄▀▌░▄█▒▒███▄", - " █▀░░█▄▒█░▐▐▀▀▄▄▄ ▄▄▄▀▀▌▌░█▒▒█░░▀█", - " █░░░░█▒█░▐▐ ▄▄ █ ▄▄ ▌▌░█▒█░░░░█", - " █░▄░░█▒█░▐▐▄ ▀▀ █ ▀▀ ▄▌▌░█▒█░░▄░█", - " █░░█░█▒█░░▌▄█▄▄▀ ▀▄▄█▄▐░░█▒█░█░░█", - " █▄░█████████▀░░▀▄▀░░▀█████████░▄█", - " ██▀░░▄▀░░▀░░▀▄░░░▄▀░░▀░░▀▄░░▀██ ", - " ██░░░░░░░░░░░░░░░░░░░░░░░░░░░░░██", - " █░▄░░░░░░░░░░░░░░░░░░░░░░░░░░░▄░█", - " █░▀█▄░░░░░░░░░░░░░░░░░░░░░░░▄█▀░█", - " █░░█▀███████████████████████▀█░░█", - " █░░█ █ █ █ █ █ █░░█", - " █░░░▀█▄▄█▄▄▄█▄▄▄█▄▄▄█▄▄▄█▄▄█▀░░░█", - " ▀█░░▀█▄█ █ █ █ █▄█▀░░░█▀ ", - " ▀█░░░▀▀█▄▄ █ █ █▄▄█▀▀░░░░█▀ ", - " ▀█░░░░░▀▀█████████▀▀░░░░░░█▀ ", - " ▀█░░░░░░░▄░░░░░░░▄░░░░░░█▀ ", - " ▀██▄░░░▀▀▀▀▀▀▀▀▀░░░▄██▀ ", - " ▀██▄▄░░░░░░░▄▄██▀ ", - " ▀▀███████▀▀ ", -} - -M[12] = { - " ⠀⠀⠀⠀⠀⠀⠀⠀⠀⣠⠤⠖⠚⢉⣩⣭⡭⠛⠓⠲⠦⣄⡀⠀⠀⠀⠀⠀⠀⠀ ", - " ⠀⠀⠀⠀⠀⠀⢀⡴⠋⠁⠀⠀⠊⠀⠀⠀⠀⠀⠀⠀⠀⠀⠉⠳⢦⡀⠀⠀⠀⠀ ", - " ⠀⠀⠀⠀⢀⡴⠃⢀⡴⢳⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠙⣆⠀⠀⠀ ", - " ⠀⠀⠀⠀⡾⠁⣠⠋⠀⠈⢧⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠈⢧⠀⠀ ", - " ⠀⠀⠀⣸⠁⢰⠃⠀⠀⠀⠈⢣⡀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠈⣇⠀ ", - " ⠀⠀⠀⡇⠀⡾⡀⠀⠀⠀⠀⣀⣹⣆⡀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢹⠀ ", - " ⠀⠀⢸⠃⢀⣇⡈⠀⠀⠀⠀⠀⠀⢀⡑⢄⡀⢀⡀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢸⡇ ", - " ⠀⠀⢸⠀⢻⡟⡻⢶⡆⠀⠀⠀⠀⡼⠟⡳⢿⣦⡑⢄⠀⠀⠀⠀⠀⠀⠀⠀⢸⡇ ", - " ⠀⠀⣸⠀⢸⠃⡇⢀⠇⠀⠀⠀⠀⠀⡼⠀⠀⠈⣿⡗⠂⠀⠀⠀⠀⠀⠀⠀⢸⠁ ", - " ⠀⠀⡏⠀⣼⠀⢳⠊⠀⠀⠀⠀⠀⠀⠱⣀⣀⠔⣸⠁⠀⠀⠀⠀⠀⠀⠀⢠⡟⠀ ", - " ⠀⠀⡇⢀⡇⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠠⠀⡇⠀⠀⠀⠀⠀⠀⠀⠀⢸⠃⠀ ", - " ⠀⢸⠃⠘⡇⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢸⠁⠀⠀⢀⠀⠀⠀⠀⠀⣾⠀⠀ ", - " ⠀⣸⠀⠀⠹⡄⠀⠀⠈⠁⠀⠀⠀⠀⠀⠀⠀⡞⠀⠀⠀⠸⠀⠀⠀⠀⠀⡇⠀⠀ ", - " ⠀⡏⠀⠀⠀⠙⣆⠀⠀⠀⠀⠀⠀⠀⢀⣠⢶⡇⠀⠀⢰⡀⠀⠀⠀⠀⠀⡇⠀⠀ ", - " ⢰⠇⡄⠀⠀⠀⡿⢣⣀⣀⣀⡤⠴⡞⠉⠀⢸⠀⠀⠀⣿⡇⠀⠀⠀⠀⠀⣧⠀⠀ ", - " ⣸⠀⡇⠀⠀⠀⠀⠀⠀⠉⠀⠀⠀⢹⠀⠀⢸⠀⠀⢀⣿⠇⠀⠀⠀⠁⠀⢸⠀⠀ ", - " ⣿⠀⡇⠀⠀⠀⠀⠀⢀⡤⠤⠶⠶⠾⠤⠄⢸⠀⡀⠸⣿⣀⠀⠀⠀⠀⠀⠈⣇⠀ ", - " ⡇⠀⡇⠀⠀⡀⠀⡴⠋⠀⠀⠀⠀⠀⠀⠀⠸⡌⣵⡀⢳⡇⠀⠀⠀⠀⠀⠀⢹⡀ ", - " ⡇⠀⠇⠀⠀⡇⡸⠁⠀⠀⠀⠀⠀⠀⠀⠀⠀⠙⠮⢧⣀⣻⢂⠀⠀⠀⠀⠀⠀⢧ ", - " ⣇⠀⢠⠀⠀⢳⠇⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠈⡎⣆⠀⠀⠀⠀⠀⠘ ", -} - -M[13] = { - "⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢀⡀⠀⠀⠀⠀⢀⡀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀ ", - "⠀⠀⠀⠀⠀⠀⠀⠀⠀⣠⡖⠁⠀⠀⠀⠀⠀⠀⠈⢲⣄⠀⠀⠀⠀⠀⠀⠀⠀⠀ ", - "⠀⠀⠀⠀⠀⠀⠀⠀⣼⡏⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢹⣧⠀⠀⠀⠀⠀⠀⠀⠀ ", - "⠀⠀⠀⠀⠀⠀⠀⣸⣿⠁⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠈⣿⣇⠀⠀⠀⠀⠀⠀⠀ ", - "⠀⠀⠀⠀⠀⠀⠀⣿⣿⡇⠀⢀⣀⣤⣤⣤⣤⣀⡀⠀⢸⣿⣿⠀⠀⠀⠀⠀⠀⠀ ", - "⠀⠀⠀⠀⠀⠀⠀⢻⣿⣿⣔⢿⡿⠟⠛⠛⠻⢿⡿⣢⣿⣿⡟⠀⠀⠀⠀⠀⠀⠀ ", - "⠀⠀⠀⠀⣀⣤⣶⣾⣿⣿⣿⣷⣤⣀⡀⢀⣀⣤⣾⣿⣿⣿⣷⣶⣤⡀⠀⠀⠀⠀ ", - "⠀⠀⢠⣾⣿⡿⠿⠿⠿⣿⣿⣿⣿⡿⠏⠻⢿⣿⣿⣿⣿⠿⠿⠿⢿⣿⣷⡀⠀⠀ ", - "⠀⢠⡿⠋⠁⠀⠀⢸⣿⡇⠉⠻⣿⠇⠀⠀⠸⣿⡿⠋⢰⣿⡇⠀⠀⠈⠙⢿⡄⠀ ", - "⠀⡿⠁⠀⠀⠀⠀⠘⣿⣷⡀⠀⠰⣿⣶⣶⣿⡎⠀⢀⣾⣿⠇⠀⠀⠀⠀⠈⢿⠀ ", - "⠀⡇⠀⠀⠀⠀⠀⠀⠹⣿⣷⣄⠀⣿⣿⣿⣿⠀⣠⣾⣿⠏⠀⠀⠀⠀⠀⠀⢸⠀ ", - "⠀⠁⠀⠀⠀⠀⠀⠀⠀⠈⠻⢿⢇⣿⣿⣿⣿⡸⣿⠟⠁⠀⠀⠀⠀⠀⠀⠀⠈⠀ ", - "⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢀⣼⣿⣿⣿⣿⣧⡀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀ ", - "⠀⠀⠀⠐⢤⣀⣀⢀⣀⣠⣴⣿⣿⠿⠋⠙⠿⣿⣿⣦⣄⣀⠀⠀⣀⡠⠂⠀⠀⠀ ", - "⠀⠀⠀⠀⠀⠈⠉⠛⠛⠛⠛⠉⠀⠀⠀⠀⠀⠈⠉⠛⠛⠛⠛⠋⠁⠀⠀⠀⠀⠀ ", -} - -M[14] = { - "", - "⠀⠀⠀⠀⠀⠀⠀⠀⠀⢀⣀⣠⣤⣤⣴⣦⣤⣤⣄⣀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀ ", - "⠀⠀⠀⠀⠀⠀⢀⣤⣾⣿⣿⣿⣿⠿⠿⠿⠿⣿⣿⣿⣿⣶⣤⡀⠀⠀⠀⠀⠀⠀ ", - "⠀⠀⠀⠀⣠⣾⣿⣿⡿⠛⠉⠀⠀⠀⠀⠀⠀⠀⠀⠉⠛⢿⣿⣿⣶⡀⠀⠀⠀⠀ ", - "⠀⠀⠀⣴⣿⣿⠟⠁⠀⠀⠀⣶⣶⣶⣶⡆⠀⠀⠀⠀⠀⠀⠈⠻⣿⣿⣦⠀⠀⠀ ", - "⠀⠀⣼⣿⣿⠋⠀⠀⠀⠀⠀⠛⠛⢻⣿⣿⡀⠀⠀⠀⠀⠀⠀⠀⠙⣿⣿⣧⠀⠀ ", - "⠀⢸⣿⣿⠃⠀⠀⠀⠀⠀⠀⠀⠀⢀⣿⣿⣷⠀⠀⠀⠀⠀⠀⠀⠀⠸⣿⣿⡇⠀ ", - "⠀⣿⣿⡿⠀⠀⠀⠀⠀⠀⠀⠀⢀⣾⣿⣿⣿⣇⠀⠀⠀⠀⠀⠀⠀⠀⣿⣿⣿⠀ ", - "⠀⣿⣿⡇⠀⠀⠀⠀⠀⠀⠀⢠⣿⣿⡟⢹⣿⣿⡆⠀⠀⠀⠀⠀⠀⠀⣹⣿⣿⠀ ", - "⠀⣿⣿⣷⠀⠀⠀⠀⠀⠀⣰⣿⣿⠏⠀⠀⢻⣿⣿⡄⠀⠀⠀⠀⠀⠀⣿⣿⡿⠀ ", - "⠀⢸⣿⣿⡆⠀⠀⠀⠀⣴⣿⡿⠃⠀⠀⠀⠈⢿⣿⣷⣤⣤⡆⠀⠀⣰⣿⣿⠇⠀ ", - "⠀⠀⢻⣿⣿⣄⠀⠀⠾⠿⠿⠁⠀⠀⠀⠀⠀⠘⣿⣿⡿⠿⠛⠀⣰⣿⣿⡟⠀⠀ ", - "⠀⠀⠀⠻⣿⣿⣧⣄⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣠⣾⣿⣿⠏⠀⠀⠀ ", - "⠀⠀⠀⠀⠈⠻⣿⣿⣷⣤⣄⡀⠀⠀⠀⠀⠀⠀⢀⣠⣴⣾⣿⣿⠟⠁⠀⠀⠀⠀ ", - "⠀⠀⠀⠀⠀⠀⠈⠛⠿⣿⣿⣿⣿⣿⣶⣶⣿⣿⣿⣿⣿⠿⠋⠁⠀⠀⠀⠀⠀⠀ ", - "⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠉⠉⠛⠛⠛⠛⠛⠛⠉⠉⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀ ", -} - -M[15] = { - " ⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢀⡴⣪⣭⣿⣷⣶⣄⠀⠀⠀⠀⠀⠀⠀⠀ ", - " ⠀⠀⠀⠀⠀⠀⠀⠀⠀⢀⣀⠤⢤⢔⡾⣹⣿⣿⣿⣿⣿⣿⣷⡄⠀⠀⠀⠀⠀⠀ ", - " ⠀⠀⠀⠀⠀⠀⠀⠀⠀⠁⠀⢰⢳⣿⣿⣿⠋⣻⣿⣿⣿⣿⣿⣿⣾⣿⠟⠀⠀⠀ ", - " ⠀⠀⠀⠀⠀⢀⠔⠁⠀⠀⠀⢸⣼⣷⣻⣧⣴⣿⣏⣿⣿⣿⣿⣿⣿⣿⣶⣶⣦⠤ ", - " ⠀⠀⠀⠀⢠⠇⠀⠀⠀⠀⠀⠈⢿⣿⣷⣿⣏⡿⣿⣿⣿⣿⣿⣿⣿⡿⠿⠛⠁⠀ ", - " ⠀⠀⠀⢀⠇⠀⠀⠀⠀⠀⠀⠀⠀⠹⢿⣿⣿⣿⣝⣿⣯⣾⠋⣇⠀⠀⠀⠀⠀⠀ ", - " ⠀⠀⢠⠀⠀⠀⠀⠀⠀⠀⠀⠀⢠⡄⠀⠀⠙⣽⣝⠋⢡⣯⣀⠘⢦⡀⠀⠀⠀⠀ ", - " ⠀⠀⡷⡁⠀⡄⠀⢠⠻⠀⠀⠀⢸⠙⠀⠀⠀⠙⡇⢹⣧⠛⠂⠀⢤⣉⠢⡀⠀⠀ ", - " ⡠⢊⠚⢇⣰⢣⠀⡞⠒⠣⠀⠀⠘⡄⠘⠓⠲⢆⣳⠀⠀⣠⣄⣀⣀⠙⢯⣾⡄⠀ ", - " ⣇⣇⡌⠈⡜⡌⢳⣧⣤⣄⡑⠄⣀⣳⢀⣠⣤⣴⣾⡆⠀⣿⠖⣠⣮⠀⠀⣿⠇⠀ ", - " ⠈⠛⢇⠀⠿⠷⡘⣿⢙⠿⡏⠀⠈⠉⢻⣻⣿⡏⢹⡟⣢⣿⣟⡻⠋⢀⡴⠁⠀⠀ ", - " ⠀⠀⠈⠢⢤⣀⣋⡿⢮⡉⠁⠀⠀⠀⠈⢉⣙⠷⠛⠺⣿⣙⣛⠭⠝⠋⠀⠀⠀⠀ ", - " ⠀⠀⠀⠀⠀⠀⠀⠀⠀⠈⡩⠒⠶⠲⠞⠓⢦⡀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀ ", - " ⠀⠀⠀⠀⠀⠀⠀⠀⠀⣰⣵⣕⣉⣫⣿⣦⠀⠱⡀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀ ", - " ⠀⠀⠀⠀⠀⠀⠀⠀⢠⣿⡾⡿⡟⣻⣿⡏⠱⣮⣿⣦⡀⠀⠀⠀⠀⠀⠀⠀⠀⠀ ", - " ⠀⠀⠀⠀⠀⠀⠀⣰⢿⡛⣿⣾⣜⣾⣿⣿⣿⣿⣿⣿⣿⣆⠀⠀⠀⠀⠀⠀⠀⠀ ", - " ⠀⠀⠀⠀⢀⣴⣿⣾⣿⣿⣿⣿⣿⣿⣾⡏⣿⣿⣿⣿⣿⣿⣆⠀⠀⠀⠀⠀⠀⠀ ", - " ⠀⠀⠀⠀⢀⣵⣿⣿⣿⣿⣿⣿⣿⡿⣿⣿⣿⣿⣿⣯⣿⣿⠟⠃⠀⠀⠀⠀⠀⠀ ", - " ⠀⠀⠀⠀⠀⠀⠈⢻⣿⣿⣶⣿⣿⣿⣿⣿⣿⣿⣿⠿⠿⠟⠀⠀⠀⠀⠀⠀⠀⠀ ", - " ⠀⠀⠀⠀⠀⠀⠀⠈⠻⠿⠿⣿⣿⣿⣿⣿⣿⡿⠃⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀ ", - " ⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠘⣿⣽⣿⠇⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀ ", -} - -M[16] = { - "", - " ████▌█████▌█ ████████▐▀██▀ ", - " ▄█████ █████▌ █ ▀██████▌█▄▄▀▄ ", - " ▌███▌█ ▐███▌▌ ▄▄ ▌█▌███▐███ ▀ ", - " ▐ ▐██ ▄▄▐▀█ ▐▄█▀▌█▐███▐█ ", - " ███ ▌▄█▌ ▀ ▀██ ▀██████▌ ", - " ▀█▌▀██▀ ▄ ███▐███ ", - " ██▌ ▐███████▌ ", - " ███ ▀█▀ ▐██▐███▀▌ ", - " ▌█▌█▄ ▄▄████▀ ▀ ", - " █▀██▄▄▄ ▄▄▀▀▒█▀█ ", - "", -} - -M[17] = { - "", - "", - " ⢀⣴⡾⠃⠄⠄⠄⠄⠄⠈⠺⠟⠛⠛⠛⠛⠻⢿⣿⣿⣿⣿⣶⣤⡀ ", - " ⢀⣴⣿⡿⠁⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⣸⣿⣿⣿⣿⣿⣿⣿⣷ ", - " ⣴⣿⡿⡟⡼⢹⣷⢲⡶⣖⣾⣶⢄⠄⠄⠄⠄⠄⢀⣼⣿⢿⣿⣿⣿⣿⣿⣿⣿ ", - " ⣾⣿⡟⣾⡸⢠⡿⢳⡿⠍⣼⣿⢏⣿⣷⢄⡀⠄⢠⣾⢻⣿⣸⣿⣿⣿⣿⣿⣿⣿ ", - " ⣡⣿⣿⡟⡼⡁⠁⣰⠂⡾⠉⢨⣿⠃⣿⡿⠍⣾⣟⢤⣿⢇⣿⢇⣿⣿⢿⣿⣿⣿⣿⣿ ", - " ⣱⣿⣿⡟⡐⣰⣧⡷⣿⣴⣧⣤⣼⣯⢸⡿⠁⣰⠟⢀⣼⠏⣲⠏⢸⣿⡟⣿⣿⣿⣿⣿⣿ ", - " ⣿⣿⡟⠁⠄⠟⣁⠄⢡⣿⣿⣿⣿⣿⣿⣦⣼⢟⢀⡼⠃⡹⠃⡀⢸⡿⢸⣿⣿⣿⣿⣿⡟ ", - " ⣿⣿⠃⠄⢀⣾⠋⠓⢰⣿⣿⣿⣿⣿⣿⠿⣿⣿⣾⣅⢔⣕⡇⡇⡼⢁⣿⣿⣿⣿⣿⣿⢣ ", - " ⣿⡟⠄⠄⣾⣇⠷⣢⣿⣿⣿⣿⣿⣿⣿⣭⣀⡈⠙⢿⣿⣿⡇⡧⢁⣾⣿⣿⣿⣿⣿⢏⣾ ", - " ⣿⡇⠄⣼⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⠟⢻⠇⠄⠄⢿⣿⡇⢡⣾⣿⣿⣿⣿⣿⣏⣼⣿ ", - " ⣿⣷⢰⣿⣿⣾⣿⣿⣿⣿⣿⣿⣿⣿⣿⢰⣧⣀⡄⢀⠘⡿⣰⣿⣿⣿⣿⣿⣿⠟⣼⣿⣿ ", - " ⢹⣿⢸⣿⣿⠟⠻⢿⣿⣿⣿⣿⣿⣿⣿⣶⣭⣉⣤⣿⢈⣼⣿⣿⣿⣿⣿⣿⠏⣾⣹⣿⣿ ", - " ⢸⠇⡜⣿⡟⠄⠄⠄⠈⠙⣿⣿⣿⣿⣿⣿⣿⣿⠟⣱⣻⣿⣿⣿⣿⣿⠟⠁⢳⠃⣿⣿⣿ ", - " ⣰⡗⠹⣿⣄⠄⠄⠄⢀⣿⣿⣿⣿⣿⣿⠟⣅⣥⣿⣿⣿⣿⠿⠋ ⣾⡌⢠⣿⡿⠃ ", - " ⠜⠋⢠⣷⢻⣿⣿⣶⣾⣿⣿⣿⣿⠿⣛⣥⣾⣿⠿⠟⠛⠉ ", - "", - "", -} - -M[18] = { - "", - " ⣿⡇⣿⣿⣿⠛⠁⣴⣿⡿⠿⠧⠹⠿⠘⣿⣿⣿⡇⢸⡻⣿⣿⣿⣿⣿⣿⣿ ", - " ⢹⡇⣿⣿⣿⠄⣞⣯⣷⣾⣿⣿⣧⡹⡆⡀⠉⢹⡌⠐⢿⣿⣿⣿⡞⣿⣿⣿ ", - " ⣾⡇⣿⣿⡇⣾⣿⣿⣿⣿⣿⣿⣿⣿⣄⢻⣦⡀⠁⢸⡌⠻⣿⣿⣿⡽⣿⣿ ", - " ⡇⣿⠹⣿⡇⡟⠛⣉⠁⠉⠉⠻⡿⣿⣿⣿⣿⣿⣦⣄⡉⠂⠈⠙⢿⣿⣝⣿ ", - " ⠤⢿⡄⠹⣧⣷⣸⡇⠄⠄⠲⢰⣌⣾⣿⣿⣿⣿⣿⣿⣶⣤⣤⡀⠄⠈⠻⢮ ", - " ⣧⠄⢘⢻⣿⡇⢀⣀⠄⣸⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣧⡀⠄⢀ ", - " ⣿⡆⢸⣿⣿⣿⣬⣭⣴⣿⣿⣿⣿⣿⣿⣿⣯⠝⠛⠛⠙⢿⡿⠃⠄⢸ ", - " ⢿⣿⡀⣿⣿⣿⣾⣿⣿⣿⣿⣿⣿⣿⣿⣿⣷⣿⣿⣿⣿⡾⠁⢠⡇⢀ ", - " ⢸⣿⡇⠻⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣏⣫⣻⡟⢀⠄⣿⣷⣾ ", - " ⢸⣿⡇⠄⠈⠙⠿⣿⣿⣿⣮⣿⣿⣿⣿⣿⣿⣿⣿⡿⢠⠊⢀⡇⣿⣿ ", - " ⣿⡇⢀⡲⠄⠄⠈⠙⠻⢿⣿⣿⠿⠿⠟⠛⠋⠁⣰⠇ ⢸⣿⣿⣿ ", - " ⣿⡇⢬⡻⡇⡄⠄⠄⠄⡰⢖⠔⠉⠄⠄⠄⠄⣼⠏ ⢸⣿⣿⣿ ", - " ⣿⡇⠄⠙⢌⢷⣆⡀⡾⡣⠃⠄⠄⠄⠄⠄⣼⡟ ⢿⣿⣿ ", - "", -} - -M[19] = { - "", - " ⢰⣧⣼⣯⠄⣸⣠⣶⣶⣦⣾⠄⠄⠄⠄⡀⠄⢀⣿⣿⠄⠄⠄⢸⡇⠄⠄ ", - " ⣾⣿⠿⠿⠶⠿⢿⣿⣿⣿⣿⣦⣤⣄⢀⡅⢠⣾⣛⡉⠄⠄⠄⠸⢀⣿⠄ ", - " ⢀⡋⣡⣴⣶⣶⡀⠄⠄⠙⢿⣿⣿⣿⣿⣿⣴⣿⣿⣿⢃⣤⣄⣀⣥⣿⣿⠄ ", - " ⢸⣇⠻⣿⣿⣿⣧⣀⢀⣠⡌⢻⣿⣿⣿⣿⣿⣿⣿⣿⣿⠿⠿⠿⣿⣿⣿⠄ ", - " ⢀⢸⣿⣷⣤⣤⣤⣬⣙⣛⢿⣿⣿⣿⣿⣿⣿⡿⣿⣿⡍⠄⠄⢀⣤⣄⠉⠋⣰ ", - " ⣼⣖⣿⣿⣿⣿⣿⣿⣿⣿⣿⢿⣿⣿⣿⣿⣿⢇⣿⣿⡷⠶⠶⢿⣿⣿⠇⢀⣤ ", - " ⠘⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣽⣿⣿⣿⡇⣿⣿⣿⣿⣿⣿⣷⣶⣥⣴⣿⡗ ", - " ⢀⠈⢿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⡟ ", - " ⢸⣿⣦⣌⣛⣻⣿⣿⣧⠙⠛⠛⡭⠅⠒⠦⠭⣭⡻⣿⣿⣿⣿⣿⣿⣿⣿⡿⠃ ", - " ⠘⣿⣿⣿⣿⣿⣿⣿⣿⡆⠄⠄⠄⠄⠄⠄⠄⠄⠹⠈⢋⣽⣿⣿⣿⣿⣵⣾⠃ ", - " ⠘⣿⣿⣿⣿⣿⣿⣿⣿⠄⣴⣿⣶⣄⠄⣴⣶⠄⢀⣾⣿⣿⣿⣿⣿⣿⠃ ", - " ⠈⠻⣿⣿⣿⣿⣿⣿⡄⢻⣿⣿⣿⠄⣿⣿⡀⣾⣿⣿⣿⣿⣛⠛⠁ ", - " ⠈⠛⢿⣿⣿⣿⠁⠞⢿⣿⣿⡄⢿⣿⡇⣸⣿⣿⠿⠛⠁ ", - " ⠉⠻⣿⣿⣾⣦⡙⠻⣷⣾⣿⠃⠿⠋⠁ ⢀⣠⣴ ", - " ⣿⣿⣿⣶⣶⣮⣥⣒⠲⢮⣝⡿⣿⣿⡆⣿⡿⠃⠄⠄⠄⠄⠄⠄⠄⣠⣴⣿⣿⣿ ", - "", -} - -M[20] = { - "", - " ⣿⢸⣿⣿⣿⣿⣿⢹⣿⣿⣿⣿⣿⢿⣿⡇⡇⣿⣿⡇⢹⣿⣿⣿⣿⣿⣿⠄⢸⣿ ", - " ⡟⢸⣿⣿⣭⣭⡭⣼⣶⣿⣿⣿⣿⢸⣧⣇⠇⢸⣿⣿⠈⣿⣿⣿⣿⣿⣿⡆⠘⣿ ", - " ⡇⢸⣿⣿⣿⣿⡇⣻⡿⣿⣿⡟⣿⢸⣿⣿⠇⡆⣝⠿⡌⣸⣿⣿⣿⣿⣿⡇⠄⣿ ", - " ⢣⢾⣾⣷⣾⣽⣻⣿⣇⣿⣿⣧⣿⢸⣿⣿⡆⢸⣹⣿⣆⢥⢛⡿⣿⣿⣿⡇⠄⣿ ", - " ⣛⡓⣉⠉⠙⠻⢿⣿⣿⣟⣻⠿⣹⡏⣿⣿⣧⢸⣧⣿⣿⣨⡟⣿⣿⣿⣿⡇⠄⣿ ", - " ⠸⣷⣹⣿⠄⠄⠄⠄⠘⢿⣿⣿⣯⣳⣿⣭⣽⢼⣿⣜⣿⣇⣷⡹⣿⣿⣿⠁⢰⣿ ", - " ⢻⣷⣿⡄⢈⠿⠇⢸⣿⣿⣿⣿⣿⣿⣟⠛⠲⢯⣿⣒⡾⣼⣷⡹⣿⣿⠄⣼⣿ ", - " ⡄⢸⣿⣿⣷⣬⣽⣯⣾⣿⣿⣿⣿⣿⣿⣿⣿⡀⠄⢀⠉⠙⠛⠛⠳⠽⠿⢠⣿⣿ ", - " ⡇⣼⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣷⢄⣹⡿⠃⠄⠄⣰⠎⡈⣾⣿⣿ ", - " ⡇⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣾⣭⣽⣖⣄⣴⣯⣾⢷⣿⣿⣿ ", - " ⣧⠸⣿⣿⣿⣿⣿⣿⠯⠊⠙⢻⢿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣏⣾⣿⣿⣿ ", - " ⣿⣦⠹⣿⣿⣿⣿⣿⠄⢀⣴⢾⣼⣻⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⡟⣾⣿⣿⣿⣿ ", - " ⣿⣿⣇⢽⣿⣿⣿⡏⣿⣿⣿⣿⣿⡇⣿⣿⣿⣿⡿⣿⣛⣻⠿⣟⣼⣿⣿⣿⣿⢃ ", - " ⣿⣿⣿⡎⣷⣽⠻⣇⣿⣿⣿⡿⣟⣵⣿⣟⣽⣾⣿⣿⣿⣿⢯⣾⣿⣿⣿⠟⠱⡟ ", - " ⣿⣿⣿⣿⢹⣿⣿⢮⣚⡛⠒⠛⢛⣋⣶⣿⣿⣿⣿⣿⣟⣱⠿⣿⣿⠟⣡⣺⢿ ", - "", -} - -M[21] = { - "", - " ⣇⣿⠘⣿⣿⣿⡿⡿⣟⣟⢟⢟⢝⠵⡝⣿⡿⢂⣼⣿⣷⣌⠩⡫⡻⣝⠹⢿⣿⣷ ", - " ⡆⣿⣆⠱⣝⡵⣝⢅⠙⣿⢕⢕⢕⢕⢝⣥⢒⠅⣿⣿⣿⡿⣳⣌⠪⡪⣡⢑⢝⣇ ", - " ⡆⣿⣿⣦⠹⣳⣳⣕⢅⠈⢗⢕⢕⢕⢕⢕⢈⢆⠟⠋⠉⠁⠉⠉⠁⠈⠼⢐⢕⢽ ", - " ⡗⢰⣶⣶⣦⣝⢝⢕⢕⠅⡆⢕⢕⢕⢕⢕⣴⠏⣠⡶⠛⡉⡉⡛⢶⣦⡀⠐⣕⢕ ", - " ⡝⡄⢻⢟⣿⣿⣷⣕⣕⣅⣿⣔⣕⣵⣵⣿⣿⢠⣿⢠⣮⡈⣌⠨⠅⠹⣷⡀⢱⢕ ", - " ⡝⡵⠟⠈⢀⣀⣀⡀⠉⢿⣿⣿⣿⣿⣿⣿⣿⣼⣿⢈⡋⠴⢿⡟⣡⡇⣿⡇⡀⢕ ", - " ⡝⠁⣠⣾⠟⡉⡉⡉⠻⣦⣻⣿⣿⣿⣿⣿⣿⣿⣿⣧⠸⣿⣦⣥⣿⡇⡿⣰⢗⢄ ", - " ⠁⢰⣿⡏⣴⣌⠈⣌⠡⠈⢻⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣬⣉⣉⣁⣄⢖⢕⢕⢕ ", - " ⡀⢻⣿⡇⢙⠁⠴⢿⡟⣡⡆⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣷⣵⣵⣿ ", - " ⡻⣄⣻⣿⣌⠘⢿⣷⣥⣿⠇⣿⣿⣿⣿⣿⣿⠛⠻⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿ ", - " ⣷⢄⠻⣿⣟⠿⠦⠍⠉⣡⣾⣿⣿⣿⣿⣿⣿⢸⣿⣦⠙⣿⣿⣿⣿⣿⣿⣿⣿⠟ ", - " ⡕⡑⣑⣈⣻⢗⢟⢞⢝⣻⣿⣿⣿⣿⣿⣿⣿⠸⣿⠿⠃⣿⣿⣿⣿⣿⣿⡿⠁⣠ ", - " ⡝⡵⡈⢟⢕⢕⢕⢕⣵⣿⣿⣿⣿⣿⣿⣿⣿⣿⣶⣶⣿⣿⣿⣿⣿⠿⠋⣀⣈⠙ ", - " ⡝⡵⡕⡀⠑⠳⠿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⠿⠛⢉⡠⡲⡫⡪⡪⡣ ", - "", -} - -M[22] = { - "", - " ⣿⣿⣷⡁⢆⠈⠕⢕⢂⢕⢂⢕⢂⢔⢂⢕⢄⠂⣂⠂⠆⢂⢕⢂⢕⢂⢕⢂⢕⢂ ", - " ⣿⣿⣿⡷⠊⡢⡹⣦⡑⢂⢕⢂⢕⢂⢕⢂⠕⠔⠌⠝⠛⠶⠶⢶⣦⣄⢂⢕⢂⢕ ", - " ⣿⣿⠏⣠⣾⣦⡐⢌⢿⣷⣦⣅⡑⠕⠡⠐⢿⠿⣛⠟⠛⠛⠛⠛⠡⢷⡈⢂⢕⢂ ", - " ⠟⣡⣾⣿⣿⣿⣿⣦⣑⠝⢿⣿⣿⣿⣿⣿⡵⢁⣤⣶⣶⣿⢿⢿⢿⡟⢻⣤⢑⢂ ", - " ⣾⣿⣿⡿⢟⣛⣻⣿⣿⣿⣦⣬⣙⣻⣿⣿⣷⣿⣿⢟⢝⢕⢕⢕⢕⢽⣿⣿⣷⣔ ", - " ⣿⣿⠵⠚⠉⢀⣀⣀⣈⣿⣿⣿⣿⣿⣿⣿⣿⣿⣗⢕⢕⢕⢕⢕⢕⣽⣿⣿⣿⣿ ", - " ⢷⣂⣠⣴⣾⡿⡿⡻⡻⣿⣿⣴⣿⣿⣿⣿⣿⣿⣷⣵⣵⣵⣷⣿⣿⣿⣿⣿⣿⡿ ", - " ⢌⠻⣿⡿⡫⡪⡪⡪⡪⣺⣿⣿⣿⣿⣿⠿⠿⢿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⠃ ", - " ⠣⡁⠹⡪⡪⡪⡪⣪⣾⣿⣿⣿⣿⠋⠐⢉⢍⢄⢌⠻⣿⣿⣿⣿⣿⣿⣿⣿⠏⠈ ", - " ⡣⡘⢄⠙⣾⣾⣾⣿⣿⣿⣿⣿⣿⡀⢐⢕⢕⢕⢕⢕⡘⣿⣿⣿⣿⣿⣿⠏⠠⠈ ", - " ⠌⢊⢂⢣⠹⣿⣿⣿⣿⣿⣿⣿⣿⣧⢐⢕⢕⢕⢕⢕⢅⣿⣿⣿⣿⡿⢋⢜⠠⠈ ", - " ⠄⠁⠕⢝⡢⠈⠻⣿⣿⣿⣿⣿⣿⣿⣷⣕⣑⣑⣑⣵⣿⣿⣿⡿⢋⢔⢕⣿⠠⠈ ", - " ⠨⡂⡀⢑⢕⡅⠂⠄⠉⠛⠻⠿⢿⣿⣿⣿⣿⣿⣿⣿⣿⡿⢋⢔⢕⢕⣿⣿⠠⠈ ", - " ⠄⠪⣂⠁⢕⠆⠄⠂⠄⠁⡀⠂⡀⠄⢈⠉⢍⢛⢛⢛⢋⢔⢕⢕⢕⣽⣿⣿⠠⠈ ", - "", -} - -M[23] = { - "", - "⠀⠀⠀⠀⠀⠀⠀⡀⠀⠀⣀⣀⣀⡀⠀⢀⡀⠀⢀⣀⣀⣀⠀⡀⠀⠀⠀⠀⠀⠀", - "⠀⠀⠀⠀⠀⣠⣎⣀⣀⣠⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣶⡄⠀⠀⠀⠀", - "⠀⠀⠀⠀⣰⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣆⠀⠀⠀", - "⠀⠀⠀⢰⣿⣿⣿⣿⣿⣿⣿⣿⣿⡿⡿⠏⠿⠿⠿⠿⠿⣿⣿⣿⣿⣿⣿⡆⠀⠀", - "⠀⠀⠀⣿⣿⣿⣿⣿⣿⡿⢿⠋⠉⠀⠀⠀⠀⠀⡀⠀⠀⠘⢿⣿⣿⣿⣿⣧⠀⠀", - "⠀⠀⢰⣿⣿⣿⣿⠟⢁⠀⠀⠀⠀⠀⠀⠀⠀⠀⠇⠀⠀⡈⠀⠻⣿⣿⣿⣿⠀⠀", - "⠀⠀⣼⣿⣿⡿⠁⠀⢸⠀⠈⢳⣶⣤⣄⠀⠈⠀⠁⠀⠀⠀⢀⠀⠹⣿⣿⡟⠀⠀", - "⠀⠀⣿⣿⣿⠀⠀⠈⣼⡇⠀⠘⠻⠟⠁⠀⠀⠀⠀⢤⣀⡀⠌⠀⠀⣿⣿⠃⠀⠀", - "⠀⠀⣿⣿⣿⡀⠀⠀⡏⡇⠀⠀⠀⠀⠀⠀⠀⠀⠀⠸⣿⡿⠋⢰⢠⣿⡏⠀⠀⠀", - "⠀⠀⣿⣿⣿⡇⠀⠀⢷⡃⠀⠀⢀⡀⠀⠀⠀⠀⠀⠀⠀⠀⣴⣯⣾⡟⠀⠀⠀⠀", - "⠀⠀⣿⣿⣿⡿⠀⠀⣼⣿⡄⠀⠈⠀⢑⠶⠀⠀⠀⠀⢀⣾⣿⣿⣿⡇⠀⠀⠀⠀", - "⠀⠀⣿⣿⣿⠁⠀⠀⣿⣿⠁⠀⠀⠀⢀⣀⣠⣤⣤⣴⠟⣿⣿⣿⣿⡇⠀⠀⠀⠀", - "⠀⠀⠙⢿⠃⠀⠀⢸⣿⣟⠀⠀⢀⣤⣾⣿⣿⣿⠟⠁⢰⣿⣿⣿⣿⠃⠀⠀⠀⠀", - "⠀⠀⠠⠴⠀⠀⠀⠿⠿⠿⠧⠾⠿⠿⠿⠿⠿⠃⠀⠀⠾⠿⠿⠟⠁⠀ ", - "", -} - -M[24] = { - "", - "⣿⣯⣿⣟⣟⡼⣿⡼⡿⣷⣿⣿⣿⠽⡟⢋⣿⣿⠘⣼⣷⡟⠻⡿⣷⡼⣝⡿⡾⣿", - "⣿⣿⣿⣿⢁⣵⡇⡟⠀⣿⣿⣿⠇⠀⡇⣴⣿⣿⣧⣿⣿⡇⠀⢣⣿⣷⣀⡏⢻⣿", - "⣿⣿⠿⣿⣿⣿⠷⠁⠀⠛⠛⠋⠀⠂⠹⠿⠿⠿⠿⠿⠉⠁⠀⠘⠛⠛⠛⠃⢸⣯", - "⣿⡇⠀⣄⣀⣀⣈⣁⠈⠉⠃⠀⠀⠀⠀⠀⠀⠀⠀⠠⠎⠈⠀⣀⣁⣀⣀⡠⠈⠉", - "⣿⣯⣽⡿⢟⡿⠿⠛⠛⠿⣶⣄⠀⠀⠀⠀⠀⠀⠈⢠⣴⣾⠛⠛⠿⠻⠛⠿⣷⣶", - "⣿⣿⣿⠀⠀⠀⣿⡿⣶⣿⣫⠉⠀⠀⠀⠀⠀⠀⠀⠈⠰⣿⠿⠾⣿⡇⠀⠀⢺⣿", - "⣿⣿⠻⡀⠀⠀⠙⠏⠒⡻⠃⠀⠀⠀⠀⣀⠀⠀⠀⠀⠀⠐⡓⢚⠟⠁⠀⠀⡾⢫", - "⣿⣿⠀⠀⡀⠀⠀⡈⣉⡀⡠⣐⣅⣽⣺⣿⣯⡡⣴⣴⣔⣠⣀⣀⡀⢀⡀⡀⠀⣸", - "⣿⣿⣷⣿⣟⣿⡿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⢻⢾⣷⣿", - "⣿⣿⣟⠫⡾⠟⠫⢾⠯⡻⢟⡽⢶⢿⣿⣿⡛⠕⠎⠻⠝⠪⢖⠝⠟⢫⠾⠜⢿⣿", - "⣿⣿⣿⠉⠀⠀⠀⠀⠈⠀⠀⠀⠀⣰⣋⣀⣈⣢⠀⠀⠀⠀⠀⠀⠀⠀⠀⣐⢸⣿", - "⣿⣿⣿⣆⠀⠀⠀⠀⠀⠀⠀⠀⢰⣿⣿⣿⣿⣿⣧⠀⠀⠀⠀⠀⠀⠀⠀⢀⣾⣿", - "⣿⣿⣿⣿⣦⡔⠀⠀⠀⠀⠀⠀⢻⣿⡿⣿⣿⢽⣿⠀⠀⠀⠀⠀⠀⠀⣠⣾⣿⣿", - "⣿⣿⣿⣿⣿⣿⣶⣤⣀⠀⠀⠀⠘⠛⢅⣙⣙⠿⠉⠀⠀⠀⢀⣠⣴⣿⣿⣿⣿⣿", - "⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣶⣤⣄⣅⠀⠓⠀⠀⣀⣠⣴⣺⣿⣿⣿⣿⣿⣿⣿⣿", - "", -} - -M[25] = { - "", - " ⡿⠉⠄⠄⠄⠄⠈⠙⠿⠟⠛⠉⠉⠉⠄⠄⠄⠈⠉⠉⠉⠛⠛⠻⢿⣿⣿⣿⣿⣿ ", - " ⠁⠄⠄⠄⢀⡴⣋⣵⣮⠇⡀⠄⠄⠄⠄⠄⠄⢀⠄⠄⠄⡀⠄⠄⠄⠈⠛⠿⠋⠉ ", - " ⠄⠄⠄⢠⣯⣾⣿⡿⣳⡟⣰⣿⣠⣂⡀⢀⠄⢸⡄⠄⢀⣈⢆⣱⣤⡀⢄⠄⠄⠄ ", - " ⠄⠄⠄⣼⣿⣿⡟⣹⡿⣸⣿⢳⣿⣿⣿⣿⣴⣾⢻⣆⣿⣿⣯⢿⣿⣿⣷⣧⣀⣤ ", - " ⠄⠄⣼⡟⣿⠏⢀⣿⣇⣿⣏⣿⣿⣿⣿⣿⣿⣿⢸⡇⣿⣿⣿⣟⣿⣿⣿⣿⣏⠋ ", - " ⡆⣸⡟⣼⣯⠏⣾⣿⢸⣿⢸⣿⣿⣿⣿⣿⣿⡟⠸⠁⢹⡿⣿⣿⢻⣿⣿⣿⣿⠄ ", - " ⡇⡟⣸⢟⣫⡅⣶⢆⡶⡆⣿⣿⣿⣿⣿⢿⣛⠃⠰⠆⠈⠁⠈⠙⠈⠻⣿⢹⡏⠄ ", - " ⣧⣱⡷⣱⠿⠟⠛⠼⣇⠇⣿⣿⣿⣿⣿⣿⠃⣰⣿⣿⡆⠄⠄⠄⠄⠄⠉⠈⠄⠄ ", - " ⡏⡟⢑⠃⡠⠂⠄⠄⠈⣾⢻⣿⣿⡿⡹⡳⠋⠉⠁⠉⠙⠄⢀⠄⠄⠄⠄⠄⠂⠄ ", - " ⡇⠁⢈⢰⡇⠄⠄⡙⠂⣿⣿⣿⣿⣱⣿⡗⠄⠄⠄⢀⡀⠄⠈⢰⠄⠄⠄⠐⠄⠄ ", - " ⠄⠄⠘⣿⣧⠴⣄⣡⢄⣿⣿⣿⣷⣿⣿⡇⢀⠄⠤⠈⠁⣠⣠⣸⢠⠄⠄⠄⠄⠄ ", - " ⢀⠄⠄⣿⣿⣷⣬⣵⣿⣿⣿⣿⣿⣿⣿⣷⣟⢷⡶⢗⡰⣿⣿⠇⠘⠄⠄⠄⠄⠄ ", - " ⣿⠄⠄⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣷⣶⣾⣿⣿⡟⢀⠃⠄⢸⡄⠁⣸ ", - " ⣿⠄⠄⠘⢿⣿⣿⣿⣿⣿⣿⢛⣿⣿⣿⣿⣿⣿⣿⣿⣿⣟⢄⡆⠄⢀⣪⡆⠄⣿ ", - " ⡟⠄⠄⠄⠄⣾⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⡿⢿⣟⣻⣩⣾⣃⣴⣿⣿⡇⠸⢾ ", - "", -} - -M[26] = { - "", - "⡆⣐⢕⢕⢕⢕⢕⢕⢕⢕⠅⢗⢕⢕⢕⢕⢕⢕⢕⠕⠕⢕⢕⢕⢕⢕⢕⢕⢕⢕", - "⢐⢕⢕⢕⢕⢕⣕⢕⢕⠕⠁⢕⢕⢕⢕⢕⢕⢕⢕⠅⡄⢕⢕⢕⢕⢕⢕⢕⢕⢕", - "⢕⢕⢕⢕⢕⠅⢗⢕⠕⣠⠄⣗⢕⢕⠕⢕⢕⢕⠕⢠⣿⠐⢕⢕⢕⠑⢕⢕⠵⢕", - "⢕⢕⢕⢕⠁⢜⠕⢁⣴⣿⡇⢓⢕⢵⢐⢕⢕⠕⢁⣾⢿⣧⠑⢕⢕⠄⢑⢕⠅⢕", - "⢕⢕⠵⢁⠔⢁⣤⣤⣶⣶⣶⡐⣕⢽⠐⢕⠕⣡⣾⣶⣶⣶⣤⡁⢓⢕⠄⢑⢅⢑", - "⠍⣧⠄⣶⣾⣿⣿⣿⣿⣿⣿⣷⣔⢕⢄⢡⣾⣿⣿⣿⣿⣿⣿⣿⣦⡑⢕⢤⠱⢐", - "⢠⢕⠅⣾⣿⠋⢿⣿⣿⣿⠉⣿⣿⣷⣦⣶⣽⣿⣿⠈⣿⣿⣿⣿⠏⢹⣷⣷⡅⢐", - "⣔⢕⢥⢻⣿⡀⠈⠛⠛⠁⢠⣿⣿⣿⣿⣿⣿⣿⣿⡀⠈⠛⠛⠁⠄⣼⣿⣿⡇⢔", - "⢕⢕⢽⢸⢟⢟⢖⢖⢤⣶⡟⢻⣿⡿⠻⣿⣿⡟⢀⣿⣦⢤⢤⢔⢞⢿⢿⣿⠁⢕", - "⢕⢕⠅⣐⢕⢕⢕⢕⢕⣿⣿⡄⠛⢀⣦⠈⠛⢁⣼⣿⢗⢕⢕⢕⢕⢕⢕⡏⣘⢕", - "⢕⢕⠅⢓⣕⣕⣕⣕⣵⣿⣿⣿⣾⣿⣿⣿⣿⣿⣿⣿⣷⣕⢕⢕⢕⢕⡵⢀⢕⢕", - "⢑⢕⠃⡈⢿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⢃⢕⢕⢕", - "⣆⢕⠄⢱⣄⠛⢿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⠿⢁⢕⢕⠕⢁", - "⣿⣦⡀⣿⣿⣷⣶⣬⣍⣛⣛⣛⡛⠿⠿⠿⠛⠛⢛⣛⣉⣭⣤⣂⢜⠕⢑⣡⣴⣿", - "", -} - -M[27] = { - "", - "⡿⠋⠄⣀⣀⣤⣴⣶⣾⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣦⣌⠻⣿⣿", - "⣴⣾⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣦⠹⣿", - "⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣧⠹", - "⣿⣿⡟⢹⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⡛⢿⣿⣿⣿⣮⠛⣿⣿⣿⣿⣿⣿⡆", - "⡟⢻⡇⢸⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣣⠄⡀⢬⣭⣻⣷⡌⢿⣿⣿⣿⣿⣿", - "⠃⣸⡀⠈⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣧⠈⣆⢹⣿⣿⣿⡈⢿⣿⣿⣿⣿", - "⠄⢻⡇⠄⢛⣛⣻⣿⣿⣿⣿⣿⣿⣿⣿⡆⠹⣿⣆⠸⣆⠙⠛⠛⠃⠘⣿⣿⣿⣿", - "⠄⠸⣡⠄⡈⣿⣿⣿⣿⣿⣿⣿⣿⠿⠟⠁⣠⣉⣤⣴⣿⣿⠿⠿⠿⡇⢸⣿⣿⣿", - "⠄⡄⢿⣆⠰⡘⢿⣿⠿⢛⣉⣥⣴⣶⣿⣿⣿⣿⣻⠟⣉⣤⣶⣶⣾⣿⡄⣿⡿⢸", - "⠄⢰⠸⣿⠄⢳⣠⣤⣾⣿⣿⣿⣿⣿⣿⣿⣿⣿⣧⣼⣿⣿⣿⣿⣿⣿⡇⢻⡇⢸", - "⢷⡈⢣⣡⣶⠿⠟⠛⠓⣚⣻⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣇⢸⠇⠘", - "⡀⣌⠄⠻⣧⣴⣾⣿⣿⣿⣿⣿⣿⣿⣿⡿⠟⠛⠛⠛⢿⣿⣿⣿⣿⣿⡟⠘⠄⠄", - "⣷⡘⣷⡀⠘⣿⣿⣿⣿⣿⣿⣿⣿⡋⢀⣠⣤⣶⣶⣾⡆⣿⣿⣿⠟⠁⠄⠄⠄⠄", - "⣿⣷⡘⣿⡀⢻⣿⣿⣿⣿⣿⣿⣿⣧⠸⣿⣿⣿⣿⣿⣷⡿⠟⠉⠄⠄⠄⠄⡄⢀", - "⣿⣿⣷⡈⢷⡀⠙⠛⠻⠿⠿⠿⠿⠿⠷⠾⠿⠟⣛⣋⣥⣶⣄⠄⢀⣄⠹⣦⢹⣿", - "", -} - -M[28] = { - "", - "⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⡿⣿⡿⠿⢿⣿⣿⣿⣿⣿⣿", - "⣿⣿⣿⣿⣿⣿⣿⣿⣿⡿⠿⠛⠛⠉⠉⠉⠙⠻⣅⠀⠈⢧⠀⠈⠛⠉⠉⢻⣿⣿", - "⣿⣿⣿⣿⣿⣿⠿⠋⠀⠀⠀⠀⠀⠀⠀⠀⣤⡶⠟⠀⠀⣈⠓⢤⣶⡶⠿⠛⠻⣿", - "⣿⣿⣿⣿⣿⢣⠂⠀⠀⠀⠀⠀⠀⠀⠀⠀⢿⣀⣴⠶⠿⠿⢷⡄⠀⠀⢀⣤⣾⣿", - "⣿⣿⣿⣿⣡⠁⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠸⣦⣤⣤⡀⠀⢷⡀⠀⠀⣻⣿⣿", - "⣿⣿⣿⣿⠇⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⡈⠛⠶⠛⠃⠈⠈⢿⣿⣿", - "⣿⣿⠟⠘⠀⠀⠀⠀⠀⠀⠀⠀⢀⡆⠀⠀⠀⠀⠀⠀⣧⠀⠀⠀⠀⠀⠀⠈⣿⣿", - "⣿⠏⠀⠁⠀⠀⠀⠀⠀⠀⠀⢀⣶⡄⠀⠀⠀⠀⠀⠀⣡⣄⣿⡆⠀⠀⠀⠀⣿⣿", - "⡏⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠚⠛⠛⢛⣲⣶⣿⣷⣉⠉⢉⣥⡄⠀⠀⠀⠨⣿⣿", - "⡇⢠⡆⠀⠀⢰⠀⠀⠀⠀⢸⣿⣧⣠⣿⣿⣿⣿⣿⣿⣷⣾⣿⡅⠀⠀⡄⠠⢸⣿", - "⣧⠸⣇⠀⠀⠘⣤⡀⠀⠀⠘⣿⣿⣿⣿⣿⠟⠛⠻⣿⣿⣿⡿⢁⠀⠀⢰⠀⢸⣿", - "⣿⣷⣽⣦⠀⠀⠙⢷⡀⠀⠀⠙⠻⠿⢿⣷⣾⣿⣶⠾⢟⣥⣾⣿⣧⠀⠂⢀⣿⣿", - "⣿⣿⣿⣿⣷⣆⣠⣤⣤⣤⣀⣀⡀⠀⠒⢻⣶⣾⣿⣿⣿⣿⣿⣿⣿⢀⣀⣾⣿⣿", - "", -} - -M[29] = { - "", - "⣿⣿⣿⣿⣯⣿⣿⠄⢠⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⡟⠈⣿⣿⣿⣿⣿⣿⣆⠄", - "⢻⣿⣿⣿⣾⣿⢿⣢⣞⣿⣿⣿⣿⣷⣶⣿⣯⣟⣿⢿⡇⢃⢻⣿⣿⣿⣿⣿⢿⡄", - "⠄⢿⣿⣯⣏⣿⣿⣿⡟⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣷⣧⣾⢿⣮⣿⣿⣿⣿⣾⣷", - "⠄⣈⣽⢾⣿⣿⣿⣟⣄⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣷⣝⣯⢿⣿⣿⣿⣿", - "⣿⠟⣫⢸⣿⢿⣿⣾⣿⢿⣿⣿⢻⣿⣿⣿⢿⣿⣿⣿⢸⣿⣼⣿⣿⣿⣿⣿⣿⣿", - "⡟⢸⣟⢸⣿⠸⣷⣝⢻⠘⣿⣿⢸⢿⣿⣿⠄⣿⣿⣿⡆⢿⣿⣼⣿⣿⣿⣿⢹⣿", - "⡇⣿⡿⣿⣿⢟⠛⠛⠿⡢⢻⣿⣾⣞⣿⡏⠖⢸⣿⢣⣷⡸⣇⣿⣿⣿⢼⡿⣿⣿", - "⣡⢿⡷⣿⣿⣾⣿⣷⣶⣮⣄⣿⣏⣸⣻⣃⠭⠄⠛⠙⠛⠳⠋⣿⣿⣇⠙⣿⢸⣿", - "⠫⣿⣧⣿⣿⣿⣿⣿⣿⣿⣿⣿⠻⣿⣾⣿⣿⣿⣿⣿⣿⣿⣷⣿⣿⣹⢷⣿⡼⠋", - " ⠸⣿⣿⣿⣿⣿⣿⣿⣿⣿⣷⣦⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⡟⣿⣿⣿ ", - " ⢻⢹⣿⠸⣿⣿⣿⣿⣿⣷⣿⣿⣿⣿⣿⣿⣿⣿⣿⡿⣼⣿⣿⣿⣿⡟ ", - " ⠈⢸⣿ ⠙⢿⣿⣿⣹⣿⣿⣿⣿⣟⡃⣽⣿⣿⡟⠁⣿⣿⢻⣿⣿⢿ ", - " ⠘⣿⡄ ⠙⢿⣿⣿⣾⣿⣷⣿⣿⣿⠟⠁ ⣿⣿⣾⣿⡟⣿ ", - " ⢻⡇⠸⣆ ⠈⠻⣿⡿⠿⠛⠉ ⢸⣿⣇⣿⣿⢿⣿ ", - "", -} - -M[30] = { - "", - "⣿⠟⣽⣿⣿⣿⣿⣿⢣⠟⠋⡜⠄⢸⣿⣿⡟⣬⢁⠠⠁⣤⠄⢰⠄⠇⢻⢸", - "⢏⣾⣿⣿⣿⠿⣟⢁⡴⡀⡜⣠⣶⢸⣿⣿⢃⡇⠂⢁⣶⣦⣅⠈⠇⠄⢸⢸", - "⣹⣿⣿⣿⡗⣾⡟⡜⣵⠃⣴⣿⣿⢸⣿⣿⢸⠘⢰⣿⣿⣿⣿⡀⢱⠄⠨⢸", - "⣿⣿⣿⣿⡇⣿⢁⣾⣿⣾⣿⣿⣿⣿⣸⣿⡎⠐⠒⠚⠛⠛⠿⢧⠄⠄⢠⣼", - "⣿⣿⣿⣿⠃⠿⢸⡿⠭⠭⢽⣿⣿⣿⢂⣿⠃⣤⠄⠄⠄⠄⠄⠄⠄⠄⣿⡾", - "⣼⠏⣿⡏⠄⠄⢠⣤⣶⣶⣾⣿⣿⣟⣾⣾⣼⣿⠒⠄⠄⠄⡠⣴⡄⢠⣿⣵", - "⣳⠄⣿⠄⠄⢣⠸⣹⣿⡟⣻⣿⣿⣿⣿⣿⣿⡿⡻⡖⠦⢤⣔⣯⡅⣼⡿⣹", - "⡿⣼⢸⠄⠄⣷⣷⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣕⡜⡌⡝⡸⠙⣼⠟⢱⠏", - "⡇⣿⣧⡰⡄⣿⣿⣿⣿⡿⠿⠿⠿⣿⣿⣿⣿⣿⣿⣿⣿⣷⣋⣪⣥⢠⠏⠄", - "⣧⢻⣿⣷⣧⢻⣿⣿⣿⡇⠄⢀⣀⣀⡙⣿⣿⣿⣿⣿⣿⣿⣿⣿⡇⠂⠄⠄", - "⢹⣼⣿⣿⣿⣧⡻⣿⣿⣇⣴⣿⣿⣿⣷⢸⣿⣿⣿⣿⣿⣿⣿⣿⣰⠄⠄⠄", - "⣼⡟⡟⣿⢸⣿⣿⣝⢿⣿⣾⣿⣿⣿⢟⣾⣿⣿⣿⣿⣿⣿⣿⣿⠟⠄⡀⡀", - "⣿⢰⣿⢹⢸⣿⣿⣿⣷⣝⢿⣿⣿⣿⣿⣿⣿⣿⣿⡿⠿⠛⠉⠄⠄⣸⢰⡇", - "⣿⣾⣹⣏⢸⣿⣿⣿⣿⣿⣷⣍⡻⣛⣛⣛⡉⠁⠄⠄⠄⠄⠄⠄⢀⢇⡏⠄", - "", -} - -M[31] = { - "", - "⢰⡟⣡⡟⣱⣿⡿⠡⢛⣋⣥⣴⣌⢿⣿⣿⣿⣿⣷⣌⠻⢿⣿⣿⣿⣿⣿⣿", - "⠏⢼⡿⣰⡿⠿⠡⠿⠿⢯⣉⠿⣿⣿⣿⣿⣿⣿⣷⣶⣿⣦⣍⠻⢿⣿⣿⣿", - "⣼⣷⢠⠀⠀⢠⣴⡖⠀⠀⠈⠻⣿⡿⣿⣿⣿⣿⣿⣛⣯⣝⣻⣿⣶⣿⣿⣿", - "⣿⡇⣿⡷⠂⠈⡉⠀⠀⠀⣠⣴⣾⣿⣿⣿⣿⣿⣍⡤⣤⣤⣤⡀⠀⠉⠛⠿", - "⣿⢸⣿⡅⣠⣬⣥⣤⣴⣴⣿⣿⢿⣿⣿⣿⣿⣿⣟⡭⡄⣀⣉⡀⠀⠀⠀⠀", - "⡟⣿⣿⢰⣿⣿⣿⣿⣿⣿⣿⣿⣾⣿⣿⣿⣿⣿⣿⣿⣶⣦⣈⠀⠀⠀⢀⣶", - "⡧⣿⡇⣼⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣶⣶⣾⣿", - "⡇⣿⠃⣿⣿⣿⣿⣿⠛⠛⢫⣿⣿⣻⣻⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⢿⣿", - "⡇⣿⠘⡇⢻⣿⣿⣿⡆⠀⠀⠀⠀⠈⠉⠙⠻⠏⠛⠻⣿⣿⣿⣿⣿⣭⡾⢁", - "⡇⣿⠀⠘⢿⣿⣿⣿⣧⢠⣤⠀⡤⢀⣠⣀⣀⠀⠀⣼⣿⣿⣿⣿⣿⠟⣁⠉", - "⣧⢻⠀⡄⠀⠹⣿⣿⣿⡸⣿⣾⡆⣿⣿⣿⠿⣡⣾⣿⣿⣿⣿⡿⠋⠐⢡⣶", - "⣿⡘⠈⣷⠀⠀⠈⠻⣿⣷⣎⠐⠿⢟⣋⣤⣾⣿⣿⣿⡿⠟⣩⠖⢠⡬⠈⠀", - "⣿⣧⠁⢻⡇⠀⠀⠀⠈⠻⣿⣿⣿⣿⣿⣿⠿⠟⠋⠁⢀⠈⢀⡴⠈⠁⠀⠀", - "⠻⣿⣆⠘⣿⠀⠀ ⠀⠈⠙⠛⠋⠉⠀⠀⠀⠀⡀⠤⠚⠁ ", - "", -} - -M[32] = { - "", - " ⣴⣶⣤⡤⠦⣤⣀⣤⠆ ⣈⣭⣭⣿⣶⣿⣦⣼⣆ ", - " ⠉⠻⢿⣿⠿⣿⣿⣶⣦⠤⠄⡠⢾⣿⣿⡿⠋⠉⠉⠻⣿⣿⡛⣦ ", - " ⠈⢿⣿⣟⠦ ⣾⣿⣿⣷⠄⠄⠄⠄⠻⠿⢿⣿⣧⣄ ", - " ⣸⣿⣿⢧ ⢻⠻⣿⣿⣷⣄⣀⠄⠢⣀⡀⠈⠙⠿⠄ ", - " ⢠⣿⣿⣿⠈ ⠡⠌⣻⣿⣿⣿⣿⣿⣿⣿⣛⣳⣤⣀⣀ ", - " ⢠⣧⣶⣥⡤⢄ ⣸⣿⣿⠘⠄ ⢀⣴⣿⣿⡿⠛⣿⣿⣧⠈⢿⠿⠟⠛⠻⠿⠄ ", - " ⣰⣿⣿⠛⠻⣿⣿⡦⢹⣿⣷ ⢊⣿⣿⡏ ⢸⣿⣿⡇ ⢀⣠⣄⣾⠄ ", - " ⣠⣿⠿⠛⠄⢀⣿⣿⣷⠘⢿⣿⣦⡀ ⢸⢿⣿⣿⣄ ⣸⣿⣿⡇⣪⣿⡿⠿⣿⣷⡄ ", - " ⠙⠃ ⣼⣿⡟ ⠈⠻⣿⣿⣦⣌⡇⠻⣿⣿⣷⣿⣿⣿ ⣿⣿⡇⠄⠛⠻⢷⣄ ", - " ⢻⣿⣿⣄ ⠈⠻⣿⣿⣿⣷⣿⣿⣿⣿⣿⡟ ⠫⢿⣿⡆ ", - " ⠻⣿⣿⣿⣿⣶⣶⣾⣿⣿⣿⣿⣿⣿⣿⣿⡟⢀⣀⣤⣾⡿⠃ ", - " ⢰⣶ ⣶ ⢶⣆⢀⣶⠂⣶⡶⠶⣦⡄⢰⣶⠶⢶⣦ ⣴⣶ ", - " ⢸⣿⠶⠶⣿ ⠈⢻⣿⠁ ⣿⡇ ⢸⣿⢸⣿⢶⣾⠏ ⣸⣟⣹⣧ ", - " ⠸⠿ ⠿ ⠸⠿ ⠿⠷⠶⠿⠃⠸⠿⠄⠙⠷⠤⠿⠉⠉⠿⠆ ", - "", -} - -M[33] = { - " ███╗ ██╗ ███████╗ ██████╗ ██╗ ██╗ ██╗ ███╗ ███╗", - " ████╗ ██║ ██╔════╝██╔═══██╗ ██║ ██║ ██║ ████╗ ████║", - " ██╔██╗ ██║ █████╗ ██║ ██║ ██║ ██║ ██║ ██╔████╔██║", - " ██║╚██╗██║ ██╔══╝ ██║ ██║ ╚██╗ ██╔╝ ██║ ██║╚██╔╝██║", - " ██║ ╚████║ ███████╗╚██████╔╝ ╚████╔╝ ██║ ██║ ╚═╝ ██║", - " ╚═╝ ╚═══╝ ╚══════╝ ╚═════╝ ╚═══╝ ╚═╝ ╚═╝ ╚═╝", -} - -M[34] = { - "", - "███╗ ██╗██╗ ██╗██╗███╗ ███╗ ██╗██████╗ ███████╗", - "████╗ ██║██║ ██║██║████╗ ████║ ██║██╔══██╗██╔════╝", - "██╔██╗ ██║██║ ██║██║██╔████╔██║ ██║██║ ██║█████╗ ", - "██║╚██╗██║╚██╗ ██╔╝██║██║╚██╔╝██║ ██║██║ ██║██╔══╝ ", - "██║ ╚████║ ╚████╔╝ ██║██║ ╚═╝ ██║ ██║██████╔╝███████╗", - "╚═╝ ╚═══╝ ╚═══╝ ╚═╝╚═╝ ╚═╝ ╚═╝╚═════╝ ╚══════╝", -} -return M diff --git a/lua/kide/plugins/config/comment.lua b/lua/kide/plugins/config/comment.lua deleted file mode 100644 index bd47faf7..00000000 --- a/lua/kide/plugins/config/comment.lua +++ /dev/null @@ -1 +0,0 @@ -require("Comment").setup() diff --git a/lua/kide/plugins/config/diffview-nvim.lua b/lua/kide/plugins/config/diffview-nvim.lua deleted file mode 100644 index 23f0d163..00000000 --- a/lua/kide/plugins/config/diffview-nvim.lua +++ /dev/null @@ -1 +0,0 @@ -require("diffview").setup({}) diff --git a/lua/kide/plugins/config/markdown-preview.lua b/lua/kide/plugins/config/markdown-preview.lua deleted file mode 100644 index 3c8ce8bf..00000000 --- a/lua/kide/plugins/config/markdown-preview.lua +++ /dev/null @@ -1 +0,0 @@ -vim.g.mkdp_page_title = "${name}" diff --git a/lua/kide/plugins/config/mason-nvim.lua b/lua/kide/plugins/config/mason-nvim.lua deleted file mode 100644 index ac266614..00000000 --- a/lua/kide/plugins/config/mason-nvim.lua +++ /dev/null @@ -1 +0,0 @@ -require("mason").setup() diff --git a/lua/kide/plugins/config/neogen.lua b/lua/kide/plugins/config/neogen.lua deleted file mode 100644 index 9a41f6c6..00000000 --- a/lua/kide/plugins/config/neogen.lua +++ /dev/null @@ -1,6 +0,0 @@ -require("neogen").setup({ - snippet_engine = "luasnip", - enabled = true, --if you want to disable Neogen - input_after_comment = true, -- (default: true) automatic jump (with insert mode) on inserted annotation - -- jump_map = "" -- (DROPPED SUPPORT, see [here](#cycle-between-annotations) !) The keymap in order to jump in the annotation fields (in insert mode) -}) diff --git a/lua/kide/plugins/config/nvim-autopairs.lua b/lua/kide/plugins/config/nvim-autopairs.lua deleted file mode 100644 index bdc3eaf3..00000000 --- a/lua/kide/plugins/config/nvim-autopairs.lua +++ /dev/null @@ -1,5 +0,0 @@ -local autopairs = require("nvim-autopairs") -local cmp_autopairs = require("nvim-autopairs.completion.cmp") -autopairs.setup({}) -local cmp = require("cmp") -cmp.event:on("confirm_done", cmp_autopairs.on_confirm_done()) diff --git a/lua/kide/plugins/config/nvim-colorizer.lua b/lua/kide/plugins/config/nvim-colorizer.lua deleted file mode 100644 index 577b1cdf..00000000 --- a/lua/kide/plugins/config/nvim-colorizer.lua +++ /dev/null @@ -1,27 +0,0 @@ -require("colorizer").setup({ - filetypes = { "*" }, - user_default_options = { - RGB = true, -- #RGB hex codes - RRGGBB = true, -- #RRGGBB hex codes - names = false, -- "Name" codes like Blue or blue - RRGGBBAA = false, -- #RRGGBBAA hex codes - AARRGGBB = false, -- 0xAARRGGBB hex codes - rgb_fn = false, -- CSS rgb() and rgba() functions - hsl_fn = false, -- CSS hsl() and hsla() functions - css = false, -- Enable all CSS features: rgb_fn, hsl_fn, names, RGB, RRGGBB - css_fn = false, -- Enable all CSS *functions*: rgb_fn, hsl_fn - -- Available modes for `mode`: foreground, background, virtualtext - mode = "background", -- Set the display mode. - -- Available methods are false / true / "normal" / "lsp" / "both" - -- True is same as normal - tailwind = false, -- Enable tailwind colors - -- parsers can contain values used in |user_default_options| - sass = { enable = false, parsers = { "css" } }, -- Enable sass colors - virtualtext = "■", - -- update color values even if buffer is not focused - -- example use: cmp_menu, cmp_docs - always_update = false, - }, - -- all the sub-options of filetypes apply to buftypes - buftypes = {}, -}) diff --git a/lua/kide/plugins/config/nvim-notify.lua b/lua/kide/plugins/config/nvim-notify.lua deleted file mode 100644 index c99cfd56..00000000 --- a/lua/kide/plugins/config/nvim-notify.lua +++ /dev/null @@ -1,35 +0,0 @@ -local notify = require("notify") -notify.setup({ - -- Animation style (see below for details) - stages = "fade_in_slide_out", - - -- Function called when a new window is opened, use for changing win settings/config - on_open = nil, - - -- Function called when a window is closed - on_close = nil, - - -- Render function for notifications. See notify-render() - render = "default", - - -- Default timeout for notifications - timeout = 3000, - - -- For stages that change opacity this is treated as the highlight behind the window - -- Set this to either a highlight group, an RGB hex value e.g. "#000000" or a function returning an RGB code for dynamic values - background_colour = "#000000", - - -- Minimum width for notification windows - minimum_width = 50, - - -- Icons for the different levels - icons = { - ERROR = "", - WARN = "", - INFO = "", - DEBUG = "", - TRACE = "✎", - }, -}) - -vim.notify = notify diff --git a/lua/kide/plugins/config/rest-nvim.lua b/lua/kide/plugins/config/rest-nvim.lua deleted file mode 100644 index 8efe3902..00000000 --- a/lua/kide/plugins/config/rest-nvim.lua +++ /dev/null @@ -1,22 +0,0 @@ -require("rest-nvim").setup({ - -- Open request results in a horizontal split - result_split_horizontal = false, - -- Skip SSL verification, useful for unknown certificates - skip_ssl_verification = false, - -- Highlight request on run - highlight = { - enabled = true, - timeout = 150, - }, - result = { - -- toggle showing URL, HTTP info, headers at top the of result window - show_url = true, - show_http_info = true, - show_headers = true, - }, - -- Jump to request line on run - jump_to_request = false, - env_file = ".env", - custom_dynamic_variables = {}, - yank_dry_run = true, -}) diff --git a/lua/kide/plugins/config/toggletasks.lua b/lua/kide/plugins/config/toggletasks.lua deleted file mode 100644 index edfeaa8a..00000000 --- a/lua/kide/plugins/config/toggletasks.lua +++ /dev/null @@ -1,13 +0,0 @@ -require("toggletasks").setup({ - search_paths = { - ".tasks", - ".toggletasks", - ".nvim/toggletasks", - ".nvim/tasks", - }, - toggleterm = { - close_on_exit = true, - }, -}) - -require("telescope").load_extension("toggletasks") diff --git a/lua/kide/plugins/config/translate.lua b/lua/kide/plugins/config/translate.lua deleted file mode 100644 index 45445f61..00000000 --- a/lua/kide/plugins/config/translate.lua +++ /dev/null @@ -1,12 +0,0 @@ -require("translate").setup({ - default = { - command = "translate_shell", - }, - preset = { - output = { - split = { - append = true, - }, - }, - }, -}) diff --git a/lua/kide/plugins/config/wilder.lua b/lua/kide/plugins/config/wilder.lua deleted file mode 100644 index fecc8475..00000000 --- a/lua/kide/plugins/config/wilder.lua +++ /dev/null @@ -1,39 +0,0 @@ -local wilder = require("wilder") -wilder.setup({ - modes = { ":", "/", "?" }, - next_key = "", - previous_key = "", - accept_key = "", - reject_key = "", -}) -local popupmenu_renderer = wilder.popupmenu_renderer(wilder.popupmenu_border_theme({ - highlighter = wilder.basic_highlighter(), - highlights = { - bg = "NormalFloat", - border = "NormalFloat", -- highlight to use for the border - }, - pumblend = 20, - -- 'single', 'double', 'rounded' or 'solid' - -- can also be a list of 8 characters, see :h wilder#popupmenu_border_theme() for more details - border = "rounded", - left = { " ", wilder.popupmenu_devicons() }, - right = { " ", wilder.popupmenu_scrollbar() }, -})) - -local wildmenu_renderer = wilder.wildmenu_renderer({ - highlighter = wilder.basic_highlighter(), - highlights = { - bg = "NormalFloat", - border = "NormalFloat", -- highlight to use for the border - }, - separator = " · ", - left = { " ", wilder.wildmenu_spinner(), " " }, - right = { " ", wilder.wildmenu_index() }, -}) -wilder.set_option( - "renderer", - wilder.renderer_mux({ - [":"] = popupmenu_renderer, - ["/"] = wildmenu_renderer, - }) -) diff --git a/lua/kide/plugins/lazy-nvim.lua b/lua/kide/plugins/lazy-nvim.lua index 45b3e7ca..399719c9 100644 --- a/lua/kide/plugins/lazy-nvim.lua +++ b/lua/kide/plugins/lazy-nvim.lua @@ -16,7 +16,7 @@ require("lazy").setup({ lazy = true, event = { "VeryLazy" }, config = function() - require("kide.plugins.config.mason-nvim") + require("mason").setup() end, }, { @@ -174,6 +174,7 @@ require("lazy").setup({ { "akinsho/bufferline.nvim", version = "*", + event = { "UIEnter" }, dependencies = { "nvim-tree/nvim-web-devicons" }, config = function() require("kide.plugins.config.bufferline") @@ -414,7 +415,7 @@ require("lazy").setup({ "DiffviewToggleFiles", }, config = function() - require("kide.plugins.config.diffview-nvim") + require("diffview").setup({}) end, }, { @@ -461,7 +462,19 @@ require("lazy").setup({ lazy = true, dependencies = { "akinsho/toggleterm.nvim" }, config = function() - require("kide.plugins.config.toggletasks") + require("toggletasks").setup({ + search_paths = { + ".tasks", + ".toggletasks", + ".nvim/toggletasks", + ".nvim/tasks", + }, + toggleterm = { + close_on_exit = true, + }, + }) + + require("telescope").load_extension("toggletasks") end, }, @@ -477,6 +490,8 @@ require("lazy").setup({ -- 状态栏插件 { "nvim-lualine/lualine.nvim", + lazy = true, + event = { "UIEnter" }, config = function() require("kide.plugins.config.lualine") end, @@ -510,17 +525,24 @@ require("lazy").setup({ { "rcarriga/nvim-notify", config = function() - require("kide.plugins.config.nvim-notify") - end, - }, + local notify = require("notify") + notify.setup({ + stages = "fade_in_slide_out", + on_open = nil, + on_close = nil, + render = "default", + timeout = 3000, + minimum_width = 50, + icons = { + ERROR = "", + WARN = "", + INFO = "", + DEBUG = "", + TRACE = "✎", + }, + }) - -- wildmenu 补全美化 - { - "gelguy/wilder.nvim", - enabled = false, - keys = { ":", "/", "?" }, - config = function() - require("kide.plugins.config.wilder") + vim.notify = notify end, }, @@ -529,7 +551,33 @@ require("lazy").setup({ "NvChad/nvim-colorizer.lua", event = { "BufReadPost", "InsertEnter", "VeryLazy" }, config = function() - require("kide.plugins.config.nvim-colorizer") + require("colorizer").setup({ + filetypes = { "*" }, + user_default_options = { + RGB = true, -- #RGB hex codes + RRGGBB = true, -- #RRGGBB hex codes + names = false, -- "Name" codes like Blue or blue + RRGGBBAA = false, -- #RRGGBBAA hex codes + AARRGGBB = false, -- 0xAARRGGBB hex codes + rgb_fn = false, -- CSS rgb() and rgba() functions + hsl_fn = false, -- CSS hsl() and hsla() functions + css = false, -- Enable all CSS features: rgb_fn, hsl_fn, names, RGB, RRGGBB + css_fn = false, -- Enable all CSS *functions*: rgb_fn, hsl_fn + -- Available modes for `mode`: foreground, background, virtualtext + mode = "background", -- Set the display mode. + -- Available methods are false / true / "normal" / "lsp" / "both" + -- True is same as normal + tailwind = false, -- Enable tailwind colors + -- parsers can contain values used in |user_default_options| + sass = { enable = false, parsers = { "css" } }, -- Enable sass colors + virtualtext = "■", + -- update color values even if buffer is not focused + -- example use: cmp_menu, cmp_docs + always_update = false, + }, + -- all the sub-options of filetypes apply to buftypes + buftypes = {}, + }) end, }, @@ -540,7 +588,7 @@ require("lazy").setup({ { "gc", mode = { "x" }, desc = "Comment" }, }, config = function() - require("kide.plugins.config.comment") + require("Comment").setup() end, }, { @@ -548,7 +596,11 @@ require("lazy").setup({ lazy = true, event = { "VeryLazy" }, config = function() - require("kide.plugins.config.neogen") + require("neogen").setup({ + snippet_engine = "luasnip", + enabled = true, + input_after_comment = true, + }) end, }, @@ -559,7 +611,7 @@ require("lazy").setup({ ft = "markdown", build = "cd app && yarn install", config = function() - require("kide.plugins.config.markdown-preview") + vim.g.mkdp_page_title = "${name}" end, }, -- mackdown cli 预览插件 @@ -598,7 +650,31 @@ require("lazy").setup({ { "goolord/alpha-nvim", config = function() - require("kide.plugins.config.alpha-nvim") + local alpha = require("alpha") + local dashboard = require("alpha.themes.dashboard") + dashboard.section.header.val = { + " ███╗ ██╗ ███████╗ ██████╗ ██╗ ██╗ ██╗ ███╗ ███╗", + " ████╗ ██║ ██╔════╝██╔═══██╗ ██║ ██║ ██║ ████╗ ████║", + " ██╔██╗ ██║ █████╗ ██║ ██║ ██║ ██║ ██║ ██╔████╔██║", + " ██║╚██╗██║ ██╔══╝ ██║ ██║ ╚██╗ ██╔╝ ██║ ██║╚██╔╝██║", + " ██║ ╚████║ ███████╗╚██████╔╝ ╚████╔╝ ██║ ██║ ╚═╝ ██║", + " ╚═╝ ╚═══╝ ╚══════╝ ╚═════╝ ╚═══╝ ╚═╝ ╚═╝ ╚═╝", + } + local opt = { noremap = true, silent = true } + dashboard.section.buttons.val = { + dashboard.button(" ff", "󰈞 Find File", ":Telescope find_files", opt), + dashboard.button(" fg", "󰈭 Find Word ", ":Telescope live_grep", opt), + dashboard.button( + " fp", + " Recent Projects", + ":lua require'telescope'.extensions.project.project{ display_type = 'full' }", + opt + ), + dashboard.button(" fo", " Recent File", ":Telescope oldfiles", opt), + dashboard.button(" ns", " Settings", ":e $MYVIMRC | :cd %:p:h ", opt), + dashboard.button(" q ", "󰅙 Quit NVIM", ":qa", opt), + } + alpha.setup(dashboard.opts) end, }, @@ -608,7 +684,18 @@ require("lazy").setup({ lazy = true, cmd = "Translate", config = function() - require("kide.plugins.config.translate") + require("translate").setup({ + default = { + command = "translate_shell", + }, + preset = { + output = { + split = { + append = true, + }, + }, + }, + }) end, }, -- StartupTime @@ -635,7 +722,11 @@ require("lazy").setup({ "windwp/nvim-autopairs", event = { "InsertEnter", "VeryLazy" }, config = function() - require("kide.plugins.config.nvim-autopairs") + local autopairs = require("nvim-autopairs") + local cmp_autopairs = require("nvim-autopairs.completion.cmp") + autopairs.setup({}) + local cmp = require("cmp") + cmp.event:on("confirm_done", cmp_autopairs.on_confirm_done()) end, }, @@ -671,7 +762,28 @@ require("lazy").setup({ }) end, config = function() - require("kide.plugins.config.rest-nvim") + require("rest-nvim").setup({ + -- Open request results in a horizontal split + result_split_horizontal = false, + -- Skip SSL verification, useful for unknown certificates + skip_ssl_verification = false, + -- Highlight request on run + highlight = { + enabled = true, + timeout = 150, + }, + result = { + -- toggle showing URL, HTTP info, headers at top the of result window + show_url = true, + show_http_info = true, + show_headers = true, + }, + -- Jump to request line on run + jump_to_request = false, + env_file = ".env", + custom_dynamic_variables = {}, + yank_dry_run = true, + }) end, }, From 43320a6bcf2ec750c227a2c61d03f32b18b25b38 Mon Sep 17 00:00:00 2001 From: luokai Date: Sun, 23 Jul 2023 10:53:14 +0800 Subject: [PATCH 0801/1278] =?UTF-8?q?=E5=88=A0=E9=99=A4=E6=9C=AA=E4=BD=BF?= =?UTF-8?q?=E7=94=A8=E6=8F=92=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lua/kide/plugins/lazy-nvim.lua | 34 ---------------------------------- 1 file changed, 34 deletions(-) diff --git a/lua/kide/plugins/lazy-nvim.lua b/lua/kide/plugins/lazy-nvim.lua index 399719c9..9f929aac 100644 --- a/lua/kide/plugins/lazy-nvim.lua +++ b/lua/kide/plugins/lazy-nvim.lua @@ -134,30 +134,6 @@ require("lazy").setup({ vim.cmd([[colorscheme gruvbox]]) end, }, - { - "sainnhe/gruvbox-material", - enabled = false, - lazy = false, - priority = 1000, - config = function() - vim.opt.background = "dark" - vim.g.gruvbox_material_background = "medium" - vim.g.gruvbox_material_better_performance = true - vim.g.gruvbox_material_diagnostic_virtual_text = "colored" - vim.g.gruvbox_material_current_word = "underline" - vim.cmd([[colorscheme gruvbox-material]]) - end, - }, - { - "morhetz/gruvbox", - enabled = false, - lazy = false, - priority = 1000, - config = function() - vim.opt.background = "dark" - vim.cmd([[colorscheme gruvbox]]) - end, - }, -- 文件管理 { @@ -1076,16 +1052,6 @@ require("lazy").setup({ require("copilot").setup({}) end, }, - { - "zbirenbaum/copilot-cmp", - enabled = false, - lazy = true, - dependencies = { "zbirenbaum/copilot.lua" }, - event = { "InsertEnter", "VeryLazy" }, - config = function() - require("copilot_cmp").setup() - end, - }, }, { ui = { icons = { From 235bfea3f16252d127d140c6ff3453b7400ec35d Mon Sep 17 00:00:00 2001 From: luokai Date: Sun, 23 Jul 2023 11:09:25 +0800 Subject: [PATCH 0802/1278] lspkind_symbol_map --- lua/kide/lsp/lsp_ui.lua | 28 +++++++++++++++++++++++++++- 1 file changed, 27 insertions(+), 1 deletion(-) diff --git a/lua/kide/lsp/lsp_ui.lua b/lua/kide/lsp/lsp_ui.lua index a33fbca6..0e6e2e37 100644 --- a/lua/kide/lsp/lsp_ui.lua +++ b/lua/kide/lsp/lsp_ui.lua @@ -1,5 +1,31 @@ local M = {} -local lspkind_symbol_map = require("lspkind").symbol_map +local lspkind_symbol_map = { + Text = "󰉿", + Method = "󰆧", + Function = "󰊕", + Constructor = "", + Field = "󰜢", + Variable = "󰀫", + Class = "󰠱", + Interface = "", + Module = "", + Property = "󰜢", + Unit = "󰑭", + Value = "󰎠", + Enum = "", + Keyword = "󰌋", + Snippet = "", + Color = "󰏘", + File = "󰈙", + Reference = "󰈇", + Folder = "󰉋", + EnumMember = "", + Constant = "󰏿", + Struct = "󰙅", + Event = "", + Operator = "󰆕", + TypeParameter = "", +} -- remove obsolete TS* highlight groups https://github.com/nvim-treesitter/nvim-treesitter/pull/3656 M.symbol_map = { From c48b0405ba03a09d1f0756e49762882355761370 Mon Sep 17 00:00:00 2001 From: luokai Date: Sun, 23 Jul 2023 11:42:47 +0800 Subject: [PATCH 0803/1278] winbar --- lua/kide/lsp/init.lua | 1 + lua/kide/plugins/config/lualine.lua | 2 +- lua/kide/plugins/config/nvim-navic.lua | 36 ---------------------- lua/kide/plugins/lazy-nvim.lua | 42 ++++++++++++++++++++++++-- 4 files changed, 42 insertions(+), 39 deletions(-) delete mode 100644 lua/kide/plugins/config/nvim-navic.lua diff --git a/lua/kide/lsp/init.lua b/lua/kide/lsp/init.lua index c96068bf..d2a094f3 100644 --- a/lua/kide/lsp/init.lua +++ b/lua/kide/lsp/init.lua @@ -114,6 +114,7 @@ vim.api.nvim_create_autocmd("LspAttach", { local bufnr = args.buf local client = vim.lsp.get_client_by_id(args.data.client_id) if client.server_capabilities.documentSymbolProvider then + vim.opt_local.winbar = "%{%v:lua.require'nvim-navic'.get_location()%}" require("nvim-navic").attach(client, bufnr) end end, diff --git a/lua/kide/plugins/config/lualine.lua b/lua/kide/plugins/config/lualine.lua index aca8c8e3..d33e2438 100644 --- a/lua/kide/plugins/config/lualine.lua +++ b/lua/kide/plugins/config/lualine.lua @@ -28,7 +28,7 @@ local config = { end, }, "filename", - "navic", + -- "navic", }, lualine_x = { "encoding", "fileformat", "filetype" }, lualine_y = { "progress" }, diff --git a/lua/kide/plugins/config/nvim-navic.lua b/lua/kide/plugins/config/nvim-navic.lua deleted file mode 100644 index 6fec4e13..00000000 --- a/lua/kide/plugins/config/nvim-navic.lua +++ /dev/null @@ -1,36 +0,0 @@ -local navic = require("nvim-navic") -local symbol_map = require("kide.lsp.lsp_ui").symbol_map -navic.setup({ - icons = { - File = symbol_map.File.icon .. " ", - Module = symbol_map.Module.icon .. " ", - Namespace = symbol_map.Namespace.icon .. " ", - Package = symbol_map.Package.icon .. " ", - Class = symbol_map.Class.icon .. " ", - Method = symbol_map.Method.icon .. " ", - Property = symbol_map.Property.icon .. " ", - Field = symbol_map.Field.icon .. " ", - Constructor = symbol_map.Constructor.icon .. " ", - Enum = symbol_map.Enum.icon .. "", - Interface = symbol_map.Interface.icon .. "", - Function = symbol_map.Function.icon .. " ", - Variable = symbol_map.Variable.icon .. " ", - Constant = symbol_map.Constant.icon .. " ", - String = symbol_map.String.icon .. " ", - Number = symbol_map.Number.icon .. " ", - Boolean = symbol_map.Boolean.icon .. " ", - Array = symbol_map.Array.icon .. " ", - Object = symbol_map.Object.icon .. " ", - Key = symbol_map.Key.icon .. " ", - Null = symbol_map.Null.icon .. " ", - EnumMember = symbol_map.EnumMember.icon .. " ", - Struct = symbol_map.Struct.icon .. " ", - Event = symbol_map.Event.icon .. " ", - Operator = symbol_map.Operator.icon .. " ", - TypeParameter = symbol_map.TypeParameter.icon .. " ", - }, - -- highlight = false, - separator = "  ", - -- depth_limit = 0, - -- depth_limit_indicator = "..", -}) diff --git a/lua/kide/plugins/lazy-nvim.lua b/lua/kide/plugins/lazy-nvim.lua index 9f929aac..4b08ca77 100644 --- a/lua/kide/plugins/lazy-nvim.lua +++ b/lua/kide/plugins/lazy-nvim.lua @@ -885,7 +885,44 @@ require("lazy").setup({ "SmiteshP/nvim-navic", lazy = true, config = function() - require("kide.plugins.config.nvim-navic") + local navic = require("nvim-navic") + local symbol_map = require("kide.lsp.lsp_ui").symbol_map + navic.setup({ + icons = { + File = symbol_map.File.icon .. " ", + Module = symbol_map.Module.icon .. " ", + Namespace = symbol_map.Namespace.icon .. " ", + Package = symbol_map.Package.icon .. " ", + Class = symbol_map.Class.icon .. " ", + Method = symbol_map.Method.icon .. " ", + Property = symbol_map.Property.icon .. " ", + Field = symbol_map.Field.icon .. " ", + Constructor = symbol_map.Constructor.icon .. " ", + Enum = symbol_map.Enum.icon .. "", + Interface = symbol_map.Interface.icon .. "", + Function = symbol_map.Function.icon .. " ", + Variable = symbol_map.Variable.icon .. " ", + Constant = symbol_map.Constant.icon .. " ", + String = symbol_map.String.icon .. " ", + Number = symbol_map.Number.icon .. " ", + Boolean = symbol_map.Boolean.icon .. " ", + Array = symbol_map.Array.icon .. " ", + Object = symbol_map.Object.icon .. " ", + Key = symbol_map.Key.icon .. " ", + Null = symbol_map.Null.icon .. " ", + EnumMember = symbol_map.EnumMember.icon .. " ", + Struct = symbol_map.Struct.icon .. " ", + Event = symbol_map.Event.icon .. " ", + Operator = symbol_map.Operator.icon .. " ", + TypeParameter = symbol_map.TypeParameter.icon .. " ", + }, + lazy_update_context = true, + highlight = true, + safe_output = true, + separator = " > ", + -- depth_limit = 0, + -- depth_limit_indicator = "..", + }) end, }, @@ -929,7 +966,8 @@ require("lazy").setup({ end end - return require("ufo").getFolds(bufnr, "lsp") + return require("ufo") + .getFolds(bufnr, "lsp") :catch(function(err) return handleFallbackException(err, "treesitter") end) From 7672466c828f3c0bc9fe9c8c76924c328a329087 Mon Sep 17 00:00:00 2001 From: luokai Date: Sun, 23 Jul 2023 11:48:35 +0800 Subject: [PATCH 0804/1278] bdelete --- lua/kide/core/keybindings.lua | 2 +- lua/kide/plugins/lazy-nvim.lua | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/lua/kide/core/keybindings.lua b/lua/kide/core/keybindings.lua index 04eab992..e3422543 100644 --- a/lua/kide/core/keybindings.lua +++ b/lua/kide/core/keybindings.lua @@ -37,7 +37,7 @@ M.setup = function() require("kide.core.utils").close_other_bufline() end, {}) map("n", "s", ":w", opt) - map("n", "w", ":bd", opt) + map("n", "w", ":Bdelete", opt) map("n", "W", ":%bd", opt) map("n", "q", ":q", opt) -- buffer diff --git a/lua/kide/plugins/lazy-nvim.lua b/lua/kide/plugins/lazy-nvim.lua index 4b08ca77..9cedebf5 100644 --- a/lua/kide/plugins/lazy-nvim.lua +++ b/lua/kide/plugins/lazy-nvim.lua @@ -156,6 +156,10 @@ require("lazy").setup({ require("kide.plugins.config.bufferline") end, }, + { + "famiu/bufdelete.nvim", + cmd = { "Bdelete" }, + }, -- treesitter (新增) { From 7bd2c70d84f6b0b511d8ffd93a286352757a7a6b Mon Sep 17 00:00:00 2001 From: luokai Date: Sun, 23 Jul 2023 13:46:43 +0800 Subject: [PATCH 0805/1278] update --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index f37bdb0b..dc0732ca 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # NVIM IDE -可配置 `Java`, `Rust`, `C/C++`, `JavaScript` 等编程语言开发环境。 极速启动 (`startuptime` 20 ~ 70 ms)。 +可配置 `Java`, `Rust`, `C/C++`, `JavaScript` 等编程语言开发环境。 极速启动 (`startuptime` 15 ~ 60 ms)。 使用 `neovim-nightly` 版本。 From 24fbb5c18d7195f3706f483867054601ac2025d0 Mon Sep 17 00:00:00 2001 From: luokai Date: Sun, 23 Jul 2023 15:47:07 +0800 Subject: [PATCH 0806/1278] noice.nvim --- lua/kide/core/keybindings.lua | 79 +++++++++++++++-------------- lua/kide/plugins/config/lualine.lua | 25 ++++++++- lua/kide/plugins/lazy-nvim.lua | 54 +++++++++++++------- lua/kide/theme/gruvbox.lua | 20 ++++++++ 4 files changed, 123 insertions(+), 55 deletions(-) diff --git a/lua/kide/core/keybindings.lua b/lua/kide/core/keybindings.lua index e3422543..75a8c15a 100644 --- a/lua/kide/core/keybindings.lua +++ b/lua/kide/core/keybindings.lua @@ -16,50 +16,50 @@ M.setup = function() -- n 模式下粘贴系统剪切板的内容 map("n", "v", '"+p', opt) -- 取消搜索高亮显示 - map("n", "", ":nohlsearch", opt) - map("n", "", ":nohlsearch", opt) + map("n", "", "nohlsearch", opt) + map("n", "", "nohlsearch", opt) keymap("n", "", "h", opt) keymap("n", "", "j", opt) keymap("n", "", "k", opt) keymap("n", "", "l", opt) - map("n", "", ":res +5", opt) - map("n", "", ":res -5", opt) - map("n", "", ":res -5", opt) - map("n", "", ":res +5", opt) - map("n", "", ":vertical resize+5", opt) - map("n", "", ":vertical resize-5", opt) - map("n", "", ":vertical resize-5", opt) - map("n", "", ":vertical resize+5", opt) + map("n", "", "res +5", opt) + map("n", "", "res -5", opt) + map("n", "", "res -5", opt) + map("n", "", "res +5", opt) + map("n", "", "vertical resize+5", opt) + map("n", "", "vertical resize-5", opt) + map("n", "", "vertical resize-5", opt) + map("n", "", "vertical resize+5", opt) vim.api.nvim_create_user_command("BufferCloseOther", function() require("kide.core.utils").close_other_bufline() end, {}) - map("n", "s", ":w", opt) - map("n", "w", ":Bdelete", opt) - map("n", "W", ":%bd", opt) - map("n", "q", ":q", opt) + map("n", "s", "write", opt) + map("n", "w", "Bdelete", opt) + map("n", "W", "%bd", opt) + map("n", "q", "q", opt) -- buffer - map("n", "n", ":BufferLineCycleNext ", opt) - map("n", "p", ":BufferLineCyclePrev ", opt) + map("n", "n", "BufferLineCycleNext ", opt) + map("n", "p", "BufferLineCyclePrev ", opt) -- window - map("n", "", ":vertical resize +5 ", opt) - map("n", "", ":vertical resize -5 ", opt) + map("n", "", "vertical resize +5 ", opt) + map("n", "", "vertical resize -5 ", opt) -- " 退出 terminal 模式 map("t", "", "", opt) -- map("t", "jk", "", opt) -- ToggleTerm - map("n", "", ":ToggleTerm", opt) - map("t", "", ":ToggleTerm", opt) - map("n", "tt", ":ToggleTerm", opt) - map("v", "tt", ":ToggleTermSendVisualSelection", opt) + map("n", "", "ToggleTerm", opt) + map("t", "", "ToggleTerm", opt) + map("n", "tt", "ToggleTerm", opt) + map("v", "tt", "ToggleTermSendVisualSelection", opt) -- map("t", "tt", ":ToggleTerm", opt) -- symbols-outline.nvim - map("n", "o", ":SymbolsOutline", opt) + map("n", "o", "SymbolsOutline", opt) -- Telescope map("n", "ff", "Telescope find_files", opt) @@ -79,24 +79,29 @@ M.setup = function() map("n", "fh", "Telescope help_tags", opt) -- translate - map("n", "tz", ":Translate ZH -source=EN -parse_after=window -output=floating", opt) - map("v", "tz", ":Translate ZH -source=EN -parse_after=window -output=floating", opt) - map("n", "te", ":Translate EN -source=ZH -parse_after=window -output=floating", opt) - map("v", "te", ":Translate EN -source=ZH -parse_after=window -output=floating", opt) + map("n", "tz", "Translate ZH -source=EN -parse_after=window -output=floating", opt) + map("v", "tz", "Translate ZH -source=EN -parse_after=window -output=floating", opt) + map("n", "te", "Translate EN -source=ZH -parse_after=window -output=floating", opt) + map("v", "te", "Translate EN -source=ZH -parse_after=window -output=floating", opt) -- camel_case require("kide.core.utils").camel_case_init() -- nvim-dap - keymap("n", "", ":lua require'dap'.continue()", opt) - keymap("n", "", ":lua require'dap'.step_over()", opt) - keymap("n", "", ":lua require'dap'.step_into()", opt) - keymap("n", "", ":lua require'dap'.step_out()", opt) - keymap("n", "db", ":lua require'dap'.toggle_breakpoint()", opt) - keymap("n", "dB", ":lua require'dap'.set_breakpoint(vim.fn.input('Breakpoint condition: '))", opt) - keymap("n", "dp", ":lua require'dap'.set_breakpoint(nil, nil, vim.fn.input('Log point message: '))", opt) - keymap("n", "dr", ":lua require'dap'.repl.open()", opt) - keymap("n", "dl", ":lua require'dap'.run_last()", opt) + keymap("n", "", "lua require'dap'.continue()", opt) + keymap("n", "", "lua require'dap'.step_over()", opt) + keymap("n", "", "lua require'dap'.step_into()", opt) + keymap("n", "", "lua require'dap'.step_out()", opt) + keymap("n", "db", "lua require'dap'.toggle_breakpoint()", opt) + keymap("n", "dB", "lua require'dap'.set_breakpoint(vim.fn.input('Breakpoint condition: '))", opt) + keymap( + "n", + "dp", + "lua require'dap'.set_breakpoint(nil, nil, vim.fn.input('Log point message: '))", + opt + ) + keymap("n", "dr", "lua require'dap'.repl.open()", opt) + keymap("n", "dl", "lua require'dap'.run_last()", opt) -- nvim-dap-ui keymap("n", "ds", ':lua require("dapui").float_element(vim.Nil, { enter = true}) ', opt) @@ -124,7 +129,7 @@ M.setup = function() map("n", "ts", "Telescope toggletasks spawn", opt) -- nvimTree - map("n", "e", ":NvimTreeToggle", opt) + map("n", "e", "NvimTreeToggle", opt) -- set keybinds for both INSERT and VISUAL. vim.api.nvim_set_keymap("i", "", "luasnip-next-choice", {}) diff --git a/lua/kide/plugins/config/lualine.lua b/lua/kide/plugins/config/lualine.lua index d33e2438..29079a6c 100644 --- a/lua/kide/plugins/config/lualine.lua +++ b/lua/kide/plugins/config/lualine.lua @@ -30,7 +30,30 @@ local config = { "filename", -- "navic", }, - lualine_x = { "encoding", "fileformat", "filetype" }, + lualine_x = { + { + require("noice").api.status.message.get_hl, + cond = require("noice").api.status.message.has, + }, + { + require("noice").api.status.command.get, + cond = require("noice").api.status.command.has, + color = { fg = "#fabd2f" }, + }, + { + require("noice").api.status.mode.get, + cond = require("noice").api.status.mode.has, + color = { fg = "#fabd2f" }, + }, + { + require("noice").api.status.search.get, + cond = require("noice").api.status.search.has, + color = { fg = "#fabd2f" }, + }, + "encoding", + "fileformat", + "filetype", + }, lualine_y = { "progress" }, lualine_z = { "location" }, }, diff --git a/lua/kide/plugins/lazy-nvim.lua b/lua/kide/plugins/lazy-nvim.lua index 9cedebf5..ef43d53b 100644 --- a/lua/kide/plugins/lazy-nvim.lua +++ b/lua/kide/plugins/lazy-nvim.lua @@ -513,6 +513,7 @@ require("lazy").setup({ render = "default", timeout = 3000, minimum_width = 50, + background_colour = "#000000", icons = { ERROR = "", WARN = "", @@ -525,6 +526,41 @@ require("lazy").setup({ vim.notify = notify end, }, + { + "folke/noice.nvim", + event = "VeryLazy", + dependencies = { + "MunifTanjim/nui.nvim", + "rcarriga/nvim-notify", + }, + config = function() + require("noice").setup({ + messages = { + enabled = true, -- enables the Noice messages UI + view = "notify", -- default view for messages + view_error = "notify", -- view for errors + view_warn = "notify", -- view for warnings + view_history = "messages", -- view for :messages + view_search = "virtualtext", -- view for search count messages. Set to `false` to disable + }, + lsp = { + override = { + ["vim.lsp.util.convert_input_to_markdown_lines"] = false, + ["vim.lsp.util.stylize_markdown"] = false, + ["cmp.entry.get_documentation"] = false, + }, + hover = { + enabled = false, + }, + signature = { + enabled = false, + }, + }, + }) + require("kide.theme.gruvbox").load_noice_highlights() + require("telescope").load_extension("noice") + end, + }, -- 颜色显示 { @@ -790,21 +826,6 @@ require("lazy").setup({ end, }, - -- LSP 进度 - { - "j-hui/fidget.nvim", - lazy = true, - tag = "legacy", - event = "LspAttach", - config = function() - require("fidget").setup({ - text = { - done = "", - }, - }) - end, - }, - -- 查找替换 { "windwp/nvim-spectre", @@ -970,8 +991,7 @@ require("lazy").setup({ end end - return require("ufo") - .getFolds(bufnr, "lsp") + return require("ufo").getFolds(bufnr, "lsp") :catch(function(err) return handleFallbackException(err, "treesitter") end) diff --git a/lua/kide/theme/gruvbox.lua b/lua/kide/theme/gruvbox.lua index 750341b9..c24b939e 100644 --- a/lua/kide/theme/gruvbox.lua +++ b/lua/kide/theme/gruvbox.lua @@ -92,4 +92,24 @@ M.load_indent_blankline_highlights = function() }) end +M.load_noice_highlights = function() + M.load_highlights({ + NoiceCmdlinePopupBorderCmdline = { fg = colors.yellow, bg = nil }, + NoiceCmdlinePopupBorderFilter = { fg = colors.yellow, bg = nil }, + NoiceCmdlinePopupBorderHelp = { fg = colors.yellow, bg = nil }, + NoiceCmdlinePopupBorderInput = { fg = colors.yellow, bg = nil }, + NoiceCmdlinePopupBorderLua = { fg = colors.yellow, bg = nil }, + NoiceCmdlinePopupBorderSearch = { fg = colors.yellow, bg = nil }, + + NoiceCmdlinePopupTitle = { fg = colors.yellow, bg = nil }, + + NoiceCmdlineIconCmdline = { fg = colors.yellow, bg = nil }, + NoiceCmdlineIconFilter = { fg = colors.yellow, bg = nil }, + NoiceCmdlineIconHelp = { fg = colors.yellow, bg = nil }, + NoiceCmdlineIconInput = { fg = colors.yellow, bg = nil }, + NoiceCmdlineIconLua = { fg = colors.yellow, bg = nil }, + NoiceCmdlineIconSearch = { fg = colors.yellow, bg = nil }, + }) +end + return M From 75bf763a0eeda473c77756e0a39956597dab205e Mon Sep 17 00:00:00 2001 From: luokai Date: Sun, 23 Jul 2023 15:49:23 +0800 Subject: [PATCH 0807/1278] keymap --- lua/kide/core/keybindings.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lua/kide/core/keybindings.lua b/lua/kide/core/keybindings.lua index 75a8c15a..fc4129e0 100644 --- a/lua/kide/core/keybindings.lua +++ b/lua/kide/core/keybindings.lua @@ -59,7 +59,7 @@ M.setup = function() -- map("t", "tt", ":ToggleTerm", opt) -- symbols-outline.nvim - map("n", "o", "SymbolsOutline", opt) + map("n", "o", "SymbolsOutline", opt) -- Telescope map("n", "ff", "Telescope find_files", opt) From cab76c8ef44ae955f912165694635023bcc908d2 Mon Sep 17 00:00:00 2001 From: luokai Date: Sun, 23 Jul 2023 15:59:02 +0800 Subject: [PATCH 0808/1278] flash.nvim --- lua/kide/plugins/lazy-nvim.lua | 55 ++++++++++++++++++++++++++++------ 1 file changed, 46 insertions(+), 9 deletions(-) diff --git a/lua/kide/plugins/lazy-nvim.lua b/lua/kide/plugins/lazy-nvim.lua index ef43d53b..3b4d01c7 100644 --- a/lua/kide/plugins/lazy-nvim.lua +++ b/lua/kide/plugins/lazy-nvim.lua @@ -815,15 +815,52 @@ require("lazy").setup({ -- 快速跳转 { - "ggandor/leap.nvim", - lazy = true, - keys = { "s", "S" }, - config = function() - require("leap").add_default_mappings() - require("leap").opts.safe_labels = {} - vim.keymap.del({ "x", "o" }, "x") - vim.keymap.del({ "x", "o" }, "X") - end, + "folke/flash.nvim", + event = "VeryLazy", + opts = {}, + -- stylua: ignore + keys = { + { + "s", + mode = { "n", "x", "o" }, + function() + require("flash").jump() + end, + desc = "Flash", + }, + { + "S", + mode = { "n", "o", "x" }, + function() + require("flash").treesitter() + end, + desc = "Flash Treesitter", + }, + { + "r", + mode = "o", + function() + require("flash").remote() + end, + desc = "Remote Flash", + }, + { + "R", + mode = { "o", "x" }, + function() + require("flash").treesitter_search() + end, + desc = "Treesitter Search", + }, + { + "", + mode = { "c" }, + function() + require("flash").toggle() + end, + desc = "Toggle Flash Search", + }, + }, }, -- 查找替换 From 99b662932939d73e1b1c49e4064a6f1545976a52 Mon Sep 17 00:00:00 2001 From: luokai Date: Sun, 23 Jul 2023 16:05:39 +0800 Subject: [PATCH 0809/1278] Date --- lua/kide/core/init.lua | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lua/kide/core/init.lua b/lua/kide/core/init.lua index ff1ebaad..73b616a2 100644 --- a/lua/kide/core/init.lua +++ b/lua/kide/core/init.lua @@ -5,4 +5,6 @@ vim.schedule(function() require("kide.core.utils.maven").setup() require("kide.core.utils.jdtls").setup() require("kide.core.utils.pandoc").setup() + + vim.api.nvim_create_user_command("Date", "lua print(os.date())", {}) end) From ed9c255c578a7151b97a35c2162df9baf41a9afa Mon Sep 17 00:00:00 2001 From: luokai Date: Sun, 23 Jul 2023 16:17:22 +0800 Subject: [PATCH 0810/1278] NoiceConfirmBorder --- lua/kide/theme/gruvbox.lua | 1 + 1 file changed, 1 insertion(+) diff --git a/lua/kide/theme/gruvbox.lua b/lua/kide/theme/gruvbox.lua index c24b939e..6e476724 100644 --- a/lua/kide/theme/gruvbox.lua +++ b/lua/kide/theme/gruvbox.lua @@ -100,6 +100,7 @@ M.load_noice_highlights = function() NoiceCmdlinePopupBorderInput = { fg = colors.yellow, bg = nil }, NoiceCmdlinePopupBorderLua = { fg = colors.yellow, bg = nil }, NoiceCmdlinePopupBorderSearch = { fg = colors.yellow, bg = nil }, + NoiceConfirmBorder = { fg = colors.yellow, bg = nil }, NoiceCmdlinePopupTitle = { fg = colors.yellow, bg = nil }, From 4038c5a17c8e1d727a235283c25f21fd17ce5243 Mon Sep 17 00:00:00 2001 From: luokai Date: Sun, 23 Jul 2023 20:28:13 +0800 Subject: [PATCH 0811/1278] bufferline --- lua/kide/plugins/config/bufferline.lua | 23 +++++++---------------- 1 file changed, 7 insertions(+), 16 deletions(-) diff --git a/lua/kide/plugins/config/bufferline.lua b/lua/kide/plugins/config/bufferline.lua index afcdcbd5..bfb6c347 100644 --- a/lua/kide/plugins/config/bufferline.lua +++ b/lua/kide/plugins/config/bufferline.lua @@ -1,5 +1,8 @@ -require("bufferline").setup({ +local bufferline = require("bufferline") +bufferline.setup({ options = { + mode = "buffers", + style_preset = bufferline.style_preset.minimal, -- 使用 nvim 内置lsp diagnostics = "nvim_lsp", diagnostics_indicator = function(count, level, diagnostics_dict, context) @@ -15,17 +18,6 @@ require("bufferline").setup({ { filetype = "NvimTree", text = function() - -- return "File Explorer" - -- git symbolic-ref --short -q HEAD - -- git --no-pager rev-parse --show-toplevel --absolute-git-dir --abbrev-ref HEAD - -- git --no-pager rev-parse --short HEAD - -- local b = vim.fn.trim(vim.fn.system("git symbolic-ref --short -q HEAD")) - -- if string.match(b, "fatal") then - -- b = "" - -- else - -- b = "  " .. b - -- end - -- return vim.fn.fnamemodify(vim.fn.getcwd(), ":p:h:t") .. b return "File Explorer" end, padding = 1, @@ -79,12 +71,11 @@ require("bufferline").setup({ text_align = "left", }, }, + indicator = { + style = "none", + }, color_icons = true, show_buffer_close_icons = true, - -- show_buffer_default_icon = true, show_close_icon = false, - show_tab_indicators = true, - -- separator_style = "slant" | "thick" | "thin" | { 'any', 'any' }, - -- separator_style = "slant", }, }) From 65aab26a8c97a74c95fedb0488f8f78d3e37fc89 Mon Sep 17 00:00:00 2001 From: luokai Date: Mon, 24 Jul 2023 15:57:07 +0800 Subject: [PATCH 0812/1278] jdt:// doc fmt --- lua/kide/lsp/lsp_ui.lua | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lua/kide/lsp/lsp_ui.lua b/lua/kide/lsp/lsp_ui.lua index 0e6e2e37..ff2172bd 100644 --- a/lua/kide/lsp/lsp_ui.lua +++ b/lua/kide/lsp/lsp_ui.lua @@ -134,10 +134,10 @@ M.init = function() -- 文档格式化 local function markdown_format(input) if input then - input = string.gsub(input, '%[([%a%$_]?[%.%w%(%)*"+,\\_%[%]%s :%-@"]*)%]%(file:/[^%)]+%)', function(i1) + input = string.gsub(input, '%[([%a%$_]?[%.%w%(%)*"+,\\_%[%]%s :%-@<>]*)%]%(file:/[^%)]+%)', function(i1) return "`" .. i1 .. "`" end) - input = string.gsub(input, '%[([%a%$_]?[%.%w%(%)*"+,\\_%[%]%s :%-@"]*)%]%(jdt://[^%)]+%)', function(i1) + input = string.gsub(input, '%[([%a%$_]?[%.%w%(%)*"+,\\_%[%]%s :%-@<>]*)%]%(jdt://[^%)]+%)', function(i1) return "`" .. i1 .. "`" end) end From c63f2d77ac5ebe52afd833ea94b16d870b52cd1b Mon Sep 17 00:00:00 2001 From: luokai Date: Wed, 26 Jul 2023 11:40:58 +0800 Subject: [PATCH 0813/1278] =?UTF-8?q?=E5=88=A0=E9=99=A4=E7=BF=BB=E8=AF=91?= =?UTF-8?q?=E5=BF=AB=E6=8D=B7=E9=94=AE=E7=9B=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lua/kide/core/keybindings.lua | 6 ------ 1 file changed, 6 deletions(-) diff --git a/lua/kide/core/keybindings.lua b/lua/kide/core/keybindings.lua index fc4129e0..68a57c25 100644 --- a/lua/kide/core/keybindings.lua +++ b/lua/kide/core/keybindings.lua @@ -78,12 +78,6 @@ M.setup = function() map("n", "fb", "Telescope buffers", opt) map("n", "fh", "Telescope help_tags", opt) - -- translate - map("n", "tz", "Translate ZH -source=EN -parse_after=window -output=floating", opt) - map("v", "tz", "Translate ZH -source=EN -parse_after=window -output=floating", opt) - map("n", "te", "Translate EN -source=ZH -parse_after=window -output=floating", opt) - map("v", "te", "Translate EN -source=ZH -parse_after=window -output=floating", opt) - -- camel_case require("kide.core.utils").camel_case_init() From 4d397d8e31b62c823fbacfe5b337f6145fb38478 Mon Sep 17 00:00:00 2001 From: luokai Date: Wed, 26 Jul 2023 11:41:42 +0800 Subject: [PATCH 0814/1278] =?UTF-8?q?=E5=88=A0=E9=99=A4=E7=BF=BB=E8=AF=91?= =?UTF-8?q?=E5=BF=AB=E6=8D=B7=E9=94=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 2 -- 1 file changed, 2 deletions(-) diff --git a/README.md b/README.md index dc0732ca..43aa3a80 100644 --- a/README.md +++ b/README.md @@ -52,8 +52,6 @@ git clone https://github.com/JavaHello/nvim.git | Code Action | `Normal` | `ca` | | Debug | `Normal` | `F5` or `:DapContinue` | | 断点 | `Normal` | `db` | -| 翻译 en->zh | `Normal` or `Visual` | `tz` | -| 翻译 zh->en | `Normal` or `Visual` | `te` | | 内置终端 | `Command` | `:ToggleTerm` | | Tasks 列表 | `Normal` | `ts` | | 代码折叠 | `Normal` | `zc` | From 560a6eff839ad57de2909a5267be69d4aaa8e72f Mon Sep 17 00:00:00 2001 From: luokai Date: Wed, 26 Jul 2023 15:07:55 +0800 Subject: [PATCH 0815/1278] browse --- lua/kide/plugins/config/browse-nvim.lua | 12 ++++++++++++ lua/kide/plugins/lazy-nvim.lua | 1 + 2 files changed, 13 insertions(+) diff --git a/lua/kide/plugins/config/browse-nvim.lua b/lua/kide/plugins/config/browse-nvim.lua index bfa2d657..0ad53ad9 100644 --- a/lua/kide/plugins/config/browse-nvim.lua +++ b/lua/kide/plugins/config/browse-nvim.lua @@ -9,6 +9,18 @@ local bookmarks = { "https://docs.spring.io/spring-framework/docs/5.3.12/reference/html/", "https://github.com/", "https://stackoverflow.com/", + "https://mvnrepository.com/", + ["github"] = { + ["name"] = "search github from neovim", + ["code_search"] = "https://github.com/search?q=%s&type=code", + ["repo_search"] = "https://github.com/search?q=%s&type=repositories", + ["issues_search"] = "https://github.com/search?q=%s&type=issues", + ["pulls_search"] = "https://github.com/search?q=%s&type=pullrequests", + }, + ["maven"] = { + ["name"] = "search maven from neovim", + ["jar_search"] = "https://mvnrepository.com/search?q=%s", + }, } local function command(name, rhs, opts) diff --git a/lua/kide/plugins/lazy-nvim.lua b/lua/kide/plugins/lazy-nvim.lua index 3b4d01c7..044d99ae 100644 --- a/lua/kide/plugins/lazy-nvim.lua +++ b/lua/kide/plugins/lazy-nvim.lua @@ -917,6 +917,7 @@ require("lazy").setup({ { "lalitmee/browse.nvim", lazy = true, + event = { "VeryLazy" }, cmd = { "Browse", }, From c3cbc4fb51247abb805e5bda0bf4bb0bf7dd2d2e Mon Sep 17 00:00:00 2001 From: luokai Date: Fri, 28 Jul 2023 15:17:35 +0800 Subject: [PATCH 0816/1278] update icon --- lua/kide/plugins/lazy-nvim.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lua/kide/plugins/lazy-nvim.lua b/lua/kide/plugins/lazy-nvim.lua index 044d99ae..14bf5208 100644 --- a/lua/kide/plugins/lazy-nvim.lua +++ b/lua/kide/plugins/lazy-nvim.lua @@ -1155,7 +1155,7 @@ require("lazy").setup({ }, { ui = { icons = { - task = " ", + task = "✓ ", }, }, }) From 14d1179dd8460f64c3a3601b689ea8d2f8bedacc Mon Sep 17 00:00:00 2001 From: luokai Date: Sat, 29 Jul 2023 13:17:15 +0800 Subject: [PATCH 0817/1278] =?UTF-8?q?=E6=94=AF=E6=8C=81=E5=91=BD=E4=BB=A4?= =?UTF-8?q?=E6=B8=85=E7=90=86=20data=20=E7=9B=AE=E5=BD=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lua/kide/lsp/java.lua | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lua/kide/lsp/java.lua b/lua/kide/lsp/java.lua index ee7f2de7..d67f5e00 100644 --- a/lua/kide/lsp/java.lua +++ b/lua/kide/lsp/java.lua @@ -130,7 +130,8 @@ local function jdtls_launcher() if lombok_jar ~= nil then table.insert(cmd, "--jvm-arg=-javaagent:" .. lombok_jar) end - table.insert(cmd, "-data=" .. workspace_dir) + table.insert(cmd, "-data") + table.insert(cmd, workspace_dir) return cmd end From 9b9dc0fc5d556b655b2b96358e6b8b822fed7a85 Mon Sep 17 00:00:00 2001 From: luokai Date: Sat, 29 Jul 2023 21:59:59 +0800 Subject: [PATCH 0818/1278] flash config --- lua/kide/plugins/lazy-nvim.lua | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/lua/kide/plugins/lazy-nvim.lua b/lua/kide/plugins/lazy-nvim.lua index 14bf5208..99ba7e4b 100644 --- a/lua/kide/plugins/lazy-nvim.lua +++ b/lua/kide/plugins/lazy-nvim.lua @@ -817,7 +817,16 @@ require("lazy").setup({ { "folke/flash.nvim", event = "VeryLazy", - opts = {}, + opts = { + modes = { + search = { + enabled = false, + }, + char = { + enabled = false, + }, + }, + }, -- stylua: ignore keys = { { From b00438e24aa1e14eb16f603881354caf05e701df Mon Sep 17 00:00:00 2001 From: luokai Date: Sat, 29 Jul 2023 22:04:32 +0800 Subject: [PATCH 0819/1278] bdelete --- lua/kide/core/keybindings.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lua/kide/core/keybindings.lua b/lua/kide/core/keybindings.lua index 68a57c25..0e54c719 100644 --- a/lua/kide/core/keybindings.lua +++ b/lua/kide/core/keybindings.lua @@ -37,7 +37,7 @@ M.setup = function() require("kide.core.utils").close_other_bufline() end, {}) map("n", "s", "write", opt) - map("n", "w", "Bdelete", opt) + map("n", "w", "bdelete", opt) map("n", "W", "%bd", opt) map("n", "q", "q", opt) -- buffer From 4aa1a479b31b7a3309a97759e97b83d6aafff4fc Mon Sep 17 00:00:00 2001 From: luokai Date: Sun, 30 Jul 2023 16:59:55 +0800 Subject: [PATCH 0820/1278] refactoring --- lua/kide/plugins/lazy-nvim.lua | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/lua/kide/plugins/lazy-nvim.lua b/lua/kide/plugins/lazy-nvim.lua index 99ba7e4b..4f983b17 100644 --- a/lua/kide/plugins/lazy-nvim.lua +++ b/lua/kide/plugins/lazy-nvim.lua @@ -1123,6 +1123,29 @@ require("lazy").setup({ require("kide.plugins.config.flutter-tools") end, }, + { + "ThePrimeagen/refactoring.nvim", + lazy = true, + ft = { + "typescript", + "javascript", + "lua", + "c", + "cpp", + "go", + "python", + "java", + "php", + "ruby", + }, + dependencies = { + "nvim-lua/plenary.nvim", + "nvim-treesitter/nvim-treesitter", + }, + config = function() + require("refactoring").setup({}) + end, + }, -- ui { From ee6888bfc09d7ac4e52be5e4cd870e4b3300fb86 Mon Sep 17 00:00:00 2001 From: luokai Date: Sun, 30 Jul 2023 17:29:45 +0800 Subject: [PATCH 0821/1278] copilot --- lua/kide/plugins/lazy-nvim.lua | 24 +++++++++++++++++++----- 1 file changed, 19 insertions(+), 5 deletions(-) diff --git a/lua/kide/plugins/lazy-nvim.lua b/lua/kide/plugins/lazy-nvim.lua index 4f983b17..874eb42b 100644 --- a/lua/kide/plugins/lazy-nvim.lua +++ b/lua/kide/plugins/lazy-nvim.lua @@ -1175,13 +1175,27 @@ require("lazy").setup({ require("todo-comments").setup({}) end, }, - { - "zbirenbaum/copilot.lua", + -- { + -- "zbirenbaum/copilot.lua", + -- enabled = config.plugin.copilot.enable, + -- lazy = true, + -- cmd = "Copilot", + -- config = function() + -- require("copilot").setup({}) + -- end, + -- }, + { + "github/copilot.vim", enabled = config.plugin.copilot.enable, - lazy = true, - cmd = "Copilot", config = function() - require("copilot").setup({}) + vim.g.copilot_enabled = true + vim.g.copilot_no_tab_map = true + vim.cmd('imap