From 1e27d1c7b25e4d28a25c0fa2c4e6e33a66b9072e Mon Sep 17 00:00:00 2001 From: moxie Date: Tue, 30 Sep 2025 12:27:44 +0300 Subject: add nvim configs --- .config/nvim/lua/plugins/blink.cmp.lua | 23 ++++ .config/nvim/lua/plugins/harpoon.lua | 22 ++++ .config/nvim/lua/plugins/highlight-colors.lua | 29 +++++ .config/nvim/lua/plugins/hover.lua | 58 ++++++++++ .config/nvim/lua/plugins/init.lua | 31 +++++ .config/nvim/lua/plugins/kiwi.lua | 17 +++ .config/nvim/lua/plugins/lazydev.lua | 26 +++++ .config/nvim/lua/plugins/lualine.lua | 161 ++++++++++++++++++++++++++ .config/nvim/lua/plugins/oil.lua | 22 ++++ .config/nvim/lua/plugins/outline.lua | 10 ++ .config/nvim/lua/plugins/render-markdown.lua | 44 +++++++ .config/nvim/lua/plugins/telescope.lua | 48 ++++++++ .config/nvim/lua/plugins/treesitter.lua | 42 +++++++ .config/nvim/lua/plugins/undotree.lua | 8 ++ 14 files changed, 541 insertions(+) create mode 100644 .config/nvim/lua/plugins/blink.cmp.lua create mode 100644 .config/nvim/lua/plugins/harpoon.lua create mode 100644 .config/nvim/lua/plugins/highlight-colors.lua create mode 100644 .config/nvim/lua/plugins/hover.lua create mode 100644 .config/nvim/lua/plugins/init.lua create mode 100644 .config/nvim/lua/plugins/kiwi.lua create mode 100644 .config/nvim/lua/plugins/lazydev.lua create mode 100644 .config/nvim/lua/plugins/lualine.lua create mode 100644 .config/nvim/lua/plugins/oil.lua create mode 100644 .config/nvim/lua/plugins/outline.lua create mode 100644 .config/nvim/lua/plugins/render-markdown.lua create mode 100644 .config/nvim/lua/plugins/telescope.lua create mode 100644 .config/nvim/lua/plugins/treesitter.lua create mode 100644 .config/nvim/lua/plugins/undotree.lua (limited to '.config/nvim/lua/plugins') diff --git a/.config/nvim/lua/plugins/blink.cmp.lua b/.config/nvim/lua/plugins/blink.cmp.lua new file mode 100644 index 0000000..d5f292b --- /dev/null +++ b/.config/nvim/lua/plugins/blink.cmp.lua @@ -0,0 +1,23 @@ +return { + "saghen/blink.cmp", + version = "*", + opts = { + keymap = { preset = "super-tab" }, + appearance = { + use_nvim_cmp_as_default = true, + nerd_font_variant = "mono", + }, + + fuzzy = { + max_typos = function(keyword) + return math.floor(#keyword / 0) + end, + }, + + sources = { + default = { "lsp", "path", "snippets", "buffer" }, + -- cmdline = {}, + }, + }, + opts_extend = { "sources.default" }, +} diff --git a/.config/nvim/lua/plugins/harpoon.lua b/.config/nvim/lua/plugins/harpoon.lua new file mode 100644 index 0000000..9ca692f --- /dev/null +++ b/.config/nvim/lua/plugins/harpoon.lua @@ -0,0 +1,22 @@ +return { + "ThePrimeagen/harpoon", + branch = "harpoon2", + dependencies = { "nvim-lua/plenary.nvim" }, + config = function() + local harpoon = require "harpoon" + harpoon:setup() + + vim.keymap.set("n", "", function() + harpoon:list():add() + end) + vim.keymap.set("n", "", function() + harpoon.ui:toggle_quick_menu(harpoon:list()) + end) + + for _, idx in ipairs { 1, 2, 3, 4, 5 } do + vim.keymap.set("n", string.format("%d", idx), function() + harpoon:list():select(idx) + end) + end + end, +} diff --git a/.config/nvim/lua/plugins/highlight-colors.lua b/.config/nvim/lua/plugins/highlight-colors.lua new file mode 100644 index 0000000..a0c61b7 --- /dev/null +++ b/.config/nvim/lua/plugins/highlight-colors.lua @@ -0,0 +1,29 @@ +return { + "brenoprata10/nvim-highlight-colors", + cmd = "HighlightColors", + lazy = true, + config = function() + vim.opt.termguicolors = true + require("nvim-highlight-colors").setup { + render = "virtual", + virtual_symbol = "■", + virtual_symbol_prefix = " ", + virtual_symbol_suffix = "", + virtual_symbol_position = "eow", + enable_hex = true, + enable_short_hex = true, + enable_rgb = true, + enable_hsl = true, + enable_var_usage = true, + enable_named_colors = true, + enable_tailwind = false, + custom_colors = { + { label = "%-%-theme%-primary%-color", color = "#0f1219" }, + { label = "%-%-theme%-secondary%-color", color = "#5a5d64" }, + }, + + exclude_filetypes = {}, + exclude_buftypes = {}, + } + end, +} diff --git a/.config/nvim/lua/plugins/hover.lua b/.config/nvim/lua/plugins/hover.lua new file mode 100644 index 0000000..9368041 --- /dev/null +++ b/.config/nvim/lua/plugins/hover.lua @@ -0,0 +1,58 @@ +return { + "lewis6991/hover.nvim", + config = function() + local hover = require "hover" + hover.config({ + --- List of modules names to load as providers. + --- @type (string|Hover.Config.Provider)[] + providers = { + 'hover.providers.diagnostic', + 'hover.providers.lsp', + 'hover.providers.dap', + 'hover.providers.man', + 'hover.providers.dictionary', + -- Optional, disabled by default: + -- 'hover.providers.gh', + -- 'hover.providers.gh_user', + -- 'hover.providers.jira', + -- 'hover.providers.fold_preview', + -- 'hover.providers.highlight', + }, + preview_opts = { + border = 'single' + }, + -- Whether the contents of a currently open hover window should be moved + -- to a :h preview-window when pressing the hover keymap. + preview_window = false, + title = true, + mouse_providers = { + 'hover.providers.lsp', + }, + mouse_delay = 1000 + }) + + -- Setup keymaps + vim.keymap.set('n', 'K', function() + require('hover').open() + end, { desc = 'hover.nvim (open)' }) + + vim.keymap.set('n', 'gK', function() + require('hover').enter() + end, { desc = 'hover.nvim (enter)' }) + + --vim.keymap.set('n', '', function() + -- require('hover').hover_switch('previous') + --end, { desc = 'hover.nvim (previous source)' }) + + --vim.keymap.set('n', '', function() + -- require('hover').hover_switch('next') + --end, { desc = 'hover.nvim (next source)' }) + + -- Mouse support + --vim.keymap.set('n', '', function() + -- require('hover').mouse() + --end, { desc = 'hover.nvim (mouse)' }) + + vim.o.mousemoveevent = true + end, +} diff --git a/.config/nvim/lua/plugins/init.lua b/.config/nvim/lua/plugins/init.lua new file mode 100644 index 0000000..76b1b49 --- /dev/null +++ b/.config/nvim/lua/plugins/init.lua @@ -0,0 +1,31 @@ +return { + { "nvim-lua/plenary.nvim" }, + { "folke/zen-mode.nvim", cmd = "ZenMode", opts = {}, lazy = true }, + { 'SCJangra/table-nvim', ft = { 'markdown', 'md' }, opts = {}, lazy = true }, + -- for LSP + { "j-hui/fidget.nvim", opts = {}, }, -- LSP progress messages & notifications + { "stevearc/conform.nvim", opts = {}, }, -- Autoformatting + { "b0o/SchemaStore.nvim", event = "VeryLazy" }, -- Adds JSON Schema support for jsonls + -- mini extras + -- { + -- "nvim-mini/mini.pairs", + -- version = false, + -- conifg = function() + -- require("mini.pairs").setup() + -- end, + -- }, + -- { + -- 'nvim-mini/mini.surround', + -- version = false, + -- config = function() + -- require("mini.surround").setup() + -- end, + -- }, + -- { + -- "nvim-mini/mini.icons", + -- version = false, + -- config = function() + -- require("mini.icons").setup() + -- end, + -- }, +} diff --git a/.config/nvim/lua/plugins/kiwi.lua b/.config/nvim/lua/plugins/kiwi.lua new file mode 100644 index 0000000..abccc24 --- /dev/null +++ b/.config/nvim/lua/plugins/kiwi.lua @@ -0,0 +1,17 @@ +return { + 'serenevoid/kiwi.nvim', + dir = "/home/moxie/.local/share/nvim/lazy/kiwi.nvim/", + branch = "local", + dev = true, + opts = { + { + name = "wiki", + path = "wiki" + }, + }, + keys = { + { "ww", ":lua require(\"kiwi\").open_wiki_index()", desc = "Open Wiki index" }, + { "T", ":lua require(\"kiwi\").todo.toggle()", desc = "Toggle Markdown Task" } + }, + lazy = true +} diff --git a/.config/nvim/lua/plugins/lazydev.lua b/.config/nvim/lua/plugins/lazydev.lua new file mode 100644 index 0000000..327ba76 --- /dev/null +++ b/.config/nvim/lua/plugins/lazydev.lua @@ -0,0 +1,26 @@ +return { + { + "folke/lazydev.nvim", + ft = "lua", + opts = { + library = { + { path = "${3rd}/luv/library", words = { "vim%.uv" } }, + }, + }, + }, + { + "saghen/blink.cmp", + opts = { + sources = { + default = { "lazydev", "lsp", "path", "snippets", "buffer" }, + providers = { + lazydev = { + name = "LazyDev", + module = "lazydev.integrations.blink", + score_offset = 100, + }, + }, + }, + }, + }, +} diff --git a/.config/nvim/lua/plugins/lualine.lua b/.config/nvim/lua/plugins/lualine.lua new file mode 100644 index 0000000..c1000ef --- /dev/null +++ b/.config/nvim/lua/plugins/lualine.lua @@ -0,0 +1,161 @@ +return { + "nvim-lualine/lualine.nvim", + dependencies = { "nvim-tree/nvim-web-devicons" }, + + config = function() + local theme = function() + local colors = { + black = '#282828', + black_hard = '#1d2021', + white = '#ebdbb2', + red = '#fb4934', + green = '#b8bb26', + yellow = '#d79921', + yellow_bright = '#fabd2f', + blue = '#83a598', + purple = '#d3859b', + aqua = '#8ec07c', + orange = '#d65d0e', + orange_bright = '#fe8019', + gray = '#a89984', + darkgray = '#3c3836', + lightgray = '#504945', + inactivegray = '#7c6f64', + } + + return { + normal = { + a = { bg = colors.yellow, fg = colors.black, gui = 'bold' }, + b = { bg = colors.darkgray, fg = colors.white }, + c = { bg = colors.darkgray, fg = colors.white } + }, + insert = { + a = { bg = colors.yellow, fg = colors.black, gui = 'bold' }, + b = { bg = colors.darkgray, fg = colors.white }, + c = { bg = colors.darkgray, fg = colors.white } + }, + visual = { + a = { bg = colors.yellow, fg = colors.black, gui = 'bold' }, + b = { bg = colors.darkgray, fg = colors.white }, + c = { bg = colors.darkgray, fg = colors.white } + }, + replace = { + a = { bg = colors.yellow, fg = colors.black, gui = 'bold' }, + b = { bg = colors.darkgray, fg = colors.white }, + c = { bg = colors.darkgray, fg = colors.white } + }, + command = { + a = { bg = colors.yellow, fg = colors.black, gui = 'bold' }, + b = { bg = colors.darkgray, fg = colors.white }, + c = { bg = colors.darkgray, fg = colors.white } + }, + inactive = { + a = { bg = colors.darkgray, fg = colors.gray, gui = 'bold' }, + b = { bg = colors.darkgray, fg = colors.gray }, + c = { bg = colors.darkgray, fg = colors.gray } + } + } + end + + + local tty = function() + local colors = { + black = '#000000', + -- white = '#ffffff', + white = '#ebdbb2', + yellow = '#d79921', + gray = '#a89984', + darkgray = '#3c3836', + } + + return { + normal = { + a = { bg = colors.yellow, fg = colors.black }, + b = { bg = colors.darkgray, fg = colors.white }, + c = { bg = colors.darkgray, fg = colors.white } + }, + insert = { + a = { bg = colors.yellow, fg = colors.black }, + b = { bg = colors.darkgray, fg = colors.white }, + c = { bg = colors.darkgray, fg = colors.white } + }, + visual = { + a = { bg = colors.yellow, fg = colors.black }, + b = { bg = colors.darkgray, fg = colors.white }, + c = { bg = colors.darkgray, fg = colors.white } + }, + replace = { + a = { bg = colors.yellow, fg = colors.black }, + b = { bg = colors.darkgray, fg = colors.white }, + c = { bg = colors.darkgray, fg = colors.white } + }, + command = { + a = { bg = colors.yellow, fg = colors.black }, + b = { bg = colors.darkgray, fg = colors.white }, + c = { bg = colors.darkgray, fg = colors.white } + }, + inactive = { + a = { bg = colors.darkgray, fg = colors.white }, + b = { bg = colors.darkgray, fg = colors.white }, + c = { bg = colors.darkgray, fg = colors.white } + } + } + end + + require('lualine').setup { + options = { + icons_enabled = false, + theme = theme, -- theme or tty + component_separators = { left = '', right = '' }, + section_separators = { left = '', right = '' }, + disabled_filetypes = { + statusline = {}, + winbar = {}, + }, + ignore_focus = {}, + always_divide_middle = true, + always_show_tabline = true, + globalstatus = false, + refresh = { + statusline = 1000, + tabline = 1000, + winbar = 1000, + refresh_time = 16, + events = { + 'WinEnter', + 'BufEnter', + 'BufWritePost', + 'SessionLoadPost', + 'FileChangedShellPost', + 'VimResized', + 'Filetype', + 'CursorMoved', + 'CursorMovedI', + 'ModeChanged', + }, + } + }, + sections = { + lualine_a = { 'mode' }, + lualine_b = { 'branch', 'diff', 'diagnostics' }, + lualine_c = { 'filename' }, + lualine_x = { 'encoding', 'fileformat', 'filetype' }, + -- lualine_y = { 'progress' }, + lualine_y = { '' }, + lualine_z = { 'location' } + }, + inactive_sections = { + lualine_a = {}, + lualine_b = {}, + lualine_c = { 'filename' }, + lualine_x = { 'location' }, + lualine_y = {}, + lualine_z = {} + }, + tabline = {}, + winbar = {}, + inactive_winbar = {}, + extensions = {} + } + end, +} diff --git a/.config/nvim/lua/plugins/oil.lua b/.config/nvim/lua/plugins/oil.lua new file mode 100644 index 0000000..1abc120 --- /dev/null +++ b/.config/nvim/lua/plugins/oil.lua @@ -0,0 +1,22 @@ +return { + "stevearc/oil.nvim", + dependencies = { "nvim-tree/nvim-web-devicons" }, + config = function() + require("oil").setup { + columns = { "icon" }, + keymaps = { + [""] = false, + [""] = "actions.select_split", + }, + view_options = { + show_hidden = true, + }, + } + + -- Open parent directory in current window + vim.keymap.set("n", "-", "Oil", { desc = "Open parent directory" }) + + -- Open parent directory in floating window + vim.keymap.set("n", "-", require("oil").toggle_float) + end, +} diff --git a/.config/nvim/lua/plugins/outline.lua b/.config/nvim/lua/plugins/outline.lua new file mode 100644 index 0000000..8326e53 --- /dev/null +++ b/.config/nvim/lua/plugins/outline.lua @@ -0,0 +1,10 @@ +return { + "hedyhli/outline.nvim", + lazy = true, + cmd = { "Outline", "OutlineOpen" }, + keys = { + { "o", vim.cmd.Outline, desc = "Toggle outline" }, + }, + opts = { + }, +} diff --git a/.config/nvim/lua/plugins/render-markdown.lua b/.config/nvim/lua/plugins/render-markdown.lua new file mode 100644 index 0000000..da9fe62 --- /dev/null +++ b/.config/nvim/lua/plugins/render-markdown.lua @@ -0,0 +1,44 @@ +return { + 'MeanderingProgrammer/render-markdown.nvim', + cmd = "RenderMarkdown", + ft = { "markdown", "md" }, + lazy = true, + -- dependencies = { 'nvim-treesitter/nvim-treesitter', 'nvim-mini/mini.icons' }, -- if you use standalone mini plugins + dependencies = { 'nvim-treesitter/nvim-treesitter', 'nvim-tree/nvim-web-devicons' }, -- if you prefer nvim-web-devicons + + ---@module 'render-markdown' + ---@type render.md.UserConfig + opts = {}, + config = function() + require('render-markdown').setup({ + -- completions = { lsp = { enabled = true } }, + heading = { + -- position = 'inline', + icons = { '➤ ' }, + -- icons = { '󰼏 ', '󰎨 ' }, + -- icons = { '➤ ', '➢ ' }, + width = 'block', + left_pad = 1, + right_pad = 1, + }, + bullet = { + -- icons = { '▫️', '▪️' }, + icons = { '■', '□' }, + }, + code = { + width = 'block', + min_width = 45, + left_pad = 0, + right_pad = 2, + language_pad = 0, + }, + }) + end, + -- fg = #b8bb26 + vim.api.nvim_set_hl(0, 'RenderMarkdownH1Bg', { fg = '#000000', bg = '#fabd2f' }), + vim.api.nvim_set_hl(0, 'RenderMarkdownH2Bg', { bg = '#181818' }), + vim.api.nvim_set_hl(0, 'RenderMarkdownH3Bg', { bg = '#242424' }), + vim.api.nvim_set_hl(0, 'RenderMarkdownH4Bg', { bg = '#303030' }), + vim.api.nvim_set_hl(0, 'RenderMarkdownH5Bg', { bg = '#3c3c3c' }), + vim.api.nvim_set_hl(0, 'RenderMarkdownH6Bg', { bg = '#424242' }), +} diff --git a/.config/nvim/lua/plugins/telescope.lua b/.config/nvim/lua/plugins/telescope.lua new file mode 100644 index 0000000..4d8e86c --- /dev/null +++ b/.config/nvim/lua/plugins/telescope.lua @@ -0,0 +1,48 @@ +return { + 'nvim-telescope/telescope.nvim', + dependencies = { + { 'nvim-lua/plenary.nvim' }, + { 'nvim-telescope/telescope-fzf-native.nvim', build = 'make' }, + { 'nvim-telescope/telescope-smart-history.nvim' }, + { 'kkharji/sqlite.lua' }, + }, + config = function() + local data = assert(vim.fn.stdpath 'data') --[[@as string]] + + require('telescope').setup { + extensions = { + fzf = { + fuzzy = true, + override_generic_sorter = true, + override_file_sorter = true, + case_mode = 'smart_case', + }, + wrap_results = true, + history = { + path = vim.fs.joinpath(data, 'telescope_history.sqlite3'), + limit = 100, + }, + }, + } + + pcall(require('telescope').load_extension, 'fzf') + pcall(require('telescope').load_extension, 'smart_history') + + local builtin = require 'telescope.builtin' + + vim.keymap.set('n', 'fd', builtin.find_files) + vim.keymap.set('n', 'fh', builtin.help_tags) + vim.keymap.set('n', 'fg', builtin.live_grep) + vim.keymap.set('n', '/', builtin.current_buffer_fuzzy_find) + vim.keymap.set('n', 'gw', builtin.grep_string) + + vim.keymap.set('n', 'fa', function() + ---@diagnostic disable-next-line: param-type-mismatch + builtin.find_files { cwd = vim.fs.joinpath(vim.fn.stdpath 'data', 'lazy') } + end) + + vim.keymap.set('n', 'en', function() + builtin.find_files { cwd = vim.fn.stdpath 'config' } + end) + end, +} diff --git a/.config/nvim/lua/plugins/treesitter.lua b/.config/nvim/lua/plugins/treesitter.lua new file mode 100644 index 0000000..9d4697d --- /dev/null +++ b/.config/nvim/lua/plugins/treesitter.lua @@ -0,0 +1,42 @@ +return { + "nvim-treesitter/nvim-treesitter", + config = function() + require("nvim-treesitter.configs").setup { + modules = {}, + ensure_installed = { + "latex", + "markdown", + "markdown_inline", + "vim", + "vimdoc", + "query", + "bash", + "c", + "cpp", + "rust", + "toml", + "python", + "haskell", + "go", + "lua", + "luadoc", + "html", + "css", + "scss", + "json", + "ruby", + "yaml", + "javascript", + "typescript", + "tsx", + }, + sync_install = false, + auto_install = true, + ignore_install = {}, + highlight = { + enable = true, + additional_vim_regex_highlighting = false, + }, + } + end, +} diff --git a/.config/nvim/lua/plugins/undotree.lua b/.config/nvim/lua/plugins/undotree.lua new file mode 100644 index 0000000..8a416b1 --- /dev/null +++ b/.config/nvim/lua/plugins/undotree.lua @@ -0,0 +1,8 @@ +return { + "mbbill/undotree", + lazy = true, + cmd = { "UndotreeToggle" }, + keys = { + { "u", vim.cmd.UndotreeToggle, desc = "Toggle undotree" }, + }, +} -- cgit v1.2.3