diff --git a/lazy-lock.json b/lazy-lock.json index 712541d..ca3975a 100644 --- a/lazy-lock.json +++ b/lazy-lock.json @@ -13,6 +13,7 @@ "gitsigns.nvim": { "branch": "main", "commit": "863903631e676b33e8be2acb17512fdc1b80b4fb" }, "harpoon": { "branch": "harpoon2", "commit": "0378a6c428a0bed6a2781d459d7943843f374bce" }, "lazy.nvim": { "branch": "main", "commit": "460e1cd8f24e364d54543a4b0e83f6f4ec1f65fb" }, + "lspkind.nvim": { "branch": "master", "commit": "59c3f419af48a2ffb2320cea85e44e5a95f71664" }, "lualine.nvim": { "branch": "master", "commit": "b431d228b7bbcdaea818bdc3e25b8cdbe861f056" }, "mason-lspconfig": { "branch": "main", "commit": "25c11854aa25558ee6c03432edfa0df0217324be" }, "mason.nvim": { "branch": "main", "commit": "e2f7f9044ec30067bc11800a9e266664b88cda22" }, diff --git a/lua/barink/init.lua b/lua/barink/init.lua index 86db5db..8fea857 100644 --- a/lua/barink/init.lua +++ b/lua/barink/init.lua @@ -1,5 +1,4 @@ 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({ @@ -12,5 +11,5 @@ if not vim.loop.fs_stat(lazypath) then }) end vim.opt.rtp:prepend(lazypath) - +require("barink.keys") require("lazy").setup("barink.plugins") diff --git a/lua/barink/keys.lua b/lua/barink/keys.lua index d2ba03f..0edea92 100644 --- a/lua/barink/keys.lua +++ b/lua/barink/keys.lua @@ -21,16 +21,27 @@ 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', '', function() require('trouble').toggle('diagnostics') 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) +vim.keymap.set('n', 'ca', function () vim.lsp.buf.code_action() end) -- Debugging -vim.keymap.set('n', 'sb', function () require('dap').toggle_breakpoint() end ) -vim.keymap.set('n', 'db', function () require('dapui').toggle() end ) +vim.keymap.set('n', 'b', function () require('dap').toggle_breakpoint() end ) vim.keymap.set('n', '', function () print("Start debug session" ) require('dap').continue() end ) vim.keymap.set('n', '', function () require('dap').step_over() end ) vim.keymap.set('n', '', function () require('dap').step_into() end ) vim.keymap.set('n', '=',":Gen Generate") + +-- Easily hit escape in terminal mode. +vim.keymap.set("t", "", "") + +-- Open a terminal at the bottom of the screen with a fixed height. +vim.keymap.set("n", ",st", function() + vim.cmd.new() + vim.cmd.wincmd "J" + vim.api.nvim_win_set_height(0, 12) + vim.wo.winfixheight = true + vim.cmd.term() +end) diff --git a/lua/barink/plugins/dap.lua b/lua/barink/plugins/dap.lua index ac5c5e2..5ec7d1e 100644 --- a/lua/barink/plugins/dap.lua +++ b/lua/barink/plugins/dap.lua @@ -106,6 +106,20 @@ return { args = {'dap', '-l', '127.0.0.1:${port}'}, } } + local dap = require("dap") + local ui = require("dapui") + dap.listeners.before.attach.dapui_config = function() + ui.open() + end + dap.listeners.before.launch.dapui_config = function() + ui.open() + end + dap.listeners.before.event_terminated.dapui_config = function() + ui.close() + end + dap.listeners.before.event_exited.dapui_config = function() + ui.close() + end end } } diff --git a/lua/barink/plugins/lsp.lua b/lua/barink/plugins/lsp.lua index a73d11b..c8ff0b3 100644 --- a/lua/barink/plugins/lsp.lua +++ b/lua/barink/plugins/lsp.lua @@ -19,8 +19,11 @@ return version = "v2.*", }, {'mfussenegger/nvim-jdtls', dependencies = {'nvim-dap'}}, + "onsails/lspkind.nvim", }, config = function() + vim.opt.completeopt = { "menu", "menuone", "noselect", "preview"} + require("lspkind").init({}) require("mason").setup() require("mason-lspconfig").setup({ ensure_installed = { "lua_ls", "bashls", "rust_analyzer" } @@ -32,7 +35,16 @@ return enable_autosnippets = true, }) local cmp = require('cmp') + local lspkind = require("lspkind") cmp.setup({ + formatting = { + format = lspkind.cmp_format({ + mode = 'symbol', + maxwidth = 60, + ellipsis_char = '...', + show_labelDetails = true, + }), + }, snippet = { expand = function(args) require('luasnip').lsp_expand(args.body) @@ -132,10 +144,21 @@ return gopls = true, intelephense = true, lua_ls = { - settings = { - Lua = { - diagnostics = { - globals = { 'vim'} + config = { + settings = { + Lua = { + runtime = { + version = 'LuaJIT', + }, + workspace = { + checkThirdParty= false, + library = { + vim.env.VIMRUNTIME + } + }, +-- diagnostics = { +-- globals = { 'vim'} +-- } } } } diff --git a/lua/barink/vim.lua b/lua/barink/vim.lua index 4f5a67a..e42b000 100644 --- a/lua/barink/vim.lua +++ b/lua/barink/vim.lua @@ -25,7 +25,7 @@ vim.g.netrw_browse_split = 0 vim.g.netrw_winsize = 25 vim.opt.completeopt = {'menu', 'menuone', 'noselect' } - +vim.opt.inccommand = 'split' vim.api.nvim_create_autocmd('LspAttach', { callback = function (args) local client = vim.lsp.get_client_by_id(args.data.client_id)