diff --git a/.config/nvim/lua/goodhumored/common-bindings.lua b/.config/nvim/lua/goodhumored/common-bindings.lua index b3fc0d2..1ec80af 100644 --- a/.config/nvim/lua/goodhumored/common-bindings.lua +++ b/.config/nvim/lua/goodhumored/common-bindings.lua @@ -4,8 +4,12 @@ vim.keymap.set("n", "", "nohlsearch") -- ───────────────────────── Diagnostic keymaps ────────────────────── vim.keymap.set("n", "q", vim.diagnostic.setloclist, { desc = "Open diagnostic [Q]uickfix list" }) +-- ╭─────────────────────────────────────────────────────────╮ +-- │ terminal │ +-- ╰─────────────────────────────────────────────────────────╯ -- ────────── easy leave terminal (shortcut to ctrl+\, ctrl+n) ─────── vim.keymap.set("t", "", "", { desc = "Exit terminal mode" }) +vim.keymap.set("n", "tt", ":ToggleTerm", { desc = "Toggle terminal" }) -- ╭─────────────────────────────────────────────────────────╮ -- │ Windows │ diff --git a/.config/nvim/lua/goodhumored/common-vim-settings.lua b/.config/nvim/lua/goodhumored/common-vim-settings.lua index ab4ec5a..2d1eb21 100644 --- a/.config/nvim/lua/goodhumored/common-vim-settings.lua +++ b/.config/nvim/lua/goodhumored/common-vim-settings.lua @@ -106,3 +106,41 @@ vim.api.nvim_create_autocmd({ "BufEnter", "BufWinEnter" }, { }) end, }) + +-- ╭─────────────────────────────────────────────────────────╮ +-- │ Langmap │ +-- ╰─────────────────────────────────────────────────────────╯ + +local function escape(str) + -- Эти символы должны быть экранированы, если встречаются в langmap + local escape_chars = [[;,."|\]] + return vim.fn.escape(str, escape_chars) +end + +-- Наборы символов, введенных с зажатым шифтом +local en_shift = [[~QWERTYUIOP{}ASDFGHJKL:"ZXCVBNM<>]] +local ru_shift = [[ËЙЦУКЕНГШЩЗХЪФЫВАПРОЛДЖЭЯЧСМИТЬБЮ]] +-- Наборы символов, введенных как есть +-- Здесь я не добавляю ',.' и 'бю', чтобы впоследствии не было рекурсивного вызова комманды +local en = [[`qwertyuiop[]asdfghjkl;'zxcvbnm,.]] +local ru = [[ёйцукенгшщзхъфывапролджэячсмитьбю]] +vim.opt.langmap = vim.fn.join({ + -- ; - разделитель, который не нужно экранировать + -- | + escape(ru_shift) + .. ";" + .. escape(en_shift), + escape(ru) .. ";" .. escape(en), +}, ",") + +-- ╭─────────────────────────────────────────────────────────╮ +-- │ enable word wrap and linebreak for norg and markdown │ +-- │ files │ +-- ╰─────────────────────────────────────────────────────────╯ +vim.api.nvim_create_autocmd("FileType", { + pattern = { "norg", "markdown" }, + callback = function() + vim.opt_local.wrap = true + vim.opt_local.linebreak = true + end, +}) diff --git a/.config/nvim/lua/goodhumored/plugins/auto-pairs.lua b/.config/nvim/lua/goodhumored/plugins/auto-pairs.lua new file mode 100644 index 0000000..1b30f35 --- /dev/null +++ b/.config/nvim/lua/goodhumored/plugins/auto-pairs.lua @@ -0,0 +1,3 @@ +return { + "jiangmiao/auto-pairs", +} diff --git a/.config/nvim/lua/goodhumored/plugins/autocomplete.lua b/.config/nvim/lua/goodhumored/plugins/autocomplete.lua index 87eb3e8..6e4cf7f 100644 --- a/.config/nvim/lua/goodhumored/plugins/autocomplete.lua +++ b/.config/nvim/lua/goodhumored/plugins/autocomplete.lua @@ -76,7 +76,7 @@ return { -- Autocompletion -- Manually trigger a completion from nvim-cmp. -- Generally you don't need this, because nvim-cmp will display -- completions whenever it has completion options available. - [""] = cmp.mapping.complete({}), + [""] = cmp.mapping.complete(), -- Think of as moving to the right of your snippet expansion. -- So if you have a snippet that's like: diff --git a/.config/nvim/lua/goodhumored/plugins/clipboard-image.lua b/.config/nvim/lua/goodhumored/plugins/clipboard-image.lua new file mode 100644 index 0000000..8f70b46 --- /dev/null +++ b/.config/nvim/lua/goodhumored/plugins/clipboard-image.lua @@ -0,0 +1,29 @@ +-- ╭─────────────────────────────────────────────────────────╮ +-- │ ekickx/clipboard-image.nvim │ +-- │ paste images into markdown │ +-- ╰─────────────────────────────────────────────────────────╯ +return { + "postfen/clipboard-image.nvim", + config = function() + require("clipboard-image").setup({ + default = { + img_name = function() + vim.fn.inputsave() + local name = vim.fn.input("Name: ") + vim.fn.inputrestore() + if name == nil or name == "" then + name = os.date("%d-%m-%y-%H:%M:%S") + end + return name + end, + img_handler = function(img) + vim.cmd("normal! f[") -- go to [ + vim.cmd("normal! a" .. img.name) -- append text with image name + end, + + img_dir = { "%:p:h", "img" }, + }, + }) + vim.keymap.set("n", "pi", "PasteImg", { desc = "[P]aste [I]mage" }) + end, +} diff --git a/.config/nvim/lua/goodhumored/plugins/common.lua b/.config/nvim/lua/goodhumored/plugins/common.lua index eb0fd3e..07efe9b 100644 --- a/.config/nvim/lua/goodhumored/plugins/common.lua +++ b/.config/nvim/lua/goodhumored/plugins/common.lua @@ -1,4 +1,3 @@ return { "tpope/vim-sleuth", -- Detect tabstop and shiftwidth automatically - "jiangmiao/auto-pairs", } diff --git a/.config/nvim/lua/goodhumored/plugins/dap/dap-go.lua b/.config/nvim/lua/goodhumored/plugins/dap/dap-go.lua new file mode 100644 index 0000000..396c54f --- /dev/null +++ b/.config/nvim/lua/goodhumored/plugins/dap/dap-go.lua @@ -0,0 +1,58 @@ +return { + "leoluz/nvim-dap-go", + config = function() + require("dap-go").setup({ + -- Additional dap configurations can be added. + -- dap_configurations accepts a list of tables where each entry + -- represents a dap configuration. For more details do: + -- :help dap-configuration + dap_configurations = { + { + -- Must be "go" or it will be ignored by the plugin + type = "go", + name = "Attach remote", + mode = "remote", + request = "attach", + }, + }, + -- delve configurations + delve = { + -- the path to the executable dlv which will be used for debugging. + -- by default, this is the "dlv" executable on your PATH. + path = "dlv", + -- time to wait for delve to initialize the debug session. + -- default to 20 seconds + initialize_timeout_sec = 20, + -- a string that defines the port to start delve debugger. + -- default to string "${port}" which instructs nvim-dap + -- to start the process in a random available port. + -- if you set a port in your debug configuration, its value will be + -- assigned dynamically. + port = "${port}", + -- additional args to pass to dlv + args = {}, + -- the build flags that are passed to delve. + -- defaults to empty string, but can be used to provide flags + -- such as "-tags=unit" to make sure the test suite is + -- compiled during debugging, for example. + -- passing build flags using args is ineffective, as those are + -- ignored by delve in dap mode. + -- avaliable ui interactive function to prompt for arguments get_arguments + build_flags = {}, + -- whether the dlv process to be created detached or not. there is + -- an issue on Windows where this needs to be set to false + -- otherwise the dlv server creation will fail. + -- avaliable ui interactive function to prompt for build flags: get_build_flags + detached = vim.fn.has("win32") == 0, + -- the current working directory to run dlv from, if other than + -- the current working directory. + cwd = nil, + }, + -- options related to running closest test + tests = { + -- enables verbosity when running the test. + verbose = false, + }, + }) + end, +} diff --git a/.config/nvim/lua/goodhumored/plugins/dap/dap.lua b/.config/nvim/lua/goodhumored/plugins/dap/dap.lua index 1c01e54..ab1cd07 100644 --- a/.config/nvim/lua/goodhumored/plugins/dap/dap.lua +++ b/.config/nvim/lua/goodhumored/plugins/dap/dap.lua @@ -78,6 +78,16 @@ return { }, } end + + dap.configurations.go = { + { + type = "go", + name = "Debug", + request = "launch", + program = "${file}", + }, + } + -- setup dap config by VsCode launch.json file local vscode = require("dap.ext.vscode") local json = require("plenary.json") @@ -90,6 +100,7 @@ return { vscode.load_launchjs() end end, + keys = { { "d", "", desc = "+debug", mode = { "n", "v" } }, { diff --git a/.config/nvim/lua/goodhumored/plugins/dressing.lua b/.config/nvim/lua/goodhumored/plugins/dressing.lua new file mode 100644 index 0000000..aed2d9f --- /dev/null +++ b/.config/nvim/lua/goodhumored/plugins/dressing.lua @@ -0,0 +1,8 @@ +-- ╭─────────────────────────────────────────────────────────╮ +-- │ stevearc/dressing.nvim │ +-- │ beautiful inputs │ +-- ╰─────────────────────────────────────────────────────────╯ +return { + "stevearc/dressing.nvim", + opts = {}, +} diff --git a/.config/nvim/lua/goodhumored/plugins/easytables.lua b/.config/nvim/lua/goodhumored/plugins/easytables.lua new file mode 100644 index 0000000..fe21efe --- /dev/null +++ b/.config/nvim/lua/goodhumored/plugins/easytables.lua @@ -0,0 +1,27 @@ +-- ╭─────────────────────────────────────────────────────────╮ +-- │ Myzel394/easytables.nvim │ +-- │ plugin for easy work with markdown tables │ +-- │ https://github.com/Myzel394/easytables.nvim │ +-- ╰─────────────────────────────────────────────────────────╯ +-- #### Inserting a new table +-- +-- Go to the place where you want to insert your table and either call: +-- +-- * `:EasyTablesCreateNew x` - Creates a new table with `` columns and `` rows +-- * `:EasyTablesCreateNew ` - Creates a square table with the size of `` (eg. `:EasyTablesCreateNew 5` -> Creates a `5x5` table) +-- * `:EasyTablesCreateNew x` - Creates a table with `` columns and **one** row +-- * `:EasyTablesCreateNew x` - Creates a table with **one** column and `` rows +-- +-- #### Editing an existing table +-- +-- Go to your table (doesn't matter where, can be at a border or inside a cell) and type: +-- +-- `:EasyTablesImportThisTable` +return { + "Myzel394/easytables.nvim", + config = function() + require("easytables").setup({ + -- Your configuration comes here + }) + end, +} diff --git a/.config/nvim/lua/goodhumored/plugins/image.lua.disable b/.config/nvim/lua/goodhumored/plugins/image.lua.disable new file mode 100644 index 0000000..63ebe56 --- /dev/null +++ b/.config/nvim/lua/goodhumored/plugins/image.lua.disable @@ -0,0 +1,52 @@ +-- ╭─────────────────────────────────────────────────────────╮ +-- │ 3rd/image.nvim │ +-- │ images view inside vim │ +-- ╰─────────────────────────────────────────────────────────╯ +return { + "3rd/image.nvim", + config = function() + local image = require("image") + -- default config + image.setup({ + backend = "kitty", + integrations = { + markdown = { + enabled = true, + clear_in_insert_mode = false, + download_remote_images = true, + only_render_image_at_cursor = false, + filetypes = { "markdown", "vimwiki" }, -- markdown extensions (ie. quarto) can go here + }, + neorg = { + enabled = true, + clear_in_insert_mode = false, + download_remote_images = true, + only_render_image_at_cursor = false, + filetypes = { "norg" }, + }, + html = { + enabled = false, + }, + css = { + enabled = false, + }, + }, + max_width = nil, + max_height = nil, + max_width_window_percentage = nil, + max_height_window_percentage = 50, + window_overlap_clear_enabled = false, -- toggles images when windows are overlapped + window_overlap_clear_ft_ignore = { "cmp_menu", "cmp_docs", "" }, + editor_only_render_when_focused = false, -- auto show/hide images when the editor gains/looses focus + tmux_show_only_in_active_window = true, -- auto show/hide images in the correct Tmux window (needs visual-activity off) + hijack_file_patterns = { "*.png", "*.jpg", "*.jpeg", "*.gif", "*.webp", "*.avif" }, -- render image files as images when opened + }) + vim.keymap.set("n", "ti", function() + if image.is_enabled() then + image.disable() + else + image.enable() + end + end, {}) + end, +} diff --git a/.config/nvim/lua/goodhumored/plugins/kanagawa-color-scheme.lua.disabled b/.config/nvim/lua/goodhumored/plugins/kanagawa-color-scheme.lua.disabled new file mode 100644 index 0000000..87c2b23 --- /dev/null +++ b/.config/nvim/lua/goodhumored/plugins/kanagawa-color-scheme.lua.disabled @@ -0,0 +1,3 @@ +return { + "rebelot/kanagawa.nvim", +} diff --git a/.config/nvim/lua/goodhumored/plugins/lsp.lua b/.config/nvim/lua/goodhumored/plugins/lsp.lua index 99c4682..48dfb6a 100644 --- a/.config/nvim/lua/goodhumored/plugins/lsp.lua +++ b/.config/nvim/lua/goodhumored/plugins/lsp.lua @@ -203,7 +203,26 @@ return { -- LSP Configuration & Plugins -- ol gur freire pbasvthengvba nobir. Hfrshy jura qvfnoyvat -- pregnva srngherf bs na YFC (sbe rknzcyr, gheavat bss sbeznggvat sbe gffreire) server.capabilities = vim.tbl_deep_extend("force", {}, capabilities, server.capabilities or {}) - require("lspconfig")[server_name].setup(server) + local lspConfig = require("lspconfig") + lspConfig[server_name].setup(server) + lspConfig.gopls.setup({ + settings = { + gopls = { + gofumpt = true, + golines = true, + }, + }, + }) + -- https://microsoft.github.io/pyright/#/settings + lspConfig.pyright.setup({ + capabilities = capabilities, + python = { + analysis = { + autoSearchPaths = true, + diagnosticMode = "workspace", + }, + }, + }) end, }, }) diff --git a/.config/nvim/lua/goodhumored/plugins/ltex.lua b/.config/nvim/lua/goodhumored/plugins/ltex.lua new file mode 100644 index 0000000..9b02b0f --- /dev/null +++ b/.config/nvim/lua/goodhumored/plugins/ltex.lua @@ -0,0 +1,45 @@ +return { + "vigoux/ltex-ls.nvim", + -- config = function() + -- require("ltex-ls").setup({ + -- use_spellfile = false, + -- filetypes = { "latex", "tex", "bib", "markdown", "gitcommit", "text" }, + -- settings = { + -- ltex = { + -- enabled = { "latex", "tex", "bib", "markdown" }, + -- language = "auto", + -- diagnosticSeverity = "information", + -- sentenceCacheSize = 2000, + -- additionalRules = { + -- enablePickyRules = true, + -- motherTongue = "ru", + -- }, + -- disabledRules = {}, + -- dictionary = (function() + -- -- For dictionary, search for files in the runtime to have + -- -- and include them as externals the format for them is + -- -- dict/{LANG}.txt + -- -- + -- -- Also add dict/default.txt to all of them + -- local files = {} + -- for _, file in ipairs(vim.api.nvim_get_runtime_file("dict/*", true)) do + -- local lang = vim.fn.fnamemodify(file, ":t:r") + -- local fullpath = vim.fs.normalize(file, ":p") + -- files[lang] = { ":" .. fullpath } + -- end + -- + -- if files.default then + -- for lang, _ in pairs(files) do + -- if lang ~= "default" then + -- vim.list_extend(files[lang], files.default) + -- end + -- end + -- files.default = nil + -- end + -- return files + -- end)(), + -- }, + -- }, + -- }) + -- end, +} diff --git a/.config/nvim/lua/goodhumored/plugins/markdown-preview.lua b/.config/nvim/lua/goodhumored/plugins/markdown-preview.lua new file mode 100644 index 0000000..a7d24ff --- /dev/null +++ b/.config/nvim/lua/goodhumored/plugins/markdown-preview.lua @@ -0,0 +1,12 @@ +-- install with yarn or npm +return +-- install with yarn or npm +{ + "iamcco/markdown-preview.nvim", + cmd = { "MarkdownPreviewToggle", "MarkdownPreview", "MarkdownPreviewStop" }, + build = "cd app && yarn install", + init = function() + vim.g.mkdp_filetypes = { "markdown" } + end, + ft = { "markdown" }, +} diff --git a/.config/nvim/lua/goodhumored/plugins/markview.lua b/.config/nvim/lua/goodhumored/plugins/markview.lua new file mode 100644 index 0000000..6e3fd90 --- /dev/null +++ b/.config/nvim/lua/goodhumored/plugins/markview.lua @@ -0,0 +1,17 @@ +-- ╭─────────────────────────────────────────────────────────╮ +-- │ markview │ +-- │ markdown beautifier │ +-- ╰─────────────────────────────────────────────────────────╯ +return { + "OXY2DEV/markview.nvim", + lazy = false, -- Recommended + -- ft = "markdown" -- If you decide to lazy-load anyway + + dependencies = { + -- You will not need this if you installed the + -- parsers manually + -- Or if the parsers are in your $RUNTIMEPATH + "nvim-treesitter/nvim-treesitter", + "nvim-tree/nvim-web-devicons", + }, +} diff --git a/.config/nvim/lua/goodhumored/plugins/methods_lsp_signature.lua b/.config/nvim/lua/goodhumored/plugins/methods_lsp_signature.lua new file mode 100644 index 0000000..8047006 --- /dev/null +++ b/.config/nvim/lua/goodhumored/plugins/methods_lsp_signature.lua @@ -0,0 +1,13 @@ +-- ╭─────────────────────────────────────────────────────────╮ +-- │ ray-x/lsp_signature.nvim │ +-- │ shows method signature in insert mode │ +-- ╰─────────────────────────────────────────────────────────╯ + +return { + "ray-x/lsp_signature.nvim", + event = "VeryLazy", + opts = {}, + config = function(_, opts) + require("lsp_signature").setup(opts) + end, +} diff --git a/.config/nvim/lua/goodhumored/plugins/neorg.lua b/.config/nvim/lua/goodhumored/plugins/neorg.lua new file mode 100644 index 0000000..47fb441 --- /dev/null +++ b/.config/nvim/lua/goodhumored/plugins/neorg.lua @@ -0,0 +1,50 @@ +return { + "nvim-neorg/neorg", + lazy = false, + version = "*", + config = function() + require("neorg").setup({ + load = { + ["core.defaults"] = {}, + ["core.concealer"] = {}, + ["core.dirman"] = { + config = { + workspaces = { + notes = "~/notes", + uni = "~/Uni", + job = "~/job", + side = "~/side-hustle", + }, + default_workspace = "notes", + }, + }, + }, + }) + + vim.wo.foldlevel = 99 + vim.wo.conceallevel = 2 + end, + + keys = { + { + "n", + ":Neorg", + desc = "[N]eorg", + }, + { + "nw", + ":Neorg workspace", + desc = "[N]eorg [W]orkspaces", + }, + { + "nj", + ":Neorg journal", + desc = "[N]eorg [J]ournal", + }, + { + "ni", + ":Neorg index", + desc = "[N]eorg [I]ndex", + }, + }, +} diff --git a/.config/nvim/lua/goodhumored/plugins/otter.lua b/.config/nvim/lua/goodhumored/plugins/otter.lua new file mode 100644 index 0000000..0e8a1b5 --- /dev/null +++ b/.config/nvim/lua/goodhumored/plugins/otter.lua @@ -0,0 +1,14 @@ +-- ╭─────────────────────────────────────────────────────────╮ +-- │ jmbuhr/otter.nvim │ +-- │ adds completions, treesitter and lsp featurs to │ +-- │ markdown codeblocks │ +-- │ https://github.com/jmbuhr/otter.nvim │ +-- ╰─────────────────────────────────────────────────────────╯ + +return { + "jmbuhr/otter.nvim", + dependencies = { + "nvim-treesitter/nvim-treesitter", + }, + opts = {}, +} diff --git a/.config/nvim/lua/goodhumored/plugins/pastify.lua.disable b/.config/nvim/lua/goodhumored/plugins/pastify.lua.disable new file mode 100644 index 0000000..902457d --- /dev/null +++ b/.config/nvim/lua/goodhumored/plugins/pastify.lua.disable @@ -0,0 +1,15 @@ +-- ╭─────────────────────────────────────────────────────────╮ +-- │ pastify │ +-- │ enables pasting image from clipboard │ +-- ╰─────────────────────────────────────────────────────────╯ +return { + "TobinPalmer/pastify.nvim", + cmd = { "Pastify", "PastifyAfter" }, + config = function() + require("pastify").setup({ + -- opts = { + -- apikey = "YOUR API KEY (https://api.imgbb.com/)", -- Needed if you want to save online. + -- }, + }) + end, +} diff --git a/.config/nvim/lua/goodhumored/plugins/project-nvim.lua b/.config/nvim/lua/goodhumored/plugins/project-nvim.lua index 26712e6..4ee9ee6 100644 --- a/.config/nvim/lua/goodhumored/plugins/project-nvim.lua +++ b/.config/nvim/lua/goodhumored/plugins/project-nvim.lua @@ -20,9 +20,9 @@ return { silent_chdir = true, }) require("telescope").load_extension("projects") - vim.keymap.set({ "n" }, "pf", function() + vim.keymap.set({ "n" }, "sp", function() require("telescope").extensions.projects.projects({}) - end, { desc = "[P]rojects [F]ind" }) + end, { desc = "[S]earch [P]roject" }) end, }, -- { diff --git a/.config/nvim/lua/goodhumored/plugins/toggleterm.lua b/.config/nvim/lua/goodhumored/plugins/toggleterm.lua new file mode 100644 index 0000000..25848a0 --- /dev/null +++ b/.config/nvim/lua/goodhumored/plugins/toggleterm.lua @@ -0,0 +1 @@ +return { "akinsho/toggleterm.nvim", version = "*", config = true }