From abf1eb828f956ac95b76b252cc8fe0198090eca8 Mon Sep 17 00:00:00 2001 From: Yuqian Yang Date: Wed, 4 Jun 2025 18:42:09 +0800 Subject: chore(config): move dir. --- store/bin/neovide-listen | 49 +++++++++++ store/bin/nvr-wait | 4 + store/config/aichat/roles/blogger.md | 4 + store/config/aichat/roles/coder.md | 5 ++ store/config/halloy/config.toml | 20 +++++ store/config/home/bash_profile | 1 + store/config/home/bashrc | 8 ++ store/config/home/gitconfig | 11 +++ store/config/mihomo/config.yaml | 96 +++++++++++++++++++++ store/config/nvim/init.lua | 24 ++++++ store/config/nvim/lazy-lock.json | 19 +++++ store/config/nvim/lua/plugins.lua | 35 ++++++++ store/config/nvim/lua/setup/init.lua | 46 ++++++++++ store/config/nvim/lua/setup/lsp.lua | 67 +++++++++++++++ store/config/nvim/lua/setup/plugins/cmp.lua | 30 +++++++ store/config/nvim/lua/setup/plugins/gitsigns.lua | 40 +++++++++ store/config/nvim/lua/setup/plugins/init.lua | 16 ++++ store/config/nvim/lua/setup/plugins/lint.lua | 98 ++++++++++++++++++++++ store/config/nvim/lua/setup/plugins/telescope.lua | 28 +++++++ .../config/nvim/lua/setup/plugins/tree-sitter.lua | 11 +++ store/config/nvim/lua/setup/win.lua | 16 ++++ store/home/bash_profile | 1 - store/home/bashrc | 8 -- store/home/bin/neovide-listen | 49 ----------- store/home/bin/nvr-wait | 4 - store/home/config/aichat/roles/blogger.md | 4 - store/home/config/aichat/roles/coder.md | 5 -- store/home/config/halloy/config.toml | 20 ----- store/home/config/mihomo/config.yaml | 96 --------------------- store/home/config/nvim/init.lua | 24 ------ store/home/config/nvim/lazy-lock.json | 19 ----- store/home/config/nvim/lua/plugins.lua | 35 -------- store/home/config/nvim/lua/setup/init.lua | 46 ---------- store/home/config/nvim/lua/setup/lsp.lua | 67 --------------- store/home/config/nvim/lua/setup/plugins/cmp.lua | 30 ------- .../config/nvim/lua/setup/plugins/gitsigns.lua | 40 --------- store/home/config/nvim/lua/setup/plugins/init.lua | 16 ---- store/home/config/nvim/lua/setup/plugins/lint.lua | 98 ---------------------- .../config/nvim/lua/setup/plugins/telescope.lua | 28 ------- .../config/nvim/lua/setup/plugins/tree-sitter.lua | 11 --- store/home/config/nvim/lua/setup/win.lua | 16 ---- store/home/gitconfig | 11 --- 42 files changed, 628 insertions(+), 628 deletions(-) create mode 100755 store/bin/neovide-listen create mode 100755 store/bin/nvr-wait create mode 100644 store/config/aichat/roles/blogger.md create mode 100644 store/config/aichat/roles/coder.md create mode 100644 store/config/halloy/config.toml create mode 100644 store/config/home/bash_profile create mode 100644 store/config/home/bashrc create mode 100644 store/config/home/gitconfig create mode 100644 store/config/mihomo/config.yaml create mode 100644 store/config/nvim/init.lua create mode 100644 store/config/nvim/lazy-lock.json create mode 100644 store/config/nvim/lua/plugins.lua create mode 100644 store/config/nvim/lua/setup/init.lua create mode 100644 store/config/nvim/lua/setup/lsp.lua create mode 100644 store/config/nvim/lua/setup/plugins/cmp.lua create mode 100644 store/config/nvim/lua/setup/plugins/gitsigns.lua create mode 100644 store/config/nvim/lua/setup/plugins/init.lua create mode 100644 store/config/nvim/lua/setup/plugins/lint.lua create mode 100644 store/config/nvim/lua/setup/plugins/telescope.lua create mode 100644 store/config/nvim/lua/setup/plugins/tree-sitter.lua create mode 100644 store/config/nvim/lua/setup/win.lua delete mode 100644 store/home/bash_profile delete mode 100644 store/home/bashrc delete mode 100755 store/home/bin/neovide-listen delete mode 100755 store/home/bin/nvr-wait delete mode 100644 store/home/config/aichat/roles/blogger.md delete mode 100644 store/home/config/aichat/roles/coder.md delete mode 100644 store/home/config/halloy/config.toml delete mode 100644 store/home/config/mihomo/config.yaml delete mode 100644 store/home/config/nvim/init.lua delete mode 100644 store/home/config/nvim/lazy-lock.json delete mode 100644 store/home/config/nvim/lua/plugins.lua delete mode 100644 store/home/config/nvim/lua/setup/init.lua delete mode 100644 store/home/config/nvim/lua/setup/lsp.lua delete mode 100644 store/home/config/nvim/lua/setup/plugins/cmp.lua delete mode 100644 store/home/config/nvim/lua/setup/plugins/gitsigns.lua delete mode 100644 store/home/config/nvim/lua/setup/plugins/init.lua delete mode 100644 store/home/config/nvim/lua/setup/plugins/lint.lua delete mode 100644 store/home/config/nvim/lua/setup/plugins/telescope.lua delete mode 100644 store/home/config/nvim/lua/setup/plugins/tree-sitter.lua delete mode 100644 store/home/config/nvim/lua/setup/win.lua delete mode 100644 store/home/gitconfig (limited to 'store') diff --git a/store/bin/neovide-listen b/store/bin/neovide-listen new file mode 100755 index 0000000..3bcc7da --- /dev/null +++ b/store/bin/neovide-listen @@ -0,0 +1,49 @@ +#!/usr/bin/env bash + +export CRU_NVIM_SERVER=${CRU_NVIM_SERVER:-/tmp/nvimsocket} + +args=() + +self_built_nvim="$HOME/codes/neovim/build/bin/nvim" +self_built_nvim_runtime="$HOME/codes/neovim/runtime" +if [[ -z "$CRU_NVIM" ]] && [[ -e "$self_built_nvim" ]]; then + echo "Found self-built neovim at $CRU_NVIM" + CRU_NVIM="$self_built_nvim" + CRU_VIMRUNTIME="$self_built_nvim_runtime" +fi + +[[ -z "$CRU_NVIM" ]] || args=("${args[@]}" "--neovim-bin" "$CRU_NVIM") +export CRU_NVIM=${CRU_NVIM:-nvim} +[[ -z "$CRU_VIMRUNTIME" ]] || export VIMRUNTIME="$CRU_VIMRUNTIME" + +self_built_neovide="$HOME/codes/neovide/target/release/neovide" +if [[ -z "$CRU_NEOVIDE" ]] && [[ -e "$self_built_neovide" ]]; then + echo "Found self-build of neovide at $self_built_neovide" + CRU_NEOVIDE="$self_built_neovide" +fi +export CRU_NEOVIDE=${CRU_NEOVIDE:-neovide} + +listen_added=0 +for arg in "$@"; do + args=("${args[@]}" "$arg") + if [[ "$arg" == "--" ]]; then + args=("${args[@]}" "--listen" "$CRU_NVIM_SERVER") + listen_added=1 + fi +done + +if [[ $listen_added = 0 ]]; then + args=("${args[@]}" "--" "--listen" "$CRU_NVIM_SERVER") +fi + +if which nvr > /dev/null; then + echo "Found nvr, set VISUAL EDITOR GIT_EDITOR to nvr-wait" + export VISUAL="nvr-wait" + export EDITOR="$VISUAL" + export GIT_EDITOR="$VISUAL" +fi + +args=("$CRU_NEOVIDE" "${args[@]}") +echo "Full command is ${args[@]}" +exec "${args[@]}" + diff --git a/store/bin/nvr-wait b/store/bin/nvr-wait new file mode 100755 index 0000000..410d42d --- /dev/null +++ b/store/bin/nvr-wait @@ -0,0 +1,4 @@ +#!/bin/sh + +export CRU_NVIM_SERVER=${CRU_NVIM_SERVER:-/tmp/nvimsocket} +exec nvr --nostart --servername "$CRU_NVIM_SERVER" -cc split --remote-wait "$@" diff --git a/store/config/aichat/roles/blogger.md b/store/config/aichat/roles/blogger.md new file mode 100644 index 0000000..b2ebb65 --- /dev/null +++ b/store/config/aichat/roles/blogger.md @@ -0,0 +1,4 @@ +model: deepseek:deepseek-chat + +--- +You are DeepSeek, an AI assistant specialized in English writing. Your task is to refine my writings and explain the changes to help me improve my English writing skills. diff --git a/store/config/aichat/roles/coder.md b/store/config/aichat/roles/coder.md new file mode 100644 index 0000000..ae5458b --- /dev/null +++ b/store/config/aichat/roles/coder.md @@ -0,0 +1,5 @@ +model: deepseek:deepseek-chat +temperature: 0 + +--- +You are an AI programming assistant. Help users write, debug, and optimize code. Provide clear, well-commented examples, explain concepts simply, and suggest multiple solutions when possible. Prioritize best practices like readability, efficiency, and security. Ask clarifying questions if the request is unclear. diff --git a/store/config/halloy/config.toml b/store/config/halloy/config.toml new file mode 100644 index 0000000..5d39f52 --- /dev/null +++ b/store/config/halloy/config.toml @@ -0,0 +1,20 @@ +tooltips = true + +[notifications] +direct_message = { sound = "peck", show_toast = true } +connected = { sound = "ring", show_toast = true } +disconnected = { sound = "ring", show_toast = true } + +[notifications.highlight] +sound = "dong" +exclude = [ "NickServ" ] + +[servers.liberachat] +nickname = "crupest" +server = "irc.libera.chat" +channels = [ "#hurd" ] +use_tls = true + +[servers.liberachat.sasl.plain] +username = "crupest" +password = ... diff --git a/store/config/home/bash_profile b/store/config/home/bash_profile new file mode 100644 index 0000000..b65f405 --- /dev/null +++ b/store/config/home/bash_profile @@ -0,0 +1 @@ +export PATH="$HOME/.local/bin:$PATH" diff --git a/store/config/home/bashrc b/store/config/home/bashrc new file mode 100644 index 0000000..1ab3b08 --- /dev/null +++ b/store/config/home/bashrc @@ -0,0 +1,8 @@ +set-proxy() { + 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 +} diff --git a/store/config/home/gitconfig b/store/config/home/gitconfig new file mode 100644 index 0000000..4b88c56 --- /dev/null +++ b/store/config/home/gitconfig @@ -0,0 +1,11 @@ +[user] + name = Yuqian Yang + email = crupest@crupest.life +[core] + autocrlf = false + editor = vim +[credential] + helper = /usr/lib/git-core/git-credential-libsecret +[alias] + lg = log --decorate --oneline --graph + pap = push --all --prune diff --git a/store/config/mihomo/config.yaml b/store/config/mihomo/config.yaml new file mode 100644 index 0000000..cd2c3a3 --- /dev/null +++ b/store/config/mihomo/config.yaml @@ -0,0 +1,96 @@ +mixed-port: 7897 +mode: rule +log-level: info +external-controller: 127.0.0.1:9090 +profile: + store-selected: true + +external-ui: ui/metacubexd +external-ui-name: metacubexd +external-ui-url: https://github.com/MetaCubeX/metacubexd/archive/refs/heads/gh-pages.zip + +geox-url: + geoip: https://testingcf.jsdelivr.net/gh/MetaCubeX/meta-rules-dat@release/geoip.dat + geosite: https://testingcf.jsdelivr.net/gh/MetaCubeX/meta-rules-dat@release/geosite.dat + mmdb: https://testingcf.jsdelivr.net/gh/MetaCubeX/meta-rules-dat@release/country.mmdb + asn: https://testingcf.jsdelivr.net/gh/MetaCubeX/meta-rules-dat@release/GeoLite2-ASN.mmdb +geo-auto-update: true +geo-update-interval: 24 + +ipv6: false +unified-delay: true +global-client-fingerprint: edge + +dns: + enable: true + ipv6: true + default-nameserver: + - 223.5.5.5 + nameserver: + - https://dns.alidns.com/dns-query + - 223.5.5.5 + - 8.8.8.8 + - 1.1.1.1 + +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 + - 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 + - MATCH,DIRECT + +proxy-groups: + - name: node-select + type: select + proxies: + - auto-select + use: + - money + + - name: auto-select + type: url-test + use: + - money + interval: 300 + url: https://www.gstatic.com/generate_204 + filter: 日本|新加坡|香港|台湾|美国 + expected-status: 204 diff --git a/store/config/nvim/init.lua b/store/config/nvim/init.lua new file mode 100644 index 0000000..95d1c30 --- /dev/null +++ b/store/config/nvim/init.lua @@ -0,0 +1,24 @@ +local lazy_path = vim.fn.stdpath("data") .. "/lazy/lazy.nvim" +if not vim.uv.fs_stat(lazy_path) then + vim.fn.system({ + "git", + "clone", + "--filter=blob:none", + "https://github.com/folke/lazy.nvim.git", + "--branch=stable", -- latest stable release + lazy_path, + }) +end +vim.opt.rtp:prepend(lazy_path) +require("lazy").setup("plugins") + +if vim.g.neovide then + vim.opt.guifont = "Maple Mono NF"; + vim.g.neovide_normal_opacity = 0.95; + vim.g.neovide_input_ime = false; + vim.g.neovide_cursor_animate_in_insert_mode = false + vim.g.neovide_input_macos_option_key_is_meta = 'only_left' + vim.cmd("colorscheme catppuccin-macchiato") +end + +require("setup").setup() diff --git a/store/config/nvim/lazy-lock.json b/store/config/nvim/lazy-lock.json new file mode 100644 index 0000000..9869b1d --- /dev/null +++ b/store/config/nvim/lazy-lock.json @@ -0,0 +1,19 @@ +{ + "catppuccin": { "branch": "main", "commit": "a0c769bc7cd04bbbf258b3d5f01e2bdce744108d" }, + "cmp-buffer": { "branch": "main", "commit": "b74fab3656eea9de20a9b8116afa3cfc4ec09657" }, + "cmp-nvim-lsp": { "branch": "main", "commit": "a8912b88ce488f411177fc8aed358b04dc246d7b" }, + "cmp-path": { "branch": "main", "commit": "c6635aae33a50d6010bf1aa756ac2398a2d54c32" }, + "gitsigns.nvim": { "branch": "main", "commit": "d0f90ef51d4be86b824b012ec52ed715b5622e51" }, + "lazy.nvim": { "branch": "main", "commit": "6c3bda4aca61a13a9c63f1c1d1b16b9d3be90d7a" }, + "lualine.nvim": { "branch": "master", "commit": "0c6cca9f2c63dadeb9225c45bc92bb95a151d4af" }, + "neo-tree.nvim": { "branch": "v3.x", "commit": "f481de16a0eb59c985abac8985e3f2e2f75b4875" }, + "nui.nvim": { "branch": "main", "commit": "7cd18e73cfbd70e1546931b7268b3eebaeff9391" }, + "nvim-autopairs": { "branch": "master", "commit": "4d74e75913832866aa7de35e4202463ddf6efd1b" }, + "nvim-cmp": { "branch": "main", "commit": "b5311ab3ed9c846b585c0c15b7559be131ec4be9" }, + "nvim-lint": { "branch": "master", "commit": "b47cbb249351873e3a571751c3fb66ed6369852f" }, + "nvim-lspconfig": { "branch": "master", "commit": "8adb3b5938f6074a1bcc36d3c3916f497d2e8ec4" }, + "nvim-treesitter": { "branch": "master", "commit": "42fc28ba918343ebfd5565147a42a26580579482" }, + "nvim-web-devicons": { "branch": "master", "commit": "1fb58cca9aebbc4fd32b086cb413548ce132c127" }, + "plenary.nvim": { "branch": "master", "commit": "857c5ac632080dba10aae49dba902ce3abf91b35" }, + "telescope.nvim": { "branch": "master", "commit": "b4da76be54691e854d3e0e02c36b0245f945c2c7" } +} diff --git a/store/config/nvim/lua/plugins.lua b/store/config/nvim/lua/plugins.lua new file mode 100644 index 0000000..480ea8f --- /dev/null +++ b/store/config/nvim/lua/plugins.lua @@ -0,0 +1,35 @@ +-- spellchecker: disable +return { + { "catppuccin/nvim", name = "catppuccin", priority = 1000 }, + "neovim/nvim-lspconfig", + "hrsh7th/nvim-cmp", + "hrsh7th/cmp-nvim-lsp", + "hrsh7th/cmp-buffer", + "hrsh7th/cmp-path", + { + "nvim-treesitter/nvim-treesitter", + build = ":TSUpdate" + }, + { + "nvim-neo-tree/neo-tree.nvim", + branch = "v3.x", + dependencies = { + "nvim-lua/plenary.nvim", + "nvim-tree/nvim-web-devicons", -- not strictly required, but recommended + "MunifTanjim/nui.nvim", + -- {"3rd/image.nvim", opts = {}}, -- Optional image support in preview window: See `# Preview Mode` for more information + }, + lazy = false, -- neo-tree will lazily load itself + }, + { + "nvim-lualine/lualine.nvim", + dependencies = { 'nvim-tree/nvim-web-devicons' } + }, + { + "nvim-telescope/telescope.nvim", + dependencies = { 'nvim-lua/plenary.nvim' } + }, + "windwp/nvim-autopairs", + "mfussenegger/nvim-lint", + "lewis6991/gitsigns.nvim", +} diff --git a/store/config/nvim/lua/setup/init.lua b/store/config/nvim/lua/setup/init.lua new file mode 100644 index 0000000..df3eb3d --- /dev/null +++ b/store/config/nvim/lua/setup/init.lua @@ -0,0 +1,46 @@ +local function close_float() + local wins = vim.api.nvim_list_wins() + for _, v in ipairs(wins) do + if vim.api.nvim_win_get_config(v).relative ~= '' then + vim.api.nvim_win_close(v, false) + end + end +end + +local function setup() + if vim.fn.has("win32") ~= 0 then + require("setup.win").setup() + end + + -- spellchecker: ignore termguicolors + vim.opt.termguicolors = true; + vim.opt.fileformats = "unix,dos"; + vim.opt.number = true; + + vim.g.load_doxygen_syntax = true; + vim.g.doxygen_javadoc_autobrief = false; + + vim.keymap.set("n", "", "bnext") + vim.keymap.set("n", "", "bNext") + vim.keymap.set("n", "", close_float) + vim.keymap.set('t', '', '') + vim.keymap.set('t', '', function() + local register = vim.fn.input("Enter register: ") + if register == "" then + register = '"' + end + return '"' .. register .. 'pi' + end, { expr = true }) + + vim.cmd("autocmd FileType gitcommit,gitrebase,gitconfig set bufhidden=delete") + + vim.diagnostic.config({ virtual_text = true }) + vim.keymap.set("n", "grl", vim.diagnostic.open_float) + + require("setup.lsp").setup() + require("setup.plugins").setup() +end + +return { + setup = setup +} diff --git a/store/config/nvim/lua/setup/lsp.lua b/store/config/nvim/lua/setup/lsp.lua new file mode 100644 index 0000000..15deacd --- /dev/null +++ b/store/config/nvim/lua/setup/lsp.lua @@ -0,0 +1,67 @@ +-- spellchecker: words denols luals + +vim.lsp.config("*", { + capabilities = vim.tbl_extend("force", + vim.lsp.protocol.make_client_capabilities(), + require("cmp_nvim_lsp").default_capabilities() + ) +}) + +local function setup_clangd() + local clangd = "clangd" + local brew_clangd_path = "/usr/local/opt/llvm/bin/clangd" + + if vim.uv.fs_stat(brew_clangd_path) ~= nil then + clangd = brew_clangd_path + end + + vim.lsp.config("clangd", { + cmd = { clangd } + }) + local old_on_attach = vim.lsp.config.clangd.on_attach + vim.lsp.config.clangd.on_attach = function(client, bufnr) + if old_on_attach then old_on_attach(client, bufnr) end + vim.keymap.set('n', 'grs', "ClangdSwitchSourceHeader", { + buffer = bufnr + }) + end +end + +local function setup_luals() + vim.lsp.config("lua_ls", { + settings = { + Lua = { + runtime = { + version = "LuaJIT" + }, + diagnostics = { + globals = { "vim" }, + }, + workspace = { + library = { + [vim.fn.expand "$VIMRUNTIME/lua"] = true, + [vim.fn.expand "$VIMRUNTIME/lua/vim/lsp"] = true, + [vim.fn.stdpath "data" .. "/lazy/lazy.nvim/lua/lazy"] = true, + }, + maxPreload = 100000, + preloadFileSize = 10000, + }, + }, + }, + }) +end + +local function setup() + vim.lsp.enable('denols') + vim.lsp.enable('cmake') + vim.lsp.enable('bashls') + vim.lsp.enable('html') + vim.lsp.enable('cssls') + setup_clangd() + setup_luals() +end + + +return { + setup = setup +} diff --git a/store/config/nvim/lua/setup/plugins/cmp.lua b/store/config/nvim/lua/setup/plugins/cmp.lua new file mode 100644 index 0000000..be9f8ea --- /dev/null +++ b/store/config/nvim/lua/setup/plugins/cmp.lua @@ -0,0 +1,30 @@ +local function setup() + local cmp = require("cmp") + + cmp.setup { + snippet = { + expand = function(args) + vim.snippet.expand(args.body) + end, + }, + mapping = cmp.mapping.preset.insert({ + [''] = cmp.mapping.scroll_docs(-4), + [''] = cmp.mapping.scroll_docs(4), + [''] = cmp.mapping.select_next_item({ behavior = cmp.SelectBehavior.Select }), + [''] = cmp.mapping.select_prev_item({ behavior = cmp.SelectBehavior.Select }), + [''] = cmp.mapping.abort(), + [''] = cmp.mapping.confirm({ select = true }), + [''] = cmp.mapping.confirm({ select = true }), + }), + sources = cmp.config.sources({ + { name = 'nvim_lsp' }, + { name = 'path' }, + }, { + { name = 'buffer' }, + }) + } +end + +return { + setup = setup +} diff --git a/store/config/nvim/lua/setup/plugins/gitsigns.lua b/store/config/nvim/lua/setup/plugins/gitsigns.lua new file mode 100644 index 0000000..957c661 --- /dev/null +++ b/store/config/nvim/lua/setup/plugins/gitsigns.lua @@ -0,0 +1,40 @@ +local function setup() + local gitsigns = require('gitsigns') + + gitsigns.setup { + on_attach = function(bufnr) + 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 + vim.cmd.normal({ ']c', bang = true }) + else + gitsigns.nav_hunk('next') + end + end) + + map('n', '[c', function() + if vim.wo.diff then + vim.cmd.normal({ '[c', bang = true }) + else + gitsigns.nav_hunk('prev') + end + end) + + -- Actions + map('n', 'gc', gitsigns.preview_hunk) + map('n', 'gt', gitsigns.toggle_deleted) + map('n', 'gd', gitsigns.diffthis) + map('n', 'gb', function() gitsigns.blame_line { full = true } end) + end + } +end + +return { + setup = setup +} diff --git a/store/config/nvim/lua/setup/plugins/init.lua b/store/config/nvim/lua/setup/plugins/init.lua new file mode 100644 index 0000000..5bcc219 --- /dev/null +++ b/store/config/nvim/lua/setup/plugins/init.lua @@ -0,0 +1,16 @@ +local function setup() + require("neo-tree").setup {} + require('lualine').setup {} + + require("setup.plugins.telescope").setup() + require("setup.plugins.gitsigns").setup() + + require("setup.plugins.tree-sitter").setup() + require("setup.plugins.lint").setup() + require("setup.plugins.cmp").setup() + require("nvim-autopairs").setup {} +end + +return { + setup = setup +} diff --git a/store/config/nvim/lua/setup/plugins/lint.lua b/store/config/nvim/lua/setup/plugins/lint.lua new file mode 100644 index 0000000..928841d --- /dev/null +++ b/store/config/nvim/lua/setup/plugins/lint.lua @@ -0,0 +1,98 @@ +local lint = require("lint") + +local cspell = { + name = "cspell", + config_patterns = { + ".cspell.json", + "cspell.json", + ".cSpell.json", + "cSpell.json", + "cspell.config.js", + "cspell.config.cjs", + "cspell.config.json", + "cspell.config.yaml", + "cspell.config.yml", + "cspell.yaml", + "cspell.yml", + }, + fast = true, +} + +local markdownlint = { + name = "markdownlint", + config_patterns = { + ".markdownlint.jsonc", + ".markdownlint.json", + ".markdownlint.yaml", + ".markdownlint.yml", + ".markdownlintrc", + }, + filetypes = { "markdown" }, + fast = true, +} + +local linters = { cspell, markdownlint } + +local linter_names = vim.tbl_map(function(l) return l.name end, linters) + +local function cru_lint(linter, opt) + opt = opt or {} + + local buf = opt.buf or 0 + + if linter.filetypes then + local filetype = vim.api.nvim_get_option_value("filetype", { buf = buf }) + if not vim.list_contains(linter.filetypes, filetype) then + return + 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) + 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 + if not fast or linter.fast then + cru_lint(linter, opt) + 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 }) +end + +return { + setup = setup, +} diff --git a/store/config/nvim/lua/setup/plugins/telescope.lua b/store/config/nvim/lua/setup/plugins/telescope.lua new file mode 100644 index 0000000..69a69c0 --- /dev/null +++ b/store/config/nvim/lua/setup/plugins/telescope.lua @@ -0,0 +1,28 @@ +local function setup() + local builtin = require('telescope.builtin') + vim.keymap.set('n', '/', builtin.live_grep, {}) + vim.keymap.set('n', 'fg', builtin.live_grep, {}) + vim.keymap.set('n', 'ff', builtin.find_files, {}) + vim.keymap.set('n', 'fb', builtin.buffers, {}) + vim.keymap.set('n', 'fh', builtin.help_tags, {}) + vim.keymap.set('n', 'fr', builtin.registers, {}) + vim.keymap.set('n', 'fq', builtin.quickfixhistory, {}) + vim.keymap.set('n', 'fm', builtin.marks, {}) + vim.keymap.set('n', 'fd', builtin.diagnostics, {}) + vim.keymap.set('n', 'fs', builtin.lsp_workspace_symbols, {}) + + local function all_files(opts) + opts = vim.tbl_extend('force', { + hidden = true, + no_ignore = true, + no_ignore_parent = true, + }, opts or {}) + builtin.find_files(opts) + end + + vim.keymap.set('n', 'fa', all_files, {}) +end + +return { + setup = setup +} diff --git a/store/config/nvim/lua/setup/plugins/tree-sitter.lua b/store/config/nvim/lua/setup/plugins/tree-sitter.lua new file mode 100644 index 0000000..043f425 --- /dev/null +++ b/store/config/nvim/lua/setup/plugins/tree-sitter.lua @@ -0,0 +1,11 @@ +local function setup() + require'nvim-treesitter.configs'.setup { + highlight = { enable = true }, + incremental_selection = { enable = true }, + textobjects = { enable = true }, + } +end + +return { + setup = setup +} diff --git a/store/config/nvim/lua/setup/win.lua b/store/config/nvim/lua/setup/win.lua new file mode 100644 index 0000000..90e168a --- /dev/null +++ b/store/config/nvim/lua/setup/win.lua @@ -0,0 +1,16 @@ +-- spellchecker: words pwsh +-- spellchecker: ignore shellcmdflag shellredir shellpipe shellquote shellxquote +local function setup() + vim.cmd([[ + let &shell = executable('pwsh') ? 'pwsh' : 'powershell' + let &shellcmdflag = '-NoLogo -ExecutionPolicy RemoteSigned -Command [Console]::InputEncoding=[Console]::OutputEncoding=[System.Text.UTF8Encoding]::new();$PSDefaultParameterValues[''Out-File:Encoding'']=''utf8'';Remove-Alias -Force -ErrorAction SilentlyContinue tee;' + let &shellredir = '2>&1 | %%{ "$_" } | Out-File %s; exit $LastExitCode' + let &shellpipe = '2>&1 | %%{ "$_" } | tee %s; exit $LastExitCode' + set shellquote= shellxquote= + ]]) + vim.opt.completeslash = 'slash' +end + +return { + setup = setup +} diff --git a/store/home/bash_profile b/store/home/bash_profile deleted file mode 100644 index b65f405..0000000 --- a/store/home/bash_profile +++ /dev/null @@ -1 +0,0 @@ -export PATH="$HOME/.local/bin:$PATH" diff --git a/store/home/bashrc b/store/home/bashrc deleted file mode 100644 index 1ab3b08..0000000 --- a/store/home/bashrc +++ /dev/null @@ -1,8 +0,0 @@ -set-proxy() { - 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 -} diff --git a/store/home/bin/neovide-listen b/store/home/bin/neovide-listen deleted file mode 100755 index 3bcc7da..0000000 --- a/store/home/bin/neovide-listen +++ /dev/null @@ -1,49 +0,0 @@ -#!/usr/bin/env bash - -export CRU_NVIM_SERVER=${CRU_NVIM_SERVER:-/tmp/nvimsocket} - -args=() - -self_built_nvim="$HOME/codes/neovim/build/bin/nvim" -self_built_nvim_runtime="$HOME/codes/neovim/runtime" -if [[ -z "$CRU_NVIM" ]] && [[ -e "$self_built_nvim" ]]; then - echo "Found self-built neovim at $CRU_NVIM" - CRU_NVIM="$self_built_nvim" - CRU_VIMRUNTIME="$self_built_nvim_runtime" -fi - -[[ -z "$CRU_NVIM" ]] || args=("${args[@]}" "--neovim-bin" "$CRU_NVIM") -export CRU_NVIM=${CRU_NVIM:-nvim} -[[ -z "$CRU_VIMRUNTIME" ]] || export VIMRUNTIME="$CRU_VIMRUNTIME" - -self_built_neovide="$HOME/codes/neovide/target/release/neovide" -if [[ -z "$CRU_NEOVIDE" ]] && [[ -e "$self_built_neovide" ]]; then - echo "Found self-build of neovide at $self_built_neovide" - CRU_NEOVIDE="$self_built_neovide" -fi -export CRU_NEOVIDE=${CRU_NEOVIDE:-neovide} - -listen_added=0 -for arg in "$@"; do - args=("${args[@]}" "$arg") - if [[ "$arg" == "--" ]]; then - args=("${args[@]}" "--listen" "$CRU_NVIM_SERVER") - listen_added=1 - fi -done - -if [[ $listen_added = 0 ]]; then - args=("${args[@]}" "--" "--listen" "$CRU_NVIM_SERVER") -fi - -if which nvr > /dev/null; then - echo "Found nvr, set VISUAL EDITOR GIT_EDITOR to nvr-wait" - export VISUAL="nvr-wait" - export EDITOR="$VISUAL" - export GIT_EDITOR="$VISUAL" -fi - -args=("$CRU_NEOVIDE" "${args[@]}") -echo "Full command is ${args[@]}" -exec "${args[@]}" - diff --git a/store/home/bin/nvr-wait b/store/home/bin/nvr-wait deleted file mode 100755 index 410d42d..0000000 --- a/store/home/bin/nvr-wait +++ /dev/null @@ -1,4 +0,0 @@ -#!/bin/sh - -export CRU_NVIM_SERVER=${CRU_NVIM_SERVER:-/tmp/nvimsocket} -exec nvr --nostart --servername "$CRU_NVIM_SERVER" -cc split --remote-wait "$@" diff --git a/store/home/config/aichat/roles/blogger.md b/store/home/config/aichat/roles/blogger.md deleted file mode 100644 index b2ebb65..0000000 --- a/store/home/config/aichat/roles/blogger.md +++ /dev/null @@ -1,4 +0,0 @@ -model: deepseek:deepseek-chat - ---- -You are DeepSeek, an AI assistant specialized in English writing. Your task is to refine my writings and explain the changes to help me improve my English writing skills. diff --git a/store/home/config/aichat/roles/coder.md b/store/home/config/aichat/roles/coder.md deleted file mode 100644 index ae5458b..0000000 --- a/store/home/config/aichat/roles/coder.md +++ /dev/null @@ -1,5 +0,0 @@ -model: deepseek:deepseek-chat -temperature: 0 - ---- -You are an AI programming assistant. Help users write, debug, and optimize code. Provide clear, well-commented examples, explain concepts simply, and suggest multiple solutions when possible. Prioritize best practices like readability, efficiency, and security. Ask clarifying questions if the request is unclear. diff --git a/store/home/config/halloy/config.toml b/store/home/config/halloy/config.toml deleted file mode 100644 index 5d39f52..0000000 --- a/store/home/config/halloy/config.toml +++ /dev/null @@ -1,20 +0,0 @@ -tooltips = true - -[notifications] -direct_message = { sound = "peck", show_toast = true } -connected = { sound = "ring", show_toast = true } -disconnected = { sound = "ring", show_toast = true } - -[notifications.highlight] -sound = "dong" -exclude = [ "NickServ" ] - -[servers.liberachat] -nickname = "crupest" -server = "irc.libera.chat" -channels = [ "#hurd" ] -use_tls = true - -[servers.liberachat.sasl.plain] -username = "crupest" -password = ... diff --git a/store/home/config/mihomo/config.yaml b/store/home/config/mihomo/config.yaml deleted file mode 100644 index cd2c3a3..0000000 --- a/store/home/config/mihomo/config.yaml +++ /dev/null @@ -1,96 +0,0 @@ -mixed-port: 7897 -mode: rule -log-level: info -external-controller: 127.0.0.1:9090 -profile: - store-selected: true - -external-ui: ui/metacubexd -external-ui-name: metacubexd -external-ui-url: https://github.com/MetaCubeX/metacubexd/archive/refs/heads/gh-pages.zip - -geox-url: - geoip: https://testingcf.jsdelivr.net/gh/MetaCubeX/meta-rules-dat@release/geoip.dat - geosite: https://testingcf.jsdelivr.net/gh/MetaCubeX/meta-rules-dat@release/geosite.dat - mmdb: https://testingcf.jsdelivr.net/gh/MetaCubeX/meta-rules-dat@release/country.mmdb - asn: https://testingcf.jsdelivr.net/gh/MetaCubeX/meta-rules-dat@release/GeoLite2-ASN.mmdb -geo-auto-update: true -geo-update-interval: 24 - -ipv6: false -unified-delay: true -global-client-fingerprint: edge - -dns: - enable: true - ipv6: true - default-nameserver: - - 223.5.5.5 - nameserver: - - https://dns.alidns.com/dns-query - - 223.5.5.5 - - 8.8.8.8 - - 1.1.1.1 - -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 - - 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 - - MATCH,DIRECT - -proxy-groups: - - name: node-select - type: select - proxies: - - auto-select - use: - - money - - - name: auto-select - type: url-test - use: - - money - interval: 300 - url: https://www.gstatic.com/generate_204 - filter: 日本|新加坡|香港|台湾|美国 - expected-status: 204 diff --git a/store/home/config/nvim/init.lua b/store/home/config/nvim/init.lua deleted file mode 100644 index 95d1c30..0000000 --- a/store/home/config/nvim/init.lua +++ /dev/null @@ -1,24 +0,0 @@ -local lazy_path = vim.fn.stdpath("data") .. "/lazy/lazy.nvim" -if not vim.uv.fs_stat(lazy_path) then - vim.fn.system({ - "git", - "clone", - "--filter=blob:none", - "https://github.com/folke/lazy.nvim.git", - "--branch=stable", -- latest stable release - lazy_path, - }) -end -vim.opt.rtp:prepend(lazy_path) -require("lazy").setup("plugins") - -if vim.g.neovide then - vim.opt.guifont = "Maple Mono NF"; - vim.g.neovide_normal_opacity = 0.95; - vim.g.neovide_input_ime = false; - vim.g.neovide_cursor_animate_in_insert_mode = false - vim.g.neovide_input_macos_option_key_is_meta = 'only_left' - vim.cmd("colorscheme catppuccin-macchiato") -end - -require("setup").setup() diff --git a/store/home/config/nvim/lazy-lock.json b/store/home/config/nvim/lazy-lock.json deleted file mode 100644 index 9869b1d..0000000 --- a/store/home/config/nvim/lazy-lock.json +++ /dev/null @@ -1,19 +0,0 @@ -{ - "catppuccin": { "branch": "main", "commit": "a0c769bc7cd04bbbf258b3d5f01e2bdce744108d" }, - "cmp-buffer": { "branch": "main", "commit": "b74fab3656eea9de20a9b8116afa3cfc4ec09657" }, - "cmp-nvim-lsp": { "branch": "main", "commit": "a8912b88ce488f411177fc8aed358b04dc246d7b" }, - "cmp-path": { "branch": "main", "commit": "c6635aae33a50d6010bf1aa756ac2398a2d54c32" }, - "gitsigns.nvim": { "branch": "main", "commit": "d0f90ef51d4be86b824b012ec52ed715b5622e51" }, - "lazy.nvim": { "branch": "main", "commit": "6c3bda4aca61a13a9c63f1c1d1b16b9d3be90d7a" }, - "lualine.nvim": { "branch": "master", "commit": "0c6cca9f2c63dadeb9225c45bc92bb95a151d4af" }, - "neo-tree.nvim": { "branch": "v3.x", "commit": "f481de16a0eb59c985abac8985e3f2e2f75b4875" }, - "nui.nvim": { "branch": "main", "commit": "7cd18e73cfbd70e1546931b7268b3eebaeff9391" }, - "nvim-autopairs": { "branch": "master", "commit": "4d74e75913832866aa7de35e4202463ddf6efd1b" }, - "nvim-cmp": { "branch": "main", "commit": "b5311ab3ed9c846b585c0c15b7559be131ec4be9" }, - "nvim-lint": { "branch": "master", "commit": "b47cbb249351873e3a571751c3fb66ed6369852f" }, - "nvim-lspconfig": { "branch": "master", "commit": "8adb3b5938f6074a1bcc36d3c3916f497d2e8ec4" }, - "nvim-treesitter": { "branch": "master", "commit": "42fc28ba918343ebfd5565147a42a26580579482" }, - "nvim-web-devicons": { "branch": "master", "commit": "1fb58cca9aebbc4fd32b086cb413548ce132c127" }, - "plenary.nvim": { "branch": "master", "commit": "857c5ac632080dba10aae49dba902ce3abf91b35" }, - "telescope.nvim": { "branch": "master", "commit": "b4da76be54691e854d3e0e02c36b0245f945c2c7" } -} diff --git a/store/home/config/nvim/lua/plugins.lua b/store/home/config/nvim/lua/plugins.lua deleted file mode 100644 index 480ea8f..0000000 --- a/store/home/config/nvim/lua/plugins.lua +++ /dev/null @@ -1,35 +0,0 @@ --- spellchecker: disable -return { - { "catppuccin/nvim", name = "catppuccin", priority = 1000 }, - "neovim/nvim-lspconfig", - "hrsh7th/nvim-cmp", - "hrsh7th/cmp-nvim-lsp", - "hrsh7th/cmp-buffer", - "hrsh7th/cmp-path", - { - "nvim-treesitter/nvim-treesitter", - build = ":TSUpdate" - }, - { - "nvim-neo-tree/neo-tree.nvim", - branch = "v3.x", - dependencies = { - "nvim-lua/plenary.nvim", - "nvim-tree/nvim-web-devicons", -- not strictly required, but recommended - "MunifTanjim/nui.nvim", - -- {"3rd/image.nvim", opts = {}}, -- Optional image support in preview window: See `# Preview Mode` for more information - }, - lazy = false, -- neo-tree will lazily load itself - }, - { - "nvim-lualine/lualine.nvim", - dependencies = { 'nvim-tree/nvim-web-devicons' } - }, - { - "nvim-telescope/telescope.nvim", - dependencies = { 'nvim-lua/plenary.nvim' } - }, - "windwp/nvim-autopairs", - "mfussenegger/nvim-lint", - "lewis6991/gitsigns.nvim", -} diff --git a/store/home/config/nvim/lua/setup/init.lua b/store/home/config/nvim/lua/setup/init.lua deleted file mode 100644 index df3eb3d..0000000 --- a/store/home/config/nvim/lua/setup/init.lua +++ /dev/null @@ -1,46 +0,0 @@ -local function close_float() - local wins = vim.api.nvim_list_wins() - for _, v in ipairs(wins) do - if vim.api.nvim_win_get_config(v).relative ~= '' then - vim.api.nvim_win_close(v, false) - end - end -end - -local function setup() - if vim.fn.has("win32") ~= 0 then - require("setup.win").setup() - end - - -- spellchecker: ignore termguicolors - vim.opt.termguicolors = true; - vim.opt.fileformats = "unix,dos"; - vim.opt.number = true; - - vim.g.load_doxygen_syntax = true; - vim.g.doxygen_javadoc_autobrief = false; - - vim.keymap.set("n", "", "bnext") - vim.keymap.set("n", "", "bNext") - vim.keymap.set("n", "", close_float) - vim.keymap.set('t', '', '') - vim.keymap.set('t', '', function() - local register = vim.fn.input("Enter register: ") - if register == "" then - register = '"' - end - return '"' .. register .. 'pi' - end, { expr = true }) - - vim.cmd("autocmd FileType gitcommit,gitrebase,gitconfig set bufhidden=delete") - - vim.diagnostic.config({ virtual_text = true }) - vim.keymap.set("n", "grl", vim.diagnostic.open_float) - - require("setup.lsp").setup() - require("setup.plugins").setup() -end - -return { - setup = setup -} diff --git a/store/home/config/nvim/lua/setup/lsp.lua b/store/home/config/nvim/lua/setup/lsp.lua deleted file mode 100644 index 15deacd..0000000 --- a/store/home/config/nvim/lua/setup/lsp.lua +++ /dev/null @@ -1,67 +0,0 @@ --- spellchecker: words denols luals - -vim.lsp.config("*", { - capabilities = vim.tbl_extend("force", - vim.lsp.protocol.make_client_capabilities(), - require("cmp_nvim_lsp").default_capabilities() - ) -}) - -local function setup_clangd() - local clangd = "clangd" - local brew_clangd_path = "/usr/local/opt/llvm/bin/clangd" - - if vim.uv.fs_stat(brew_clangd_path) ~= nil then - clangd = brew_clangd_path - end - - vim.lsp.config("clangd", { - cmd = { clangd } - }) - local old_on_attach = vim.lsp.config.clangd.on_attach - vim.lsp.config.clangd.on_attach = function(client, bufnr) - if old_on_attach then old_on_attach(client, bufnr) end - vim.keymap.set('n', 'grs', "ClangdSwitchSourceHeader", { - buffer = bufnr - }) - end -end - -local function setup_luals() - vim.lsp.config("lua_ls", { - settings = { - Lua = { - runtime = { - version = "LuaJIT" - }, - diagnostics = { - globals = { "vim" }, - }, - workspace = { - library = { - [vim.fn.expand "$VIMRUNTIME/lua"] = true, - [vim.fn.expand "$VIMRUNTIME/lua/vim/lsp"] = true, - [vim.fn.stdpath "data" .. "/lazy/lazy.nvim/lua/lazy"] = true, - }, - maxPreload = 100000, - preloadFileSize = 10000, - }, - }, - }, - }) -end - -local function setup() - vim.lsp.enable('denols') - vim.lsp.enable('cmake') - vim.lsp.enable('bashls') - vim.lsp.enable('html') - vim.lsp.enable('cssls') - setup_clangd() - setup_luals() -end - - -return { - setup = setup -} diff --git a/store/home/config/nvim/lua/setup/plugins/cmp.lua b/store/home/config/nvim/lua/setup/plugins/cmp.lua deleted file mode 100644 index be9f8ea..0000000 --- a/store/home/config/nvim/lua/setup/plugins/cmp.lua +++ /dev/null @@ -1,30 +0,0 @@ -local function setup() - local cmp = require("cmp") - - cmp.setup { - snippet = { - expand = function(args) - vim.snippet.expand(args.body) - end, - }, - mapping = cmp.mapping.preset.insert({ - [''] = cmp.mapping.scroll_docs(-4), - [''] = cmp.mapping.scroll_docs(4), - [''] = cmp.mapping.select_next_item({ behavior = cmp.SelectBehavior.Select }), - [''] = cmp.mapping.select_prev_item({ behavior = cmp.SelectBehavior.Select }), - [''] = cmp.mapping.abort(), - [''] = cmp.mapping.confirm({ select = true }), - [''] = cmp.mapping.confirm({ select = true }), - }), - sources = cmp.config.sources({ - { name = 'nvim_lsp' }, - { name = 'path' }, - }, { - { name = 'buffer' }, - }) - } -end - -return { - setup = setup -} diff --git a/store/home/config/nvim/lua/setup/plugins/gitsigns.lua b/store/home/config/nvim/lua/setup/plugins/gitsigns.lua deleted file mode 100644 index 957c661..0000000 --- a/store/home/config/nvim/lua/setup/plugins/gitsigns.lua +++ /dev/null @@ -1,40 +0,0 @@ -local function setup() - local gitsigns = require('gitsigns') - - gitsigns.setup { - on_attach = function(bufnr) - 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 - vim.cmd.normal({ ']c', bang = true }) - else - gitsigns.nav_hunk('next') - end - end) - - map('n', '[c', function() - if vim.wo.diff then - vim.cmd.normal({ '[c', bang = true }) - else - gitsigns.nav_hunk('prev') - end - end) - - -- Actions - map('n', 'gc', gitsigns.preview_hunk) - map('n', 'gt', gitsigns.toggle_deleted) - map('n', 'gd', gitsigns.diffthis) - map('n', 'gb', function() gitsigns.blame_line { full = true } end) - end - } -end - -return { - setup = setup -} diff --git a/store/home/config/nvim/lua/setup/plugins/init.lua b/store/home/config/nvim/lua/setup/plugins/init.lua deleted file mode 100644 index 5bcc219..0000000 --- a/store/home/config/nvim/lua/setup/plugins/init.lua +++ /dev/null @@ -1,16 +0,0 @@ -local function setup() - require("neo-tree").setup {} - require('lualine').setup {} - - require("setup.plugins.telescope").setup() - require("setup.plugins.gitsigns").setup() - - require("setup.plugins.tree-sitter").setup() - require("setup.plugins.lint").setup() - require("setup.plugins.cmp").setup() - require("nvim-autopairs").setup {} -end - -return { - setup = setup -} diff --git a/store/home/config/nvim/lua/setup/plugins/lint.lua b/store/home/config/nvim/lua/setup/plugins/lint.lua deleted file mode 100644 index 928841d..0000000 --- a/store/home/config/nvim/lua/setup/plugins/lint.lua +++ /dev/null @@ -1,98 +0,0 @@ -local lint = require("lint") - -local cspell = { - name = "cspell", - config_patterns = { - ".cspell.json", - "cspell.json", - ".cSpell.json", - "cSpell.json", - "cspell.config.js", - "cspell.config.cjs", - "cspell.config.json", - "cspell.config.yaml", - "cspell.config.yml", - "cspell.yaml", - "cspell.yml", - }, - fast = true, -} - -local markdownlint = { - name = "markdownlint", - config_patterns = { - ".markdownlint.jsonc", - ".markdownlint.json", - ".markdownlint.yaml", - ".markdownlint.yml", - ".markdownlintrc", - }, - filetypes = { "markdown" }, - fast = true, -} - -local linters = { cspell, markdownlint } - -local linter_names = vim.tbl_map(function(l) return l.name end, linters) - -local function cru_lint(linter, opt) - opt = opt or {} - - local buf = opt.buf or 0 - - if linter.filetypes then - local filetype = vim.api.nvim_get_option_value("filetype", { buf = buf }) - if not vim.list_contains(linter.filetypes, filetype) then - return - 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) - 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 - if not fast or linter.fast then - cru_lint(linter, opt) - 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 }) -end - -return { - setup = setup, -} diff --git a/store/home/config/nvim/lua/setup/plugins/telescope.lua b/store/home/config/nvim/lua/setup/plugins/telescope.lua deleted file mode 100644 index 69a69c0..0000000 --- a/store/home/config/nvim/lua/setup/plugins/telescope.lua +++ /dev/null @@ -1,28 +0,0 @@ -local function setup() - local builtin = require('telescope.builtin') - vim.keymap.set('n', '/', builtin.live_grep, {}) - vim.keymap.set('n', 'fg', builtin.live_grep, {}) - vim.keymap.set('n', 'ff', builtin.find_files, {}) - vim.keymap.set('n', 'fb', builtin.buffers, {}) - vim.keymap.set('n', 'fh', builtin.help_tags, {}) - vim.keymap.set('n', 'fr', builtin.registers, {}) - vim.keymap.set('n', 'fq', builtin.quickfixhistory, {}) - vim.keymap.set('n', 'fm', builtin.marks, {}) - vim.keymap.set('n', 'fd', builtin.diagnostics, {}) - vim.keymap.set('n', 'fs', builtin.lsp_workspace_symbols, {}) - - local function all_files(opts) - opts = vim.tbl_extend('force', { - hidden = true, - no_ignore = true, - no_ignore_parent = true, - }, opts or {}) - builtin.find_files(opts) - end - - vim.keymap.set('n', 'fa', all_files, {}) -end - -return { - setup = setup -} diff --git a/store/home/config/nvim/lua/setup/plugins/tree-sitter.lua b/store/home/config/nvim/lua/setup/plugins/tree-sitter.lua deleted file mode 100644 index 043f425..0000000 --- a/store/home/config/nvim/lua/setup/plugins/tree-sitter.lua +++ /dev/null @@ -1,11 +0,0 @@ -local function setup() - require'nvim-treesitter.configs'.setup { - highlight = { enable = true }, - incremental_selection = { enable = true }, - textobjects = { enable = true }, - } -end - -return { - setup = setup -} diff --git a/store/home/config/nvim/lua/setup/win.lua b/store/home/config/nvim/lua/setup/win.lua deleted file mode 100644 index 90e168a..0000000 --- a/store/home/config/nvim/lua/setup/win.lua +++ /dev/null @@ -1,16 +0,0 @@ --- spellchecker: words pwsh --- spellchecker: ignore shellcmdflag shellredir shellpipe shellquote shellxquote -local function setup() - vim.cmd([[ - let &shell = executable('pwsh') ? 'pwsh' : 'powershell' - let &shellcmdflag = '-NoLogo -ExecutionPolicy RemoteSigned -Command [Console]::InputEncoding=[Console]::OutputEncoding=[System.Text.UTF8Encoding]::new();$PSDefaultParameterValues[''Out-File:Encoding'']=''utf8'';Remove-Alias -Force -ErrorAction SilentlyContinue tee;' - let &shellredir = '2>&1 | %%{ "$_" } | Out-File %s; exit $LastExitCode' - let &shellpipe = '2>&1 | %%{ "$_" } | tee %s; exit $LastExitCode' - set shellquote= shellxquote= - ]]) - vim.opt.completeslash = 'slash' -end - -return { - setup = setup -} diff --git a/store/home/gitconfig b/store/home/gitconfig deleted file mode 100644 index 4b88c56..0000000 --- a/store/home/gitconfig +++ /dev/null @@ -1,11 +0,0 @@ -[user] - name = Yuqian Yang - email = crupest@crupest.life -[core] - autocrlf = false - editor = vim -[credential] - helper = /usr/lib/git-core/git-credential-libsecret -[alias] - lg = log --decorate --oneline --graph - pap = push --all --prune -- cgit v1.2.3