lazyvim
This commit is contained in:
@ -1,9 +0,0 @@
|
||||
vim.g['brightest#highlight'] = { group = 'BrightestUnderline' }
|
||||
vim.g['brightest_enable'] = 0
|
||||
vim.g['brightest#enable_filetypes'] = {
|
||||
_ = 1,
|
||||
vim = 0,
|
||||
NvimTree = 0,
|
||||
TelescopePrompt = 0,
|
||||
Trouble = 0,
|
||||
}
|
@ -1,82 +0,0 @@
|
||||
local cmp = require("cmp")
|
||||
local luasnip = require("luasnip")
|
||||
|
||||
local has_words_before = function()
|
||||
local line, col = unpack(vim.api.nvim_win_get_cursor(0))
|
||||
return col ~= 0 and vim.api.nvim_buf_get_lines(0, line - 1, line, true)[1]:sub(col, col):match("%s") == nil
|
||||
end
|
||||
cmp.setup({
|
||||
-- snippet = {
|
||||
-- expand = function(args)
|
||||
-- require('luasnip').lsp_expand(args.body) -- For `luasnip` users.
|
||||
-- end,
|
||||
-- },
|
||||
mapping = {
|
||||
['<C-k>'] = cmp.mapping.select_prev_item(),
|
||||
['<C-p>'] = cmp.mapping.select_prev_item(),
|
||||
['<C-j>'] = cmp.mapping.select_next_item(),
|
||||
['<C-n>'] = cmp.mapping.select_next_item(),
|
||||
['<C-d>'] = cmp.mapping(cmp.mapping.scroll_docs(-4), { 'i', 'c' }),
|
||||
['<C-f>'] = cmp.mapping(cmp.mapping.scroll_docs(4), { 'i', 'c' }),
|
||||
['<C-Space>'] = cmp.mapping(cmp.mapping.complete(), { 'i', 'c' }),
|
||||
['<C-y>'] = cmp.config.disable, -- Specify `cmp.config.disable` if you want to remove the default `<C-y>` mapping.
|
||||
['<C-e>'] = cmp.mapping({
|
||||
i = cmp.mapping.abort(),
|
||||
c = cmp.mapping.close(),
|
||||
}),
|
||||
['<CR>'] = cmp.mapping.confirm({ select = true }),
|
||||
['<Tab>'] = cmp.mapping(function(fallback)
|
||||
if cmp.visible() then
|
||||
cmp.select_next_item()
|
||||
elseif luasnip.expand_or_jumpable() then
|
||||
luasnip.expand_or_jump()
|
||||
elseif has_words_before() then
|
||||
cmp.complete()
|
||||
else
|
||||
fallback()
|
||||
end
|
||||
end, { "i", "s" }),
|
||||
['<S-Tab>'] = cmp.mapping(function(fallback)
|
||||
if cmp.visible() then
|
||||
cmp.select_prev_item()
|
||||
elseif luasnip.jumpable(-1) then
|
||||
luasnip.jump(-1)
|
||||
else
|
||||
fallback()
|
||||
end
|
||||
end, { "i", "s" })
|
||||
},
|
||||
sources = cmp.config.sources({
|
||||
{ name = 'nvim_lsp' },
|
||||
{ name = 'nvim_lsp_signature_help' },
|
||||
{ name = 'buffer' },
|
||||
-- { name = 'path' },
|
||||
}),
|
||||
window = {
|
||||
completion = cmp.config.window.bordered(),
|
||||
documentation = cmp.config.window.bordered(),
|
||||
},
|
||||
formatting = {
|
||||
fields = { 'menu', 'abbr', 'kind' },
|
||||
format = function(entry, item)
|
||||
local menu_icon = {
|
||||
nvim_lsp = 'λ',
|
||||
buffer = 'Ω'
|
||||
}
|
||||
item.menu = menu_icon[entry.source.name]
|
||||
return item
|
||||
end
|
||||
}
|
||||
})
|
||||
|
||||
cmp.setup.cmdline('/', {
|
||||
sources = {
|
||||
{ name = 'buffer' }
|
||||
}
|
||||
})
|
||||
|
||||
cmp.setup.cmdline(':', {
|
||||
sources = cmp.config.sources({
|
||||
{ name = 'path' }
|
||||
}, { { name = 'cmdline' } })
|
||||
})
|
13
nvim/lua/config/autocmds.lua
Normal file
13
nvim/lua/config/autocmds.lua
Normal file
@ -0,0 +1,13 @@
|
||||
-- Autocmds are automatically loaded on the VeryLazy event
|
||||
-- Default autocmds that are always set: https://github.com/LazyVim/LazyVim/blob/main/lua/lazyvim/config/autocmds.lua
|
||||
-- Add any additional autocmds here
|
||||
local function open_nvim_tree(data)
|
||||
local directory = vim.fn.isdirectory(data.file) == 1
|
||||
if not directory then
|
||||
return
|
||||
end
|
||||
|
||||
vim.cmd.cd(data.file)
|
||||
end
|
||||
|
||||
vim.api.nvim_create_autocmd({ "VimEnter" }, { callback = open_nvim_tree })
|
20
nvim/lua/config/keymaps.lua
Normal file
20
nvim/lua/config/keymaps.lua
Normal file
@ -0,0 +1,20 @@
|
||||
-- Keymaps are automatically loaded on the VeryLazy event
|
||||
-- Default keymaps that are always set: https://github.com/LazyVim/LazyVim/blob/main/lua/lazyvim/config/keymaps.lua
|
||||
-- Add any additional keymaps here
|
||||
|
||||
local function map(mode, lhs, rhs, opts)
|
||||
local keys = require("lazy.core.handler").handlers.keys
|
||||
---@cast keys LazyKeysHandler
|
||||
-- do not create the keymap if a lazy keys handler exists
|
||||
if not keys.active[keys.parse({ lhs, mode = mode }).id] then
|
||||
opts = opts or {}
|
||||
opts.silent = opts.silent ~= false
|
||||
if opts.remap and not vim.g.vscode then
|
||||
opts.remap = nil
|
||||
end
|
||||
vim.keymap.set(mode, lhs, rhs, opts)
|
||||
end
|
||||
end
|
||||
|
||||
map("t", "<Esc><Esc>", [[<C-\><C-n>]], {})
|
||||
map("", "tl", require("lsp_lines").toggle, { desc = "Toggle lsp_lines" })
|
46
nvim/lua/config/lazy.lua
Normal file
46
nvim/lua/config/lazy.lua
Normal file
@ -0,0 +1,46 @@
|
||||
local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim"
|
||||
if not vim.loop.fs_stat(lazypath) then
|
||||
-- bootstrap lazy.nvim
|
||||
-- stylua: ignore
|
||||
vim.fn.system({ "git", "clone", "--filter=blob:none", "https://github.com/folke/lazy.nvim.git", "--branch=stable", lazypath })
|
||||
end
|
||||
vim.opt.rtp:prepend(vim.env.LAZY or lazypath)
|
||||
|
||||
require("lazy").setup({
|
||||
spec = {
|
||||
-- add LazyVim and import its plugins
|
||||
{ "LazyVim/LazyVim", import = "lazyvim.plugins" },
|
||||
-- import any extras modules here
|
||||
-- { import = "lazyvim.plugins.extras.lang.typescript" },
|
||||
-- { import = "lazyvim.plugins.extras.lang.json" },
|
||||
-- { import = "lazyvim.plugins.extras.ui.mini-animate" },
|
||||
-- import/override with your plugins
|
||||
{ import = "plugins" },
|
||||
},
|
||||
defaults = {
|
||||
-- By default, only LazyVim plugins will be lazy-loaded. Your custom plugins will load during startup.
|
||||
-- If you know what you're doing, you can set this to `true` to have all your custom plugins lazy-loaded by default.
|
||||
lazy = false,
|
||||
-- It's recommended to leave version=false for now, since a lot the plugin that support versioning,
|
||||
-- have outdated releases, which may break your Neovim install.
|
||||
version = false, -- always use the latest git commit
|
||||
-- version = "*", -- try installing the latest stable version for plugins that support semver
|
||||
},
|
||||
install = { colorscheme = { "tokyonight", "habamax" } },
|
||||
checker = { enabled = true }, -- automatically check for plugin updates
|
||||
performance = {
|
||||
rtp = {
|
||||
-- disable some rtp plugins
|
||||
disabled_plugins = {
|
||||
"gzip",
|
||||
-- "matchit",
|
||||
-- "matchparen",
|
||||
-- "netrwPlugin",
|
||||
"tarPlugin",
|
||||
"tohtml",
|
||||
"tutor",
|
||||
"zipPlugin",
|
||||
},
|
||||
},
|
||||
},
|
||||
})
|
9
nvim/lua/config/options.lua
Normal file
9
nvim/lua/config/options.lua
Normal file
@ -0,0 +1,9 @@
|
||||
-- Options are automatically loaded before lazy.nvim startup
|
||||
-- Default options that are always set: https://github.com/LazyVim/LazyVim/blob/main/lua/lazyvim/config/options.lua
|
||||
-- Add any additional options here
|
||||
--
|
||||
|
||||
local opt = vim.opt
|
||||
local diag = vim.diagnostic
|
||||
opt.scrolloff = 999
|
||||
diag.config({ virtual_text = false })
|
@ -1,85 +0,0 @@
|
||||
vim.fn.sign_define('DapBreakpoint', { text = '🟥', texthl = '', linehl = '', numhl = '' })
|
||||
vim.fn.sign_define('DapStopped', { text = '⭐️', texthl = '', linehl = '', numhl = '' })
|
||||
local dap = require('dap')
|
||||
local dapui = require("dapui")
|
||||
|
||||
local M = {}
|
||||
|
||||
--local DEBUGGER_PATH = {os.getenv('HOME')..'/.local/share/nvim/mason/packages/js-debug-adapter'}
|
||||
local DEBUGGER_PATH = vim.fn.stdpath "data" .. "/site/pack/packer/opt/vscode-js-debug"
|
||||
|
||||
function M.setup()
|
||||
dap.adapters.lldb = {
|
||||
type = 'executable',
|
||||
command = '/usr/bin/lldb-vscode',
|
||||
name = 'lldb'
|
||||
}
|
||||
|
||||
dap.configurations.cpp = {
|
||||
{
|
||||
name = 'Launch',
|
||||
type = 'lldb',
|
||||
request = 'launch',
|
||||
program = function()
|
||||
return vim.fn.input('Path to executable: ', vim.fn.getcwd() .. '/', 'file')
|
||||
end,
|
||||
cwd = '${workspaceFolder}',
|
||||
stopOnEntry = false,
|
||||
args = {}
|
||||
}
|
||||
}
|
||||
dap.configurations.c = dap.configurations.cpp
|
||||
dap.configurations.rust = dap.configurations.cpp
|
||||
require('dap-vscode-js').setup {
|
||||
node_path = "node",
|
||||
debugger_path = DEBUGGER_PATH,
|
||||
adapters = { "pwa-node", "pwa-chrome", "pwa-msedge", "node-terminal", "pwa-extensionHost" }
|
||||
}
|
||||
for _, language in ipairs { "typescript", "javascript" } do
|
||||
dap.configurations[language] = { {
|
||||
type = "pwa-node",
|
||||
request = "launch",
|
||||
name = "Launch File",
|
||||
program = "${file}",
|
||||
cwd = "${workspaceFolder}"
|
||||
},
|
||||
{
|
||||
type = "pwa-node",
|
||||
request = "attach",
|
||||
name = "Attach",
|
||||
processId = require("dap.utils").pick_process,
|
||||
cwd = "${workspaceFolder}"
|
||||
},
|
||||
{
|
||||
type = "pwa-node",
|
||||
request = "launch",
|
||||
name = "Debug Jest Tests",
|
||||
runtimeExecutable = "node",
|
||||
runtimeArgs = {
|
||||
"./node_modules/jest/bin/jest.js",
|
||||
"--runInBand",
|
||||
},
|
||||
rootPath = "${workspaceFolder}",
|
||||
console = "integratedTerminal",
|
||||
internalConsoleOptions = "neverOpen",
|
||||
cwd = "${workspaceFolder}"
|
||||
} }
|
||||
end
|
||||
end
|
||||
|
||||
require("dapui").setup()
|
||||
|
||||
M.setup()
|
||||
dap.listeners.after.event_initialized["dapui_config"] = function()
|
||||
print('dap event init')
|
||||
dapui.open()
|
||||
end
|
||||
dap.listeners.before.event_terminated["dapui_config"] = function()
|
||||
print('dap event terminate')
|
||||
dapui.close()
|
||||
end
|
||||
dap.listeners.before.event_exited["dapui_config"] = function()
|
||||
print('dap event exit')
|
||||
dapui.close()
|
||||
end
|
||||
return M
|
@ -1,51 +0,0 @@
|
||||
|
||||
local dap = require('dap')
|
||||
|
||||
local function debugJest(testName, filename)
|
||||
print("starting " .. testName .. " in " .. filename)
|
||||
dap.run({
|
||||
type = 'node',
|
||||
request = 'launch',
|
||||
cwd = vim.fn.getcwd(),
|
||||
runtimeArgs = {'--inspect-brk', '/usr/local/bin/jest', '--no-coverage', '-t', testName, '--', filename},
|
||||
sourceMaps = true,
|
||||
protocol = 'inspector',
|
||||
skipFiles = {'<node_internals>/**/*.js'},
|
||||
console = 'integratedTerminal',
|
||||
port = 9229,
|
||||
})
|
||||
end
|
||||
|
||||
local function attach()
|
||||
print("attaching")
|
||||
dap.run({
|
||||
type = 'node',
|
||||
request = 'attach',
|
||||
cwd = vim.fn.getcwd(),
|
||||
sourceMaps = true,
|
||||
protocol = 'inspector',
|
||||
skipFiles = {'<node_internals>/**/*.js'},
|
||||
})
|
||||
end
|
||||
|
||||
local function attachToRemote()
|
||||
print("attaching")
|
||||
dap.run({
|
||||
type = 'node',
|
||||
request = 'attach',
|
||||
address = "127.0.0.1",
|
||||
port = 9229,
|
||||
localRoot = vim.fn.getcwd(),
|
||||
remoteRoot = "/home/vcap/app",
|
||||
sourceMaps = true,
|
||||
protocol = 'inspector',
|
||||
skipFiles = {'<node_internals>/**/*.js'},
|
||||
})
|
||||
end
|
||||
|
||||
return {
|
||||
debugJest = debugJest,
|
||||
attach = attach,
|
||||
attachToRemote = attachToRemote,
|
||||
}
|
||||
|
@ -1,27 +0,0 @@
|
||||
local set = vim.opt
|
||||
set.title = true
|
||||
set.modelines = 0
|
||||
set.hidden = true
|
||||
set.number = true
|
||||
set.ruler = true
|
||||
set.visualbell = true
|
||||
set.textwidth = 120
|
||||
set.cursorline = true
|
||||
set.tabstop = 2
|
||||
set.shiftwidth = 2
|
||||
set.showmode = true
|
||||
set.showcmd = true
|
||||
set.showmatch = true
|
||||
set.hlsearch = true
|
||||
set.ignorecase = true
|
||||
set.smartcase = true
|
||||
set.incsearch = true
|
||||
set.wrapscan = true
|
||||
set.scrolloff = 999
|
||||
set.backspace = "indent,eol,start"
|
||||
set.mouse = "nicr"
|
||||
set.termguicolors = true
|
||||
set.matchpairs:append("<:>")
|
||||
set.completeopt = "menuone,noselect,preview"
|
||||
set.expandtab = true
|
||||
set.relativenumber = true
|
@ -1,22 +0,0 @@
|
||||
require'jester'.setup({
|
||||
cmd = "yarn run test -t '$result' -- $file", -- run command
|
||||
identifiers = {"test", "it"}, -- used to identify tests
|
||||
prepend = {"describe"}, -- prepend describe blocks
|
||||
expressions = {"call_expression"}, -- tree-sitter object used to scan for tests/describe blocks
|
||||
path_to_jest_run = './node_modules/jest/bin/jest', -- used to run tests
|
||||
path_to_jest_debug = './node_modules/jest/bin/jest', -- used for debugging
|
||||
terminal_cmd = ":vsplit | terminal", -- used to spawn a terminal for running tests, for debugging refer to nvim-dap's config
|
||||
dap = { -- debug adapter configuration
|
||||
type = 'pwa-node',
|
||||
request = 'launch',
|
||||
cwd = vim.fn.getcwd(),
|
||||
runtimeArgs = {'--inspect-brk', '$path_to_jest', '--no-coverage', '-t', '$result', '--', '$file'},
|
||||
args = { '--no-cache' },
|
||||
sourceMaps = 'inline',
|
||||
protocol = 'inspector',
|
||||
skipFiles = {'<node_internals>/**/*.js'},
|
||||
console = 'integratedTerminal',
|
||||
port = 9229,
|
||||
disableOptimisticBPs = true
|
||||
}
|
||||
})
|
@ -1,58 +0,0 @@
|
||||
function map(mode, shortcut, command)
|
||||
vim.api.nvim_set_keymap(mode, shortcut, command, { noremap = true, silent = true })
|
||||
end
|
||||
|
||||
function nmap(shortcut, command)
|
||||
map('n', shortcut, command)
|
||||
end
|
||||
|
||||
function imap(shortcut, command)
|
||||
map('i', shortcut, command)
|
||||
end
|
||||
|
||||
function vmap(shortcut, command)
|
||||
map('v', shortcut, command)
|
||||
end
|
||||
|
||||
function xmap(shortcut, command)
|
||||
map('x', shortcut, command)
|
||||
end
|
||||
|
||||
nmap("<SPACE>", "<Nop>")
|
||||
nmap("<Esc><Esc>", ":noh<cr>")
|
||||
|
||||
|
||||
nmap("<C-f>", ":ToggleTerm direction=float<cr>")
|
||||
imap("<C-f>", ":ToggleTerm direction=float<cr>")
|
||||
|
||||
nmap("<C-l>", ":ToggleTerm direction=horizontal size=10<cr>")
|
||||
imap("<C-l>", ":ToggleTerm direction=horizontal size=10<cr>")
|
||||
|
||||
xmap("p", '\"_dP')
|
||||
nmap("<leader>fg", "<cmd>lua require('telescope.builtin').live_grep()<cr>")
|
||||
nmap("<leader>fb", "<cmd>lua require('telescope.builtin').buffers()<cr>")
|
||||
nmap("<leader>fh", "<cmd>lua require('telescope.builtin').help_tags()<cr>")
|
||||
nmap("<leader>ff", "<cmd>lua require('telescope.builtin').find_files()<cr>")
|
||||
nmap("<leader>vb", "<cmd>lua require('telescope.builtin').git_branches()<cr>")
|
||||
|
||||
nmap("<leader>b", "<cmd>lua require('telescope.builtin').buffers()<cr>")
|
||||
nmap("<C-n>", ":NvimTreeToggle<cr>")
|
||||
nmap("<leader>r", ":NvimTreeRefresh<cr>")
|
||||
nmap("<leader>n", ":NvimTreeToggle<cr>")
|
||||
|
||||
nmap("<leader>zn", "zf%")
|
||||
nmap("<leader>y", '\"+y')
|
||||
vmap("<leader>y", '\"+y')
|
||||
|
||||
nmap("<F5>", ":lua require'dap'.continue()<CR>")
|
||||
nmap("<F10>", ":lua require'dap'.step_over()<CR>")
|
||||
nmap("<F11>", ":lua require'dap'.step_into()<CR>")
|
||||
nmap("<F12>", ":lua require'dap'.step_out()<CR>")
|
||||
nmap("<leader>B", ":lua require'dap'.toggle_breakpoint()<CR>")
|
||||
nmap("<leader>Bc", ":lua require'dap'.set_breakpoint(vim.fn.input('Breakpoint condition: '))<CR>")
|
||||
nmap("<leader>lp", ":lua require'dap'.set_breakpoint(nil,nil,vim.fn.input('Log point message: '))<CR>")
|
||||
nmap("<leader>lR", ":lua require'dap'.repl.open()<CR>")
|
||||
nmap("<leader>dK", ":lua require'dap.ui.widgets'.hover()<CR>")
|
||||
nmap("<leader>dh", ":lua require'dap.ui.variables'.visual_hover()<CR>")
|
||||
nmap("<leader>d?", ":lua require'dap.ui.variables'.scopes()<CR>")
|
||||
nmap("<leader>da", ":lua require'debugHelper'.attach()<CR>")
|
@ -1 +0,0 @@
|
||||
require("luasnip.loaders.from_vscode").lazy_load()
|
@ -1,23 +0,0 @@
|
||||
require('mason').setup({
|
||||
ui = {
|
||||
icons = {
|
||||
package_installed = "✓",
|
||||
package_pending = "➜",
|
||||
package_uninstalled = "✗"
|
||||
}
|
||||
}
|
||||
})
|
||||
require('mason-lspconfig').setup({})
|
||||
|
||||
require 'mason-tool-installer'.setup {
|
||||
ensure_installed = {
|
||||
{ 'bash-language-server', auto_update = true },
|
||||
'lua-language-server',
|
||||
'vim-language-server',
|
||||
--'typescript-language-server',
|
||||
'stylua',
|
||||
},
|
||||
auto_update = false,
|
||||
run_on_start = true,
|
||||
start_delay = 3000
|
||||
}
|
@ -1,5 +0,0 @@
|
||||
vim.cmd('hi CursorLine term=bold cterm=bold ctermbg=darkgrey')
|
||||
|
||||
vim.cmd.colorscheme "catppuccin"
|
||||
vim.o.background = "light"
|
||||
vim.o.termguicolors = true
|
@ -1,19 +0,0 @@
|
||||
require("neotest").setup({
|
||||
adapters = {
|
||||
require("neotest-jest")({
|
||||
jestCommand = "npm test --",
|
||||
jestConfigFile = "custom.jest.config.ts",
|
||||
env = { CI = true },
|
||||
cwd = function(path)
|
||||
return vim.fn.getcwd()
|
||||
end,
|
||||
}),
|
||||
require("neotest-python")({
|
||||
dap = { justMyCode = false },
|
||||
}),
|
||||
require("neotest-plenary"),
|
||||
-- require("neotest-vim-test")({
|
||||
-- ignore_file_types = { "python", "vim", "lua" },
|
||||
-- }),
|
||||
},
|
||||
})
|
@ -1,161 +0,0 @@
|
||||
-- Mappings.
|
||||
-- See `:help vim.diagnostic.*` for documentation on any of the below functions
|
||||
local opts = { noremap = true, silent = true }
|
||||
local goErrorOpts = { severity = vim.diagnostic.severity.ERROR, noremap = true, silent = true }
|
||||
vim.keymap.set('n', '<space>e', vim.diagnostic.open_float, opts)
|
||||
vim.keymap.set('n', 'gE', ':lua vim.diagnostic.goto_prev({severity = vim.diagnostic.severity.ERROR})<cr>', opts)
|
||||
vim.keymap.set('n', 'ge', ':lua vim.diagnostic.goto_next({severity = vim.diagnostic.severity.ERROR})<cr>', 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', '<leader>gD', vim.lsp.buf.declaration, bufopts)
|
||||
vim.keymap.set('n', '<leader>gd', vim.lsp.buf.definition, bufopts)
|
||||
vim.keymap.set('n', '<leader>K', vim.lsp.buf.hover, bufopts)
|
||||
vim.keymap.set('n', '<leader>gi', vim.lsp.buf.implementation, bufopts)
|
||||
vim.keymap.set('n', '<leader>k', vim.lsp.buf.signature_help, bufopts)
|
||||
vim.keymap.set('n', '<leader>wa', vim.lsp.buf.add_workspace_folder, bufopts)
|
||||
vim.keymap.set('n', '<leader>wr', vim.lsp.buf.remove_workspace_folder, bufopts)
|
||||
vim.keymap.set('n', '<leader>wl', function()
|
||||
print(vim.inspect(vim.lsp.buf.list_workspace_folders()))
|
||||
end, bufopts)
|
||||
vim.keymap.set('n', '<leader>D', vim.lsp.buf.type_definition, bufopts)
|
||||
vim.keymap.set('n', '<leader>rn', vim.lsp.buf.rename, bufopts)
|
||||
vim.keymap.set('n', '<leader>ca', vim.lsp.buf.code_action, bufopts)
|
||||
vim.keymap.set('n', '<leader>gr', vim.lsp.buf.references, bufopts)
|
||||
vim.keymap.set('n', '<leader>f', vim.lsp.buf.format, bufopts)
|
||||
|
||||
if vim.bo[bufnr].buftype ~= "" or vim.bo[bufnr].filetype == "helm" then
|
||||
vim.diagnostic.disable()
|
||||
end
|
||||
end
|
||||
|
||||
local lsp_flags = {
|
||||
-- This is the default in Nvim 0.7+
|
||||
debounce_text_changes = 250,
|
||||
}
|
||||
|
||||
local capabilities = require('cmp_nvim_lsp').default_capabilities(
|
||||
vim.lsp.protocol.make_client_capabilities()
|
||||
)
|
||||
capabilities.textDocument.completion.completionItem.snippetSupport = true
|
||||
|
||||
require('mason-lspconfig').setup_handlers {
|
||||
function(server_name)
|
||||
require('lspconfig')[server_name].setup {
|
||||
on_attach = on_attach,
|
||||
flags = lsp_flags,
|
||||
capabilities = capabilities
|
||||
}
|
||||
end,
|
||||
['rust_analyzer'] = function()
|
||||
local rustToolsOpts = {
|
||||
tools = {
|
||||
inlay_hints = {
|
||||
auto = true,
|
||||
only_current_line = true,
|
||||
show_parameter_hints = false,
|
||||
parameter_hints_prefix = "<-",
|
||||
}
|
||||
},
|
||||
server = {
|
||||
on_attach = on_attach,
|
||||
capabilities = capabilities,
|
||||
flags = lsp_flags,
|
||||
settings = {
|
||||
["rust_analyzer"] = {
|
||||
checkOnSave = {
|
||||
command = "clippy"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
require('rust-tools').setup(rustToolsOpts)
|
||||
--on_attach = on_attach,
|
||||
--flags = lsp_flags,
|
||||
require('lspconfig')['rust_analyzer'].setup {
|
||||
on_attach = on_attach,
|
||||
flags = lsp_flags,
|
||||
-- server-specific settings...
|
||||
settings = {
|
||||
["rust-analyzer"] = {}
|
||||
}
|
||||
}
|
||||
end,
|
||||
['html'] = function()
|
||||
require('lspconfig')['html'].setup {
|
||||
on_attach = on_attach,
|
||||
flags = lsp_flags,
|
||||
cmd = { "vscode-html-language-server", "--stdio" },
|
||||
filetypes = { "html" },
|
||||
init_options = {
|
||||
configurationSection = { "html", "css", "javascript" },
|
||||
embeddedLanguages = {
|
||||
css = true,
|
||||
javascript = true
|
||||
},
|
||||
provideFormatter = true
|
||||
},
|
||||
settings = {}
|
||||
}
|
||||
end,
|
||||
['vtsls'] = function()
|
||||
require('lspconfig')['vtsls'].setup {
|
||||
on_attach = on_attach,
|
||||
flags = lsp_flags,
|
||||
}
|
||||
end,
|
||||
-- ['tsserver'] = function()
|
||||
--
|
||||
-- require('lspconfig')['tsserver'].setup {
|
||||
-- on_attach = on_attach,
|
||||
-- flags = lsp_flags,
|
||||
-- settings = {
|
||||
-- init_options = {
|
||||
-- host_info = 'neovim'
|
||||
-- }
|
||||
-- }
|
||||
-- }
|
||||
-- end,
|
||||
['yamlls'] = function()
|
||||
require('lspconfig')["yamlls"].setup {
|
||||
on_attach = on_attach,
|
||||
flags = lsp_flags,
|
||||
settings = {
|
||||
yaml = {
|
||||
schemas = { kubernetes = "globPattern" },
|
||||
}
|
||||
}
|
||||
}
|
||||
end
|
||||
-- ['sumneko_lua'] = function()
|
||||
-- require('lspconfig')["sumneko_lua"].setup {
|
||||
-- on_attach = on_attach,
|
||||
-- flags = lsp_flags,
|
||||
-- settings = {
|
||||
-- Lua = {
|
||||
-- diagnostics = {
|
||||
-- globals = { "vim" }
|
||||
-- }
|
||||
-- }
|
||||
-- }
|
||||
-- }
|
||||
-- end,
|
||||
}
|
||||
--require('lspconfig')['rust_analyzer'].setup {
|
||||
-- on_attach = on_attach,
|
||||
-- flags = lsp_flags,
|
||||
-- -- Server-specific settings...
|
||||
-- settings = {
|
||||
-- ["rust-analyzer"] = {}
|
||||
-- }
|
||||
--}
|
||||
require "fidget".setup {}
|
@ -1,10 +0,0 @@
|
||||
require("null-ls").setup({
|
||||
sources = {
|
||||
|
||||
--require("null-ls").builtins.formatting.stylua,
|
||||
|
||||
-- require("null-ls").builtins.diagnostics.eslint,
|
||||
-- require("null-ls").builtins.completion.spell,
|
||||
require("null-ls").builtins.formatting.xmllint
|
||||
},
|
||||
})
|
@ -1 +0,0 @@
|
||||
require('nvim-lightbulb').setup({ autocmd = { enabled = true } })
|
@ -1,26 +0,0 @@
|
||||
require('nvim-autopairs').setup({
|
||||
disable_filetype = { "TelescopePrompt", "vim", "spectre_panel" },
|
||||
disable_in_macro = true, -- disable when recording or executing a macro
|
||||
disable_in_visualblock = false, -- disable when insert after visual block mode
|
||||
disable_in_replace_mode = true,
|
||||
ignored_next_char = [=[[%w%%%'%[%"%.%`%$]]=],
|
||||
enable_moveright = true,
|
||||
enable_afterquote = true, -- add bracket pairs after quote
|
||||
enable_check_bracket_line = true, --- check bracket in same line
|
||||
enable_bracket_in_quote = true, --
|
||||
enable_abbr = false, -- trigger abbreviation
|
||||
break_undo = true, -- switch for basic rule break undo sequence
|
||||
check_ts = false,
|
||||
map_cr = true,
|
||||
map_bs = true, -- map the <BS> key
|
||||
map_c_h = false, -- Map the <C-h> key to delete a pair
|
||||
map_c_w = false -- map <c-w> to delete a pair if possible
|
||||
})
|
||||
|
||||
-- If you want insert `(` after select function or method item
|
||||
local cmp_autopairs = require('nvim-autopairs.completion.cmp')
|
||||
local cmp = require('cmp')
|
||||
cmp.event:on(
|
||||
'confirm_done',
|
||||
cmp_autopairs.on_confirm_done()
|
||||
)
|
@ -1,123 +0,0 @@
|
||||
require 'nvim-tree'.setup {
|
||||
renderer = {
|
||||
icons = {
|
||||
padding = ' ',
|
||||
symlink_arrow = ' >> ',
|
||||
show = {
|
||||
git = true,
|
||||
folder = true,
|
||||
file = true,
|
||||
folder_arrow = false
|
||||
},
|
||||
glyphs = {
|
||||
default = "",
|
||||
symlink = "",
|
||||
git = {
|
||||
unstaged = "✗",
|
||||
staged = "✓",
|
||||
unmerged = "",
|
||||
renamed = "➜",
|
||||
untracked = "★",
|
||||
deleted = "",
|
||||
ignored = "◌"
|
||||
},
|
||||
folder = {
|
||||
arrow_open = "",
|
||||
arrow_closed = "",
|
||||
default = "",
|
||||
open = "",
|
||||
empty = "",
|
||||
empty_open = "",
|
||||
symlink = "",
|
||||
symlink_open = "",
|
||||
}
|
||||
},
|
||||
},
|
||||
add_trailing = true,
|
||||
highlight_opened_files = "all",
|
||||
root_folder_modifier = ':~',
|
||||
special_files = {
|
||||
'README.md',
|
||||
'Makefile',
|
||||
'MAKEFILE'
|
||||
},
|
||||
highlight_git = true,
|
||||
indent_markers = {
|
||||
enable = true,
|
||||
icons = {
|
||||
corner = "└",
|
||||
edge = "│ ",
|
||||
none = " ",
|
||||
}
|
||||
}
|
||||
},
|
||||
respect_buf_cwd = true,
|
||||
disable_netrw = true,
|
||||
hijack_netrw = true,
|
||||
open_on_tab = false,
|
||||
hijack_cursor = true,
|
||||
auto_reload_on_write = true,
|
||||
hijack_unnamed_buffer_when_opening = true,
|
||||
sync_root_with_cwd = true,
|
||||
diagnostics = {
|
||||
enable = true,
|
||||
icons = {
|
||||
hint = "",
|
||||
info = "",
|
||||
warning = "",
|
||||
error = "",
|
||||
}
|
||||
},
|
||||
update_focused_file = {
|
||||
enable = true,
|
||||
update_cwd = true,
|
||||
ignore_list = {}
|
||||
},
|
||||
system_open = {
|
||||
cmd = nil,
|
||||
args = {}
|
||||
},
|
||||
filters = {
|
||||
dotfiles = false,
|
||||
custom = {}
|
||||
},
|
||||
git = {
|
||||
ignore = false,
|
||||
enable = true,
|
||||
timeout = 500,
|
||||
},
|
||||
actions = {
|
||||
open_file = {
|
||||
resize_window = true,
|
||||
window_picker = {
|
||||
exclude = {
|
||||
filetype = { "notify", "packer", "qf", "diff", "fugitive", "fugitiveblame" },
|
||||
buftype = { "nofile", "terminal", "help" }
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
view = {
|
||||
width = 35,
|
||||
hide_root_folder = false,
|
||||
side = 'right',
|
||||
mappings = {
|
||||
custom_only = false,
|
||||
list = {}
|
||||
}
|
||||
}
|
||||
}
|
||||
local function open_nvim_tree(data)
|
||||
local directory = vim.fn.isdirectory(data.file) == 1
|
||||
if not directory then
|
||||
return
|
||||
end
|
||||
|
||||
vim.cmd.enew()
|
||||
vim.cmd.bw(data.buf)
|
||||
|
||||
vim.cmd.cd(data.file)
|
||||
require('nvim-tree.api').tree.open()
|
||||
end
|
||||
|
||||
vim.api.nvim_create_autocmd({ 'VimEnter' }, { callback = open_nvim_tree })
|
@ -1,124 +0,0 @@
|
||||
require("packer").startup(function(use)
|
||||
use("wbthomason/packer.nvim")
|
||||
use({
|
||||
"williamboman/mason.nvim",
|
||||
"williamboman/mason-lspconfig.nvim",
|
||||
"neovim/nvim-lspconfig",
|
||||
"WhoIsSethDaniel/mason-tool-installer.nvim",
|
||||
})
|
||||
use { "mfussenegger/nvim-dap",
|
||||
requires = {
|
||||
"theHamsta/nvim-dap-virtual-text",
|
||||
"rcarriga/nvim-dap-ui",
|
||||
"mfussenegger/nvim-dap-python",
|
||||
"nvim-telescope/telescope-dap.nvim",
|
||||
{ "jbyuki/one-small-step-for-vimkind", module = "osv" },
|
||||
"mxsdev/nvim-dap-vscode-js",
|
||||
{
|
||||
"microsoft/vscode-js-debug",
|
||||
opt = true,
|
||||
run = "npm install --legacy-peer-deps && npx gulp vsDebugServerBundle && mv dist out",
|
||||
}
|
||||
}
|
||||
}
|
||||
use("jose-elias-alvarez/null-ls.nvim")
|
||||
use({
|
||||
"nvim-telescope/telescope.nvim",
|
||||
tag = "0.1.x",
|
||||
requires = { { "nvim-lua/plenary.nvim" } },
|
||||
})
|
||||
use("nvim-lua/lsp-status.nvim")
|
||||
-- use("jiangmiao/auto-pairs")
|
||||
use {
|
||||
"windwp/nvim-autopairs"
|
||||
-- config = function() require("nvim-autopairs").setup {} end
|
||||
}
|
||||
use("machakann/vim-highlightedyank")
|
||||
use("bling/vim-airline")
|
||||
use("airblade/vim-gitgutter")
|
||||
use("easymotion/vim-easymotion")
|
||||
use({
|
||||
"antoinemadec/FixCursorHold.nvim",
|
||||
"kosayoda/nvim-lightbulb",
|
||||
})
|
||||
use("hrsh7th/cmp-nvim-lsp")
|
||||
use("hrsh7th/cmp-nvim-lsp-signature-help")
|
||||
use("hrsh7th/cmp-nvim-lua")
|
||||
use("hrsh7th/cmp-buffer")
|
||||
use("hrsh7th/cmp-path")
|
||||
use("hrsh7th/cmp-vsnip")
|
||||
use("hrsh7th/vim-vsnip")
|
||||
use("hrsh7th/nvim-cmp")
|
||||
use("hrsh7th/cmp-cmdline")
|
||||
use("saadparwaiz1/cmp_luasnip")
|
||||
use("L3MON4D3/LuaSnip")
|
||||
use("rafamadriz/friendly-snippets")
|
||||
use("kyazdani42/nvim-web-devicons")
|
||||
use("kyazdani42/nvim-tree.lua")
|
||||
use("tpope/vim-fugitive")
|
||||
use("shumphrey/fugitive-gitlab.vim")
|
||||
use({
|
||||
"nvim-treesitter/nvim-treesitter",
|
||||
run = function()
|
||||
require("nvim-treesitter.install").update({ with_sync = true })
|
||||
end,
|
||||
})
|
||||
use("ayu-theme/ayu-vim")
|
||||
use("morhetz/gruvbox")
|
||||
use("simrat39/rust-tools.nvim")
|
||||
use({
|
||||
"akinsho/toggleterm.nvim",
|
||||
tag = "v2.*",
|
||||
config = function()
|
||||
require("toggleterm").setup()
|
||||
end,
|
||||
})
|
||||
use("https://git.sr.ht/~whynothugo/lsp_lines.nvim")
|
||||
--use 'morhetz/gruvbox'
|
||||
use({
|
||||
"folke/which-key.nvim",
|
||||
config = function()
|
||||
require("which-key").setup({})
|
||||
end,
|
||||
})
|
||||
use("gbrlsnchs/telescope-lsp-handlers.nvim")
|
||||
use({
|
||||
"nvim-neotest/neotest",
|
||||
requires = {
|
||||
"nvim-lua/plenary.nvim",
|
||||
"nvim-treesitter/nvim-treesitter",
|
||||
"antoinemadec/FixCursorHold.nvim",
|
||||
"haydenmeade/neotest-jest",
|
||||
"nvim-neotest/neotest-python",
|
||||
"nvim-neotest/neotest-plenary",
|
||||
"nvim-neotest/neotest-vim-test",
|
||||
},
|
||||
})
|
||||
use({
|
||||
"MunifTanjim/prettier.nvim",
|
||||
requires = {
|
||||
"jose-elias-alvarez/null-ls.nvim",
|
||||
"neovim/nvim-lspconfig",
|
||||
},
|
||||
})
|
||||
use {
|
||||
"folke/trouble.nvim",
|
||||
requires = "kyazdani42/nvim-web-devicons"
|
||||
}
|
||||
use 'simrat39/symbols-outline.nvim'
|
||||
use { 'j-hui/fidget.nvim', version = 'legacy' }
|
||||
use { 'shuntaka9576/preview-swagger.nvim' }
|
||||
use 'towolf/vim-helm'
|
||||
use { 'catppuccin/nvim', as = "catppuccin" }
|
||||
use 'gpanders/editorconfig.nvim'
|
||||
use 'RRethy/vim-illuminate'
|
||||
use 'David-Kunz/jester'
|
||||
use { 'kylechui/nvim-surround',
|
||||
tag = "*",
|
||||
config = function()
|
||||
require('nvim-surround').setup({
|
||||
|
||||
})
|
||||
end
|
||||
}
|
||||
end)
|
266
nvim/lua/plugins/example.lua
Normal file
266
nvim/lua/plugins/example.lua
Normal file
@ -0,0 +1,266 @@
|
||||
-- since this is just an example spec, don't actually load anything here and return an empty spec
|
||||
-- stylua: ignore
|
||||
if true then return {} end
|
||||
|
||||
-- every spec file under the "plugins" directory will be loaded automatically by lazy.nvim
|
||||
--
|
||||
-- In your plugin files, you can:
|
||||
-- * add extra plugins
|
||||
-- * disable/enabled LazyVim plugins
|
||||
-- * override the configuration of LazyVim plugins
|
||||
return {
|
||||
-- add gruvbox
|
||||
{ "ellisonleao/gruvbox.nvim" },
|
||||
|
||||
-- Configure LazyVim to load gruvbox
|
||||
{
|
||||
"LazyVim/LazyVim",
|
||||
opts = {
|
||||
colorscheme = "gruvbox",
|
||||
},
|
||||
},
|
||||
|
||||
-- change trouble config
|
||||
{
|
||||
"folke/trouble.nvim",
|
||||
-- opts will be merged with the parent spec
|
||||
opts = { use_diagnostic_signs = true },
|
||||
},
|
||||
|
||||
-- disable trouble
|
||||
{ "folke/trouble.nvim", enabled = false },
|
||||
|
||||
-- add symbols-outline
|
||||
{
|
||||
"simrat39/symbols-outline.nvim",
|
||||
cmd = "SymbolsOutline",
|
||||
keys = { { "<leader>cs", "<cmd>SymbolsOutline<cr>", desc = "Symbols Outline" } },
|
||||
config = true,
|
||||
},
|
||||
|
||||
-- override nvim-cmp and add cmp-emoji
|
||||
{
|
||||
"hrsh7th/nvim-cmp",
|
||||
dependencies = { "hrsh7th/cmp-emoji" },
|
||||
---@param opts cmp.ConfigSchema
|
||||
opts = function(_, opts)
|
||||
local cmp = require("cmp")
|
||||
opts.sources = cmp.config.sources(vim.list_extend(opts.sources, { { name = "emoji" } }))
|
||||
end,
|
||||
},
|
||||
|
||||
-- change some telescope options and a keymap to browse plugin files
|
||||
{
|
||||
"nvim-telescope/telescope.nvim",
|
||||
keys = {
|
||||
-- add a keymap to browse plugin files
|
||||
-- stylua: ignore
|
||||
{
|
||||
"<leader>fp",
|
||||
function() require("telescope.builtin").find_files({ cwd = require("lazy.core.config").options.root }) end,
|
||||
desc = "Find Plugin File",
|
||||
},
|
||||
},
|
||||
-- change some options
|
||||
opts = {
|
||||
defaults = {
|
||||
layout_strategy = "horizontal",
|
||||
layout_config = { prompt_position = "top" },
|
||||
sorting_strategy = "ascending",
|
||||
winblend = 0,
|
||||
},
|
||||
},
|
||||
},
|
||||
|
||||
-- add telescope-fzf-native
|
||||
{
|
||||
"telescope.nvim",
|
||||
dependencies = {
|
||||
"nvim-telescope/telescope-fzf-native.nvim",
|
||||
build = "make",
|
||||
config = function()
|
||||
require("telescope").load_extension("fzf")
|
||||
end,
|
||||
},
|
||||
},
|
||||
|
||||
-- add pyright to lspconfig
|
||||
{
|
||||
"neovim/nvim-lspconfig",
|
||||
---@class PluginLspOpts
|
||||
opts = {
|
||||
---@type lspconfig.options
|
||||
servers = {
|
||||
-- pyright will be automatically installed with mason and loaded with lspconfig
|
||||
pyright = {},
|
||||
},
|
||||
},
|
||||
},
|
||||
|
||||
-- add tsserver and setup with typescript.nvim instead of lspconfig
|
||||
{
|
||||
"neovim/nvim-lspconfig",
|
||||
dependencies = {
|
||||
"jose-elias-alvarez/typescript.nvim",
|
||||
init = function()
|
||||
require("lazyvim.util").on_attach(function(_, buffer)
|
||||
-- stylua: ignore
|
||||
vim.keymap.set( "n", "<leader>co", "TypescriptOrganizeImports", { buffer = buffer, desc = "Organize Imports" })
|
||||
vim.keymap.set("n", "<leader>cR", "TypescriptRenameFile", { desc = "Rename File", buffer = buffer })
|
||||
end)
|
||||
end,
|
||||
},
|
||||
---@class PluginLspOpts
|
||||
opts = {
|
||||
---@type lspconfig.options
|
||||
servers = {
|
||||
-- tsserver will be automatically installed with mason and loaded with lspconfig
|
||||
tsserver = {},
|
||||
},
|
||||
-- you can do any additional lsp server setup here
|
||||
-- return true if you don't want this server to be setup with lspconfig
|
||||
---@type table<string, fun(server:string, opts:_.lspconfig.options):boolean?>
|
||||
setup = {
|
||||
-- example to setup with typescript.nvim
|
||||
tsserver = function(_, opts)
|
||||
require("typescript").setup({ server = opts })
|
||||
return true
|
||||
end,
|
||||
-- Specify * to use this function as a fallback for any server
|
||||
-- ["*"] = function(server, opts) end,
|
||||
},
|
||||
},
|
||||
},
|
||||
|
||||
-- for typescript, LazyVim also includes extra specs to properly setup lspconfig,
|
||||
-- treesitter, mason and typescript.nvim. So instead of the above, you can use:
|
||||
{ import = "lazyvim.plugins.extras.lang.typescript" },
|
||||
|
||||
-- add more treesitter parsers
|
||||
{
|
||||
"nvim-treesitter/nvim-treesitter",
|
||||
opts = {
|
||||
ensure_installed = {
|
||||
"bash",
|
||||
"html",
|
||||
"javascript",
|
||||
"json",
|
||||
"lua",
|
||||
"markdown",
|
||||
"markdown_inline",
|
||||
"python",
|
||||
"query",
|
||||
"regex",
|
||||
"tsx",
|
||||
"typescript",
|
||||
"vim",
|
||||
"yaml",
|
||||
},
|
||||
},
|
||||
},
|
||||
|
||||
-- since `vim.tbl_deep_extend`, can only merge tables and not lists, the code above
|
||||
-- would overwrite `ensure_installed` with the new value.
|
||||
-- If you'd rather extend the default config, use the code below instead:
|
||||
{
|
||||
"nvim-treesitter/nvim-treesitter",
|
||||
opts = function(_, opts)
|
||||
-- add tsx and treesitter
|
||||
vim.list_extend(opts.ensure_installed, {
|
||||
"tsx",
|
||||
"typescript",
|
||||
})
|
||||
end,
|
||||
},
|
||||
|
||||
-- the opts function can also be used to change the default opts:
|
||||
{
|
||||
"nvim-lualine/lualine.nvim",
|
||||
event = "VeryLazy",
|
||||
opts = function(_, opts)
|
||||
table.insert(opts.sections.lualine_x, "😄")
|
||||
end,
|
||||
},
|
||||
|
||||
-- or you can return new options to override all the defaults
|
||||
{
|
||||
"nvim-lualine/lualine.nvim",
|
||||
event = "VeryLazy",
|
||||
opts = function()
|
||||
return {
|
||||
--[[add your custom lualine config here]]
|
||||
}
|
||||
end,
|
||||
},
|
||||
|
||||
-- use mini.starter instead of alpha
|
||||
{ import = "lazyvim.plugins.extras.ui.mini-starter" },
|
||||
|
||||
-- add jsonls and schemastore packages, and setup treesitter for json, json5 and jsonc
|
||||
{ import = "lazyvim.plugins.extras.lang.json" },
|
||||
|
||||
-- add any tools you want to have installed below
|
||||
{
|
||||
"williamboman/mason.nvim",
|
||||
opts = {
|
||||
ensure_installed = {
|
||||
"stylua",
|
||||
"shellcheck",
|
||||
"shfmt",
|
||||
"flake8",
|
||||
},
|
||||
},
|
||||
},
|
||||
|
||||
-- Use <tab> for completion and snippets (supertab)
|
||||
-- first: disable default <tab> and <s-tab> behavior in LuaSnip
|
||||
{
|
||||
"L3MON4D3/LuaSnip",
|
||||
keys = function()
|
||||
return {}
|
||||
end,
|
||||
},
|
||||
-- then: setup supertab in cmp
|
||||
{
|
||||
"hrsh7th/nvim-cmp",
|
||||
dependencies = {
|
||||
"hrsh7th/cmp-emoji",
|
||||
},
|
||||
---@param opts cmp.ConfigSchema
|
||||
opts = function(_, opts)
|
||||
local has_words_before = function()
|
||||
unpack = unpack or table.unpack
|
||||
local line, col = unpack(vim.api.nvim_win_get_cursor(0))
|
||||
return col ~= 0 and vim.api.nvim_buf_get_lines(0, line - 1, line, true)[1]:sub(col, col):match("%s") == nil
|
||||
end
|
||||
|
||||
local luasnip = require("luasnip")
|
||||
local cmp = require("cmp")
|
||||
|
||||
opts.mapping = vim.tbl_extend("force", opts.mapping, {
|
||||
["<Tab>"] = cmp.mapping(function(fallback)
|
||||
if cmp.visible() then
|
||||
cmp.select_next_item()
|
||||
-- You could replace the expand_or_jumpable() calls with expand_or_locally_jumpable()
|
||||
-- this way you will only jump inside the snippet region
|
||||
elseif luasnip.expand_or_jumpable() then
|
||||
luasnip.expand_or_jump()
|
||||
elseif has_words_before() then
|
||||
cmp.complete()
|
||||
else
|
||||
fallback()
|
||||
end
|
||||
end, { "i", "s" }),
|
||||
["<S-Tab>"] = cmp.mapping(function(fallback)
|
||||
if cmp.visible() then
|
||||
cmp.select_prev_item()
|
||||
elseif luasnip.jumpable(-1) then
|
||||
luasnip.jump(-1)
|
||||
else
|
||||
fallback()
|
||||
end
|
||||
end, { "i", "s" }),
|
||||
})
|
||||
end,
|
||||
},
|
||||
}
|
4
nvim/lua/plugins/lsp_lines.lua
Normal file
4
nvim/lua/plugins/lsp_lines.lua
Normal file
@ -0,0 +1,4 @@
|
||||
return {
|
||||
"https://git.sr.ht/~whynothugo/lsp_lines.nvim",
|
||||
config = true,
|
||||
}
|
6
nvim/lua/plugins/nvim-treesitter.lua
Normal file
6
nvim/lua/plugins/nvim-treesitter.lua
Normal file
@ -0,0 +1,6 @@
|
||||
return {
|
||||
"nvim-treesitter/nvim-treesitter",
|
||||
opts = {
|
||||
ensure_installed = "all",
|
||||
},
|
||||
}
|
17
nvim/lua/plugins/toggleterm.lua
Normal file
17
nvim/lua/plugins/toggleterm.lua
Normal file
@ -0,0 +1,17 @@
|
||||
return {
|
||||
{
|
||||
"akinsho/toggleterm.nvim",
|
||||
version = "*",
|
||||
opts = {
|
||||
open_mapping = [[<c-y>]],
|
||||
hide_numbers = true,
|
||||
direction = "float",
|
||||
float_opts = {
|
||||
border = "curved",
|
||||
},
|
||||
winbar = {
|
||||
enabled = false,
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
@ -1,62 +0,0 @@
|
||||
local opts = {
|
||||
highlight_hovered_item = true,
|
||||
show_guides = true,
|
||||
auto_preview = false,
|
||||
position = 'right',
|
||||
relative_width = true,
|
||||
width = 25,
|
||||
auto_close = false,
|
||||
show_numbers = false,
|
||||
show_relative_numbers = false,
|
||||
show_symbol_details = true,
|
||||
preview_bg_highlight = 'Pmenu',
|
||||
autofold_depth = nil,
|
||||
auto_unfold_hover = true,
|
||||
fold_markers = { '', '' },
|
||||
wrap = false,
|
||||
keymaps = { -- These keymaps can be a string or a table for multiple keys
|
||||
close = {"<Esc>", "q"},
|
||||
goto_location = "<Cr>",
|
||||
focus_location = "o",
|
||||
hover_symbol = "<C-space>",
|
||||
toggle_preview = "K",
|
||||
rename_symbol = "r",
|
||||
code_actions = "a",
|
||||
fold = "h",
|
||||
unfold = "l",
|
||||
fold_all = "W",
|
||||
unfold_all = "E",
|
||||
fold_reset = "R",
|
||||
},
|
||||
lsp_blacklist = {},
|
||||
symbol_blacklist = {},
|
||||
symbols = {
|
||||
File = {icon = "", hl = "TSURI"},
|
||||
Module = {icon = "", hl = "TSNamespace"},
|
||||
Namespace = {icon = "", hl = "TSNamespace"},
|
||||
Package = {icon = "", hl = "TSNamespace"},
|
||||
Class = {icon = "𝓒", hl = "TSType"},
|
||||
Method = {icon = "ƒ", hl = "TSMethod"},
|
||||
Property = {icon = "", hl = "TSMethod"},
|
||||
Field = {icon = "", hl = "TSField"},
|
||||
Constructor = {icon = "", hl = "TSConstructor"},
|
||||
Enum = {icon = "ℰ", hl = "TSType"},
|
||||
Interface = {icon = "ﰮ", hl = "TSType"},
|
||||
Function = {icon = "", hl = "TSFunction"},
|
||||
Variable = {icon = "", hl = "TSConstant"},
|
||||
Constant = {icon = "", hl = "TSConstant"},
|
||||
String = {icon = "𝓐", hl = "TSString"},
|
||||
Number = {icon = "#", hl = "TSNumber"},
|
||||
Boolean = {icon = "⊨", hl = "TSBoolean"},
|
||||
Array = {icon = "", hl = "TSConstant"},
|
||||
Object = {icon = "⦿", hl = "TSType"},
|
||||
Key = {icon = "🔐", hl = "TSType"},
|
||||
Null = {icon = "NULL", hl = "TSType"},
|
||||
EnumMember = {icon = "", hl = "TSField"},
|
||||
Struct = {icon = "𝓢", hl = "TSType"},
|
||||
Event = {icon = "🗲", hl = "TSType"},
|
||||
Operator = {icon = "+", hl = "TSOperator"},
|
||||
TypeParameter = {icon = "𝙏", hl = "TSParameter"}
|
||||
}
|
||||
}
|
||||
require("symbols-outline").setup(opts)
|
@ -1,49 +0,0 @@
|
||||
require('telescope').load_extension('lsp_handlers')
|
||||
local trouble = require('trouble.providers.telescope')
|
||||
require('telescope').setup({
|
||||
defaults = {
|
||||
mappings = {
|
||||
i = { ["<c-t>"] = trouble.open_with_trouble },
|
||||
n = { ["<c-t>"] = trouble.open_with_trouble },
|
||||
},
|
||||
path_display = { "smart" },
|
||||
},
|
||||
pickers = {
|
||||
live_grep = {
|
||||
results_title = false,
|
||||
layout_strategy = 'vertical',
|
||||
dynamic_preview_title = true,
|
||||
sorting_strategy = 'ascending',
|
||||
additional_args = { '--trim' },
|
||||
layout_config = {
|
||||
prompt_position = 'top',
|
||||
width = 0.95,
|
||||
height = 0.95,
|
||||
mirror = true,
|
||||
--flex = {
|
||||
-- flip_columns = 100,
|
||||
-- flip_lines = 10,
|
||||
-- vertical = {
|
||||
-- mirror = false,
|
||||
-- },
|
||||
-- horizontal = {
|
||||
-- mirror = false
|
||||
-- },
|
||||
--},
|
||||
}
|
||||
},
|
||||
find_files = {
|
||||
theme = "dropdown",
|
||||
layout_config = {
|
||||
horizontal = { width = 0.5 }
|
||||
}
|
||||
}
|
||||
},
|
||||
extensions = {
|
||||
lsp_handlers = {
|
||||
code_action = {
|
||||
telescope = require('telescope.themes').get_dropdown({}),
|
||||
},
|
||||
},
|
||||
},
|
||||
})
|
@ -1,8 +0,0 @@
|
||||
require('todotxt-nvim').setup({
|
||||
todo_file = '~/todotxt/todo.txt',
|
||||
sidebar = {
|
||||
width = 40,
|
||||
position = 'right'
|
||||
}
|
||||
}
|
||||
)
|
@ -1,12 +0,0 @@
|
||||
vim.api.nvim_set_keymap('t', "<Esc><Esc>", [[<C-\><C-n>]], {})
|
||||
require "toggleterm".setup {
|
||||
open_mapping = [[<c-y>]],
|
||||
hide_numbers = true,
|
||||
--direction = 'float',
|
||||
float_opts = {
|
||||
border = 'curved'
|
||||
},
|
||||
winbar = {
|
||||
enabled = false
|
||||
}
|
||||
}
|
@ -1,38 +0,0 @@
|
||||
|
||||
require'nvim-treesitter.configs'.setup {
|
||||
-- One of "all", "maintained" (parsers with maintainers), or a list of languages
|
||||
ensure_installed = "all",
|
||||
|
||||
-- Install languages synchronously (only applied to `ensure_installed`)
|
||||
sync_install = false,
|
||||
|
||||
-- List of parsers to ignore installing
|
||||
ignore_install = { },
|
||||
|
||||
highlight = {
|
||||
-- `false` will disable the whole extension
|
||||
enable = true,
|
||||
|
||||
-- list of language that will be disabled
|
||||
disable = { },
|
||||
|
||||
-- Setting this to true will run `:h syntax` and tree-sitter at the same time.
|
||||
-- Set this to `true` if you depend on 'syntax' being enabled (like for indentation).
|
||||
-- Using this option may slow down your editor, and you may see some duplicate highlights.
|
||||
-- Instead of true it can also be a list of languages
|
||||
additional_vim_regex_highlighting = false,
|
||||
},
|
||||
}
|
||||
--- Treesitter
|
||||
---BEGINWORKAROUND
|
||||
--vim.api.nvim_create_autocmd({'BufEnter','BufAdd','BufNew','BufNewFile','BufWinEnter'}, {
|
||||
-- group = vim.api.nvim_create_augroup('TS_FOLD_WORKAROUND', {}),
|
||||
-- callback = function()
|
||||
-- vim.opt.foldmethod = 'expr'
|
||||
-- vim.opt.foldexpr = 'nvim_treesitter#foldexpr()'
|
||||
-- end
|
||||
--})
|
||||
---ENDWORKAROUND
|
||||
--- Treesitter
|
||||
--- Utility functions
|
||||
---
|
@ -1,74 +0,0 @@
|
||||
require('trouble').setup {
|
||||
position = "bottom", -- position of the list can be: bottom, top, left, right
|
||||
height = 10, -- height of the trouble list when position is top or bottom
|
||||
width = 50, -- width of the list when position is left or right
|
||||
icons = true, -- use devicons for filenames
|
||||
mode = "workspace_diagnostics", -- "workspace_diagnostics", "document_diagnostics", "quickfix", "lsp_references", "loclist"
|
||||
fold_open = "", -- icon used for open folds
|
||||
fold_closed = "", -- icon used for closed folds
|
||||
group = true, -- group results by file
|
||||
padding = true, -- add an extra new line on top of the list
|
||||
action_keys = { -- key mappings for actions in the trouble list
|
||||
-- map to {} to remove a mapping, for example:
|
||||
-- close = {},
|
||||
close = "q", -- close the list
|
||||
cancel = "<esc>", -- cancel the preview and get back to your last window / buffer / cursor
|
||||
refresh = "r", -- manually refresh
|
||||
jump = { "<cr>", "<tab>" }, -- jump to the diagnostic or open / close folds
|
||||
open_split = { "<c-x>" }, -- open buffer in new split
|
||||
open_vsplit = { "<c-v>" }, -- open buffer in new vsplit
|
||||
open_tab = { "<c-t>" }, -- open buffer in new tab
|
||||
jump_close = { "o" }, -- jump to the diagnostic and close the list
|
||||
toggle_mode = "m", -- toggle between "workspace" and "document" diagnostics mode
|
||||
toggle_preview = "P", -- toggle auto_preview
|
||||
hover = "K", -- opens a small popup with the full multiline message
|
||||
preview = "p", -- preview the diagnostic location
|
||||
close_folds = { "zM", "zm" }, -- close all folds
|
||||
open_folds = { "zR", "zr" }, -- open all folds
|
||||
toggle_fold = { "zA", "za" }, -- toggle fold of current file
|
||||
previous = "k", -- previous item
|
||||
next = "j" -- next item
|
||||
},
|
||||
indent_lines = true, -- add an indent guide below the fold icons
|
||||
auto_open = false, -- automatically open the list when you have diagnostics
|
||||
auto_close = false, -- automatically close the list when you have no diagnostics
|
||||
auto_preview = true, -- automatically preview the location of the diagnostic. <esc> to close preview and go back to last window
|
||||
auto_fold = false, -- automatically fold a file trouble list at creation
|
||||
auto_jump = { "lsp_definitions" }, -- for the given modes, automatically jump if there is only a single result
|
||||
signs = {
|
||||
-- icons / text used for a diagnostic
|
||||
error = "",
|
||||
warning = "",
|
||||
hint = "",
|
||||
information = "",
|
||||
other = ""
|
||||
},
|
||||
use_diagnostic_signs = false -- enabling this will use the signs defined in your lsp client
|
||||
}
|
||||
vim.keymap.set("n", "<leader>t", "<cmd>TroubleToggle<cr>",
|
||||
{ silent = true, noremap = true }
|
||||
)
|
||||
vim.keymap.set("n", "<leader>tw", "<cmd>TroubleToggle workspace_diagnostics<cr>",
|
||||
{ silent = true, noremap = true }
|
||||
)
|
||||
vim.keymap.set("n", "<leader>td", "<cmd>TroubleToggle document_diagnostics<cr>",
|
||||
{ silent = true, noremap = true }
|
||||
)
|
||||
vim.keymap.set("n", "<leader>tl", "<cmd>TroubleToggle loclist<cr>",
|
||||
{ silent = true, noremap = true }
|
||||
)
|
||||
vim.keymap.set("n", "<leader>tq", "<cmd>TroubleToggle quickfix<cr>",
|
||||
{ silent = true, noremap = true }
|
||||
)
|
||||
|
||||
local trouble = require("trouble.providers.telescope")
|
||||
local telescope = require("telescope")
|
||||
|
||||
telescope.setup {
|
||||
defaults = {
|
||||
mappings = {
|
||||
i = { ["<c-t>"] = trouble.open_with_trouble },
|
||||
n = { ["<c-t>"] = trouble.open_with_trouble },
|
||||
},
|
||||
},
|
||||
}
|
@ -1,49 +0,0 @@
|
||||
-- default configuration
|
||||
require('illuminate').configure({
|
||||
-- providers: provider used to get references in the buffer, ordered by priority
|
||||
providers = {
|
||||
'treesitter',
|
||||
'regex',
|
||||
},
|
||||
-- delay: delay in milliseconds
|
||||
delay = 100,
|
||||
-- filetype_overrides: filetype specific overrides.
|
||||
-- The keys are strings to represent the filetype while the values are tables that
|
||||
-- supports the same keys passed to .configure except for filetypes_denylist and filetypes_allowlist
|
||||
filetype_overrides = { },
|
||||
-- filetypes_denylist: filetypes to not illuminate, this overrides filetypes_allowlist
|
||||
filetypes_denylist = {
|
||||
'dirvish',
|
||||
'fugitive',
|
||||
'NvimTree',
|
||||
'TelescopePrompt',
|
||||
'Trouble'
|
||||
},
|
||||
-- filetypes_allowlist: filetypes to illuminate, this is overriden by filetypes_denylist
|
||||
filetypes_allowlist = {},
|
||||
-- modes_denylist: modes to not illuminate, this overrides modes_allowlist
|
||||
-- See `:help mode()` for possible values
|
||||
modes_denylist = {},
|
||||
-- modes_allowlist: modes to illuminate, this is overriden by modes_denylist
|
||||
-- See `:help mode()` for possible values
|
||||
modes_allowlist = {},
|
||||
-- providers_regex_syntax_denylist: syntax to not illuminate, this overrides providers_regex_syntax_allowlist
|
||||
-- Only applies to the 'regex' provider
|
||||
-- Use :echom synIDattr(synIDtrans(synID(line('.'), col('.'), 1)), 'name')
|
||||
providers_regex_syntax_denylist = {},
|
||||
-- providers_regex_syntax_allowlist: syntax to illuminate, this is overriden by providers_regex_syntax_denylist
|
||||
-- Only applies to the 'regex' provider
|
||||
-- Use :echom synIDattr(synIDtrans(synID(line('.'), col('.'), 1)), 'name')
|
||||
providers_regex_syntax_allowlist = {},
|
||||
-- under_cursor: whether or not to illuminate under the cursor
|
||||
under_cursor = true,
|
||||
-- large_file_cutoff: number of lines at which to use large_file_config
|
||||
-- The `under_cursor` option is disabled when this cutoff is hit
|
||||
large_file_cutoff = 1000,
|
||||
-- large_file_config: config to use for large files (based on large_file_cutoff).
|
||||
-- Supports the same keys passed to .configure
|
||||
-- If nil, vim-illuminate will be disabled for large files.
|
||||
large_file_overrides = nil,
|
||||
-- min_count_to_highlight: minimum number of matches required to perform highlighting
|
||||
min_count_to_highlight = 1,
|
||||
})
|
@ -1,9 +0,0 @@
|
||||
lines = require('lsp_lines')
|
||||
lines.setup()
|
||||
vim.diagnostic.config({ virtual_text = false });
|
||||
vim.keymap.set(
|
||||
"",
|
||||
"tl",
|
||||
lines.toggle,
|
||||
{ desc = "Toggle lsp_lines" }
|
||||
);
|
Reference in New Issue
Block a user