diff --git a/.config/nvim/lazy-lock.json b/.config/nvim/lazy-lock.json index b15b471..79a7e72 100644 --- a/.config/nvim/lazy-lock.json +++ b/.config/nvim/lazy-lock.json @@ -1,6 +1,7 @@ { - "LuaSnip": { "branch": "master", "commit": "878ace11983444d865a72e1759dbcc331d1ace4c" }, + "LuaSnip": { "branch": "master", "commit": "de1a287c9cb525ae52bc846e8f6207e5ef1da5ac" }, "blame.nvim": { "branch": "main", "commit": "dedbcdce857f708c63f261287ac7491a893912d0" }, + "catppuccin": { "branch": "main", "commit": "d97387aea8264f484bb5d5e74f2182a06c83e0d8" }, "cinnamon.nvim": { "branch": "master", "commit": "a011e84b624cd7b609ea928237505d31b987748a" }, "cmp-buffer": { "branch": "main", "commit": "3022dbc9166796b644a841a02de8dd1cc1d311fa" }, "cmp-cmdline": { "branch": "main", "commit": "d250c63aa13ead745e3a40f61fdd3470efde3923" }, @@ -9,36 +10,46 @@ "cmp-nvim-lua": { "branch": "main", "commit": "f12408bdb54c39c23e67cab726264c10db33ada8" }, "cmp-path": { "branch": "main", "commit": "91ff86cd9c29299a64f968ebb45846c485725f23" }, "cmp_luasnip": { "branch": "master", "commit": "05a9ab28b53f71d1aece421ef32fee2cb857a843" }, - "conform.nvim": { "branch": "master", "commit": "f3b930db4964d60e255c8f9e37b7f2218dfc08cb" }, - "dressing.nvim": { "branch": "master", "commit": "3c38ac861e1b8d4077ff46a779cde17330b29f3a" }, - "friendly-snippets": { "branch": "main", "commit": "d0610077b6129cf9f7f78afbe3a1425d60f6e2f1" }, - "fzf-lua": { "branch": "main", "commit": "b92220ec838c195eb1c711daa69c905b1d7b8d8c" }, - "gruvbox-material": { "branch": "master", "commit": "848b4de6ab014d689d5c20790afebd7c32c1581b" }, + "conform.nvim": { "branch": "master", "commit": "5c9b6a6a50f3ec2c01f729dac872679fa6ea813f" }, + "dressing.nvim": { "branch": "master", "commit": "572314728cb1ce012e825fd66331f52c94acac12" }, + "fidget.nvim": { "branch": "main", "commit": "ef99df04a1c53a453602421bc0f756997edc8289" }, + "friendly-snippets": { "branch": "main", "commit": "dd2fd1281d4b22e7b4a5bfafa3e142d958e251f2" }, + "fzf-lua": { "branch": "main", "commit": "a9e5755721c0f24cd1635ea4ff181df5b1bd5dd4" }, + "gruvbox-material": { "branch": "master", "commit": "aa8096277690db1e1807ec57812c2cf3d54bb37f" }, "harpoon": { "branch": "harpoon2", "commit": "0378a6c428a0bed6a2781d459d7943843f374bce" }, - "lazy.nvim": { "branch": "main", "commit": "eab487c2520f0fe9e54eb5e3ea0606e20512492e" }, + "instant.nvim": { "branch": "master", "commit": "294b6d08143b3db8f9db7f606829270149e1a786" }, + "jq.nvim": { "branch": "master", "commit": "b9879798f25a9318894456dc7464af0904c08958" }, + "lazy.nvim": { "branch": "main", "commit": "8f19915175395680808de529e4220da8dafc0759" }, "lspkind.nvim": { "branch": "master", "commit": "1735dd5a5054c1fb7feaf8e8658dbab925f4f0cf" }, - "ltex-extra.nvim": { "branch": "master", "commit": "3ee08af31bf826c6ae2ca2a294b79f688306c0be" }, + "ltex-extra.nvim": { "branch": "master", "commit": "4296c2c7aefbca721d02a011366a1de30598046c" }, + "lualine.nvim": { "branch": "master", "commit": "0a5a66803c7407767b799067986b4dc3036e1983" }, "markdown-preview.nvim": { "branch": "master", "commit": "a923f5fc5ba36a3b17e289dc35dc17f66d0548ee" }, "mason-lspconfig.nvim": { "branch": "main", "commit": "a4caa0d083aab56f6cd5acf2d42331b74614a585" }, - "mason.nvim": { "branch": "main", "commit": "0fb4e56837f13b81a972fcc0554be1327b39061e" }, - "mini.ai": { "branch": "main", "commit": "7859b6344f5cee567a94f173859d25e20ba1a77e" }, - "mini.notify": { "branch": "main", "commit": "2d506633f50bd61b1041aa4a6d62e0fe0e6ae09e" }, + "mason-nvim-dap.nvim": { "branch": "main", "commit": "67210c0e775adec55de9826b038e8b62de554afc" }, + "mason.nvim": { "branch": "main", "commit": "49ff59aded1047a773670651cfa40e76e63c6377" }, "nvim-autopairs": { "branch": "master", "commit": "c15de7e7981f1111642e7e53799e1211d4606cb9" }, "nvim-bqf": { "branch": "main", "commit": "7751b6ef9fbc3907478eaf23e866c4316a2ed1b4" }, "nvim-cmp": { "branch": "main", "commit": "5260e5e8ecadaf13e6b82cf867a909f54e15fd07" }, - "nvim-lspconfig": { "branch": "master", "commit": "710a8fa7379db32199545f30ea01dd8446b9302f" }, + "nvim-colorizer.lua": { "branch": "master", "commit": "85855b38011114929f4058efc97af1059ab3e41d" }, + "nvim-dap": { "branch": "master", "commit": "5a2f7121869394502521c52b2bc581ab22c69447" }, + "nvim-dap-go": { "branch": "main", "commit": "5faf165f5062187320eaf9d177c3c1f647adc22e" }, + "nvim-dap-ui": { "branch": "master", "commit": "334cf3038c4756e6ab999cbac67c847fb654c190" }, + "nvim-lspconfig": { "branch": "master", "commit": "eadcee1573ca9d0e0cd36a49f620186a8dfdc607" }, + "nvim-nio": { "branch": "master", "commit": "def97d9351bf423f4302b9b76fd4e9729e85086c" }, "nvim-tmux-navigation": { "branch": "main", "commit": "4898c98702954439233fdaf764c39636681e2861" }, - "nvim-treesitter": { "branch": "master", "commit": "b7d50e59b1b2990b3ce8761d4cf595f4b71c87e2" }, + "nvim-treesitter": { "branch": "master", "commit": "30de5e7e9486fb1b1b8c2a1e71052b13f94f1cb0" }, "nvim-treesitter-context": { "branch": "master", "commit": "f62bfe19e0fbc13ae95649dfb3cf22f4ff85b683" }, - "nvim-treesitter-textobjects": { "branch": "master", "commit": "3557e41418b4a6c5b85d5d64abe94c9c50fa9b14" }, - "nvim-web-devicons": { "branch": "master", "commit": "b77921fdc44833c994fdb389d658ccbce5490c16" }, - "oil.nvim": { "branch": "master", "commit": "2cb39e838e9dcd8b374f09a3a87a2e5ec9d372f6" }, + "nvim-treesitter-textobjects": { "branch": "master", "commit": "5f9bf4b1ead7707e4e74e5319ee56bdc81fb73db" }, + "nvim-web-devicons": { "branch": "master", "commit": "e37bb1feee9e7320c76050a55443fa843b4b6f83" }, + "oil.nvim": { "branch": "master", "commit": "259b1fbc84734bfb74225b2c2f408dd7ed9cf474" }, "pastify.nvim": { "branch": "main", "commit": "47317b9bb7bf5fb7dfd994a6eb9bec8f00628dc0" }, "plenary.nvim": { "branch": "master", "commit": "a3e3bc82a3f95c5ed0d7201546d5d2c19b20d683" }, "presence.nvim": { "branch": "main", "commit": "87c857a56b7703f976d3a5ef15967d80508df6e6" }, - "todo-comments.nvim": { "branch": "main", "commit": "e1549807066947818113a7d7ed48f637e49620d3" }, + "todo-comments.nvim": { "branch": "main", "commit": "a7e39ae9e74f2c8c6dc4eea6d40c3971ae84752d" }, "undotree": { "branch": "master", "commit": "56c684a805fe948936cda0d1b19505b84ad7e065" }, + "vim-be-good": { "branch": "master", "commit": "4fa57b7957715c91326fcead58c1fa898b9b3625" }, + "vim-jukit": { "branch": "master", "commit": "73214c9a8abc4b6aa7a6266b5bc2ddbf8b3e3c00" }, "vim-surround": { "branch": "master", "commit": "3d188ed2113431cf8dac77be61b842acb64433d9" }, "vim-tpipeline": { "branch": "master", "commit": "5dd3832bd6e239feccb11cadca583cdcf9d5bda1" }, - "vimtex": { "branch": "master", "commit": "9665df7f51ee24aa81dbd81782e0a22480209753" } -} \ No newline at end of file + "vimtex": { "branch": "master", "commit": "9665df7f51ee24aa81dbd81782e0a22480209753" }, + "zen-mode.nvim": { "branch": "main", "commit": "78557d972b4bfbb7488e17b5703d25164ae64e6a" } diff --git a/.config/nvim/lua/core/package_manager.lua b/.config/nvim/lua/core/package_manager.lua index 0a78990..a0c0acd 100644 --- a/.config/nvim/lua/core/package_manager.lua +++ b/.config/nvim/lua/core/package_manager.lua @@ -14,5 +14,4 @@ end vim.opt.rtp:prepend(lazypath) --Call lazy config here -local lazy = require("lazy") -lazy.setup("plugins") +require('plugins.lazy') diff --git a/.config/nvim/lua/core/variables.lua b/.config/nvim/lua/core/variables.lua index d525909..4ad5e79 100644 --- a/.config/nvim/lua/core/variables.lua +++ b/.config/nvim/lua/core/variables.lua @@ -25,8 +25,8 @@ vim.opt.softtabstop = 4 vim.opt.shiftwidth = 4 vim.opt.expandtab = true --quickfix keybinds -vim.keymap.set("n", "", "cprevzz") -vim.keymap.set("n", "", "cnextzz") +vim.keymap.set("n", "", "cprevzz") +vim.keymap.set("n", "", "cnextzz") --buffer keybinds vim.keymap.set("n", "", "bp") vim.keymap.set("n", "", "bn") @@ -47,4 +47,3 @@ vim.g.jukit_mappings = 0 --Format Options vim.opt.formatoptions:remove("ro") --Sign gutter always on -vim.opt.signcolumn = "yes" diff --git a/.config/nvim/lua/plugins/autopairs.lua b/.config/nvim/lua/plugins/autopairs.lua new file mode 100644 index 0000000..c24b33d --- /dev/null +++ b/.config/nvim/lua/plugins/autopairs.lua @@ -0,0 +1,10 @@ +local Rule = require('nvim-autopairs.rule') +local npairs = require('nvim-autopairs') + +npairs.setup({ + map_cr = true, + map_bs = true, + check_ts = true, + enable_check_bracket_line = true, + ignored_next_char = "[%w]" +}) diff --git a/.config/nvim/lua/plugins/cmp.lua b/.config/nvim/lua/plugins/cmp.lua index d9f67b0..80b163b 100644 --- a/.config/nvim/lua/plugins/cmp.lua +++ b/.config/nvim/lua/plugins/cmp.lua @@ -1,112 +1,107 @@ -return { - { - "hrsh7th/nvim-cmp", - event = "VeryLazy", - dependencies = { - "hrsh7th/cmp-nvim-lsp", -- lsp - "hrsh7th/cmp-nvim-lua", -- Nvim API completions - "hrsh7th/cmp-nvim-lsp-signature-help", -- Show function signatures - "hrsh7th/cmp-buffer", --buffer completions - "hrsh7th/cmp-path", --path completions - "hrsh7th/cmp-cmdline", --cmdline completions - "L3MON4D3/LuaSnip", - "rafamadriz/friendly-snippets", - "saadparwaiz1/cmp_luasnip", - "onsails/lspkind.nvim", --lspkind icons +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 lspkind_status_ok, lspkind = pcall(require, "lspkind") +if not lspkind_status_ok then + return +end + +cmp.setup({ + snippet = { + expand = function(args) + luasnip.lsp_expand(args.body) -- For `luasnip` users. + end, + }, + mapping = { + [""] = cmp.mapping.select_next_item({ behavior = cmp.SelectBehavior.Insert }), + [""] = cmp.mapping.select_prev_item({ behavior = cmp.SelectBehavior.Insert }), + [""] = cmp.mapping.scroll_docs(-4), + [""] = cmp.mapping.scroll_docs(4), + [""] = cmp.mapping.abort(), + [""] = cmp.mapping( + cmp.mapping.confirm({ + behavior = cmp.ConfirmBehavior.Insert, + select = true, + }), + { "i", "c" } + ), + [""] = cmp.mapping(cmp.mapping.complete(), { "i", "c" }), + [""] = cmp.mapping(function() + if luasnip.expand_or_jumpable() then + luasnip.expand_or_jump() + end + end), + [""] = cmp.mapping(function() + if luasnip.jumpable(-1) then + luasnip.jump(-1) + end + end), + }, + formatting = { + fields = { "kind", "abbr", "menu" }, + format = lspkind.cmp_format({ + mode = "symbol_text", + maxwidth = 50, + ellipsis_char = "...", + show_labelDetails = true, + + before = function(entry, vim_item) + vim_item.menu = ({ + nvim_lsp = "[LSP]", + nvim_lua = "[LSP]", + path = "[Path]", + })[entry.source.name] + return vim_item + end, + }), + }, + preselect = cmp.PreselectMode.None, + sorting = { + priority_weight = 2, + comparators = { + cmp.config.compare.offset, + cmp.config.compare.exact, + cmp.config.compare.score, + cmp.config.compare.kind, + cmp.config.compare.recently_used, + cmp.config.compare.locality, + + --Make entries that start with underline appear after + function(entry1, entry2) + local _, entry1_under = entry1.completion_item.label:find("^_+") + local _, entry2_under = entry2.completion_item.label:find("^_+") + entry1_under = entry1_under or 0 + entry2_under = entry2_under or 0 + if entry1_under > entry2_under then + return false + elseif entry1_under < entry2_under then + return true + end + end, }, - config = function() - local cmp = require("cmp") + }, + sources = cmp.config.sources({ + { name = "nvim_lua" }, + { name = "nvim_lsp" }, + { name = "luasnip" }, + { name = "path" }, + }, { + { name = "buffer", keyword_length = 5 }, + }), +}) - local luasnip = require("luasnip") - require("luasnip/loaders/from_vscode").lazy_load() - - local lspkind = require("lspkind") - - cmp.setup({ - snippet = { - expand = function(args) - luasnip.lsp_expand(args.body) - end, - }, - mapping = { - [""] = cmp.mapping.select_next_item({ behavior = cmp.SelectBehavior.Insert }), - [""] = cmp.mapping.select_prev_item({ behavior = cmp.SelectBehavior.Insert }), - [""] = cmp.mapping.scroll_docs(-4), - [""] = cmp.mapping.scroll_docs(4), - [""] = cmp.mapping( - cmp.mapping.confirm({ - behavior = cmp.ConfirmBehavior.Insert, - select = true, - }), - { "i", "c" } - ), - [""] = cmp.mapping(cmp.mapping.complete(), { "i", "c" }), - [""] = cmp.mapping(function() - if luasnip.expand_or_jumpable() then - luasnip.expand_or_jump() - end - end), - [""] = cmp.mapping(function() - if luasnip.jumpable(-1) then - luasnip.jump(-1) - end - end), - }, - formatting = { - fields = { "kind", "abbr", "menu" }, - format = lspkind.cmp_format({ - mode = "symbol_text", - maxwidth = 50, - ellipsis_char = "...", - show_labelDetails = true, - - before = function(entry, vim_item) - vim_item.menu = ({ - nvim_lsp = "[LSP]", - nvim_lua = "[NVIM LSP]", - path = "[Path]", - })[entry.source.name] - return vim_item - end, - }), - }, - preselect = cmp.PreselectMode.None, - sorting = { - priority_weight = 2, - comparators = { - cmp.config.compare.offset, - cmp.config.compare.exact, - cmp.config.compare.score, - cmp.config.compare.kind, - cmp.config.compare.recently_used, - cmp.config.compare.locality, - - --Make entries that start with underline appear after - function(entry1, entry2) - local _, entry1_under = entry1.completion_item.label:find("^_+") - local _, entry2_under = entry2.completion_item.label:find("^_+") - entry1_under = entry1_under or 0 - entry2_under = entry2_under or 0 - if entry1_under > entry2_under then - return false - elseif entry1_under < entry2_under then - return true - end - end, - }, - }, - sources = cmp.config.sources({ - { name = "nvim_lua" }, - { name = "nvim_lsp" }, - { name = "luasnip" }, - { name = "path" }, - }, { - { name = "buffer", keyword_length = 5 }, - }), - }) - - local cmp_autopairs = require("nvim-autopairs.completion.cmp") - cmp.event:on("confirm_done", cmp_autopairs.on_confirm_done()) - end - } -} +local cmp_autopairs = require("nvim-autopairs.completion.cmp") +cmp.event:on("confirm_done", cmp_autopairs.on_confirm_done()) diff --git a/.config/nvim/lua/plugins/colorscheme.lua b/.config/nvim/lua/plugins/colorscheme.lua deleted file mode 100644 index 9e44e39..0000000 --- a/.config/nvim/lua/plugins/colorscheme.lua +++ /dev/null @@ -1,7 +0,0 @@ -return { - { - "sainnhe/gruvbox-material", - event = "VeryLazy", - priority = 1000, - }, -} diff --git a/.config/nvim/lua/plugins/conform.lua b/.config/nvim/lua/plugins/conform.lua new file mode 100644 index 0000000..af2e4ca --- /dev/null +++ b/.config/nvim/lua/plugins/conform.lua @@ -0,0 +1,10 @@ +require("conform").setup({ + formatters_by_ft = { + python = { "black" }, + haskell = { "fourmolu" }, + javascript = { "prettierd" }, + markdown = { "mdformat" }, + go = { "gofmt" }, + json = {"jq"} + } +}) diff --git a/.config/nvim/lua/plugins/dap.lua b/.config/nvim/lua/plugins/dap.lua new file mode 100644 index 0000000..def6a3a --- /dev/null +++ b/.config/nvim/lua/plugins/dap.lua @@ -0,0 +1,47 @@ +local dap = require("dap") + +dap.adapters.lldb = { + type = 'server', + port = "${port}", + executable = { + command = '/Users/afonso/.local/share/nvim/mason/bin/codelldb', + args = { "--port", "${port}" }, + } +} +dap.adapters.codelldb = { + type = 'server', + host = '127.0.0.1', + port = 13000 +} + +dap.configurations.c = { + { + name = "Manually start codelldb", + type = "codelldb", + request = "launch", + program = function() + return vim.fn.input('Path to executable: ', vim.fn.getcwd() .. '/', 'file') + end, + args = function() + local args = vim.fn.input('Arguments: ') + return args ~= '' and { args } or nil + end, + cwd = '${workspaceFolder}', + stopOnEntry = false, + }, + { + name = "Auto start codelldb", + type = "lldb", + request = "launch", + program = function() + return vim.fn.input('Path to executable: ', vim.fn.getcwd() .. '/', 'file') + end, + args = function() + local args = vim.fn.input('Arguments: ') + return args ~= '' and { args } or nil + end, + cwd = '${workspaceFolder}', + stopOnEntry = false, + }, + +} diff --git a/.config/nvim/lua/plugins/editing.lua b/.config/nvim/lua/plugins/editing.lua deleted file mode 100644 index 0088202..0000000 --- a/.config/nvim/lua/plugins/editing.lua +++ /dev/null @@ -1,25 +0,0 @@ -return { - { - "tpope/vim-surround", - event = "VeryLazy", - }, - { - "mbbill/undotree", - event = "VeryLazy", - }, - { - "windwp/nvim-autopairs", - event = "VeryLazy", - config = function() - local npairs = require('nvim-autopairs') - - npairs.setup({ - map_cr = true, - map_bs = true, - check_ts = true, - enable_check_bracket_line = true, - ignored_next_char = "[%w]" - }) - end, - }, -} diff --git a/.config/nvim/lua/plugins/fzf-lua.lua b/.config/nvim/lua/plugins/fzf-lua.lua index f13880c..697ead4 100644 --- a/.config/nvim/lua/plugins/fzf-lua.lua +++ b/.config/nvim/lua/plugins/fzf-lua.lua @@ -1,42 +1,34 @@ -return { - { - "ibhagwan/fzf-lua", - event = "VeryLazy", - dependencies = { "nvim-tree/nvim-web-devicons" }, - config = function() - local fzflua = require('fzf-lua') - fzflua.register_ui_select() - fzflua.setup({ - defaults = { - headers = false, - winopts = { - border = "single", - width = 0.6, - height = 0.5, - }, - }, - files = { - previewer = false, - winopts = { - width = 0.5, - height = 0.3, - } - }, - grep = { - winopts = { - width = 0.7, - preview = { - layout = "horizontal", - horizontal = "right:40%" - } - }, - } - }) - vim.keymap.set('n', 'ff', fzflua.files, {}) - vim.keymap.set('n', 'fe', fzflua.diagnostics_workspace, {}) - vim.keymap.set('n', 'fg', fzflua.live_grep, {}) - vim.keymap.set('n', 'fb', fzflua.buffers, {}) - vim.keymap.set('n', 'fh', fzflua.help_tags, {}) - end +local fzflua = require('fzf-lua') +fzflua.register_ui_select() +fzflua.setup({ + defaults = { + headers = false, + formatter = "path.filename_first", + winopts = { + border = "single", + width = 0.6, + height = 0.5, + }, + }, + files = { + previewer = false, + winopts = { + width = 0.5, + height = 0.3, + } + }, + grep = { + winopts = { + width = 0.7, + preview = { + layout = "horizontal", + horizontal = "right:40%" + } + }, } -} +}) +vim.keymap.set('n', 'ff', fzflua.files, {}) +vim.keymap.set('n', 'fe', fzflua.diagnostics_workspace, {}) +vim.keymap.set('n', 'fg', fzflua.live_grep, {}) +vim.keymap.set('n', 'fb', fzflua.buffers, {}) +vim.keymap.set('n', 'fh', fzflua.help_tags, {}) diff --git a/.config/nvim/lua/plugins/git.lua b/.config/nvim/lua/plugins/git.lua deleted file mode 100644 index a6dbe7b..0000000 --- a/.config/nvim/lua/plugins/git.lua +++ /dev/null @@ -1,9 +0,0 @@ -return { - { - "FabijanZulj/blame.nvim", - event = "VeryLazy", - config = function() - require("blame").setup() - end - }, -} diff --git a/.config/nvim/lua/plugins/harpoon.lua b/.config/nvim/lua/plugins/harpoon.lua new file mode 100644 index 0000000..4c9bd84 --- /dev/null +++ b/.config/nvim/lua/plugins/harpoon.lua @@ -0,0 +1,13 @@ +local harpoon = require("harpoon") + +-- REQUIRED +harpoon:setup() +-- REQUIRED + +vim.keymap.set("n", "a", function() harpoon:list():add() end) +vim.keymap.set("n", "", function() harpoon.ui:toggle_quick_menu(harpoon:list()) end) + +vim.keymap.set("n", "", function() harpoon:list():select(1) end) +vim.keymap.set("n", "", function() harpoon:list():select(2) end) +vim.keymap.set("n", "", function() harpoon:list():select(3) end) +vim.keymap.set("n", "", function() harpoon:list():select(4) end) diff --git a/.config/nvim/lua/plugins/jukit.lua b/.config/nvim/lua/plugins/jukit.lua new file mode 100644 index 0000000..cc6cc42 --- /dev/null +++ b/.config/nvim/lua/plugins/jukit.lua @@ -0,0 +1,27 @@ +local opts = { noremap = true, silent = true, buffer = true } +--Convert between py and ipynb +vim.keymap.set('n', 'jnp', 'call jukit#convert#notebook_convert()', opts) +-- Create new code cell below. Argument: Whether to create code cell (0) or markdown cell (1) +vim.keymap.set('n', 'jco', 'call jukit#cells#create_below(0)', opts) +-- Create new code cell above. Argument: Whether to create code cell (0) or markdown cell (1) +vim.keymap.set('n', 'jcO', 'call jukit#cells#create_above(0)', opts) + +-- Create new text (markdown) cell below. Argument: Whether to create code cell (0) or markdown cell (1) +vim.keymap.set('n', 'jct', 'call jukit#cells#create_below(1)', opts) +-- Create new text (markdown) cell above. Argument: Whether to create code cell (0) or markdown cell (1) +vim.keymap.set('n', 'jcT', 'call jukit#cells#create_above(1)', opts) + +-- Deletes the current cell +vim.keymap.set('n', 'jcd', 'call jukit#cells#delete()', opts) + +-- Send current section (argument: 0 indicates the current section) +vim.keymap.set('n', 'jcc', 'call jukit#send#section(0)', opts) + +-- Send all sections up to the current section +vim.keymap.set('n', 'jcac', 'call jukit#send#until_current_section()', opts) + +-- Send all sections +vim.keymap.set('n', 'jca', 'call jukit#send#all()', opts) + +-- Open an output split +vim.keymap.set('n', 'jos', 'call jukit#splits#output()', opts) diff --git a/.config/nvim/lua/plugins/lazy.lua b/.config/nvim/lua/plugins/lazy.lua new file mode 100644 index 0000000..0dd214d --- /dev/null +++ b/.config/nvim/lua/plugins/lazy.lua @@ -0,0 +1,345 @@ +local lazy = require("lazy") + +lazy.setup({ + + -------------------------------------------THEMES------------------------------------------ + { + "catppuccin/nvim", + name = "catppuccin", + event = "VeryLazy", + lazy = false, + priority = 1000, + opts = {}, + }, + + { + "sainnhe/gruvbox-material", + event = "VeryLazy", + priority = 1000, + }, + + -------------------------------------------------------QOL--------------------------------- + + { + "jbyuki/instant.nvim", + event = "VeryLazy", + config = function() + vim.g.instant_username = "afonso" + end, + }, + + { + "iamcco/markdown-preview.nvim", + event = "VeryLazy", + cmd = { "MarkdownPreviewToggle", "MarkdownPreview", "MarkdownPreviewStop" }, + ft = { "markdown" }, + build = function() vim.fn["mkdp#util#install"]() end, + }, + + { + "ThePrimeagen/harpoon", + event = "VeryLazy", + branch = "harpoon2", + dependencies = { "nvim-lua/plenary.nvim" }, + config = function() + require("plugins.harpoon") + end + }, + + { + "vimpostor/vim-tpipeline", + config = function() + vim.g.tpipeline_restore = 1 + end + }, + + { + "FabijanZulj/blame.nvim", + event = "VeryLazy", + config = function() + require("blame").setup() + end + }, + + { + "TobinPalmer/pastify.nvim", + event = "VeryLazy", + cmd = { "Pastify" }, + opts = {}, + }, + + --Python notebooks + { + "luk400/vim-jukit", + event = "VeryLazy", + config = function() + require("plugins.jukit") + end, + ft = { "python", "json" }, + }, + + --Nvim to browser + --"subnut/nvim-ghost.nvim", + + { + "declancm/cinnamon.nvim", + opts = { + scroll_limit = 10000, + always_scroll = true, + }, + }, + + { + "folke/todo-comments.nvim", + event = "VeryLazy", + dependencies = { "nvim-lua/plenary.nvim" }, + opts = { + vim.keymap.set("n", "]t", function() + require("todo-comments").jump_next() + end, { desc = "Next todo comment" }), + + vim.keymap.set("n", "[t", function() + require("todo-comments").jump_prev() + end, { desc = "Previous todo comment" }) + }, + }, + + { + "folke/zen-mode.nvim", + event = "VeryLazy", + opts = { + vim.keymap.set("n", "z", " ZenMode ", { noremap = true, silent = true }), + }, + }, + + --Change add and remove surroundings from words + "tpope/vim-surround", + + { + "NvChad/nvim-colorizer.lua", + opts = {}, + }, + + "mbbill/undotree", + + --Tmux navigation + { + "alexghergh/nvim-tmux-navigation", + opts = { + disable_when_zoomed = true, -- defaults to false + keybindings = { + left = "", + down = "", + up = "", + right = "", + }, + }, + }, + + -- Rename variable pop up + { + "stevearc/dressing.nvim", + event = "VeryLazy", + }, + + { + "windwp/nvim-autopairs", + event = "VeryLazy", + config = function() + require("plugins.autopairs") + end, + }, + + { + "nvim-lualine/lualine.nvim", + dependencies = { "nvim-tree/nvim-web-devicons", opt = true }, + config = function() + require("plugins.lualine") + end, + }, + + { + "stevearc/oil.nvim", + opts = {}, + }, + + -------------------------------------------------------LSP---------------------------------------------- + { + "hrsh7th/nvim-cmp", + event = "VeryLazy", + dependencies = { + "hrsh7th/cmp-nvim-lsp", -- lsp + "hrsh7th/cmp-nvim-lua", -- Nvim API completions + "hrsh7th/cmp-nvim-lsp-signature-help", -- Show function signatures + "hrsh7th/cmp-buffer", --buffer completions + "hrsh7th/cmp-path", --path completions + "hrsh7th/cmp-cmdline", --cmdline completions + "L3MON4D3/LuaSnip", + "rafamadriz/friendly-snippets", + "saadparwaiz1/cmp_luasnip", + "onsails/lspkind.nvim", --lspkind icons + }, + config = function() + require("plugins.cmp") + end, + }, + + --LSP Status + "j-hui/fidget.nvim", + + { + "rcarriga/nvim-dap-ui", + event = "VeryLazy", + dependencies = { "mfussenegger/nvim-dap", "nvim-neotest/nvim-nio" }, + config = function() + local dap = require("dap") + local dapui = require("dapui") + dapui.setup() + dap.listeners.after.event_initialized["dapui_config"] = function() + dapui.open() + end + dap.listeners.before.event_terminated["dapui_config"] = function() + dapui.close() + end + dap.listeners.before.event_exited["dapui_config"] = function() + dapui.close() + end + end, + }, + { + "jay-babu/mason-nvim-dap.nvim", + event = "VeryLazy", + dependencies = { + "williamboman/mason.nvim", + "mfussenegger/nvim-dap", + }, + opts = { + handlers = {}, + }, + }, + { + "mfussenegger/nvim-dap", + event = "VeryLazy", + config = function() + require("plugins.dap") + end, + }, + + { + 'leoluz/nvim-dap-go', + event = "VeryLazy", + opts = {} + }, + + { + "neovim/nvim-lspconfig", + event = { "BufReadPost", "BufNewFile" }, + dependencies = { + { + "williamboman/mason-lspconfig.nvim", + dependencies = { + { + "williamboman/mason.nvim", + config = function() + require("plugins.mason") + end, + }, + }, + config = function() + require("plugins.mason-lspconfig") + end + }, + }, + config = function() + require("plugins.lspconfig") + end, + }, + + --Better quick fix + { + 'kevinhwang91/nvim-bqf', + event = "VeryLazy", + ft = 'qf' + }, + + { + "stevearc/conform.nvim", + event = "VeryLazy", + config = function() + require("plugins.conform") + end, + }, + + { + "lervag/vimtex", + event = "VeryLazy", + config = function() + require("plugins.vimtex") + end, + }, + + --'tpope/vim-commentary', + + -- { + -- "mrcjkb/rustaceanvim", + -- version = "^4", -- Recommended + -- ft = { "rust" }, + -- }, + + { + "barreiroleo/ltex-extra.nvim", + event = "VeryLazy", + }, + + ------------------------------------------------------------------------------------------- + -- Syntax Highlighting + { + "nvim-treesitter/nvim-treesitter", + event = { "BufReadPost", "BufNewFile" }, + dependencies = { + 'nvim-treesitter/nvim-treesitter-textobjects' + }, + config = function() + require("plugins.treesitter") + end, + }, + + + --Sticky headers + { + "nvim-treesitter/nvim-treesitter-context", + config = function() + require("plugins.treesitter-context") + end, + }, + + { + "ibhagwan/fzf-lua", + event = "VeryLazy", + dependencies = { "nvim-tree/nvim-web-devicons" }, + config = function() + require('plugins.fzf-lua') + end + }, + + --Discord Rich Presence + "andweeb/presence.nvim", + + --Vim be good + { + 'ThePrimeagen/vim-be-good', + event = "VeryLazy", + }, + + + --JQ + { + 'jrop/jq.nvim', + event = "VeryLazy", + }, + + -- { + -- 'BooleanCube/keylab.nvim', + -- opts = {} + -- } +}) diff --git a/.config/nvim/lua/plugins/lsp.lua b/.config/nvim/lua/plugins/lsp.lua deleted file mode 100644 index 520a846..0000000 --- a/.config/nvim/lua/plugins/lsp.lua +++ /dev/null @@ -1,222 +0,0 @@ -return { - -- Rename variable pop up - { - "stevearc/dressing.nvim", - event = "VeryLazy", - }, - { - "williamboman/mason.nvim", - config = function() - local mason = require("mason") - vim.api.nvim_create_augroup("_mason", { clear = true }) - local options = { - PATH = "skip", - ui = { - icons = { - package_pending = " ", - package_installed = "󰄳 ", - package_uninstalled = " ", - }, - keymaps = { - toggle_server_expand = "", - install_server = "i", - update_server = "u", - check_server_version = "c", - update_all_servers = "U", - check_outdated_servers = "C", - uninstall_server = "X", - cancel_installation = "", - }, - }, - max_concurrent_installers = 10, - } - mason.setup(options) - end, - }, - { - "williamboman/mason-lspconfig.nvim", - dependencies = { - "williamboman/mason.nvim" - }, - config = function() - local mason_lspconfig = require("mason-lspconfig") - local lspconfig = require("lspconfig") - - mason_lspconfig.setup({ - automatic_installation = false, - }) - - local lsp_defaults = lspconfig.util.default_config - local capabilities = - vim.tbl_deep_extend("force", lsp_defaults.capabilities, require("cmp_nvim_lsp").default_capabilities()) - - mason_lspconfig.setup_handlers({ - -- This is a default handler that will be called for each installed server (also for new servers that are installed during a session) - function(server_name) - lspconfig[server_name].setup({ - capabilities = capabilities, - }) - end, - ["gopls"] = function() - lspconfig["gopls"].setup({ - capabilities = capabilities, - settings = { - gopls = { - ["ui.completion.usePlaceholders"] = true, - ["ui.diagnostic.staticcheck"] = true, - ["ui.inlayhint.hints"] = { - assignVariablesTypes = true, - compositeLiteralFields = true, - compositeLiteralTypes = true, - constantValues = true, - functionTypeParameters = true, - parameterNames = true, - rangeVariableTypes = true - }, - } - } - }) - end, - ["lua_ls"] = function() - lspconfig["lua_ls"].setup({ - capabilities = capabilities, - settings = { - Lua = { - runtime = { - -- Tell the language server which version of Lua you're using (most likely LuaJIT in the case of Neovim) - version = "LuaJIT", - }, - diagnostics = { - -- Get the language server to recognize the `vim` global - globals = { "vim" }, - }, - workspace = { - -- Make the server aware of Neovim runtime files - library = vim.api.nvim_get_runtime_file("", true), - }, - hint = { enable = true } - }, - }, - }) - end, - ["ltex"] = function() - lspconfig["ltex"].setup({ - capabilities = capabilities, - --Local on attach - on_attach = function(_, _) - -- rest of your on_attach process. - require("ltex_extra").setup() - end, - settings = { - ltex = { - language = "pt-PT", - }, - }, - }) - end, - ["basedpyright"] = function() - lspconfig["basedpyright"].setup({ - capabilities = capabilities, - settings = { - verboseOutput = true, - autoImportCompletion = true, - basedpyright = { - analysis = { - typeCheckingMode = "all", - autoSearchPaths = true, - useLibraryCodeForTypes = true, - diagnosticMode = "openFilesOnly", - indexing = true, - }, - }, - }, - }) - end, - }) - end - }, - { - "neovim/nvim-lspconfig", - event = { "BufReadPost", "BufNewFile" }, - dependencies = { - "williamboman/mason-lspconfig.nvim" - }, - config = function() - local lspconfig = require("lspconfig") - - -- Use an on_attach function to only map the following keys - -- after the language server attaches to the current buffer - vim.api.nvim_create_autocmd("LspAttach", { - group = vim.api.nvim_create_augroup("UserLspConfig", {}), - callback = function(ev) - -- Enable completion triggered by - vim.bo[ev.buf].omnifunc = "v:lua.vim.lsp.omnifunc" - - local fzflua = require("fzf-lua") - local conform = require("conform") - - local client = vim.lsp.get_client_by_id(ev.data.client_id) - if client ~= nil then - client.server_capabilities.semanticTokensProvider = nil - end - - -- Mappings. - local bufopts = { noremap = true, silent = true, buffer = ev.buf } - vim.keymap.set("n", "e", vim.diagnostic.open_float, bufopts) - vim.keymap.set("n", "q", vim.diagnostic.setloclist, bufopts) - vim.keymap.set("n", "gD", vim.lsp.buf.declaration, bufopts) - vim.keymap.set("n", "gd", vim.lsp.buf.definition, bufopts) - vim.keymap.set("n", "gr", fzflua.lsp_references, bufopts) - vim.keymap.set("n", "K", vim.lsp.buf.hover, bufopts) - vim.keymap.set("n", "gi", fzflua.lsp_implementations, bufopts) - vim.keymap.set("n", "k", vim.lsp.buf.signature_help, bufopts) - vim.keymap.set("n", "D", vim.lsp.buf.type_definition, bufopts) - vim.keymap.set("n", "rn", vim.lsp.buf.rename, bufopts) - vim.keymap.set("n", "ca", vim.lsp.buf.code_action, bufopts) - vim.keymap.set("n", "ge", vim.diagnostic.goto_next, bufopts) - vim.keymap.set("n", "gE", vim.diagnostic.goto_prev, bufopts) - vim.keymap.set("n", "fo", function() conform.format({ lsp_fallback = true }) end, bufopts) - end, - }) - - -- ADD NVIM CMP AS A CAPABILITY - local lsp_defaults = lspconfig.util.default_config - local capabilities = - vim.tbl_deep_extend("force", lsp_defaults.capabilities, require("cmp_nvim_lsp").default_capabilities()) - - lspconfig["hls"].setup({ - capabilities = capabilities, - filetypes = { 'haskell', 'lhaskell', 'cabal' }, - }) - end, - }, - { - "stevearc/conform.nvim", - event = "VeryLazy", - config = function() - require("conform").setup({ - formatters_by_ft = { - python = { "black" }, - haskell = { "fourmolu" }, - javascript = { "prettierd" }, - markdown = { "mdformat" }, - go = { "gofmt" }, - json = { "jq" } - } - }) - end, - }, - - { - "lervag/vimtex", - event = "VeryLazy", - config = function() - vim.g.vimtex_view_method = 'skim' - vim.g.vimtex_compiler_methor = 'pdflatex' - end, - }, - { - "barreiroleo/ltex-extra.nvim", - event = "VeryLazy", - }, -} diff --git a/.config/nvim/lua/plugins/lspconfig.lua b/.config/nvim/lua/plugins/lspconfig.lua new file mode 100644 index 0000000..0bbe1f9 --- /dev/null +++ b/.config/nvim/lua/plugins/lspconfig.lua @@ -0,0 +1,45 @@ +local lspconfig = require("lspconfig") + +-- Use an on_attach function to only map the following keys +-- after the language server attaches to the current buffer +vim.api.nvim_create_autocmd("LspAttach", { + group = vim.api.nvim_create_augroup("UserLspConfig", {}), + callback = function(ev) + -- Enable completion triggered by + vim.bo[ev.buf].omnifunc = "v:lua.vim.lsp.omnifunc" + vim.opt_local.signcolumn = numbers + + local fzflua = require("fzf-lua") + local conform = require("conform") + + local client = vim.lsp.get_client_by_id(ev.data.client_id) + client.server_capabilities.semanticTokensProvider = nil + + -- Mappings. + local bufopts = { noremap = true, silent = true, buffer = ev.buf } + vim.keymap.set("n", "e", vim.diagnostic.open_float, bufopts) + vim.keymap.set("n", "q", vim.diagnostic.setloclist, bufopts) + vim.keymap.set("n", "gD", vim.lsp.buf.declaration, bufopts) + vim.keymap.set("n", "gd", vim.lsp.buf.definition, bufopts) + vim.keymap.set("n", "gr", fzflua.lsp_references, bufopts) + vim.keymap.set("n", "K", vim.lsp.buf.hover, bufopts) + vim.keymap.set("n", "gi", fzflua.lsp_implementations, bufopts) + vim.keymap.set("n", "k", vim.lsp.buf.signature_help, bufopts) + vim.keymap.set("n", "D", vim.lsp.buf.type_definition, bufopts) + vim.keymap.set("n", "rn", vim.lsp.buf.rename, bufopts) + vim.keymap.set("n", "ca", vim.lsp.buf.code_action, bufopts) + vim.keymap.set("n", "ge", vim.diagnostic.goto_next, bufopts) + vim.keymap.set("n", "gE", vim.diagnostic.goto_prev, bufopts) + vim.keymap.set("n", "fo", function() conform.format({ lsp_fallback = true }) end, bufopts) + end, +}) + +-- ADD NVIM CMP AS A CAPABILITY +local lsp_defaults = lspconfig.util.default_config +local capabilities = + vim.tbl_deep_extend("force", lsp_defaults.capabilities, require("cmp_nvim_lsp").default_capabilities()) + +lspconfig["hls"].setup({ + capabilities = capabilities, + filetypes = { 'haskell', 'lhaskell', 'cabal' }, +}) diff --git a/.config/nvim/lua/plugins/lualine.lua b/.config/nvim/lua/plugins/lualine.lua new file mode 100644 index 0000000..ec50706 --- /dev/null +++ b/.config/nvim/lua/plugins/lualine.lua @@ -0,0 +1,40 @@ +require('lualine').setup { + options = { + icons_enabled = true, + theme = 'auto', + component_separators = { left = '', right = ''}, + section_separators = { left = '', right = ''}, + disabled_filetypes = { + statusline = {}, + winbar = {}, + }, + ignore_focus = {}, + always_divide_middle = true, + globalstatus = false, + refresh = { + statusline = 1000, + tabline = 1000, + winbar = 1000, + } + }, + sections = { + lualine_a = {}, + lualine_b = {}, + lualine_c = {}, + lualine_x = {'filetype'}, + lualine_y = {}, + lualine_z = {'location'} + }, + inactive_sections = { + lualine_a = {}, + lualine_b = {}, + lualine_c = {'filename'}, + lualine_x = {'location'}, + lualine_y = {}, + lualine_z = {} + }, + tabline = {}, + winbar = {}, + inactive_winbar = {}, + extensions = {} +} diff --git a/.config/nvim/lua/plugins/mason-lspconfig.lua b/.config/nvim/lua/plugins/mason-lspconfig.lua new file mode 100644 index 0000000..1bb7f71 --- /dev/null +++ b/.config/nvim/lua/plugins/mason-lspconfig.lua @@ -0,0 +1,94 @@ +local mason_lspconfig = require("mason-lspconfig") +local lspconfig = require("lspconfig") + +mason_lspconfig.setup({ + automatic_installation = false, +}) + +local lsp_defaults = lspconfig.util.default_config +local capabilities = + vim.tbl_deep_extend("force", lsp_defaults.capabilities, require("cmp_nvim_lsp").default_capabilities()) + +mason_lspconfig.setup_handlers({ + -- This is a default handler that will be called for each installed server (also for new servers that are installed during a session) + function(server_name) + lspconfig[server_name].setup({ + capabilities = capabilities, + }) + end, + ["gopls"] = function() + lspconfig["gopls"].setup({ + capabilities = capabilities, + settings = { + gopls = { + ["ui.completion.usePlaceholders"] = true, + ["ui.diagnostic.staticcheck"] = true, + ["ui.inlayhint.hints"] = { + assignVariablesTypes = true, + compositeLiteralFields = true, + compositeLiteralTypes = true, + constantValues = true, + functionTypeParameters = true, + parameterNames = true, + rangeVariableTypes = true + }, + } + } + }) + end, + ["lua_ls"] = function() + lspconfig["lua_ls"].setup({ + capabilities = capabilities, + settings = { + Lua = { + runtime = { + -- Tell the language server which version of Lua you're using (most likely LuaJIT in the case of Neovim) + version = "LuaJIT", + }, + diagnostics = { + -- Get the language server to recognize the `vim` global + globals = { "vim" }, + }, + workspace = { + -- Make the server aware of Neovim runtime files + library = vim.api.nvim_get_runtime_file("", true), + }, + hint = { enable = true } + }, + }, + }) + end, + ["ltex"] = function() + lspconfig["ltex"].setup({ + capabilities = capabilities, + --Local on attach + on_attach = function(_, _) + -- rest of your on_attach process. + require("ltex_extra").setup() + end, + settings = { + ltex = { + language = "en-US", + }, + }, + }) + end, + ["basedpyright"] = function() + lspconfig["basedpyright"].setup({ + capabilities = capabilities, + settings = { + verboseOutput = true, + autoImportCompletion = true, + basedpyright = { + analysis = { + typeCheckingMode = "all", + autoSearchPaths = true, + useLibraryCodeForTypes = true, + diagnosticMode = "openFilesOnly", + indexing = true, + }, + }, + }, + }) + end, +}) diff --git a/.config/nvim/lua/plugins/mason.lua b/.config/nvim/lua/plugins/mason.lua new file mode 100644 index 0000000..bdc6628 --- /dev/null +++ b/.config/nvim/lua/plugins/mason.lua @@ -0,0 +1,24 @@ +local mason = require("mason") +vim.api.nvim_create_augroup("_mason", { clear = true }) +local options = { + PATH = "skip", + ui = { + icons = { + package_pending = " ", + package_installed = "󰄳 ", + package_uninstalled = " ", + }, + keymaps = { + toggle_server_expand = "", + install_server = "i", + update_server = "u", + check_server_version = "c", + update_all_servers = "U", + check_outdated_servers = "C", + uninstall_server = "X", + cancel_installation = "", + }, + }, + max_concurrent_installers = 10, +} +mason.setup(options) diff --git a/.config/nvim/lua/plugins/misc.lua b/.config/nvim/lua/plugins/misc.lua deleted file mode 100644 index 0125b33..0000000 --- a/.config/nvim/lua/plugins/misc.lua +++ /dev/null @@ -1,29 +0,0 @@ -return { - { - "iamcco/markdown-preview.nvim", - event = "VeryLazy", - cmd = { "MarkdownPreviewToggle", "MarkdownPreview", "MarkdownPreviewStop" }, - ft = { "markdown" }, - build = function() vim.fn["mkdp#util#install"]() end, - }, - { - "folke/todo-comments.nvim", - event = "VeryLazy", - dependencies = { "nvim-lua/plenary.nvim" }, - opts = { - vim.keymap.set("n", "]t", function() - require("todo-comments").jump_next() - end, { desc = "Next todo comment" }), - - vim.keymap.set("n", "[t", function() - require("todo-comments").jump_prev() - end, { desc = "Previous todo comment" }) - }, - }, - { - "TobinPalmer/pastify.nvim", - event = "VeryLazy", - cmd = { "Pastify" }, - opts = {}, - }, -} diff --git a/.config/nvim/lua/plugins/navigation.lua b/.config/nvim/lua/plugins/navigation.lua deleted file mode 100644 index d8c38f9..0000000 --- a/.config/nvim/lua/plugins/navigation.lua +++ /dev/null @@ -1,44 +0,0 @@ -return { - { - "ThePrimeagen/harpoon", - event = "VeryLazy", - branch = "harpoon2", - dependencies = { "nvim-lua/plenary.nvim" }, - config = function() - local harpoon = require("harpoon") - harpoon.setup() - vim.keymap.set("n", "a", function() harpoon:list():add() end) - vim.keymap.set("n", "", function() harpoon.ui:toggle_quick_menu(harpoon:list()) end) - - vim.keymap.set("n", "", function() harpoon:list():select(1) end) - vim.keymap.set("n", "", function() harpoon:list():select(2) end) - vim.keymap.set("n", "", function() harpoon:list():select(3) end) - vim.keymap.set("n", "", function() harpoon:list():select(4) end) - end - }, - { - "stevearc/oil.nvim", - opts = {}, - }, - { - "alexghergh/nvim-tmux-navigation", - event = "VeryLazy", - opts = { - disable_when_zoomed = true, -- defaults to false - keybindings = { - left = "", - down = "", - up = "", - right = "", - }, - }, - }, - { - "declancm/cinnamon.nvim", - event = "VeryLazy", - opts = { - scroll_limit = 10000, - always_scroll = true, - }, - }, -} diff --git a/.config/nvim/lua/plugins/none-ls.lua b/.config/nvim/lua/plugins/none-ls.lua new file mode 100644 index 0000000..6a9d3b6 --- /dev/null +++ b/.config/nvim/lua/plugins/none-ls.lua @@ -0,0 +1,28 @@ +local augroup = vim.api.nvim_create_augroup("LspFormatting",{}) +local null_ls = require("null-ls") + +null_ls.setup({ + sources = { + null_ls.builtins.formatting.black, + null_ls.builtins.formatting.gofmt, + null_ls.builtins.formatting.prettierd.with({ + filetypes = { "html", "json", "css", "js", "yaml", "markdown" }, + }), + null_ls.builtins.diagnostics.golangci_lint, + }, + on_attach = function(client,bufnr) + if client.supports_method("textDocument/formatting") then + vim.api.nvim_clear_autocmds({ + group = augroup, + buffer = bufnr, + }) + vim.api.nvim_create_autocmd("BufWritePre",{ + group = augroup, + buffer = bufnr, + callback = function() + vim.lsp.buf.format({ bufnr = bufnr }) + end + }) + end + end, +}) diff --git a/.config/nvim/lua/plugins/sql_formatter.json b/.config/nvim/lua/plugins/sql_formatter.json new file mode 100644 index 0000000..f725b10 --- /dev/null +++ b/.config/nvim/lua/plugins/sql_formatter.json @@ -0,0 +1,3 @@ +{ + "keywordCase": "upper" +} diff --git a/.config/nvim/lua/plugins/telescope.lua b/.config/nvim/lua/plugins/telescope.lua new file mode 100644 index 0000000..a3dcf85 --- /dev/null +++ b/.config/nvim/lua/plugins/telescope.lua @@ -0,0 +1,42 @@ +local telescope = require('telescope') +local actions = require("telescope.actions") + +telescope.setup { + defaults = { + layout_strategy = "horizontal", + path_display = { "filename_first" }, + mappings = { + i = { + [""] = actions.close, + }, + }, + }, + pickers = { + find_files = { + previewer = false, + layout_strategy = "center", + layout_config = { + height = 0.7, + width = 0.5 + }, + }, + live_grep = { + only_sort_text = true, + previewer = true, + } + }, + extensions = { + ["ui-select"] = { + require("telescope.themes").get_cursor {} + } + } +} +telescope.load_extension('fzf') +telescope.load_extension("ui-select") +--local builtin = require('telescope.builtin') +--vim.keymap.set('n', 'ff', builtin.find_files, {}) +--vim.keymap.set('n', 'fe', builtin.diagnostics, {}) +--vim.keymap.set('n', 'fg', builtin.live_grep, {}) +--vim.keymap.set('n', 'fb', builtin.buffers, {}) +--vim.keymap.set('n', 'fs', builtin.treesitter, {}) +--vim.keymap.set('n', 'fh', builtin.help_tags, {}) diff --git a/.config/nvim/lua/plugins/treesitter-context.lua b/.config/nvim/lua/plugins/treesitter-context.lua new file mode 100644 index 0000000..97a406d --- /dev/null +++ b/.config/nvim/lua/plugins/treesitter-context.lua @@ -0,0 +1,8 @@ +require'treesitter-context'.setup{ + patterns = { + rust = { + 'impl_item', + 'match', + }, + } +} diff --git a/.config/nvim/lua/plugins/treesitter.lua b/.config/nvim/lua/plugins/treesitter.lua index 5e4a45f..995a448 100644 --- a/.config/nvim/lua/plugins/treesitter.lua +++ b/.config/nvim/lua/plugins/treesitter.lua @@ -1,44 +1,42 @@ -return { +local present, treesitter = pcall(require, "nvim-treesitter.configs") +if not present then + return +end - { - "nvim-treesitter/nvim-treesitter", - event = { "BufReadPost", "BufNewFile" }, - dependencies = { - 'nvim-treesitter/nvim-treesitter-textobjects' +require('nvim-treesitter.install').update({ with_sync = true }) + + +local options = { + ensure_installed = { "c", "lua", "haskell", "rust", "markdown", "org" }, + + highlight = { + enable = true, + use_languagetree = true, + additional_vim_regex_highlighting = { "org" }, + }, + indent = { + enable = true, + }, + textobjects = { + select = { + enable = true, + -- Automatically jump forward to textobj, similar to targets.vim + lookahead = true, + keymaps = { + -- You can use the capture groups defined in textobjects.scm + ["af"] = "@function.outer", + ["if"] = "@function.inner", + ["ab"] = "@block.outer", + ["ib"] = "@block.inner", + }, + selection_modes = { + ['@block.outer'] = 'v', -- charwise + ['@block.inner'] = 'v', -- charwise + ['@function.outer'] = 'V', -- linewise + }, + include_surrounding_whitespace = true, }, - config = function() - local treesitter = require("nvim-treesitter.configs") - - require('nvim-treesitter.install').update({ with_sync = true }) - - - local options = { - ensure_installed = { "c", "lua", "haskell", "markdown" }, - - highlight = { - enable = true, - use_languagetree = true, - additional_vim_regex_highlighting = { "org" }, - }, - indent = { - enable = true, - }, - } - - treesitter.setup(options) - end - }, - { - "nvim-treesitter/nvim-treesitter-context", - event = "VeryLazy", - config = function() - require 'treesitter-context'.setup() - end, - }, - { - 'echasnovski/mini.ai', - event = "VeryLazy", - version = false, - opts = {} }, } + +treesitter.setup(options) diff --git a/.config/nvim/lua/plugins/ui.lua b/.config/nvim/lua/plugins/ui.lua deleted file mode 100644 index 062f150..0000000 --- a/.config/nvim/lua/plugins/ui.lua +++ /dev/null @@ -1,26 +0,0 @@ -return { - { - "vimpostor/vim-tpipeline", - config = function() - vim.g.tpipeline_restore = 1 - vim.g.tpipeline_autoembed = 1 - vim.o.laststatus = 0 - vim.g.tpipeline_statusline = '%=%l:%c' - end - }, - { - 'echasnovski/mini.notify', - version = false, - config = function() - vim.api.nvim_set_hl(0, 'MiniNotifyNormal', { link = 'Normal' }) - vim.api.nvim_set_hl(0, 'MiniNotifyBorder', { link = 'Normal' }) - require("mini.notify").setup() - end - }, - --Better quick fix - { - 'kevinhwang91/nvim-bqf', - event = "VeryLazy", - ft = 'qf' - }, -} diff --git a/.config/nvim/lua/plugins/vimtex.lua b/.config/nvim/lua/plugins/vimtex.lua new file mode 100644 index 0000000..fdac0c5 --- /dev/null +++ b/.config/nvim/lua/plugins/vimtex.lua @@ -0,0 +1,2 @@ +vim.g.vimtex_view_method = 'skim' +vim.g.vimtex_compiler_methor = 'pdflatex' diff --git a/.config/wireplumber/main.lua.d/51-acer-monitor.lua b/.config/wireplumber/main.lua.d/51-acer-monitor.lua new file mode 100644 index 0000000..211b84d --- /dev/null +++ b/.config/wireplumber/main.lua.d/51-acer-monitor.lua @@ -0,0 +1,12 @@ +rule ={ + matches = { + { + {"node.description","equals","GA104 High Definition Audio Controller Digital Stereo (HDMI)"}, + } + }, + apply_properties = { + ["node.description"] = "Acer Monitor Speakers", + ["node.nick"] = "Acer Monitor Speakers" + } +} +table.insert(alsa_monitor.rules,rule) diff --git a/.config/wireplumber/main.lua.d/51-built-in-input.lua b/.config/wireplumber/main.lua.d/51-built-in-input.lua new file mode 100644 index 0000000..353f493 --- /dev/null +++ b/.config/wireplumber/main.lua.d/51-built-in-input.lua @@ -0,0 +1,12 @@ +rule ={ + matches = { + { + {"node.name","equals","alsa_input.platform-snd_aloop.0.analog-stereo"}, + } + }, + apply_properties = { + ["node.description"] = "Built-in Audio Input", + ["node.nick"] = "Built-in Audio Input" + } +} +table.insert(alsa_monitor.rules,rule) diff --git a/.config/wireplumber/main.lua.d/51-built-in-output.lua b/.config/wireplumber/main.lua.d/51-built-in-output.lua new file mode 100644 index 0000000..75fd345 --- /dev/null +++ b/.config/wireplumber/main.lua.d/51-built-in-output.lua @@ -0,0 +1,12 @@ +rule ={ + matches = { + { + {"node.name","equals","alsa_output.platform-snd_aloop.0.analog-stereo"}, + } + }, + apply_properties = { + ["node.description"] = "Built-in Audio Output", + ["node.nick"] = "Built-in Audio Output" + } +} +table.insert(alsa_monitor.rules,rule) diff --git a/.config/wireplumber/main.lua.d/51-focusrite-input.lua b/.config/wireplumber/main.lua.d/51-focusrite-input.lua new file mode 100644 index 0000000..de81862 --- /dev/null +++ b/.config/wireplumber/main.lua.d/51-focusrite-input.lua @@ -0,0 +1,12 @@ +rule ={ + matches = { + { + {"node.name","equals","alsa_input.usb-Focusrite_Scarlett_Solo_USB_Y70DAWR074D97D-00.analog-stereo"}, + } + }, + apply_properties = { + ["node.description"] = "Scarlett Solo Interface Input", + ["node.nick"] = "Scarlett Solo Input" + } +} +table.insert(alsa_monitor.rules,rule) diff --git a/.config/wireplumber/main.lua.d/51-focusrite-output.lua b/.config/wireplumber/main.lua.d/51-focusrite-output.lua new file mode 100644 index 0000000..3727690 --- /dev/null +++ b/.config/wireplumber/main.lua.d/51-focusrite-output.lua @@ -0,0 +1,12 @@ +rule ={ + matches = { + { + {"node.name","equals","alsa_output.usb-Focusrite_Scarlett_Solo_USB_Y70DAWR074D97D-00.iec958-stereo"}, + } + }, + apply_properties = { + ["node.description"] = "Scarlett Solo Interface Output", + ["node.nick"] = "Scarlett Solo Output" + } +} +table.insert(alsa_monitor.rules,rule) diff --git a/.zshenv b/.zshenv index c0fd380..a127c7e 100644 --- a/.zshenv +++ b/.zshenv @@ -4,7 +4,4 @@ TRAPUSR1() { exec "${SHELL}" fi } -if [[ $(uname) == "Darwin" ]]; then - export JAVA_HOME="/opt/homebrew/opt/openjdk@17/libexec/openjdk.jdk/Contents/Home" -fi -export LIBVA_DRIVER_NAME=nvidia +export JAVA_HOME="/opt/homebrew/opt/openjdk@17/libexec/openjdk.jdk/Contents/Home"