feat: support java

fix: nvim tree filter .gitignore
support: rust language
This commit is contained in:
Young Xu 2023-04-02 18:47:14 +08:00
parent 5ee995ebea
commit ed7b42efbc
Signed by: xuthus5
GPG Key ID: A23CF9620CBB55F9
25 changed files with 1060 additions and 199 deletions

View File

@ -14,7 +14,7 @@ git clone --depth 1 https://github.com/wbthomason/packer.nvim\
安装依赖 安装依赖
```bash ```bash
sudo dnf install fd-find ripgrep ShellCheck -y sudo dnf install fd-find ripgrep ShellCheck luarocks -y
go install github.com/jesseduffield/lazygit@latest go install github.com/jesseduffield/lazygit@latest
sudo npm install eslint --global sudo npm install eslint --global
sudo npm install -g typescript typescript-language-server sudo npm install -g typescript typescript-language-server

121
ftplugin/java.lua Normal file
View File

@ -0,0 +1,121 @@
function IsDirectoryExist(dirname)
return os.rename(dirname, dirname) and true or false
end
local jdtls = require("jdtls")
local root_markers = { ".git", "mvnw", "gradlew", "pom.xml", "build.gradle" }
local root_dir = require("jdtls.setup").find_root(root_markers)
if root_dir == "" then
return
end
local project_name = vim.fn.fnamemodify(vim.fn.getcwd(), ":p:h:t")
local home = os.getenv("HOME")
local jdtls_home = home .. "/.jdtls"
local plugins_home = jdtls_home .. "/plugins"
local workspace = jdtls_home .. "/workspace/" .. project_name
-- create when workspace not exist
if not IsDirectoryExist(workspace) then
os.execute("mkdir " .. workspace)
end
local launcher = plugins_home .. "/org.eclipse.equinox.launcher_1.6.400.v20210924-0641.jar"
local configuration = jdtls_home .. "/config_linux"
if vim.loop.os_uname().sysname == "Windows" then
configuration = jdtls_home .. "\\config_win"
end
local config = {
flags = {
debounce_text_changes = 80,
},
on_attach = common_lsp_on_attach,
cmd = {
"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",
"-Xmx1g",
"--add-modules=ALL-SYSTEM",
"--add-opens",
"java.base/java.util=ALL-UNNAMED",
"--add-opens",
"java.base/java.lang=ALL-UNNAMED",
"-javaagent:" .. jdtls_home .. "/bin/lombok.jar",
"-jar",
launcher,
"-configuration",
configuration,
"-data",
workspace,
},
root_dir = root_dir,
settings = {
java = {
maven = {
downloadSources = true,
},
eclipse = {
downloadSources = true,
},
implementationsCodeLens = {
enabled = true,
},
referencesCodeLens = {
enabled = true,
},
references = {
includeDecompiledSources = true,
},
format = {
enabled = true,
settings = {
url = vim.fn.stdpath("config") .. "intellij-java-google-style.xml",
profile = "GoogleStyle",
},
},
signatureHelp = { enabled = true },
contentProvider = { preferred = "fernflower" }, -- Use fernflower to decompile library code
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,
},
},
codeGeneration = {
toString = {
template = "${object.className}{${member.name()}=${member.value}, ${otherMembers}}",
},
hashCodeEquals = {
useJava7Objects = true,
},
useBlocks = true,
},
},
},
init_options = {
bundles = {},
},
}
jdtls.start_or_attach(config)

View File

@ -1 +0,0 @@
vnoremap <silent><buffer> D :<c-u>call SurroundVaddPairs("/** ", " */")<cr>

View File

