Further LSP configuration
This commit is contained in:
parent
d7101c6952
commit
b71257d2e3
87
init.lua
87
init.lua
|
|
@ -6,6 +6,7 @@ vim.g.maplocalleader = " "
|
|||
vim.cmd("map <C-x> <Space>")
|
||||
vim.cmd("map <C-g> <Esc>")
|
||||
vim.cmd("imap <C-g> <Esc>")
|
||||
vim.cmd("lmap <C-g> <Esc>")
|
||||
vim.cmd("map <C-c> <Nop>")
|
||||
|
||||
-- Lazy plugin manager
|
||||
|
|
@ -62,7 +63,15 @@ vim.api.nvim_create_autocmd({ 'BufEnter', 'BufNewFile' }, {
|
|||
|
||||
|
||||
-- LSP Configuration
|
||||
require('lsp-zero')
|
||||
local lsp_zero = require('lsp-zero')
|
||||
-- https://lsp-zero.netlify.app/v3.x/language-server-configuration.html#default-keybindings
|
||||
lsp_zero.on_attach(function(client, bufnr)
|
||||
lsp_zero.default_keymaps({
|
||||
buffer = bufnr,
|
||||
preserve_mappings = false
|
||||
})
|
||||
end)
|
||||
|
||||
local lspconfig = require('lspconfig')
|
||||
lspconfig.lua_ls.setup({})
|
||||
lspconfig.bashls.setup({})
|
||||
|
|
@ -119,6 +128,40 @@ lspconfig.jsonls.setup {
|
|||
capabilities = capabilities,
|
||||
}
|
||||
|
||||
local cmp = require('cmp')
|
||||
cmp.setup({
|
||||
sources = {
|
||||
{name = 'nvim_lsp'},
|
||||
},
|
||||
mapping = {
|
||||
['<Tab>'] = cmp.mapping.confirm({select = true}),
|
||||
['<C-e>'] = cmp.mapping.abort(),
|
||||
['<Up>'] = cmp.mapping.select_prev_item({behavior = 'select'}),
|
||||
['<C-k>'] = cmp.mapping.select_prev_item({behavior = 'select'}),
|
||||
['<Down>'] = cmp.mapping.select_next_item({behavior = 'select'}),
|
||||
['<C-j>'] = cmp.mapping.select_next_item({behavior = 'select'}),
|
||||
['<C-p>'] = cmp.mapping(function()
|
||||
if cmp.visible() then
|
||||
cmp.select_prev_item({behavior = 'insert'})
|
||||
else
|
||||
cmp.complete()
|
||||
end
|
||||
end),
|
||||
['<C-n>'] = cmp.mapping(function()
|
||||
if cmp.visible() then
|
||||
cmp.select_next_item({behavior = 'insert'})
|
||||
else
|
||||
cmp.complete()
|
||||
end
|
||||
end),
|
||||
},
|
||||
snippet = {
|
||||
expand = function(args)
|
||||
require('luasnip').lsp_expand(args.body)
|
||||
end,
|
||||
},
|
||||
})
|
||||
|
||||
-- DAP Configuration
|
||||
local dap = require("dap")
|
||||
local dapwidgets = require("dap.ui.widgets")
|
||||
|
|
@ -179,6 +222,34 @@ dap.configurations.c = {
|
|||
stopAtBeginningOfMainSubprogram = false,
|
||||
},
|
||||
}
|
||||
|
||||
-- Discord Rich Presence
|
||||
-- The setup config table shows all available config options with their default values:
|
||||
-- require("neocord").setup({
|
||||
-- -- General options
|
||||
-- logo = "auto", -- "auto" or url
|
||||
-- logo_tooltip = nil, -- nil or string
|
||||
-- main_image = "language", -- "language" or "logo"
|
||||
-- client_id = "1157438221865717891", -- Use your own Discord application client id (not recommended)
|
||||
-- log_level = "debug", -- Log messages at or above this level (one of the following: "debug", "info", "warn", "error")
|
||||
-- debounce_timeout = 10, -- Number of seconds to debounce events (or calls to `:lua package.loaded.presence:update(<filename>, true)`)
|
||||
-- blacklist = {}, -- A list of strings or Lua patterns that disable Rich Presence if the current file name, path, or workspace matches
|
||||
-- file_assets = {}, -- Custom file asset definitions keyed by file names and extensions (see default config at `lua/presence/file_assets.lua` for reference)
|
||||
-- show_time = true, -- Show the timer
|
||||
-- global_timer = false, -- if set true, timer won't update when any event are triggered
|
||||
--
|
||||
-- -- Rich Presence text options
|
||||
-- editing_text = "Editing %s", -- Format string rendered when an editable file is loaded in the buffer (either string or function(filename: string): string)
|
||||
-- file_explorer_text = "Browsing %s", -- Format string rendered when browsing a file explorer (either string or function(file_explorer_name: string): string)
|
||||
-- git_commit_text = "Committing changes", -- Format string rendered when committing changes in git (either string or function(filename: string): string)
|
||||
-- plugin_manager_text = "Managing plugins", -- Format string rendered when managing plugins (either string or function(plugin_manager_name: string): string)
|
||||
-- reading_text = "Reading %s", -- Format string rendered when a read-only or unmodifiable file is loaded in the buffer (either string or function(filename: string): string)
|
||||
-- workspace_text = "Working on %s", -- Format string rendered when in a git repository (either string or function(project_name: string|nil, filename: string): string)
|
||||
-- line_number_text = "Line %s out of %s", -- Format string rendered when `enable_line_number` is set to true (either string or function(line_number: number, line_count: number): string)
|
||||
-- terminal_text = "Using Terminal", -- Format string rendered when in terminal mode.
|
||||
-- })
|
||||
|
||||
|
||||
-- Remake of emacs which-key mode, I'll add all custom keybinds here
|
||||
-- TODO: The DAP related functions should be moved into their own respective file/modularised better!
|
||||
require("which-key").add ({
|
||||
|
|
@ -209,8 +280,8 @@ require("which-key").add ({
|
|||
-- LSP/DAP Options
|
||||
{
|
||||
mode = { "n", "v" }, -- NORMAL and VISUAL mode
|
||||
{ "<C-c>lb", function() dap.toggle_breakpoint() end, desc = "Debugger: Toggle breakpoint" },
|
||||
{ "<C-c>ld", function()
|
||||
{ "<C-c>db", function() dap.toggle_breakpoint() end, desc = "Debugger: Toggle breakpoint" },
|
||||
{ "<C-c>dd", function()
|
||||
if daprunning == false then
|
||||
if pcall(function() dap.continue() end) then
|
||||
dapInit()
|
||||
|
|
@ -222,7 +293,7 @@ require("which-key").add ({
|
|||
print("Debugger already running!")
|
||||
end
|
||||
end, desc = "Debugger: Run" },
|
||||
{ "<C-c>lD", function()
|
||||
{ "<C-c>dD", function()
|
||||
if daprunning == false then
|
||||
if pcall(function() dap.run_last() end) then
|
||||
dapInit()
|
||||
|
|
@ -235,7 +306,7 @@ require("which-key").add ({
|
|||
print("Debugger already running!")
|
||||
end
|
||||
end, desc = "Debugger: Run last configuration again" },
|
||||
{ "<C-c>ls", function()
|
||||
{ "<C-c>ds", function()
|
||||
if daprunning == true then
|
||||
if pcall(function() dap.terminate() end) then
|
||||
dapCleanup()
|
||||
|
|
@ -247,7 +318,7 @@ require("which-key").add ({
|
|||
print("Debugger is not running!")
|
||||
end
|
||||
end, desc = "Debugger: Stop" },
|
||||
{ "<C-c>lr", function()
|
||||
{ "<C-c>dr", function()
|
||||
if daprunning == true then
|
||||
if not pcall(function() dap.continue() end) then
|
||||
dapCleanup()
|
||||
|
|
@ -256,7 +327,7 @@ require("which-key").add ({
|
|||
print("Debugger is not running! Please run debugger first")
|
||||
end
|
||||
end, desc = "Debugger: Resume execution" },
|
||||
{ "<C-c>ln", function()
|
||||
{ "<C-c>dn", function()
|
||||
if daprunning == true then
|
||||
if not pcall(function() dap.step_over() end) then
|
||||
dapCleanup()
|
||||
|
|
@ -265,7 +336,7 @@ require("which-key").add ({
|
|||
print("Debugger is not running! Please run debugger first")
|
||||
end
|
||||
end, desc = "Debugger: Step over" },
|
||||
{ "<C-c>li", function()
|
||||
{ "<C-c>di", function()
|
||||
if daprunning == true then
|
||||
if not pcall(function() dap.step_into() end) then
|
||||
dapCleanup()
|
||||
|
|
|
|||
|
|
@ -3,14 +3,15 @@
|
|||
"cmp-nvim-lsp": { "branch": "main", "commit": "39e2eda76828d88b773cc27a3f61d2ad782c922d" },
|
||||
"dashboard-nvim": { "branch": "master", "commit": "fabf5feec96185817c732d47d363f34034212685" },
|
||||
"gruvbox.nvim": { "branch": "main", "commit": "7a1b23e4edf73a39642e77508ee6b9cbb8c60f9e" },
|
||||
"lazy.nvim": { "branch": "main", "commit": "6ca90a21202808796418e46d3cebfbb5a44e54a2" },
|
||||
"lsp-zero.nvim": { "branch": "v3.x", "commit": "87701af045b3032515776abeb47eb8c2ddb5e679" },
|
||||
"lazy.nvim": { "branch": "main", "commit": "077102c5bfc578693f12377846d427f49bc50076" },
|
||||
"lsp-zero.nvim": { "branch": "v3.x", "commit": "56db3d5ce5476b183783160e6045f7337ba12b83" },
|
||||
"mini.statusline": { "branch": "main", "commit": "ec7e2c509c7262fef85a28a772f60ebe146297db" },
|
||||
"neocord": { "branch": "main", "commit": "aa7a58023166533da83ca7b11c0d2569e45d7381" },
|
||||
"nvim-cmp": { "branch": "main", "commit": "d818fd0624205b34e14888358037fb6f5dc51234" },
|
||||
"nvim-dap": { "branch": "master", "commit": "bc03b83c94d0375145ff5ac6a6dcf28c1241e06f" },
|
||||
"nvim-lspconfig": { "branch": "master", "commit": "df9c116cbcf0aa7e58f2b36b0296fa687e87f36f" },
|
||||
"nvim-web-devicons": { "branch": "master", "commit": "c0cfc1738361b5da1cd0a962dd6f774cc444f856" },
|
||||
"nvim-lspconfig": { "branch": "master", "commit": "f95d371c1a274f60392edfd8ea5121b42dca736e" },
|
||||
"nvim-web-devicons": { "branch": "master", "commit": "a2af6aa13a2ad3ad361d562a319a91bcd68c43a4" },
|
||||
"plenary.nvim": { "branch": "master", "commit": "a3e3bc82a3f95c5ed0d7201546d5d2c19b20d683" },
|
||||
"telescope.nvim": { "branch": "master", "commit": "a0bbec21143c7bc5f8bb02e0005fa0b982edc026" },
|
||||
"which-key.nvim": { "branch": "main", "commit": "ed5f7622771d0b5c0ac3a5e286ec6cd17b6be131" }
|
||||
"which-key.nvim": { "branch": "main", "commit": "6c1584eb76b55629702716995cca4ae2798a9cca" }
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue