diff --git a/.config/nvim/lua/mappings.lua b/.config/nvim/lua/mappings.lua index de53e8b..1a1c77e 100644 --- a/.config/nvim/lua/mappings.lua +++ b/.config/nvim/lua/mappings.lua @@ -7,6 +7,9 @@ vim.wo.relativenumber= true vim.opt.hlsearch = false vim.opt.incsearch = true vim.opt.smartindent = true +--Move lines +vim.keymap.set("v", "J", ":m '>+1gv=gv") +vim.keymap.set("v", "K", ":m '<-2gv=gv") --Remove Wrap vim.opt.wrap = false --Not let cursor go bellow 10 chars. @@ -16,6 +19,9 @@ vim.opt.tabstop = 4 vim.opt.softtabstop = 4 vim.opt.shiftwidth = 4 vim.opt.expandtab = true +--quickfix keybinds +vim.keymap.set("n", "", "cnextzz") +vim.keymap.set("n", "", "cprevzz") --Undo dir vim.opt.undodir = os.getenv("HOME") .. "/.vim/undodir" vim.opt.undofile = true diff --git a/.config/nvim/lua/plugins/cmp.lua b/.config/nvim/lua/plugins/cmp.lua index 6583aeb..86c738a 100644 --- a/.config/nvim/lua/plugins/cmp.lua +++ b/.config/nvim/lua/plugins/cmp.lua @@ -1,140 +1,145 @@ local cmp_status_ok, cmp = pcall(require, "cmp") if not cmp_status_ok then - return + return end local snip_status_ok, luasnip = pcall(require, "luasnip") if not snip_status_ok then - return + 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" + local col = vim.fn.col "." - 1 + return col == 0 or vim.fn.getline("."):sub(col, col):match "%s" end --   פּ ﯟ   some other good icons local kind_icons = { - Text = "", - Method = "m", - Function = "", - Constructor = "", - Field = "", - Variable = "", - Class = "", - Interface = "", - Module = "", - Property = "", - Unit = "", - Value = "", - Enum = "", - Keyword = "", - Snippet = "", - Color = "", - File = "", - Reference = "", - Folder = "", - EnumMember = "", - Constant = "", - Struct = "", - Event = "", - Operator = "", - TypeParameter = "", + Text = "", + Method = "m", + Function = "", + Constructor = "", + Field = "", + Variable = "", + Class = "", + Interface = "", + Module = "", + Property = "", + Unit = "", + Value = "", + Enum = "", + Keyword = "", + Snippet = "", + Color = "", + File = "", + Reference = "", + Folder = "", + EnumMember = "", + Constant = "", + Struct = "", + Event = "", + Operator = "", + TypeParameter = "", } -- find more here: https://www.nerdfonts.com/cheat-sheet cmp.setup { - snippet = { - expand = function(args) - luasnip.lsp_expand(args.body) -- For `luasnip` users. - end, - }, - mapping = { - [""] = 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.config.disable, -- Specify `cmp.config.disable` if you want to remove the default `` mapping. - [""] = 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 = true }, - [""] = 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) - -- Kind icons - vim_item.kind = string.format("%s", kind_icons[vim_item.kind]) - -- vim_item.kind = string.format('%s %s', kind_icons[vim_item.kind], vim_item.kind) -- This concatonates the icons with the name of the item kind - vim_item.menu = ({ - nvim_lsp = "(LSP)", - luasnip = "(Snippet)", - buffer = "(Text)", - path = "(Path)", - })[entry.source.name] - return vim_item - end, - }, - sorting = { - comparators = { - cmp.config.compare.exact, - cmp.config.compare.offset, - cmp.config.compare.recently_used, - } - }, - sources = { - { name = "nvim_lsp" }, - { name = "luasnip" }, - { name = "buffer" }, - { name = "path" }, - }, - confirm_opts = { - behavior = cmp.ConfirmBehavior.Replace, - select = false, - }, - window = { - documentation = cmp.config.window.bordered(), - completion = cmp.config.window.bordered({ - winhighlight = "Normal:Pmenu,FloatBorder:Pmenu,CursorLine:PmenuSel,Search:None" - }) + snippet = { + expand = function(args) + luasnip.lsp_expand(args.body) -- For `luasnip` users. + end, + }, + mapping = { + [""] = 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.config.disable, -- Specify `cmp.config.disable` if you want to remove the default `` mapping. + [""] = 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 = true }, + [""] = 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) + -- Kind icons + vim_item.kind = string.format("%s", kind_icons[vim_item.kind]) + -- vim_item.kind = string.format('%s %s', kind_icons[vim_item.kind], vim_item.kind) -- This concatonates the icons with the name of the item kind + vim_item.menu = ({ + nvim_lsp = "(LSP)", + luasnip = "(Snippet)", + buffer = "(Text)", + path = "(Path)", + })[entry.source.name] + return vim_item + end, + }, + sorting = { + comparators = { + cmp.config.compare.exact, + cmp.config.compare.offset, + cmp.config.compare.recently_used, + } + }, + sources = cmp.config.sources( + { + { name = "nvim_lsp" }, + { name = "luasnip" }, + { name = "path" }, + }, + { + --This sources will only show up if there aren't any sources from the other list + { name = "buffer", keyword_length = 5 }, + } + ), + confirm_opts = { + behavior = cmp.ConfirmBehavior.Replace, + select = false, + }, + window = { + documentation = cmp.config.window.bordered(), + completion = cmp.config.window.bordered({ + winhighlight = "Normal:Pmenu,FloatBorder:Pmenu,CursorLine:PmenuSel,Search:None" + }) - }, - experimental = { - ghost_text = false, - native_menu = false, - }, + }, + experimental = { + ghost_text = true, + native_menu = false, + }, } diff --git a/.config/nvim/lua/plugins/lspconfig.lua b/.config/nvim/lua/plugins/lspconfig.lua index c2d88a1..ca6bf4d 100644 --- a/.config/nvim/lua/plugins/lspconfig.lua +++ b/.config/nvim/lua/plugins/lspconfig.lua @@ -1,5 +1,4 @@ local mason_lspconfig = require "mason-lspconfig" -local notify = require "notify" mason_lspconfig.setup({ ensure_installed = { "sumneko_lua", "rust_analyzer", "texlab", "hls", "yamlls" }, @@ -48,11 +47,6 @@ local on_attach = function(client, bufnr) end end -local on_init = function (client, initialize_result) - -- Alert user that LSP finished loading - notify("Finished loading " ..client.name, "info", {title = "LSP"}) -end - local lspconfig = require "lspconfig" -- ADD NVIM CMP AS A CAPABILITY @@ -71,7 +65,6 @@ mason_lspconfig.setup_handlers { function(server_name) lspconfig[server_name].setup { on_attach = on_attach, - on_init = on_init, flags = lsp_flags, capabilities = capabilities, } diff --git a/.config/nvim/lua/plugins/packer.lua b/.config/nvim/lua/plugins/packer.lua index 215c6fe..c717f3c 100644 --- a/.config/nvim/lua/plugins/packer.lua +++ b/.config/nvim/lua/plugins/packer.lua @@ -24,36 +24,38 @@ local plugins = packer.startup({ function(use) end } - use { 'stevearc/dressing.nvim' } -- Rename variable pop up + use { "stevearc/dressing.nvim" } -- Rename variable pop up use { "windwp/nvim-autopairs", config = function() require("nvim-autopairs").setup {} end } - use { 'kyazdani42/nvim-web-devicons' } + use { "kyazdani42/nvim-web-devicons" } use { - 'nvim-lualine/lualine.nvim', - requires = { 'kyazdani42/nvim-web-devicons', opt = true }, + "nvim-lualine/lualine.nvim", + requires = { "kyazdani42/nvim-web-devicons", opt = true }, config = function() require 'plugins.lualine' end } - use { 'rcarriga/nvim-notify', - config = function() - vim.notify = require("notify") - end - } + use {"j-hui/fidget.nvim", + config = function () + require("fidget").setup{} + end + } + + use {"voldikss/vim-floaterm"} --------------------------------------------------SUGGESTION BOX----------------------------------------- use { "hrsh7th/nvim-cmp", requires = { - 'hrsh7th/cmp-nvim-lsp', -- lsp - 'hrsh7th/cmp-buffer', --buffer completions - 'hrsh7th/cmp-path', --path completions - 'hrsh7th/cmp-cmdline' --cmdline completions + "hrsh7th/cmp-nvim-lsp", -- lsp + "hrsh7th/cmp-buffer", --buffer completions + "hrsh7th/cmp-path", --path completions + "hrsh7th/cmp-cmdline" --cmdline completions }, config = function() require "plugins.cmp" @@ -92,9 +94,9 @@ local plugins = packer.startup({ function(use) ------------------------------------------------------------------------------------------ - use { 'nvim-tree/nvim-tree.lua', + use { "nvim-tree/nvim-tree.lua", requires = { - 'nvim-tree/nvim-web-devicons', -- optional, for file icons + "nvim-tree/nvim-web-devicons", -- optional, for file icons }, config = function() require("nvim-tree").setup() @@ -119,8 +121,8 @@ local plugins = packer.startup({ function(use) } --Tabs - use { 'romgrk/barbar.nvim', - requires = 'kyazdani42/nvim-web-devicons', + use { "romgrk/barbar.nvim", + requires = "kyazdani42/nvim-web-devicons", config = function() require "plugins.barbar" end @@ -128,9 +130,9 @@ local plugins = packer.startup({ function(use) --fuzzy file finding use { - 'nvim-telescope/telescope.nvim', tag = '0.1.0', + "nvim-telescope/telescope.nvim", tag = '0.1.0', -- or , branch = '0.1.x', - requires = { { 'nvim-lua/plenary.nvim' } }, + requires = { { "nvim-lua/plenary.nvim" } }, config = function() require('plugins.telescope') end }