From e9a2f811b7d030cb8701bd8459fd5c842a521eff Mon Sep 17 00:00:00 2001 From: Alexander Neonxp Kiryukhin Date: Tue, 13 May 2025 10:07:17 +0300 Subject: [PATCH] =?UTF-8?q?=D0=9F=D1=80=D0=B0=D0=B2=D0=BA=D0=B8=20nvim=20?= =?UTF-8?q?=D0=BA=D0=BE=D0=BD=D1=84=D0=B8=D0=B3=D0=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- nvim/init.lua | 1 - nvim/lazy-lock.json | 27 ++++++----- nvim/lua/autocommands.lua | 42 ++++++++++++++--- nvim/lua/keymaps.lua | 16 +++---- nvim/lua/lsp.lua | 10 +++-- nvim/lua/options.lua | 17 +++++-- nvim/lua/plugins.lua | 67 ++++++++++++++++++++++++--- nvim/lua/plugins/autosave.lua | 77 +++++++++++++++++++++++++++++++ nvim/lua/plugins/cmp.lua | 80 +++++++++++++++++---------------- nvim/lua/plugins/conform.lua | 1 + nvim/lua/plugins/lualine.lua | 8 ++-- nvim/lua/plugins/onedark.lua | 33 -------------- nvim/lua/plugins/theme.lua | 21 +++++++++ nvim/lua/plugins/treesitter.lua | 77 +++++++++++++------------------ zsh/zshrc | 2 +- 15 files changed, 313 insertions(+), 166 deletions(-) create mode 100644 nvim/lua/plugins/autosave.lua delete mode 100644 nvim/lua/plugins/onedark.lua create mode 100644 nvim/lua/plugins/theme.lua diff --git a/nvim/init.lua b/nvim/init.lua index a697712..2c2eb00 100644 --- a/nvim/init.lua +++ b/nvim/init.lua @@ -26,4 +26,3 @@ require("keymaps") require("autocommands") require("lsp") require("dap") -require("onedark").load() diff --git a/nvim/lazy-lock.json b/nvim/lazy-lock.json index 30f23f5..c2c4287 100644 --- a/nvim/lazy-lock.json +++ b/nvim/lazy-lock.json @@ -1,34 +1,37 @@ { - "LuaSnip": { "branch": "master", "commit": "03c8e67eb7293c404845b3982db895d59c0d1538" }, + "LuaSnip": { "branch": "master", "commit": "458560534a73f7f8d7a11a146c801db00b081df0" }, + "auto-save.nvim": { "branch": "main", "commit": "29f793a3a7f98129387590269ffe3ad61ab5e509" }, "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": "372fc521f8421b7830ea6db4d6ea3bae1c77548c" }, + "conform.nvim": { "branch": "master", "commit": "374aaf384e2e841607b8e2fe63fa3ad01d111c91" }, "friendly-snippets": { "branch": "main", "commit": "572f5660cf05f8cd8834e096d7b4c921ba18e175" }, "go.nvim": { "branch": "master", "commit": "37ec4d9be3edef64b725bfe29684e1fe019873bc" }, - "goerr-nvim": { "branch": "main", "commit": "d30ba1cab652e78dbf6a644eb4823be57e9af203" }, "goimpl.nvim": { "branch": "main", "commit": "2548d42c4db0645dea14f27e67c4b19b7030f1cf" }, "guihua.lua": { "branch": "master", "commit": "0cc9631914ffcbe3e474e809c610d12a75b660cf" }, "headlines.nvim": { "branch": "master", "commit": "bf17c96a836ea27c0a7a2650ba385a7783ed322e" }, "indent-blankline.nvim": { "branch": "master", "commit": "005b56001b2cb30bfa61b7986bc50657816ba4ba" }, "lazy.nvim": { "branch": "main", "commit": "6c3bda4aca61a13a9c63f1c1d1b16b9d3be90d7a" }, - "lsp_signature.nvim": { "branch": "master", "commit": "a793d02b6a5e639fa9d3f2a89a839fa688ab2d0a" }, + "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" }, "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": "1b801f68d09e70e59e6dd967b663b6d84ee3e87d" }, + "nvim-lspconfig": { "branch": "master", "commit": "61e5109c8cf24807e4ae29813a3a82b31821dd45" }, "nvim-nio": { "branch": "master", "commit": "21f5324bfac14e22ba26553caf69ec76ae8a7662" }, - "nvim-tree.lua": { "branch": "master", "commit": "582ae48c9e43d2bcd55dfcc8e2e7a1f29065d924" }, - "nvim-treesitter": { "branch": "master", "commit": "94ea4f436d2b59c80f02e293466c374584f03b8c" }, - "nvim-treesitter-context": { "branch": "master", "commit": "6daca3ad780f045550b820f262002f35175a6c04" }, - "nvim-treesitter-textobjects": { "branch": "master", "commit": "ed373482db797bbf71bdff37a15c7555a84dce47" }, - "nvim-web-devicons": { "branch": "master", "commit": "2c2b4eafce6cdd0cb165036faa17396eff18f847" }, - "onedark.nvim": { "branch": "master", "commit": "0e5512d1bebd1f08954710086f87a5caa173a924" }, + "nvim-tree.lua": { "branch": "master", "commit": "e7d1b7dadc62fe2eccc17d814354b0a5688621ce" }, + "nvim-treesitter": { "branch": "master", "commit": "28d480e0624b259095e56f353ec911f9f2a0f404" }, + "nvim-treesitter-context": { "branch": "master", "commit": "5c48b8ba1b0b7b25feb6e34e7eb293ea893aedc4" }, + "nvim-treesitter-textobjects": { "branch": "master", "commit": "0e3be38005e9673d044e994b1e4b123adb040179" }, + "nvim-ts-autotag": { "branch": "main", "commit": "a1d526af391f6aebb25a8795cbc05351ed3620b5" }, + "nvim-web-devicons": { "branch": "master", "commit": "f1420728f59843eb2ef084406b3d0201a0a0932d" }, + "onedark.nvim": { "branch": "master", "commit": "11de4da47f3e69cb70c3ae9816bd8af166cbe121" }, "plenary.nvim": { "branch": "master", "commit": "857c5ac632080dba10aae49dba902ce3abf91b35" }, "popup.nvim": { "branch": "master", "commit": "b7404d35d5d3548a82149238289fa71f7f6de4ac" }, "smartcolumn.nvim": { "branch": "main", "commit": "92f3773af80d674f1eb61e112dca79e2fa449fd1" }, - "telescope.nvim": { "branch": "master", "commit": "a4ed82509cecc56df1c7138920a1aeaf246c0ac5" } + "telescope.nvim": { "branch": "master", "commit": "b4da76be54691e854d3e0e02c36b0245f945c2c7" } } diff --git a/nvim/lua/autocommands.lua b/nvim/lua/autocommands.lua index f0733f3..48c94d9 100644 --- a/nvim/lua/autocommands.lua +++ b/nvim/lua/autocommands.lua @@ -69,13 +69,6 @@ vim.api.nvim_create_autocmd("TextYankPost", { end, }) -vim.api.nvim_create_autocmd({ "BufReadPost", "FileReadPost" }, { - pattern = "*", - callback = function() - vim.cmd("normal! zR") - end, -}) - vim.api.nvim_create_autocmd("BufEnter", { callback = function() if vim.bo.filetype == "NvimTree" or vim.fn.expand("%") == "" then @@ -92,6 +85,33 @@ vim.api.nvim_create_autocmd("BufEnter", { end, }) +vim.api.nvim_create_autocmd({ "BufEnter", "BufAdd", "BufNew", "BufNewFile", "BufWinEnter" }, { + group = vim.api.nvim_create_augroup("TS_FOLD_WORKAROUND", {}), + callback = function() + vim.opt.foldmethod = "expr" + vim.opt.foldexpr = "nvim_treesitter#foldexpr()" + end, +}) +vim.api.nvim_create_autocmd("FileType", { + pattern = "*", + callback = function(args) + local buf = args.buf + local ft = vim.bo[buf].filetype + + if ft and ft ~= "" then + local has_parser, _ = pcall(vim.treesitter.language.get_lang, ft) + if has_parser then + pcall(vim.treesitter.start, buf, ft) + end + end + end +}) +vim.api.nvim_create_autocmd("User", { + pattern = "TSUpdate", + callback = function() + vim.cmd([[TSEnable highlight]]) + end, +}) vim.api.nvim_create_autocmd({ "BufWritePost" }, { pattern = "*.templ", callback = function() @@ -146,6 +166,14 @@ vim.api.nvim_create_autocmd("FileType", { vim.opt_local.cindent = false end, }) + +vim.api.nvim_create_autocmd("VimResized", { + pattern = "*", + callback = function() + vim.opt.scrolloff = vim.fn.floor(vim.fn.winheight(0) / 2) + end, +}) + -- vim.api.nvim_create_autocmd("InsertEnter", { -- pattern = "*", -- command = "set norelativenumber", diff --git a/nvim/lua/keymaps.lua b/nvim/lua/keymaps.lua index 34ff6c1..c57ce97 100644 --- a/nvim/lua/keymaps.lua +++ b/nvim/lua/keymaps.lua @@ -23,8 +23,8 @@ map("v", ">", ">gv", { noremap = true, silent = true }) kmap("n", "bn", "bnext", { noremap = true, silent = true, desc = "Next buffer" }) kmap("n", "bp", "bprevious", { noremap = true, silent = true, desc = "Previous buffer" }) kmap("n", "bd", "bdelete", { noremap = true, silent = true, desc = "Delete buffer" }) -kmap("n", "w", "wa", { noremap = true, silent = true, desc = "Save all files" }) -kmap("n", "qq", "q", { noremap = true, silent = true, desc = "Exit" }) +kmap("n", "", "wa", { noremap = true, silent = true, desc = "Save all files" }) +kmap("n", "q", "q", { noremap = true, silent = true, desc = "Exit" }) kmap("n", "vs", "vsplit", { noremap = true, silent = true, desc = "Vertical split" }) -- }}} @@ -47,17 +47,16 @@ kmap("n", "tt", ":split:terminal:startinsert", { noremap = t kmap("n", "e", vim.diagnostic.open_float, { noremap = true, silent = true, desc = "Show diagnostics" }) 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" }) kmap("n", "gD", vim.lsp.buf.declaration, { noremap = true, silent = true, desc = "Go to declaration" }) - kmap("n", "gd", vim.lsp.buf.definition, { noremap = true, silent = true, desc = "Go to definition" }) +kmap("n", "D", vim.lsp.buf.type_definition, { noremap = true, silent = true, desc = "Type definition" }) +kmap("n", "gr", vim.lsp.buf.references, { noremap = true, silent = true, desc = "Find references" }) kmap("n", "K", vim.lsp.buf.hover, { noremap = true, silent = true, desc = "Show documentation" }) kmap("n", "gi", vim.lsp.buf.implementation, { noremap = true, silent = true, desc = "Go to implementation" }) - kmap("n", "", vim.lsp.buf.signature_help, { noremap = true, silent = true, desc = "Signature help" }) kmap( @@ -78,11 +77,8 @@ kmap("n", "wl", function() print(vim.inspect(vim.lsp.buf.list_workspace_folders())) end, { noremap = true, silent = true, desc = "List workspace folders" }) -kmap("n", "D", vim.lsp.buf.type_definition, { noremap = true, silent = true, desc = "Type definition" }) - -kmap("n", "", vim.lsp.buf.code_action, { noremap = true, silent = true, desc = "Code actions" }) - -kmap("n", "gr", vim.lsp.buf.references, { noremap = true, silent = true, desc = "Find references" }) +--kmap("n", "", vim.lsp.buf.code_action, { noremap = true, silent = true, desc = "Code actions" }) +kmap("n", "", "Lspsaga code_action", { noremap = true, silent = true, desc = "Code actions" }) kmap("n", "", vim.lsp.buf.rename, { noremap = true, silent = true, desc = "Rename symbol" }) diff --git a/nvim/lua/lsp.lua b/nvim/lua/lsp.lua index 5f04683..73b92f2 100644 --- a/nvim/lua/lsp.lua +++ b/nvim/lua/lsp.lua @@ -7,11 +7,9 @@ local function config(_config) capabilities = require("cmp_nvim_lsp").default_capabilities(vim.lsp.protocol.make_client_capabilities()), }, _config or {}) end - -- иницализация gopls LSP для Go -- https://github.com/golang/tools/blob/master/gopls/doc/vim.md#neovim-install lspconfig.gopls.setup(config({ - on_attach = on_attach, cmd = { "gopls", "serve" }, filetypes = { "go", "go.mod" }, root_dir = util.root_pattern("go.work", "go.mod", ".git"), @@ -19,9 +17,15 @@ lspconfig.gopls.setup(config({ gopls = { analyses = { unusedparams = true, - shadow = true, }, staticcheck = true, + gofumpt = true, }, }, })) + +lspconfig.templ.setup(config({ + cmd = {"templ", "lsp"}, + filetypes = {"templ"}, + root_markers = { "go.work", "go.mod", ".git" }, +})) diff --git a/nvim/lua/options.lua b/nvim/lua/options.lua index c5bd497..c912b32 100644 --- a/nvim/lua/options.lua +++ b/nvim/lua/options.lua @@ -32,12 +32,15 @@ local options = { scrolloff = 8, sidescrolloff = 8, syntax = "on", - foldmethod = "marker", + foldmethod = "expr", foldmarker = "{{{,}}}", - --foldexpr = "nvim_treesitter#foldexpr()", - foldlevelstart = 0, + --foldexpr = "v:lua.vim.treesitter.foldexpr()", + foldexpr = "nvim_treesitter#foldexpr()", + foldlevelstart = 99, foldenable = true, 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", } vim.opt.formatoptions:append({ r = true, o = true }) vim.opt.shortmess:append("c") @@ -45,5 +48,11 @@ vim.opt.shortmess:append("c") for k, v in pairs(options) do vim.opt[k] = v end - +vim.wo.foldmethod = "expr" +vim.wo.foldexpr = "v:lua.vim.treesitter.foldexpr()" vim.cmd("set whichwrap+=<,>,[,],h,l") +vim.filetype.add({ + extension = { + templ = "templ", + }, +}) diff --git a/nvim/lua/plugins.lua b/nvim/lua/plugins.lua index 4b0b605..0f46ea6 100644 --- a/nvim/lua/plugins.lua +++ b/nvim/lua/plugins.lua @@ -1,7 +1,11 @@ -local plugins = { +require("lazy").setup({ { "nvim-lua/plenary.nvim" }, + { + "ray-x/guihua.lua", + build = "cd lua/fzy && make", + }, { "neovim/nvim-lspconfig" }, - { "Snyssfx/goerr-nvim" }, + -- { "Snyssfx/goerr-nvim" }, { "lukas-reineke/indent-blankline.nvim", main = "ibl", @@ -20,10 +24,61 @@ local plugins = { { "ray-x/lsp_signature.nvim", event = "VeryLazy", - config = true, + opts = { + doc_lines = 1, + max_height = 3, + hint_prefix = "", + hint_prefix = { + above = "↙ ", + current = "← ", + below = "↖ ", + }, + floating_window = false, + }, }, + { + "nvimdev/lspsaga.nvim", + opts = { + lightbulb = { + enable = false, + }, + }, + }, + { + "karb94/neoscroll.nvim", + opts = { + stop_eof = false, + respect_scrolloff = true, + mappings = { + "", + "", + "", + "", + "", + "", + "zt", + "zz", + "zb", + }, + }, + keys = { + { + "", + function() + require("neoscroll").scroll(-vim.api.nvim_win_get_height(0) + 3, { duration = 150 }) + end, + }, + { + "", + function() + require("neoscroll").scroll(vim.api.nvim_win_get_height(0) - 3, { duration = 150 }) + end, + }, + }, + }, + require("plugins.autosave"), + require("plugins.theme"), require("plugins.cmp"), - require("plugins.onedark"), require("plugins.treesitter"), require("plugins.tree"), require("plugins.conform"), @@ -34,9 +89,7 @@ local plugins = { require("plugins.lualine"), require("plugins.telescope"), require("plugins.columns"), -} - -require("lazy").setup(plugins, { +}, { performance = { rtp = { disabled_plugins = { diff --git a/nvim/lua/plugins/autosave.lua b/nvim/lua/plugins/autosave.lua new file mode 100644 index 0000000..9cbcd83 --- /dev/null +++ b/nvim/lua/plugins/autosave.lua @@ -0,0 +1,77 @@ +return { + "okuuva/auto-save.nvim", + enabled = true, + cmd = "ASToggle", -- optional for lazy loading on command + event = { "InsertLeave", "TextChanged" }, -- optional for lazy loading on trigger events + opts = { + enabled = true, -- start auto-save when the plugin is loaded (i.e. when your package manager loads it) + trigger_events = { -- See :h events + -- -- vim events that trigger an immediate save + -- -- I'm disabling this, as it's autosaving when I leave the buffer and + -- -- that's autoformatting stuff if on insert mode and following a tutorial + -- -- Re-enabling this to only save if NOT in insert mode in the condition below + -- immediate_save = { nil }, + immediate_save = { "BufLeave", "FocusLost", "QuitPre", "VimSuspend" }, -- vim events that trigger an immediate save + -- vim events that trigger a deferred save (saves after `debounce_delay`) + defer_save = { + "InsertLeave", + "TextChanged", + { "User", pattern = "VisualLeave" }, + { "User", pattern = "FlashJumpEnd" }, + { "User", pattern = "SnacksInputLeave" }, + { "User", pattern = "SnacksPickerInputLeave" }, + }, + cancel_deferred_save = { + "InsertEnter", + { "User", pattern = "VisualEnter" }, + { "User", pattern = "FlashJumpStart" }, + { "User", pattern = "SnacksInputEnter" }, + { "User", pattern = "SnacksPickerInputEnter" }, + }, + }, + -- function that takes the buffer handle and determines whether to save the current buffer or not + -- return true: if buffer is ok to be saved + -- return false: if it's not ok to be saved + -- if set to `nil` then no specific condition is applied + condition = function(buf) + -- Do not save when I'm in insert mode + -- Do NOT ADD VISUAL MODE HERE or the cancel_deferred_save wont' work + -- If I STAY in insert mode and switch to another app, like YouTube to + -- take notes, the BufLeave or FocusLost immediate_save will be ignored + -- and the save will not be triggered + local mode = vim.fn.mode() + if mode == "i" then + return false + end + + -- Disable auto-save for the harpoon plugin, otherwise it just opens and closes + -- https://github.com/ThePrimeagen/harpoon/issues/434 + -- + -- don't save for `sql` file types + -- I do this so when working with dadbod the file is not saved every time + -- I make a change, and a SQL query executed + -- Run `:set filetype?` on a dadbod query to make sure of the filetype + local filetype = vim.bo[buf].filetype + if filetype == "harpoon" or filetype == "mysql" then + return false + end + + -- Skip autosave if you're in an active snippet + if require("luasnip").in_snippet() then + return false + end + + return true + end, + write_all_buffers = false, -- write all buffers when the current one meets `condition` + -- Do not execute autocmds when saving + -- If you set noautocmd = true, autosave won't trigger an auto format + -- https://github.com/okuuva/auto-save.nvim/issues/55 + noautocmd = false, + lockmarks = false, -- lock marks when saving, see `:h lockmarks` for more details + -- delay after which a pending save is executed (default 1000) + debounce_delay = 2000, + -- log debug messages to 'auto-save.log' file in neovim cache directory, set to `true` to enable + debug = false, + }, +} diff --git a/nvim/lua/plugins/cmp.lua b/nvim/lua/plugins/cmp.lua index 0a7cffc..7457d2f 100644 --- a/nvim/lua/plugins/cmp.lua +++ b/nvim/lua/plugins/cmp.lua @@ -50,44 +50,46 @@ return { }, }, }, - opts = { - -- preselect = require("cmp").PreselectMode.None, - experimental = { - ghost_text = true, - }, + config = function() + require("cmp").setup({ + preselect = require("cmp").PreselectMode.None, + experimental = { + ghost_text = false, + }, - confirmation = { - default_behavior = require("cmp").ConfirmBehavior.Replace, - }, - completion = { - completeopt = "menu,menuone,noinsert,noselect", - keyword_length = 2, - }, - mapping = require("cmp").mapping.preset.insert({ - [""] = require("cmp").mapping.scroll_docs(-4), - [""] = require("cmp").mapping.scroll_docs(4), - [""] = require("cmp").mapping.complete(), - [""] = require("cmp").mapping.abort(), - [""] = require("cmp").mapping.confirm({ select = false }), - [""] = require("cmp").mapping.confirm({ select = true }), - }), - snippet = { - expand = function(args) - require("luasnip").lsp_expand(args.body) - end, - }, - formatting = { - format = function(entry, vim_item) - vim_item.menu = source_mapping[entry.source.name] or "[Unknown]" - return vim_item - end, - }, - sources = require("cmp").config.sources({ - { name = "nvim_lsp", priority = 1000 }, - { name = "luasnip", priority = 750 }, - { name = "path", priority = 500 }, - }, { - { name = "buffer" }, - }), - }, + confirmation = { + default_behavior = require("cmp").ConfirmBehavior.Replace, + }, + completion = { + completeopt = "menu,menuone,noinsert,noselect", + keyword_length = 2, + }, + mapping = require("cmp").mapping.preset.insert({ + [""] = require("cmp").mapping.scroll_docs(-4), + [""] = require("cmp").mapping.scroll_docs(4), + [""] = require("cmp").mapping.complete(), + [""] = require("cmp").mapping.abort(), + [""] = require("cmp").mapping.confirm({ select = false }), + [""] = require("cmp").mapping.confirm({ select = true }), + }), + snippet = { + expand = function(args) + require("luasnip").lsp_expand(args.body) + end, + }, + formatting = { + format = function(entry, vim_item) + vim_item.menu = source_mapping[entry.source.name] or "[Unknown]" + return vim_item + end, + }, + sources = require("cmp").config.sources({ + { name = "nvim_lsp", priority = 1000 }, + { name = "luasnip", priority = 750 }, + { name = "path", priority = 500 }, + }, { + { name = "buffer" }, + }), + }) + end, } diff --git a/nvim/lua/plugins/conform.lua b/nvim/lua/plugins/conform.lua index ea0fcf0..3204d2d 100644 --- a/nvim/lua/plugins/conform.lua +++ b/nvim/lua/plugins/conform.lua @@ -15,6 +15,7 @@ return { lua = { "stylua" }, python = { "isort", "black" }, go = { "gofmt" }, + templ = { "templ" }, }, format_on_save = { lsp_fallback = true, diff --git a/nvim/lua/plugins/lualine.lua b/nvim/lua/plugins/lualine.lua index 3be9d19..19bcb8e 100644 --- a/nvim/lua/plugins/lualine.lua +++ b/nvim/lua/plugins/lualine.lua @@ -3,7 +3,7 @@ return { opts = { options = { icons_enabled = true, - theme = "auto", + theme = "onedark", component_separators = { left = "", right = "" }, section_separators = { left = "", right = "" }, disabled_filetypes = { @@ -23,9 +23,9 @@ return { lualine_a = { "mode" }, lualine_b = { "branch", "diff", "diagnostics" }, lualine_c = { "filename" }, - lualine_x = { "encoding", "fileformat", "filetype" }, - lualine_y = { "progress" }, - lualine_z = { "location" }, + lualine_x = { "filetype" }, + lualine_y = { "progress", "location" }, + lualine_z = { "lsp_status", "os.date('%H:%M')" }, }, inactive_sections = { lualine_a = {}, diff --git a/nvim/lua/plugins/onedark.lua b/nvim/lua/plugins/onedark.lua deleted file mode 100644 index f4c4aca..0000000 --- a/nvim/lua/plugins/onedark.lua +++ /dev/null @@ -1,33 +0,0 @@ -return { - "navarasu/onedark.nvim", - opts = { - style = "darker", - transparent = false, -- Show/hide background - term_colors = true, -- Change terminal color as per the selected theme style - ending_tildes = true, -- Show the end-of-buffer tildes. By default they are hidden - cmp_itemkind_reverse = false, -- reverse item kind highlights in cmp menu - toggle_style_key = nil, -- keybind to toggle theme style. Leave it nil to disable it, or set it to a string, for example "ts" - toggle_style_list = { "dark", "darker", "cool", "deep", "warm", "warmer", "light" }, -- List of styles to toggle between - - code_style = { - comments = "italic", - keywords = "none", - functions = "none", - strings = "none", - variables = "none", - }, - - lualine = { - transparent = false, -- lualine center bar transparency - }, - - colors = {}, -- Override default colors - highlights = {}, -- Override highlight groups - - diagnostics = { - darker = true, -- darker colors for diagnostic - undercurl = true, -- use undercurl instead of underline for diagnostics - background = true, -- use background color for virtual text - }, - }, -} diff --git a/nvim/lua/plugins/theme.lua b/nvim/lua/plugins/theme.lua new file mode 100644 index 0000000..72a6f81 --- /dev/null +++ b/nvim/lua/plugins/theme.lua @@ -0,0 +1,21 @@ +return { + "navarasu/onedark.nvim", + priority = 1000, -- make sure to load this before all the other start plugins + config = function() + require("onedark").setup({ + style = "darker", + colors = { + bright_orange = "#ff8800", -- define a new color + }, + highlights = { + -- ["@lsp.type.keyword"] = { fg = "$green", fmt = "bold,underline" }, + -- ["@lsp.type.property"] = { fg = "$bright_orange", bg = "#00ff00", fmt = "bold" }, + -- ["@lsp.type.function"] = { fg = "#0000ff", sp = "$cyan", fmt = "underline,italic" }, + -- ["@lsp.type.method"] = { link = "@function" }, + -- To add language specific config + -- ["@lsp.type.variable.go"] = { fg = "none" }, + }, + }) + require("onedark").load() + end, +} diff --git a/nvim/lua/plugins/treesitter.lua b/nvim/lua/plugins/treesitter.lua index f6127d7..08d05e9 100644 --- a/nvim/lua/plugins/treesitter.lua +++ b/nvim/lua/plugins/treesitter.lua @@ -2,56 +2,42 @@ return { "nvim-treesitter/nvim-treesitter", build = ":TSUpdate", opts = { - highlight = { enable = true }, - ensure_installed = { - "c", - "lua", - "python", - "bash", - "go", - "html", - "css", - "javascript", - "typescript", - "git_config", - "git_rebase", - "gitattributes", - "gitcommit", - "gitignore", - "gomod", - "gosum", - "gotmpl", - "gowork", - "hjson", - "ini", - "json", - "json5", - "jsonnet", - "latex", - "make", - "markdown", - "markdown_inline", - "nginx", - "proto", - "rust", - "templ", - "todotxt", - "toml", - "tsx", - "typescript", - "vim", - "vimdoc", - "xml", - "yaml", - "sql", - "ssh_config", + highlight = { + enable = true, + additional_vim_regex_highlighting = false, }, + ensure_installed = "all", ignore_install = { "gdhsader", "phpdoc" }, indent = { enable = true }, auto_install = true, - sync_install = false, - textobjects = { select = { enable = true, lookahead = true } }, + sync_install = true, + incremental_selection = { + enable = true, + keymaps = { + init_selection = "", + node_incremental = "", + scope_incremental = false, + node_decremental = "", + }, + }, + textobjects = { + select = { enable = true, lookahead = true }, + move = { + enable = true, + goto_next_start = { ["]f"] = "@function.outer", ["]c"] = "@class.outer", ["]a"] = "@parameter.inner" }, + goto_next_end = { ["]F"] = "@function.outer", ["]C"] = "@class.outer", ["]A"] = "@parameter.inner" }, + goto_previous_start = { + ["[f"] = "@function.outer", + ["[c"] = "@class.outer", + ["[a"] = "@parameter.inner", + }, + goto_previous_end = { ["[F"] = "@function.outer", ["[C"] = "@class.outer", ["[A"] = "@parameter.inner" }, + }, + }, }, + build = function() + require("nvim-treesitter.install").update({ with_sync = true })() + end, dependencies = { { "nvim-treesitter/nvim-treesitter-textobjects" }, { @@ -62,5 +48,6 @@ return { line_numbers = true, }, }, + { "windwp/nvim-ts-autotag" }, }, } diff --git a/zsh/zshrc b/zsh/zshrc index de9f9d6..9e473c4 100644 --- a/zsh/zshrc +++ b/zsh/zshrc @@ -56,7 +56,7 @@ alias df="df -h" alias free="free -m" alias gitu='git add . && git commit && git push' alias g=git -alias nsh='wl-paste | curl -d @- https://nixshare.ru/upload 2>/dev/null | wl-copy' +alias share='wl-paste | curl -si -d @- https://nixshare.ru/paste/clipboard.txt | grep "location:" | sed -s "s/location: //" | wl-copy' alias p=python3 [[ ! -f `which exa` ]] || alias ls="exa" && alias ll="exa -l" # }}}