separated plugins configs and added couple new plugins
This commit is contained in:
parent
8c93e97b86
commit
6b3424c590
25
init.lua
25
init.lua
|
@ -1,11 +1,10 @@
|
||||||
-- See `:help mapleader`
|
-- NOTE: Must happen before plugins are required (otherwise wrong leader will be used)
|
||||||
-- NOTE: Must happen before plugins are required (otherwise wrong leader will be used)
|
|
||||||
vim.g.mapleader = ' '
|
vim.g.mapleader = ' '
|
||||||
vim.g.maplocalleader = ' '
|
vim.g.maplocalleader = ' '
|
||||||
|
|
||||||
-- Install package manager
|
-- Install package manager
|
||||||
-- https://github.com/folke/lazy.nvim
|
-- https://github.com/folke/lazy.nvim
|
||||||
-- `:help lazy.nvim.txt` for more info
|
-- Check Lua documentation for more info
|
||||||
local lazypath = vim.fn.stdpath 'data' .. '/lazy/lazy.nvim'
|
local lazypath = vim.fn.stdpath 'data' .. '/lazy/lazy.nvim'
|
||||||
if not vim.loop.fs_stat(lazypath) then
|
if not vim.loop.fs_stat(lazypath) then
|
||||||
vim.fn.system {
|
vim.fn.system {
|
||||||
|
@ -33,19 +32,13 @@ require('lazy').setup({
|
||||||
|
|
||||||
-- Detect tabstop and shiftwidth automatically
|
-- Detect tabstop and shiftwidth automatically
|
||||||
'tpope/vim-sleuth',
|
'tpope/vim-sleuth',
|
||||||
{ import = 'custom.plugins' },
|
{
|
||||||
|
import = 'custom.plugins',
|
||||||
|
exclude = 'custom.plugins.mason',
|
||||||
|
},
|
||||||
}, opts)
|
}, opts)
|
||||||
|
|
||||||
require('config.options')
|
require('config.options')
|
||||||
require('config.mappings')
|
require('config.mappings')
|
||||||
|
require('config.utils')
|
||||||
-- [[ Highlight on yank ]]
|
require('config.themes')
|
||||||
-- See `:help vim.highlight.on_yank()`
|
|
||||||
local highlight_group = vim.api.nvim_create_augroup('YankHighlight', { clear = true })
|
|
||||||
vim.api.nvim_create_autocmd('TextYankPost', {
|
|
||||||
callback = function()
|
|
||||||
vim.highlight.on_yank()
|
|
||||||
end,
|
|
||||||
group = highlight_group,
|
|
||||||
pattern = '*',
|
|
||||||
})
|
|
||||||
|
|
|
@ -10,7 +10,9 @@ vim.keymap.set('n', 'k', "v:count == 0 ? 'gk' : 'k'", {
|
||||||
expr = true, silent = true
|
expr = true, silent = true
|
||||||
})
|
})
|
||||||
vim.keymap.set('n', 'j', "v:count == 0 ? 'gj' : 'j'", {
|
vim.keymap.set('n', 'j', "v:count == 0 ? 'gj' : 'j'", {
|
||||||
expr = true, silent = true
|
-- Unmap the 'gp' key for previous word
|
||||||
|
expr = true,
|
||||||
|
silent = true
|
||||||
})
|
})
|
||||||
|
|
||||||
-- Move lines
|
-- Move lines
|
||||||
|
@ -24,6 +26,8 @@ vim.keymap.set('n', '<C-u>', "<C-u>zz", { desc = "Half Page Jumping Down" })
|
||||||
-- Keep search line in the middle
|
-- Keep search line in the middle
|
||||||
vim.keymap.set('n', 'n', 'nzzzv', { silent = true })
|
vim.keymap.set('n', 'n', 'nzzzv', { silent = true })
|
||||||
vim.keymap.set('n', 'N', 'Nzzzv', { silent = true })
|
vim.keymap.set('n', 'N', 'Nzzzv', { silent = true })
|
||||||
|
-- Unmap the 'p' key for previous word
|
||||||
|
vim.api.nvim_set_keymap('n', 'gp', '<Nop>', { noremap = true, silent = true })
|
||||||
|
|
||||||
-- Quick fix navigation
|
-- Quick fix navigation
|
||||||
vim.keymap.set("n", "<C-k>", "<cmd>cnext<CR>zz")
|
vim.keymap.set("n", "<C-k>", "<cmd>cnext<CR>zz")
|
||||||
|
@ -36,8 +40,8 @@ vim.keymap.set({ 'n', 'v' }, '<leader>y', "\"+y", { desc = "Copy to + register"
|
||||||
vim.keymap.set('n', '<leader>Y', "\"+Y")
|
vim.keymap.set('n', '<leader>Y', "\"+Y")
|
||||||
|
|
||||||
-- Replace current word
|
-- Replace current word
|
||||||
vim.keymap.set("n", "<leader>s", [[:%s/\<<C-r><C-w>\>/<C-r><C-w>/gI<Left><Left><Left>]],
|
vim.keymap.set("n", "<leader>r", [[:%s/\<<C-r><C-w>\>/<C-r><C-w>/gI<Left><Left><Left>]],
|
||||||
{ desc = "[S]ubstitute Current Word" })
|
{ desc = "[R]eplace Current Word" })
|
||||||
vim.keymap.set("n", "<leader>x", "<cmd>!chmod +x %<CR>", { desc = "Set Current File to Executable", silent = true })
|
vim.keymap.set("n", "<leader>x", "<cmd>!chmod +x %<CR>", { desc = "Set Current File to Executable", silent = true })
|
||||||
|
|
||||||
-- [ telescope keymaps]
|
-- [ telescope keymaps]
|
||||||
|
@ -69,3 +73,14 @@ vim.keymap.set('n', '[d', vim.diagnostic.goto_prev, { desc = 'Go to previous dia
|
||||||
vim.keymap.set('n', ']d', vim.diagnostic.goto_next, { desc = 'Go to next diagnostic message' })
|
vim.keymap.set('n', ']d', vim.diagnostic.goto_next, { desc = 'Go to next diagnostic message' })
|
||||||
vim.keymap.set('n', '<leader>e', vim.diagnostic.open_float, { desc = 'Open floating diagnostic message' })
|
vim.keymap.set('n', '<leader>e', vim.diagnostic.open_float, { desc = 'Open floating diagnostic message' })
|
||||||
vim.keymap.set('n', '<leader>q', vim.diagnostic.setloclist, { desc = 'Open diagnostics list' })
|
vim.keymap.set('n', '<leader>q', vim.diagnostic.setloclist, { desc = 'Open diagnostics list' })
|
||||||
|
|
||||||
|
-- [[ Highlight on yank ]]
|
||||||
|
-- See `:help vim.highlight.on_yank()`
|
||||||
|
local highlight_group = vim.api.nvim_create_augroup('YankHighlight', { clear = true })
|
||||||
|
vim.api.nvim_create_autocmd('TextYankPost', {
|
||||||
|
callback = function()
|
||||||
|
vim.highlight.on_yank()
|
||||||
|
end,
|
||||||
|
group = highlight_group,
|
||||||
|
pattern = '*',
|
||||||
|
})
|
||||||
|
|
|
@ -1,15 +1,13 @@
|
||||||
local opt = vim.opt
|
local opt = vim.opt
|
||||||
local g = vim.g
|
local g = vim.g
|
||||||
|
|
||||||
local opts = {
|
local opts = {
|
||||||
-- change cursor in insert mode
|
-- Change cursor in insert mode
|
||||||
guicursor = "",
|
guicursor = "",
|
||||||
|
|
||||||
-- Make line numbers default
|
-- Make line numbers default
|
||||||
relativenumber = true,
|
relativenumber = true,
|
||||||
|
|
||||||
-- Enable mouse mode
|
|
||||||
mouse = 'a',
|
|
||||||
|
|
||||||
-- Enable break indent
|
-- Enable break indent
|
||||||
breakindent = true,
|
breakindent = true,
|
||||||
|
|
||||||
|
@ -18,16 +16,15 @@ local opts = {
|
||||||
softtabstop = 4,
|
softtabstop = 4,
|
||||||
shiftwidth = 4,
|
shiftwidth = 4,
|
||||||
expandtab = true,
|
expandtab = true,
|
||||||
|
|
||||||
smartindent = true,
|
smartindent = true,
|
||||||
|
|
||||||
-- Disable line wrap
|
-- Disable line wrap
|
||||||
wrap = false,
|
wrap = false,
|
||||||
|
|
||||||
-- Save undo history_list
|
-- Save undo history
|
||||||
swapfile = false,
|
swapfile = false,
|
||||||
backup = false,
|
backup = false,
|
||||||
undodir = os.getenv("HOME") .. "/.vim/undodir",
|
undodir = vim.fn.stdpath("data") .. "/site/undodir",
|
||||||
undofile = true,
|
undofile = true,
|
||||||
|
|
||||||
-- Searching Configuration
|
-- Searching Configuration
|
||||||
|
@ -48,14 +45,12 @@ local opts = {
|
||||||
-- NOTE: You should make sure your terminal supports this
|
-- NOTE: You should make sure your terminal supports this
|
||||||
termguicolors = true,
|
termguicolors = true,
|
||||||
scrolloff = 10,
|
scrolloff = 10,
|
||||||
-- isfname:append("@-@"),
|
|
||||||
colorcolumn = "80",
|
colorcolumn = "80",
|
||||||
-- part of the neovim imprioving command below
|
pyxversion = 3,
|
||||||
pyxversion = 3
|
|
||||||
}
|
}
|
||||||
|
|
||||||
for k, v in pairs(opts) do
|
for k, v in pairs(opts) do
|
||||||
vim.opt[k] = v
|
opt[k] = v
|
||||||
end
|
end
|
||||||
|
|
||||||
local win_local = {
|
local win_local = {
|
||||||
|
@ -67,7 +62,7 @@ for k, v in pairs(win_local) do
|
||||||
vim.wo[k] = v
|
vim.wo[k] = v
|
||||||
end
|
end
|
||||||
|
|
||||||
-- disable builtins plugins
|
-- Disable built-in plugins
|
||||||
local disabled_built_ins = {
|
local disabled_built_ins = {
|
||||||
"2html_plugin",
|
"2html_plugin",
|
||||||
"getscript",
|
"getscript",
|
||||||
|
@ -75,12 +70,12 @@ local disabled_built_ins = {
|
||||||
"gzip",
|
"gzip",
|
||||||
"logipat",
|
"logipat",
|
||||||
"matchit",
|
"matchit",
|
||||||
-- "netrw",
|
-- "netrw",
|
||||||
"netrwFileHandlers",
|
"netrwFileHandlers",
|
||||||
"loaded_remote_plugins",
|
"loaded_remote_plugins",
|
||||||
"loaded_tutor_mode_plugin",
|
"loaded_tutor_mode_plugin",
|
||||||
"netrwPlugin",
|
-- "netrwPlugin",
|
||||||
"netrwSettings",
|
-- "netrwSettings",
|
||||||
"rrhelper",
|
"rrhelper",
|
||||||
"spellfile_plugin",
|
"spellfile_plugin",
|
||||||
"tar",
|
"tar",
|
||||||
|
@ -89,31 +84,27 @@ local disabled_built_ins = {
|
||||||
"vimballPlugin",
|
"vimballPlugin",
|
||||||
"zip",
|
"zip",
|
||||||
"zipPlugin",
|
"zipPlugin",
|
||||||
"matchparen", -- matchparen.nvim disables the default
|
"matchparen",
|
||||||
}
|
}
|
||||||
|
|
||||||
for _, plugin in pairs(disabled_built_ins) do
|
for _, plugin in pairs(disabled_built_ins) do
|
||||||
vim.g["loaded_" .. plugin] = 1
|
g["loaded_" .. plugin] = 1
|
||||||
end
|
end
|
||||||
|
|
||||||
--
|
-- Improve Neovim startup
|
||||||
-- IMPROVE NEOVIM STARTUP
|
|
||||||
-- https://github.com/editorconfig/editorconfig-vim/issues/50
|
|
||||||
local global_let_opts = {
|
local global_let_opts = {
|
||||||
loaded_python_provier = 0,
|
loaded_python_provider = 0,
|
||||||
loaded_python3_provider = 0,
|
loaded_python3_provider = 0,
|
||||||
python_host_skip_check = 1,
|
python_host_skip_check = 1,
|
||||||
-- python_host_prog = '/bin/python2',
|
|
||||||
python3_host_skip_check = 1,
|
python3_host_skip_check = 1,
|
||||||
python3_host_prog = '/usr/local/bin/python3',
|
python3_host_prog = '/usr/local/bin/python3',
|
||||||
EditorConfig_core_mode = 'external_command',
|
EditorConfig_core_mode = 'external_command',
|
||||||
-- https://vi.stackexchange.com/a/5318/7339
|
|
||||||
matchparen_timeout = 20,
|
matchparen_timeout = 20,
|
||||||
matchparen_insert_timeout = 20,
|
matchparen_insert_timeout = 20,
|
||||||
}
|
}
|
||||||
|
|
||||||
for k, v in pairs(global_let_opts) do
|
for k, v in pairs(global_let_opts) do
|
||||||
vim.g[k] = v
|
g[k] = v
|
||||||
end
|
end
|
||||||
|
|
||||||
opt.formatoptions = "l"
|
opt.formatoptions = "l"
|
||||||
|
@ -126,12 +117,3 @@ opt.formatoptions = opt.formatoptions
|
||||||
+ "n" -- Indent past the formatlistpat, not underneath it.
|
+ "n" -- Indent past the formatlistpat, not underneath it.
|
||||||
+ "j" -- Auto-remove comments if possible.
|
+ "j" -- Auto-remove comments if possible.
|
||||||
- "2" -- I'm not in gradeschool anymore
|
- "2" -- I'm not in gradeschool anymore
|
||||||
|
|
||||||
opt.guicursor = {
|
|
||||||
"n-v:block",
|
|
||||||
"i-c-ci-ve:ver25",
|
|
||||||
"r-cr:hor20",
|
|
||||||
"o:hor50",
|
|
||||||
"i:blinkwait700-blinkoff400-blinkon250-Cursor/lCursor",
|
|
||||||
"sm:block-blinkwait175-blinkoff150-blinkon175",
|
|
||||||
}
|
|
||||||
|
|
|
@ -0,0 +1 @@
|
||||||
|
|
|
@ -14,21 +14,48 @@ return {
|
||||||
},
|
},
|
||||||
config = function()
|
config = function()
|
||||||
-- See `:help cmp`
|
-- See `:help cmp`
|
||||||
|
vim.opt.completeopt = { 'menu', 'menuone', 'noselect' }
|
||||||
|
require('luasnip.loaders.from_vscode').lazy_load()
|
||||||
|
|
||||||
local cmp = require 'cmp'
|
local cmp = require 'cmp'
|
||||||
local luasnip = require 'luasnip'
|
local luasnip = require 'luasnip'
|
||||||
require('luasnip.loaders.from_vscode').lazy_load()
|
|
||||||
luasnip.config.setup {}
|
luasnip.config.setup {}
|
||||||
|
|
||||||
|
local select_opts = { behavior = cmp.SelectBehavior.Select }
|
||||||
|
|
||||||
cmp.setup {
|
cmp.setup {
|
||||||
snippet = {
|
snippet = {
|
||||||
expand = function(args)
|
expand = function(args)
|
||||||
luasnip.lsp_expand(args.body)
|
luasnip.lsp_expand(args.body)
|
||||||
end,
|
end,
|
||||||
},
|
},
|
||||||
|
sources = {
|
||||||
|
{ name = 'path' },
|
||||||
|
{ name = 'nvim_lsp', keyword_length = 1 },
|
||||||
|
{ name = 'buffer', keyword_length = 3 },
|
||||||
|
{ name = 'luasnip', keyword_length = 2 },
|
||||||
|
},
|
||||||
|
window = {
|
||||||
|
documentation = cmp.config.window.bordered()
|
||||||
|
},
|
||||||
|
formatting = {
|
||||||
|
fields = { 'menu', 'abbr', 'kind' },
|
||||||
|
format = function(entry, item)
|
||||||
|
local menu_icon = {
|
||||||
|
nvim_lsp = 'λ',
|
||||||
|
luasnip = '⋗',
|
||||||
|
buffer = 'Ω',
|
||||||
|
path = '🖫',
|
||||||
|
}
|
||||||
|
|
||||||
|
item.menu = menu_icon[entry.source.name]
|
||||||
|
return item
|
||||||
|
end,
|
||||||
|
},
|
||||||
mapping = cmp.mapping.preset.insert {
|
mapping = cmp.mapping.preset.insert {
|
||||||
['<C-n>'] = cmp.mapping.select_next_item(),
|
['<C-n>'] = cmp.mapping.select_next_item(),
|
||||||
['<C-p>'] = cmp.mapping.select_prev_item(),
|
['<C-p>'] = cmp.mapping.select_prev_item(),
|
||||||
['<C-d>'] = cmp.mapping.scroll_docs(-4),
|
['<C-b>'] = cmp.mapping.scroll_docs(-4),
|
||||||
['<C-f>'] = cmp.mapping.scroll_docs(4),
|
['<C-f>'] = cmp.mapping.scroll_docs(4),
|
||||||
['<C-Space>'] = cmp.mapping.complete {},
|
['<C-Space>'] = cmp.mapping.complete {},
|
||||||
['<CR>'] = cmp.mapping.confirm {
|
['<CR>'] = cmp.mapping.confirm {
|
||||||
|
@ -54,10 +81,38 @@ return {
|
||||||
end
|
end
|
||||||
end, { 'i', 's' }),
|
end, { 'i', 's' }),
|
||||||
},
|
},
|
||||||
sources = {
|
|
||||||
{ name = 'nvim_lsp' },
|
|
||||||
{ name = 'luasnip' },
|
|
||||||
},
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
local sign = function(opts)
|
||||||
|
vim.fn.sign_define(opts.name, {
|
||||||
|
texthl = opts.name,
|
||||||
|
text = opts.text,
|
||||||
|
numhl = ''
|
||||||
|
})
|
||||||
|
end
|
||||||
|
|
||||||
|
sign({ name = 'DiagnosticSignError', text = '✘' })
|
||||||
|
sign({ name = 'DiagnosticSignWarn', text = '▲' })
|
||||||
|
sign({ name = 'DiagnosticSignHint', text = '⚑' })
|
||||||
|
sign({ name = 'DiagnosticSignInfo', text = '»' })
|
||||||
|
|
||||||
|
vim.diagnostic.config({
|
||||||
|
virtual_text = false,
|
||||||
|
severity_sort = true,
|
||||||
|
float = {
|
||||||
|
border = 'rounded',
|
||||||
|
source = 'always',
|
||||||
|
},
|
||||||
|
})
|
||||||
|
|
||||||
|
vim.lsp.handlers['textDocument/hover'] = vim.lsp.with(
|
||||||
|
vim.lsp.handlers.hover,
|
||||||
|
{ border = 'rounded' }
|
||||||
|
)
|
||||||
|
|
||||||
|
vim.lsp.handlers['textDocument/signatureHelp'] = vim.lsp.with(
|
||||||
|
vim.lsp.handlers.signature_help,
|
||||||
|
{ border = 'rounded' }
|
||||||
|
)
|
||||||
end,
|
end,
|
||||||
}
|
}
|
|
@ -60,17 +60,24 @@ return {
|
||||||
-- Create a command `:Format` local to the LSP buffer
|
-- Create a command `:Format` local to the LSP buffer
|
||||||
vim.api.nvim_buf_create_user_command(bufnr, 'Format', function(_)
|
vim.api.nvim_buf_create_user_command(bufnr, 'Format', function(_)
|
||||||
vim.lsp.buf.format()
|
vim.lsp.buf.format()
|
||||||
end, { desc = 'Format current buffer with LSP' })
|
end, { desc = 'Format current buffer with LSP and lint' })
|
||||||
|
|
||||||
-- Enable auto-formatting on save
|
-- Enable auto-formatting on save
|
||||||
vim.api.nvim_command([[
|
-- vim.api.nvim_command([[
|
||||||
augroup AutoFormatOnSave
|
-- augroup AutoFormatOnSave
|
||||||
autocmd!
|
-- autocmd!
|
||||||
autocmd BufWritePre * :Format
|
-- autocmd BufWritePre * :Format
|
||||||
augroup END
|
-- augroup END
|
||||||
]])
|
-- ]])
|
||||||
end
|
end
|
||||||
|
|
||||||
|
-- Setup neovim lua configuration
|
||||||
|
require('neodev').setup()
|
||||||
|
|
||||||
|
-- nvim-cmp supports additional completion capabilities, so broadcast that to servers
|
||||||
|
local capabilities = require('cmp_nvim_lsp').default_capabilities()
|
||||||
|
|
||||||
|
-- Servers configuration
|
||||||
local servers = {
|
local servers = {
|
||||||
clangd = {},
|
clangd = {},
|
||||||
gopls = {
|
gopls = {
|
||||||
|
@ -82,7 +89,7 @@ return {
|
||||||
completeUnimported = true,
|
completeUnimported = true,
|
||||||
usePlaceholders = true,
|
usePlaceholders = true,
|
||||||
analysis = {
|
analysis = {
|
||||||
unusedarams = true,
|
unusedParams = true,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
@ -91,46 +98,39 @@ return {
|
||||||
settings = {
|
settings = {
|
||||||
pylsp = {
|
pylsp = {
|
||||||
plugins = {
|
plugins = {
|
||||||
pycodestyle = {
|
black = {
|
||||||
ignore = { 'W391' },
|
blackArgs = {
|
||||||
maxLineLength = 79
|
"--line-length", "79",
|
||||||
|
"--exclude", "venv",
|
||||||
|
"--exclude", "env",
|
||||||
|
"--exclude", ".git",
|
||||||
|
"--exclude", ".hg",
|
||||||
|
},
|
||||||
|
lineLength = 79,
|
||||||
},
|
},
|
||||||
flake8 = {},
|
flake8 = {},
|
||||||
black = {
|
isort = {
|
||||||
lineLength = 79,
|
profile = "black",
|
||||||
-- Configure Black to split lines without specifying a target version
|
|
||||||
blackArgs = {
|
|
||||||
"--line-length",
|
|
||||||
"79",
|
|
||||||
"--exclude",
|
|
||||||
"venv",
|
|
||||||
"--exclude",
|
|
||||||
"env",
|
|
||||||
"--exclude",
|
|
||||||
".git",
|
|
||||||
"--exclude",
|
|
||||||
".hg",
|
|
||||||
},
|
|
||||||
},
|
},
|
||||||
mypy = {
|
mypy = {
|
||||||
enabled = true,
|
|
||||||
command = 'mypy',
|
|
||||||
args = {},
|
args = {},
|
||||||
|
command = "mypy",
|
||||||
diagnostics = true,
|
diagnostics = true,
|
||||||
|
enabled = true,
|
||||||
},
|
},
|
||||||
isort = {
|
pycodestyle = {
|
||||||
profile = 'black',
|
ignore = { "W391" },
|
||||||
|
maxLineLength = 79,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
python = {
|
python = {
|
||||||
-- Specify the path to your Python interpreter
|
|
||||||
pythonPath = "/usr/bin/python3",
|
|
||||||
analysis = {
|
analysis = {
|
||||||
autoSearchPaths = true,
|
autoSearchPaths = true,
|
||||||
diagnosticMode = 'openFilesOnly',
|
diagnosticMode = "openFilesOnly",
|
||||||
|
typeCheckingMode = "strict",
|
||||||
useLibraryCodeForTypes = true,
|
useLibraryCodeForTypes = true,
|
||||||
typeCheckingMode = 'on',
|
|
||||||
},
|
},
|
||||||
|
pythonPath = "/usr/local/bin/python3",
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
@ -138,7 +138,6 @@ return {
|
||||||
-- rust_analyzer = {},
|
-- rust_analyzer = {},
|
||||||
-- tsserver = {},
|
-- tsserver = {},
|
||||||
-- html = { filetypes = { 'html', 'twig', 'hbs'} },
|
-- html = { filetypes = { 'html', 'twig', 'hbs'} },
|
||||||
|
|
||||||
lua_ls = {
|
lua_ls = {
|
||||||
Lua = {
|
Lua = {
|
||||||
workspace = { checkThirdParty = false },
|
workspace = { checkThirdParty = false },
|
||||||
|
@ -147,16 +146,8 @@ return {
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
-- Setup neovim lua configuration
|
-- Setup Mason configuration
|
||||||
require('neodev').setup()
|
local mason = require('mason')
|
||||||
|
|
||||||
-- nvim-cmp supports additional completion capabilities, so broadcast that to servers
|
|
||||||
local capabilities = vim.lsp.protocol.make_client_capabilities()
|
|
||||||
capabilities = require('cmp_nvim_lsp').default_capabilities(capabilities)
|
|
||||||
|
|
||||||
-- Setup Mason condifuration
|
|
||||||
local mason = require 'mason'
|
|
||||||
|
|
||||||
mason.setup {
|
mason.setup {
|
||||||
ui = {
|
ui = {
|
||||||
icons = {
|
icons = {
|
||||||
|
@ -166,13 +157,14 @@ return {
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
-- Ensure the servers above are installed
|
|
||||||
local mason_lspconfig = require 'mason-lspconfig'
|
|
||||||
|
|
||||||
|
-- Ensure the servers above are installed
|
||||||
|
local mason_lspconfig = require('mason-lspconfig')
|
||||||
mason_lspconfig.setup {
|
mason_lspconfig.setup {
|
||||||
ensure_installed = vim.tbl_keys(servers)
|
ensure_installed = vim.tbl_keys(servers),
|
||||||
}
|
}
|
||||||
|
|
||||||
|
-- Add Mason handlers
|
||||||
mason_lspconfig.setup_handlers {
|
mason_lspconfig.setup_handlers {
|
||||||
function(server_name)
|
function(server_name)
|
||||||
require('lspconfig')[server_name].setup {
|
require('lspconfig')[server_name].setup {
|
||||||
|
@ -183,5 +175,8 @@ return {
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
}
|
}
|
||||||
|
|
||||||
|
-- Load nvim-cmp after Mason to allow Mason to configure it first
|
||||||
|
require('cmp')
|
||||||
end
|
end
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,34 @@
|
||||||
|
return {
|
||||||
|
"debugloop/telescope-undo.nvim",
|
||||||
|
dependencies = { -- note how they're inverted to above example
|
||||||
|
{
|
||||||
|
"nvim-telescope/telescope.nvim",
|
||||||
|
dependencies = { "nvim-lua/plenary.nvim" },
|
||||||
|
},
|
||||||
|
},
|
||||||
|
keys = {
|
||||||
|
{ -- lazy style key map
|
||||||
|
"<leader>u",
|
||||||
|
"<cmd>Telescope undo<cr>",
|
||||||
|
desc = "undo history",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
opts = {
|
||||||
|
extensions = {
|
||||||
|
undo = {
|
||||||
|
side_by_side = true,
|
||||||
|
layout_strategy = "vertical",
|
||||||
|
layout_config = {
|
||||||
|
preview_height = 0.8,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
config = function(_, opts)
|
||||||
|
-- Calling telescope's setup from multiple specs does not hurt, it will happily merge the
|
||||||
|
-- configs for us. We won't use data, as everything is in it's own namespace (telescope
|
||||||
|
-- defaults, as well as each extension).
|
||||||
|
require("telescope").setup(opts)
|
||||||
|
require("telescope").load_extension("undo")
|
||||||
|
end,
|
||||||
|
}
|
|
@ -4,6 +4,7 @@ return {
|
||||||
branch = '0.1.x',
|
branch = '0.1.x',
|
||||||
dependencies = {
|
dependencies = {
|
||||||
'nvim-lua/plenary.nvim',
|
'nvim-lua/plenary.nvim',
|
||||||
|
'debugloop/telescope-undo.nvim',
|
||||||
-- Fuzzy Finder Algorithm which requires local dependencies to be built.
|
-- Fuzzy Finder Algorithm which requires local dependencies to be built.
|
||||||
-- Only load if `make` is available. Make sure you have the system
|
-- Only load if `make` is available. Make sure you have the system
|
||||||
-- requirements installed.
|
-- requirements installed.
|
||||||
|
@ -19,7 +20,7 @@ return {
|
||||||
'nvim-tree/nvim-web-devicons',
|
'nvim-tree/nvim-web-devicons',
|
||||||
},
|
},
|
||||||
config = function()
|
config = function()
|
||||||
require('telescope').setup {
|
require('telescope').setup({
|
||||||
defaults = {
|
defaults = {
|
||||||
mappings = {
|
mappings = {
|
||||||
i = {
|
i = {
|
||||||
|
@ -28,7 +29,7 @@ return {
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
}
|
})
|
||||||
-- Enable telescope fzf native, if installed
|
-- Enable telescope fzf native, if installed
|
||||||
pcall(require('telescope').load_extension, 'fzf')
|
pcall(require('telescope').load_extension, 'fzf')
|
||||||
|
|
||||||
|
@ -68,5 +69,7 @@ return {
|
||||||
end
|
end
|
||||||
|
|
||||||
vim.api.nvim_create_user_command('LiveGrepGitRoot', live_grep_git_root, {})
|
vim.api.nvim_create_user_command('LiveGrepGitRoot', live_grep_git_root, {})
|
||||||
|
|
||||||
|
-- require("telescope").extensions.undo.undo()
|
||||||
end,
|
end,
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
return {
|
return {
|
||||||
'mbbill/undotree',
|
-- 'mbbill/undotree',
|
||||||
config = function()
|
-- config = function()
|
||||||
vim.keymap.set('n', '<leader>u', vim.cmd.UndotreeToggle, { desc = '[U]ndotree' })
|
-- vim.keymap.set('n', '<leader>u', vim.cmd.UndotreeToggle, { desc = '[U]ndotree' })
|
||||||
end
|
-- end
|
||||||
}
|
}
|
||||||
|
|
|
@ -43,4 +43,3 @@ return {
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,13 @@
|
||||||
return {
|
return {
|
||||||
'folke/which-key.nvim',
|
"folke/which-key.nvim",
|
||||||
opts = {}
|
event = "VeryLazy",
|
||||||
|
init = function()
|
||||||
|
vim.o.timeout = true
|
||||||
|
vim.o.timeoutlen = 300
|
||||||
|
end,
|
||||||
|
opts = {
|
||||||
|
-- your configuration comes here
|
||||||
|
-- or leave it empty to use the default settings
|
||||||
|
-- refer to the configuration section below
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue