diff --git a/linux/.config/nvim/init.lua b/linux/.config/nvim/init.lua new file mode 100644 index 0000000..2146012 --- /dev/null +++ b/linux/.config/nvim/init.lua @@ -0,0 +1,7 @@ +vim.g.mapleader = " " +vim.g.maplocalleader = " " + +require 'core.lazy' +require 'core.options' +require 'core.keymaps' +require 'core.autocmds' diff --git a/linux/.config/nvim/lazy-lock.json b/linux/.config/nvim/lazy-lock.json new file mode 100644 index 0000000..afd040e --- /dev/null +++ b/linux/.config/nvim/lazy-lock.json @@ -0,0 +1,32 @@ +{ + "Comment.nvim": { "branch": "master", "commit": "0236521ea582747b58869cb72f70ccfa967d2e89" }, + "LuaSnip": { "branch": "master", "commit": "118263867197a111717b5f13d954cd1ab8124387" }, + "barbar.nvim": { "branch": "master", "commit": "dd852401ee902745b67fc09a83d113b3fe82a96f" }, + "cmp-buffer": { "branch": "main", "commit": "3022dbc9166796b644a841a02de8dd1cc1d311fa" }, + "cmp-nvim-lsp": { "branch": "main", "commit": "5af77f54de1b16c34b23cba810150689a3a90312" }, + "cmp-path": { "branch": "main", "commit": "91ff86cd9c29299a64f968ebb45846c485725f23" }, + "cmp_luasnip": { "branch": "master", "commit": "05a9ab28b53f71d1aece421ef32fee2cb857a843" }, + "friendly-snippets": { "branch": "main", "commit": "53d3df271d031c405255e99410628c26a8f0d2b0" }, + "gitsigns.nvim": { "branch": "main", "commit": "d195f0c35ced5174d3ecce1c4c8ebb3b5bc23fa9" }, + "indent-blankline.nvim": { "branch": "master", "commit": "5da5546947f3125dfd6aa85ab21074dc83f776d5" }, + "lazy.nvim": { "branch": "main", "commit": "96584866b9c5e998cbae300594d0ccfd0c464627" }, + "lsp-zero.nvim": { "branch": "v3.x", "commit": "1104a01a1126cddd77f957a9bd32730694c604c4" }, + "lualine.nvim": { "branch": "master", "commit": "566b7036f717f3d676362742630518a47f132fff" }, + "mason-lspconfig.nvim": { "branch": "main", "commit": "56e435e09f8729af2d41973e81a0db440f8fe9c9" }, + "mason.nvim": { "branch": "main", "commit": "41e75af1f578e55ba050c863587cffde3556ffa6" }, + "neodev.nvim": { "branch": "main", "commit": "029899ea32d3dc8ed8c910ceca2ee5d16e566c11" }, + "nvim-autopairs": { "branch": "master", "commit": "9fd41181693dd4106b3e414a822bb6569924de81" }, + "nvim-cmp": { "branch": "main", "commit": "538e37ba87284942c1d76ed38dd497e54e65b891" }, + "nvim-lspconfig": { "branch": "master", "commit": "9099871a7c7e1c16122e00d70208a2cd02078d80" }, + "nvim-tree.lua": { "branch": "master", "commit": "50f30bcd8c62ac4a83d133d738f268279f2c2ce2" }, + "nvim-treesitter": { "branch": "master", "commit": "7d0b4756aba3b220d38ec0443c6cc10944060dd7" }, + "nvim-ts-autotag": { "branch": "main", "commit": "8515e48a277a2f4947d91004d9aa92c29fdc5e18" }, + "nvim-web-devicons": { "branch": "master", "commit": "43aa2ddf476012a2155f5f969ee55ab17174da7a" }, + "plenary.nvim": { "branch": "master", "commit": "55d9fe89e33efd26f532ef20223e5f9430c8b0c0" }, + "telescope.nvim": { "branch": "master", "commit": "54930e1abfc94409e1bb9266e752ef8379008592" }, + "tokyonight.nvim": { "branch": "main", "commit": "f247ee700b569ed43f39320413a13ba9b0aef0db" }, + "trouble.nvim": { "branch": "main", "commit": "f1168feada93c0154ede4d1fe9183bf69bac54ea" }, + "vim-illuminate": { "branch": "master", "commit": "3bd2ab64b5d63b29e05691e624927e5ebbf0fb86" }, + "vim-tmux-navigator": { "branch": "master", "commit": "38b1d0402c4600543281dc85b3f51884205674b6" }, + "which-key.nvim": { "branch": "main", "commit": "4433e5ec9a507e5097571ed55c02ea9658fb268a" } +} \ No newline at end of file diff --git a/linux/.config/nvim/lua/core/autocmds.lua b/linux/.config/nvim/lua/core/autocmds.lua new file mode 100644 index 0000000..8bd359d --- /dev/null +++ b/linux/.config/nvim/lua/core/autocmds.lua @@ -0,0 +1,23 @@ +-- auto-format on save +local lsp_fmt_group = vim.api.nvim_create_augroup("LspFormattingGroup", {}) +vim.api.nvim_create_autocmd("BufWritePre", { + group = lsp_fmt_group, + callback = function() + local efm = vim.lsp.get_active_clients({ name = "efm" }) + + if vim.tbl_isempty(efm) then + return + end + + vim.lsp.buf.format({ name = "efm", async = true }) + end, +}) + +-- highlight on yank +local highlight_yank_group = vim.api.nvim_create_augroup("HighlightYankGroup", {}) +vim.api.nvim_create_autocmd("TextYankPost", { + group = highlight_yank_group, + callback = function() + vim.highlight.on_yank() + end, +}) diff --git a/linux/.config/nvim/lua/core/keymaps.lua b/linux/.config/nvim/lua/core/keymaps.lua new file mode 100644 index 0000000..cd8ee2f --- /dev/null +++ b/linux/.config/nvim/lua/core/keymaps.lua @@ -0,0 +1,58 @@ +local mapkey = require("utils.keymapper").mapvimkey + +-- Buffer Navigation +mapkey("bn", "bnext", "n") -- Next buffer +mapkey("bp", "bprevious", "n") -- Prev buffer +mapkey("bb", "e #", "n") -- Switch to Other Buffer +mapkey("`", "e #", "n") -- Switch to Other Buffer + +-- Directory Navigatio}n +mapkey("m", "NvimTreeFocus", "n") +mapkey("e", "NvimTreeToggle", "n") + +-- Pane and Window Navigation +mapkey("", "h", "n") -- Navigate Left +mapkey("", "j", "n") -- Navigate Down +mapkey("", "k", "n") -- Navigate Up +mapkey("", "l", "n") -- Navigate Right +mapkey("", "wincmd h", "t") -- Navigate Left +mapkey("", "wincmd j", "t") -- Navigate Down +mapkey("", "wincmd k", "t") -- Navigate Up +mapkey("", "wincmd l", "t") -- Navigate Right +mapkey("", "TmuxNavigateLeft", "n") -- Navigate Left +mapkey("", "TmuxNavigateDown", "n") -- Navigate Down +mapkey("", "TmuxNavigateUp", "n") -- Navigate Up +mapkey("", "TmuxNavigateRight", "n") -- Navigate Right + +-- Window Management +mapkey("sv", "vsplit", "n") -- Split Vertically +mapkey("sh", "split", "n") -- Split Horizontally +mapkey("", "resize +2", "n") +mapkey("", "resize -2", "n") +mapkey("", "vertical resize +2", "n") +mapkey("", "vertical resize -2", "n") + +-- Show Full File-Path +mapkey("pa", "echo expand('%:p')", "n") -- Show Full File Path + +-- Notes +mapkey("ng", "Neorg workspace general", "n") +mapkey("nw", "Neorg workspace work", "n") +mapkey("ny", "Neorg workspace youtube", "n") + +-- Indenting +vim.keymap.set("v", "<", "", ">gv", { silent = true, noremap = true }) + +local api = vim.api + +-- Zen Mode +api.nvim_set_keymap("n", "zn", ":TZNarrow", {}) +api.nvim_set_keymap("v", "zn", ":'<,'>TZNarrow", {}) +api.nvim_set_keymap("n", "sm", ":TZFocus", {}) +api.nvim_set_keymap("n", "zm", ":TZMinimalist", {}) +api.nvim_set_keymap("n", "za", ":TZAtaraxis", {}) + +-- Comments +api.nvim_set_keymap("n", "", "gtc", { noremap = false }) +api.nvim_set_keymap("v", "", "goc", { noremap = false }) diff --git a/linux/.config/nvim/lua/core/lazy.lua b/linux/.config/nvim/lua/core/lazy.lua new file mode 100644 index 0000000..f294fed --- /dev/null +++ b/linux/.config/nvim/lua/core/lazy.lua @@ -0,0 +1,41 @@ +local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim" +if not vim.loop.fs_stat(lazypath) then + vim.fn.system({ + "git", + "clone", + "--filter=blob:none", + "https://github.com/folke/lazy.nvim.git", + "--branch=stable", -- latest stable release + lazypath, + }) +end +vim.opt.rtp:prepend(lazypath) + +local plugins = "plugins" + +local opts = { + defaults = { + lazy = true, + }, + install = { + colorscheme = { "nightfox" }, + }, + rtp = { + disabled_plugins = { + "gzip", + "matchit", + "matchparen", + "netrw", + "netrwPlugin", + "tarPlugin", + "tohtml", + "tutor", + "zipPlugin", + }, + }, + change_detection = { + notify = false, + }, +} + +require("lazy").setup(plugins, opts) diff --git a/linux/.config/nvim/lua/core/options.lua b/linux/.config/nvim/lua/core/options.lua new file mode 100644 index 0000000..716548b --- /dev/null +++ b/linux/.config/nvim/lua/core/options.lua @@ -0,0 +1,50 @@ +local opt = vim.opt + +-- Tab / Indentation +opt.tabstop = 2 +opt.shiftwidth = 2 +opt.softtabstop = 2 +opt.expandtab = true +opt.smartindent = true +opt.wrap = false + +-- Search +opt.incsearch = true +opt.ignorecase = true +opt.smartcase = true +opt.hlsearch = false + +-- Appearance +opt.number = true +opt.relativenumber = false +opt.termguicolors = true +opt.colorcolumn = "100" +opt.signcolumn = "yes" +-- opt.signcolumn = "number" +opt.cmdheight = 1 +opt.scrolloff = 10 +opt.completeopt = "menuone,noinsert,noselect" +-- opt.guicursor = "" + +opt.tabline = '%!v:lua.require("utils").tabline()' + + +-- Behaviour +opt.hidden = true +opt.errorbells = false +opt.swapfile = false +opt.backup = false +opt.undodir = vim.fn.expand("~/.vim/undodir") +opt.undofile = true +opt.backspace = "indent,eol,start" +opt.splitright = true +opt.splitbelow = true +opt.autochdir = false +opt.iskeyword:append("-") +opt.mouse:append("a") +opt.clipboard:append("unnamedplus") +opt.modifiable = true +-- opt.guicursor = +-- "n-v-c:block,i-ci-ve:block,r-cr:hor20,o:hor50,a:blinkwait700-blinkoff400-blinkon250-Cursor/lCursor,sm:block-blinkwait175-blinkoff150-blinkon175" +opt.encoding = "UTF-8" +opt.cursorline = true diff --git a/linux/.config/nvim/lua/plugins/comment.lua b/linux/.config/nvim/lua/plugins/comment.lua new file mode 100644 index 0000000..12eedb8 --- /dev/null +++ b/linux/.config/nvim/lua/plugins/comment.lua @@ -0,0 +1,6 @@ +return { + "numToStr/Comment.nvim", + opts = { + }, + lazy = false, +} diff --git a/linux/.config/nvim/lua/plugins/indent-blackline.lua b/linux/.config/nvim/lua/plugins/indent-blackline.lua new file mode 100644 index 0000000..b483458 --- /dev/null +++ b/linux/.config/nvim/lua/plugins/indent-blackline.lua @@ -0,0 +1,6 @@ +return { + "lukas-reineke/indent-blankline.nvim", + main = "ibl", + opts = {}, + lazy = false, +} diff --git a/linux/.config/nvim/lua/plugins/init.lua b/linux/.config/nvim/lua/plugins/init.lua new file mode 100644 index 0000000..435838e --- /dev/null +++ b/linux/.config/nvim/lua/plugins/init.lua @@ -0,0 +1,16 @@ +return { + { + "folke/which-key.nvim", + event = "VeryLazy", + init = function() + vim.o.timeout = true + vim.o.timeoutlen = 900 + end, + opts = { + -- your configuration comes here + -- or leave it empty to use the default settings + -- refer to the configuration section below + } + }, + { "folke/neodev.nvim" }, +} diff --git a/linux/.config/nvim/lua/plugins/lsp.lua b/linux/.config/nvim/lua/plugins/lsp.lua new file mode 100644 index 0000000..cbdc110 --- /dev/null +++ b/linux/.config/nvim/lua/plugins/lsp.lua @@ -0,0 +1,124 @@ +local config = function() + local lsp_zero = require 'lsp-zero' + local luasnip = require 'luasnip' + local diagnostic_signs = require("utils.icons").diagnostic_signs + + lsp_zero.on_attach(function(client, bufnr) + vim.diagnostic.config({ + virtual_text = false, -- disable virtual text + update_in_insert = true, + underline = true, + severity_sort = true, + float = { + focusable = true, + style = "minimal", + border = "rounded", + source = "always", + + header = "", + prefix = "", + }, + }) + + vim.lsp.handlers["textDocument/hover"] = vim.lsp.with(vim.lsp.handlers.hover, { + border = "rounded", + }) + + vim.lsp.handlers["textDocument/signatureHelp"] = vim.lsp.with(vim.lsp.handlers.signature_help, { + border = "rounded", + }) + + local opts = {buffer = bufnr, remap = false} + + vim.keymap.set("n", "gd", function() vim.lsp.buf.definition() end, opts) + vim.keymap.set("n", "K", function() vim.lsp.buf.hover() end, opts) + vim.keymap.set("n", "vws", function() vim.lsp.buf.workspace_symbol() end, opts) + vim.keymap.set("n", "vd", function() vim.diagnostic.open_float() end, opts) + vim.keymap.set("n", "[d", function() vim.diagnostic.goto_next() end, opts) + vim.keymap.set("n", "]d", function() vim.diagnostic.goto_prev() end, opts) + vim.keymap.set("n", "vca", function() vim.lsp.buf.code_action() end, opts) + vim.keymap.set("n", "vrr", function() vim.lsp.buf.references() end, opts) + vim.keymap.set("n", "vrn", function() vim.lsp.buf.rename() end, opts) + vim.keymap.set("i", "", function() vim.lsp.buf.signature_help() end, opts) + end) + + lsp_zero.set_sign_icons({ + error = diagnostic_signs.Error, + warn = diagnostic_signs.Warn, + hint = diagnostic_signs.Hint, + info = diagnostic_signs.Info + }) + + require('mason').setup({}) + require('mason-lspconfig').setup({ + ensure_installed = { + "bashls", + "tsserver", + "pyright", + "lua_ls", + "jsonls", + "clangd", + }, + automatic_installation = true, + handlers = { + lsp_zero.default_setup, + lua_ls = function() + local lua_opts = lsp_zero.nvim_lua_ls() + require('lspconfig').lua_ls.setup(lua_opts) + end, + pyright = function() + require('lspconfig').pyright.setup({}) + end, + } + }) + + local cmp = require('cmp') + local cmp_select = {behavior = cmp.SelectBehavior.Select} + require("luasnip/loaders/from_vscode").lazy_load() + -- require("luasnip/loaders/from_vscode").load() + + cmp.setup({ + snippet = { + expand = function(args) + luasnip.lsp_expand(args.body) + end, + }, + preselect = 'item', + completion = { + completeopt = 'menu,menuone,noinsert' + }, + sources = { + {name = 'luasnip'}, + {name = 'path'}, + {name = 'nvim_lsp'}, + {name = 'nvim_lua'}, + {name = 'buffer'}, + }, + formatting = lsp_zero.cmp_format(), + mapping = cmp.mapping.preset.insert({ + -- [''] = cmp.mapping.select_prev_item(cmp_select), + [''] = cmp.mapping.select_next_item(cmp_select), + [''] = cmp.mapping.select_next_item(cmp_select), + [''] = cmp.mapping.confirm({ select = true }), + [''] = cmp.mapping.complete(), + }), + }) +end + +return { + "VonHeikemen/lsp-zero.nvim", + branch = 'v3.x', + config = config, + lazy = false, + dependencies = { + "williamboman/mason.nvim", + "williamboman/mason-lspconfig.nvim", + "neovim/nvim-lspconfig", + "hrsh7th/nvim-cmp", + "hrsh7th/cmp-nvim-lsp", + "hrsh7th/cmp-buffer", + "hrsh7th/cmp-path", + "saadparwaiz1/cmp_luasnip", + {"L3MON4D3/LuaSnip", version = "v2.*", build = "make install_jsregexp", dependencies={"rafamadriz/friendly-snippets"}}, + } +} diff --git a/linux/.config/nvim/lua/plugins/lualine-nvim.lua b/linux/.config/nvim/lua/plugins/lualine-nvim.lua new file mode 100644 index 0000000..95bf236 --- /dev/null +++ b/linux/.config/nvim/lua/plugins/lualine-nvim.lua @@ -0,0 +1,69 @@ +local config = { + options = { + icons_enabled = true, + theme = "auto", + globalstatus = true, + disabled_filetypes = { + statusline = {}, + winbar = {}, + }, + ignore_focus = {}, + component_separators = { left = "|", right = "|" }, + section_separators = { left = "", right = "" }, + refresh = { + statusline = 1000, + tabline = 1000, + winbar = 1000, + } + }, + sections = { + lualine_a = { "mode" }, + lualine_b = { "buffers" }, + lualine_x = { "diagnostics", "encoding", "fileformat", "filetype" }, + lualine_y = { "progress" }, + lualine_z = { "location" }, + lualine_c = {}, + }, + tabline = {}, + winbar = {}, + inactive_winbar = {}, + extensions = {} +} + +local function ins_left(component) + table.insert(config.sections.lualine_c, component) +end + +local function ins_right(component) + table.insert(config.sections.lualine_x, 1, component) +end + +ins_right { + -- Lsp server name . + function() + local msg = 'No Active Lsp' + local buf_ft = vim.api.nvim_buf_get_option(0, 'filetype') + local clients = vim.lsp.get_active_clients() + if next(clients) == nil then + return msg + end + for _, client in ipairs(clients) do + local filetypes = client.config.filetypes + if filetypes and vim.fn.index(filetypes, buf_ft) ~= -1 then + return client.name + end + end + return msg + end, + icon = ' LSP:', + color = { fg = '#ff6b6b' }, +} + +return { + "nvim-lualine/lualine.nvim", + lazy = false, + opts = config, + dependencies = { + "nvim-tree/nvim-web-devicons" + } +} diff --git a/linux/.config/nvim/lua/plugins/mason.lua b/linux/.config/nvim/lua/plugins/mason.lua new file mode 100644 index 0000000..789d28a --- /dev/null +++ b/linux/.config/nvim/lua/plugins/mason.lua @@ -0,0 +1,14 @@ +return { + "williamboman/mason.nvim", + cmd = "Mason", + event = "BufReadPre", + opts = { + ui = { + icons = { + package_installed = "✓", + package_pending = "➜", + package_uninstalled = "✗", + }, + }, + }, +} diff --git a/linux/.config/nvim/lua/plugins/nvim-autopairs.lua b/linux/.config/nvim/lua/plugins/nvim-autopairs.lua new file mode 100644 index 0000000..2355082 --- /dev/null +++ b/linux/.config/nvim/lua/plugins/nvim-autopairs.lua @@ -0,0 +1,5 @@ +return { + "windwp/nvim-autopairs", + event = "InsertEnter", + opts = {}, -- this is equalent to setup({}) function +} diff --git a/linux/.config/nvim/lua/plugins/nvim-tree.lua b/linux/.config/nvim/lua/plugins/nvim-tree.lua new file mode 100644 index 0000000..23317eb --- /dev/null +++ b/linux/.config/nvim/lua/plugins/nvim-tree.lua @@ -0,0 +1,9 @@ +return { + "nvim-tree/nvim-tree.lua", + lazy = false, + opts = { + filters = { + dotfiles = false, + } + } +} diff --git a/linux/.config/nvim/lua/plugins/nvim-treesitter.lua b/linux/.config/nvim/lua/plugins/nvim-treesitter.lua new file mode 100644 index 0000000..35d15af --- /dev/null +++ b/linux/.config/nvim/lua/plugins/nvim-treesitter.lua @@ -0,0 +1,52 @@ +local config = function() + require("nvim-treesitter.configs").setup({ + build = ":TSUpdate", + indent = { + enable = true, + }, + autotag = { + enable = true, + }, + event = { + "BufReadPre", + "BufNewFile", + }, + ensure_installed = { + "markdown", + "json", + "javascript", + "typescript", + "yaml", + "html", + "css", + "markdown", + "bash", + "lua", + "dockerfile", + "solidity", + "gitignore", + "python", + "vue", + }, + auto_install = true, + highlight = { + enable = true, + additional_vim_regex_highlighting = true, + }, + incremental_selection = { + enable = true, + keymaps = { + init_selection = "", + node_incremental = "", + scope_incremental = false, + node_decremental = "", + }, + }, + }) +end + +return { + "nvim-treesitter/nvim-treesitter", + lazy = false, + opts = config, +} diff --git a/linux/.config/nvim/lua/plugins/nvim-ts-autotag.lua b/linux/.config/nvim/lua/plugins/nvim-ts-autotag.lua new file mode 100644 index 0000000..e3840e0 --- /dev/null +++ b/linux/.config/nvim/lua/plugins/nvim-ts-autotag.lua @@ -0,0 +1,4 @@ +return { + "windwp/nvim-ts-autotag", + lazy = false, +} diff --git a/linux/.config/nvim/lua/plugins/nvim-web-devicons.lua b/linux/.config/nvim/lua/plugins/nvim-web-devicons.lua new file mode 100644 index 0000000..537b4f5 --- /dev/null +++ b/linux/.config/nvim/lua/plugins/nvim-web-devicons.lua @@ -0,0 +1,3 @@ +return { + 'nvim-tree/nvim-web-devicons' +} diff --git a/linux/.config/nvim/lua/plugins/telescope.lua b/linux/.config/nvim/lua/plugins/telescope.lua new file mode 100644 index 0000000..9a59399 --- /dev/null +++ b/linux/.config/nvim/lua/plugins/telescope.lua @@ -0,0 +1,45 @@ +local mapvimkey = require("utils.keymapper").mapvimkey + +local config = function() + local telescope = require("telescope") + telescope.setup({ + defaults = { + mappings = { + i = { + [""] = "move_selection_next", + [""] = "move_selection_previous", + }, + }, + }, + pickers = { + find_files = { + theme = "dropdown", + previewer = true, + hidden = true, + }, + live_grep = { + theme = "dropdown", + previewer = true, + }, + buffers = { + theme = "dropdown", + previewer = true, + }, + }, + }) +end + +return { + "nvim-telescope/telescope.nvim", + tag = "0.1.3", + lazy = false, + dependencies = { "nvim-lua/plenary.nvim" }, + config = config, + keys = { + mapvimkey("fk", "Telescope keymaps", "Show Keymaps"), + mapvimkey("fh", "Telescope help_tags", "Show Help Tags"), + mapvimkey("ff", "Telescope find_files", "Find Files"), + mapvimkey("fg", "Telescope live_grep", "Live Grep"), + mapvimkey("fb", "Telescope buffers", "Find Buffers"), + }, +} diff --git a/linux/.config/nvim/lua/plugins/tmux-navigator.lua b/linux/.config/nvim/lua/plugins/tmux-navigator.lua new file mode 100644 index 0000000..6efe1fe --- /dev/null +++ b/linux/.config/nvim/lua/plugins/tmux-navigator.lua @@ -0,0 +1,4 @@ +return { + "christoomey/vim-tmux-navigator", + lazy = false, +} diff --git a/linux/.config/nvim/lua/plugins/tokyonight.lua b/linux/.config/nvim/lua/plugins/tokyonight.lua new file mode 100644 index 0000000..e5b265f --- /dev/null +++ b/linux/.config/nvim/lua/plugins/tokyonight.lua @@ -0,0 +1,9 @@ +return { + "folke/tokyonight.nvim", + lazy = false, + priority = 1000, + opts = {}, + config = function() + vim.cmd('colorscheme tokyonight-storm') + end +} diff --git a/linux/.config/nvim/lua/plugins/trouble-nvim.lua b/linux/.config/nvim/lua/plugins/trouble-nvim.lua new file mode 100644 index 0000000..296f6cc --- /dev/null +++ b/linux/.config/nvim/lua/plugins/trouble-nvim.lua @@ -0,0 +1,82 @@ +local diagnostic_signs = require("utils.icons").diagnostic_signs +local maplazykey = require("utils.keymapper").maplazykey + +return { + "folke/trouble.nvim", + dependencies = { "nvim-tree/nvim-web-devicons" }, + opts = { + position = "bottom", -- position of the list can be: bottom, top, left, right + height = 10, -- height of the trouble list when position is top or bottom + width = 50, -- width of the list when position is left or right + icons = true, -- use devicons for filenames + mode = "workspace_diagnostics", -- "workspace_diagnostics", "document_diagnostics", "quickfix", "lsp_references", "loclist" + severity = nil, -- nil (ALL) or vim.diagnostic.severity.ERROR | WARN | INFO | HINT + fold_open = "", -- icon used for open folds + fold_closed = "", -- icon used for closed folds + group = true, -- group results by file + padding = true, -- add an extra new line on top of the list + cycle_results = true, -- cycle item list when reaching beginning or end of list + action_keys = { -- key mappings for actions in the trouble list + -- map to {} to remove a mapping, for example: + -- close = {}, + close = "q", -- close the list + cancel = "", -- cancel the preview and get back to your last window / buffer / cursor + refresh = "r", -- manually refresh + jump = { "", "", "<2-leftmouse>" }, -- jump to the diagnostic or open / close folds + open_split = { "" }, -- open buffer in new split + open_vsplit = { "" }, -- open buffer in new vsplit + open_tab = { "" }, -- open buffer in new tab + jump_close = {"o"}, -- jump to the diagnostic and close the list + toggle_mode = "m", -- toggle between "workspace" and "document" diagnostics mode + switch_severity = "s", -- switch "diagnostics" severity filter level to HINT / INFO / WARN / ERROR + toggle_preview = "P", -- toggle auto_preview + hover = "K", -- opens a small popup with the full multiline message + preview = "p", -- preview the diagnostic location + open_code_href = "c", -- if present, open a URI with more information about the diagnostic error + close_folds = {"zM", "zm"}, -- close all folds + open_folds = {"zR", "zr"}, -- open all folds + toggle_fold = {"zA", "za"}, -- toggle fold of current file + previous = "k", -- previous item + next = "j", -- next item + help = "?" -- help menu + }, + multiline = true, -- render multi-line messages + indent_lines = true, -- add an indent guide below the fold icons + win_config = { border = "single" }, -- window configuration for floating windows. See |nvim_open_win()|. + auto_open = false, -- automatically open the list when you have diagnostics + auto_close = false, -- automatically close the list when you have no diagnostics + auto_preview = true, -- automatically preview the location of the diagnostic. to close preview and go back to last window + auto_fold = false, -- automatically fold a file trouble list at creation + auto_jump = {"lsp_definitions"}, -- for the given modes, automatically jump if there is only a single result + include_declaration = { "lsp_references", "lsp_implementations", "lsp_definitions" }, -- for the given modes, include the declaration of the current symbol in the results + signs = { + -- icons / text used for a diagnostic + error = diagnostic_signs.Error, + warning = diagnostic_signs.Warn, + hint = diagnostic_signs.Hint, + information = diagnostic_signs.Info, + other = diagnostic_signs.Info, + }, + use_diagnostic_signs = false -- enabling this will use the signs defined in your lsp client + }, + keys = { + maplazykey("xx", function() + require("trouble").toggle() + end, "Toggle Trouble"), + maplazykey("xw", function() + require("trouble").toggle("workspace_diagnostics") + end, "Show Workspace Diagnostics"), + maplazykey("xd", function() + require("trouble").toggle("document_diagnostics") + end, "Show Document Diagnostics"), + maplazykey("xq", function() + require("trouble").toggle("quickfix") + end, "Toggle Quickfix List"), + maplazykey("xl", function() + require("trouble").toggle("loclist") + end, "Toggle Location List"), + maplazykey("gR", function() + require("trouble").toggle("lsp_references") + end, "Toggle LSP References"), + }, +} diff --git a/linux/.config/nvim/lua/plugins/vim-illuminate.lua b/linux/.config/nvim/lua/plugins/vim-illuminate.lua new file mode 100644 index 0000000..d91323f --- /dev/null +++ b/linux/.config/nvim/lua/plugins/vim-illuminate.lua @@ -0,0 +1,7 @@ +return { + "RRethy/vim-illuminate", + lazy = false, + config = function() + require("illuminate").configure({}) + end, +} diff --git a/linux/.config/nvim/lua/utils/icons.lua b/linux/.config/nvim/lua/utils/icons.lua new file mode 100644 index 0000000..e45c2f6 --- /dev/null +++ b/linux/.config/nvim/lua/utils/icons.lua @@ -0,0 +1,18 @@ +local M = {} + +M.debugging_signs = { + Stopped = { "󰁕 ", "DiagnosticWarn", "DapStoppedLine" }, + Breakpoint = " ", + BreakpointCondition = " ", + BreakpointRejected = { " ", "DiagnosticError" }, + LogPoint = ".>", +} + +M.diagnostic_signs = { + Error = " ", + Warn = " ", + Hint = " ", + Info = " ", +} + +return M diff --git a/linux/.config/nvim/lua/utils/init.lua b/linux/.config/nvim/lua/utils/init.lua new file mode 100644 index 0000000..0e9ac58 --- /dev/null +++ b/linux/.config/nvim/lua/utils/init.lua @@ -0,0 +1,26 @@ +local M = {} + +function M.tabline() + local s = '' + for i = 1, vim.fn.tabpagenr('$') do + local winnr = vim.fn.tabpagewinnr(i) + local buflist = vim.fn.tabpagebuflist(i) + local bufnr = buflist[winnr] + local bufname = vim.fn.bufname(bufnr) + local filename = vim.fn.fnamemodify(bufname, ':t') + local icon = require'nvim-web-devicons'.get_icon(filename) + + -- Отмечаем активный таб + if i == vim.fn.tabpagenr() then + s = s .. '%#TabLineSel#' + else + s = s .. '%#TabLine#' + end + + s = s .. ' ' .. (icon or '') .. ' ' .. filename .. ' ' + end + s = s .. '%#TabLineFill#%=' + return s +end + +return M diff --git a/linux/.config/nvim/lua/utils/keymapper.lua b/linux/.config/nvim/lua/utils/keymapper.lua new file mode 100644 index 0000000..1a4277a --- /dev/null +++ b/linux/.config/nvim/lua/utils/keymapper.lua @@ -0,0 +1,69 @@ +local vim_modes = { + n = "n", + i = "i", + v = "v", +} + +local default_opts = { + noremap = true, + silent = true, +} + +--- @param opts (table|nil) +--- @return table +local get_opts = function(opts) + local all_opts = opts + if all_opts == nil then + all_opts = {} + end + for k, v in pairs(default_opts) do + all_opts[k] = all_opts[k] or v + end + return all_opts +end + +--- @param vimmode (string|nil) +--- @return string +local get_mode = function(vimmode) + local modeString = vim_modes[vimmode] + if modeString == nil then + return "n" + else + return modeString + end +end + +--- @param command (string) +--- @return string +local get_cmd_string = function(command) + return [[]] .. command .. [[]] +end + +--- @param keymaps string +--- @param command string +--- @param vimmode (string|nil) +--- @param options (table|nil) +--- @return nil +local mapvimkey = function(keymaps, command, vimmode, options) + local mode = get_mode(vimmode) + local lhs = keymaps + local rhs = get_cmd_string(command) + local opts = get_opts(options) + vim.keymap.set(mode, lhs, rhs, opts) +end + +--- @param keymaps string +--- @param cmd (function|string) +--- @param desc (string|nil) +--- @return table +local maplazykey = function(keymaps, cmd, desc) + if type(cmd) ~= "function" then + cmd = get_cmd_string(cmd) + end + return { keymaps, cmd, desc = desc } +end + +return { + mapvimkey = mapvimkey, + maplazykey = maplazykey, +} diff --git a/linux/.tmux.conf b/linux/.tmux.conf index ee95fd9..ee8360d 100755 --- a/linux/.tmux.conf +++ b/linux/.tmux.conf @@ -9,7 +9,8 @@ set -g mode-keys vi bind-key -T copy-mode-vi v send-keys -X begin-selection bind-key -T copy-mode-vi y send-keys -X copy-pipe "pbcopy" -set -g default-terminal "xterm-256color" +set -g default-terminal "tmux-256color" +set-option -sa terminal-features ',alacritty:RGB' # reset gpg-agent password cache after close the pane (vimwiki diary) set-hook -g window-unlinked 'run-shell "gpgconf --reload gpg-agent"' diff --git a/linux/.zshrc b/linux/.zshrc index a36f760..b0c55c3 100644 --- a/linux/.zshrc +++ b/linux/.zshrc @@ -100,6 +100,9 @@ export PATH=$PATH:$HOME/.config/emacs/bin ## golang export GOPATH=$HOME/go # don't forget to change your path correctly! export PATH=$PATH:$GOPATH/bin +export PATH=$PATH:/usr/local/go/bin +## color +export TERM=tmux-256color [ -f ~/.fzf.zsh ] && source ~/.fzf.zsh export VOLTA_HOME="$HOME/.volta"