diff --git a/lazy-lock.json b/lazy-lock.json index a6e529d..a9190cc 100644 --- a/lazy-lock.json +++ b/lazy-lock.json @@ -1,38 +1,35 @@ { - "Comment.nvim": { "branch": "master", "commit": "0236521ea582747b58869cb72f70ccfa967d2e89" }, - "LuaSnip": { "branch": "master", "commit": "03c8e67eb7293c404845b3982db895d59c0d1538" }, - "cmp-buffer": { "branch": "main", "commit": "3022dbc9166796b644a841a02de8dd1cc1d311fa" }, - "cmp-cmdline": { "branch": "main", "commit": "d250c63aa13ead745e3a40f61fdd3470efde3923" }, - "cmp-nvim-lsp": { "branch": "main", "commit": "39e2eda76828d88b773cc27a3f61d2ad782c922d" }, - "cmp-path": { "branch": "main", "commit": "91ff86cd9c29299a64f968ebb45846c485725f23" }, - "conform.nvim": { "branch": "master", "commit": "f3b930db4964d60e255c8f9e37b7f2218dfc08cb" }, - "fidget.nvim": { "branch": "main", "commit": "ef99df04a1c53a453602421bc0f756997edc8289" }, - "gen.nvim": { "branch": "main", "commit": "bd19cf584b5b82123de977b44105e855e61e5f39" }, - "git-worktree.nvim": { "branch": "master", "commit": "f247308e68dab9f1133759b05d944569ad054546" }, + "catppuccin": { "branch": "main", "commit": "63685e1562ef53873c9764b483d7ac5c7a608922" }, + "edgy.nvim": { "branch": "main", "commit": "7e8dedc39abebe40c289b8012cc89b11c69aa7a0" }, + "gitsigns.nvim": { "branch": "main", "commit": "863903631e676b33e8be2acb17512fdc1b80b4fb" }, "harpoon": { "branch": "harpoon2", "commit": "0378a6c428a0bed6a2781d459d7943843f374bce" }, - "lazy.nvim": { "branch": "main", "commit": "24fa2a97085ca8a7220b5b078916f81e316036fd" }, - "lualine.nvim": { "branch": "master", "commit": "0a5a66803c7407767b799067986b4dc3036e1983" }, - "mason-lspconfig": { "branch": "main", "commit": "a4caa0d083aab56f6cd5acf2d42331b74614a585" }, - "mason.nvim": { "branch": "main", "commit": "49ff59aded1047a773670651cfa40e76e63c6377" }, - "nvim-cmp": { "branch": "main", "commit": "5260e5e8ecadaf13e6b82cf867a909f54e15fd07" }, - "nvim-dap": { "branch": "master", "commit": "abb238f631609ea4be496ba7946f4f3aaec86c6a" }, - "nvim-dap-ui": { "branch": "master", "commit": "b7267003ba4dd860350be86f75b9d9ea287cedca" }, - "nvim-dap-virtual-text": { "branch": "master", "commit": "d7c695ea39542f6da94ee4d66176f5d660ab0a77" }, - "nvim-emmet": { "branch": "main", "commit": "928cfb74ed436d6d326ccab2061cf3592de1bf55" }, - "nvim-highlight-colors": { "branch": "main", "commit": "582064092cff170331064b7d198a5b97cb261fca" }, - "nvim-jdtls": { "branch": "master", "commit": "10691312d51c5485c656a71258b55d3798d3fb3e" }, - "nvim-lspconfig": { "branch": "master", "commit": "38de86f82efd9ba0881203767d6a8e1815abca28" }, - "nvim-nio": { "branch": "master", "commit": "632024157d01e8bc48fd7df6a7de8ffe3fdd4f3a" }, - "nvim-treesitter": { "branch": "master", "commit": "ea2b137f35fb1e87a6471ec311805920fdf45745" }, - "nvim-web-devicons": { "branch": "master", "commit": "b77921fdc44833c994fdb389d658ccbce5490c16" }, - "oil.nvim": { "branch": "master", "commit": "2cb39e838e9dcd8b374f09a3a87a2e5ec9d372f6" }, - "plenary.nvim": { "branch": "master", "commit": "a3e3bc82a3f95c5ed0d7201546d5d2c19b20d683" }, - "telescope-fzf-native.nvim": { "branch": "main", "commit": "9ef21b2e6bb6ebeaf349a0781745549bbb870d27" }, - "telescope.nvim": { "branch": "master", "commit": "2df52609a1632de5d77a0b2416db6ad9cf32e463" }, - "tokyonight.nvim": { "branch": "main", "commit": "0fae425aaab04a5f97666bd431b96f2f19c36935" }, - "trouble.nvim": { "branch": "main", "commit": "a8264a65a0b894832ea642844f5b7c30112c458f" }, - "undotree": { "branch": "master", "commit": "56c684a805fe948936cda0d1b19505b84ad7e065" }, - "vim-dadbod": { "branch": "master", "commit": "fb30422b7bee7e2fa4205a4d226f01477f4fc593" }, - "vim-fugitive": { "branch": "master", "commit": "4f59455d2388e113bd510e85b310d15b9228ca0d" }, - "vim-tabby": { "branch": "main", "commit": "afd76df166ed0f223ede1071e0cfde8075cc4a24" } -} \ No newline at end of file + "lazy.nvim": { "branch": "main", "commit": "460e1cd8f24e364d54543a4b0e83f6f4ec1f65fb" }, + "lualine.nvim": { "branch": "master", "commit": "b431d228b7bbcdaea818bdc3e25b8cdbe861f056" }, + "neo-tree.nvim": { "branch": "v3.x", "commit": "a77af2e764c5ed4038d27d1c463fa49cd4794e07" }, + "noice.nvim": { "branch": "main", "commit": "c1ba80ccf6b3bd8c7fc88fe2e61085131d44ad65" }, + "nui.nvim": { "branch": "main", "commit": "b58e2bfda5cea347c9d58b7f11cf3012c7b3953f" }, + "nvim-dap": { "branch": "master", "commit": "7ff6936010b7222fea2caea0f67ed77f1b7c60dd" }, + "nvim-dap-ui": { "branch": "master", "commit": "1c351e4e417d4691da12948b6ecf966936a56d28" }, + "nvim-dap-virtual-text": { "branch": "master", "commit": "3497eb39bf413a57ab5b7e7e2e192683e462148c" }, + "nvim-highlight-colors": { "branch": "main", "commit": "a411550ef85cae467b889ba7d1a96bd78332d90e" }, + "nvim-nio": { "branch": "master", "commit": "a428f309119086dc78dd4b19306d2d67be884eee" }, + "nvim-notify": { "branch": "master", "commit": "fbef5d32be8466dd76544a257d3f3dce20082a07" }, + "nvim-treesitter": { "branch": "master", "commit": "140f534ce9c02189921b80f5c8a68ab9e3f92ce8" }, + "nvim-web-devicons": { "branch": "master", "commit": "1e5a2a796a88b5d696acb07dd5c285b13d13da21" }, + "oil.nvim": { "branch": "master", "commit": "1360be5fda9c67338331abfcd80de2afbb395bcd" }, + "playground": { "branch": "master", "commit": "ba48c6a62a280eefb7c85725b0915e021a1a0749" }, + "plenary.nvim": { "branch": "master", "commit": "2d9b06177a975543726ce5c73fca176cedbffe9d" }, + "telescope-fzf-native.nvim": { "branch": "main", "commit": "cf48d4dfce44e0b9a2e19a008d6ec6ea6f01a83b" }, + "telescope.nvim": { "branch": "master", "commit": "cb3f98d935842836cc115e8c9e4b38c1380fbb6b" }, + "todo-comments.nvim": { "branch": "main", "commit": "ae0a2afb47cf7395dc400e5dc4e05274bf4fb9e0" }, + "trouble.nvim": { "branch": "main", "commit": "6efc446226679fda0547c0fd6a7892fd5f5b15d8" }, + "twilight.nvim": { "branch": "main", "commit": "1584c0b0a979b71fd86b18d302ba84e9aba85b1b" }, + "undotree": { "branch": "master", "commit": "78b5241191852ffa9bb5da5ff2ee033160798c3b" }, + "vim-be-good": { "branch": "master", "commit": "4fa57b7957715c91326fcead58c1fa898b9b3625" }, + "vim-dadbod": { "branch": "master", "commit": "7888cb7164d69783d3dce4e0283decd26b82538b" }, + "vim-dadbod-completion": { "branch": "master", "commit": "880f7e9f2959e567c718d52550f9fae1aa07aa81" }, + "vim-dadbod-ui": { "branch": "master", "commit": "f29c85ab42861c6ef683289b0c6a51e0d436dcf6" }, + "vim-fugitive": { "branch": "master", "commit": "d4877e54cef67f5af4f950935b1ade19ed6b7370" }, + "which-key.nvim": { "branch": "main", "commit": "fb070344402cfc662299d9914f5546d840a22126" }, + "zen-mode.nvim": { "branch": "main", "commit": "29b292bdc58b76a6c8f294c961a8bf92c5a6ebd6" } +} diff --git a/lua/barink/after/ftplugin/go.lua b/lua/barink/after/ftplugin/go.lua deleted file mode 100644 index 39d684f..0000000 --- a/lua/barink/after/ftplugin/go.lua +++ /dev/null @@ -1,36 +0,0 @@ -local dap = require("dap") -print("You opened a Golang file") - -dap.adapters.delve = { - type = 'server', - port = '${port}', - executable = { - command = 'dlv', - args = {'dap', '-l', '127.0.0.1:${port}'}, - } -} - --- https://github.com/go-delve/delve/blob/master/Documentation/usage/dlv_dap.md -dap.configurations.go = { - { - type = "delve", - name = "Debug", - request = "launch", - program = "${file}" - }, - { - type = "delve", - name = "Debug test", -- configuration for debugging test files - request = "launch", - mode = "test", - program = "${file}" - }, - -- works with go.mod packages and sub packages - { - type = "delve", - name = "Debug test (go.mod)", - request = "launch", - mode = "test", - program = "./${relativeFileDirname}" - } -} diff --git a/lua/barink/after/ftplugin/java.lua b/lua/barink/after/ftplugin/java.lua deleted file mode 100644 index 3af7acd..0000000 --- a/lua/barink/after/ftplugin/java.lua +++ /dev/null @@ -1,24 +0,0 @@ ---[[ --- Only setup for windows --- Don't know if all this is actually necessary --- TODO: FIX: Clean this mess up ~ 03/28/2024 ---]] -if vim.loop.os_uname().sysname == 'Windows_NT' then - Cmd = 'c:/Users/nigel/Appdata/Local/nvim-data/mason/bin/jdtls.cmd' - JavaDebug = vim.fn.glob("C:/Users/nigel/AppData/Local/nvim-data/java-debug/com.microsoft.java.debug.plugin/target/com.microsoft.java.debug.plugin-0.52.0.jar", 1) -else - Cmd = '' - JavaDebug = nil -end -local config = { - cmd = {Cmd}, - root_dir = vim.fs.dirname(vim.fs.find({'gradlew', '.git', 'mvnw'}, { upward = true })[1]), - init_options = { - bundles = { - JavaDebug - } - } -} -require('jdtls').start_or_attach(config) -require('jdtls').setup_dap({hotcodreplace='auto'}) -require('jdtls.dap').setup_dap_main_class_configs() diff --git a/lua/barink/after/ftplugin/lua.lua b/lua/barink/after/ftplugin/lua.lua deleted file mode 100644 index fef868a..0000000 --- a/lua/barink/after/ftplugin/lua.lua +++ /dev/null @@ -1 +0,0 @@ -print("You opened a LUA file..") diff --git a/lua/barink/init.lua b/lua/barink/init.lua index 72140fc..8ea29a6 100644 --- a/lua/barink/init.lua +++ b/lua/barink/init.lua @@ -1,6 +1,5 @@ require("barink.vim") require("barink.keys") - local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim" if not vim.loop.fs_stat(lazypath) then vim.fn.system({ diff --git a/lua/barink/keys.lua b/lua/barink/keys.lua index a3dca3e..7c1786f 100644 --- a/lua/barink/keys.lua +++ b/lua/barink/keys.lua @@ -1,16 +1,16 @@ -- Keymaps vim.g.mapleader = " " -vim.keymap.set("n", "", vim.cmd.UndotreeToggle) -vim.keymap.set("n", "p", [["_dP]]) -vim.keymap.set("n", "fa", vim.lsp.buf.format) -vim.keymap.set("n", "m", ":Mason") -vim.keymap.set("n", "e", ":Explore", { noremap = false, silent = true }) -vim.keymap.set("n", "le", ":Lexplore", { noremap = false, silent = true }) -vim.keymap.set("n", "x", "!chmod +x %", { silent = true }) --- Move lines while in visual mode -vim.keymap.set("v", "", ":m '>+1gv=gv", { noremap = true }) -vim.keymap.set("v", "", ":m '<-2gv=gv", { noremap = true }) +vim.keymap.set('n', '', vim.cmd.UndotreeToggle) +vim.keymap.set('n', 'p', [["_dP]]) +vim.keymap.set('n', 'fa', vim.lsp.buf.format) +vim.keymap.set('n', 'm', ":Mason") +vim.keymap.set('n', 'e',':Explore', {noremap = false, silent=true}) +vim.keymap.set('n', 'le',':Lexplore', {noremap = false, silent=true}) +vim.keymap.set('n', 'l', ':Neotree', {noremap = false, silent= true}) +-- Move lines while in visual mode +vim.keymap.set('v', '', ':m \'>+1gv=gv', {noremap = true}) +vim.keymap.set('v', '', ':m \'<-2gv=gv', {noremap = true}) -- Move lines while in normal mode vim.keymap.set("n", "", ":m .+1==", { noremap = true }) @@ -21,18 +21,11 @@ vim.keymap.set("i", "", ":m .+1==gi", { noremap = true }) vim.keymap.set("i", "", ":m .-2==gi", { noremap = true }) -- Diagnostics ! -vim.keymap.set("n", "", function() - require("trouble").toggle() -end) -vim.keymap.set("n", "d", function() - vim.diagnostic.open_float() -end) -vim.keymap.set("n", "dn", function() - vim.diagnostic.goto_next() -end) -vim.keymap.set("n", "dp", function() - vim.diagnostic.goto_prev() -end) +vim.keymap.set('n', '', function() require('trouble').toggle() end ) +vim.keymap.set('n', 'd', function () vim.diagnostic.open_float() end ) +vim.keymap.set('n', 'dn', function () vim.diagnostic.goto_next() end ) +vim.keymap.set('n', 'dp', function () vim.diagnostic.goto_prev() end ) +vim.keymap.set('n', '', function () vim.lsp.buf.code_action() end) -- Debugging vim.keymap.set("n", "sb", function() diff --git a/lua/barink/plugins/Oil.lua b/lua/barink/plugins/Oil.lua new file mode 100644 index 0000000..a9acfc0 --- /dev/null +++ b/lua/barink/plugins/Oil.lua @@ -0,0 +1,14 @@ +return { + { + "stevearc/oil.nvim", + opt = { + default_file_explorer = false + }, + dependencies = { + 'nvim-tree/nvim-web-devicons' + }, + config = function () + vim.keymap.set("n", "-", "Oil", { desc= "Open parent directory"}) + end + } +} diff --git a/lua/barink/plugins/codellama.lua b/lua/barink/plugins/codellama.lua deleted file mode 100644 index e4987cd..0000000 --- a/lua/barink/plugins/codellama.lua +++ /dev/null @@ -1,17 +0,0 @@ -return { - { - 'David-kunz/gen.nvim', - opts = { - model = "codellama:7b", - host = "localhost", - port = "11434", - quit_mape = "q", - init = function (options) pcall(io.popen("ollama serve > /dev/null 2>&1 &)")) end, - display_mode = "split", - command =function (options) - local body = {model = options.model, stream=true} - return "curl --silent --no-buffer -X POST http://" .. options.host .. ':' .. options.port .. "/api/chat -d $body" - end, - }, - } -} diff --git a/lua/barink/plugins/comments.lua b/lua/barink/plugins/comments.lua index b461041..ed2b9c0 100644 --- a/lua/barink/plugins/comments.lua +++ b/lua/barink/plugins/comments.lua @@ -1,11 +1,9 @@ return { 'numToStr/Comment.nvim', - opts = { - -- add any options here - }, - config = function () - require("Comment").setup() - end, lazy = false, + opts = { + }, + config = function() + require("Comment").setup() + end } - diff --git a/lua/barink/plugins/conform.lua b/lua/barink/plugins/conform.lua index d0992cc..fecf484 100644 --- a/lua/barink/plugins/conform.lua +++ b/lua/barink/plugins/conform.lua @@ -1,18 +1,35 @@ return { - "stevearc/conform.nvim", - opts = {}, - config = function() - require("conform").setup({ - formatters_by_ft = { - lua = { "stylua" }, - javascript = { { "prettierd", "prettier" } }, - }, - }) - vim.api.nvim_create_autocmd("BufWritePre", { - pattern = "*", - callback = function(args) - require("conform").format({ buffer = args.buf }) - end, - }) - end, + "stevearc/conform.nvim", + event = { "BufWritePre"}, + cmd = { "ConformInfo"}, + opts = { + formatters_by_ft = { + php = { "pint"}, + lua = { "stylua"}, + javascript = { "prettierd", "prettier", stop_after_first = true }, + typescript = { "prettierd", "prettier", stop_after_first = true }, + }, + format_on_save = { timeout_ms = 500 }, + default_format_ops = { + lsp_format = "fallback" + }, + }, + config = function () + require("conform").setup() + -- Command to run async formatting + vim.api.nvim_create_user_command("Format", function(args) + local range = nil + if args.count ~= -1 then + local end_line = vim.api.nvim_buf_get_lines(0, args.line2 - 1, args.line2, true)[1] + range = { + start = { args.line1, 0 }, + ["end"] = { args.line2, end_line:len() }, + } + end + require("conform").format({ async = true, lsp_format = "fallback", range = range }) + end, { range = true }) + + + end } + diff --git a/lua/barink/plugins/dadbod-ui.lua b/lua/barink/plugins/dadbod-ui.lua new file mode 100644 index 0000000..e3565ef --- /dev/null +++ b/lua/barink/plugins/dadbod-ui.lua @@ -0,0 +1,16 @@ +return { + "kristijanhusak/vim-dadbod-ui", + dependencies = { + {'tpope/vim-dadbod', lazy = true }, + { 'kristijanhusak/vim-dadbod-completion', ft = { 'sql', 'mysql', 'plsql'}, lazy = true }, + }, + cmd = { + 'DBUI', + 'DBUIToggle', + 'DBUIAddConnection', + 'DBUIFindBuffer', + }, + init = function () + vim.g.db_ui_use_nerd_fonts = 1 + end +} diff --git a/lua/barink/plugins/dap.lua b/lua/barink/plugins/dap.lua index a7ddf18..0552b34 100644 --- a/lua/barink/plugins/dap.lua +++ b/lua/barink/plugins/dap.lua @@ -22,13 +22,52 @@ return { }, config = function () local dap = require('dap') + dap.configurations.cpp = { + { + name = "Launch", + type= "codelldb", + request = "launch", + program = function () + return vim.fn.input('Path to executable: ', vim.fn.getcwd() , 'file') + end, + cwd = '${workspaceFolder}/Framework', + stopOnEntry = false, + } + } + dap.adapters.lldb = { + type = 'executable', + command = "C:\\Program Files\\LLVM\\bin\\lldb-dap.exe", + name = 'lldb' + } + + -- Zig configuration + dap.configurations.zig = { + name = 'launch', + type= 'lldb', + request = 'launch', + program = '${workspaceFolder}/zig-out/bin/tests.exe', + cwd = '${workspaceFolder}', + } + -- Java configuration + -- See also ftplugin dap.configurations.java = { { - type = 'java'; - request = 'launch'; - name = "Launch file"; - program = "java ${file}"; + type = 'java', + request = 'launch', + name = "Launch file", + program = "java ${file}", }} + dap.configurations.cpp = {{ + name="launch", + type="lldb", + request="launch", + program = function () + return vim.fn.input('Path to executable: ', vim.fn.getcwd() ..'/', 'file') + end, + cwd = '${workspaceFolder}', + stopOnEntry = false, + args = {}, + }} dap.configurations.go = { { type = "delve", @@ -60,6 +99,14 @@ return { args = {'dap', '-l', '127.0.0.1:${port}'}, } } + dap.adapters.codelldb = { + type= 'server', + port = '${port}', + executable = { + command = 'C:/Users/Nigel/Appdata/Local/nvim-data/mason/bin/codelldb.cmd', + args = {"--port", "${port}"} + } + } end } } diff --git a/lua/barink/plugins/edgy.lua b/lua/barink/plugins/edgy.lua new file mode 100644 index 0000000..f387301 --- /dev/null +++ b/lua/barink/plugins/edgy.lua @@ -0,0 +1,29 @@ +return { + "folke/edgy.nvim", + event = "VeryLazy", + opts= { + bottom ={ + { + ft = "toggleterm", + size = { height = 0.4 }, + filter = function (_, win) + return vim.api.nvim_win_get_config(win).relative == "" + end, + }, + { + ft = "lazyterm", + title = "Lazyterm", + size = { height = 0.4 }, + filter = function(buf, _) + return not vim.b[buf].lazyterm_cmd + end + } + }, + init = function () + vim.opt.laststatus = 3 + vim.opt.splitkeep = "screen" + end, + } +} + + diff --git a/lua/barink/plugins/fidget.lua b/lua/barink/plugins/fidget.lua deleted file mode 100644 index d534814..0000000 --- a/lua/barink/plugins/fidget.lua +++ /dev/null @@ -1,8 +0,0 @@ -return { - "j-hui/fidget.nvim", - opts = { - notification = { - window = { winblend = 0}, - }, - }, - } diff --git a/lua/barink/plugins/git-worktree.lua b/lua/barink/plugins/git-worktree.lua index 18d2a07..0651b59 100644 --- a/lua/barink/plugins/git-worktree.lua +++ b/lua/barink/plugins/git-worktree.lua @@ -1,10 +1,14 @@ return { - 'ThePrimeagen/git-worktree.nvim', - dependencies = { - 'nvim-telescope/telescope.nvim' - }, - init = function() - require("git-worktree").setup() - require("telescope").load_extension("git_worktree") - end + { + 'ThePrimeagen/git-worktree.nvim', + dependencies = { + 'nvim-telescope/telescope.nvim', + }, + opts = {}, + init = function () + require("git-worktree").setup() + require("telescope").load_extension("git_worktree") + end + } } + diff --git a/lua/barink/plugins/gitsigns.lua b/lua/barink/plugins/gitsigns.lua new file mode 100644 index 0000000..4a7e525 --- /dev/null +++ b/lua/barink/plugins/gitsigns.lua @@ -0,0 +1,4 @@ +return { + 'lewis6991/gitsigns.nvim', + opt = {} +} diff --git a/lua/barink/plugins/lsp.lua b/lua/barink/plugins/lsp.lua index 6714af0..a5623a7 100644 --- a/lua/barink/plugins/lsp.lua +++ b/lua/barink/plugins/lsp.lua @@ -1,56 +1,54 @@ -return { - "neovim/nvim-lspconfig", - dependencies = { - "williamboman/mason-lspconfig", - "williamboman/mason.nvim", - "hrsh7th/cmp-nvim-lsp", - "hrsh7th/cmp-buffer", - "hrsh7th/cmp-path", - "hrsh7th/cmp-cmdline", - "hrsh7th/nvim-cmp", - { - "L3MON4D3/LuaSnip", - dependencies = "hrsh7th/nvim-cmp", - version = "v2.*", - }, - { "mfussenegger/nvim-jdtls", dependencies = { "nvim-dap" } }, - { - "olrtg/nvim-emmet", - config = function() - vim.keymap.set({ "n", "v" }, "xe", require("nvim-emmet").wrap_with_abbreviation) - end, - }, - }, - config = function() - require("mason").setup() - require("mason-lspconfig").setup({ - ensure_installed = { "lua_ls", "bashls", "rust_analyzer" }, - }) - local cmp = require("cmp") - cmp.setup({ - snippet = { - expand = function(args) - require("luasnip").lsp_expand(args.body) - end, - }, - mapping = cmp.mapping.preset.insert({ - [""] = cmp.mapping.scroll_docs(-4), - [""] = cmp.mapping.scroll_docs(4), - [""] = cmp.mapping.complete(), - [""] = cmp.mapping.abort(), - [""] = cmp.mapping.confirm({ select = true }), -- Accept currently selected item. Set `select` to `false` to only confirm explicitly selected items. - }), - sources = cmp.config.sources({ - { name = "path" }, - { name = "nvim_lsp", keyword_length = 1 }, - { name = "luasnip", option = { show_autosnippets = true } }, - }, { - { name = "buffer", keyword_length = 2 }, - }), - window = { - documentation = cmp.config.window.bordered(), - }, - }) +return + { + 'neovim/nvim-lspconfig', + dependencies = { + { + "folke/neoconf.nvim", + opts = {} + }, + "williamboman/mason-lspconfig", + "williamboman/mason.nvim", + "hrsh7th/cmp-nvim-lsp", + "hrsh7th/cmp-buffer", + "hrsh7th/cmp-path", + "hrsh7th/cmp-cmdline", + "hrsh7th/nvim-cmp", + { + 'L3MON4D3/LuaSnip', + dependencies = 'hrsh7th/nvim-cmp', + version = "v2.*", + }, + {'mfussenegger/nvim-jdtls', dependencies = {'nvim-dap'}}, + }, + config = function() + require("mason").setup() + require("mason-lspconfig").setup({ + ensure_installed = { "lua_ls", "bashls", "rust_analyzer" } + }) + local cmp = require('cmp') + cmp.setup({ + snippet = { + expand = function(args) + require('luasnip').lsp_expand(args.body) + end, + }, + mapping = cmp.mapping.preset.insert({ + [''] = cmp.mapping.scroll_docs(-4), + [''] = cmp.mapping.scroll_docs(4), + [''] = cmp.mapping.complete(), + [''] = cmp.mapping.abort(), + [''] = cmp.mapping.confirm({ select = true }), -- Accept currently selected item. Set `select` to `false` to only confirm explicitly selected items. + }), + sources = cmp.config.sources({ + { name = 'nvim_lsp', keyword_length = 1 }, + { name = 'luasnip', option = { show_autosnippets = true}}, + { name = 'path' }, + }, { + { name = 'buffer', keyword_length = 2 }, + }), + window = { + documentation = cmp.config.window.bordered() + }, -- Set configuration for specific filetype. cmp.setup.filetype("gitcommit", { @@ -82,7 +80,12 @@ return { local lsp = require("lspconfig") - lsp.emmet_language_server.setup({}) + local ls = require("luasnip") + ls.config.set_config({ + history = true, + updateevents = "TextChanged, TextChangedI", + enable_autosnippets = true, + }) lsp.lua_ls.setup({ capabilities = require("cmp_nvim_lsp").default_capabilities(), @@ -101,51 +104,82 @@ return { enable_autosnippets = true, }) - vim.keymap.set({ "i", "s" }, "", function() - ls.expand() - end, { silent = true }) - vim.keymap.set({ "i", "s" }, "", function() - ls.jump(1) - end, { silent = true }) - vim.keymap.set({ "i", "s" }, "", function() - ls.jump(-1) - end, { silent = true }) - vim.keymap.set({ "i", "s" }, "", function() - if ls.choice_active() then - ls.change_choice(1) - end - end, { silent = true }) + require("luasnip.loaders.from_lua").load({paths= "~/.config/nvim/lua/barink/snippets"}) - require("luasnip.loaders.from_lua").load({ paths = "C:\\Users\\nigel\\AppData\\Local\\nvim\\lua\\snippets" }) - -- Set up lspconfig. - local capabilities = require("cmp_nvim_lsp").default_capabilities() + -- Set up lspconfig. + local capabilities = require("cmp_nvim_lsp").default_capabilities() + local lsp = require("lspconfig") - require("lspconfig")["asm_lsp"].setup({ - capabilities = capabilities, - }) + local language_server = { + asm_lsp= true, + zls = true, + emmet_language_server = true, + rust_analyzer = true, + jdtls = true, + pylsp = true, + phpactor = { + init_options = { + ["language_server_phpstan.enabled"] = false, + ["language_server_psalm.enabled"] = false, + } + }, + clangd = { + capabilities = capabilities, + root_dir = require('lspconfig').util.root_pattern("compile_commands.json", "compile_flags.txt", ".git"), + cmd = {"clangd"}, + filetypes = { "c", "cpp", "objc", "objcpp"}, + settings = { + clangd = { + compilationDatabasePath = "compile-commands.json", + }, + } + }, + ts_ls = true, + gopls = true, + intelephense = true, + lua_ls = { + settings = { + Lua = { + diagnostics = { + globals = { 'vim'} + } + } + } + }, + } - require("lspconfig")["zls"].setup({ - capabilities = capabilities, - }) + for name, config in pairs(language_server) do + if config == true then + config = {} + end + config = vim.tbl_deep_extend("force", {}, { capabilities = capabilities }, config) + lsp[name].setup({}) + end + vim.api.nvim_create_autocmd("LspAttach", { + callback = function (args) + local client = assert(vim.lsp.get_client_by_id(args.data.client_id), "must have valid client") - require("lspconfig")["rust_analyzer"].setup({ - capabilities = capabilities, - }) + local settings = language_server[client.name] + if type(settings) ~= "table" then + settings = {} + end - require("lspconfig")["jdtls"].setup({ - capabilities = capabilities, - }) + local builtin = require "telescope.builtin" - require("lspconfig")["bashls"].setup({ - capabilities = capabilities, - }) + vim.opt_local.omnifunc = "v:lua.vim.lsp.omnifunc" + vim.keymap.set("n", "gd", builtin.lsp_definitions, {buffer = -1}) + vim.keymap.set("n", "gr", builtin.lsp_references, {buffer = -1}) + vim.keymap.set("n", "gD", vim.lsp.buf.declaration, {buffer = -1}) + vim.keymap.set("n", "gT", vim.lsp.buf.type_definition, {buffer = -1}) + vim.keymap.set("n", "K", vim.lsp.buf.hover, {buffer = -1}) - require("lspconfig")["tsserver"].setup({ - capabilities = capabilities, - }) - require("lspconfig")["gopls"].setup({ - capabilities = capabilities, - }) + vim.keymap.set("n", "cr", vim.lsp.buf.rename, {buffer =-1}) + vim.keymap.set("n", "ca", vim.lsp.buf.code_action, {buffer = -1}) + vim.keymap.set("n", "wd", builtin.lsp_document_symbols, {buffer = -1}) + + + end + }) end, } diff --git a/lua/barink/plugins/neo-tree.lua b/lua/barink/plugins/neo-tree.lua new file mode 100644 index 0000000..5d1acc2 --- /dev/null +++ b/lua/barink/plugins/neo-tree.lua @@ -0,0 +1,9 @@ +return { + "nvim-neo-tree/neo-tree.nvim", + branch = "v3.x", + dependencies = { + "nvim-lua/plenary.nvim", + "nvim-tree/nvim-web-devicons", + "MunifTanjim/nui.nvim" + }, +} diff --git a/lua/barink/plugins/noice.lua b/lua/barink/plugins/noice.lua new file mode 100644 index 0000000..61ebecf --- /dev/null +++ b/lua/barink/plugins/noice.lua @@ -0,0 +1,11 @@ +return { + "folke/noice.nvim", + event = "VeryLazy", + opts = { + }, + dependencies = { + "MunifTanjim/nui.nvim", + "rcarriga/nvim-notify", + }, + +} diff --git a/lua/barink/plugins/oil.lua b/lua/barink/plugins/oil.lua index e1b0f0a..a9acfc0 100644 --- a/lua/barink/plugins/oil.lua +++ b/lua/barink/plugins/oil.lua @@ -1,14 +1,14 @@ return { - 'stevearc/oil.nvim', - opts = {}, - dependencies = {"nvim-tree/nvim-web-devicons"}, - config = function () - require("oil").setup( - { - default_file_explorer=false - } - ) - vim.keymap.set("n", "-", "Oil", { desc = "Open parent directory"}) - - end + { + "stevearc/oil.nvim", + opt = { + default_file_explorer = false + }, + dependencies = { + 'nvim-tree/nvim-web-devicons' + }, + config = function () + vim.keymap.set("n", "-", "Oil", { desc= "Open parent directory"}) + end + } } diff --git a/lua/barink/plugins/telescope.lua b/lua/barink/plugins/telescope.lua index 52cd44e..eaa0654 100644 --- a/lua/barink/plugins/telescope.lua +++ b/lua/barink/plugins/telescope.lua @@ -6,15 +6,7 @@ return { {'nvim-lua/plenary.nvim'}, { 'nvim-telescope/telescope-fzf-native.nvim', - build = function () if os == 'Windows_NT' then - print("You are on Windows, Idiot!!!") - return [[ - cmake -S. -Bbuild -DCMAKE_BUILD_TYPE=Release - && cmake --build build --config Release - && cmake --install build --prefix build - ]] else - return 'make' end - end, + build ="cmake -S. -Bbuild -DCMAKE_BUILD_TYPE=Release && cmake --build build --config Release && cmake --install build --prefix build", } }, config = function() @@ -22,8 +14,15 @@ return { require('telescope').load_extension('fzf') local builtin = require('telescope.builtin') - vim.keymap.set('n', 'ff', builtin.find_files, {}) - vim.keymap.set('n', 'fs', builtin.git_files, {}) + vim.keymap.set('n', 'fd', builtin.find_files, {}) + vim.keymap.set('n', 'ft', builtin.git_files, {}) + vim.keymap.set('n', 'fh', builtin.help_tags) + vim.keymap.set('n', 'fb', builtin.buffers) + vim.keymap.set('n', '/', builtin.current_buffer_fuzzy_find) + vim.keymap.set('n', 'gw', builtin.grep_string) + vim.keymap.set('n', 'fp',function () + builtin.find_files { cwd = "~/AppData/Local/nvim/lua/barink/"} + end) end } } diff --git a/lua/barink/plugins/theme.lua b/lua/barink/plugins/theme.lua new file mode 100644 index 0000000..6c5e379 --- /dev/null +++ b/lua/barink/plugins/theme.lua @@ -0,0 +1,30 @@ +-- return { +-- "folke/tokyonight.nvim", +-- lazy = false, +-- priority = 1000, +-- opts = {}, +-- config = function() +-- require("tokyonight").setup({ +-- style = "night", +-- light_style = "day", +-- transparent = true, +-- terminal_colors = true, +-- dim_inactive = false, +-- lualine_bold = false, +-- }) +-- +-- vim.cmd [[colorscheme tokyonight]] +-- end +-- } + +return { + { + "catppuccin/nvim", + name="catppuccin", + priority=1000, + config = function () + require("catppuccin").setup() + vim.cmd.colorscheme('catppuccin') + end + } +} diff --git a/lua/barink/plugins/todo-comments.lua b/lua/barink/plugins/todo-comments.lua new file mode 100644 index 0000000..8702948 --- /dev/null +++ b/lua/barink/plugins/todo-comments.lua @@ -0,0 +1,8 @@ +return { + "folke/todo-comments.nvim", + dependencies = { + "nvim-lua/plenary.nvim" + }, + opts = { + } +} diff --git a/lua/barink/plugins/tokyonight.lua b/lua/barink/plugins/tokyonight.lua deleted file mode 100644 index a5fef0d..0000000 --- a/lua/barink/plugins/tokyonight.lua +++ /dev/null @@ -1,18 +0,0 @@ -return { - "folke/tokyonight.nvim", - lazy = false, - priority = 1000, - opts = {}, - config = function() - require("tokyonight").setup({ - style = "night", - light_style = "day", - transparent = true, - terminal_colors = true, - dim_inactive = false, - lualine_bold = false, - }) - - vim.cmd [[colorscheme tokyonight]] - end - } diff --git a/lua/barink/plugins/treesitter.lua b/lua/barink/plugins/treesitter.lua index 0b0b99e..90dff70 100644 --- a/lua/barink/plugins/treesitter.lua +++ b/lua/barink/plugins/treesitter.lua @@ -1,14 +1,33 @@ return { + { "nvim-treesitter/nvim-treesitter", build = ":TSUpdate", + dependencies = { + { + "nvim-treesitter/playground", + }, + }, config = function() + require 'nvim-treesitter.install'.compilers = {'clang'} local configs = require("nvim-treesitter.configs") configs.setup({ - ensure_installed = { "c", "lua", "vim", "vimdoc", "bash" }, + playground = { + enable = true, + disable = {}, + updatetime = 25, + keybindings = { + toggle_query_editor = 'o', + toggle_hl_groups = 'i', + update = 'R', + show_help = '?' + } + }, + ensure_installed = { "python", "c", "lua", "vim", "vimdoc", "bash" }, sync_install = false, highlight = { enable = true }, indent = { enable = true }, }) end - } + }, + } diff --git a/lua/barink/plugins/twilight.lua b/lua/barink/plugins/twilight.lua new file mode 100644 index 0000000..9dab6c3 --- /dev/null +++ b/lua/barink/plugins/twilight.lua @@ -0,0 +1,6 @@ +return { + { + "folke/twilight.nvim", + opts = {} + } +} diff --git a/lua/barink/plugins/undotree.lua b/lua/barink/plugins/undotree.lua index c04453f..288e38d 100644 --- a/lua/barink/plugins/undotree.lua +++ b/lua/barink/plugins/undotree.lua @@ -1 +1,6 @@ -return { "mbbill/undotree" } +return { + "mbbill/undotree", + config = function () + vim.keymap.set('n', '', vim.cmd.UndotreeToggle) + end +} diff --git a/lua/barink/plugins/vim-dadbod.lua b/lua/barink/plugins/vim-dadbod.lua index 5a7c4ed..e536dc5 100644 --- a/lua/barink/plugins/vim-dadbod.lua +++ b/lua/barink/plugins/vim-dadbod.lua @@ -1,4 +1,9 @@ return { +<<<<<<< HEAD 'tpope/vim-dadbod', } +======= + "tpope/vim-dadbod", +} +>>>>>>> Windows diff --git a/lua/barink/plugins/vimbegood.lua b/lua/barink/plugins/vimbegood.lua new file mode 100644 index 0000000..16f6b70 --- /dev/null +++ b/lua/barink/plugins/vimbegood.lua @@ -0,0 +1,4 @@ +return { + 'ThePrimeagen/vim-be-good', +} + diff --git a/lua/barink/plugins/which-key.lua b/lua/barink/plugins/which-key.lua new file mode 100644 index 0000000..4696062 --- /dev/null +++ b/lua/barink/plugins/which-key.lua @@ -0,0 +1,15 @@ +return { + "folke/which-key.nvim", + event = "VeryLazy", + opts = { + }, + keys = { + { + "?", + function() + require("which-key").show({global = false}) + end, + desc = "Buffer Local Keymaps (which-key)", + } + } +} diff --git a/lua/barink/plugins/zen-mode.lua b/lua/barink/plugins/zen-mode.lua new file mode 100644 index 0000000..eb74732 --- /dev/null +++ b/lua/barink/plugins/zen-mode.lua @@ -0,0 +1,4 @@ +return { + "folke/zen-mode.nvim", + opts = {} +} diff --git a/lua/snippets/all.lua b/lua/barink/snippets/all.lua similarity index 100% rename from lua/snippets/all.lua rename to lua/barink/snippets/all.lua diff --git a/lua/snippets/java.lua b/lua/barink/snippets/java.lua similarity index 100% rename from lua/snippets/java.lua rename to lua/barink/snippets/java.lua diff --git a/lua/snippets/lua.lua b/lua/barink/snippets/lua.lua similarity index 100% rename from lua/snippets/lua.lua rename to lua/barink/snippets/lua.lua diff --git a/lua/barink/vim.lua b/lua/barink/vim.lua index 8b73673..4f5a67a 100644 --- a/lua/barink/vim.lua +++ b/lua/barink/vim.lua @@ -35,3 +35,15 @@ vim.api.nvim_create_autocmd('LspAttach', { end, }) +--[[ +-- Run zig test on save +-- TODO: fix vim.cmd call +-- TODO: only do this when a zig test file is open +vim.api.nvim_create_autocmd('BufWritePost' , { + callback = function () + vim.cmd{cmd = '!zig' , args= {'test', vim.fn.expand('%')} } + end +})]]-- + + +