From f470e78d1c3c51bb7351e3734fd6d285939d6d73 Mon Sep 17 00:00:00 2001 From: root Date: Sun, 10 Aug 2025 20:24:22 +0000 Subject: [PATCH] init --- after/ftplugin/cpp.vim | 35 ++ after/ftplugin/gitconfig.vim | 1 + after/ftplugin/javascript.vim | 3 + after/ftplugin/lua.vim | 6 + after/ftplugin/markdown.lua | 97 ++++++ after/ftplugin/markdown.vim | 67 ++++ after/ftplugin/python.vim | 16 + after/ftplugin/qf.vim | 6 + after/ftplugin/sql.vim | 1 + after/ftplugin/tex.lua | 2 + after/ftplugin/text.vim | 1 + after/ftplugin/vim.vim | 12 + after/ftplugin/yaml.vim | 4 + after/lsp/clangd.lua | 3 + after/lsp/ltex.lua | 8 + after/lsp/lua_ls.lua | 13 + after/lsp/pyright.lua | 43 +++ after/lsp/ruff.lua | 8 + autoload/buf_utils.vim | 27 ++ autoload/text_obj.vim | 67 ++++ autoload/utils.vim | 130 +++++++ ftdetect/pdc.vim | 4 + ftdetect/snippets.vim | 4 + init.lua | 14 + lazy-lock.json | 95 +++++ lua/colorschemes.lua | 92 +++++ lua/config/blink-cmp.lua | 32 ++ lua/config/bqf.lua | 6 + lua/config/bufferline.lua | 42 +++ lua/config/dashboard-nvim.lua | 75 ++++ lua/config/fidget-nvim.lua | 1 + lua/config/fugitive.lua | 24 ++ lua/config/fzf-lua.lua | 18 + lua/config/git-conflict.lua | 9 + lua/config/git-linker.lua | 47 +++ lua/config/gitsigns.lua | 55 +++ lua/config/glance.lua | 12 + lua/config/hlslens.lua | 75 ++++ lua/config/iron.lua | 7 + lua/config/lightbulb.lua | 18 + lua/config/live-command.lua | 9 + lua/config/lsp.lua | 127 +++++++ lua/config/lualine.lua | 310 +++++++++++++++++ lua/config/nvim-cmp.lua | 106 ++++++ lua/config/nvim-hop.lua | 27 ++ lua/config/nvim-notify.lua | 8 + lua/config/nvim-statuscol.lua | 22 ++ lua/config/nvim-tree.lua | 108 ++++++ lua/config/nvim-ufo.lua | 41 +++ lua/config/treesitter-textobjects.lua | 23 ++ lua/config/treesitter.lua | 8 + lua/config/which-key.lua | 6 + lua/config/yanky.lua | 15 + lua/custom-autocmd.lua | 217 ++++++++++++ lua/diagnostic-conf.lua | 62 ++++ lua/globals.lua | 58 ++++ lua/lsp_utils.lua | 14 + lua/mappings.lua | 153 +++++++++ lua/plugin_specs.lua | 405 ++++++++++++++++++++++ lua/utils.lua | 87 +++++ my_snippets/all.snippets | 7 + my_snippets/cpp.snippets | 149 ++++++++ my_snippets/markdown.snippets | 163 +++++++++ my_snippets/python.snippets | 15 + my_snippets/snippets.snippets | 5 + my_snippets/tex.snippets | 9 + my_snippets/vim.snippets | 14 + package-lock.json | 6 + plugin/abbrev.vim | 3 + plugin/command.lua | 50 +++ plugin/command.vim | 46 +++ plugin/log-autocmds.vim | 118 +++++++ spell/en.utf-8.add | 478 ++++++++++++++++++++++++++ viml_conf/options.vim | 171 +++++++++ viml_conf/plugins.vim | 188 ++++++++++ 75 files changed, 4408 insertions(+) create mode 100644 after/ftplugin/cpp.vim create mode 100644 after/ftplugin/gitconfig.vim create mode 100644 after/ftplugin/javascript.vim create mode 100644 after/ftplugin/lua.vim create mode 100644 after/ftplugin/markdown.lua create mode 100644 after/ftplugin/markdown.vim create mode 100644 after/ftplugin/python.vim create mode 100644 after/ftplugin/qf.vim create mode 100644 after/ftplugin/sql.vim create mode 100644 after/ftplugin/tex.lua create mode 100644 after/ftplugin/text.vim create mode 100644 after/ftplugin/vim.vim create mode 100644 after/ftplugin/yaml.vim create mode 100644 after/lsp/clangd.lua create mode 100644 after/lsp/ltex.lua create mode 100644 after/lsp/lua_ls.lua create mode 100644 after/lsp/pyright.lua create mode 100644 after/lsp/ruff.lua create mode 100644 autoload/buf_utils.vim create mode 100644 autoload/text_obj.vim create mode 100644 autoload/utils.vim create mode 100644 ftdetect/pdc.vim create mode 100644 ftdetect/snippets.vim create mode 100644 init.lua create mode 100644 lazy-lock.json create mode 100644 lua/colorschemes.lua create mode 100644 lua/config/blink-cmp.lua create mode 100644 lua/config/bqf.lua create mode 100644 lua/config/bufferline.lua create mode 100644 lua/config/dashboard-nvim.lua create mode 100644 lua/config/fidget-nvim.lua create mode 100644 lua/config/fugitive.lua create mode 100644 lua/config/fzf-lua.lua create mode 100644 lua/config/git-conflict.lua create mode 100644 lua/config/git-linker.lua create mode 100644 lua/config/gitsigns.lua create mode 100644 lua/config/glance.lua create mode 100644 lua/config/hlslens.lua create mode 100644 lua/config/iron.lua create mode 100644 lua/config/lightbulb.lua create mode 100644 lua/config/live-command.lua create mode 100644 lua/config/lsp.lua create mode 100644 lua/config/lualine.lua create mode 100644 lua/config/nvim-cmp.lua create mode 100644 lua/config/nvim-hop.lua create mode 100644 lua/config/nvim-notify.lua create mode 100644 lua/config/nvim-statuscol.lua create mode 100644 lua/config/nvim-tree.lua create mode 100644 lua/config/nvim-ufo.lua create mode 100644 lua/config/treesitter-textobjects.lua create mode 100644 lua/config/treesitter.lua create mode 100644 lua/config/which-key.lua create mode 100644 lua/config/yanky.lua create mode 100644 lua/custom-autocmd.lua create mode 100644 lua/diagnostic-conf.lua create mode 100644 lua/globals.lua create mode 100644 lua/lsp_utils.lua create mode 100644 lua/mappings.lua create mode 100644 lua/plugin_specs.lua create mode 100644 lua/utils.lua create mode 100644 my_snippets/all.snippets create mode 100644 my_snippets/cpp.snippets create mode 100644 my_snippets/markdown.snippets create mode 100644 my_snippets/python.snippets create mode 100644 my_snippets/snippets.snippets create mode 100644 my_snippets/tex.snippets create mode 100644 my_snippets/vim.snippets create mode 100644 package-lock.json create mode 100644 plugin/abbrev.vim create mode 100644 plugin/command.lua create mode 100644 plugin/command.vim create mode 100644 plugin/log-autocmds.vim create mode 100644 spell/en.utf-8.add create mode 100644 viml_conf/options.vim create mode 100644 viml_conf/plugins.vim diff --git a/after/ftplugin/cpp.vim b/after/ftplugin/cpp.vim new file mode 100644 index 0000000..564acfe --- /dev/null +++ b/after/ftplugin/cpp.vim @@ -0,0 +1,35 @@ +set commentstring=//\ %s + +" Disable inserting comment leader after hitting o or O or +set formatoptions-=o +set formatoptions-=r + +nnoremap :call compile_run_cpp() + +function! s:compile_run_cpp() abort + let src_path = expand('%:p:~') + let src_noext = expand('%:p:~:r') + let _flag = '-Wall -Wextra -std=c++11 -O2' + + if executable('clang++') + let prog = 'clang++' + elseif executable('g++') + let prog = 'g++' + else + echoerr 'No C++ compiler found on the system!' + endif + call s:create_term_buf('h', 20) + execute printf('term %s %s %s -o %s && %s', prog, _flag, src_path, src_noext, src_noext) + startinsert +endfunction + +function s:create_term_buf(_type, size) abort + set splitbelow + set splitright + if a:_type ==# 'v' + vnew + else + new + endif + execute 'resize ' . a:size +endfunction diff --git a/after/ftplugin/gitconfig.vim b/after/ftplugin/gitconfig.vim new file mode 100644 index 0000000..9c2e80a --- /dev/null +++ b/after/ftplugin/gitconfig.vim @@ -0,0 +1 @@ +set commentstring=#\ %s diff --git a/after/ftplugin/javascript.vim b/after/ftplugin/javascript.vim new file mode 100644 index 0000000..3e27ee8 --- /dev/null +++ b/after/ftplugin/javascript.vim @@ -0,0 +1,3 @@ +" Disable inserting comment leader after hitting o or O or +set formatoptions-=o +set formatoptions-=r diff --git a/after/ftplugin/lua.vim b/after/ftplugin/lua.vim new file mode 100644 index 0000000..a0c7ce0 --- /dev/null +++ b/after/ftplugin/lua.vim @@ -0,0 +1,6 @@ +" Disable inserting comment leader after hitting o or O or +set formatoptions-=o +set formatoptions-=r + +nnoremap :luafile % +nnoremap f silent !stylua % diff --git a/after/ftplugin/markdown.lua b/after/ftplugin/markdown.lua new file mode 100644 index 0000000..f403fb1 --- /dev/null +++ b/after/ftplugin/markdown.lua @@ -0,0 +1,97 @@ +local function add_reference_at_end(label, url, title) + vim.schedule(function() + local bufnr = vim.api.nvim_get_current_buf() + local line_count = vim.api.nvim_buf_line_count(bufnr) + + local ref_def = "[" .. label .. "]: " .. url + if title and title ~= "" then + ref_def = ref_def .. ' "' .. title .. '"' + end + + local buffer_lines = vim.api.nvim_buf_get_lines(bufnr, 0, -1, false) + local has_ref_section = false + for _, line in ipairs(buffer_lines) do + if line:match("^%s*[%s]*$") then + has_ref_section = true + break + end + end + + local lines_to_add = {} + if not has_ref_section then + if #lines_to_add == 0 then + table.insert(lines_to_add, "") + end + table.insert(lines_to_add, "") + end + + table.insert(lines_to_add, ref_def) + + vim.api.nvim_buf_set_lines(bufnr, line_count, line_count, false, lines_to_add) + end) +end + +local function get_ref_link_labels() + local labels = {} + local seen = {} + local lines = vim.api.nvim_buf_get_lines(0, 0, -1, false) + + for _, line in ipairs(lines) do + -- %[.-%] matches [link text] (non-greedy) + -- %[(.-)%] matches [label] and captures the label content + local start_pos = 1 + while start_pos <= #line do + local match_start, match_end, label = string.find(line, "%[.-%]%[(.-)%]", start_pos) + if not match_start then + break + end + + if label and label ~= "" and not seen[label] then + table.insert(labels, label) + seen[label] = true + end + + start_pos = match_end + 1 + end + end + + return labels +end + +local function count_consecutive_spaces(str) + -- Remove leading spaces first + local trimmed = str:match("^%s*(.*)") + local count = 0 + + -- Count each sequence of one or more consecutive spaces + for spaces in trimmed:gmatch("%s+") do + count = count + 1 + end + return count +end + +vim.api.nvim_buf_create_user_command(0, "AddRef", function(opts) + local args = vim.split(opts.args, " ", { trimempty = true }) + if #args < 2 then + vim.print("Usage: :AddRef