nvim lazy conf almost finished
This commit is contained in:
parent
be07ce0344
commit
5335419073
9 changed files with 126 additions and 186 deletions
|
@ -1,6 +0,0 @@
|
||||||
require 'colorizer'.setup({
|
|
||||||
'dosini';
|
|
||||||
'css';
|
|
||||||
'javascript';
|
|
||||||
html = { mode = 'background' };
|
|
||||||
})
|
|
|
@ -1 +1,4 @@
|
||||||
require("fidget").setup()
|
return {
|
||||||
|
"j-hui/fidget.nvim",
|
||||||
|
config = true
|
||||||
|
}
|
||||||
|
|
|
@ -1,97 +1,72 @@
|
||||||
local present, mason = pcall(require, "mason")
|
return {
|
||||||
|
"neovim/nvim-lspconfig",
|
||||||
|
dependencies = "williamboman/mason-lspconfig.nvim",
|
||||||
|
config = function()
|
||||||
|
local mason_lspconfig = require "mason-lspconfig"
|
||||||
|
|
||||||
vim.api.nvim_create_augroup("_mason", { clear = true })
|
mason_lspconfig.setup({
|
||||||
|
ensure_installed = {},
|
||||||
|
automatic_installation = true
|
||||||
|
})
|
||||||
|
|
||||||
local options = {
|
|
||||||
PATH = "skip",
|
|
||||||
|
|
||||||
ui = {
|
local opts = { noremap = true, silent = true }
|
||||||
icons = {
|
vim.keymap.set('n', '<space>e', vim.diagnostic.open_float, opts)
|
||||||
package_installed = "✓",
|
vim.keymap.set('n', '[d', vim.diagnostic.goto_prev, opts)
|
||||||
package_pending = "➜",
|
vim.keymap.set('n', ']d', vim.diagnostic.goto_next, opts)
|
||||||
package_uninstalled = "✗"
|
vim.keymap.set('n', '<space>q', vim.diagnostic.setloclist, opts)
|
||||||
},
|
|
||||||
|
|
||||||
keymaps = {
|
-- Use an on_attach function to only map the following keys
|
||||||
toggle_server_expand = "<CR>",
|
-- after the language server attaches to the current buffer
|
||||||
install_server = "i",
|
local on_attach = function(client, bufnr)
|
||||||
update_server = "u",
|
-- Enable completion triggered by <c-x><c-o>
|
||||||
check_server_version = "c",
|
vim.api.nvim_buf_set_option(bufnr, 'omnifunc', 'v:lua.vim.lsp.omnifunc')
|
||||||
update_all_servers = "U",
|
|
||||||
check_outdated_servers = "C",
|
|
||||||
uninstall_server = "X",
|
|
||||||
cancel_installation = "<C-c>",
|
|
||||||
},
|
|
||||||
},
|
|
||||||
|
|
||||||
max_concurrent_installers = 10,
|
-- Mappings.
|
||||||
}
|
-- See `:help vim.lsp.*` for documentation on any of the below functions
|
||||||
|
local bufopts = { noremap = true, silent = true, buffer = bufnr }
|
||||||
mason.setup(options)
|
vim.keymap.set('n', 'gD', vim.lsp.buf.declaration, bufopts)
|
||||||
|
vim.keymap.set('n', 'gd', vim.lsp.buf.definition, bufopts)
|
||||||
local mason_lspconfig = require "mason-lspconfig"
|
vim.keymap.set('n', 'K', vim.lsp.buf.hover, bufopts)
|
||||||
|
vim.keymap.set('n', 'gi', vim.lsp.buf.implementation, bufopts)
|
||||||
mason_lspconfig.setup({
|
-- vim.keymap.set('n', '<C-k>', vim.lsp.buf.signature_help, bufopts)
|
||||||
ensure_installed = {},
|
vim.keymap.set('n', '<space>wa', vim.lsp.buf.add_workspace_folder, bufopts)
|
||||||
automatic_installation = true
|
vim.keymap.set('n', '<space>wr', vim.lsp.buf.remove_workspace_folder, bufopts)
|
||||||
})
|
vim.keymap.set('n', '<space>wl', function()
|
||||||
|
print(vim.inspect(vim.lsp.buf.list_workspace_folders()))
|
||||||
|
end, bufopts)
|
||||||
local opts = { noremap = true, silent = true }
|
vim.keymap.set('n', '<space>D', vim.lsp.buf.type_definition, bufopts)
|
||||||
vim.keymap.set('n', '<space>e', vim.diagnostic.open_float, opts)
|
vim.keymap.set('n', '<space>rn', vim.lsp.buf.rename, bufopts)
|
||||||
vim.keymap.set('n', '[d', vim.diagnostic.goto_prev, opts)
|
vim.keymap.set('n', '<space>ca', vim.lsp.buf.code_action, bufopts)
|
||||||
vim.keymap.set('n', ']d', vim.diagnostic.goto_next, opts)
|
vim.keymap.set('n', 'gr', vim.lsp.buf.references, bufopts)
|
||||||
vim.keymap.set('n', '<space>q', vim.diagnostic.setloclist, opts)
|
vim.keymap.set('n', '<space>ge', function() vim.diagnostic.goto_next() end, bufopts)
|
||||||
|
vim.keymap.set('n', '<space>gE', function() vim.diagnostic.goto_prev() end, bufopts)
|
||||||
-- Use an on_attach function to only map the following keys
|
vim.keymap.set('n', '<space>fo', function() vim.lsp.buf.format { async = true } end, bufopts)
|
||||||
-- after the language server attaches to the current buffer
|
end
|
||||||
local on_attach = function(client, bufnr)
|
|
||||||
-- Enable completion triggered by <c-x><c-o>
|
local lspconfig = require "lspconfig"
|
||||||
vim.api.nvim_buf_set_option(bufnr, 'omnifunc', 'v:lua.vim.lsp.omnifunc')
|
|
||||||
|
-- ADD NVIM CMP AS A CAPABILITY
|
||||||
-- Mappings.
|
local lsp_defaults = lspconfig.util.default_config
|
||||||
-- See `:help vim.lsp.*` for documentation on any of the below functions
|
|
||||||
local bufopts = { noremap = true, silent = true, buffer = bufnr }
|
local capabilities = vim.tbl_deep_extend(
|
||||||
vim.keymap.set('n', 'gD', vim.lsp.buf.declaration, bufopts)
|
'force',
|
||||||
vim.keymap.set('n', 'gd', vim.lsp.buf.definition, bufopts)
|
lsp_defaults.capabilities,
|
||||||
vim.keymap.set('n', 'K', vim.lsp.buf.hover, bufopts)
|
require('cmp_nvim_lsp').default_capabilities()
|
||||||
vim.keymap.set('n', 'gi', vim.lsp.buf.implementation, bufopts)
|
)
|
||||||
-- vim.keymap.set('n', '<C-k>', vim.lsp.buf.signature_help, bufopts)
|
|
||||||
vim.keymap.set('n', '<space>wa', vim.lsp.buf.add_workspace_folder, bufopts)
|
|
||||||
vim.keymap.set('n', '<space>wr', vim.lsp.buf.remove_workspace_folder, bufopts)
|
mason_lspconfig.setup_handlers {
|
||||||
vim.keymap.set('n', '<space>wl', function()
|
|
||||||
print(vim.inspect(vim.lsp.buf.list_workspace_folders()))
|
-- This is a default handler that will be called for each installed server (also for new servers that are installed during a session)
|
||||||
end, bufopts)
|
function(server_name)
|
||||||
vim.keymap.set('n', '<space>D', vim.lsp.buf.type_definition, bufopts)
|
lspconfig[server_name].setup {
|
||||||
vim.keymap.set('n', '<space>rn', vim.lsp.buf.rename, bufopts)
|
on_attach = on_attach,
|
||||||
vim.keymap.set('n', '<space>ca', vim.lsp.buf.code_action, bufopts)
|
on_init = on_init,
|
||||||
vim.keymap.set('n', 'gr', vim.lsp.buf.references, bufopts)
|
flags = lsp_flags,
|
||||||
vim.keymap.set('n', '<space>ge', function() vim.diagnostic.goto_next() end, bufopts)
|
capabilities = capabilities,
|
||||||
vim.keymap.set('n', '<space>gE', function() vim.diagnostic.goto_prev() end, bufopts)
|
}
|
||||||
vim.keymap.set('n', '<space>fo', function() vim.lsp.buf.format { async = true } end, bufopts)
|
end,
|
||||||
end
|
}
|
||||||
|
end
|
||||||
local lspconfig = require "lspconfig"
|
|
||||||
|
|
||||||
-- 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()
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
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 {
|
|
||||||
on_attach = on_attach,
|
|
||||||
on_init = on_init,
|
|
||||||
flags = lsp_flags,
|
|
||||||
capabilities = capabilities,
|
|
||||||
}
|
|
||||||
end,
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -19,8 +19,8 @@ return {
|
||||||
}
|
}
|
||||||
|
|
||||||
require('orgmode').setup({
|
require('orgmode').setup({
|
||||||
org_agenda_files = { '~/Nextcloud/Documents/uni/**/*' },
|
org_agenda_files = { '~/Nextcloud/org/**/*' },
|
||||||
org_default_notes_file = '~/Nextcloud/Documents/uni/refile.org',
|
org_default_notes_file = '~/Nextcloud/org/refile.org',
|
||||||
})
|
})
|
||||||
end
|
end
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,45 +0,0 @@
|
||||||
return {
|
|
||||||
"nvim-lualine/lualine.nvim",
|
|
||||||
config = function()
|
|
||||||
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 = { 'mode' },
|
|
||||||
lualine_b = { 'branch', 'diff', 'diagnostics' },
|
|
||||||
lualine_c = { 'filename' },
|
|
||||||
lualine_x = { 'encoding', 'fileformat', 'filetype' },
|
|
||||||
lualine_y = { 'progress' },
|
|
||||||
lualine_z = { 'location' }
|
|
||||||
},
|
|
||||||
inactive_sections = {
|
|
||||||
lualine_a = {},
|
|
||||||
lualine_b = {},
|
|
||||||
lualine_c = { 'filename' },
|
|
||||||
lualine_x = { 'location' },
|
|
||||||
lualine_y = {},
|
|
||||||
lualine_z = {}
|
|
||||||
},
|
|
||||||
tabline = {},
|
|
||||||
winbar = {},
|
|
||||||
inactive_winbar = {},
|
|
||||||
extensions = {}
|
|
||||||
}
|
|
||||||
end
|
|
||||||
}
|
|
|
@ -1,5 +1,13 @@
|
||||||
local builtin = require('telescope.builtin')
|
return {
|
||||||
vim.keymap.set('n', '<leader>sf', builtin.find_files, {})
|
"nvim-telescope/telescope.nvim",
|
||||||
vim.keymap.set('n', '<leader>sg', builtin.live_grep, {})
|
dependencies = {
|
||||||
vim.keymap.set('n', '<leader>sb', builtin.buffers, {})
|
"nvim-lua/plenary.nvim"
|
||||||
vim.keymap.set('n', '<leader>sh', builtin.help_tags, {})
|
},
|
||||||
|
config = function()
|
||||||
|
local builtin = require('telescope.builtin')
|
||||||
|
vim.keymap.set('n', '<leader>sf', builtin.find_files, {})
|
||||||
|
vim.keymap.set('n', '<leader>sg', builtin.live_grep, {})
|
||||||
|
vim.keymap.set('n', '<leader>sb', builtin.buffers, {})
|
||||||
|
vim.keymap.set('n', '<leader>sh', builtin.help_tags, {})
|
||||||
|
end
|
||||||
|
}
|
||||||
|
|
|
@ -1,36 +1,37 @@
|
||||||
function ContextSetup(show_all_context)
|
return {
|
||||||
require("treesitter-context").setup({
|
"romgrk/nvim-treesitter-context",
|
||||||
enable = true, -- Enable this plugin (Can be enabled/disabled later via commands)
|
config = function()
|
||||||
throttle = true, -- Throttles plugin updates (may improve performance)
|
require("treesitter-context").setup({
|
||||||
max_lines = 0, -- How many lines the window should span. Values <= 0 mean no limit.
|
enable = true, -- Enable this plugin (Can be enabled/disabled later via commands)
|
||||||
show_all_context = show_all_context,
|
throttle = true, -- Throttles plugin updates (may improve performance)
|
||||||
patterns = { -- Match patterns for TS nodes. These get wrapped to match at word boundaries.
|
max_lines = 0, -- How many lines the window should span. Values <= 0 mean no limit.
|
||||||
-- For all filetypes
|
show_all_context = false,
|
||||||
-- Note that setting an entry here replaces all other patterns for this entry.
|
patterns = { -- Match patterns for TS nodes. These get wrapped to match at word boundaries.
|
||||||
-- By setting the 'default' entry below, you can control which nodes you want to
|
-- For all filetypes
|
||||||
-- appear in the context window.
|
-- Note that setting an entry here replaces all other patterns for this entry.
|
||||||
default = {
|
-- By setting the 'default' entry below, you can control which nodes you want to
|
||||||
"function",
|
-- appear in the context window.
|
||||||
"method",
|
default = {
|
||||||
"for",
|
"function",
|
||||||
"while",
|
"method",
|
||||||
"if",
|
"for",
|
||||||
"switch",
|
"while",
|
||||||
"case",
|
"if",
|
||||||
},
|
"switch",
|
||||||
|
"case",
|
||||||
|
},
|
||||||
|
|
||||||
rust = {
|
rust = {
|
||||||
"loop_expression",
|
"loop_expression",
|
||||||
"impl_item",
|
"impl_item",
|
||||||
},
|
},
|
||||||
|
|
||||||
typescript = {
|
typescript = {
|
||||||
"class_declaration",
|
"class_declaration",
|
||||||
"abstract_class_declaration",
|
"abstract_class_declaration",
|
||||||
"else_clause",
|
"else_clause",
|
||||||
|
},
|
||||||
},
|
},
|
||||||
},
|
})
|
||||||
})
|
end
|
||||||
end
|
}
|
||||||
|
|
||||||
ContextSetup(false)
|
|
||||||
|
|
|
@ -1 +1,7 @@
|
||||||
vim.keymap.set("n", "<leader>u", vim.cmd.UndotreeToggle)
|
return {
|
||||||
|
"mbbill/undotree",
|
||||||
|
config = function()
|
||||||
|
vim.keymap.set("n", "<leader>u", vim.cmd.UndotreeToggle)
|
||||||
|
end
|
||||||
|
|
||||||
|
}
|
||||||
|
|
|
@ -1,2 +0,0 @@
|
||||||
vim.g.vimtex_view_method = 'zathura'
|
|
||||||
vim.g.vimtex_compiler_methor = 'latexmk'
|
|
Loading…
Add table
Add a link
Reference in a new issue