diff options
Diffstat (limited to 'store')
-rw-r--r-- | store/config/etc/fonts/local.conf | 60 | ||||
-rw-r--r-- | store/config/home/bashrc | 7 | ||||
-rw-r--r-- | store/config/mihomo/config.yaml | 85 | ||||
-rw-r--r-- | store/config/mihomo/need-rule | 4 | ||||
-rw-r--r-- | store/config/nvim/init.lua | 2 | ||||
-rw-r--r-- | store/config/nvim/lazy-lock.json | 11 | ||||
-rw-r--r-- | store/config/nvim/lua/plugins.lua | 1 | ||||
-rw-r--r-- | store/config/nvim/lua/setup/init.lua | 2 | ||||
-rw-r--r-- | store/config/nvim/lua/setup/lsp.lua | 47 | ||||
-rw-r--r-- | store/config/nvim/lua/setup/plugins/conform.lua | 18 | ||||
-rw-r--r-- | store/config/nvim/lua/setup/plugins/init.lua | 1 | ||||
-rw-r--r-- | store/config/nvim/lua/setup/plugins/lint.lua | 80 | ||||
-rw-r--r-- | store/config/nvim/lua/setup/win.lua | 1 |
13 files changed, 201 insertions, 118 deletions
diff --git a/store/config/etc/fonts/local.conf b/store/config/etc/fonts/local.conf new file mode 100644 index 0000000..a8dbe2b --- /dev/null +++ b/store/config/etc/fonts/local.conf @@ -0,0 +1,60 @@ +<?xml version="1.0"?> +<!DOCTYPE fontconfig SYSTEM "urn:fontconfig:fonts.dtd"> +<fontconfig> + + <alias> + <family>sans-serif</family> + <prefer> + <family>MiSans</family> + </prefer> + </alias> + + <alias> + <family>serif</family> + <prefer> + <family>MiSans</family> + </prefer> + </alias> + + <alias> + <family>monospace</family> + <prefer> + <family>Maple Mono</family> + </prefer> + </alias> + + <alias> + <family>MiSans</family> + <prefer> + <family>MiSans</family> + <family>Noto Color Emoji</family> + </prefer> + </alias> + + <alias> + <family>Maple Mono</family> + <prefer> + <family>Maple Mono</family> + <family>Maple Mono NF</family> + <family>Maple Mono NF CN</family> + <family>Noto Color Emoji</family> + </prefer> + </alias> + + <alias> + <family>Noto Sans</family> + <prefer> + <family>Noto Sans</family> + <family>Noto Sans CJK SC</family> + </prefer> + </alias> + + <alias> + <family>Noto Serif</family> + <prefer> + <family>Noto Serif</family> + <family>Noto Serif CJK SC</family> + </prefer> + </alias> + +</fontconfig>
\ No newline at end of file diff --git a/store/config/home/bashrc b/store/config/home/bashrc index 1ab3b08..e59b2a4 100644 --- a/store/config/home/bashrc +++ b/store/config/home/bashrc @@ -1,8 +1,13 @@ set-proxy() { + export http_proxy="http://127.0.0.1:7897" + export https_proxy="http://127.0.0.1:7897" export HTTP_PROXY="http://127.0.0.1:7897" export HTTPS_PROXY="http://127.0.0.1:7897" } unset-proxy() { - unset HTTP_PROXY HTTPS_PROXY + unset http_proxy + unset https_proxy + unset HTTP_PROXY + unset HTTPS_PROXY } diff --git a/store/config/mihomo/config.yaml b/store/config/mihomo/config.yaml index cd2c3a3..c455409 100644 --- a/store/config/mihomo/config.yaml +++ b/store/config/mihomo/config.yaml @@ -26,56 +26,61 @@ dns: ipv6: true default-nameserver: - 223.5.5.5 + - 119.29.29.29 nameserver: +# - 9.9.9.11 +# - tls://1.1.1.1 + - https://doh.pub/dns-query - https://dns.alidns.com/dns-query - 223.5.5.5 - - 8.8.8.8 - - 1.1.1.1 + - 119.29.29.29 + +sniffer: + enable: true + sniff: + HTTP: + ports: [80] + TLS: + ports: [443] + QUIC: + ports: [443] + skip-domain: + - "Mijia Cloud" + +rule-providers: + cn: + type: file + path: has-rule + behavior: classical + format: text + + non-cn: + type: file + path: not-has-rule + behavior: classical + format: text + + need: + type: file + path: need-rule + behavior: classical + format: text rules: - - GEOSITE,github,node-select - - GEOSITE,google,node-select - - GEOSITE,youtube,node-select - - GEOSITE,twitter,node-select - - GEOSITE,facebook,node-select - - GEOSITE,discord,node-select - - GEOSITE,reddit,node-select - - GEOSITE,twitch,node-select - - GEOSITE,quora,node-select - - GEOSITE,telegram,node-select - - GEOSITE,imgur,node-select - - GEOSITE,stackexchange,node-select - - GEOSITE,onedrive,node-select - - GEOSITE,duckduckgo,node-select - - GEOSITE,wikimedia,node-select - - GEOSITE,gitbook,node-select - - GEOSITE,gitlab,node-select - - GEOSITE,creativecommons,node-select - - GEOSITE,archive,node-select - - GEOSITE,matrix,node-select - - GEOSITE,tor,node-select - - GEOSITE,python,node-select - - GEOSITE,ruby,node-select - - GEOSITE,rust,node-select - - GEOSITE,nodejs,node-select - - GEOSITE,npmjs,node-select - - GEOSITE,qt,node-select - - GEOSITE,docker,node-select - - GEOSITE,v2ray,node-select - - GEOSITE,homebrew,node-select - - GEOSITE,bootstrap,node-select - - GEOSITE,heroku,node-select - - GEOSITE,vercel,node-select - - GEOSITE,ieee,node-select - - GEOSITE,sci-hub,node-select - - GEOSITE,libgen,node-select + - RULE-SET,cn,DIRECT + - RULE-SET,non-cn,node-select + - RULE-SET,need,node-select +# - NOT,((GEOIP,CN)),node-select - DOMAIN-SUFFIX,gnu.org,node-select - DOMAIN-SUFFIX,nongnu.org,node-select - DOMAIN-SUFFIX,ietf.org,node-select - - DOMAIN-SUFFIX,packagist.org,node-select - DOMAIN-SUFFIX,metacubex.one,node-select - DOMAIN-SUFFIX,winehq.org,node-select - - DOMAIN-SUFFIX,postfix.org,node-select + - DOMAIN-SUFFIX,freedesktop.org,node-select + - DOMAIN-SUFFIX,eff.org,node-select + - DOMAIN-SUFFIX,typescriptlang.org,node-select + - DOMAIN-SUFFIX,arxiv.org,node-select +# - MATCH,node-select - MATCH,DIRECT proxy-groups: diff --git a/store/config/mihomo/need-rule b/store/config/mihomo/need-rule new file mode 100644 index 0000000..7ffcf49 --- /dev/null +++ b/store/config/mihomo/need-rule @@ -0,0 +1,4 @@ +IP-CIDR,185.199.108.153/32 +IP-CIDR,185.199.109.153/32 +IP-CIDR,185.199.110.153/32 +IP-CIDR,185.199.111.153/32
\ No newline at end of file diff --git a/store/config/nvim/init.lua b/store/config/nvim/init.lua index d038019..ac6961a 100644 --- a/store/config/nvim/init.lua +++ b/store/config/nvim/init.lua @@ -1,3 +1,5 @@ +vim.crupest = {} + local lazy_path = vim.fn.stdpath("data") .. "/lazy/lazy.nvim" if not vim.uv.fs_stat(lazy_path) then vim.fn.system({ diff --git a/store/config/nvim/lazy-lock.json b/store/config/nvim/lazy-lock.json index f323937..4f6c2b5 100644 --- a/store/config/nvim/lazy-lock.json +++ b/store/config/nvim/lazy-lock.json @@ -3,16 +3,15 @@ "cmp-buffer": { "branch": "main", "commit": "b74fab3656eea9de20a9b8116afa3cfc4ec09657" }, "cmp-nvim-lsp": { "branch": "main", "commit": "a8912b88ce488f411177fc8aed358b04dc246d7b" }, "cmp-path": { "branch": "main", "commit": "c6635aae33a50d6010bf1aa756ac2398a2d54c32" }, - "conform.nvim": { "branch": "master", "commit": "0e93e0d12d2f7ebdea9e3e444dfaff0050cefbe6" }, - "gitsigns.nvim": { "branch": "main", "commit": "d0f90ef51d4be86b824b012ec52ed715b5622e51" }, + "gitsigns.nvim": { "branch": "main", "commit": "731b581428ec6c1ccb451b95190ebbc6d7006db7" }, "lazy.nvim": { "branch": "main", "commit": "6c3bda4aca61a13a9c63f1c1d1b16b9d3be90d7a" }, - "lualine.nvim": { "branch": "master", "commit": "0c6cca9f2c63dadeb9225c45bc92bb95a151d4af" }, + "lualine.nvim": { "branch": "master", "commit": "a94fc68960665e54408fe37dcf573193c4ce82c9" }, "neo-tree.nvim": { "branch": "v3.x", "commit": "f481de16a0eb59c985abac8985e3f2e2f75b4875" }, - "nui.nvim": { "branch": "main", "commit": "7cd18e73cfbd70e1546931b7268b3eebaeff9391" }, + "nui.nvim": { "branch": "main", "commit": "de740991c12411b663994b2860f1a4fd0937c130" }, "nvim-autopairs": { "branch": "master", "commit": "4d74e75913832866aa7de35e4202463ddf6efd1b" }, "nvim-cmp": { "branch": "main", "commit": "b5311ab3ed9c846b585c0c15b7559be131ec4be9" }, - "nvim-lint": { "branch": "master", "commit": "cc26ae6a620298bb3f33b0e0681f99a10ae57781" }, - "nvim-lspconfig": { "branch": "master", "commit": "a182334ba933e58240c2c45e6ae2d9c7ae313e00" }, + "nvim-lint": { "branch": "master", "commit": "2b0039b8be9583704591a13129c600891ac2c596" }, + "nvim-lspconfig": { "branch": "master", "commit": "7ad4a11cc5742774877c529fcfb2702f7caf75e4" }, "nvim-treesitter": { "branch": "master", "commit": "42fc28ba918343ebfd5565147a42a26580579482" }, "nvim-web-devicons": { "branch": "master", "commit": "1fb58cca9aebbc4fd32b086cb413548ce132c127" }, "plenary.nvim": { "branch": "master", "commit": "857c5ac632080dba10aae49dba902ce3abf91b35" }, diff --git a/store/config/nvim/lua/plugins.lua b/store/config/nvim/lua/plugins.lua index 8458575..85de362 100644 --- a/store/config/nvim/lua/plugins.lua +++ b/store/config/nvim/lua/plugins.lua @@ -37,5 +37,4 @@ return { { "hrsh7th/cmp-path" }, { "windwp/nvim-autopairs" }, { "mfussenegger/nvim-lint" }, - { 'stevearc/conform.nvim' } } diff --git a/store/config/nvim/lua/setup/init.lua b/store/config/nvim/lua/setup/init.lua index ec8c8d4..bbce01c 100644 --- a/store/config/nvim/lua/setup/init.lua +++ b/store/config/nvim/lua/setup/init.lua @@ -1,5 +1,3 @@ --- spellchecker: words termguicolors - local function close_float() local wins = vim.api.nvim_list_wins() for _, v in ipairs(wins) do diff --git a/store/config/nvim/lua/setup/lsp.lua b/store/config/nvim/lua/setup/lsp.lua index a11ad34..4216f1c 100644 --- a/store/config/nvim/lua/setup/lsp.lua +++ b/store/config/nvim/lua/setup/lsp.lua @@ -1,5 +1,3 @@ --- spellchecker: words denols luals - vim.lsp.config("*", { capabilities = vim.tbl_extend("force", vim.lsp.protocol.make_client_capabilities(), @@ -24,15 +22,23 @@ local function setup_clangd() vim.lsp.config("clangd", { cmd = { clangd } }) - vim.api.nvim_create_autocmd('LspAttach', { + vim.api.nvim_create_autocmd("LspAttach", { callback = function(ev) if client_name_is(ev, "clangd") then - vim.keymap.set('n', 'grs', "<cmd>ClangdSwitchSourceHeader<cr>", { + vim.keymap.set("n", "grs", "<cmd>ClangdSwitchSourceHeader<cr>", { buffer = ev.buf }) end end }) + + vim.api.nvim_create_autocmd("LspDetach", { + callback = function(ev) + if client_name_is(ev, "clangd") then + vim.keymap.del("n", "grs", { buffer = ev.buf }) + end + end + }) end local function setup_lua_ls() @@ -57,6 +63,11 @@ local function setup_lua_ls() }) end +function vim.crupest.no_range_format() + print("Lsp doesn't support range formatting. Use gqa to format the whole document.") + return 0 +end + local function setup_denols() vim.lsp.config("denols", { root_dir = function(bufnr, on_dir) @@ -69,10 +80,22 @@ local function setup_denols() end, }) - vim.api.nvim_create_autocmd('LspAttach', { + vim.api.nvim_create_autocmd("LspAttach", { callback = function(ev) if client_name_is(ev, "denols") then - vim.o.formatexpr = "v:lua.require'conform'.formatexpr()" + vim.api.nvim_set_option_value( + "formatexpr", + "v:lua.vim.crupest.no_range_format()", + { buf = ev.buf } + ) + end + end + }) + + vim.api.nvim_create_autocmd("LspDetach", { + callback = function(ev) + if client_name_is(ev, "denols") then + vim.api.nvim_set_option_value("formatexpr", "", { buf = ev.buf }) end end }) @@ -80,6 +103,18 @@ end local function setup() + vim.api.nvim_create_autocmd("LspAttach", { + callback = function(ev) + vim.keymap.set("n", "gqa", vim.lsp.buf.format, { buffer = ev.buf }) + end + }) + + vim.api.nvim_create_autocmd("LspDetach", { + callback = function(ev) + vim.keymap.del("n", "gqa", { buffer = ev.buf }) + end + }) + setup_clangd() setup_lua_ls() setup_denols() diff --git a/store/config/nvim/lua/setup/plugins/conform.lua b/store/config/nvim/lua/setup/plugins/conform.lua deleted file mode 100644 index e14c3f9..0000000 --- a/store/config/nvim/lua/setup/plugins/conform.lua +++ /dev/null @@ -1,18 +0,0 @@ -local function setup() - require("conform").setup({ - formatters_by_ft = { - javascript = { "prettierd", "prettier", stop_after_first = true }, - typescript = { "prettierd", "prettier", stop_after_first = true }, - javascriptreact = { "prettierd", "prettier", stop_after_first = true }, - typescriptreact = { "prettierd", "prettier", stop_after_first = true }, - markdown = { "prettierd", "prettier", stop_after_first = true }, - }, - default_format_opts = { - lsp_format = "fallback", - }, - }) -end - -return { - setup = setup -} diff --git a/store/config/nvim/lua/setup/plugins/init.lua b/store/config/nvim/lua/setup/plugins/init.lua index 88eca4f..8f1346b 100644 --- a/store/config/nvim/lua/setup/plugins/init.lua +++ b/store/config/nvim/lua/setup/plugins/init.lua @@ -15,7 +15,6 @@ local function setup() require("setup.plugins.tree-sitter").setup() require("setup.plugins.lint").setup() - require("setup.plugins.conform").setup() require("setup.plugins.cmp").setup() require("nvim-autopairs").setup {} end diff --git a/store/config/nvim/lua/setup/plugins/lint.lua b/store/config/nvim/lua/setup/plugins/lint.lua index 928841d..d03f539 100644 --- a/store/config/nvim/lua/setup/plugins/lint.lua +++ b/store/config/nvim/lua/setup/plugins/lint.lua @@ -1,4 +1,6 @@ -local lint = require("lint") +--- spellchecker: ignore markdownlintrc + +---@alias CruLinter { name: string, config_patterns: string[], filetypes: string[] | nil, fast: boolean } local cspell = { name = "cspell", @@ -31,15 +33,30 @@ local markdownlint = { fast = true, } -local linters = { cspell, markdownlint } - -local linter_names = vim.tbl_map(function(l) return l.name end, linters) +local linters = { cspell = cspell, markdownlint = markdownlint } -local function cru_lint(linter, opt) - opt = opt or {} +---@param linter CruLinter +---@param buf integer +---@return string | nil +local function find_config(linter, buf) + local files = vim.fs.find(linter.config_patterns, { + path = vim.api.nvim_buf_get_name(buf), upward = true }) + if #files ~= 0 then + return files[1]; + end + return nil +end - local buf = opt.buf or 0 +vim.list_extend(require("lint.linters.markdownlint").args, { + "--config", + function() + return find_config(markdownlint, 0); + end +}) +---@param linter CruLinter +---@param buf integer +function vim.crupest.lint(linter, buf) if linter.filetypes then local filetype = vim.api.nvim_get_option_value("filetype", { buf = buf }) if not vim.list_contains(linter.filetypes, filetype) then @@ -47,50 +64,29 @@ local function cru_lint(linter, opt) end end - if 0 ~= #vim.fs.find(linter.config_patterns, { - path = vim.api.nvim_buf_get_name(opt.buf), upward = true }) then - lint.try_lint(linter.name) + if find_config(linter, buf) then + require("lint").try_lint(linter.name) end end -local function cru_lint_one(name, opt) - for _, linter in ipairs(linters) do - if linter.name == name then - cru_lint(linter, opt) - return - end - end - vim.notify("No linter named " .. name .. " is configured.", vim.log.levels.ERROR, {}) -end - -local function cru_lint_all(opt, fast) - for _, linter in ipairs(linters) do +function vim.crupest.lint_all(buf, fast) + for _, linter in pairs(linters) do if not fast or linter.fast then - cru_lint(linter, opt) + vim.crupest.lint(linter, buf) end end end -local function cru_lint_all_fast(opt) - local buf = opt.buf - if vim.api.nvim_get_option_value("buftype", { buf = buf }) == "" then - cru_lint_all(opt, true) - end -end - local function setup() - vim.api.nvim_create_autocmd({ "BufReadPost", "InsertLeave", "TextChanged" }, { callback = cru_lint_all_fast }) - - local function cru_lint_cmd(opt) - if #opt.args == 0 then - cru_lint_all(opt, false) - else - cru_lint_one(opt.args, opt) - end - end - - vim.api.nvim_create_user_command("CruLint", cru_lint_cmd, - { nargs = '?', complete = function() return linter_names end }) + vim.api.nvim_create_autocmd( + { "BufReadPost", "InsertLeave", "TextChanged" }, + { + callback = function(opt) + if vim.api.nvim_get_option_value("buftype", { buf = opt.buf }) == "" then + vim.crupest.lint_all(opt.buf, true) + end + end + }) end return { diff --git a/store/config/nvim/lua/setup/win.lua b/store/config/nvim/lua/setup/win.lua index 90e168a..9aa979d 100644 --- a/store/config/nvim/lua/setup/win.lua +++ b/store/config/nvim/lua/setup/win.lua @@ -1,4 +1,3 @@ --- spellchecker: words pwsh -- spellchecker: ignore shellcmdflag shellredir shellpipe shellquote shellxquote local function setup() vim.cmd([[ |