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 = {
|
||||
icons = {
|
||||
package_installed = "✓",
|
||||
package_pending = "➜",
|
||||
package_uninstalled = "✗"
|
||||
},
|
||||
local opts = { noremap = true, silent = true }
|
||||
vim.keymap.set('n', '<space>e', vim.diagnostic.open_float, opts)
|
||||
vim.keymap.set('n', '[d', vim.diagnostic.goto_prev, opts)
|
||||
vim.keymap.set('n', ']d', vim.diagnostic.goto_next, opts)
|
||||
vim.keymap.set('n', '<space>q', vim.diagnostic.setloclist, opts)
|
||||
|
||||
keymaps = {
|
||||
toggle_server_expand = "<CR>",
|
||||
install_server = "i",
|
||||
update_server = "u",
|
||||
check_server_version = "c",
|
||||
update_all_servers = "U",
|
||||
check_outdated_servers = "C",
|
||||
uninstall_server = "X",
|
||||
cancel_installation = "<C-c>",
|
||||
},
|
||||
},
|
||||
-- Use an on_attach function to only map the following keys
|
||||
-- after the language server attaches to the current buffer
|
||||
local on_attach = function(client, bufnr)
|
||||
-- Enable completion triggered by <c-x><c-o>
|
||||
vim.api.nvim_buf_set_option(bufnr, 'omnifunc', 'v:lua.vim.lsp.omnifunc')
|
||||
|
||||
max_concurrent_installers = 10,
|
||||
}
|
||||
|
||||
mason.setup(options)
|
||||
|
||||
local mason_lspconfig = require "mason-lspconfig"
|
||||
|
||||
mason_lspconfig.setup({
|
||||
ensure_installed = {},
|
||||
automatic_installation = true
|
||||
})
|
||||
|
||||
|
||||
local opts = { noremap = true, silent = true }
|
||||
vim.keymap.set('n', '<space>e', vim.diagnostic.open_float, opts)
|
||||
vim.keymap.set('n', '[d', vim.diagnostic.goto_prev, opts)
|
||||
vim.keymap.set('n', ']d', vim.diagnostic.goto_next, opts)
|
||||
vim.keymap.set('n', '<space>q', vim.diagnostic.setloclist, opts)
|
||||
|
||||
-- Use an on_attach function to only map the following keys
|
||||
-- after the language server attaches to the current buffer
|
||||
local on_attach = function(client, bufnr)
|
||||
-- Enable completion triggered by <c-x><c-o>
|
||||
vim.api.nvim_buf_set_option(bufnr, 'omnifunc', 'v:lua.vim.lsp.omnifunc')
|
||||
|
||||
-- Mappings.
|
||||
-- See `:help vim.lsp.*` for documentation on any of the below functions
|
||||
local bufopts = { noremap = true, silent = true, buffer = bufnr }
|
||||
vim.keymap.set('n', 'gD', vim.lsp.buf.declaration, bufopts)
|
||||
vim.keymap.set('n', 'gd', vim.lsp.buf.definition, bufopts)
|
||||
vim.keymap.set('n', 'K', vim.lsp.buf.hover, bufopts)
|
||||
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)
|
||||
vim.keymap.set('n', '<space>wl', function()
|
||||
print(vim.inspect(vim.lsp.buf.list_workspace_folders()))
|
||||
end, bufopts)
|
||||
vim.keymap.set('n', '<space>D', vim.lsp.buf.type_definition, bufopts)
|
||||
vim.keymap.set('n', '<space>rn', vim.lsp.buf.rename, bufopts)
|
||||
vim.keymap.set('n', '<space>ca', vim.lsp.buf.code_action, bufopts)
|
||||
vim.keymap.set('n', 'gr', vim.lsp.buf.references, bufopts)
|
||||
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)
|
||||
vim.keymap.set('n', '<space>fo', function() vim.lsp.buf.format { async = true } end, bufopts)
|
||||
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,
|
||||
-- Mappings.
|
||||
-- See `:help vim.lsp.*` for documentation on any of the below functions
|
||||
local bufopts = { noremap = true, silent = true, buffer = bufnr }
|
||||
vim.keymap.set('n', 'gD', vim.lsp.buf.declaration, bufopts)
|
||||
vim.keymap.set('n', 'gd', vim.lsp.buf.definition, bufopts)
|
||||
vim.keymap.set('n', 'K', vim.lsp.buf.hover, bufopts)
|
||||
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)
|
||||
vim.keymap.set('n', '<space>wl', function()
|
||||
print(vim.inspect(vim.lsp.buf.list_workspace_folders()))
|
||||
end, bufopts)
|
||||
vim.keymap.set('n', '<space>D', vim.lsp.buf.type_definition, bufopts)
|
||||
vim.keymap.set('n', '<space>rn', vim.lsp.buf.rename, bufopts)
|
||||
vim.keymap.set('n', '<space>ca', vim.lsp.buf.code_action, bufopts)
|
||||
vim.keymap.set('n', 'gr', vim.lsp.buf.references, bufopts)
|
||||
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)
|
||||
vim.keymap.set('n', '<space>fo', function() vim.lsp.buf.format { async = true } end, bufopts)
|
||||
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,
|
||||
}
|
||||
end
|
||||
}
|
||||
|
|
|
@ -19,8 +19,8 @@ return {
|
|||
}
|
||||
|
||||
require('orgmode').setup({
|
||||
org_agenda_files = { '~/Nextcloud/Documents/uni/**/*' },
|
||||
org_default_notes_file = '~/Nextcloud/Documents/uni/refile.org',
|
||||
org_agenda_files = { '~/Nextcloud/org/**/*' },
|
||||
org_default_notes_file = '~/Nextcloud/org/refile.org',
|
||||
})
|
||||
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')
|
||||
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, {})
|
||||
return {
|
||||
"nvim-telescope/telescope.nvim",
|
||||
dependencies = {
|
||||
"nvim-lua/plenary.nvim"
|
||||
},
|
||||
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)
|
||||
require("treesitter-context").setup({
|
||||
enable = true, -- Enable this plugin (Can be enabled/disabled later via commands)
|
||||
throttle = true, -- Throttles plugin updates (may improve performance)
|
||||
max_lines = 0, -- How many lines the window should span. Values <= 0 mean no limit.
|
||||
show_all_context = show_all_context,
|
||||
patterns = { -- Match patterns for TS nodes. These get wrapped to match at word boundaries.
|
||||
-- For all filetypes
|
||||
-- Note that setting an entry here replaces all other patterns for this entry.
|
||||
-- By setting the 'default' entry below, you can control which nodes you want to
|
||||
-- appear in the context window.
|
||||
default = {
|
||||
"function",
|
||||
"method",
|
||||
"for",
|
||||
"while",
|
||||
"if",
|
||||
"switch",
|
||||
"case",
|
||||
},
|
||||
return {
|
||||
"romgrk/nvim-treesitter-context",
|
||||
config = function()
|
||||
require("treesitter-context").setup({
|
||||
enable = true, -- Enable this plugin (Can be enabled/disabled later via commands)
|
||||
throttle = true, -- Throttles plugin updates (may improve performance)
|
||||
max_lines = 0, -- How many lines the window should span. Values <= 0 mean no limit.
|
||||
show_all_context = false,
|
||||
patterns = { -- Match patterns for TS nodes. These get wrapped to match at word boundaries.
|
||||
-- For all filetypes
|
||||
-- Note that setting an entry here replaces all other patterns for this entry.
|
||||
-- By setting the 'default' entry below, you can control which nodes you want to
|
||||
-- appear in the context window.
|
||||
default = {
|
||||
"function",
|
||||
"method",
|
||||
"for",
|
||||
"while",
|
||||
"if",
|
||||
"switch",
|
||||
"case",
|
||||
},
|
||||
|
||||
rust = {
|
||||
"loop_expression",
|
||||
"impl_item",
|
||||
},
|
||||
rust = {
|
||||
"loop_expression",
|
||||
"impl_item",
|
||||
},
|
||||
|
||||
typescript = {
|
||||
"class_declaration",
|
||||
"abstract_class_declaration",
|
||||
"else_clause",
|
||||
typescript = {
|
||||
"class_declaration",
|
||||
"abstract_class_declaration",
|
||||
"else_clause",
|
||||
},
|
||||
},
|
||||
},
|
||||
})
|
||||
end
|
||||
|
||||
ContextSetup(false)
|
||||
})
|
||||
end
|
||||
}
|
||||
|
|
|
@ -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
Reference in a new issue