diff --git a/nvim/init.lua b/nvim/init.lua index d4cea9c..613641b 100644 --- a/nvim/init.lua +++ b/nvim/init.lua @@ -33,4 +33,4 @@ require("keymaps") require("commands") require("autocommands") require("lsp") -require("dap") +-- require("dap") diff --git a/nvim/lazy-lock.json b/nvim/lazy-lock.json index 0049cd8..9055080 100644 --- a/nvim/lazy-lock.json +++ b/nvim/lazy-lock.json @@ -1,14 +1,13 @@ { "LuaSnip": { "branch": "master", "commit": "458560534a73f7f8d7a11a146c801db00b081df0" }, "auto-save.nvim": { "branch": "main", "commit": "29f793a3a7f98129387590269ffe3ad61ab5e509" }, - "auto-session": { "branch": "main", "commit": "00334ee24b9a05001ad50221c8daffbeedaa0842" }, "cmp-buffer": { "branch": "main", "commit": "b74fab3656eea9de20a9b8116afa3cfc4ec09657" }, "cmp-nvim-lsp": { "branch": "main", "commit": "a8912b88ce488f411177fc8aed358b04dc246d7b" }, "cmp-path": { "branch": "main", "commit": "c6635aae33a50d6010bf1aa756ac2398a2d54c32" }, "cmp_luasnip": { "branch": "master", "commit": "98d9cb5c2c38532bd9bdb481067b20fea8f32e90" }, - "conform.nvim": { "branch": "master", "commit": "2b2b30260203af3b93a7470ac6c8457ddd6e32d9" }, + "conform.nvim": { "branch": "master", "commit": "a4bb5d6c4ae6f32ab13114e62e70669fa67745b9" }, "friendly-snippets": { "branch": "main", "commit": "572f5660cf05f8cd8834e096d7b4c921ba18e175" }, - "go.nvim": { "branch": "master", "commit": "37ec4d9be3edef64b725bfe29684e1fe019873bc" }, + "go.nvim": { "branch": "master", "commit": "844b66b397edcbac8f941129eb4a57472a582a52" }, "goimpl.nvim": { "branch": "main", "commit": "2548d42c4db0645dea14f27e67c4b19b7030f1cf" }, "guihua.lua": { "branch": "master", "commit": "0cc9631914ffcbe3e474e809c610d12a75b660cf" }, "headlines.nvim": { "branch": "master", "commit": "bf17c96a836ea27c0a7a2650ba385a7783ed322e" }, @@ -17,22 +16,22 @@ "lsp_signature.nvim": { "branch": "master", "commit": "a4e3c15dfdce8783c074539b1835edae75fa63d5" }, "lspsaga.nvim": { "branch": "main", "commit": "920b1253e1a26732e53fac78412f6da7f674671d" }, "lualine.nvim": { "branch": "master", "commit": "15884cee63a8c205334ab13ab1c891cd4d27101a" }, - "neoscroll.nvim": { "branch": "master", "commit": "f957373912e88579e26fdaea4735450ff2ef5c9c" }, + "nui.nvim": { "branch": "main", "commit": "f535005e6ad1016383f24e39559833759453564e" }, "nvim-cmp": { "branch": "main", "commit": "b5311ab3ed9c846b585c0c15b7559be131ec4be9" }, "nvim-dap": { "branch": "master", "commit": "8df427aeba0a06c6577dc3ab82de3076964e3b8d" }, "nvim-dap-go": { "branch": "main", "commit": "8763ced35b19c8dc526e04a70ab07c34e11ad064" }, "nvim-dap-ui": { "branch": "master", "commit": "73a26abf4941aa27da59820fd6b028ebcdbcf932" }, - "nvim-lspconfig": { "branch": "master", "commit": "5a137448fd921a0c5d3939cb75e60d21f64e4606" }, + "nvim-lspconfig": { "branch": "master", "commit": "ac1dfbe3b60e5e23a2cff90e3bd6a3bc88031a57" }, "nvim-nio": { "branch": "master", "commit": "21f5324bfac14e22ba26553caf69ec76ae8a7662" }, "nvim-tree.lua": { "branch": "master", "commit": "e7d1b7dadc62fe2eccc17d814354b0a5688621ce" }, "nvim-treesitter": { "branch": "master", "commit": "066fd6505377e3fd4aa219e61ce94c2b8bdb0b79" }, "nvim-treesitter-context": { "branch": "master", "commit": "5c48b8ba1b0b7b25feb6e34e7eb293ea893aedc4" }, "nvim-treesitter-textobjects": { "branch": "master", "commit": "b0debd5c424969b4baeabdc8f54db3036c691732" }, "nvim-ts-autotag": { "branch": "main", "commit": "a1d526af391f6aebb25a8795cbc05351ed3620b5" }, - "nvim-web-devicons": { "branch": "master", "commit": "f1420728f59843eb2ef084406b3d0201a0a0932d" }, + "nvim-web-devicons": { "branch": "master", "commit": "1fb58cca9aebbc4fd32b086cb413548ce132c127" }, "plenary.nvim": { "branch": "master", "commit": "857c5ac632080dba10aae49dba902ce3abf91b35" }, "popup.nvim": { "branch": "master", "commit": "b7404d35d5d3548a82149238289fa71f7f6de4ac" }, "smartcolumn.nvim": { "branch": "main", "commit": "92f3773af80d674f1eb61e112dca79e2fa449fd1" }, - "telescope-project.nvim": { "branch": "master", "commit": "8e11df94419e444601c09828dadf70890484e443" }, - "telescope.nvim": { "branch": "master", "commit": "b4da76be54691e854d3e0e02c36b0245f945c2c7" } + "telescope.nvim": { "branch": "master", "commit": "b4da76be54691e854d3e0e02c36b0245f945c2c7" }, + "todotxt.nvim": { "branch": "main", "commit": "1c5a9fe131c31846844870cf9bcaada6b65e5e59" } } diff --git a/nvim/lua/autocommands.lua b/nvim/lua/autocommands.lua index 1431693..2cb9ad4 100644 --- a/nvim/lua/autocommands.lua +++ b/nvim/lua/autocommands.lua @@ -121,31 +121,6 @@ vim.api.nvim_create_autocmd({ "BufWritePost" }, { end, }) --- Автоматический вход в insert mode при открытии терминала -vim.api.nvim_create_autocmd({ "BufWinEnter", "WinEnter" }, { - pattern = "term://*", - callback = function() - vim.cmd("startinsert") - end, -}) - --- Автоматический выход из insert mode при уходе с терминала -vim.api.nvim_create_autocmd("BufLeave", { - pattern = "term://*", - callback = function() - vim.cmd("stopinsert") - end, -}) - -vim.api.nvim_create_autocmd({ "BufReadPost", "BufWinEnter", "WinEnter" }, { - pattern = "*", - callback = function(args) - -- Проверяем, что это не терминальный буфер - if not vim.startswith(vim.api.nvim_buf_get_name(args.buf), "term://") then - vim.cmd("normal zR") -- Развернуть все складки - end - end, -}) vim.api.nvim_create_autocmd({ "VimEnter" }, { callback = function(data) local directory = vim.fn.isdirectory(data.file) == 1 @@ -175,12 +150,12 @@ vim.api.nvim_create_autocmd("VimResized", { end, }) --- vim.api.nvim_create_autocmd("InsertEnter", { --- pattern = "*", --- command = "set norelativenumber", --- }) --- --- vim.api.nvim_create_autocmd("InsertLeave", { --- pattern = "*", --- callback = "set langmap=ФИСВУАПРШОЛДЬТЩЗЙКЫЕГМЦЧНЯ;ABCDEFGHIJKLMNOPQRSTUVWXYZ,фисвуапршолдьтщзйкыегмцчня;abcdefghijklmnopqrstuvwxyz", --- }) +vim.api.nvim_create_autocmd("InsertEnter", { + pattern = "*", + command = "set norelativenumber", +}) + +vim.api.nvim_create_autocmd("InsertLeave", { + pattern = "*", + command = "set relativenumber", +}) diff --git a/nvim/lua/keymaps.lua b/nvim/lua/keymaps.lua index 44ec57a..3c1a989 100644 --- a/nvim/lua/keymaps.lua +++ b/nvim/lua/keymaps.lua @@ -41,8 +41,6 @@ end -- }}} -kmap("n", "tt", ":split:terminal:startinsert", { noremap = true, silent = true }) - -- {{{ LSP функции kmap("n", "d[", vim.diagnostic.goto_prev, { noremap = true, silent = true, desc = "Previous diagnostic" }) kmap("n", "d]", vim.diagnostic.goto_next, { noremap = true, silent = true, desc = "Next diagnostic" }) diff --git a/nvim/lua/lualine/themes/base16.lua b/nvim/lua/lualine/themes/base16.lua deleted file mode 100644 index 03f4f35..0000000 --- a/nvim/lua/lualine/themes/base16.lua +++ /dev/null @@ -1,128 +0,0 @@ - -local modules = require('lualine_require').lazy_require { notices = 'lualine.utils.notices' } - -local function add_notice(notice) - modules.notices.add_notice('theme(base16): ' .. notice) -end - -local function setup(colors) - local theme = { - normal = { - a = { fg = colors.bg, bg = colors.normal }, - b = { fg = colors.light_fg, bg = colors.alt_bg }, - c = { fg = colors.fg, bg = colors.bg }, - }, - replace = { - a = { fg = colors.bg, bg = colors.replace }, - b = { fg = colors.light_fg, bg = colors.alt_bg }, - }, - insert = { - a = { fg = colors.bg, bg = colors.insert }, - b = { fg = colors.light_fg, bg = colors.alt_bg }, - }, - visual = { - a = { fg = colors.bg, bg = colors.visual }, - b = { fg = colors.light_fg, bg = colors.alt_bg }, - }, - inactive = { - a = { fg = colors.dark_fg, bg = colors.bg }, - b = { fg = colors.dark_fg, bg = colors.bg }, - c = { fg = colors.dark_fg, bg = colors.bg }, - }, - } - - theme.command = theme.normal - theme.terminal = theme.insert - - return theme -end - -local function setup_default() - return setup { - bg = '#282a2e', - alt_bg = '#373b41', - dark_fg = '#969896', - fg = '#b4b7b4', - light_fg = '#c5c8c6', - normal = '#81a2be', - insert = '#b5bd68', - visual = '#b294bb', - replace = '#de935f', - } -end - -local function setup_base16_nvim() - -- Continue to load nvim-base16 - local loaded, base16 = pcall(require, 'base16-colorscheme') - - if not loaded then - add_notice( - 'nvim-base16 is not currently present in your runtimepath, make sure it is properly installed,' - .. ' fallback to default colors.' - ) - - return nil - end - - if not base16.colors and not vim.env.BASE16_THEME then - add_notice( - 'nvim-base16 is not loaded yet, you should update your configuration to load it before lualine' - .. ' so that the colors from your colorscheme can be used, fallback to "tomorrow-night" theme.' - ) - elseif not base16.colors and not base16.colorschemes[vim.env.BASE16_THEME] then - add_notice( - 'The colorscheme "%s" defined by the environment variable "BASE16_THEME" is not handled by' - .. ' nvim-base16, fallback to "tomorrow-night" theme.' - ) - end - - local colors = base16.colors or base16.colorschemes[vim.env.BASE16_THEME or 'tomorrow-night'] - - return setup { - bg = colors.base01, - alt_bg = colors.base02, - dark_fg = colors.base03, - fg = colors.base04, - light_fg = colors.base05, - normal = colors.base0D, - insert = colors.base0B, - visual = colors.base0E, - replace = colors.base09, - } -end - -local function setup_base16_vim() - -- Check if tinted-theming/base16-vim is already loaded - if vim.g.base16_gui00 and vim.g.base16_gui0F then - return setup { - bg = vim.g.base16_gui01, - alt_bg = vim.g.base16_gui02, - dark_fg = vim.g.base16_gui03, - fg = vim.g.base16_gui04, - light_fg = vim.g.base16_gui05, - normal = vim.g.base16_gui0D, - insert = vim.g.base16_gui0B, - visual = vim.g.base16_gui0E, - replace = vim.g.base16_gui09, - } - end - - -- base16-vim has been renamed to tinted-vim along with colors - -- context: https://github.com/nvim-lualine/lualine.nvim/pull/1352 - if vim.g.tinted_gui00 and vim.g.tinted_gui0F then - return setup { - bg = vim.g.tinted_gui01, - alt_bg = vim.g.tinted_gui02, - dark_fg = vim.g.tinted_gui03, - fg = vim.g.tinted_gui04, - light_fg = vim.g.tinted_gui05, - normal = vim.g.tinted_gui0D, - insert = vim.g.tinted_gui0B, - visual = vim.g.tinted_gui0E, - replace = vim.g.tinted_gui09, - } - end - return nil -end - -return setup_base16_vim() or setup_base16_nvim() or setup_default() diff --git a/nvim/lua/myplugins/resize.lua b/nvim/lua/myplugins/resize.lua new file mode 100644 index 0000000..8af6c3b --- /dev/null +++ b/nvim/lua/myplugins/resize.lua @@ -0,0 +1,97 @@ +local M = {} + +M.setup = function(opts) end + +M.isRightMost = function() + local curWin = vim.fn.winnr() + vim.cmd([[wincmd l]]) + local rightWin = vim.fn.winnr() + if curWin == rightWin then + return true + else + vim.cmd([[wincmd h]]) + return false + end +end + +M.isLeftMost = function() + local curWin = vim.fn.winnr() + vim.cmd([[wincmd h]]) + local leftWin = vim.fn.winnr() + if curWin == leftWin then + return true + else + vim.cmd([[wincmd l]]) + return false + end +end + +M.isBottomMost = function() + local curWin = vim.fn.winnr() + vim.cmd([[wincmd j]]) + local bottomWin = vim.fn.winnr() + if curWin == bottomWin then + return true + else + vim.cmd([[wincmd k]]) + return false + end +end + +M.isTopMost = function() + local curWin = vim.fn.winnr() + vim.cmd([[wincmd k]]) + local topWin = vim.fn.winnr() + if curWin == topWin then + return true + else + vim.cmd([[wincmd j]]) + return false + end +end + +M.ResizeLeft = function() + if M.isRightMost() then + if not M.isLeftMost() then + vim.cmd([[wincmd 5 >]]) + end + else + vim.cmd([[wincmd 5 <]]) + end +end + +M.ResizeRight = function() + if M.isRightMost() then + if not M.isLeftMost() then + vim.cmd([[wincmd 5 <]]) + end + else + vim.cmd([[wincmd 5 >]]) + end +end + +M.ResizeUp = function() + if M.isBottomMost() then + if not M.isTopMost() then + vim.cmd([[wincmd 5 +]]) + else + vim.cmd([[wincmd 5 -]]) + end + else + vim.cmd([[wincmd 5 -]]) + end +end + +M.ResizeDown = function() + if M.isBottomMost() then + if not M.isTopMost() then + vim.cmd([[wincmd 5 -]]) + else + vim.cmd([[wincmd 5 +]]) + end + else + vim.cmd([[wincmd 5 +]]) + end +end + +return M diff --git a/nvim/lua/options.lua b/nvim/lua/options.lua index 1b56650..20d8c78 100644 --- a/nvim/lua/options.lua +++ b/nvim/lua/options.lua @@ -8,7 +8,7 @@ local options = { hidden = true, hlsearch = true, ignorecase = true, - mouse = "a", + mouse = "", pumheight = 10, showmode = false, showtabline = 2, @@ -25,7 +25,7 @@ local options = { tabstop = 4, cursorline = true, number = true, - -- relativenumber = true, + relativenumber = true, numberwidth = 4, signcolumn = "yes", wrap = true, @@ -35,8 +35,10 @@ local options = { foldenable = false, scrolloff = 999, so = vim.fn.floor(vim.fn.winheight(0) / 2), - guicursor = "n-v-c:block,i-ci-ve:ver25,r-cr:hor20,o:hor50,i:blinkwait700-blinkoff400-blinkon250-Cursor/lCursor,a:blinkwait700-blinkoff400-blinkon250-Cursor/lCursor,sm:block-blinkwait175-blinkoff150-blinkon175", + guicursor = "n-v-c:block,i-ci-ve:hor10,r-cr:hor20,o:hor50,a:blinkwait700-blinkoff400-blinkon250-Cursor/lCursor,sm:block-blinkwait175-blinkoff150-blinkon175", langmap = "ФИСВУАПРШОЛДЬТЩЗЙКЫЕГМЦЧНЯЖ;ABCDEFGHIJKLMNOPQRSTUVWXYZ:,фисвуапршолдьтщзйкыегмцчня;abcdefghijklmnopqrstuvwxyz", + spelllang = "en,ru_yo", + spell = true, } vim.opt.formatoptions:append({ r = true, o = true }) vim.opt.shortmess:append("c") diff --git a/nvim/lua/plugins.lua b/nvim/lua/plugins.lua index 2e6b946..cec8ae7 100644 --- a/nvim/lua/plugins.lua +++ b/nvim/lua/plugins.lua @@ -6,75 +6,50 @@ require("lazy").setup({ }, { "neovim/nvim-lspconfig" }, { - "lukas-reineke/indent-blankline.nvim", - main = "ibl", - --@module "ibl" - --@type ibl.config - config = true, - }, - { - "lukas-reineke/headlines.nvim", - dependencies = "nvim-treesitter/nvim-treesitter", - config = true, - }, - { - "mfussenegger/nvim-dap", - }, - { - "ray-x/lsp_signature.nvim", - event = "VeryLazy", + "arnarg/todotxt.nvim", + dependencies = { "MunifTanjim/nui.nvim" }, opts = { - doc_lines = 1, - max_height = 3, - hint_prefix = "", - hint_prefix = { - above = "↙ ", - current = "← ", - below = "↖ ", - }, - floating_window = true, + todo_file = "~/Документы/todo.txt", }, }, { - "nvimdev/lspsaga.nvim", - opts = { - lightbulb = { - enable = false, - }, - }, - }, - { - "karb94/neoscroll.nvim", - opts = { - stop_eof = false, - respect_scrolloff = true, - mappings = { - "", - "", - "", - "", - "", - "", - "zt", - "zz", - "zb", - }, - }, + name = "resize", + dir = "~/.config/nvim/lua/myplugins", keys = { { - "", + "", function() - require("neoscroll").scroll(-vim.api.nvim_win_get_height(0) + 3, { duration = 150 }) + require("myplugins.resize").ResizeLeft() end, + silent = true, }, { - "", + "", function() - require("neoscroll").scroll(vim.api.nvim_win_get_height(0) - 3, { duration = 150 }) + require("myplugins.resize").ResizeRight() end, + silent = true, + }, + { + "", + function() + require("myplugins.resize").ResizeUp() + end, + silent = true, + }, + { + "", + function() + require("myplugins.resize").ResizeDown() + end, + silent = true, }, }, }, + require("plugins.blankline"), + require("plugins.headlines"), + require("plugins.lsp_saga"), + require("plugins.lsp_signature"), require("plugins.autosave"), require("plugins.cmp"), require("plugins.treesitter"), @@ -82,6 +57,7 @@ require("lazy").setup({ require("plugins.conform"), require("plugins.dapui"), require("plugins.dap"), + require("plugins.dap_go"), require("plugins.go"), require("plugins.goimpl"), require("plugins.lualine"), diff --git a/nvim/lua/plugins/blankline.lua b/nvim/lua/plugins/blankline.lua new file mode 100644 index 0000000..b74d9e6 --- /dev/null +++ b/nvim/lua/plugins/blankline.lua @@ -0,0 +1,7 @@ +return { + "lukas-reineke/indent-blankline.nvim", + main = "ibl", + --@module "ibl" + --@type ibl.config + config = true, +} diff --git a/nvim/lua/plugins/dap.lua b/nvim/lua/plugins/dap.lua index da87df9..ab44a1e 100644 --- a/nvim/lua/plugins/dap.lua +++ b/nvim/lua/plugins/dap.lua @@ -1,158 +1,3 @@ -local default_config = { - delve = { - path = "dlv", - initialize_timeout_sec = 20, - port = "${port}", - args = {}, - build_flags = "", - -- Automatically handle the issue on delve Windows versions < 1.24.0 - -- where delve needs to be run in attched mode or it will fail (actually crashes). - detached = vim.fn.has("win32") == 0, - output_mode = "remote", - }, - tests = { - verbose = false, - }, -} - -local function setup_go_configuration(dap, configs) - local common_debug_configs = { - { - type = "go", - name = "Debug", - request = "launch", - program = "${workspaceFolder}", - args = {}, - buildFlags = configs.delve.build_flags, - outputMode = configs.delve.output_mode, - }, - } - - if dap.configurations.go == nil then - dap.configurations.go = {} - end - - for _, config in ipairs(common_debug_configs) do - table.insert(dap.configurations.go, config) - end - - if configs == nil or configs.dap_configurations == nil then - return - end - - for _, config in ipairs(configs.dap_configurations) do - if config.type == "go" then - table.insert(dap.configurations.go, config) - end - end -end - return { - "leoluz/nvim-dap-go", - dependencies = { "mfussenegger/nvim-dap" }, - opts = true, - config = function() - local dap, dapui = require("dap"), require("dapui") - - dap.adapters.go = { - type = "server", - port = "${port}", - executable = { - command = "dlv", - args = { "dap", "-l", "127.0.0.1:${port}" }, - }, - } - - setup_go_configuration(dap, default_config) - - dap.defaults.fallback.terminal_win_cmd = "enew | set filetype=dap-terminal" - dap.listeners.before.attach.dapui_config = function() - dapui.open() - end - dap.listeners.before.launch.dapui_config = function() - dapui.open() - end - dap.listeners.before.event_terminated.dapui_config = function() - dapui.close() - end - dap.listeners.before.event_exited.dapui_config = function() - dapui.close() - end - - vim.api.nvim_set_hl(0, "DapBreakpoint", { ctermbg = 0, fg = "#993939", bg = "#31353f" }) - vim.api.nvim_set_hl(0, "DapLogPoint", { ctermbg = 0, fg = "#61afef", bg = "#31353f" }) - vim.api.nvim_set_hl(0, "DapStopped", { ctermbg = 0, fg = "#98c379", bg = "#31353f" }) - - vim.fn.sign_define( - "DapBreakpoint", - { text = "!", texthl = "DapBreakpoint", linehl = "DapBreakpoint", numhl = "DapBreakpoint" } - ) - vim.fn.sign_define( - "DapBreakpointCondition", - { text = "?", texthl = "DapBreakpoint", linehl = "DapBreakpoint", numhl = "DapBreakpoint" } - ) - vim.fn.sign_define( - "DapBreakpointRejected", - { text = "RJ", texthl = "DapBreakpoint", linehl = "DapBreakpoint", numhl = "DapBreakpoint" } - ) - vim.fn.sign_define( - "DapLogPoint", - { text = "i", texthl = "DapLogPoint", linehl = "DapLogPoint", numhl = "DapLogPoint" } - ) - vim.fn.sign_define( - "DapStopped", - { text = "→", texthl = "DapStopped", linehl = "DapStopped", numhl = "DapStopped" } - ) - end, - keys = { - { - "", - function() - require("dap").continue() - end, - silent = true, - }, - { - "", -- S-F5 - function() - require("dap").restart() - end, - silent = true, - }, - { - "", -- C-F5 - function() - require("dap").terminate() - end, - silent = true, - }, - { - "", - function() - require("dap").step_over() - end, - silent = true, - }, - { - "", - function() - require("dap").step_into() - end, - silent = true, - }, - { - "", -- S-F7 - function() - require("dap").step_out() - end, - silent = true, - }, - { - "", - function() - require("dap").toggle_breakpoint() - end, - silent = true, - }, - }, + "mfussenegger/nvim-dap", } diff --git a/nvim/lua/plugins/dap_go.lua b/nvim/lua/plugins/dap_go.lua new file mode 100644 index 0000000..705fab7 --- /dev/null +++ b/nvim/lua/plugins/dap_go.lua @@ -0,0 +1,159 @@ +local default_config = { + delve = { + path = "dlv", + initialize_timeout_sec = 20, + port = "${port}", + args = {}, + build_flags = "", + -- Automatically handle the issue on delve Windows versions < 1.24.0 + -- where delve needs to be run in attched mode or it will fail (actually crashes). + detached = vim.fn.has("win32") == 0, + output_mode = "remote", + cwd = nil, + }, + tests = { + verbose = false, + }, +} + +local function setup_go_configuration(dap, configs) + local common_debug_configs = { + { + type = "go", + name = "Debug", + request = "launch", + program = "${workspaceFolder}", + args = {}, + buildFlags = configs.delve.build_flags, + outputMode = configs.delve.output_mode, + }, + } + + if dap.configurations.go == nil then + dap.configurations.go = {} + end + + for _, config in ipairs(common_debug_configs) do + table.insert(dap.configurations.go, config) + end + + if configs == nil or configs.dap_configurations == nil then + return + end + + for _, config in ipairs(configs.dap_configurations) do + if config.type == "go" then + table.insert(dap.configurations.go, config) + end + end +end + +return { + "leoluz/nvim-dap-go", + dependencies = { "mfussenegger/nvim-dap" }, + opts = true, + config = function() + local dap, dapui = require("dap"), require("dapui") + + dap.adapters.go = { + type = "server", + port = "${port}", + executable = { + command = "dlv", + args = { "dap", "-l", "127.0.0.1:${port}" }, + }, + } + + setup_go_configuration(dap, default_config) + + dap.defaults.fallback.terminal_win_cmd = "enew | set filetype=dap-terminal" + dap.listeners.before.attach.dapui_config = function() + dapui.open() + end + dap.listeners.before.launch.dapui_config = function() + dapui.open() + end + dap.listeners.before.event_terminated.dapui_config = function() + dapui.close() + end + dap.listeners.before.event_exited.dapui_config = function() + dapui.close() + end + + vim.api.nvim_set_hl(0, "DapBreakpoint", { ctermbg = 0, fg = "#993939", bg = "#31353f" }) + vim.api.nvim_set_hl(0, "DapLogPoint", { ctermbg = 0, fg = "#61afef", bg = "#31353f" }) + vim.api.nvim_set_hl(0, "DapStopped", { ctermbg = 0, fg = "#98c379", bg = "#31353f" }) + + vim.fn.sign_define( + "DapBreakpoint", + { text = "!", texthl = "DapBreakpoint", linehl = "DapBreakpoint", numhl = "DapBreakpoint" } + ) + vim.fn.sign_define( + "DapBreakpointCondition", + { text = "?", texthl = "DapBreakpoint", linehl = "DapBreakpoint", numhl = "DapBreakpoint" } + ) + vim.fn.sign_define( + "DapBreakpointRejected", + { text = "RJ", texthl = "DapBreakpoint", linehl = "DapBreakpoint", numhl = "DapBreakpoint" } + ) + vim.fn.sign_define( + "DapLogPoint", + { text = "i", texthl = "DapLogPoint", linehl = "DapLogPoint", numhl = "DapLogPoint" } + ) + vim.fn.sign_define( + "DapStopped", + { text = "→", texthl = "DapStopped", linehl = "DapStopped", numhl = "DapStopped" } + ) + end, + keys = { + { + "", + function() + require("dap").continue() + end, + silent = true, + }, + { + "", -- S-F5 + function() + require("dap").restart() + end, + silent = true, + }, + { + "", -- C-F5 + function() + require("dap").terminate() + end, + silent = true, + }, + { + "", + function() + require("dap").step_over() + end, + silent = true, + }, + { + "", + function() + require("dap").step_into() + end, + silent = true, + }, + { + "", -- S-F7 + function() + require("dap").step_out() + end, + silent = true, + }, + { + "", + function() + require("dap").toggle_breakpoint() + end, + silent = true, + }, + }, +} diff --git a/nvim/lua/plugins/dapui.lua b/nvim/lua/plugins/dapui.lua index 93df74b..5d35e1e 100644 --- a/nvim/lua/plugins/dapui.lua +++ b/nvim/lua/plugins/dapui.lua @@ -52,8 +52,6 @@ return { { elements = { "repl", - "breakpoints", - "scopes", }, size = 0.3, position = "bottom", diff --git a/nvim/lua/plugins/headlines.lua b/nvim/lua/plugins/headlines.lua new file mode 100644 index 0000000..5d92245 --- /dev/null +++ b/nvim/lua/plugins/headlines.lua @@ -0,0 +1,5 @@ +return { + "lukas-reineke/headlines.nvim", + dependencies = "nvim-treesitter/nvim-treesitter", + config = true, + } diff --git a/nvim/lua/plugins/lsp_saga.lua b/nvim/lua/plugins/lsp_saga.lua new file mode 100644 index 0000000..ab8177f --- /dev/null +++ b/nvim/lua/plugins/lsp_saga.lua @@ -0,0 +1,8 @@ +return { + "nvimdev/lspsaga.nvim", + opts = { + lightbulb = { + enable = false, + }, + }, +} diff --git a/nvim/lua/plugins/lsp_signature.lua b/nvim/lua/plugins/lsp_signature.lua new file mode 100644 index 0000000..b9add0b --- /dev/null +++ b/nvim/lua/plugins/lsp_signature.lua @@ -0,0 +1,15 @@ +return { + "ray-x/lsp_signature.nvim", + event = "VeryLazy", + opts = { + doc_lines = 1, + max_height = 3, + hint_prefix = "", + hint_prefix = { + above = "↙ ", + current = "← ", + below = "↖ ", + }, + floating_window = true, + }, +} diff --git a/nvim/lua/plugins/tree.lua b/nvim/lua/plugins/tree.lua index 94d1f11..3bf9eed 100644 --- a/nvim/lua/plugins/tree.lua +++ b/nvim/lua/plugins/tree.lua @@ -1,5 +1,4 @@ -local HEIGHT_RATIO = 0.8 -local WIDTH_RATIO = 0.5 +local WIDTH_RATIO = 0.25 return { "nvim-tree/nvim-tree.lua", @@ -9,36 +8,10 @@ return { opts = { disable_netrw = true, hijack_netrw = true, - hijack_directories = { - enable = true, - auto_open = true, - }, sort = { sorter = "case_sensitive", }, view = { - -- width = 30, - float = { - enable = true, - open_win_config = function() - local screen_w = vim.opt.columns:get() - local screen_h = vim.opt.lines:get() - vim.opt.cmdheight:get() - local window_w = screen_w * WIDTH_RATIO - local window_h = screen_h * HEIGHT_RATIO - local window_w_int = math.floor(window_w) - local window_h_int = math.floor(window_h) - local center_x = (screen_w - window_w) / 2 - local center_y = ((vim.opt.lines:get() - window_h) / 2) - vim.opt.cmdheight:get() - return { - border = "rounded", - relative = "editor", - row = center_y, - col = center_x, - width = window_w_int, - height = window_h_int, - } - end, - }, width = function() return math.floor(vim.opt.columns:get() * WIDTH_RATIO) end, @@ -60,11 +33,8 @@ return { filters = { dotfiles = false, }, - sync_root_with_cwd = true, - respect_buf_cwd = true, update_focused_file = { enable = true, - update_root = true, }, }, keys = { diff --git a/nvim/lua/plugins/treesitter.lua b/nvim/lua/plugins/treesitter.lua index 08d05e9..59e9294 100644 --- a/nvim/lua/plugins/treesitter.lua +++ b/nvim/lua/plugins/treesitter.lua @@ -7,7 +7,7 @@ return { additional_vim_regex_highlighting = false, }, ensure_installed = "all", - ignore_install = { "gdhsader", "phpdoc" }, + ignore_install = { "gdhsader", "phpdoc", "org" }, indent = { enable = true }, auto_install = true, sync_install = true, diff --git a/nvim/spell/en.utf-8.add b/nvim/spell/en.utf-8.add new file mode 100644 index 0000000..98afcae --- /dev/null +++ b/nvim/spell/en.utf-8.add @@ -0,0 +1,2 @@ +блог +блога diff --git a/nvim/spell/en.utf-8.add.spl b/nvim/spell/en.utf-8.add.spl new file mode 100644 index 0000000..1fe94cc Binary files /dev/null and b/nvim/spell/en.utf-8.add.spl differ diff --git a/nvim/spell/ru.cp1251.spl b/nvim/spell/ru.cp1251.spl new file mode 100644 index 0000000..5720ab0 Binary files /dev/null and b/nvim/spell/ru.cp1251.spl differ diff --git a/nvim/spell/ru.cp1251.sug b/nvim/spell/ru.cp1251.sug new file mode 100644 index 0000000..60f8823 Binary files /dev/null and b/nvim/spell/ru.cp1251.sug differ diff --git a/nvim/spell/ru.koi8-r.spl b/nvim/spell/ru.koi8-r.spl new file mode 100644 index 0000000..e503020 Binary files /dev/null and b/nvim/spell/ru.koi8-r.spl differ diff --git a/nvim/spell/ru.koi8-r.sug b/nvim/spell/ru.koi8-r.sug new file mode 100644 index 0000000..bdb7abe Binary files /dev/null and b/nvim/spell/ru.koi8-r.sug differ diff --git a/nvim/spell/ru.utf-8.spl b/nvim/spell/ru.utf-8.spl new file mode 100644 index 0000000..96e7592 Binary files /dev/null and b/nvim/spell/ru.utf-8.spl differ diff --git a/nvim/spell/ru.utf-8.sug b/nvim/spell/ru.utf-8.sug new file mode 100644 index 0000000..ba5a361 Binary files /dev/null and b/nvim/spell/ru.utf-8.sug differ diff --git a/zsh/comp/todotxt.zsh-completion b/zsh/comp/todotxt.zsh-completion new file mode 100644 index 0000000..bd5b7c3 --- /dev/null +++ b/zsh/comp/todotxt.zsh-completion @@ -0,0 +1,107 @@ +#compdef todo.sh + +_todo() { + local curcontext="$curcontext" state state_descr line + typeset -A opt_args + local -a args commands subcmds + + local _todo_sh=${_todo_sh:-${words[1]}} + local -r MOVE_COMMAND_PATTERN='(move|mv)' + local -r OPTS=('-@' '-@@' '-+' '-++' '-d' '-f' '-h' '-p' '-P' '-PP' '-a' '-n' '-t' '-v' '-vv' '-V' '-x') + local -r COMMANDS=( + 'add:a new task' + 'a:add alias' + 'addto:add to file' + 'addm:add multiple' + 'append:app:app:append to task' + 'archive:move done tasks to archive' + 'command:run addon' + 'del:rm:delete task' + 'depri:dp:remove priority' + 'do:mark as done' + 'help:show help' + 'list:ls:list tasks' + 'listaddons:show installed addons' + 'listall:lsa:list all tasks' + 'listcon:lsc:list contexts' + 'listfile:lf:list files' + 'listpri:lsp:list by priority' + 'listproj:lsprj:list projects' + 'move:mv:move task between files' + 'prepend:insert text at beginning' + 'pri:p:set priority' + 'replace:modify task' + 'report:generate report' + 'shorthelp:brief help' + ) + + _arguments -C \ + "1: :->cmds" \ + "*:: :->args" + + case $state in + cmds) + local addons=($(eval TODOTXT_VERBOSE=0 "$_todo_sh" command listaddons 2>/dev/null)) + args=($COMMANDS $addons $OPTS) + _describe 'todo.sh command' args + ;; + args) + cur="${words[CURRENT]}" + prev="${words[CURRENT-1]}" + + case "$prev" in + command) + _describe 'subcommand' COMMANDS + ;; + help) + local addons=($(eval TODOTXT_VERBOSE=0 "$_todo_sh" command listaddons 2>/dev/null)) + args=($COMMANDS $addons) + _describe 'help topic' args + ;; + addto|listfile|lf|move|mv) + local files=($(eval TODOTXT_VERBOSE=0 "$_todo_sh" command listfile 2>/dev/null)) + _describe 'file' files + ;; + *) + case "$cur" in + due:*) + _values 'due date' $(seq 0 30 | xargs -I{} date -d "+{} days" +%Y-%m-%d) + ;; + *@today*|*@now*) + _wanted dates expl 'date' compadd -S '' -- $(date +%Y-%m-%d) + ;; + +*) + local projects=($(eval TODOTXT_VERBOSE=0 "$_todo_sh" command listproj 2>/dev/null)) + [[ ${#projects} -eq 0 ]] && projects=($(eval TODOTXT_VERBOSE=0 TODOTXT_SOURCEVAR=\$DONE_FILE "$_todo_sh" command listproj 2>/dev/null)) + _describe 'project' projects -p '+' + ;; + @*) + local contexts=($(eval TODOTXT_VERBOSE=0 "$_todo_sh" command listcon 2>/dev/null)) + [[ ${#contexts} -eq 0 ]] && contexts=($(eval TODOTXT_VERBOSE=0 TODOTXT_SOURCEVAR=\$DONE_FILE "$_todo_sh" command listcon 2>/dev/null)) + _describe 'context' contexts -p '@' + ;; + [0-9]##) + local task=($(eval TODOTXT_VERBOSE=0 "$_todo_sh" \ + '-@ -+ -p -x command ls "^ *${cur} "' 2>/dev/null | \ + sed -e 's/^ *[0-9]\{1,\} //' \ + -e 's/^\((.) \)\{0,1\}[0-9]\{2,4\}-[0-9]\{2\}-[0-9]\{2\} /\1/' \ + -e 's/^\([xX] \)\([0-9]\{2,4\}-[0-9]\{2\}-[0-9]\{2\} \)\{1,2\}/\1/' \ + -e 's/[[:space:]]*$//' -e '1q')) + _message -r "Task ${cur}: ${task}" + ;; + *) + if [[ ${words[1]} == $~MOVE_COMMAND_PATTERN ]] && (( CURRENT == 3 )); then + local files=($(eval TODOTXT_VERBOSE=0 "$_todo_sh" command listfile 2>/dev/null)) + _describe 'destination file' files + else + _files + fi + ;; + esac + ;; + esac + ;; + esac +} + +_todo "$@" diff --git a/zsh/conf.d/todo.zsh b/zsh/conf.d/todo.zsh new file mode 100644 index 0000000..18cc240 --- /dev/null +++ b/zsh/conf.d/todo.zsh @@ -0,0 +1,95 @@ + +# Expand multiple lines removal +todo() { + local pattern="[[:digit:] ]##" + setopt extendedglob # Enable extended regexes + setopt localoptions + case $* in + $~pattern) + for number in $*; do + todo rm $number + done + ;; + \*) + for number in $(todol | + sed $'s/\e\[[0-9;:]*[a-zA-Z]//g' | # Remove color from list output + sed 's/^[^0-9].*//' | # Remove non-task lines + sed -r 's/^([0-9]+).*/\1/' # Only keep the number in task's lines + ); do + todo rm $number + done + ;; + *) + echo '\e[1;31mWrong parameter : \e[0;31m'$*'\e[0m' + echo 'Usage: todor NUMBERS' + echo '\e[1mNUMBERS:\e[0m' + echo ' Space-separated line numbers to delete (ex: 1 5 6)' + echo ' \e[2mBrace expansion can also be used for adjacent NUMBERS, like : {5..7}' + echo ' \e[2mWildcard character (*, beware of expansion, rather "quote" or \\escape it)' + echo ' is also supported to deleted every line.' + ;; + esac +} + +# Print a reminder about todo.txt's syntax +todostx() { + echo -e "$( + cat <<-TodoTxtSyntax + \e[1;32m╭────────────────────────────────── Syntaxe de todo.txt ──────────────────────────────────╮\e[0m + \e[1;32m│\e[0m \e[0;1;32m│\e[0m + \e[1;32m│\e[0m Principe de base : \e[0;1;32m│\e[0m + \e[1;32m│\e[0m \e[0;1;32m│\e[0m + \e[1;32m│\e[0m \e[1;3m1 ligne = 1 tâche\e[0m \e[0;1;32m│\e[0m + \e[1;32m│\e[0m \e[0;1;32m│\e[0m + \e[1;32m│\e[0m Le format des tâches est libre, néanmoins plusieurs \e[1mnotations\e[0m permettent de les \e[0;1;32m│\e[0m + \e[1;32m│\e[0m structurer : \e[0;1;32m│\e[0m + \e[1;32m│\e[0m \e[0;1;32m│\e[0m + \e[1;32m│\e[0m ┏ \e[1;2mMarque de complétion\e[0;1;33m*\e[0m (pour les tâche \e[1;33mcomplétées\e[0m, toujours en premier) \e[0;1;32m│\e[0m + \e[1;32m│\e[0m ┃ Format : \e[1;2mx␣\e[0m \e[0;1;32m│\e[0m + \e[1;32m│\e[0m ┃ \e[0;1;32m│\e[0m + \e[1;32m│\e[0m ┃ ┏ \e[1;31mPriorité\e[33m*\e[0m (pour les tâche \e[1;33mnon complétées\e[0m, toujours en premier) \e[0;1;32m│\e[0m + \e[1;32m│\e[0m ┃ ┃ Format : \e[1;31m(\e[0m[\e[1;31mA-Z\e[0m]\e[1;31m␣) \e[0;1;32m│\e[0m + \e[1;32m│\e[0m ┃ ┃ \e[0;1;32m│\e[0m + \e[1;32m│\e[0m ┃ ┃ ┏ \e[2;38;5;172mDate de complétion\e[0;1;33m*\e[0m (pour les tâche \e[1;33mcomplétées\e[0m, toujours après le \e[2mx\e[0m ; \e[0;1;32m│\e[0m + \e[1;32m│\e[0m ┃ ┃ ┃ si présente, la date de création doit aussi l'être) \e[0;1;32m│\e[0m + \e[1;32m│\e[0m ┃ ┃ ┃ Format : (\e[2;38;5;172m20\e[0m|\e[2;38;5;172m19\e[0m)[\e[2;38;5;172m00-99\e[0m]\e[2;38;5;172m-\e[0m[\e[2;38;5;172m00-12\e[0m]\e[2;38;5;172m-\e[0m[\e[2;38;5;172m00-31\e[0m]\e[2;38;5;172m␣\e[0m \e[0;1;32m│\e[0m + \e[1;32m│\e[0m ┃ ┃ ┃ \e[0;1;32m│\e[0m + \e[1;32m│\e[0m ┃ ┃ ┃ ┏ \e[2;38;5;172mDate de création\e[0;1;33m*\e[0m \e[0;1;32m│\e[0m + \e[1;32m│\e[0m ┃ ┃ ┃ ┃ Format : Idem date de complétion \e[0;1;32m│\e[0m + \e[1;32m│\e[0m ┃ ┃ ┃ ┃ \e[0;1;32m│\e[0m + \e[1;32m│\e[0m ┃ ┃ ┃ ┃ ┏ \e[1mDescription de la tâche\e[0m, peut inclure \e[0;1;32m│\e[0m + \e[1;32m│\e[0m ┃ ┃ ┃ ┃ ┃ diverse étiquettes (projet, contexte, \e[0;1;32m│\e[0m + \e[1;32m│\e[0m ┃ ┃ ┃ ┃ ┃ clé:valeur) \e[0;1;32m│\e[0m + \e[1;32m│\e[0m ┻ ━┻━ ━━━━┻━━━━━ ━━━━━┻━━━━ ━━━━━━━━━━━━━━━━━━┻━━━━━━━━━━━━━━━━━━ \e[0;1;32m│\e[0m + \e[1;32m│\e[0m \e[1;2mx\e[0;1m \e[31m(A) \e[0;2;38;5;172m2012-12-21 2000-09-05\e[0;1;31m Live in \e[38;5;112m+peace\e[31m on \e[38;5;13m@Earth\e[31m \e[3;38;5;12mdue:eternity \e[0;1;32m│\e[0m + \e[1;32m│\e[0m ━━┳━━━ ━━┳━━━ ━━━━━┳━━━━━━ \e[0;1;32m│\e[0m + \e[1;32m│\e[0m ┃ ┃ ┗ \e[1mÉtiquette \e[3;38;5;12mclé:valeur\e[0;1;33m*\e[0m, \e[0;1;32m│\e[0m + \e[1;32m│\e[0m ┃ ┃ pour renseigner des \e[0;1;32m│\e[0m + \e[1;32m│\e[0m ┃ ┃ types de métadonnée \e[0;1;32m│\e[0m + \e[1;32m│\e[0m ┃ ┃ supplémentaires \e[0;1;32m│\e[0m + \e[1;32m│\e[0m ┃ ┃ \e[0;1;32m│\e[0m + \e[1;32m│\e[0m ┃ ┗ \e[1mÉtiquette de \e[3;38;5;13mcontexte\e[0;1;33m*\e[0m, précédée \e[0;1;32m│\e[0m + \e[1;32m│\e[0m ┃ d'un espace, n'en contenant pas et \e[0;1;32m│\e[0m + \e[1;32m│\e[0m ┃ indiquée par un \e[1;3;38;5;13m@\e[0m, une tâche peut \e[0;1;32m│\e[0m + \e[1;32m│\e[0m ┃ faire partie de plusieurs contextes \e[0;1;32m│\e[0m + \e[1;32m│\e[0m ┃ \e[0;1;32m│\e[0m + \e[1;32m│\e[0m ┗ \e[1mÉtiquette de \e[3;38;5;112mprojet\e[0;1;33m*\e[0m, précédée d'un espace, \e[0;1;32m│\e[0m + \e[1;32m│\e[0m n'en contenant pas et indiquée par un \e[1;3;38;5;112m+\e[0m, une \e[0;1;32m│\e[0m + \e[1;32m│\e[0m tâche peut faire partie de plusieurs projets \e[0;1;32m│\e[0m + \e[1;32m│\e[0m \e[0;1;32m│\e[0m + \e[1;32m│\e[0m \e[2;3mLes champs marqués d'un \e[0;1;33m*\e[0;2;3m sont optionnels, on peut choisir ou non de les \e[0;1;32m│\e[0m + \e[1;32m│\e[0m \e[2;3minclure, mais si on le fait, \e[1mla syntaxe de leur format doit être respectée\e[0;2;3m. \e[0;1;32m│\e[0m + \e[1;32m│\e[0m \e[0;1;32m│\e[0m + \e[1;32m│\e[0m \e[2;3mNote : L'exemple proposé n'est pas valide, puisqu'il cumule la marque de complétion \e[0;1;32m│\e[0m + \e[1;32m│\e[0m \e[2;3met la priorité. \e[0;1;32m│\e[0m + \e[1;32m│\e[0m \e[2;3mDeux exemples valides, une tâche non complétée et une complétée, seraient :\e[0m \e[0;1;32m│\e[0m + \e[1;32m│\e[0m \e[0;1;32m│\e[0m + \e[1;32m│\e[0m \e[1;31m(A) \e[0;2;38;5;172m2000-09-05\e[0;1;31m Live in \e[38;5;112m+peace\e[31m on \e[38;5;13m@Earth\e[31m \e[3;38;5;12mdue:eternity \e[0;1;32m│\e[0m + \e[1;32m│\e[0m \e[0;1;32m│\e[0m + \e[1;32m│\e[0m \e[1;2mx\e[0;1m \e[0;2;38;5;172m2012-12-21 2000-09-05\e[0;1;31m Live in \e[38;5;112m+peace\e[31m on \e[38;5;13m@Earth\e[31m \e[3;38;5;12mdue:eternity \e[0;1;32m│\e[0m + \e[1;32m│\e[0m \e[0;1;32m│\e[0m + \e[1;32m╰─────────────────────────────────────────────────────────────────────────────────────────╯\e[0m + + TodoTxtSyntax + )" | ${PAGER:-less} +} diff --git a/zsh/zshrc b/zsh/zshrc index b8d2cfe..95f285d 100644 --- a/zsh/zshrc +++ b/zsh/zshrc @@ -59,7 +59,9 @@ alias gitu='git add . && git commit && git push' alias g=git alias share='wl-paste | curl -si -d @- https://nixshare.ru/paste/clipboard.txt | grep "location:" | sed -s "s/location: //" | wl-copy' alias p=python3 +alias t=todo.sh [[ ! -f `which exa` ]] || alias ls="exa" && alias ll="exa -l" +compdef _todo t # }}} # {{{ Functions