parent
143ea8369d
commit
eb48860774
@ -1 +0,0 @@
|
|||||||
lazy-lock.json
|
|
||||||
@ -1,19 +1,7 @@
|
|||||||
local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim"
|
|
||||||
if not vim.loop.fs_stat(lazypath) then
|
|
||||||
vim.fn.system({
|
|
||||||
"git",
|
|
||||||
"clone",
|
|
||||||
"--filter=blob:none",
|
|
||||||
"https://github.com/folke/lazy.nvim.git",
|
|
||||||
"--branch=stable", -- latest stable release
|
|
||||||
lazypath,
|
|
||||||
})
|
|
||||||
end
|
|
||||||
vim.opt.rtp:prepend(lazypath)
|
|
||||||
|
|
||||||
vim.g.mapleader = " "
|
vim.g.mapleader = " "
|
||||||
-- keymaps goes first because it sets the leader key
|
|
||||||
require("keymaps")
|
require("keymaps")
|
||||||
require("set")
|
require("set")
|
||||||
|
|
||||||
require("lazy").setup("plugins")
|
require("plugins")
|
||||||
|
require("lsp")
|
||||||
|
|||||||
@ -0,0 +1,94 @@
|
|||||||
|
vim.pack.add {
|
||||||
|
{ src = 'https://github.com/neovim/nvim-lspconfig' },
|
||||||
|
}
|
||||||
|
|
||||||
|
local on_attach = function(_, bufnr)
|
||||||
|
local opts = { buffer = bufnr, remap = false }
|
||||||
|
vim.keymap.set("n", "gd", function() vim.lsp.buf.definition() end, opts)
|
||||||
|
vim.keymap.set("n", "<leader>k", function() vim.lsp.buf.hover() end, opts)
|
||||||
|
vim.keymap.set("n", "<leader>vws", function() vim.lsp.buf.workspace_symbol() end, opts)
|
||||||
|
vim.keymap.set("n", "<leader>vd", function() vim.diagnostic.open_float() end, opts)
|
||||||
|
vim.keymap.set("n", "[d", function() vim.lsp.diagnostics.goto_next() end, opts)
|
||||||
|
vim.keymap.set("n", "]d", function() vim.lsp.diagnostic.goto_prev() end, opts)
|
||||||
|
vim.keymap.set("n", "<leader>ca", function() vim.lsp.buf.code_action() end, opts)
|
||||||
|
vim.keymap.set("n", "gr", function() vim.lsp.buf.references() end, opts)
|
||||||
|
vim.keymap.set("n", "<leader>rn", function() vim.lsp.buf.rename() end, opts)
|
||||||
|
vim.keymap.set("i", "<C-k>", function() vim.lsp.buf.signature_help() end, opts)
|
||||||
|
vim.keymap.set("n", "<leader>fo", function() vim.lsp.buf.format() end, opts)
|
||||||
|
vim.keymap.set('n', '<Leader>D', vim.lsp.buf.type_definition, opts)
|
||||||
|
vim.keymap.set('n', '<Leader>e', vim.diagnostic.open_float, opts)
|
||||||
|
end
|
||||||
|
|
||||||
|
vim.lsp.config['rust_analyser'] = {
|
||||||
|
-- capabilities = capabilities,
|
||||||
|
on_attach = on_attach,
|
||||||
|
filetypes = { 'rust' },
|
||||||
|
settings = {
|
||||||
|
['rust-analyzer'] = {
|
||||||
|
checkOnSave = {
|
||||||
|
allFeatures = true,
|
||||||
|
overrideCommand = {
|
||||||
|
'cargo', 'clippy', '--workspace', '--message-format=json',
|
||||||
|
'--all-targets', '--all-features'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
vim.lsp.enable('rust_analyser')
|
||||||
|
|
||||||
|
vim.lsp.config['lua_ls'] = {
|
||||||
|
on_attach = on_attach,
|
||||||
|
filetypes = { 'lua' },
|
||||||
|
-- capabilities = capabilities,
|
||||||
|
settings = {
|
||||||
|
Lua = {
|
||||||
|
runtime = {
|
||||||
|
version = 'LuaJIT',
|
||||||
|
},
|
||||||
|
diagnostics = {
|
||||||
|
globals = { 'vim' },
|
||||||
|
},
|
||||||
|
workspace = {
|
||||||
|
library = vim.api.nvim_get_runtime_file("", true),
|
||||||
|
},
|
||||||
|
telemetry = {
|
||||||
|
enable = false,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
vim.lsp.enable('lua_ls')
|
||||||
|
|
||||||
|
vim.lsp.config['ts_ls'] = {
|
||||||
|
-- capabilities = capabilities,
|
||||||
|
on_attach = on_attach,
|
||||||
|
}
|
||||||
|
vim.lsp.enable('ts_ls')
|
||||||
|
|
||||||
|
vim.lsp.config['pyright'] = {
|
||||||
|
-- capabilities = capabilities,
|
||||||
|
on_attach = on_attach,
|
||||||
|
}
|
||||||
|
vim.lsp.enable('pyright')
|
||||||
|
|
||||||
|
vim.lsp.config['bashls'] = {
|
||||||
|
-- capabilities = capabilities,
|
||||||
|
on_attach = on_attach,
|
||||||
|
}
|
||||||
|
vim.lsp.enable('bashls')
|
||||||
|
|
||||||
|
vim.lsp.config['clangd'] = {
|
||||||
|
-- capabilities = capabilities,
|
||||||
|
on_attach = on_attach,
|
||||||
|
}
|
||||||
|
vim.lsp.enable('clangd')
|
||||||
|
|
||||||
|
vim.lsp.config['volar'] = {
|
||||||
|
filetypes = { 'typescript', 'javascript', 'javascriptreact', 'typescriptreact', 'vue', 'json' },
|
||||||
|
-- capabilities = capabilities,
|
||||||
|
on_attach = on_attach,
|
||||||
|
}
|
||||||
|
vim.lsp.enable('volar')
|
||||||
@ -0,0 +1,9 @@
|
|||||||
|
vim.pack.add({
|
||||||
|
{ src = 'https://github.com/dzfrias/arena.nvim', name = 'arena' },
|
||||||
|
})
|
||||||
|
|
||||||
|
require('arena').setup()
|
||||||
|
|
||||||
|
vim.keymap.set("n", "<leader>j", function()
|
||||||
|
require("arena").toggle()
|
||||||
|
end)
|
||||||
@ -0,0 +1,20 @@
|
|||||||
|
vim.pack.add({
|
||||||
|
{ src = "https://github.com/saghen/blink.cmp", version = vim.version.range("^1") },
|
||||||
|
{ src = "https://github.com/L3MON4D3/LuaSnip" },
|
||||||
|
{ src = "https://github.com/rafamadriz/friendly-snippets" },
|
||||||
|
})
|
||||||
|
|
||||||
|
require("blink.cmp").setup({
|
||||||
|
keymap = { preset = "default" },
|
||||||
|
appearance = {
|
||||||
|
nerd_font_variant = "mono",
|
||||||
|
use_nvim_cmp_as_default = true,
|
||||||
|
},
|
||||||
|
completion = {
|
||||||
|
documentation = { auto_show = true },
|
||||||
|
},
|
||||||
|
sources = {
|
||||||
|
default = { "lsp", "path", "snippets", "buffer" },
|
||||||
|
},
|
||||||
|
fuzzy = { implementation = "prefer_rust_with_warning" },
|
||||||
|
})
|
||||||
@ -1,6 +0,0 @@
|
|||||||
return {
|
|
||||||
'numToStr/Comment.nvim',
|
|
||||||
config = function()
|
|
||||||
require('Comment').setup()
|
|
||||||
end
|
|
||||||
}
|
|
||||||
@ -0,0 +1,57 @@
|
|||||||
|
vim.pack.add({ "https://github.com/stevearc/conform.nvim" })
|
||||||
|
|
||||||
|
require("conform").setup({
|
||||||
|
formatters_by_ft = {
|
||||||
|
lua = { "stylua", lsp_format = "fallback" },
|
||||||
|
python = { "isort", "black" },
|
||||||
|
rust = { "rustywind", "rustfmt", lsp_format = "fallback" },
|
||||||
|
javascript = { "rustywind", "prettier" },
|
||||||
|
json = { "prettier" },
|
||||||
|
markdown = { "prettier" },
|
||||||
|
typescript = { "rustywind", "prettier" },
|
||||||
|
vue = { "rustywind", "prettier" },
|
||||||
|
css = { "prettier" },
|
||||||
|
html = { "rustywind", "prettier" },
|
||||||
|
toml = { "taplo" },
|
||||||
|
},
|
||||||
|
default_format_opts = {
|
||||||
|
lsp_format = "fallback",
|
||||||
|
},
|
||||||
|
format_on_save = function(bufnr)
|
||||||
|
if vim.g.disable_autoformat or vim.b[bufnr].disable_autoformat then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
local bufname = vim.api.nvim_buf_get_name(bufnr)
|
||||||
|
if bufname:match("/node_modules/") then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
return { timeout_ms = 500, lsp_format = "fallback" }
|
||||||
|
end,
|
||||||
|
})
|
||||||
|
|
||||||
|
|
||||||
|
require("conform").formatters.black = {
|
||||||
|
append_args = { "--line-length=79" },
|
||||||
|
}
|
||||||
|
|
||||||
|
-- vim.api.nvim_create_autocmd("BufWritePre", {
|
||||||
|
-- pattern = "*",
|
||||||
|
-- callback = function(args, a)
|
||||||
|
-- require("conform").format({ bufnr = args.buf })
|
||||||
|
-- end,
|
||||||
|
-- })
|
||||||
|
|
||||||
|
vim.api.nvim_create_user_command("FormatDisable", function(opts)
|
||||||
|
if opts.bang then
|
||||||
|
vim.b.disable_autoformat = true
|
||||||
|
else
|
||||||
|
vim.g.disable_autoformat = true
|
||||||
|
end
|
||||||
|
vim.notify("Autoformat disabled" .. (opts.bang and " (buffer)" or " (global)"), vim.log.levels.WARN)
|
||||||
|
end, { desc = "Disable autoformat-on-save", bang = true })
|
||||||
|
|
||||||
|
vim.api.nvim_create_user_command("FormatEnable", function()
|
||||||
|
vim.b.disable_autoformat = false
|
||||||
|
vim.g.disable_autoformat = false
|
||||||
|
vim.notify("Autoformat enabled", vim.log.levels.INFO)
|
||||||
|
end, { desc = "Re-enable autoformat-on-save" })
|
||||||
@ -1,3 +1,3 @@
|
|||||||
return {
|
vim.pack.add({
|
||||||
"tpope/vim-fugitive"
|
{ src = 'https://github.com/tpope/vim-fugitive', name = 'fugitive' },
|
||||||
}
|
})
|
||||||
|
|||||||
@ -0,0 +1,9 @@
|
|||||||
|
require('plugins.plenary')
|
||||||
|
require('plugins.telescope')
|
||||||
|
require('plugins.tokyonight')
|
||||||
|
require('plugins.treesitter')
|
||||||
|
require('plugins.gitsigns')
|
||||||
|
require('plugins.fugitive')
|
||||||
|
require('plugins.conform')
|
||||||
|
require('plugins.blink')
|
||||||
|
require('plugins.arena')
|
||||||
@ -1,214 +0,0 @@
|
|||||||
return {
|
|
||||||
'neovim/nvim-lspconfig',
|
|
||||||
'hrsh7th/nvim-cmp', -- Autocompletion plugin
|
|
||||||
'hrsh7th/cmp-nvim-lsp', -- LSP source for nvim-cmp
|
|
||||||
'L3MON4D3/LuaSnip',
|
|
||||||
{
|
|
||||||
'nvimtools/none-ls.nvim',
|
|
||||||
dependencies = { 'nvim-lua/plenary.nvim' },
|
|
||||||
config = function()
|
|
||||||
local null_ls = require("null-ls")
|
|
||||||
|
|
||||||
local sources = {
|
|
||||||
-- python
|
|
||||||
null_ls.builtins.formatting.black.with({
|
|
||||||
extra_args = { "--line-length=79" }
|
|
||||||
}),
|
|
||||||
null_ls.builtins.formatting.isort,
|
|
||||||
null_ls.builtins.diagnostics.flake8,
|
|
||||||
-- java euh script
|
|
||||||
null_ls.builtins.formatting.prettier,
|
|
||||||
null_ls.builtins.code_actions.eslint,
|
|
||||||
null_ls.builtins.diagnostics.eslint,
|
|
||||||
-- convienence
|
|
||||||
null_ls.builtins.code_actions.gitsigns,
|
|
||||||
-- Docker
|
|
||||||
null_ls.builtins.diagnostics.hadolint,
|
|
||||||
-- TailwindCSS
|
|
||||||
null_ls.builtins.formatting.rustywind.with({
|
|
||||||
filetypes = { "javascript", "javascriptreact", "typescript", "typescriptreact", "vue", "svelte",
|
|
||||||
"html", "rust" },
|
|
||||||
}),
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
local lspconfig = require('lspconfig')
|
|
||||||
|
|
||||||
-- Add additional capabilities supported by nvim-cmp
|
|
||||||
local capabilities = require("cmp_nvim_lsp").default_capabilities()
|
|
||||||
|
|
||||||
local on_attach = function(_, bufnr)
|
|
||||||
local opts = { buffer = bufnr, remap = false }
|
|
||||||
vim.keymap.set("n", "gd", function() vim.lsp.buf.definition() end, opts)
|
|
||||||
vim.keymap.set("n", "<leader>k", function() vim.lsp.buf.hover() end, opts)
|
|
||||||
vim.keymap.set("n", "<leader>vws", function() vim.lsp.buf.workspace_symbol() end, opts)
|
|
||||||
vim.keymap.set("n", "<leader>vd", function() vim.diagnostic.open_float() end, opts)
|
|
||||||
vim.keymap.set("n", "[d", function() vim.diagnostic.goto_next() end, opts)
|
|
||||||
vim.keymap.set("n", "]d", function() vim.diagnostic.goto_prev() end, opts)
|
|
||||||
vim.keymap.set("n", "<leader>ca", function() vim.lsp.buf.code_action() end, opts)
|
|
||||||
vim.keymap.set("n", "gr", function() vim.lsp.buf.references() end, opts)
|
|
||||||
vim.keymap.set("n", "<leader>rn", function() vim.lsp.buf.rename() end, opts)
|
|
||||||
vim.keymap.set("i", "<C-k>", function() vim.lsp.buf.signature_help() end, opts)
|
|
||||||
vim.keymap.set("n", "<leader>fo", function() vim.lsp.buf.format() end, opts)
|
|
||||||
vim.keymap.set('n', '<Leader>D', vim.lsp.buf.type_definition, opts)
|
|
||||||
vim.keymap.set('n', '<Leader>e', vim.diagnostic.open_float, opts)
|
|
||||||
end
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
lspconfig.rust_analyzer.setup {
|
|
||||||
capabilities = capabilities,
|
|
||||||
on_attach = on_attach,
|
|
||||||
settings = {
|
|
||||||
['rust-analyzer'] = {
|
|
||||||
checkOnSave = {
|
|
||||||
allFeatures = true,
|
|
||||||
overrideCommand = {
|
|
||||||
'cargo', 'clippy', '--workspace', '--message-format=json',
|
|
||||||
'--all-targets', '--all-features'
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
lspconfig.lua_ls.setup {
|
|
||||||
on_attach = on_attach,
|
|
||||||
capabilities = capabilities,
|
|
||||||
settings = {
|
|
||||||
Lua = {
|
|
||||||
runtime = {
|
|
||||||
version = 'LuaJIT',
|
|
||||||
},
|
|
||||||
diagnostics = {
|
|
||||||
globals = { 'vim' },
|
|
||||||
},
|
|
||||||
workspace = {
|
|
||||||
library = vim.api.nvim_get_runtime_file("", true),
|
|
||||||
},
|
|
||||||
telemetry = {
|
|
||||||
enable = false,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
}
|
|
||||||
|
|
||||||
lspconfig.tsserver.setup {
|
|
||||||
capabilities = capabilities,
|
|
||||||
on_attach = on_attach,
|
|
||||||
}
|
|
||||||
|
|
||||||
-- lspconfig.vuels.setup {
|
|
||||||
-- capabilities = capabilities,
|
|
||||||
-- on_attach = on_attach,
|
|
||||||
-- }
|
|
||||||
|
|
||||||
lspconfig.pyright.setup {
|
|
||||||
capabilities = capabilities,
|
|
||||||
on_attach = on_attach,
|
|
||||||
}
|
|
||||||
|
|
||||||
lspconfig.bashls.setup {
|
|
||||||
capabilities = capabilities,
|
|
||||||
on_attach = on_attach,
|
|
||||||
}
|
|
||||||
|
|
||||||
lspconfig.clangd.setup {
|
|
||||||
capabilities = capabilities,
|
|
||||||
on_attach = on_attach,
|
|
||||||
}
|
|
||||||
|
|
||||||
lspconfig.volar.setup {
|
|
||||||
filetypes = { 'typescript', 'javascript', 'javascriptreact', 'typescriptreact', 'vue', 'json' },
|
|
||||||
capabilities = capabilities,
|
|
||||||
on_attach = on_attach,
|
|
||||||
}
|
|
||||||
|
|
||||||
-- Keep null_ls last so that its diagnostics and code actions come last
|
|
||||||
null_ls.setup({ sources = sources })
|
|
||||||
|
|
||||||
-- Global mappings.
|
|
||||||
vim.keymap.set('n', '<leader>e', vim.diagnostic.open_float)
|
|
||||||
vim.keymap.set('n', '[d', vim.diagnostic.goto_prev)
|
|
||||||
vim.keymap.set('n', ']d', vim.diagnostic.goto_next)
|
|
||||||
vim.keymap.set('n', '<leader>q', vim.diagnostic.setloclist)
|
|
||||||
|
|
||||||
-- Use LspAttach autocommand to only map the following keys
|
|
||||||
-- after the language server attaches to the current buffer
|
|
||||||
vim.api.nvim_create_autocmd('LspAttach', {
|
|
||||||
group = vim.api.nvim_create_augroup('UserLspConfig', {}),
|
|
||||||
callback = function(ev)
|
|
||||||
-- Enable completion triggered by <c-x><c-o>
|
|
||||||
vim.bo[ev.buf].omnifunc = 'v:lua.vim.lsp.omnifunc'
|
|
||||||
|
|
||||||
-- Buffer local mappings.
|
|
||||||
local opts = { buffer = ev.buf }
|
|
||||||
vim.keymap.set('n', 'gD', vim.lsp.buf.declaration, opts)
|
|
||||||
vim.keymap.set('n', 'gd', vim.lsp.buf.definition, opts)
|
|
||||||
vim.keymap.set('n', 'K', vim.lsp.buf.hover, opts)
|
|
||||||
vim.keymap.set('n', 'gi', vim.lsp.buf.implementation, opts)
|
|
||||||
vim.keymap.set('n', '<C-k>', vim.lsp.buf.signature_help, opts)
|
|
||||||
vim.keymap.set('n', '<leader>wa', vim.lsp.buf.add_workspace_folder, opts)
|
|
||||||
vim.keymap.set('n', '<leader>wr', vim.lsp.buf.remove_workspace_folder, opts)
|
|
||||||
vim.keymap.set('n', '<leader>wl', function()
|
|
||||||
print(vim.inspect(vim.lsp.buf.list_workspace_folders()))
|
|
||||||
end, opts)
|
|
||||||
vim.keymap.set('n', '<leader>D', vim.lsp.buf.type_definition, opts)
|
|
||||||
vim.keymap.set('n', '<leader>rn', vim.lsp.buf.rename, opts)
|
|
||||||
vim.keymap.set('n', '<leader>ca', vim.lsp.buf.code_action, opts)
|
|
||||||
vim.keymap.set('n', 'gr', vim.lsp.buf.references, opts)
|
|
||||||
vim.keymap.set('n', '<leader>f', function()
|
|
||||||
vim.lsp.buf.format { async = true }
|
|
||||||
end, opts)
|
|
||||||
end,
|
|
||||||
})
|
|
||||||
|
|
||||||
-- nvim-cmp setup
|
|
||||||
local cmp = require 'cmp'
|
|
||||||
cmp.setup {
|
|
||||||
snippet = {
|
|
||||||
expand = function(args)
|
|
||||||
require('luasnip').lsp_expand(args.body)
|
|
||||||
end,
|
|
||||||
},
|
|
||||||
window = {
|
|
||||||
completion = cmp.config.window.bordered(),
|
|
||||||
documentation = cmp.config.window.bordered(),
|
|
||||||
},
|
|
||||||
mapping = cmp.mapping.preset.insert({
|
|
||||||
['<C-u>'] = cmp.mapping.scroll_docs(-4), -- Up
|
|
||||||
['<C-d>'] = cmp.mapping.scroll_docs(4), -- Down
|
|
||||||
-- C-b (back) C-f (forward) for snippet placeholder navigation.
|
|
||||||
['<C-Space>'] = cmp.mapping.complete(),
|
|
||||||
['<CR>'] = cmp.mapping.confirm {
|
|
||||||
behavior = cmp.ConfirmBehavior.Replace,
|
|
||||||
select = true,
|
|
||||||
},
|
|
||||||
['<Tab>'] = cmp.mapping(function(fallback)
|
|
||||||
if cmp.visible() then
|
|
||||||
cmp.select_next_item()
|
|
||||||
else
|
|
||||||
fallback()
|
|
||||||
end
|
|
||||||
end, { 'i', 's' }),
|
|
||||||
['<S-Tab>'] = cmp.mapping(function(fallback)
|
|
||||||
if cmp.visible() then
|
|
||||||
cmp.select_prev_item()
|
|
||||||
else
|
|
||||||
fallback()
|
|
||||||
end
|
|
||||||
end, { 'i', 's' }),
|
|
||||||
}),
|
|
||||||
sources = cmp.config.sources({
|
|
||||||
{ name = 'nvim_lsp' },
|
|
||||||
{ name = 'luasnip' },
|
|
||||||
}, {
|
|
||||||
{ name = 'buffer' },
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
-- Format on save
|
|
||||||
vim.cmd [[autocmd BufWritePre * lua vim.lsp.buf.format()]]
|
|
||||||
end
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -1,9 +0,0 @@
|
|||||||
return {
|
|
||||||
{
|
|
||||||
"iamcco/markdown-preview.nvim",
|
|
||||||
event = "BufRead",
|
|
||||||
build = function()
|
|
||||||
vim.fn["mkdp#util#install"]()
|
|
||||||
end,
|
|
||||||
},
|
|
||||||
}
|
|
||||||
@ -0,0 +1,3 @@
|
|||||||
|
vim.pack.add({
|
||||||
|
{ src = 'https://github.com/nvim-lua/plenary.nvim', name = 'plenary' },
|
||||||
|
})
|
||||||
@ -1,45 +1,17 @@
|
|||||||
return {
|
vim.pack.add({
|
||||||
'nvim-telescope/telescope.nvim',
|
{ src = 'https://github.com/nvim-telescope/telescope.nvim', name = 'telescope' },
|
||||||
tag = '0.1.4',
|
})
|
||||||
dependencies = {
|
|
||||||
'nvim-lua/plenary.nvim',
|
|
||||||
'debugloop/telescope-undo.nvim',
|
|
||||||
},
|
|
||||||
config = function()
|
|
||||||
-- TELESCOPE
|
|
||||||
local builtin = require('telescope.builtin')
|
|
||||||
vim.keymap.set('n', '<leader>ff', builtin.find_files, {})
|
|
||||||
vim.keymap.set('n', '<leader>fg', builtin.live_grep, {})
|
|
||||||
vim.keymap.set('n', '<leader>fb', builtin.buffers, {})
|
|
||||||
vim.keymap.set('n', '<leader>fh', builtin.help_tags, {})
|
|
||||||
vim.keymap.set('n', '<leader>fq', builtin.quickfix, {})
|
|
||||||
vim.keymap.set('n', '<leader>fr', builtin.lsp_references, {})
|
|
||||||
vim.keymap.set('n', '<leader>fw', builtin.lsp_workspace_symbols, {})
|
|
||||||
vim.keymap.set('n', '<leader>fd', builtin.diagnostics, {})
|
|
||||||
vim.keymap.set('n', '<leader>fc', builtin.git_commits, {})
|
|
||||||
vim.keymap.set('n', '<leader>fbc', builtin.git_bcommits, {})
|
|
||||||
|
|
||||||
-- TELESCOPE UNDO
|
telescope = require('telescope')
|
||||||
require("telescope").setup({
|
|
||||||
extensions = {
|
|
||||||
undo = {
|
|
||||||
use_delta = true,
|
|
||||||
use_custom_command = nil, -- setting this implies `use_delta = false`. Accepted format is: { "bash", "-c", "echo '$DIFF' | delta" }
|
|
||||||
side_by_side = false,
|
|
||||||
vim_diff_opts = { ctxlen = 0 },
|
|
||||||
entry_format = "state #$ID, $STAT, $TIME",
|
|
||||||
mappings = {
|
|
||||||
i = {
|
|
||||||
["<cr>"] = require("telescope-undo.actions").yank_additions,
|
|
||||||
["<S-cr>"] = require("telescope-undo.actions").yank_deletions,
|
|
||||||
["<C-cr>"] = require("telescope-undo.actions").restore,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
})
|
|
||||||
require("telescope").load_extension("undo")
|
|
||||||
|
|
||||||
vim.keymap.set("n", "<leader>u", "<cmd>Telescope undo<cr>")
|
local builtin = require('telescope.builtin')
|
||||||
end
|
vim.keymap.set('n', '<leader>ff', builtin.find_files, {})
|
||||||
}
|
vim.keymap.set('n', '<leader>fg', builtin.live_grep, {})
|
||||||
|
vim.keymap.set('n', '<leader>fb', builtin.buffers, {})
|
||||||
|
vim.keymap.set('n', '<leader>fh', builtin.help_tags, {})
|
||||||
|
vim.keymap.set('n', '<leader>fq', builtin.quickfix, {})
|
||||||
|
vim.keymap.set('n', '<leader>fr', builtin.lsp_references, {})
|
||||||
|
vim.keymap.set('n', '<leader>fw', builtin.lsp_workspace_symbols, {})
|
||||||
|
vim.keymap.set('n', '<leader>fd', builtin.diagnostics, {})
|
||||||
|
vim.keymap.set('n', '<leader>fc', builtin.git_commits, {})
|
||||||
|
vim.keymap.set('n', '<leader>fbc', builtin.git_bcommits, {})
|
||||||
|
|||||||
@ -1,9 +1,6 @@
|
|||||||
return {
|
vim.pack.add({
|
||||||
'folke/tokyonight.nvim',
|
{ src = 'https://github.com/folke/tokyonight.nvim', name = 'tokyonight' },
|
||||||
lazy = false, -- make sure we load this during startup if it is your main colorscheme
|
})
|
||||||
priority = 1000, -- make sure to load this before all the other start plugins
|
|
||||||
config = function()
|
vim.cmd([[colorscheme tokyonight-night]])
|
||||||
-- load the colorscheme here
|
|
||||||
vim.cmd([[colorscheme tokyonight-night]])
|
|
||||||
end,
|
|
||||||
}
|
|
||||||
|
|||||||
@ -1,114 +1,179 @@
|
|||||||
return {
|
vim.pack.add({
|
||||||
"nvim-treesitter/nvim-treesitter",
|
{ src = 'https://github.com/nvim-treesitter/nvim-treesitter', name = 'treesitter', branch = 'main' },
|
||||||
dependencies = {
|
{ src = 'https://github.com/nvim-treesitter/nvim-treesitter-context', name = 'treesitter-context' },
|
||||||
"nvim-treesitter/nvim-treesitter-context",
|
{ src = 'https://github.com/nvim-treesitter/nvim-treesitter-textobjects', name = 'treesitter-textobjects' },
|
||||||
"nvim-treesitter/nvim-treesitter-textobjects",
|
})
|
||||||
"nvim-treesitter/playground",
|
|
||||||
},
|
require("nvim-treesitter").setup()
|
||||||
build = ":TSUpdate",
|
require("nvim-treesitter").install({
|
||||||
config = function()
|
"bash",
|
||||||
require("nvim-treesitter.install").update({ with_sync = true })
|
"blade",
|
||||||
|
"c",
|
||||||
|
"comment",
|
||||||
|
"css",
|
||||||
|
"diff",
|
||||||
|
"dockerfile",
|
||||||
|
"fish",
|
||||||
|
"gitcommit",
|
||||||
|
"gitignore",
|
||||||
|
"go",
|
||||||
|
"gomod",
|
||||||
|
"gosum",
|
||||||
|
"gowork",
|
||||||
|
"html",
|
||||||
|
"ini",
|
||||||
|
"javascript",
|
||||||
|
"jsdoc",
|
||||||
|
"json",
|
||||||
|
"lua",
|
||||||
|
"luadoc",
|
||||||
|
"luap",
|
||||||
|
"make",
|
||||||
|
"markdown",
|
||||||
|
"markdown_inline",
|
||||||
|
"nginx",
|
||||||
|
"nix",
|
||||||
|
"proto",
|
||||||
|
"python",
|
||||||
|
"query",
|
||||||
|
"regex",
|
||||||
|
"rust",
|
||||||
|
"scss",
|
||||||
|
"sql",
|
||||||
|
"terraform",
|
||||||
|
"toml",
|
||||||
|
"tsx",
|
||||||
|
"typescript",
|
||||||
|
"vim",
|
||||||
|
"vimdoc",
|
||||||
|
"xml",
|
||||||
|
"yaml",
|
||||||
|
"zig",
|
||||||
|
})
|
||||||
|
|
||||||
require("nvim-treesitter.configs").setup {
|
|
||||||
ensure_installed = "all",
|
-- configuration
|
||||||
highlight = { enable = true, },
|
require("nvim-treesitter-textobjects").setup {
|
||||||
textobjects = {
|
|
||||||
select = {
|
select = {
|
||||||
enable = true,
|
-- Automatically jump forward to textobj, similar to targets.vim
|
||||||
lookahead = true,
|
lookahead = true,
|
||||||
keymaps = {
|
-- You can choose the select mode (default is charwise 'v')
|
||||||
["af"] = "@function.outer",
|
--
|
||||||
["if"] = "@function.inner",
|
-- Can also be a function which gets passed a table with the keys
|
||||||
["ac"] = "@class.outer",
|
-- * query_string: eg '@function.inner'
|
||||||
["ic"] = { query = "@class.inner", desc = "Select inner part of a class region" },
|
-- * method: eg 'v' or 'o'
|
||||||
["as"] = { query = "@scope", query_group = "locals", desc = "Select language scope" },
|
-- and should return the mode ('v', 'V', or '<c-v>') or a table
|
||||||
["is"] = { query = "@scope", query_group = "locals", desc = "Select language scope" },
|
-- mapping query_strings to modes.
|
||||||
['al'] = '@loop.outer',
|
|
||||||
['il'] = '@loop.inner',
|
|
||||||
['aa'] = '@parameter.outer',
|
|
||||||
['ia'] = '@parameter.inner',
|
|
||||||
},
|
|
||||||
selection_modes = {
|
selection_modes = {
|
||||||
['@parameter.outer'] = 'v', -- charwise
|
['@parameter.outer'] = 'v', -- charwise
|
||||||
['@function.outer'] = 'V', -- linewise
|
['@function.outer'] = 'V', -- linewise
|
||||||
['@class.outer'] = '<c-v>', -- blockwise
|
['@class.outer'] = '<c-v>', -- blockwise
|
||||||
},
|
},
|
||||||
include_surrounding_whitespace = true,
|
-- If you set this to `true` (default is `false`) then any textobject is
|
||||||
},
|
-- extended to include preceding or succeeding whitespace. Succeeding
|
||||||
swap = {
|
-- whitespace has priority in order to act similarly to eg the built-in
|
||||||
enable = true,
|
-- `ap`.
|
||||||
swap_next = {
|
|
||||||
["<leader>a"] = "@parameter.inner",
|
|
||||||
},
|
|
||||||
swap_previous = {
|
|
||||||
["<leader>A"] = "@parameter.inner",
|
|
||||||
},
|
|
||||||
},
|
|
||||||
lsp_interop = {
|
|
||||||
enable = true,
|
|
||||||
border = 'none',
|
|
||||||
floating_preview_opts = {},
|
|
||||||
peek_definition_code = {
|
|
||||||
["<leader>gf"] = "@function.outer",
|
|
||||||
["<leader>gc"] = "@class.outer",
|
|
||||||
},
|
|
||||||
},
|
|
||||||
move = {
|
|
||||||
enable = true,
|
|
||||||
set_jumps = true, -- whether to set jumps in the jumplist
|
|
||||||
goto_next_start = {
|
|
||||||
["]m"] = "@function.outer",
|
|
||||||
["]]"] = { query = "@class.outer", desc = "Next class start" },
|
|
||||||
--
|
|
||||||
-- You can use regex matching (i.e. lua pattern) and/or pass a list in a "query" key to group multiple queires.
|
|
||||||
["]o"] = "@loop.*",
|
|
||||||
-- ["]o"] = { query = { "@loop.inner", "@loop.outer" } }
|
|
||||||
--
|
--
|
||||||
-- You can pass a query group to use query from `queries/<lang>/<query_group>.scm file in your runtime path.
|
-- Can also be a function which gets passed a table with the keys
|
||||||
-- Below example nvim-treesitter's `locals.scm` and `folds.scm`. They also provide highlights.scm and indent.scm.
|
-- * query_string: eg '@function.inner'
|
||||||
["]s"] = { query = "@scope", query_group = "locals", desc = "Next scope" },
|
-- * selection_mode: eg 'v'
|
||||||
["]z"] = { query = "@fold", query_group = "folds", desc = "Next fold" },
|
-- and should return true of false
|
||||||
},
|
include_surrounding_whitespace = false,
|
||||||
goto_next_end = {
|
|
||||||
["]M"] = "@function.outer",
|
|
||||||
["]["] = "@class.outer",
|
|
||||||
},
|
|
||||||
goto_previous_start = {
|
|
||||||
["[m"] = "@function.outer",
|
|
||||||
["[["] = "@class.outer",
|
|
||||||
},
|
|
||||||
goto_previous_end = {
|
|
||||||
["[M"] = "@function.outer",
|
|
||||||
["[]"] = "@class.outer",
|
|
||||||
},
|
|
||||||
-- Below will go to either the start or the end, whichever is closer.
|
|
||||||
-- Use if you want more granular movements
|
|
||||||
-- Make it even more gradual by adding multiple queries and regex.
|
|
||||||
goto_next = {
|
|
||||||
["]i"] = "@conditional.outer",
|
|
||||||
},
|
|
||||||
goto_previous = {
|
|
||||||
["[i"] = "@conditional.outer",
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
|
move = {
|
||||||
|
-- whether to set jumps in the jumplist
|
||||||
|
set_jumps = true,
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
local ts_repeat_move = require "nvim-treesitter.textobjects.repeatable_move"
|
-- keymaps
|
||||||
|
-- You can use the capture groups defined in `textobjects.scm`
|
||||||
|
vim.keymap.set({ "x", "o" }, "am", function()
|
||||||
|
require "nvim-treesitter-textobjects.select".select_textobject("@function.outer", "textobjects")
|
||||||
|
end)
|
||||||
|
vim.keymap.set({ "x", "o" }, "im", function()
|
||||||
|
require "nvim-treesitter-textobjects.select".select_textobject("@function.inner", "textobjects")
|
||||||
|
end)
|
||||||
|
vim.keymap.set({ "x", "o" }, "ac", function()
|
||||||
|
require "nvim-treesitter-textobjects.select".select_textobject("@class.outer", "textobjects")
|
||||||
|
end)
|
||||||
|
vim.keymap.set({ "x", "o" }, "ic", function()
|
||||||
|
require "nvim-treesitter-textobjects.select".select_textobject("@class.inner", "textobjects")
|
||||||
|
end)
|
||||||
|
vim.keymap.set({ "x", "o" }, "ia", function()
|
||||||
|
require "nvim-treesitter-textobjects.select".select_textobject("@parameter.inner", "textobjects")
|
||||||
|
end)
|
||||||
|
vim.keymap.set({ "x", "o" }, "aa", function()
|
||||||
|
require "nvim-treesitter-textobjects.select".select_textobject("@parameter.inner", "textobjects")
|
||||||
|
end)
|
||||||
|
vim.keymap.set({ "x", "o" }, "il", function()
|
||||||
|
require "nvim-treesitter-textobjects.select".select_textobject("@parameter.loop", "textobjects")
|
||||||
|
end)
|
||||||
|
vim.keymap.set({ "x", "o" }, "al", function()
|
||||||
|
require "nvim-treesitter-textobjects.select".select_textobject("@parameter.loop", "textobjects")
|
||||||
|
end)
|
||||||
|
-- You can also use captures from other query groups like `locals.scm`
|
||||||
|
vim.keymap.set({ "x", "o" }, "as", function()
|
||||||
|
require "nvim-treesitter-textobjects.select".select_textobject("@local.scope", "locals")
|
||||||
|
end)
|
||||||
|
|
||||||
-- Repeat movement with ; and ,
|
-- SWAP Keymaps
|
||||||
-- ensure ; goes forward and , goes backward regardless of the last direction
|
vim.keymap.set("n", "<leader>a", function()
|
||||||
vim.keymap.set({ "n", "x", "o" }, ";", ts_repeat_move.repeat_last_move_next)
|
require("nvim-treesitter-textobjects.swap").swap_next "@parameter.inner"
|
||||||
vim.keymap.set({ "n", "x", "o" }, ",", ts_repeat_move.repeat_last_move_previous)
|
end)
|
||||||
|
vim.keymap.set("n", "<leader>A", function()
|
||||||
|
require("nvim-treesitter-textobjects.swap").swap_previous "@parameter.outer"
|
||||||
|
end)
|
||||||
|
|
||||||
-- vim way: ; goes to the direction you were moving.
|
-- MOVE keymaps
|
||||||
-- vim.keymap.set({ "n", "x", "o" }, ";", ts_repeat_move.repeat_last_move)
|
-- You can use the capture groups defined in `textobjects.scm`
|
||||||
-- vim.keymap.set({ "n", "x", "o" }, ",", ts_repeat_move.repeat_last_move_opposite)
|
vim.keymap.set({ "n", "x", "o" }, "]m", function()
|
||||||
|
require("nvim-treesitter-textobjects.move").goto_next_start("@function.outer", "textobjects")
|
||||||
|
end)
|
||||||
|
vim.keymap.set({ "n", "x", "o" }, "]]", function()
|
||||||
|
require("nvim-treesitter-textobjects.move").goto_next_start("@class.outer", "textobjects")
|
||||||
|
end)
|
||||||
|
-- You can also pass a list to group multiple queries.
|
||||||
|
vim.keymap.set({ "n", "x", "o" }, "]o", function()
|
||||||
|
require("nvim-treesitter-textobjects.move").goto_next_start({ "@loop.inner", "@loop.outer" }, "textobjects")
|
||||||
|
end)
|
||||||
|
-- You can also use captures from other query groups like `locals.scm` or `folds.scm`
|
||||||
|
vim.keymap.set({ "n", "x", "o" }, "]s", function()
|
||||||
|
require("nvim-treesitter-textobjects.move").goto_next_start("@local.scope", "locals")
|
||||||
|
end)
|
||||||
|
vim.keymap.set({ "n", "x", "o" }, "]M", function()
|
||||||
|
require("nvim-treesitter-textobjects.move").goto_next_end("@function.outer", "textobjects")
|
||||||
|
end)
|
||||||
|
vim.keymap.set({ "n", "x", "o" }, "][", function()
|
||||||
|
require("nvim-treesitter-textobjects.move").goto_next_end("@class.outer", "textobjects")
|
||||||
|
end)
|
||||||
|
vim.keymap.set({ "n", "x", "o" }, "[m", function()
|
||||||
|
require("nvim-treesitter-textobjects.move").goto_previous_start("@function.outer", "textobjects")
|
||||||
|
end)
|
||||||
|
vim.keymap.set({ "n", "x", "o" }, "[[", function()
|
||||||
|
require("nvim-treesitter-textobjects.move").goto_previous_start("@class.outer", "textobjects")
|
||||||
|
end)
|
||||||
|
|
||||||
-- Optionally, make builtin f, F, t, T also repeatable with ; and ,
|
vim.keymap.set({ "n", "x", "o" }, "[M", function()
|
||||||
vim.keymap.set({ "n", "x", "o" }, "f", ts_repeat_move.builtin_f)
|
require("nvim-treesitter-textobjects.move").goto_previous_end("@function.outer", "textobjects")
|
||||||
vim.keymap.set({ "n", "x", "o" }, "F", ts_repeat_move.builtin_F)
|
end)
|
||||||
vim.keymap.set({ "n", "x", "o" }, "t", ts_repeat_move.builtin_t)
|
vim.keymap.set({ "n", "x", "o" }, "[]", function()
|
||||||
vim.keymap.set({ "n", "x", "o" }, "T", ts_repeat_move.builtin_T)
|
require("nvim-treesitter-textobjects.move").goto_previous_end("@class.outer", "textobjects")
|
||||||
end,
|
end)
|
||||||
}
|
|
||||||
|
|
||||||
|
local ts_repeat_move = require "nvim-treesitter-textobjects.repeatable_move"
|
||||||
|
|
||||||
|
-- Repeat movement with ; and ,
|
||||||
|
-- ensure ; goes forward and , goes backward regardless of the last direction
|
||||||
|
vim.keymap.set({ "n", "x", "o" }, ";", ts_repeat_move.repeat_last_move_next)
|
||||||
|
vim.keymap.set({ "n", "x", "o" }, ",", ts_repeat_move.repeat_last_move_previous)
|
||||||
|
|
||||||
|
-- Optionally, make builtin f, F, t, T also repeatable with ; and ,
|
||||||
|
vim.keymap.set({ "n", "x", "o" }, "f", ts_repeat_move.builtin_f_expr, { expr = true })
|
||||||
|
vim.keymap.set({ "n", "x", "o" }, "F", ts_repeat_move.builtin_F_expr, { expr = true })
|
||||||
|
vim.keymap.set({ "n", "x", "o" }, "t", ts_repeat_move.builtin_t_expr, { expr = true })
|
||||||
|
vim.keymap.set({ "n", "x", "o" }, "T", ts_repeat_move.builtin_T_expr, { expr = true })
|
||||||
|
|
||||||
|
-- Use treesitter for auto indentation detection
|
||||||
|
vim.bo.indentexpr = "v:lua.vim.treesitter.indentexpr()"
|
||||||
|
|||||||
@ -0,0 +1,77 @@
|
|||||||
|
{
|
||||||
|
"plugins": {
|
||||||
|
"LuaSnip": {
|
||||||
|
"rev": "a62e1083a3cfe8b6b206e7d3d33a51091df25357",
|
||||||
|
"src": "https://github.com/L3MON4D3/LuaSnip"
|
||||||
|
},
|
||||||
|
"arena": {
|
||||||
|
"rev": "9ebbf55b4f0e3815e3caf3264cc1a2721b5111e9",
|
||||||
|
"src": "https://github.com/dzfrias/arena.nvim"
|
||||||
|
},
|
||||||
|
"blink.cmp": {
|
||||||
|
"rev": "78336bc89ee5365633bcf754d93df01678b5c08f",
|
||||||
|
"src": "https://github.com/saghen/blink.cmp",
|
||||||
|
"version": "1.0.0 - 2.0.0"
|
||||||
|
},
|
||||||
|
"conform.nvim": {
|
||||||
|
"rev": "086a40dc7ed8242c03be9f47fbcee68699cc2395",
|
||||||
|
"src": "https://github.com/stevearc/conform.nvim"
|
||||||
|
},
|
||||||
|
"friendly-snippets": {
|
||||||
|
"rev": "6cd7280adead7f586db6fccbd15d2cac7e2188b9",
|
||||||
|
"src": "https://github.com/rafamadriz/friendly-snippets"
|
||||||
|
},
|
||||||
|
"fugitive": {
|
||||||
|
"rev": "3b753cf8c6a4dcde6edee8827d464ba9b8c4a6f0",
|
||||||
|
"src": "https://github.com/tpope/vim-fugitive"
|
||||||
|
},
|
||||||
|
"gitsigns": {
|
||||||
|
"rev": "8d82c240f190fc33723d48c308ccc1ed8baad69d",
|
||||||
|
"src": "https://github.com/lewis6991/gitsigns.nvim"
|
||||||
|
},
|
||||||
|
"markdown-preview": {
|
||||||
|
"rev": "a923f5fc5ba36a3b17e289dc35dc17f66d0548ee",
|
||||||
|
"src": "https://github.com/iamcco/markdown-preview.nvim"
|
||||||
|
},
|
||||||
|
"markdown-preview.nvim": {
|
||||||
|
"rev": "a923f5fc5ba36a3b17e289dc35dc17f66d0548ee",
|
||||||
|
"src": "https://github.com/iamcco/markdown-preview.nvim"
|
||||||
|
},
|
||||||
|
"nvim-lspconfig": {
|
||||||
|
"rev": "cb5bc0b2b35a6d513e3298d285db81453e791f4f",
|
||||||
|
"src": "https://github.com/neovim/nvim-lspconfig"
|
||||||
|
},
|
||||||
|
"peekup": {
|
||||||
|
"rev": "82251c54cd60f8504dfd9acd853eae57fe832447",
|
||||||
|
"src": "https://github.com/gennaro-tedesco/nvim-peekup"
|
||||||
|
},
|
||||||
|
"plenary": {
|
||||||
|
"rev": "74b06c6c75e4eeb3108ec01852001636d85a932b",
|
||||||
|
"src": "https://github.com/nvim-lua/plenary.nvim"
|
||||||
|
},
|
||||||
|
"telescope": {
|
||||||
|
"rev": "f7c673b8e46e8f233ff581d3624a517d33a7e264",
|
||||||
|
"src": "https://github.com/nvim-telescope/telescope.nvim"
|
||||||
|
},
|
||||||
|
"tokyonight": {
|
||||||
|
"rev": "cdc07ac78467a233fd62c493de29a17e0cf2b2b6",
|
||||||
|
"src": "https://github.com/folke/tokyonight.nvim"
|
||||||
|
},
|
||||||
|
"treesitter": {
|
||||||
|
"rev": "4916d6592ede8c07973490d9322f187e07dfefac",
|
||||||
|
"src": "https://github.com/nvim-treesitter/nvim-treesitter"
|
||||||
|
},
|
||||||
|
"treesitter-context": {
|
||||||
|
"rev": "b0c45cefe2c8f7b55fc46f34e563bc428ef99636",
|
||||||
|
"src": "https://github.com/nvim-treesitter/nvim-treesitter-context"
|
||||||
|
},
|
||||||
|
"treesitter-playground": {
|
||||||
|
"rev": "ba48c6a62a280eefb7c85725b0915e021a1a0749",
|
||||||
|
"src": "https://github.com/nvim-treesitter/playground"
|
||||||
|
},
|
||||||
|
"treesitter-textobjects": {
|
||||||
|
"rev": "851e865342e5a4cb1ae23d31caf6e991e1c99f1e",
|
||||||
|
"src": "https://github.com/nvim-treesitter/nvim-treesitter-textobjects"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
Loading…
Reference in new issue