@ -1,51 +0,0 @@
hi MDTask ctermfg=1
hi MDDoneText ctermfg=37 cterm=italic,strikethrough
hi MDTodoText cterm=NONE
hi MDDoneDate cterm=strikethrough ctermfg=71
hi MDTodoDate ctermfg=71
hi Deadline ctermfg=162 cterm=bold,underline
hi NearDeadline ctermfg=178 cterm=bold
au FileType markdown syn match markdownError "\w\@<=\w\@="
au FileType markdown syn match MDDoneDate /[SD]:\d\{4\}\([\/-]\d\d\)\{2\}/ contained
au FileType markdown syn match MDTodoDate /[SD]:\d\{4\}\([\/-]\d\d\)\{2\}/ contained
au FileType markdown syn match MDDoneText /- \[x\] \zs.*/ contains=MDDoneDate contained
au FileType markdown syn match MDTodoText /- \[ \] \zs.*/ contains=MDTodoDate contained
au FileType markdown syn match MDTask /- \[\(x\| \)\] .*/ contains=MDDoneText,MDTodoText
au FileType markdown call matchadd('Deadline', 'D:'.strftime("%Y-%m-%d"))
au FileType markdown call matchadd('NearDeadline', 'D:'.strftime("%Y-%m-%d", localtime() + 3600 * 24))
au FileType markdown call matchadd('NearDeadline', 'D:'.strftime("%Y-%m-%d", localtime() + 3600 * 48))
let b:md_block = '```'
setlocal shiftwidth=2
setlocal softtabstop=2
setlocal tabstop=2
nnoremap <silent><buffer> <CR> :call <SID>toggleTodoStatus()<CR><CR>
nnoremap <silent><buffer> <2-LeftMouse> :call <SID>toggleTodoStatus()<CR>:w<CR><2-LeftMouse>
vnoremap <silent><buffer> B :<c-u>call SurroundVaddPairs("**", "**")<cr>
vnoremap <silent><buffer> I :<c-u>call SurroundVaddPairs("*", "*")<cr>
vnoremap <silent><buffer> T :<c-u>call SurroundVaddPairs("- [ ] ", "")<cr>
vnoremap <silent><buffer> ` :<c-u>call SurroundVaddPairs("`", "`")<cr>
vnoremap <silent><buffer> C :<c-u>call SurroundVaddPairs("```plaintext", "```")<cr>
fun! s:toggleTodoStatus()
let line = getline('.')
if line =~ glob2regpat('*- \[ \]*')
call setline('.', substitute(line, '\[ \]', '[x]', ''))
elseif line =~ glob2regpat('*- \[x\]*')
call setline('.', substitute(line, '\[x\]', '[ ]', ''))
endif
endf
nnoremap <silent><buffer> <F6> :call <SID>toggleMPTheme()<CR>
inoremap <silent><buffer> <F6> <ESC>:call <SID>toggleMPTheme()<CR>
fun! s:toggleMPTheme()
if g:mkdp_theme == 'dark'
let g:mkdp_theme = 'light'
else
let g:mkdp_theme = 'dark'
endif
exec 'MarkdownPreviewStop'
sleep 1
exec 'MarkdownPreview'
endf

View File

@ -1 +0,0 @@
let g:omni_sql_no_default_maps = 1

View File

@ -1 +0,0 @@
vnoremap <silent><buffer> D :<c-u>call SurroundVaddPairs("/** ", " */")<cr>

View File

@ -1 +0,0 @@
let g:omni_sql_no_default_maps = 1

View File

@ -1 +0,0 @@
vnoremap <silent><buffer> D :<c-u>call SurroundVaddPairs("/** ", " */")<cr>

View File

@ -1,4 +0,0 @@
augroup vue
au!
autocmd BufWritePre *.vue :call CocAction('format')
augroup END

View File

@ -45,11 +45,13 @@ require("lsp.lua")
require("lsp.protocol") require("lsp.protocol")
require("lsp.volar") require("lsp.volar")
require("lsp.clang") require("lsp.clang")
require("plugins.java")
-- lspsaga -- lspsaga
require("plugins.lspsaga") require("plugins.lspsaga")
-- golang lsp -- golang lsp
require("plugins.golang") require("plugins.golang")
-- rust ide
require("plugins.rust")
-- 载入主题 -- 载入主题
require("core.theme") require("core.theme")
-- 载入按键 -- 载入按键

View File

@ -0,0 +1,598 @@
<?xml version="1.0" encoding="UTF-8"?>
<code_scheme name="GoogleStyle">
<option name="OTHER_INDENT_OPTIONS">
<value>
<option name="INDENT_SIZE" value="2" />
<option name="CONTINUATION_INDENT_SIZE" value="4" />
<option name="TAB_SIZE" value="2" />
<option name="USE_TAB_CHARACTER" value="false" />
<option name="SMART_TABS" value="false" />
<option name="LABEL_INDENT_SIZE" value="0" />
<option name="LABEL_INDENT_ABSOLUTE" value="false" />
<option name="USE_RELATIVE_INDENTS" value="false" />
</value>
</option>
<option name="INSERT_INNER_CLASS_IMPORTS" value="true" />
<option name="CLASS_COUNT_TO_USE_IMPORT_ON_DEMAND" value="999" />
<option name="NAMES_COUNT_TO_USE_IMPORT_ON_DEMAND" value="999" />
<option name="PACKAGES_TO_USE_IMPORT_ON_DEMAND">
<value />
</option>
<option name="IMPORT_LAYOUT_TABLE">
<value>
<package name="" withSubpackages="true" static="true" />
<emptyLine />
<package name="" withSubpackages="true" static="false" />
</value>
</option>
<option name="RIGHT_MARGIN" value="100" />
<option name="JD_ALIGN_PARAM_COMMENTS" value="false" />
<option name="JD_ALIGN_EXCEPTION_COMMENTS" value="false" />
<option name="JD_P_AT_EMPTY_LINES" value="false" />
<option name="JD_KEEP_EMPTY_PARAMETER" value="false" />
<option name="JD_KEEP_EMPTY_EXCEPTION" value="false" />
<option name="JD_KEEP_EMPTY_RETURN" value="false" />
<option name="KEEP_CONTROL_STATEMENT_IN_ONE_LINE" value="false" />
<option name="KEEP_BLANK_LINES_BEFORE_RBRACE" value="0" />
<option name="KEEP_BLANK_LINES_IN_CODE" value="1" />
<option name="BLANK_LINES_AFTER_CLASS_HEADER" value="0" />
<option name="ALIGN_MULTILINE_PARAMETERS" value="false" />
<option name="ALIGN_MULTILINE_FOR" value="false" />
<option name="CALL_PARAMETERS_WRAP" value="1" />
<option name="METHOD_PARAMETERS_WRAP" value="1" />
<option name="EXTENDS_LIST_WRAP" value="1" />
<option name="THROWS_KEYWORD_WRAP" value="1" />
<option name="METHOD_CALL_CHAIN_WRAP" value="1" />
<option name="BINARY_OPERATION_WRAP" value="1" />
<option name="BINARY_OPERATION_SIGN_ON_NEXT_LINE" value="true" />
<option name="TERNARY_OPERATION_WRAP" value="1" />
<option name="TERNARY_OPERATION_SIGNS_ON_NEXT_LINE" value="true" />
<option name="FOR_STATEMENT_WRAP" value="1" />
<option name="ARRAY_INITIALIZER_WRAP" value="1" />
<option name="WRAP_COMMENTS" value="true" />
<option name="IF_BRACE_FORCE" value="3" />
<option name="DOWHILE_BRACE_FORCE" value="3" />
<option name="WHILE_BRACE_FORCE" value="3" />
<option name="FOR_BRACE_FORCE" value="3" />
<option name="SPACE_BEFORE_ARRAY_INITIALIZER_LBRACE" value="true" />
<AndroidXmlCodeStyleSettings>
<option name="USE_CUSTOM_SETTINGS" value="true" />
<option name="LAYOUT_SETTINGS">
<value>
<option name="INSERT_BLANK_LINE_BEFORE_TAG" value="false" />
</value>
</option>
</AndroidXmlCodeStyleSettings>
<JSCodeStyleSettings>
<option name="INDENT_CHAINED_CALLS" value="false" />
</JSCodeStyleSettings>
<Python>
<option name="USE_CONTINUATION_INDENT_FOR_ARGUMENTS" value="true" />
</Python>
<TypeScriptCodeStyleSettings>
<option name="INDENT_CHAINED_CALLS" value="false" />
</TypeScriptCodeStyleSettings>
<XML>
<option name="XML_ALIGN_ATTRIBUTES" value="false" />
<option name="XML_LEGACY_SETTINGS_IMPORTED" value="true" />
</XML>
<codeStyleSettings language="CSS">
<indentOptions>
<option name="INDENT_SIZE" value="2" />
<option name="CONTINUATION_INDENT_SIZE" value="4" />
<option name="TAB_SIZE" value="2" />
</indentOptions>
</codeStyleSettings>
<codeStyleSettings language="ECMA Script Level 4">
<option name="KEEP_BLANK_LINES_IN_CODE" value="1" />
<option name="ALIGN_MULTILINE_PARAMETERS" value="false" />
<option name="ALIGN_MULTILINE_FOR" value="false" />
<option name="CALL_PARAMETERS_WRAP" value="1" />
<option name="METHOD_PARAMETERS_WRAP" value="1" />
<option name="EXTENDS_LIST_WRAP" value="1" />
<option name="BINARY_OPERATION_WRAP" value="1" />
<option name="BINARY_OPERATION_SIGN_ON_NEXT_LINE" value="true" />
<option name="TERNARY_OPERATION_WRAP" value="1" />
<option name="TERNARY_OPERATION_SIGNS_ON_NEXT_LINE" value="true" />
<option name="FOR_STATEMENT_WRAP" value="1" />
<option name="ARRAY_INITIALIZER_WRAP" value="1" />
<option name="IF_BRACE_FORCE" value="3" />
<option name="DOWHILE_BRACE_FORCE" value="3" />
<option name="WHILE_BRACE_FORCE" value="3" />
<option name="FOR_BRACE_FORCE" value="3" />
<option name="PARENT_SETTINGS_INSTALLED" value="true" />
</codeStyleSettings>
<codeStyleSettings language="HTML">
<indentOptions>
<option name="INDENT_SIZE" value="2" />
<option name="CONTINUATION_INDENT_SIZE" value="4" />
<option name="TAB_SIZE" value="2" />
</indentOptions>
</codeStyleSettings>
<codeStyleSettings language="JAVA">
<option name="KEEP_CONTROL_STATEMENT_IN_ONE_LINE" value="false" />
<option name="KEEP_BLANK_LINES_IN_CODE" value="1" />
<option name="BLANK_LINES_AFTER_CLASS_HEADER" value="1" />
<option name="ALIGN_MULTILINE_PARAMETERS" value="false" />
<option name="ALIGN_MULTILINE_RESOURCES" value="false" />
<option name="ALIGN_MULTILINE_FOR" value="false" />
<option name="CALL_PARAMETERS_WRAP" value="1" />
<option name="METHOD_PARAMETERS_WRAP" value="1" />
<option name="EXTENDS_LIST_WRAP" value="1" />
<option name="THROWS_KEYWORD_WRAP" value="1" />
<option name="METHOD_CALL_CHAIN_WRAP" value="1" />
<option name="BINARY_OPERATION_WRAP" value="1" />
<option name="BINARY_OPERATION_SIGN_ON_NEXT_LINE" value="true" />
<option name="TERNARY_OPERATION_WRAP" value="1" />
<option name="TERNARY_OPERATION_SIGNS_ON_NEXT_LINE" value="true" />
<option name="FOR_STATEMENT_WRAP" value="1" />
<option name="ARRAY_INITIALIZER_WRAP" value="1" />
<option name="WRAP_COMMENTS" value="true" />
<option name="IF_BRACE_FORCE" value="3" />
<option name="DOWHILE_BRACE_FORCE" value="3" />
<option name="WHILE_BRACE_FORCE" value="3" />
<option name="FOR_BRACE_FORCE" value="3" />
<option name="PARENT_SETTINGS_INSTALLED" value="true" />
<indentOptions>
<option name="INDENT_SIZE" value="2" />
<option name="CONTINUATION_INDENT_SIZE" value="4" />
<option name="TAB_SIZE" value="2" />
</indentOptions>
</codeStyleSettings>
<codeStyleSettings language="JSON">
<indentOptions>
<option name="CONTINUATION_INDENT_SIZE" value="4" />
<option name="TAB_SIZE" value="2" />
</indentOptions>
</codeStyleSettings>
<codeStyleSettings language="JavaScript">
<option name="RIGHT_MARGIN" value="80" />
<option name="KEEP_BLANK_LINES_IN_CODE" value="1" />
<option name="ALIGN_MULTILINE_PARAMETERS" value="false" />
<option name="ALIGN_MULTILINE_FOR" value="false" />
<option name="CALL_PARAMETERS_WRAP" value="1" />
<option name="METHOD_PARAMETERS_WRAP" value="1" />
<option name="BINARY_OPERATION_WRAP" value="1" />
<option name="BINARY_OPERATION_SIGN_ON_NEXT_LINE" value="true" />
<option name="TERNARY_OPERATION_WRAP" value="1" />
<option name="TERNARY_OPERATION_SIGNS_ON_NEXT_LINE" value="true" />
<option name="FOR_STATEMENT_WRAP" value="1" />
<option name="ARRAY_INITIALIZER_WRAP" value="1" />
<option name="IF_BRACE_FORCE" value="3" />
<option name="DOWHILE_BRACE_FORCE" value="3" />
<option name="WHILE_BRACE_FORCE" value="3" />
<option name="FOR_BRACE_FORCE" value="3" />
<option name="PARENT_SETTINGS_INSTALLED" value="true" />
<indentOptions>
<option name="INDENT_SIZE" value="2" />
<option name="TAB_SIZE" value="2" />
</indentOptions>
</codeStyleSettings>
<codeStyleSettings language="PROTO">
<option name="RIGHT_MARGIN" value="80" />
<indentOptions>
<option name="INDENT_SIZE" value="2" />
<option name="CONTINUATION_INDENT_SIZE" value="2" />
<option name="TAB_SIZE" value="2" />
</indentOptions>
</codeStyleSettings>
<codeStyleSettings language="protobuf">
<option name="RIGHT_MARGIN" value="80" />
<indentOptions>
<option name="INDENT_SIZE" value="2" />
<option name="CONTINUATION_INDENT_SIZE" value="2" />
<option name="TAB_SIZE" value="2" />
</indentOptions>
</codeStyleSettings>
<codeStyleSettings language="Python">
<option name="KEEP_BLANK_LINES_IN_CODE" value="1" />
<option name="RIGHT_MARGIN" value="80" />
<option name="ALIGN_MULTILINE_PARAMETERS" value="false" />
<option name="PARENT_SETTINGS_INSTALLED" value="true" />
<indentOptions>
<option name="INDENT_SIZE" value="2" />
<option name="CONTINUATION_INDENT_SIZE" value="4" />
<option name="TAB_SIZE" value="2" />
</indentOptions>
</codeStyleSettings>
<codeStyleSettings language="SASS">
<indentOptions>
<option name="CONTINUATION_INDENT_SIZE" value="4" />
<option name="TAB_SIZE" value="2" />
</indentOptions>
</codeStyleSettings>
<codeStyleSettings language="SCSS">
<indentOptions>
<option name="CONTINUATION_INDENT_SIZE" value="4" />
<option name="TAB_SIZE" value="2" />
</indentOptions>
</codeStyleSettings>
<codeStyleSettings language="TypeScript">
<indentOptions>
<option name="INDENT_SIZE" value="2" />
<option name="TAB_SIZE" value="2" />
</indentOptions>
</codeStyleSettings>
<codeStyleSettings language="XML">
<indentOptions>
<option name="INDENT_SIZE" value="2" />
<option name="CONTINUATION_INDENT_SIZE" value="2" />
<option name="TAB_SIZE" value="2" />
</indentOptions>
<arrangement>
<rules>
<section>
<rule>
<match>
<AND>
<NAME>xmlns:android</NAME>
<XML_ATTRIBUTE />
<XML_NAMESPACE>^$</XML_NAMESPACE>
</AND>
</match>
</rule>
</section>
<section>
<rule>
<match>
<AND>
<NAME>xmlns:.*</NAME>
<XML_ATTRIBUTE />
<XML_NAMESPACE>^$</XML_NAMESPACE>
</AND>
</match>
<order>BY_NAME</order>
</rule>
</section>
<section>
<rule>
<match>
<AND>
<NAME>.*:id</NAME>
<XML_ATTRIBUTE />
<XML_NAMESPACE>http://schemas.android.com/apk/res/android</XML_NAMESPACE>
</AND>
</match>
</rule>
</section>
<section>
<rule>
<match>
<AND>
<NAME>style</NAME>
<XML_ATTRIBUTE />
<XML_NAMESPACE>^$</XML_NAMESPACE>
</AND>
</match>
</rule>
</section>
<section>
<rule>
<match>
<AND>
<NAME>.*</NAME>
<XML_ATTRIBUTE />
<XML_NAMESPACE>^$</XML_NAMESPACE>
</AND>
</match>
<order>BY_NAME</order>
</rule>
</section>
<section>
<rule>
<match>
<AND>
<NAME>.*:.*Style</NAME>
<XML_ATTRIBUTE />
<XML_NAMESPACE>http://schemas.android.com/apk/res/android</XML_NAMESPACE>
</AND>
</match>
<order>BY_NAME</order>
</rule>
</section>
<section>
<rule>
<match>
<AND>
<NAME>.*:layout_width</NAME>
<XML_ATTRIBUTE />
<XML_NAMESPACE>http://schemas.android.com/apk/res/android</XML_NAMESPACE>
</AND>
</match>
</rule>
</section>
<section>
<rule>
<match>
<AND>
<NAME>.*:layout_height</NAME>
<XML_ATTRIBUTE />
<XML_NAMESPACE>http://schemas.android.com/apk/res/android</XML_NAMESPACE>
</AND>
</match>
</rule>
</section>
<section>
<rule>
<match>
<AND>
<NAME>.*:layout_weight</NAME>
<XML_ATTRIBUTE />
<XML_NAMESPACE>http://schemas.android.com/apk/res/android</XML_NAMESPACE>
</AND>
</match>
</rule>
</section>
<section>
<rule>
<match>
<AND>
<NAME>.*:layout_margin</NAME>
<XML_ATTRIBUTE />
<XML_NAMESPACE>http://schemas.android.com/apk/res/android</XML_NAMESPACE>
</AND>
</match>
</rule>
</section>
<section>
<rule>
<match>
<AND>
<NAME>.*:layout_marginTop</NAME>
<XML_ATTRIBUTE />
<XML_NAMESPACE>http://schemas.android.com/apk/res/android</XML_NAMESPACE>
</AND>
</match>
</rule>
</section>
<section>
<rule>
<match>
<AND>
<NAME>.*:layout_marginBottom</NAME>
<XML_ATTRIBUTE />
<XML_NAMESPACE>http://schemas.android.com/apk/res/android</XML_NAMESPACE>
</AND>
</match>
</rule>
</section>
<section>
<rule>
<match>
<AND>
<NAME>.*:layout_marginStart</NAME>
<XML_ATTRIBUTE />
<XML_NAMESPACE>http://schemas.android.com/apk/res/android</XML_NAMESPACE>
</AND>
</match>
</rule>
</section>
<section>
<rule>
<match>
<AND>
<NAME>.*:layout_marginEnd</NAME>
<XML_ATTRIBUTE />
<XML_NAMESPACE>http://schemas.android.com/apk/res/android</XML_NAMESPACE>
</AND>
</match>
</rule>
</section>
<section>
<rule>
<match>
<AND>
<NAME>.*:layout_marginLeft</NAME>
<XML_ATTRIBUTE />
<XML_NAMESPACE>http://schemas.android.com/apk/res/android</XML_NAMESPACE>
</AND>
</match>
</rule>
</section>
<section>
<rule>
<match>
<AND>
<NAME>.*:layout_marginRight</NAME>
<XML_ATTRIBUTE />
<XML_NAMESPACE>http://schemas.android.com/apk/res/android</XML_NAMESPACE>
</AND>
</match>
</rule>
</section>
<section>
<rule>
<match>
<AND>
<NAME>.*:layout_.*</NAME>
<XML_ATTRIBUTE />
<XML_NAMESPACE>http://schemas.android.com/apk/res/android</XML_NAMESPACE>
</AND>
</match>
<order>BY_NAME</order>
</rule>
</section>
<section>
<rule>
<match>
<AND>
<NAME>.*:padding</NAME>
<XML_ATTRIBUTE />
<XML_NAMESPACE>http://schemas.android.com/apk/res/android</XML_NAMESPACE>
</AND>
</match>
</rule>
</section>
<section>
<rule>
<match>
<AND>
<NAME>.*:paddingTop</NAME>
<XML_ATTRIBUTE />
<XML_NAMESPACE>http://schemas.android.com/apk/res/android</XML_NAMESPACE>
</AND>
</match>
</rule>
</section>
<section>
<rule>
<match>
<AND>
<NAME>.*:paddingBottom</NAME>
<XML_ATTRIBUTE />
<XML_NAMESPACE>http://schemas.android.com/apk/res/android</XML_NAMESPACE>
</AND>
</match>
</rule>
</section>
<section>
<rule>
<match>
<AND>
<NAME>.*:paddingStart</NAME>
<XML_ATTRIBUTE />
<XML_NAMESPACE>http://schemas.android.com/apk/res/android</XML_NAMESPACE>
</AND>
</match>
</rule>
</section>
<section>
<rule>
<match>
<AND>
<NAME>.*:paddingEnd</NAME>
<XML_ATTRIBUTE />
<XML_NAMESPACE>http://schemas.android.com/apk/res/android</XML_NAMESPACE>
</AND>
</match>
</rule>
</section>
<section>
<rule>
<match>
<AND>
<NAME>.*:paddingLeft</NAME>
<XML_ATTRIBUTE />
<XML_NAMESPACE>http://schemas.android.com/apk/res/android</XML_NAMESPACE>
</AND>
</match>
</rule>
</section>
<section>
<rule>
<match>
<AND>
<NAME>.*:paddingRight</NAME>
<XML_ATTRIBUTE />
<XML_NAMESPACE>http://schemas.android.com/apk/res/android</XML_NAMESPACE>
</AND>
</match>
</rule>
</section>
<section>
<rule>
<match>
<AND>
<NAME>.*</NAME>
<XML_NAMESPACE>http://schemas.android.com/apk/res/android</XML_NAMESPACE>
</AND>
</match>
<order>BY_NAME</order>
</rule>
</section>
<section>
<rule>
<match>
<AND>
<NAME>.*</NAME>
<XML_NAMESPACE>http://schemas.android.com/apk/res-auto</XML_NAMESPACE>
</AND>
</match>
<order>BY_NAME</order>
</rule>
</section>
<section>
<rule>
<match>
<AND>
<NAME>.*</NAME>
<XML_NAMESPACE>http://schemas.android.com/tools</XML_NAMESPACE>
</AND>
</match>
<order>BY_NAME</order>
</rule>
</section>
<section>
<rule>
<match>
<AND>
<NAME>.*</NAME>
<XML_NAMESPACE>.*</XML_NAMESPACE>
</AND>
</match>
<order>BY_NAME</order>
</rule>
</section>
</rules>
</arrangement>
</codeStyleSettings>
<Objective-C>
<option name="INDENT_NAMESPACE_MEMBERS" value="0" />
<option name="INDENT_C_STRUCT_MEMBERS" value="2" />
<option name="INDENT_CLASS_MEMBERS" value="2" />
<option name="INDENT_VISIBILITY_KEYWORDS" value="1" />
<option name="INDENT_INSIDE_CODE_BLOCK" value="2" />
<option name="KEEP_STRUCTURES_IN_ONE_LINE" value="true" />
<option name="FUNCTION_PARAMETERS_WRAP" value="5" />
<option name="FUNCTION_CALL_ARGUMENTS_WRAP" value="5" />
<option name="TEMPLATE_CALL_ARGUMENTS_WRAP" value="5" />
<option name="TEMPLATE_CALL_ARGUMENTS_ALIGN_MULTILINE" value="true" />
<option name="ALIGN_INIT_LIST_IN_COLUMNS" value="false" />
<option name="SPACE_BEFORE_SUPERCLASS_COLON" value="false" />
</Objective-C>
<Objective-C-extensions>
<option name="GENERATE_INSTANCE_VARIABLES_FOR_PROPERTIES" value="ASK" />
<option name="RELEASE_STYLE" value="IVAR" />
<option name="TYPE_QUALIFIERS_PLACEMENT" value="BEFORE" />
<file>
<option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="Import" />
<option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="Macro" />
<option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="Typedef" />
<option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="Enum" />
<option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="Constant" />
<option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="Global" />
<option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="Struct" />
<option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="FunctionPredecl" />
<option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="Function" />
</file>
<class>
<option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="Property" />
<option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="Synthesize" />
<option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="InitMethod" />
<option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="StaticMethod" />
<option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="InstanceMethod" />
<option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="DeallocMethod" />
</class>
<extensions>
<pair source="cc" header="h" />
<pair source="c" header="h" />
</extensions>
</Objective-C-extensions>
<codeStyleSettings language="ObjectiveC">
<option name="RIGHT_MARGIN" value="80" />
<option name="KEEP_BLANK_LINES_BEFORE_RBRACE" value="1" />
<option name="BLANK_LINES_BEFORE_IMPORTS" value="0" />
<option name="BLANK_LINES_AFTER_IMPORTS" value="0" />
<option name="BLANK_LINES_AROUND_CLASS" value="0" />
<option name="BLANK_LINES_AROUND_METHOD" value="0" />
<option name="BLANK_LINES_AROUND_METHOD_IN_INTERFACE" value="0" />
<option name="ALIGN_MULTILINE_BINARY_OPERATION" value="false" />
<option name="BINARY_OPERATION_SIGN_ON_NEXT_LINE" value="true" />
<option name="FOR_STATEMENT_WRAP" value="1" />
<option name="ASSIGNMENT_WRAP" value="1" />
<indentOptions>
<option name="INDENT_SIZE" value="2" />
<option name="CONTINUATION_INDENT_SIZE" value="4" />
</indentOptions>
</codeStyleSettings>
</code_scheme>

View File

@ -4,6 +4,8 @@ vim.g.maplocalleader = " "
local map = vim.keymap local map = vim.keymap
local noreopt = { noremap = true, silent = true } local noreopt = { noremap = true, silent = true }
-- 重启lsp
map.set("n", "<leader>lr", "<cmd>LspRestart<CR>", noreopt)
-- save -- save
map.set({ "n", "i" }, "<C-s>", "<cmd>w<cr>", noreopt) map.set({ "n", "i" }, "<C-s>", "<cmd>w<cr>", noreopt)
-- format -- format
@ -27,6 +29,10 @@ map.set("n", "<C-h>", "<C-w>h", noreopt)
map.set("n", "<C-j>", "<C-w>j", noreopt) map.set("n", "<C-j>", "<C-w>j", noreopt)
map.set("n", "<C-k>", "<C-w>k", noreopt) map.set("n", "<C-k>", "<C-w>k", noreopt)
map.set("n", "<C-l>", "<C-w>l", noreopt) map.set("n", "<C-l>", "<C-w>l", noreopt)
-- 折叠配置
map.set({"n", "v"}, "<leader>z+", "zM", noreopt)
map.set({"n", "v"}, "<leader>z-", "zR", noreopt)
map.set({"n", "v"}, "<leader>zz", "za", noreopt)
-- 分屏 -- 分屏
map.set("n", "<leader>sv", ":vsp<CR>", noreopt) map.set("n", "<leader>sv", ":vsp<CR>", noreopt)
map.set("n", "<leader>sh", ":sp<CR>", noreopt) map.set("n", "<leader>sh", ":sp<CR>", noreopt)
@ -50,8 +56,8 @@ map.set("n", "qn", ":q!<CR>", noreopt)
map.set("n", "qq", ":qa!<CR>", noreopt) map.set("n", "qq", ":qa!<CR>", noreopt)
map.set("i", "jk", "<ESC>", noreopt) map.set("i", "jk", "<ESC>", noreopt)
-- 文件页切换 -- 文件页切换
map.set("n", "<leader>bl", ":BufferLineCyclePrev<CR>", noreopt) map.set("n", "<leader>ll", ":BufferLineCyclePrev<CR>", noreopt)
map.set("n", "<leader>br", ":BufferLineCycleNext<CR>", noreopt) map.set("n", "<leader>hh", ":BufferLineCycleNext<CR>", noreopt)
map.set("n", "<leader>bpi", ":BufferLineTogglePin<CR>", noreopt) map.set("n", "<leader>bpi", ":BufferLineTogglePin<CR>", noreopt)
map.set("n", "<leader>bcl", ":BufferLineCloseLeft<CR>", noreopt) map.set("n", "<leader>bcl", ":BufferLineCloseLeft<CR>", noreopt)
map.set("n", "<leader>bcr", ":BufferLineCloseRight<CR>", noreopt) map.set("n", "<leader>bcr", ":BufferLineCloseRight<CR>", noreopt)

View File

@ -40,10 +40,10 @@ vim.o.hidden = true
-- 鼠标支持 -- 鼠标支持
vim.o.mouse = "a" vim.o.mouse = "a"
-- smaller updatetime -- smaller updatetime
vim.o.updatetime = 300 vim.o.updatetime = 3000
-- 设置 timeoutlen 为等待键盘快捷键连击时间500毫秒可根据需要设置 -- 设置 timeoutlen 为等待键盘快捷键连击时间500毫秒可根据需要设置
-- 遇到问题详见https://github.com/nshen/learn-neovim-lua/issues/1 -- 遇到问题详见https://github.com/nshen/learn-neovim-lua/issues/1
vim.o.timeoutlen = 500 vim.o.timeoutlen = 1000
-- split window 从下边和右边出现 -- split window 从下边和右边出现
vim.o.splitbelow = true vim.o.splitbelow = true
vim.o.splitright = true vim.o.splitright = true

View File

@ -10,6 +10,5 @@ common_lsp_on_attach = function(client, bufnr)
end end
common_lsp_flags = { common_lsp_flags = {
-- This is the default in Nvim 0.7+ debounce_text_changes = 500,
debounce_text_changes = 150,
} }

View File

@ -1,9 +1,15 @@
-- setting up lua
local runtime_path = vim.split(package.path, ";")
table.insert(runtime_path, "lua/?.lua")
table.insert(runtime_path, "lua/?/init.lua")
require("lspconfig").lua_ls.setup({ require("lspconfig").lua_ls.setup({
settings = { settings = {
Lua = { Lua = {
runtime = { runtime = {
-- Tell the language server which version of Lua you're using (most likely LuaJIT in the case of Neovim) -- Tell the language server which version of Lua you're using (most likely LuaJIT in the case of Neovim)
version = "LuaJIT", version = "LuaJIT",
path = runtime_path,
}, },
diagnostics = { diagnostics = {
-- Get the language server to recognize the `vim` global -- Get the language server to recognize the `vim` global
@ -12,6 +18,7 @@ require("lspconfig").lua_ls.setup({
workspace = { workspace = {
-- Make the server aware of Neovim runtime files -- Make the server aware of Neovim runtime files
library = vim.api.nvim_get_runtime_file("", true), library = vim.api.nvim_get_runtime_file("", true),
checkThirdParty = false,
}, },
-- Do not send telemetry data containing a randomized but unique identifier -- Do not send telemetry data containing a randomized but unique identifier
telemetry = { telemetry = {

View File

@ -15,9 +15,29 @@ require("nvim-tree").setup({
enable = true, enable = true,
update_root = true, update_root = true,
}, },
filters = { custom = { ".git" } }, filters = {
custom = {},
dotfiles = true,
exclude = { ".golangci*", ".protolint*", ".gitignore" },
},
filesystem_watchers = {
enable = true,
debounce_delay = 10,
},
git = {
enable = true,
ignore = true,
show_on_dirs = true,
show_on_open_dirs = true,
timeout = 400,
},
modified = {
enable = false,
show_on_dirs = true,
show_on_open_dirs = true,
},
view = { view = {
width = 30, width = 48,
mappings = { mappings = {
list = { list = {
{ key = "u", action = "dir_up" }, { key = "u", action = "dir_up" },
@ -25,7 +45,52 @@ require("nvim-tree").setup({
}, },
}, },
renderer = { renderer = {
full_name = true,
group_empty = true, group_empty = true,
indent_markers = {
enable = true,
},
icons = {
git_placement = "signcolumn",
show = {
file = true,
folder = true,
folder_arrow = true,
git = true,
},
},
},
diagnostics = {
enable = true,
show_on_dirs = true,
},
actions = {
change_dir = {
enable = false,
restrict_above_cwd = true,
},
open_file = {
resize_window = true,
window_picker = {
chars = "aoeui",
},
},
remove_file = {
close_window = false,
},
},
log = {
enable = false,
truncate = true,
types = {
all = false,
config = false,
copy_paste = false,
diagnostics = false,
git = false,
profile = false,
watcher = false,
},
}, },
}) })

View File

@ -1,6 +1,6 @@
require("go").setup() require("go").setup()
local format_sync_grp = vim.api.nvim_create_augroup("GoImport", {}) local format_sync_grp = vim.api.nvim_create_augroup("GoImport", {})
vim.api.nvim_create_autocmd("BufWritePre", { vim.api.nvim_create_autocmd("InsertLeavePre", {
pattern = "*.go", pattern = "*.go",
callback = function() callback = function()
require("go.format").goimport() require("go.format").goimport()

51
lua/plugins/java.lua Normal file
View File

@ -0,0 +1,51 @@
function IsFileExist(filename)
local f = io.open(filename)
if f ~= nil then
io.close(f)
return true
else
return false
end
end
function IsDirectoryExist(dirname)
return os.rename(dirname, dirname) and true or false
end
local jdtlspath = os.getenv("HOME") .. "/.jdtls"
if vim.loop.os_uname().sysname == "Windows" then
jdtlspath = os.getenv("HOME") .. "\\.jdtls"
end
-- 创建目录
if not IsFileExist(jdtlspath) then
os.execute("mkdir " .. jdtlspath)
end
-- 检测文件存在否
if not IsDirectoryExist(jdtlspath .. "/bin/jdtls") then
print("download jdtls binary")
local download_ret = os.execute(
"wget https://download.eclipse.org/jdtls/milestones/1.23.0/jdt-language-server-1.23.0-202304271346.tar.gz -P /tmp"
)
if download_ret ~= 0 then
vim.notify("download jdtls binary failed")
return
end
vim.notify("download jdtls success")
local tar_ret = os.execute("tar xvzf /tmp/jdt-language-server-1.23.0-202304271346.tar.gz -C " .. jdtlspath)
if tar_ret ~= 0 then
vim.notify("extract jdtls file failed")
return
end
end
local lombok_path = jdtlspath .. "/bin/lombok.jar"
-- 下载lombok
if not IsFileExist(jdtlspath .. "/bin/lombok.jar") then
vim.notify("download lombok.jar")
local download_ret = os.execute("wget https://projectlombok.org/downloads/lombok.jar -P " .. jdtlspath .. "/bin")
if download_ret ~= 0 then
vim.notify("download lombok failed")
end
end

View File

@ -3,6 +3,19 @@ require("lspsaga").setup({
colors = require("catppuccin.groups.integrations.lsp_saga").custom_colors(), colors = require("catppuccin.groups.integrations.lsp_saga").custom_colors(),
kind = require("catppuccin.groups.integrations.lsp_saga").custom_kind(), kind = require("catppuccin.groups.integrations.lsp_saga").custom_kind(),
}, },
diagnostic = {
show_code_action = true,
},
code_action = {
num_shortcut = true,
show_server_name = false,
extend_gitsigns = true,
keys = {
-- string | table type
quit = "q",
exec = "<CR>",
},
},
}) })
require("lsp-colors").setup({ require("lsp-colors").setup({

View File

@ -9,28 +9,64 @@ require("mason").setup({
}) })
require("mason-lspconfig").setup({ require("mason-lspconfig").setup({
ensure_installed = { ensure_installed = {},
"clangd",
"emmet_ls",
"cmake",
"gradle_ls",
"kotlin_language_server",
"lua_ls",
"rust_analyzer",
"gopls",
"golangci_lint_ls",
"tsserver",
"volar",
"taplo",
"yamlls",
"jsonls",
"jdtls",
"bashls",
"cssls",
"dockerls",
"docker_compose_language_service",
"eslint",
"html",
},
automatic_installation = true, automatic_installation = true,
}) })
require("mason-tool-installer").setup({
-- a list of all tools you want to ensure are installed upon
-- start; they should be the names Mason uses for each tool
ensure_installed = {
"bash-language-server",
"clangd",
"cmake-language-server",
"css-lsp",
"docker-compose-language-service",
"dockerfile-language-server",
"emmet-ls",
"eslint-lsp",
"goimports",
"goimports-reviser",
"golangci-lint",
"golangci-lint-langserver",
"golines",
"gopls",
"gradle-language-server",
"html-lsp",
"jdtls",
"json-lsp",
"kotlin-language-server",
"lua-language-server",
"rust-analyzer",
"rustfmt",
"stylua",
"taplo",
"typescript-language-server",
"vue-language-server",
"yaml-language-server",
"yamlfmt",
"yamllint",
},
-- if set to true this will check each tool for updates. If updates
-- are available the tool will be updated. This setting does not
-- affect :MasonToolsUpdate or :MasonToolsInstall.
-- Default: false
auto_update = true,
-- automatically install / update on startup. If set to false nothing
-- will happen on startup. You can use :MasonToolsInstall or
-- :MasonToolsUpdate to install tools and check for updates.
-- Default: true
run_on_start = true,
-- set a delay (in ms) before the installation starts. This is only
-- effective if run_on_start is set to true.
-- e.g.: 5000 = 5 second delay, 10000 = 10 second delay, etc...
-- Default: 0
start_delay = 15000, -- 3 second delay
-- Only attempt to install if 'debounce_hours' number of hours has
-- elapsed since the last time Neovim was started. This stores a
-- timestamp in a file named stdpath('data')/mason-tool-installer-debounce.
-- This is only relevant when you are using 'run_on_start'. It has no
-- effect when running manually via ':MasonToolsInstall' etc....
-- Default: nil
debounce_hours = 24, -- at least 5 hours between attempts to install/update
})

View File

@ -1 +1,5 @@
require("notify").setup({
background_colour = "#000000",
})
vim.notify = require("notify") vim.notify = require("notify")

View File

@ -1,10 +1,12 @@
local null_ls = require("null-ls") local null_ls = require("null-ls")
null_ls.setup({ null_ls.setup({
debounce = 500,
sources = { sources = {
null_ls.builtins.formatting.stylua, null_ls.builtins.formatting.stylua,
null_ls.builtins.formatting.gofmt, null_ls.builtins.formatting.gofmt,
null_ls.builtins.formatting.eslint_d, null_ls.builtins.formatting.eslint_d,
null_ls.builtins.formatting.yamlfmt,
null_ls.builtins.formatting.protolint, null_ls.builtins.formatting.protolint,
-- 诊断 -- 诊断
null_ls.builtins.diagnostics.eslint_d, null_ls.builtins.diagnostics.eslint_d,

12
lua/plugins/rust.lua Normal file
View File

@ -0,0 +1,12 @@
local rt = require("rust-tools")
rt.setup({
server = {
on_attach = function(_, bufnr)
-- Hover actions
vim.keymap.set("n", "<C-space>", rt.hover_actions.hover_actions, { buffer = bufnr })
-- Code action groups
vim.keymap.set("n", "<Leader>a", rt.code_action_group.code_action_group, { buffer = bufnr })
end,
},
})

View File

@ -44,6 +44,7 @@ return require("packer").startup(function(use)
"williamboman/mason-lspconfig.nvim", "williamboman/mason-lspconfig.nvim",
"neovim/nvim-lspconfig", "neovim/nvim-lspconfig",
"jose-elias-alvarez/null-ls.nvim", "jose-elias-alvarez/null-ls.nvim",
"WhoIsSethDaniel/mason-tool-installer.nvim",
}) })
-- 命令行 -- 命令行
use({ use({
@ -148,11 +149,15 @@ return require("packer").startup(function(use)
-- install jsregexp (optional!:). -- install jsregexp (optional!:).
run = "make install_jsregexp", run = "make install_jsregexp",
}) })
-- rust ide
use({ "simrat39/rust-tools.nvim" })
-- golang ide -- golang ide
use({ use({
"ray-x/go.nvim", "ray-x/go.nvim",
"ray-x/guihua.lua", -- recommended if need floating window support "ray-x/guihua.lua", -- recommended if need floating window support
}) })
-- java ide
use({ "mfussenegger/nvim-jdtls" })
-- 高亮当前关键词 -- 高亮当前关键词
use({ "RRethy/vim-illuminate" }) use({ "RRethy/vim-illuminate" })
-- 罗列文件中的所有url -- 罗列文件中的所有url