diff --git a/nvim/.config/nvim/init.lua b/nvim/.config/nvim/init.lua index 84ff950..61b1e25 100644 --- a/nvim/.config/nvim/init.lua +++ b/nvim/.config/nvim/init.lua @@ -1,6 +1,19 @@ -require('pluginsLazy') require('options') +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) +require("lazy").setup("plugins") require('keymapping') + require('colorscheme') --------------------- diff --git a/nvim/.config/nvim/lazy-lock.json b/nvim/.config/nvim/lazy-lock.json new file mode 100644 index 0000000..9fc7341 --- /dev/null +++ b/nvim/.config/nvim/lazy-lock.json @@ -0,0 +1,46 @@ +{ + "LuaSnip": { "branch": "master", "commit": "ea7d7ea510c641c4f15042becd27f35b3e5b3c2b" }, + "bufferline.nvim": { "branch": "main", "commit": "9961d87bb3ec008213c46ba14b3f384a5f520eb5" }, + "cmp-buffer": { "branch": "main", "commit": "3022dbc9166796b644a841a02de8dd1cc1d311fa" }, + "cmp-calc": { "branch": "main", "commit": "ce91d14d2e7a8b3f6ad86d85e34d41c1ae6268d9" }, + "cmp-cmdline": { "branch": "main", "commit": "8ee981b4a91f536f52add291594e89fb6645e451" }, + "cmp-git": { "branch": "main", "commit": "169202582f900b0e189eed5153b291383bfbba47" }, + "cmp-nvim-lsp": { "branch": "main", "commit": "44b16d11215dce86f253ce0c30949813c0a90765" }, + "cmp-nvim-lua": { "branch": "main", "commit": "f12408bdb54c39c23e67cab726264c10db33ada8" }, + "cmp-path": { "branch": "main", "commit": "91ff86cd9c29299a64f968ebb45846c485725f23" }, + "cmp_luasnip": { "branch": "master", "commit": "18095520391186d634a0045dacaa346291096566" }, + "dressing.nvim": { "branch": "master", "commit": "c1e1d5fa44fe08811b6ef4aadac2b50e602f9504" }, + "fidget.nvim": { "branch": "main", "commit": "0ba1e16d07627532b6cae915cc992ecac249fb97" }, + "friendly-snippets": { "branch": "main", "commit": "ebf6d6e83494cdd88a54a429340256f4dbb6a052" }, + "gitsigns.nvim": { "branch": "main", "commit": "907ae8636016aab2f283576fc60d46ca3427e579" }, + "gruvbox.nvim": { "branch": "main", "commit": "7fb36e0f67aa6f3d7f3e54f37ca7032ea1af0b59" }, + "indent-blankline.nvim": { "branch": "master", "commit": "9637670896b68805430e2f72cf5d16be5b97a22a" }, + "lazy.nvim": { "branch": "main", "commit": "2a9354c7d2368d78cbd5575a51a2af5bd8a6ad01" }, + "lspkind-nvim": { "branch": "master", "commit": "57610d5ab560c073c465d6faf0c19f200cb67e6e" }, + "lualine.nvim": { "branch": "master", "commit": "45e27ca739c7be6c49e5496d14fcf45a303c3a63" }, + "markdown-preview.nvim": { "branch": "master", "commit": "02cc3874738bc0f86e4b91f09b8a0ac88aef8e96" }, + "mason-lspconfig.nvim": { "branch": "main", "commit": "01b4b6724ebcf5b43fc021486f6a260f1d09311e" }, + "mason.nvim": { "branch": "main", "commit": "d66c60e17dd6fd8165194b1d14d21f7eb2c1697a" }, + "mini.bufremove": { "branch": "main", "commit": "7821606e35c1ac931b56d8e3155f45ffe76ee7e5" }, + "neogit": { "branch": "master", "commit": "50b3e1d9c600deb4027af117cca660bee88223a4" }, + "nui.nvim": { "branch": "main", "commit": "c8de23342caf8d50b15d6b28368d36a56a69d76f" }, + "null-ls.nvim": { "branch": "main", "commit": "0010ea927ab7c09ef0ce9bf28c2b573fc302f5a7" }, + "nvim-autopairs": { "branch": "master", "commit": "defad64afbf19381fe31488a7582bbac421d6e38" }, + "nvim-cmp": { "branch": "main", "commit": "5dce1b778b85c717f6614e3f4da45e9f19f54435" }, + "nvim-lspconfig": { "branch": "master", "commit": "360a895125ac4f39df6aa8f763635eff07e69fff" }, + "nvim-navic": { "branch": "master", "commit": "9c89730da6a05acfeb6a197e212dfadf5aa60ca0" }, + "nvim-notify": { "branch": "master", "commit": "94859430020f5cf32a1b97ddd9e596fed9db7981" }, + "nvim-tree.lua": { "branch": "master", "commit": "94c7c810af205c0f00c8f105dcf490c8eb17658a" }, + "nvim-treesitter": { "branch": "master", "commit": "9ab4e9cc8989e3811b14897cd0eb21ae35e5541e" }, + "nvim-treesitter-endwise": { "branch": "master", "commit": "9298b3ac8fd6d0d8f9e321194c6d3fd37e417cf9" }, + "nvim-web-devicons": { "branch": "master", "commit": "925e2aa30dc9fe9332060199c19f132ec0f3d493" }, + "nvim-whichkey-setup.lua": { "branch": "main", "commit": "b2df0761b8ba3fca31b7ae1b0afcad2f8a4e89f4" }, + "plenary.nvim": { "branch": "master", "commit": "9ce85b0f7dcfe5358c0be937ad23e456907d410b" }, + "telescope-fzf-native.nvim": { "branch": "main", "commit": "6c921ca12321edaa773e324ef64ea301a1d0da62" }, + "telescope.nvim": { "branch": "master", "commit": "a19770625aed49ad2a9f591a5e3946707f7359f6" }, + "trouble.nvim": { "branch": "main", "commit": "3f85d8ed30e97ceeddbbcf80224245d347053711" }, + "vim-easyescape": { "branch": "master", "commit": "fd7875f1657fd54fae85088acf289b9723d8a790" }, + "vim-eunuch": { "branch": "master", "commit": "67f3dd32b4dcd1c427085f42ff5f29c7adc645c6" }, + "vim-illuminate": { "branch": "master", "commit": "8c910b2f84ae6acd9b4b17330bb94dd783c0c11a" }, + "which-key.nvim": { "branch": "main", "commit": "7ccf476ebe0445a741b64e36c78a682c1c6118b7" } +} \ No newline at end of file diff --git a/nvim/.config/nvim/lua/keymapping.lua b/nvim/.config/nvim/lua/keymapping.lua index 817000d..1a23c9c 100644 --- a/nvim/.config/nvim/lua/keymapping.lua +++ b/nvim/.config/nvim/lua/keymapping.lua @@ -4,8 +4,45 @@ local keymap = vim.keymap.set local opts = { silent = true } -vim.g.mapleader= ' ' + +local function map(mode, lhs, rhs, opts) + local keys = require("lazy.core.handler").handlers.keys + ---@cast keys LazyKeysHandler + -- do not create the keymap if a lazy keys handler exists + if not keys.active[keys.parse({ lhs, mode = mode }).id] then + opts = opts or {} + opts.silent = opts.silent ~= false + if opts.remap and not vim.g.vscode then + opts.remap = nil + end + vim.keymap.set(mode, lhs, rhs, opts) + end +end + +-- Move to window using the hjkl keys +map("n", "", "h", { desc = "Go to left window", remap = true }) +map("n", "", "j", { desc = "Go to lower window", remap = true }) +map("n", "", "k", { desc = "Go to upper window", remap = true }) +map("n", "", "l", { desc = "Go to right window", remap = true }) + +-- Resize window using arrow keys +map("n", "", "resize +2", { desc = "Increase window height" }) +map("n", "", "resize -2", { desc = "Decrease window height" }) +map("n", "", "vertical resize -2", { desc = "Decrease window width" }) +map("n", "", "vertical resize +2", { desc = "Increase window width" }) + +-- buffers +map("n", "", "BufferLineCyclePrev", { desc = "Prev buffer" }) +map("n", "", "BufferLineCycleNext", { desc = "Next buffer" }) +map("n", "[b", "BufferLineCyclePrev", { desc = "Prev buffer" }) +map("n", "]b", "BufferLineCycleNext", { desc = "Next buffer" }) + +map("n", "bb", "e #", { desc = "Switch to Other Buffer" }) +map("n", "`", "e #", { desc = "Switch to Other Buffer" }) + +-- Clear search with +map({ "i", "n" }, "", "noh", { desc = "Escape and clear hlsearch" }) -- Copy and paste with system clipboard keymap('v', '', '"+y', opts) @@ -17,19 +54,46 @@ keymap('i', 'kj','', opts) -- Normal -- -- -- Save and quit -keymap("n", "", ":write", opts) -keymap("n", "", ":quit", opts) +map({ "i", "x", "n", "s" }, "", "w", { desc = "Save file" }) +map("n", "qq", "qa", { desc = "Quit all" }) keymap('n', '',':NvimTreeToggle', opts) keymap('n', 'r',':NvimTreeRefresh', opts) keymap('n', 'n',':NvimTreeFindFile', opts) keymap("n", "e", ":NvimTreeToggle", opts) --- Navigate buffers -keymap("n", "", ":bnext", opts) -keymap("n", "", ":bprevious", opts) - +-- better indenting +map("v", "<", "", ">gv") +map("n", "xl", "lopen", { desc = "Location List" }) +map("n", "xq", "copen", { desc = "Quickfix List" }) +map("n", "[q", vim.cmd.cprev, { desc = "Previous quickfix" }) +map("n", "]q", vim.cmd.cnext, { desc = "Next quickfix" }) --keymap('n', '',':BufferLinePick', opts) --force sudo save keymap('c', 'w!!','w !sudo tee > /dev/null %', opts) +-- floating terminal +local lazyterm = function() Util.float_term(nil, { cwd = Util.get_root() }) end +map("n", "ft", lazyterm, { desc = "Terminal (root dir)" }) +map("n", "fT", function() Util.float_term() end, { desc = "Terminal (cwd)" }) +map("n", "", lazyterm, { desc = "Terminal (root dir)" }) +map("n", "", lazyterm, { desc = "which_key_ignore" }) + +-- Terminal Mappings +map("t", "", "", { desc = "Enter Normal Mode" }) +map("t", "", "wincmd h", { desc = "Go to left window" }) +map("t", "", "wincmd j", { desc = "Go to lower window" }) +map("t", "", "wincmd k", { desc = "Go to upper window" }) +map("t", "", "wincmd l", { desc = "Go to right window" }) +map("t", "", "close", { desc = "Hide Terminal" }) +map("t", "", "close", { desc = "which_key_ignore" }) + + +-- tabs +map("n", "l", "tablast", { desc = "Last Tab" }) +map("n", "f", "tabfirst", { desc = "First Tab" }) +map("n", "", "tabnew", { desc = "New Tab" }) +map("n", "]", "tabnext", { desc = "Next Tab" }) +map("n", "d", "tabclose", { desc = "Close Tab" }) +map("n", "[", "tabprevious", { desc = "Previous Tab" }) diff --git a/nvim/.config/nvim/lua/options.lua b/nvim/.config/nvim/lua/options.lua index 50eb3cc..37de422 100644 --- a/nvim/.config/nvim/lua/options.lua +++ b/nvim/.config/nvim/lua/options.lua @@ -1,3 +1,5 @@ +vim.g.mapleader = " " +vim.g.maplocalleader = "\\" ------------- -- Options -- -- ---------- @@ -23,8 +25,8 @@ vim.opt.undofile = true -- enable persistent undo vim.opt.updatetime = 100 -- faster completion (4000ms default) vim.opt.writebackup = false -- if a file is being edited by another program (or was written to file while editing with another program), it is not allowed to be edited vim.opt.expandtab = true -- convert tabs to spaces -vim.opt.shiftwidth = 4 -- the number of spaces inserted for each indentation -vim.opt.tabstop = 4 -- insert 2 spaces for a tab +vim.opt.shiftwidth = 2 -- the number of spaces inserted for each indentation +vim.opt.tabstop = 2 -- insert 2 spaces for a tab vim.opt.cursorline = true -- highlight the current line vim.opt.number = true -- set numbered lines vim.opt.relativenumber = true -- show relative line number diff --git a/nvim/.config/nvim/lua/plugins.lua b/nvim/.config/nvim/lua/plugins.lua deleted file mode 100644 index 79269fa..0000000 --- a/nvim/.config/nvim/lua/plugins.lua +++ /dev/null @@ -1,178 +0,0 @@ -------------- --- Plugins -- -------------- --- Autocommand that reloads neovim whenever you save the plugins.lua file -vim.cmd([[ - augroup packer_user_config - autocmd! - autocmd BufWritePost plugins.lua source | PackerCompile - augroup end -]]) - --- Auto install plugin manager - -local fn = vim.fn - -local ensure_packer = function() - local fn = vim.fn - local install_path = fn.stdpath('data') .. '/site/pack/packer/start/packer.nvim' - if fn.empty(fn.glob(install_path)) > 0 then - fn.system({ 'git', 'clone', '--depth', '1', 'https://github.com/wbthomason/packer.nvim', install_path }) - vim.cmd [[packadd packer.nvim]] - return true - end - return false -end - -local packer_bootstrap = ensure_packer() - - - -return require('packer').startup { - function(use) - use 'wbthomason/packer.nvim' - use 'lewis6991/impatient.nvim' - use 'nvim-lua/plenary.nvim' - use 'tpope/vim-eunuch' - --LSP - use({ "https://github.com/neovim/nvim-lspconfig" }) - use({ "https://github.com/williamboman/mason-lspconfig.nvim" }) - use({ "https://github.com/williamboman/mason.nvim", - config = function() - end - }) - use({ "https://github.com/jose-elias-alvarez/null-ls.nvim", - config = function() - require('plugins.lsp.null-ls') - end - }) - - use { - 'iamcco/markdown-preview.nvim', - run = function() - vim.fn['mkdp#util#install'](0) - end, - config = function() - end, - } - - - - -- telescope - use { - 'nvim-telescope/telescope.nvim', - } - use { - 'nvim-telescope/telescope-fzf-native.nvim', - run = 'make', - config = function() - require('plugins.telescope') - end - } - - - use { - 'zhou13/vim-easyescape', - config = function() - require('plugins.vim-easyescape') - end - } - - - - -- Autocomplete - use 'hrsh7th/cmp-nvim-lsp' - use 'hrsh7th/cmp-buffer' - use 'hrsh7th/cmp-cmdline' - use 'hrsh7th/cmp-path' - use 'hrsh7th/cmp-calc' - use 'hrsh7th/cmp-git' - use 'hrsh7th/cmp-nvim-lua' - use 'L3MON4D3/LuaSnip' - use 'rafamadriz/friendly-snippets' - use 'onsails/lspkind-nvim' - - - use({ - 'hrsh7th/nvim-cmp', - config = function() - require('plugins.cmp') - end - }) - - -- UI - use 'ellisonleao/gruvbox.nvim' - use { - "lukas-reineke/indent-blankline.nvim", - config = function() - require('plugins.indent-blankline') - - end - } - - use 'kyazdani42/nvim-web-devicons' - use { - 'akinsho/bufferline.nvim', - config = function() - require('plugins.bufferline') - end - } - use({ - "kyazdani42/nvim-tree.lua", - config = function() - require('plugins.nvim-tree') - end, - }) - - use 'AckslD/nvim-whichkey-setup.lua' - use({ - "folke/which-key.nvim", - config = function() - require('plugins.which-key') - end, - }) - use({ 'nvim-lualine/lualine.nvim', - config = function() - require('plugins.lualine') - end - }) - - --GIT - use { - 'lewis6991/gitsigns.nvim', - config = function() - require('plugins.gitsign') - end - } - use { - 'RRethy/vim-illuminate', - } - - use { - 'TimUntersberger/neogit', - config = function() - require('plugins.neogit') - end - } - use({ - 'windwp/nvim-autopairs', - config = function() - require('plugins.autopairs') - end - }) - - --treesitter - use 'RRethy/nvim-treesitter-endwise' - use({ - 'nvim-treesitter/nvim-treesitter', - config = function() - require('plugins.treesitter') - end - }) - - - if packer_bootstrap then - require('packer').sync() - end - end -} diff --git a/nvim/.config/nvim/lua/plugins/autopairs.lua b/nvim/.config/nvim/lua/plugins/autopairs.lua deleted file mode 100644 index b3f4b2a..0000000 --- a/nvim/.config/nvim/lua/plugins/autopairs.lua +++ /dev/null @@ -1,33 +0,0 @@ -local status_ok, autopairs = pcall(require, "nvim-autopairs") -if not status_ok then - return -end -autopairs.setup({ - check_ts = true, -- treesitter integration - disable_filetype = { "TelescopePrompt" }, - ts_config = { - lua = { "string", "source" }, - javascript = { "string", "template_string" }, - java = false, - }, - - fast_wrap = { - map = "", - chars = { "{", "[", "(", '"', "'" }, - pattern = string.gsub([[ [%'%"%)%>%]%)%}%,] ]], "%s+", ""), - offset = 0, -- Offset from pattern match - end_key = "$", - keys = "qwertyuiopzxcvbnmasdfghjkl", - check_comma = true, - highlight = "PmenuSel", - highlight_grey = "LineNr", - }, -}) - - -local cmp_autopairs = require("nvim-autopairs.completion.cmp") -local cmp_status_ok, cmp = pcall(require, "cmp") -if not cmp_status_ok then - return -end -cmp.event:on("confirm_done", cmp_autopairs.on_confirm_done({})) diff --git a/nvim/.config/nvim/lua/plugins/bufferline.lua b/nvim/.config/nvim/lua/plugins/bufferline.lua deleted file mode 100644 index b93e806..0000000 --- a/nvim/.config/nvim/lua/plugins/bufferline.lua +++ /dev/null @@ -1,23 +0,0 @@ - -local status_ok, bufferline = pcall(require, "bufferline") -if not status_ok then - return -end - - -bufferline.setup({ - options = { - close_command = "Bdelete! %d", -- can be a string | function, see "Mouse actions" - right_mouse_command = "Bdelete! %d", -- can be a string | function, see "Mouse actions" - offsets = { { filetype = "NvimTree", text = "", padding = 1 } }, - separator_style = "thin", -- | "thick" | "thin" | { 'any', 'any' }, - offsets = { - { - filetype = 'NvimTree', - text = 'File Explorer', - highlight = 'Directory', - text_align = 'left' - } - } - }, -}) diff --git a/nvim/.config/nvim/lua/plugins/cmp.lua b/nvim/.config/nvim/lua/plugins/cmp.lua index 5f1748c..6ae21d1 100644 --- a/nvim/.config/nvim/lua/plugins/cmp.lua +++ b/nvim/.config/nvim/lua/plugins/cmp.lua @@ -1,129 +1,151 @@ +return { + { + "https://github.com/hrsh7th/nvim-cmp", + event = "VeryLazy", + dependencies = { + "https://github.com/hrsh7th/cmp-buffer", + "https://github.com/hrsh7th/cmp-nvim-lsp", + "https://github.com/hrsh7th/cmp-path", + "https://github.com/saadparwaiz1/cmp_luasnip", + 'hrsh7th/cmp-cmdline', + 'hrsh7th/cmp-calc', + 'hrsh7th/cmp-git', + 'hrsh7th/cmp-nvim-lua', + 'rafamadriz/friendly-snippets', + 'onsails/lspkind-nvim', + "https://github.com/L3MON4D3/LuaSnip", -local cmp_status_ok, cmp = pcall(require, "cmp") -if not cmp_status_ok then - return -end + }, + config = function() -local snip_status_ok, luasnip = pcall(require, "luasnip") -if not snip_status_ok then - return -end -require("luasnip/loaders/from_vscode").lazy_load() - -local check_backspace = function() - local col = vim.fn.col(".") - 1 - return col == 0 or vim.fn.getline("."):sub(col, col):match("%s") -end -local kind_icons = { - Text = "", - Method = "", - Function = "", - Constructor = "", - Field = "", - Variable = "", - Class = "", - Interface = "", - Module = "", - Property = "", - Unit = "", - Value = "", - Enum = "", - Keyword = "", - Snippet = "", - Color = "", - File = "", - Reference = "", - Folder = "", - EnumMember = "", - Constant = "", - Struct = "", - Event = "", - Operator = "", - TypeParameter = "", + local cmp_status_ok, cmp = pcall(require, "cmp") + if not cmp_status_ok then + return + end + + local snip_status_ok, luasnip = pcall(require, "luasnip") + if not snip_status_ok then + return + end + require("luasnip/loaders/from_vscode").lazy_load() + + local check_backspace = function() + local col = vim.fn.col(".") - 1 + return col == 0 or vim.fn.getline("."):sub(col, col):match("%s") + end + local kind_icons = { + Text = "", + Method = "", + Function = "", + Constructor = "", + Field = "", + Variable = "", + Class = "", + Interface = "", + Module = "", + Property = "", + Unit = "", + Value = "", + Enum = "", + Keyword = "", + Snippet = "", + Color = "", + File = "", + Reference = "", + Folder = "", + EnumMember = "", + Constant = "", + Struct = "", + Event = "", + Operator = "", + TypeParameter = "", + } + + cmp.setup({ + snippet = { + expand = function(args) + luasnip.lsp_expand(args.body) -- For `luasnip` users. + end, + }, + + mapping = cmp.mapping.preset.insert({ + [""] = cmp.mapping.select_prev_item(), + [""] = cmp.mapping.select_next_item(), + [""] = cmp.mapping(cmp.mapping.scroll_docs(-1), { "i", "c" }), + [""] = cmp.mapping(cmp.mapping.scroll_docs(1), { "i", "c" }), + [""] = cmp.mapping(cmp.mapping.complete(), { "i", "c" }), + [""] = cmp.mapping({ + i = cmp.mapping.abort(), + c = cmp.mapping.close(), + }), + -- Accept currently selected item. If none selected, `select` first item. + -- Set `select` to `false` to only confirm explicitly selected items. + [""] = cmp.mapping.confirm({ select = false }), + [""] = cmp.mapping(function(fallback) + if cmp.visible() then + cmp.select_next_item() + elseif luasnip.expandable() then + luasnip.expand() + elseif luasnip.expand_or_jumpable() then + luasnip.expand_or_jump() + elseif check_backspace() then + fallback() + else + fallback() + end + end, { + "i", + "s", + }), + [""] = cmp.mapping(function(fallback) + if cmp.visible() then + cmp.select_prev_item() + elseif luasnip.jumpable(-1) then + luasnip.jump(-1) + else + fallback() + end + end, { + "i", + "s", + }), + }), + formatting = { + fields = { "kind", "abbr", "menu" }, + format = function(entry, vim_item) + vim_item.kind = kind_icons[vim_item.kind] + vim_item.menu = ({ + nvim_lsp = "", + nvim_lua = "", + luasnip = "", + buffer = "", + path = "", + emoji = "", + })[entry.source.name] + return vim_item + end, + }, + sources = { + { name = "nvim_lsp" }, + { name = "nvim_lua" }, + { name = "lua_snip" }, + { name = "buffer" }, + { name = "path" }, + { name = 'calc' }, + + }, + confirm_opts = { + behavior = cmp.ConfirmBehavior.Replace, + select = false, + }, + window = { + completion = cmp.config.window.bordered(), + documentation = cmp.config.window.bordered(), + }, + experimental = { + ghost_text = true, + }, + }) + end + }, } - -cmp.setup({ - snippet = { - expand = function(args) - luasnip.lsp_expand(args.body) -- For `luasnip` users. - end, - }, - - mapping = cmp.mapping.preset.insert({ - [""] = cmp.mapping.select_prev_item(), - [""] = cmp.mapping.select_next_item(), - [""] = cmp.mapping(cmp.mapping.scroll_docs(-1), { "i", "c" }), - [""] = cmp.mapping(cmp.mapping.scroll_docs(1), { "i", "c" }), - [""] = cmp.mapping(cmp.mapping.complete(), { "i", "c" }), - [""] = cmp.mapping({ - i = cmp.mapping.abort(), - c = cmp.mapping.close(), - }), - -- Accept currently selected item. If none selected, `select` first item. - -- Set `select` to `false` to only confirm explicitly selected items. - [""] = cmp.mapping.confirm({ select = false }), - [""] = cmp.mapping(function(fallback) - if cmp.visible() then - cmp.select_next_item() - elseif luasnip.expandable() then - luasnip.expand() - elseif luasnip.expand_or_jumpable() then - luasnip.expand_or_jump() - elseif check_backspace() then - fallback() - else - fallback() - end - end, { - "i", - "s", - }), - [""] = cmp.mapping(function(fallback) - if cmp.visible() then - cmp.select_prev_item() - elseif luasnip.jumpable(-1) then - luasnip.jump(-1) - else - fallback() - end - end, { - "i", - "s", - }), - }), - formatting = { - fields = { "kind", "abbr", "menu" }, - format = function(entry, vim_item) - vim_item.kind = kind_icons[vim_item.kind] - vim_item.menu = ({ - nvim_lsp = "", - nvim_lua = "", - luasnip = "", - buffer = "", - path = "", - emoji = "", - })[entry.source.name] - return vim_item - end, - }, - sources = { - { name = "nvim_lsp" }, - { name = "nvim_lua" }, - { name = "lua_snip" }, - { name = "buffer" }, - { name = "path" }, - { name = 'calc' }, - - }, - confirm_opts = { - behavior = cmp.ConfirmBehavior.Replace, - select = false, - }, - window = { - completion = cmp.config.window.bordered(), - documentation = cmp.config.window.bordered(), - }, - experimental = { - ghost_text = true, - }, -}) diff --git a/nvim/.config/nvim/lua/plugins/editor.lua b/nvim/.config/nvim/lua/plugins/editor.lua new file mode 100644 index 0000000..49de1b3 --- /dev/null +++ b/nvim/.config/nvim/lua/plugins/editor.lua @@ -0,0 +1,181 @@ +return { + { + 'tpope/vim-eunuch', + event= "VeryLazy" + }, + { + "https://github.com/iamcco/markdown-preview.nvim", + ft = "markdown", + build = "cd app && yarn install", + setup= function () + require("markdown-preview").setup({}) + vim.keymap.set("n", "mp", ":MarkdownPreviewToggle", { silent = true }) + end + }, + { + 'nvim-telescope/telescope.nvim', + lazy = true, + cmd = "Telescope", + keys= { + { ",", "Telescope buffers show_all_buffers=true", desc = "Switch Buffer" }, + { "/", "Telescope live_grep", desc = "Grep (root dir)" }, + { ":", "Telescope command_history", desc = "Command History" }, + -- find + { "fb", "Telescope buffers", desc = "Buffers" }, + { "ff", "Telescope find_files", desc = "Find Files (root dir)" }, + { "fF", function() builtin.find_files({ cwd = utils.buffer_dir() }) end, desc = "Find Files (cwd)" }, + { "fr", "Telescope oldfiles", desc = "Recent" }, + -- git + { "gc", "Telescope git_commits", desc = "commits" }, + { "gs", "Telescope git_status", desc = "status" }, + -- search + { 's"', "Telescope registers", desc = "Registers" }, + { "sa", "Telescope autocommands", desc = "Auto Commands" }, + { "sb", "Telescope current_buffer_fuzzy_find", desc = "Buffer" }, + { "sc", "Telescope command_history", desc = "Command History" }, + { "sC", "Telescope commands", desc = "Commands" }, + { "sd", "Telescope diagnostics bufnr=0", desc = "Document diagnostics" }, + { "sD", "Telescope diagnostics", desc = "Workspace diagnostics" }, + { "sh", "Telescope help_tags", desc = "Help Pages" }, + { "sH", "Telescope highlights", desc = "Search Highlight Groups" }, + { "sk", "Telescope keymaps", desc = "Key Maps" }, + { "sM", "Telescope man_pages", desc = "Man Pages" }, + { "sm", "Telescope marks", desc = "Jump to Mark" }, + { "so", "Telescope vim_options", desc = "Options" }, + { "sR", "Telescope resume", desc = "Resume" }, + }, + config = function() + local actions=require 'telescope.actions' + require 'telescope'.setup({ + mappings = { + i = { + [""] =actions.cycle_history_next, + [""] = actions.cycle_history_prev, + [""] = actions.cycle_history_next, + [""] = actions.cycle_history_prev, + [""] = actions.move_selection_next, + [""] = actions.move_selection_previous, + n = { + ["q"] = function(...) + return require("telescope.actions").close(...) + end, + }, + }, + }, + extensions = { + fzf = { + fuzzy = true, -- false will only do exact matching + override_generic_sorter = true, -- override the generic sorter + override_file_sorter = true, -- override the file sorter + case_mode = "smart_case", -- or "ignore_case" or "respect_case" + -- the default case_mode is "smart_case" + } + } + }) + end + + }, + { + 'nvim-telescope/telescope-fzf-native.nvim', + lazy = true, + build = 'make', + }, + { + 'zhou13/vim-easyescape', + config = function() + vim.g.easyescape_chars = { + j = 0, + k = 0 + } + vim.g.easyescape_timeout = 99 + end + }, + + { + "https://github.com/lukas-reineke/indent-blankline.nvim", + event = { "BufReadPost", "BufNewFile" }, + config = function() + require("indent_blankline").setup({ + show_current_context = true, + show_first_indent_level = false, + show_trailing_blankline_indent = false, + use_treesitter = true, + filetype_exclude = { + "help", + "alpha", + "dashboard", + "NvimTree", + "Trouble", + "lazy", + "mason", + "notify", + "toggleterm", + "lazyterm", + }, + }) + end, + }, + { + 'RRethy/vim-illuminate', + }, + { + "https://github.com/windwp/nvim-autopairs", + event = { "BufReadPost", "BufNewFile" }, + config = function() + require("nvim-autopairs").setup({ + check_ts = true, + fast_wrap = { + map = "", + chars = { "{", "[", "(", '"', "'" }, + pattern = string.gsub([[ [%'%"%)%>%]%)%}%,] ]], "%s+", ""), + offset = 0, -- Offset from pattern match + end_key = "$", + keys = "qwertyuiopzxcvbnmasdfghjkl", + check_comma = true, + highlight = "Search", + highlight_grey = "Comment", + }, + }) + end, + }, + { + "folke/trouble.nvim", + cmd = { "TroubleToggle", "Trouble" }, + opts = { use_diagnostic_signs = true }, + keys = { + { "xx", "TroubleToggle document_diagnostics", desc = "Document Diagnostics (Trouble)" }, + { "xX", "TroubleToggle workspace_diagnostics", desc = "Workspace Diagnostics (Trouble)" }, + { "xL", "TroubleToggle loclist", desc = "Location List (Trouble)" }, + { "xQ", "TroubleToggle quickfix", desc = "Quickfix List (Trouble)" }, + { + "[q", + function() + if require("trouble").is_open() then + require("trouble").previous({ skip_groups = true, jump = true }) + else + local ok, err = pcall(vim.cmd.cprev) + if not ok then + vim.notify(err, vim.log.levels.ERROR) + end + end + end, + desc = "Previous trouble/quickfix item", + }, + { + "]q", + function() + if require("trouble").is_open() then + require("trouble").next({ skip_groups = true, jump = true }) + else + local ok, err = pcall(vim.cmd.cnext) + if not ok then + vim.notify(err, vim.log.levels.ERROR) + end + end + end, + desc = "Next trouble/quickfix item", + }, + }, + }, +} + diff --git a/nvim/.config/nvim/lua/plugins/git.lua b/nvim/.config/nvim/lua/plugins/git.lua new file mode 100644 index 0000000..44e7f90 --- /dev/null +++ b/nvim/.config/nvim/lua/plugins/git.lua @@ -0,0 +1,35 @@ +return { + { + "https://github.com/lewis6991/gitsigns.nvim", + event = "VeryLazy", + config = function() + require("gitsigns").setup({ + current_line_blame = true, + }) + end, + }, + { + "https://github.com/NeogitOrg/neogit", + keys = { + { + 'gs', + function() + return require('neogit').open() + end, + desc = 'Open neogit', + }, + }, + + cmd = "Neogit", + config = function() + require("neogit").setup({ + disable_commit_confirmation = true, + kind = "split", + integrations = { + diffview = true, + }, + }) + end, + }, + +} diff --git a/nvim/.config/nvim/lua/plugins/gitsign.lua b/nvim/.config/nvim/lua/plugins/gitsign.lua deleted file mode 100644 index 21a5010..0000000 --- a/nvim/.config/nvim/lua/plugins/gitsign.lua +++ /dev/null @@ -1,7 +0,0 @@ -local status_ok, gitsigns = pcall(require, "gitsigns") -if not status_ok then - return -end -gitsigns.setup({ - -}) diff --git a/nvim/.config/nvim/lua/plugins/indent-blankline.lua b/nvim/.config/nvim/lua/plugins/indent-blankline.lua deleted file mode 100644 index 0a29935..0000000 --- a/nvim/.config/nvim/lua/plugins/indent-blankline.lua +++ /dev/null @@ -1,12 +0,0 @@ -local status_ok, indent_blankline = pcall(require, "indent_blankline") -if not status_ok then - return -end - -indent_blankline.setup { - char = "▏", - show_first_indent_level = false, - show_trailing_blankline_indent = false, - use_treesitter = true, - show_current_context = true, -} diff --git a/nvim/.config/nvim/lua/plugins/lsp/handlers.lua b/nvim/.config/nvim/lua/plugins/lsp/handlers.lua index 458fd9d..d919afb 100644 --- a/nvim/.config/nvim/lua/plugins/lsp/handlers.lua +++ b/nvim/.config/nvim/lua/plugins/lsp/handlers.lua @@ -8,7 +8,7 @@ end M.capabilities = vim.lsp.protocol.make_client_capabilities() M.capabilities.textDocument.completion.completionItem.snippetSupport = true M.capabilities = cmp_nvim_lsp.default_capabilities(M.capabilities) - +local navic = require("nvim-navic") M.setup = function() local signs = { @@ -64,9 +64,6 @@ local function lsp_keymaps(bufnr) keymap(bufnr, "n", "li", "LspInfo", opts) keymap(bufnr, "n", "lI", "LspInstallInfo", opts) - keymap(bufnr, "n", "la", "lua vim.lsp.buf.code_action()", opts) - keymap(bufnr, "n", "lj", "lua vim.diagnostic.goto_next({buffer=0})", opts) - keymap(bufnr, "n", "lk", "lua vim.diagnostic.goto_prev({buffer=0})", opts) keymap(bufnr, "n", "lr", "lua vim.lsp.buf.rename()", opts) keymap(bufnr, "n", "ls", "lua vim.lsp.buf.signature_help()", opts) keymap(bufnr, "n", "lq", "lua vim.diagnostic.setloclist()", opts) @@ -76,7 +73,9 @@ M.on_attach = function(client, bufnr) if client.name == "tsserver" then client.server_capabilities.document_formatting = false end - + if client.server_capabilities.documentSymbolProvider then + navic.attach(client, bufnr) + end lsp_keymaps(bufnr) local status_ok, illuminate = pcall(require, "illuminate") diff --git a/nvim/.config/nvim/lua/plugins/lsp/init.lua b/nvim/.config/nvim/lua/plugins/lsp/init.lua new file mode 100644 index 0000000..f2aabd0 --- /dev/null +++ b/nvim/.config/nvim/lua/plugins/lsp/init.lua @@ -0,0 +1,96 @@ +return { + { + "https://github.com/williamboman/mason-lspconfig.nvim", + event = { "BufReadPost", "BufNewFile" }, + dependencies = { + "https://github.com/williamboman/mason.nvim", + "https://github.com/neovim/nvim-lspconfig", + }, + config = function() + require("plugins.lsp.handlers").setup() + local servers = { + "ansiblels", + "bashls", + "cssls", + "dockerls", + "gopls", + "html", + "jsonls", + "pyright", + "pylsp", + "rnix", + "lua_ls", + "marksman", + "sqlls", + "terraformls", + "tflint", + "tsserver", + "yamlls", + } + local settings = { + ui = { + border = "none", + icons = { + package_installed = "◍", + package_pending = "◍", + package_uninstalled = "◍", + }, + }, + log_level = vim.log.levels.INFO, + max_concurrent_installers = 4, + } + require("mason").setup(settings) + require("mason-lspconfig").setup({ + ensure_installed = servers, + automatic_installation = true, + }) + + + local lspconfig_status_ok, lspconfig = pcall(require, "lspconfig") + if not lspconfig_status_ok then + return + end + + + for _, server in pairs(servers) do + opts = { + on_attach = require("plugins.lsp.handlers").on_attach, + capabilities = require("plugins.lsp.handlers").capabilities, + } + + server = vim.split(server, "@")[1] + + local require_ok, conf_opts = pcall(require, "plugins.lsp.settings." .. server) + if require_ok then + opts = vim.tbl_deep_extend("force", conf_opts, opts) + end + + lspconfig[server].setup(opts) + end + end + }, + { + "https://github.com/jose-elias-alvarez/null-ls.nvim", + lazy = true, + event = { "BufReadPre", "BufNewFile" }, + config = function() + + null_ls=require"null-ls" + require "null-ls".setup({ + debug = false, + sources = { + null_ls.builtins.formatting.prettier.with({ + extra_filetypes = { "toml" }, + extra_args = { "--no-semi", "--single-quote", "--jsx-single-quote" }, + }), + null_ls.builtins.formatting.black.with({ extra_args = { "--fast" } }), + null_ls.builtins.formatting.stylua, + null_ls.builtins.formatting.google_java_format, + null_ls.builtins.diagnostics.flake8, + null_ls.builtins.diagnostics.eslint, + null_ls.builtins.diagnostics.markdownlint, + }, + }) + end + }, +} diff --git a/nvim/.config/nvim/lua/plugins/lsp/mason.lua b/nvim/.config/nvim/lua/plugins/lsp/mason.lua deleted file mode 100644 index e36de24..0000000 --- a/nvim/.config/nvim/lua/plugins/lsp/mason.lua +++ /dev/null @@ -1,60 +0,0 @@ -require("plugins.lsp.handlers").setup() -local servers = { - "ansiblels", - "bashls", - "cssls", - "dockerls", - "gopls", - "html", - "jsonls", - "pyright", - "pylsp", - "rnix", - "lua_ls", - "marksman", - "sqlls", - "terraformls", - "tflint", - "tsserver", - "yamlls", -} -local settings = { - ui = { - border = "none", - icons = { - package_installed = "◍", - package_pending = "◍", - package_uninstalled = "◍", - }, - }, - log_level = vim.log.levels.INFO, - max_concurrent_installers = 4, -} -require("mason").setup(settings) -require("mason-lspconfig").setup({ - ensure_installed = servers, - automatic_installation = true, -}) - - -local lspconfig_status_ok, lspconfig = pcall(require, "lspconfig") -if not lspconfig_status_ok then - return -end - - -for _, server in pairs(servers) do - opts = { - on_attach = require("plugins.lsp.handlers").on_attach, - capabilities = require("plugins.lsp.handlers").capabilities, - } - - server = vim.split(server, "@")[1] - - local require_ok, conf_opts = pcall(require, "plugins.lsp.settings." .. server) - if require_ok then - opts = vim.tbl_deep_extend("force", conf_opts, opts) - end - - lspconfig[server].setup(opts) -end diff --git a/nvim/.config/nvim/lua/plugins/lsp/null-ls.lua b/nvim/.config/nvim/lua/plugins/lsp/null-ls.lua deleted file mode 100644 index c182e15..0000000 --- a/nvim/.config/nvim/lua/plugins/lsp/null-ls.lua +++ /dev/null @@ -1,27 +0,0 @@ - -local null_ls_status_ok, null_ls = pcall(require, "null-ls") -if not null_ls_status_ok then - return -end - --- https://github.com/jose-elias-alvarez/null-ls.nvim/tree/main/lua/null-ls/builtins/formatting -local formatting = null_ls.builtins.formatting --- https://github.com/jose-elias-alvarez/null-ls.nvim/tree/main/lua/null-ls/builtins/diagnostics -local diagnostics = null_ls.builtins.diagnostics - --- https://github.com/prettier-solidity/prettier-plugin-solidity -null_ls.setup({ - debug = false, - sources = { - formatting.prettier.with({ - extra_filetypes = { "toml" }, - extra_args = { "--no-semi", "--single-quote", "--jsx-single-quote" }, - }), - formatting.black.with({ extra_args = { "--fast" } }), - formatting.stylua, - formatting.google_java_format, - diagnostics.flake8, - diagnostics.eslint, - diagnostics.markdownlint, - }, -}) diff --git a/nvim/.config/nvim/lua/plugins/lualine.lua b/nvim/.config/nvim/lua/plugins/lualine.lua deleted file mode 100644 index bad6125..0000000 --- a/nvim/.config/nvim/lua/plugins/lualine.lua +++ /dev/null @@ -1,13 +0,0 @@ -local status_ok, lualine = pcall(require, "lualine") -if not status_ok then - return -end - -lualine.setup({ - options = { - globalstatus=true, - theme = "gruvbox_dark", - } -}) - - diff --git a/nvim/.config/nvim/lua/plugins/markdown-preview.lua b/nvim/.config/nvim/lua/plugins/markdown-preview.lua deleted file mode 100644 index 9907439..0000000 --- a/nvim/.config/nvim/lua/plugins/markdown-preview.lua +++ /dev/null @@ -1 +0,0 @@ -vim.keymap.set("n", "mp", ":MarkdownPreviewToggle", { silent = true }) diff --git a/nvim/.config/nvim/lua/plugins/neogit.lua b/nvim/.config/nvim/lua/plugins/neogit.lua deleted file mode 100644 index 7aa1220..0000000 --- a/nvim/.config/nvim/lua/plugins/neogit.lua +++ /dev/null @@ -1,11 +0,0 @@ -local status_ok, neogit = pcall(require, "neogit") -if not status_ok then - return -end - -neogit.setup{ - disable_commit_confirmation = true, - disable_context_highlighting = true -} - -vim.keymap.set('n', 'gs', ':Neogit kind=split', {silent = true}) diff --git a/nvim/.config/nvim/lua/plugins/nvim-tree.lua b/nvim/.config/nvim/lua/plugins/nvim-tree.lua deleted file mode 100644 index e341c0a..0000000 --- a/nvim/.config/nvim/lua/plugins/nvim-tree.lua +++ /dev/null @@ -1,26 +0,0 @@ - -local status_ok, nvim_tree = pcall(require, "nvim-tree") -if not status_ok then - return -end - -nvim_tree.setup({ - update_focused_file = { - enable = true, - update_cwd = true, - }, - diagnostics = { - enable = true, - show_on_dirs = true, - icons = { - hint = "", - info = "", - warning = "", - error = "", - }, - }, - view = { - width = 30, - side = "left", - }, -}) diff --git a/nvim/.config/nvim/lua/plugins/telescope.lua b/nvim/.config/nvim/lua/plugins/telescope.lua deleted file mode 100644 index fd6684b..0000000 --- a/nvim/.config/nvim/lua/plugins/telescope.lua +++ /dev/null @@ -1,51 +0,0 @@ -local status_ok, telescope = pcall(require, "telescope") -if not status_ok then - return -end - -local actions = require("telescope.actions") -local utils = require("telescope.utils") -telescope.setup { - defaults = { - path_display = { "absolute" }, - file_ignore_patterns = { ".git/", "node_modules" }, - mappings = { - i = { - [""] = actions.cycle_history_next, - [""] = actions.cycle_history_prev, - [""] = actions.cycle_history_next, - [""] = actions.cycle_history_prev, - [""] = actions.move_selection_next, - [""] = actions.move_selection_previous, - }, - }, - }, - extensions = { - fzf = { - fuzzy = true, -- false will only do exact matching - override_generic_sorter = true, -- override the generic sorter - override_file_sorter = true, -- override the file sorter - case_mode = "smart_case", -- or "ignore_case" or "respect_case" - -- the default case_mode is "smart_case" - }, - }, - pickers = { - find_files = { - no_ignore = true, - no_ignore_parent = true, - }, - }, -} - -telescope.load_extension('fzf') -require'telescope.themes'.get_ivy() - -local keymap = vim.keymap.set -local opts = { silent = true } - -keymap("n", "", ":Telescope git_files", opts) -keymap("n", "ff", ":Telescope find_files", opts) -keymap("n", "fF", function () builtin.find_files({ cwd = utils.buffer_dir() }) end, opts) -keymap("n", "/", ":Telescope live_grep", opts) -keymap("n", "pp", ":Telescope projects", opts) -keymap("n", ",", ":Telescope buffers", opts) diff --git a/nvim/.config/nvim/lua/plugins/treesitter.lua b/nvim/.config/nvim/lua/plugins/treesitter.lua index 15fac4b..9e5028c 100644 --- a/nvim/.config/nvim/lua/plugins/treesitter.lua +++ b/nvim/.config/nvim/lua/plugins/treesitter.lua @@ -1,35 +1,49 @@ -local status_ok, treesitter = pcall(require, "nvim-treesitter") -if not status_ok then - return -end - -local status_ok, configs = pcall(require, "nvim-treesitter.configs") -if not status_ok then - return -end - -configs.setup({ - ensure_installed = { - all +return { + { 'RRethy/nvim-treesitter-endwise' }, - highlight = { - enable = true, - }, - autopairs = { - enable = true, - }, - indent = { - enable = true, + { + "https://github.com/nvim-treesitter/nvim-treesitter", + event = { "BufReadPost", "BufNewFile" }, + config = function() + require("nvim-treesitter.configs").setup({ + ensure_installed = { + "bash", + "c", + "dockerfile", + "gitcommit", + "go", + "hcl", + "javascript", + "json", + "json5", + "jsonnet", + "latex", + "lua", + "nix", + "markdown", + "proto", + "python", + "rego", + "rust", + "terraform", + "typescript", + "yaml", + }, + highlight = { + enable = true, + }, + autopairs = { + enable = true, + }, + indent = { + enable = true, + }, + endwise = { + enable = true, + }, + }) + vim.treesitter.language.register("nomad", "hcl") + end, }, - context_commentstring = { - enable = true, - enable_autocmd = false, - }, - - endwise = { - enable = true, - }, -}) - -vim.treesitter.language.register("nomad","hcl") +} diff --git a/nvim/.config/nvim/lua/plugins/ui.lua b/nvim/.config/nvim/lua/plugins/ui.lua new file mode 100644 index 0000000..d0b809e --- /dev/null +++ b/nvim/.config/nvim/lua/plugins/ui.lua @@ -0,0 +1,161 @@ +return { + { + 'ellisonleao/gruvbox.nvim', + event = "VeryLazy", + }, + { + "echasnovski/mini.bufremove", + -- stylua: ignore + keys = { + { "bd", function() require("mini.bufremove").delete(0, false) end, desc = "Delete Buffer" }, + { "bD", function() require("mini.bufremove").delete(0, true) end, desc = "Delete Buffer (Force)" }, + }, + }, + { + "https://github.com/akinsho/bufferline.nvim", + event = "VeryLazy", + config = function() + require("bufferline").setup({ + options = { + -- stylua: ignore + close_command = function(n) require("mini.bufremove").delete(n, false) end, + -- stylu a: ignore + right_mouse_command = function(n) require("mini.bufremove").delete(n, false) end, + always_show_bufferline = false, + offsets = { + { + filetype = "NvimTree", + text = "nvim-tree", + highlight = "Directory", + text_align = "left", + }, + }, + }, + }) + end, + }, + { + "kyazdani42/nvim-tree.lua", + event = "VeryLazy", + config = function() + require("nvim-tree").setup({ + update_focused_file = { + enable = true, + update_cwd = true, + }, + diagnostics = { + enable = true, + show_on_dirs = true, + icons = { + hint = "", + info = "", + warning = "", + error = "", + }, + }, + view = { + width = 30, + side = "left", + }, + }) + end + }, + { + "https://github.com/folke/which-key.nvim", + event = "VeryLazy", + opts = { + plugins = { spelling = true }, + defaults = { + mode = { "n", "v" }, + [""] = { name = "+tabs" }, + ["b"] = { name = "+buffer" }, + ["c"] = { name = "+code" }, + ["f"] = { name = "+file/find" }, + ["g"] = { name = "+git" }, + ["gh"] = { name = "+hunks" }, + ["q"] = { name = "+quit/session" }, + ["s"] = { name = "+search" }, + ["u"] = { name = "+ui" }, + ["w"] = { name = "+windows" }, + ["x"] = { name = "+diagnostics/quickfix" }, + }, + }, + config = function(_, opts) + local wk = require("which-key") + wk.setup(opts) + wk.register(opts.defaults) + end, + }, + { + "https://github.com/nvim-lualine/lualine.nvim", + event = "VeryLazy", + config = function() + require("lualine").setup({ + options = { + globalstatus = true, + }, + }) + end, + }, + { + "https://github.com/j-hui/fidget.nvim", + tag = "legacy", -- TODO https://github.com/j-hui/fidget.nvim/issues/131 + event = "VeryLazy", + config = function() + require("fidget").setup({ + text = { + spinner = "dots", + }, + }) + end, + }, + { + "rcarriga/nvim-notify", + keys = { + { + "un", + function() + require("notify").dismiss({ silent = true, pending = true }) + end, + desc = "Dismiss all Notifications", + }, + }, + opts = { + timeout = 3000, + max_height = function() + return math.floor(vim.o.lines * 0.75) + end, + max_width = function() + return math.floor(vim.o.columns * 0.75) + end, + }, + }, + { + "stevearc/dressing.nvim", + lazy = true, + init = function() + ---@diagnostic disable-next-line: duplicate-set-field + vim.ui.select = function(...) + require("lazy").load({ plugins = { "dressing.nvim" } }) + return vim.ui.select(...) + end + ---@diagnostic disable-next-line: duplicate-set-field + vim.ui.input = function(...) + require("lazy").load({ plugins = { "dressing.nvim" } }) + return vim.ui.input(...) + end + end, + }, + { + "SmiteshP/nvim-navic", + lazy = true, + opts = function() + return { + separator = " ", + highlight = true, + depth_limit = 5, + } + end, + }, + { "MunifTanjim/nui.nvim", lazy = true } +} diff --git a/nvim/.config/nvim/lua/plugins/util.lua b/nvim/.config/nvim/lua/plugins/util.lua new file mode 100644 index 0000000..2c47d64 --- /dev/null +++ b/nvim/.config/nvim/lua/plugins/util.lua @@ -0,0 +1,11 @@ +return { + { + "https://github.com/nvim-lua/plenary.nvim", + cmd = { "PlenaryBustedFile", "PlenaryBustedDirectory" }, + lazy = true, + }, + { + 'kyazdani42/nvim-web-devicons' + }, + +} diff --git a/nvim/.config/nvim/lua/plugins/vim-easyescape.lua b/nvim/.config/nvim/lua/plugins/vim-easyescape.lua deleted file mode 100644 index 97e94f7..0000000 --- a/nvim/.config/nvim/lua/plugins/vim-easyescape.lua +++ /dev/null @@ -1,5 +0,0 @@ -vim.g.easyescape_chars = { - j = 0, - k = 0 -} -vim.g.easyescape_timeout = 99 diff --git a/nvim/.config/nvim/lua/plugins/which-key.lua b/nvim/.config/nvim/lua/plugins/which-key.lua deleted file mode 100644 index 46b9b6d..0000000 --- a/nvim/.config/nvim/lua/plugins/which-key.lua +++ /dev/null @@ -1,2 +0,0 @@ -vim.api.nvim_set_option("timeoutlen", 300) -require("which-key").setup({}) diff --git a/nvim/.config/nvim/lua/pluginsLazy.lua b/nvim/.config/nvim/lua/pluginsLazy.lua deleted file mode 100644 index 1bcddda..0000000 --- a/nvim/.config/nvim/lua/pluginsLazy.lua +++ /dev/null @@ -1,306 +0,0 @@ -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) - -return require("lazy").setup({ - { - "https://github.com/nvim-lua/plenary.nvim", - cmd = { "PlenaryBustedFile", "PlenaryBustedDirectory" }, - lazy = true, - }, - { - 'tpope/vim-eunuch', - event= "VeryLazy" - }, - { - "https://github.com/williamboman/mason-lspconfig.nvim", - event = { "BufReadPost", "BufNewFile" }, - dependencies = { - "https://github.com/williamboman/mason.nvim", - "https://github.com/neovim/nvim-lspconfig", - }, - config = function() - require('plugins.lsp.mason') - - end - }, - { - "https://github.com/jose-elias-alvarez/null-ls.nvim", - lazy = true, - config = function() - require "null-ls".setup({ - debug = false, - sources = { - formatting.prettier.with({ - extra_filetypes = { "toml" }, - extra_args = { "--no-semi", "--single-quote", "--jsx-single-quote" }, - }), - formatting.black.with({ extra_args = { "--fast" } }), - formatting.stylua, - formatting.google_java_format, - diagnostics.flake8, - diagnostics.eslint, - diagnostics.markdownlint, - }, - }) - end - }, - { - "https://github.com/iamcco/markdown-preview.nvim", - ft = "markdown", - build = "cd app && yarn install", - setup= function () - require("markdown-preview").setup({}) - vim.keymap.set("n", "mp", ":MarkdownPreviewToggle", { silent = true }) - end - }, - { - 'nvim-telescope/telescope.nvim', - lazy = true, - cmd = "Telescope", - config = function() - require 'telescope'.setup({ - extensions = { - fzf = { - fuzzy = true, -- false will only do exact matching - override_generic_sorter = true, -- override the generic sorter - override_file_sorter = true, -- override the file sorter - case_mode = "smart_case", -- or "ignore_case" or "respect_case" - -- the default case_mode is "smart_case" - } - } - }) - local opts = { silent = true } - vim.keymap.set("n", "", ":Telescope git_files", opts) - vim.keymap.set("n", "ff", ":Telescope find_files", opts) - vim.keymap.set("n", "fF", function() builtin.find_files({ cwd = utils.buffer_dir() }) end, opts) - vim.keymap.set("n", "/", ":Telescope live_grep", opts) - vim.keymap.set("n", "pp", ":Telescope projects", opts) - vim.keymap.set("n", ",", ":Telescope buffers", opts) - end - - }, - { - 'nvim-telescope/telescope-fzf-native.nvim', - lazy = true, - build = 'make', - }, - { - 'zhou13/vim-easyescape', - config = function() - vim.g.easyescape_chars = { - j = 0, - k = 0 - } - vim.g.easyescape_timeout = 99 - end - }, - { - "https://github.com/hrsh7th/nvim-cmp", - event = "VeryLazy", - dependencies = { - "https://github.com/hrsh7th/cmp-buffer", - "https://github.com/hrsh7th/cmp-nvim-lsp", - "https://github.com/hrsh7th/cmp-path", - "https://github.com/saadparwaiz1/cmp_luasnip", - 'hrsh7th/cmp-cmdline', - 'hrsh7th/cmp-calc', - 'hrsh7th/cmp-git', - 'hrsh7th/cmp-nvim-lua', - 'rafamadriz/friendly-snippets', - 'onsails/lspkind-nvim', - "https://github.com/L3MON4D3/LuaSnip", - - }, - config = function() - require('plugins.cmp') - end - }, - { - 'ellisonleao/gruvbox.nvim', - event = "VeryLazy", - }, - { - "https://github.com/lukas-reineke/indent-blankline.nvim", - event = { "BufReadPost", "BufNewFile" }, - config = function() - require("indent_blankline").setup({ - show_current_context = true, - show_first_indent_level = false, - show_trailing_blankline_indent = false, - use_treesitter = true, - }) - end, - }, - { - 'kyazdani42/nvim-web-devicons' - }, - { - "https://github.com/akinsho/bufferline.nvim", - event = "VeryLazy", - config = function() - require("bufferline").setup({ - options = { - always_show_bufferline = false, - }, - }) - end, - }, - { - "kyazdani42/nvim-tree.lua", - event = "VeryLazy", - config = function() - require("nvim-tree").setup({ - update_focused_file = { - enable = true, - update_cwd = true, - }, - diagnostics = { - enable = true, - show_on_dirs = true, - icons = { - hint = "", - info = "", - warning = "", - error = "", - }, - }, - view = { - width = 30, - side = "left", - }, - }) - end - }, - { - 'AckslD/nvim-whichkey-setup.lua', - event = "VeryLazy", - }, - { - "https://github.com/folke/which-key.nvim", - lazy = true, - config = function() - require("which-key").setup({}) - vim.api.nvim_set_option("timeoutlen", 300) - end, - cmd = "WhichKey", - event = "VeryLazy", - }, - { - "https://github.com/nvim-lualine/lualine.nvim", - event = "VeryLazy", - config = function() - require("lualine").setup({ - options = { - globalstatus = true, - }, - }) - end, - }, - { - "https://github.com/j-hui/fidget.nvim", - tag = "legacy", -- TODO https://github.com/j-hui/fidget.nvim/issues/131 - event = "VeryLazy", - config = function() - require("fidget").setup({ - text = { - spinner = "dots", - }, - }) - end, - }, - { - "https://github.com/lewis6991/gitsigns.nvim", - event = "VeryLazy", - config = function() - require("gitsigns").setup({ - current_line_blame = true, - }) - end, - }, - { - 'RRethy/vim-illuminate', - }, - { - "https://github.com/NeogitOrg/neogit", - cmd = "Neogit", - config = function() - require("neogit").setup({ - disable_commit_confirmation = true, - kind = "split", - integrations = { - diffview = true, - }, - }) - vim.keymap.set('n', 'gs', ':Neogit kind=split', { silent = true }) - end, - }, - { - "https://github.com/windwp/nvim-autopairs", - event = { "BufReadPost", "BufNewFile" }, - config = function() - require("nvim-autopairs").setup({ - check_ts = true, - }) - end, - }, - { 'RRethy/nvim-treesitter-endwise' - }, - { - "https://github.com/nvim-treesitter/nvim-treesitter", - event = { "BufReadPost", "BufNewFile" }, - config = function() - require("nvim-treesitter.configs").setup({ - ensure_installed = { - "bash", - "c", - "dockerfile", - "gitcommit", - "go", - "hcl", - "javascript", - "json", - "json5", - "jsonnet", - "latex", - "lua", - "nix", - "markdown", - "proto", - "python", - "rego", - "rust", - "terraform", - "typescript", - "yaml", - }, - highlight = { - enable = true, - }, - indent = { - enable = true, - }, - endwise = { - enable = true, - }, - }) - vim.treesitter.language.register("nomad", "hcl") - end, - }, - { - "https://github.com/mfussenegger/nvim-dap", - dependencies = { - { "rcarriga/nvim-dap-ui" }, - { "theHamsta/nvim-dap-virtual-text" }, - }, - }, -}) diff --git a/nvim/.config/nvim/lua/tree.lua b/nvim/.config/nvim/lua/tree.lua deleted file mode 100644 index 65ec85f..0000000 --- a/nvim/.config/nvim/lua/tree.lua +++ /dev/null @@ -1,16 +0,0 @@ -local tree ={} -local g = vim.g --- Explicitly set the nvim tree width -g.nvim_tree_width = 30 -local tree_width = g.nvim_tree_width -tree.toggle = function() - require('nvim-tree').toggle() - if require('nvim-tree.view').win_open() then - require('bufferline.state').set_offset(tree_width + 1, 'FileTree') - require('nvim-tree').find_file(true) - else - require('bufferline.state').set_offset(0) - end -end - -return tree