Switch to LazyVim (probably temporary)
This commit is contained in:
parent
4ae4db82e8
commit
be71f3ade0
13 changed files with 1338 additions and 841 deletions
841
nvim.bak/init.lua
Normal file
841
nvim.bak/init.lua
Normal file
|
@ -0,0 +1,841 @@
|
||||||
|
HOME = os.getenv("HOME")
|
||||||
|
|
||||||
|
-- Configure the clipboard to access the "+ and "* registers
|
||||||
|
-- N.B. JavaScript copy buttons on the web do not necessarily work as expected
|
||||||
|
vim.opt.clipboard = "unnamedplus,unnamed"
|
||||||
|
|
||||||
|
-- Spaces indentation
|
||||||
|
vim.opt.expandtab = true -- converts tabs to spaces
|
||||||
|
vim.opt.tabstop = 4 -- tab equals 4 spaces
|
||||||
|
vim.opt.shiftwidth = 4 -- indent size in characters
|
||||||
|
|
||||||
|
-- Show whitespace (:list)
|
||||||
|
vim.opt.listchars = "eol:¬,tab:>-,trail:~,extends:>,precedes:<,space:·"
|
||||||
|
|
||||||
|
-- Show line numbers
|
||||||
|
vim.opt.number = true
|
||||||
|
|
||||||
|
-- Vertically splitting a window (:vsplit) places new window to the right
|
||||||
|
vim.opt.splitright = true
|
||||||
|
|
||||||
|
-- Highlight cursor line
|
||||||
|
vim.opt.cursorline = true
|
||||||
|
|
||||||
|
-- Enable folding
|
||||||
|
vim.opt.foldmethod = "syntax"
|
||||||
|
vim.opt.foldlevel = 5
|
||||||
|
|
||||||
|
-- Enable 24-bit RGB color in the TUI
|
||||||
|
vim.opt.termguicolors = true
|
||||||
|
|
||||||
|
-- Minimal number of lines kept above and below the cursor
|
||||||
|
vim.opt.scrolloff = 5
|
||||||
|
|
||||||
|
-- Turn off highlight search
|
||||||
|
vim.opt.hlsearch = false
|
||||||
|
|
||||||
|
-- Temporary file locations
|
||||||
|
vim.opt.backupdir = ".backup/," .. HOME .. "/.backup/,/tmp//"
|
||||||
|
vim.opt.directory = ".swp/," .. HOME .. "/.swp/,/tmp//"
|
||||||
|
|
||||||
|
-- netrw
|
||||||
|
-- This is the workspace file explorer
|
||||||
|
vim.g.netrw_winsize = 25 -- width of the file explorer
|
||||||
|
vim.g.netrw_liststyle = 3 -- tree style listing
|
||||||
|
|
||||||
|
-- Sane vim split naviagation (via Gaslight blog)
|
||||||
|
vim.keymap.set("n", "<c-j>", "<c-w>j", { noremap = true, desc = 'Go to window below' })
|
||||||
|
vim.keymap.set("n", "<c-k>", "<c-w>k", { noremap = true, desc = 'Go to window above' })
|
||||||
|
vim.keymap.set("n", "<c-h>", "<c-w>h", { noremap = true, desc = 'Go to window to the left' })
|
||||||
|
-- N.B. This conflicts with the NetRW directory refresh command. Use the alternative `:e .`.
|
||||||
|
-- TODO: This seems not to work for netrw.
|
||||||
|
vim.keymap.set("n", "<c-l>", "<c-w>l", { noremap = true, desc = 'Go to window to the right' })
|
||||||
|
|
||||||
|
vim.keymap.set("t", "<c-j>", "<c-\\><c-n><c-w>j", { noremap = true, desc = 'Go to window below' })
|
||||||
|
vim.keymap.set("t", "<c-k>", "<c-\\><c-n><c-w>k", { noremap = true, desc = 'Go to window above' })
|
||||||
|
vim.keymap.set("t", "<c-h>", "<c-\\><c-n><c-w>h", { noremap = true, desc = 'Go to window to the left' })
|
||||||
|
vim.keymap.set("t", "<c-l>", "<c-\\><c-n><c-w>l", { noremap = true, desc = 'Go to window to the right' })
|
||||||
|
|
||||||
|
vim.keymap.set(
|
||||||
|
{ "n", "t" },
|
||||||
|
"<leader>z",
|
||||||
|
function()
|
||||||
|
-- This restores the UI to the saved layout 'idelayout' (if it exists)
|
||||||
|
if vim.fn.exists("idelayout") ~= 0 then
|
||||||
|
vim.cmd("exec idelayout")
|
||||||
|
end
|
||||||
|
end,
|
||||||
|
{ desc = "Revert window layout" }
|
||||||
|
)
|
||||||
|
|
||||||
|
local terminalgroup = vim.api.nvim_create_augroup("TerminalGroup", { clear = true })
|
||||||
|
vim.api.nvim_create_autocmd(
|
||||||
|
{ "TermOpen", "TermEnter" },
|
||||||
|
{
|
||||||
|
group = terminalgroup,
|
||||||
|
pattern = "*",
|
||||||
|
command = "set nonumber"
|
||||||
|
}
|
||||||
|
)
|
||||||
|
|
||||||
|
-- lazy.nvim
|
||||||
|
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)
|
||||||
|
|
||||||
|
local js_based_languages = { "javascript", "typescript" }
|
||||||
|
|
||||||
|
require("lazy").setup({
|
||||||
|
{
|
||||||
|
"afair/vibrantink2",
|
||||||
|
priority = 1000,
|
||||||
|
config = function()
|
||||||
|
vim.cmd.colorscheme("vibrantink2")
|
||||||
|
end
|
||||||
|
},
|
||||||
|
"nvim-lualine/lualine.nvim",
|
||||||
|
"nvim-tree/nvim-web-devicons",
|
||||||
|
{ "echasnovski/mini.nvim", version = false },
|
||||||
|
{ "nvim-treesitter/nvim-treesitter", build = ":TSUpdate" },
|
||||||
|
"neovim/nvim-lspconfig",
|
||||||
|
{
|
||||||
|
"kylechui/nvim-surround",
|
||||||
|
version = "*", -- Use for stability; omit to use `main` branch for the latest features
|
||||||
|
event = "VeryLazy",
|
||||||
|
config = function()
|
||||||
|
require("nvim-surround").setup({
|
||||||
|
-- Configuration here, or leave empty to use defaults
|
||||||
|
})
|
||||||
|
end
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"folke/which-key.nvim",
|
||||||
|
event = "VeryLazy",
|
||||||
|
-- init = function()
|
||||||
|
-- vim.o.timeout = true
|
||||||
|
-- -- N.B. Setting `timeoutlen` to 0 seems to break the plugin
|
||||||
|
-- vim.o.timeoutlen = 300 -- 0? 500? 300?
|
||||||
|
-- end,
|
||||||
|
opts = {
|
||||||
|
win = {
|
||||||
|
border = "single",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
keys = {
|
||||||
|
{
|
||||||
|
"<leader>?",
|
||||||
|
function()
|
||||||
|
require("which-key").show({ global = false })
|
||||||
|
end,
|
||||||
|
desc = "Buffer Local Keymaps (which-key)",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"ray-x/lsp_signature.nvim",
|
||||||
|
event = "VeryLazy",
|
||||||
|
opts = {},
|
||||||
|
config = function(_, opts) require 'lsp_signature'.setup(opts) end
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"folke/lazydev.nvim",
|
||||||
|
ft = "lua", -- only load on lua files
|
||||||
|
opts = {
|
||||||
|
library = {
|
||||||
|
-- See the configuration section for more details
|
||||||
|
-- Load luvit types when the `vim.uv` word is found
|
||||||
|
{ path = "luvit-meta/library", words = { "vim%.uv" } },
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{ "Bilal2453/luvit-meta", lazy = true }, -- optional `vim.uv` typings
|
||||||
|
{ -- optional completion source for require statements and module annotations
|
||||||
|
"hrsh7th/nvim-cmp",
|
||||||
|
opts = function(_, opts)
|
||||||
|
opts.sources = opts.sources or {}
|
||||||
|
table.insert(opts.sources, {
|
||||||
|
name = "lazydev",
|
||||||
|
group_index = 0, -- set group index to 0 to skip loading LuaLS completions
|
||||||
|
})
|
||||||
|
end,
|
||||||
|
event = "InsertEnter",
|
||||||
|
dependencies = {
|
||||||
|
"hrsh7th/cmp-nvim-lsp",
|
||||||
|
"hrsh7th/cmp-buffer",
|
||||||
|
"hrsh7th/cmp-path",
|
||||||
|
"hrsh7th/cmp-cmdline",
|
||||||
|
"hrsh7th/cmp-vsnip",
|
||||||
|
"hrsh7th/vim-vsnip",
|
||||||
|
"hrsh7th/cmp-nvim-lsp-signature-help",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"rcarriga/nvim-dap-ui",
|
||||||
|
dependencies = { "mfussenegger/nvim-dap", "nvim-neotest/nvim-nio" },
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"mfussenegger/nvim-dap",
|
||||||
|
event = "VeryLazy",
|
||||||
|
config = function()
|
||||||
|
local dap = require("dap")
|
||||||
|
|
||||||
|
-- local Config = require("lazyvim.config")
|
||||||
|
vim.api.nvim_set_hl(0, "DapStoppedLine", { default = true, link = "Visual" })
|
||||||
|
|
||||||
|
--[[
|
||||||
|
for name, sign in pairs(Config.icons.dap) do
|
||||||
|
sign = type(sign) == "table" and sign or { sign }
|
||||||
|
vim.fn.sign_define(
|
||||||
|
"Dap" .. name,
|
||||||
|
{ text = sign[1], texthl = sign[2] or "DiagnosticInfo", linehl = sign[3], numhl = sign[3] }
|
||||||
|
)
|
||||||
|
end
|
||||||
|
--]]
|
||||||
|
|
||||||
|
for _, language in ipairs({ "javascript", "typescript" }) do
|
||||||
|
dap.configurations[language] = {
|
||||||
|
-- Debug single nodejs files
|
||||||
|
{
|
||||||
|
type = "pwa-node",
|
||||||
|
request = "launch",
|
||||||
|
name = "Launch file",
|
||||||
|
program = "${file}",
|
||||||
|
cwd = vim.fn.getcwd(),
|
||||||
|
sourceMaps = true,
|
||||||
|
},
|
||||||
|
-- Debug nodejs processes (make sure to add --inspect when you run the process)
|
||||||
|
{
|
||||||
|
type = "pwa-node",
|
||||||
|
request = "attach",
|
||||||
|
name = "Attach",
|
||||||
|
processId = require("dap.utils").pick_process,
|
||||||
|
cwd = vim.fn.getcwd(),
|
||||||
|
sourceMaps = true,
|
||||||
|
},
|
||||||
|
-- Debug web applications (client side)
|
||||||
|
{
|
||||||
|
type = "pwa-chrome",
|
||||||
|
request = "launch",
|
||||||
|
name = "Launch & Debug Chrome",
|
||||||
|
url = function()
|
||||||
|
local co = coroutine.running()
|
||||||
|
return coroutine.create(function()
|
||||||
|
vim.ui.input({
|
||||||
|
prompt = "Enter URL: ",
|
||||||
|
default = "http://localhost:3000",
|
||||||
|
}, function(url)
|
||||||
|
if url == nil or url == "" then
|
||||||
|
return
|
||||||
|
else
|
||||||
|
coroutine.resume(co, url)
|
||||||
|
end
|
||||||
|
end)
|
||||||
|
end)
|
||||||
|
end,
|
||||||
|
webRoot = vim.fn.getcwd(),
|
||||||
|
protocol = "inspector",
|
||||||
|
sourceMaps = true,
|
||||||
|
userDataDir = false,
|
||||||
|
},
|
||||||
|
-- Divider for the launch.json derived configs
|
||||||
|
{
|
||||||
|
name = "----- ↓ launch.json configs ↓ -----",
|
||||||
|
type = "",
|
||||||
|
request = "launch",
|
||||||
|
},
|
||||||
|
}
|
||||||
|
end
|
||||||
|
end,
|
||||||
|
keys = {
|
||||||
|
{
|
||||||
|
"<leader>dO",
|
||||||
|
function()
|
||||||
|
require("dap").step_out()
|
||||||
|
end,
|
||||||
|
desc = "DAP: Step Out",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"<leader>do",
|
||||||
|
function()
|
||||||
|
require("dap").step_over()
|
||||||
|
end,
|
||||||
|
desc = "DAP: Step Over",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"<leader>db",
|
||||||
|
function()
|
||||||
|
require("dap").toggle_breakpoint()
|
||||||
|
end,
|
||||||
|
desc = "DAP: Toggle breakpoint",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"<leader>dc",
|
||||||
|
function()
|
||||||
|
require("dap").continue()
|
||||||
|
end,
|
||||||
|
desc = "DAP: Continue",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"<leader>di",
|
||||||
|
function()
|
||||||
|
require("dap").step_into()
|
||||||
|
end,
|
||||||
|
desc = "DAP: Step Into",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"<leader>da",
|
||||||
|
function()
|
||||||
|
if vim.fn.filereadable(".vscode/launch.json") then
|
||||||
|
local dap_vscode = require("dap.ext.vscode")
|
||||||
|
dap_vscode.load_launchjs(nil, {
|
||||||
|
["pwa-node"] = js_based_languages,
|
||||||
|
["chrome"] = js_based_languages,
|
||||||
|
["pwa-chrome"] = js_based_languages,
|
||||||
|
})
|
||||||
|
end
|
||||||
|
require("dap").continue()
|
||||||
|
end,
|
||||||
|
desc = "DAP: Run with Args",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
dependencies = {
|
||||||
|
-- Install the vscode-js-debug adapter
|
||||||
|
{
|
||||||
|
"microsoft/vscode-js-debug",
|
||||||
|
-- After install, build it and rename the dist directory to out
|
||||||
|
build =
|
||||||
|
"npm install --legacy-peer-deps --no-save && npx gulp vsDebugServerBundle && rm -rf out && mv dist out",
|
||||||
|
version = "1.*",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"mxsdev/nvim-dap-vscode-js",
|
||||||
|
config = function()
|
||||||
|
---@diagnostic disable-next-line: missing-fields
|
||||||
|
require("dap-vscode-js").setup({
|
||||||
|
-- Path of node executable. Defaults to $NODE_PATH, and then "node"
|
||||||
|
-- node_path = "node",
|
||||||
|
|
||||||
|
-- Path to vscode-js-debug installation.
|
||||||
|
debugger_path = vim.fn.resolve(vim.fn.stdpath("data") .. "/lazy/vscode-js-debug"),
|
||||||
|
|
||||||
|
-- Command to use to launch the debug server. Takes precedence over "node_path" and "debugger_path"
|
||||||
|
-- debugger_cmd = { "js-debug-adapter" },
|
||||||
|
|
||||||
|
-- which adapters to register in nvim-dap
|
||||||
|
adapters = {
|
||||||
|
"chrome",
|
||||||
|
"pwa-node",
|
||||||
|
"pwa-chrome",
|
||||||
|
"pwa-msedge",
|
||||||
|
"pwa-extensionHost",
|
||||||
|
"node-terminal",
|
||||||
|
},
|
||||||
|
|
||||||
|
-- Path for file logging
|
||||||
|
-- log_file_path = "(stdpath cache)/dap_vscode_js.log",
|
||||||
|
|
||||||
|
-- Logging level for output to file. Set to false to disable logging.
|
||||||
|
-- log_file_level = false,
|
||||||
|
|
||||||
|
-- Logging level for output to console. Set to false to disable console output.
|
||||||
|
-- log_console_level = vim.log.levels.ERROR,
|
||||||
|
})
|
||||||
|
end,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"Joakker/lua-json5",
|
||||||
|
build = "./install.sh",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{ "leoluz/nvim-dap-go", event = "VeryLazy" },
|
||||||
|
{ "williamboman/mason.nvim", event = "VeryLazy" },
|
||||||
|
{ "williamboman/mason-lspconfig.nvim", event = "VeryLazy" },
|
||||||
|
{ "nvimdev/lspsaga.nvim", event = "VeryLazy" },
|
||||||
|
{
|
||||||
|
"nvim-telescope/telescope.nvim",
|
||||||
|
event = "VeryLazy",
|
||||||
|
branch = "0.1.x",
|
||||||
|
dependencies = {
|
||||||
|
"nvim-lua/plenary.nvim",
|
||||||
|
{
|
||||||
|
"nvim-telescope/telescope-fzf-native.nvim",
|
||||||
|
build =
|
||||||
|
"cmake -S. -Bbuild -DCMAKE_BUILD_TYPE=Release && cmake --build build --config Release && cmake --install build --prefix build",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{ "tpope/vim-fugitive", event = "VeryLazy" },
|
||||||
|
{ "lewis6991/gitsigns.nvim", event = "VeryLazy" },
|
||||||
|
{
|
||||||
|
"pwntester/octo.nvim",
|
||||||
|
requires = {
|
||||||
|
"nvim-lua/plenary.nvim",
|
||||||
|
"nvim-telescope/telescope.nvim",
|
||||||
|
"nvim-tree/nvim-web-devicons",
|
||||||
|
},
|
||||||
|
config = function()
|
||||||
|
require("octo").setup()
|
||||||
|
end,
|
||||||
|
event = "VeryLazy",
|
||||||
|
},
|
||||||
|
{ "famiu/bufdelete.nvim", event = "VeryLazy" },
|
||||||
|
-- { "vlime/vlime", config = function() rtp = 'vim/' end },
|
||||||
|
--[[
|
||||||
|
{
|
||||||
|
'windwp/nvim-autopairs',
|
||||||
|
event = "InsertEnter",
|
||||||
|
config = true,
|
||||||
|
-- use opts = {} for passing setup options
|
||||||
|
-- this is equalent to setup({}) function
|
||||||
|
},
|
||||||
|
--]]
|
||||||
|
--{ "bhurlow/vim-parinfer", event = "VeryLazy" },
|
||||||
|
{ "kovisoft/paredit" },
|
||||||
|
--{ "monkoose/parsley", event = "VeryLazy" },
|
||||||
|
{ "monkoose/nvlime", ft = { "lisp" }, dependencies = { "monkoose/parsley" } },
|
||||||
|
{
|
||||||
|
'MeanderingProgrammer/markdown.nvim',
|
||||||
|
-- name = 'render-markdown', -- Only needed if you have another plugin named markdown.nvim
|
||||||
|
dependencies = {
|
||||||
|
'nvim-treesitter/nvim-treesitter', -- Mandatory
|
||||||
|
'nvim-tree/nvim-web-devicons', -- Optional but recommended
|
||||||
|
},
|
||||||
|
config = function()
|
||||||
|
require('render-markdown').setup({})
|
||||||
|
end,
|
||||||
|
},
|
||||||
|
{ "jparise/vim-graphql" },
|
||||||
|
})
|
||||||
|
|
||||||
|
--[[ mason
|
||||||
|
Mason manages external editor plugins such as LSP servers, DAP servers,
|
||||||
|
linters, and formatters. There are further recommended plugins for better
|
||||||
|
integration.
|
||||||
|
--]]
|
||||||
|
require('mason').setup()
|
||||||
|
require('mason-lspconfig').setup()
|
||||||
|
|
||||||
|
--[[ lualine
|
||||||
|
Lualine provides the status bar as well as the tabline.
|
||||||
|
--]]
|
||||||
|
require('lualine').setup {
|
||||||
|
options = { theme = 'dracula' },
|
||||||
|
tabline = {
|
||||||
|
lualine_a = {
|
||||||
|
{
|
||||||
|
'buffers',
|
||||||
|
mode = 4,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
--[[ Telescope
|
||||||
|
Telescope provides lists, pickers, etc. This section includes just the
|
||||||
|
functions bound to keymaps.
|
||||||
|
--]]
|
||||||
|
local builtin = require('telescope.builtin')
|
||||||
|
vim.keymap.set('n', '<leader>ff', builtin.find_files, { desc = 'Telescope: find files' })
|
||||||
|
vim.keymap.set('n', '<leader>fg', builtin.live_grep, { desc = 'Telescope: live grep' })
|
||||||
|
vim.keymap.set('n', '<leader>fb', builtin.buffers, { desc = 'Telescope: buffers' })
|
||||||
|
vim.keymap.set('n', '<leader>fh', builtin.help_tags, { desc = 'Telescope: help tags' })
|
||||||
|
|
||||||
|
require "lsp_signature".setup()
|
||||||
|
|
||||||
|
--[[ nvim-cmp
|
||||||
|
nvim-cmp is a text completion engine.
|
||||||
|
]]
|
||||||
|
|
||||||
|
local cmp = require 'cmp'
|
||||||
|
|
||||||
|
cmp.setup({
|
||||||
|
snippet = {
|
||||||
|
-- REQUIRED - you must specify a snippet engine
|
||||||
|
expand = function(args)
|
||||||
|
vim.fn["vsnip#anonymous"](args.body) -- For `vsnip` users.
|
||||||
|
end,
|
||||||
|
},
|
||||||
|
window = {
|
||||||
|
completion = cmp.config.window.bordered(),
|
||||||
|
documentation = cmp.config.window.bordered(),
|
||||||
|
},
|
||||||
|
mapping = cmp.mapping.preset.insert({
|
||||||
|
['<C-b>'] = cmp.mapping.scroll_docs(-4),
|
||||||
|
['<C-f>'] = cmp.mapping.scroll_docs(4),
|
||||||
|
['<C-Space>'] = cmp.mapping.complete(),
|
||||||
|
['<C-e>'] = cmp.mapping.abort(),
|
||||||
|
['<CR>'] = cmp.mapping.confirm({ select = true }), -- Accept currently selected item. Set `select` to `false` to only confirm explicitly selected items.
|
||||||
|
}),
|
||||||
|
sources = cmp.config.sources({
|
||||||
|
{ name = 'nvim_lsp' },
|
||||||
|
{ name = 'vsnip' }, -- For vsnip users.
|
||||||
|
}, {
|
||||||
|
{ name = 'buffer' },
|
||||||
|
{ name = 'nvim_lsp_signature_help' },
|
||||||
|
})
|
||||||
|
})
|
||||||
|
|
||||||
|
-- Set configuration for specific filetype.
|
||||||
|
cmp.setup.filetype('gitcommit', {
|
||||||
|
sources = cmp.config.sources({
|
||||||
|
{ name = 'git' }, -- You can specify the `git` source if [you were installed it](https://github.com/petertriho/cmp-git).
|
||||||
|
}, {
|
||||||
|
{ name = 'buffer' },
|
||||||
|
})
|
||||||
|
})
|
||||||
|
|
||||||
|
-- Use buffer source for `/` and `?` (if you enabled `native_menu`, this won't work anymore).
|
||||||
|
cmp.setup.cmdline({ '/', '?' }, {
|
||||||
|
mapping = cmp.mapping.preset.cmdline(),
|
||||||
|
sources = {
|
||||||
|
{ name = 'buffer' }
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
-- Use cmdline & path source for ':' (if you enabled `native_menu`, this won't work anymore).
|
||||||
|
cmp.setup.cmdline(':', {
|
||||||
|
mapping = cmp.mapping.preset.cmdline(),
|
||||||
|
sources = cmp.config.sources({
|
||||||
|
{ name = 'path' }
|
||||||
|
}, {
|
||||||
|
{ name = 'cmdline' }
|
||||||
|
})
|
||||||
|
})
|
||||||
|
|
||||||
|
--[[ nvim-lspconfig
|
||||||
|
--]]
|
||||||
|
|
||||||
|
-- Setup language servers.
|
||||||
|
local lua_ls_setup = {
|
||||||
|
settings = {
|
||||||
|
Lua = {
|
||||||
|
runtime = {
|
||||||
|
-- Tell the language server which version of Lua you're using (most likely LuaJIT in the case of Neovim)
|
||||||
|
version = "LuaJIT",
|
||||||
|
},
|
||||||
|
diagnostics = {
|
||||||
|
-- Get the language server to recognize the `vim` global
|
||||||
|
globals = { "vim" },
|
||||||
|
},
|
||||||
|
workspace = {
|
||||||
|
-- Make the server aware of Neovim runtime files
|
||||||
|
library = vim.api.nvim_get_runtime_file("", true),
|
||||||
|
checkThirdParty = false,
|
||||||
|
},
|
||||||
|
-- Do not send telemetry data containing a randomized but unique identifier
|
||||||
|
telemetry = {
|
||||||
|
enable = false,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
local capabilities = require('cmp_nvim_lsp').default_capabilities()
|
||||||
|
|
||||||
|
local lspconfig = require('lspconfig')
|
||||||
|
lspconfig.gopls.setup { capabilities = capabilities }
|
||||||
|
lspconfig.lua_ls.setup(lua_ls_setup)
|
||||||
|
lspconfig.pyright.setup { capabilities = capabilities }
|
||||||
|
-- lspconfig.tsserver.setup { capabilities = capabilities }
|
||||||
|
lspconfig.ts_ls.setup { capabilities = capabilities }
|
||||||
|
lspconfig.rust_analyzer.setup {
|
||||||
|
-- Server-specific settings. See `:help lspconfig-setup`
|
||||||
|
capabilities = capabilities,
|
||||||
|
settings = {
|
||||||
|
['rust-analyzer'] = {},
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
-- Enable (broadcasting) snippet capability for completion
|
||||||
|
local capabilities_html = vim.lsp.protocol.make_client_capabilities()
|
||||||
|
capabilities_html.textDocument.completion.completionItem.snippetSupport = true
|
||||||
|
|
||||||
|
require 'lspconfig'.html.setup {
|
||||||
|
capabilities = capabilities_html,
|
||||||
|
}
|
||||||
|
|
||||||
|
-- Global mappings : Diagnostics
|
||||||
|
-- See `:help vim.diagnostic.*` for documentation on any of the below functions
|
||||||
|
vim.keymap.set('n', '<space>e', vim.diagnostic.open_float, { desc = 'Diagnostic: open float' })
|
||||||
|
vim.keymap.set('n', '[d', vim.diagnostic.goto_prev, { desc = 'Diagnostic: go to previous' })
|
||||||
|
vim.keymap.set('n', ']d', vim.diagnostic.goto_next, { desc = 'Diagnostic: go to next' })
|
||||||
|
vim.keymap.set('n', '<space>q', vim.diagnostic.setloclist, { desc = 'Diagnostic: set loclist' })
|
||||||
|
|
||||||
|
-- Add a border to LSP windows
|
||||||
|
local _border = "single"
|
||||||
|
|
||||||
|
vim.lsp.handlers["textDocument/hover"] = vim.lsp.with(
|
||||||
|
vim.lsp.handlers.hover, {
|
||||||
|
border = _border
|
||||||
|
}
|
||||||
|
)
|
||||||
|
|
||||||
|
-- TODO: Is this necessary? Or is signature help being handled with LSPSaga?
|
||||||
|
--[[
|
||||||
|
vim.lsp.handlers["textDocument/signatureHelp"] = vim.lsp.with(
|
||||||
|
vim.lsp.handlers.signature_help, {
|
||||||
|
border = _border
|
||||||
|
}
|
||||||
|
)
|
||||||
|
--]]
|
||||||
|
|
||||||
|
vim.diagnostic.config {
|
||||||
|
float = { border = _border, max_width = 120 }
|
||||||
|
}
|
||||||
|
-- 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.
|
||||||
|
-- See `:help vim.lsp.*` for documentation on any of the below functions
|
||||||
|
local opts = function(desc)
|
||||||
|
return { buffer = ev.buf, desc = desc }
|
||||||
|
end
|
||||||
|
vim.keymap.set('n', 'gD', vim.lsp.buf.declaration, opts('LSP: go to declaration'))
|
||||||
|
vim.keymap.set('n', 'gd', vim.lsp.buf.definition, opts('LSP: go to definition'))
|
||||||
|
vim.keymap.set('n', 'K', vim.lsp.buf.hover, opts('LSP: hover'))
|
||||||
|
vim.keymap.set('n', 'gi', vim.lsp.buf.implementation, opts('LSP: go to implementation'))
|
||||||
|
-- This setting steps on my split navigation setting, so I changed it
|
||||||
|
-- to the probably harmless F9.
|
||||||
|
-- vim.keymap.set('n', '<C-k>', vim.lsp.buf.signature_help, opts(''))
|
||||||
|
vim.keymap.set('n', '<F9>', vim.lsp.buf.signature_help, opts('LSP: signature help'))
|
||||||
|
vim.keymap.set('n', '<space>wa', vim.lsp.buf.add_workspace_folder, opts('LSP: add workspace folder'))
|
||||||
|
vim.keymap.set('n', '<space>wr', vim.lsp.buf.remove_workspace_folder, opts('LSP: remove workspace folder'))
|
||||||
|
vim.keymap.set('n', '<space>wl', function()
|
||||||
|
print(vim.inspect(vim.lsp.buf.list_workspace_folders()))
|
||||||
|
end, opts('LSP: list workspace folder'))
|
||||||
|
vim.keymap.set('n', '<space>D', vim.lsp.buf.type_definition, opts('LSP: go to type definition'))
|
||||||
|
vim.keymap.set('n', '<space>rn', vim.lsp.buf.rename, opts('LSP: rename token'))
|
||||||
|
vim.keymap.set({ 'n', 'v' }, '<space>ca', vim.lsp.buf.code_action, opts('LSP: code action'))
|
||||||
|
vim.keymap.set('n', 'gr', vim.lsp.buf.references, opts('LSP: go to references'))
|
||||||
|
vim.keymap.set('n', '<space>f', function()
|
||||||
|
vim.lsp.buf.format { async = true }
|
||||||
|
end, opts('LSP: format'))
|
||||||
|
end,
|
||||||
|
})
|
||||||
|
|
||||||
|
require('gitsigns').setup({
|
||||||
|
signs = {
|
||||||
|
add = { text = '│' },
|
||||||
|
change = { text = '│' },
|
||||||
|
delete = { text = '_' },
|
||||||
|
topdelete = { text = '‾' },
|
||||||
|
changedelete = { text = '~' },
|
||||||
|
untracked = { text = '┆' },
|
||||||
|
},
|
||||||
|
signcolumn = true, -- Toggle with `:Gitsigns toggle_signs`
|
||||||
|
numhl = false, -- Toggle with `:Gitsigns toggle_numhl`
|
||||||
|
linehl = false, -- Toggle with `:Gitsigns toggle_linehl`
|
||||||
|
word_diff = false, -- Toggle with `:Gitsigns toggle_word_diff`
|
||||||
|
watch_gitdir = {
|
||||||
|
follow_files = true
|
||||||
|
},
|
||||||
|
attach_to_untracked = true,
|
||||||
|
current_line_blame = false, -- Toggle with `:Gitsigns toggle_current_line_blame`
|
||||||
|
current_line_blame_opts = {
|
||||||
|
virt_text = true,
|
||||||
|
virt_text_pos = 'eol', -- 'eol' | 'overlay' | 'right_align'
|
||||||
|
delay = 1000,
|
||||||
|
ignore_whitespace = false,
|
||||||
|
},
|
||||||
|
current_line_blame_formatter = '<author>, <author_time:%Y-%m-%d> - <summary>',
|
||||||
|
sign_priority = 6,
|
||||||
|
update_debounce = 100,
|
||||||
|
status_formatter = nil, -- Use default
|
||||||
|
max_file_length = 40000, -- Disable if file is longer than this (in lines)
|
||||||
|
preview_config = {
|
||||||
|
-- Options passed to nvim_open_win
|
||||||
|
border = 'single',
|
||||||
|
style = 'minimal',
|
||||||
|
relative = 'cursor',
|
||||||
|
row = 0,
|
||||||
|
col = 1
|
||||||
|
},
|
||||||
|
-- [2024-09-10] This is invalid, suddenly.
|
||||||
|
-- yadm = { enable = false },
|
||||||
|
on_attach = function(bufnr)
|
||||||
|
local gs = package.loaded.gitsigns
|
||||||
|
|
||||||
|
local function map(mode, l, r, opts)
|
||||||
|
opts = opts or {}
|
||||||
|
opts.buffer = bufnr
|
||||||
|
vim.keymap.set(mode, l, r, opts)
|
||||||
|
end
|
||||||
|
|
||||||
|
-- Navigation
|
||||||
|
map('n', ']c', function()
|
||||||
|
if vim.wo.diff then return ']c' end
|
||||||
|
vim.schedule(function() gs.next_hunk() end)
|
||||||
|
return '<Ignore>'
|
||||||
|
end, { expr = true, desc = 'GitSigns: go to next hunk' })
|
||||||
|
|
||||||
|
map('n', '[c', function()
|
||||||
|
if vim.wo.diff then return '[c' end
|
||||||
|
vim.schedule(function() gs.prev_hunk() end)
|
||||||
|
return '<Ignore>'
|
||||||
|
end, { expr = true, desc = 'GitSigns: go to previous hunk' })
|
||||||
|
|
||||||
|
-- Actions
|
||||||
|
map('n', '<leader>hs', gs.stage_hunk, { desc = 'GitSigns: stage hunk' })
|
||||||
|
map('n', '<leader>hr', gs.reset_hunk, { desc = 'GitSigns: reset hunk' })
|
||||||
|
map('v', '<leader>hs', function() gs.stage_hunk { vim.fn.line('.'), vim.fn.line('v') } end,
|
||||||
|
{ desc = 'GitSigns: stage hunk' })
|
||||||
|
map('v', '<leader>hr', function() gs.reset_hunk { vim.fn.line('.'), vim.fn.line('v') } end,
|
||||||
|
{ desc = 'GitSigns: reset hunk' })
|
||||||
|
map('n', '<leader>hS', gs.stage_buffer, { desc = 'GitSigns: stage buffer' })
|
||||||
|
map('n', '<leader>hu', gs.undo_stage_hunk, { desc = 'GitSigns: undo stage hunk' })
|
||||||
|
map('n', '<leader>hR', gs.reset_buffer, { desc = 'GitSigns: reset_buffer' })
|
||||||
|
map('n', '<leader>hp', gs.preview_hunk, { desc = 'GitSigns: preview hunk' })
|
||||||
|
map('n', '<leader>hb', function() gs.blame_line { full = true } end, { desc = 'GitSigns: blame line' })
|
||||||
|
map('n', '<leader>tb', gs.toggle_current_line_blame, { desc = 'GitSigns: toggle current line blame' })
|
||||||
|
map('n', '<leader>hd', gs.diffthis, { desc = 'GitSigns: diff this' })
|
||||||
|
map('n', '<leader>hD', function() gs.diffthis('~') end, { desc = 'GitSigns: diff this' })
|
||||||
|
map('n', '<leader>td', gs.toggle_deleted, { desc = 'GitSigns: toggle deleted' })
|
||||||
|
end
|
||||||
|
})
|
||||||
|
|
||||||
|
--[[
|
||||||
|
-- LSPSaga : provides a diverse basket of utilities
|
||||||
|
--]]
|
||||||
|
require('lspsaga').setup({
|
||||||
|
beacon = {
|
||||||
|
enable = true,
|
||||||
|
frequency = 7,
|
||||||
|
}
|
||||||
|
})
|
||||||
|
vim.keymap.set('n', '<leader>si', '<cmd>Lspsaga incoming_calls<CR>')
|
||||||
|
vim.keymap.set('n', '<leader>so', '<cmd>Lspsaga outgoing_calls<CR>')
|
||||||
|
vim.keymap.set('n', '<leader>ca', '<cmd>Lspsaga code_action<CR>')
|
||||||
|
vim.keymap.set('n', '<leader>sd', '<cmd>Lspsaga peek_definition<CR>')
|
||||||
|
vim.keymap.set('n', '<leader>sp', '<cmd>Lspsaga peek_type_definition<CR>')
|
||||||
|
vim.keymap.set('n', '<leader>sx', '<cmd>Lspsaga goto_definition<CR>')
|
||||||
|
vim.keymap.set('n', '<leader>sg', '<cmd>Lspsaga goto_type_definition<CR>')
|
||||||
|
vim.keymap.set('n', '[e', '<cmd>Lspsaga diagnostic_jump_prev<CR>')
|
||||||
|
vim.keymap.set('n', ']e', '<cmd>Lspsaga diagnostic_jump_next<CR>')
|
||||||
|
vim.keymap.set('n', '<leader>sK', '<cmd>Lspsaga hover_doc<CR>')
|
||||||
|
vim.keymap.set('n', '<leader>sm', '<cmd>Lspsaga finder imp<CR>')
|
||||||
|
vim.keymap.set('n', '<leader>sf', '<cmd>Lspsaga finder<CR>')
|
||||||
|
vim.keymap.set('n', '<leader>sl', '<cmd>Lspsaga outline<CR>')
|
||||||
|
vim.keymap.set('n', '<leader>rn', '<cmd>Lspsaga rename<CR>')
|
||||||
|
vim.keymap.set('n', '<leader>st', '<cmd>Lspsaga term_toggle<CR>')
|
||||||
|
|
||||||
|
require('dap-go').setup()
|
||||||
|
|
||||||
|
local dap, dapui = require("dap"), require("dapui")
|
||||||
|
dapui.setup()
|
||||||
|
|
||||||
|
dap.listeners.after.event_initialized["dapui_config"] = function()
|
||||||
|
dapui.open()
|
||||||
|
end
|
||||||
|
dap.listeners.before.event_terminated["dapui_config"] = function()
|
||||||
|
dapui.close()
|
||||||
|
end
|
||||||
|
dap.listeners.before.event_exited["dapui_config"] = function()
|
||||||
|
dapui.close()
|
||||||
|
end
|
||||||
|
|
||||||
|
-- Handlebars: One way to get syntax highlighting in Handlebars files
|
||||||
|
--[[
|
||||||
|
local syntax_highlighting_tweaks = vim.api.nvim_create_augroup("SyntaxHighlightingTweaks", { clear = true })
|
||||||
|
vim.api.nvim_create_autocmd(
|
||||||
|
{ "BufRead", "BufNewFile" },
|
||||||
|
{
|
||||||
|
group = syntax_highlighting_tweaks,
|
||||||
|
pattern = "*.hbs",
|
||||||
|
command = "set filetype=html"
|
||||||
|
}
|
||||||
|
)
|
||||||
|
--]]
|
||||||
|
|
||||||
|
-- Treesitter
|
||||||
|
require('nvim-treesitter.configs').setup({
|
||||||
|
modules = {},
|
||||||
|
highlight = {
|
||||||
|
enable = true,
|
||||||
|
loaded = true,
|
||||||
|
module_path = "nvim-treesitter.highlight",
|
||||||
|
additional_vim_regex_highlighting = true,
|
||||||
|
},
|
||||||
|
indent = {
|
||||||
|
enable = true,
|
||||||
|
module_path = "nvim-treesitter.indent",
|
||||||
|
},
|
||||||
|
ensure_installed = { "bash", "comment", "go", "html", "javascript", "json", "kdl", "lua", "python", "typescript", "yaml" },
|
||||||
|
sync_install = false,
|
||||||
|
auto_install = false,
|
||||||
|
ignore_install = {},
|
||||||
|
})
|
||||||
|
|
||||||
|
vim.treesitter.language.register("html", "handlebars")
|
||||||
|
|
||||||
|
require('mini.icons').setup()
|
||||||
|
|
||||||
|
-- Tweak GitSigns blame color
|
||||||
|
-- This differentiates the cursorline from the git blame text
|
||||||
|
vim.cmd("highlight GitSignsCurrentLineBlame gui=bold guifg=#339944")
|
||||||
|
vim.cmd("highlight NonText gui=bold guifg=#999999")
|
||||||
|
|
||||||
|
--[[
|
||||||
|
Resolve conflict between fugitive and LSPSaga, wherein the latter's
|
||||||
|
breadcrumbs cause a mismatch between the buffer and fugitive's :Git blame
|
||||||
|
window and :Gvdiffsplit window(s). To kill the winbar (the top line where
|
||||||
|
the breadcrumbs and this blame title live), enter `:set winbar&`.
|
||||||
|
--]]
|
||||||
|
local blamegroup = vim.api.nvim_create_augroup("fugitiveSagaBlameConflict", { clear = true })
|
||||||
|
vim.api.nvim_create_autocmd(
|
||||||
|
'FileType',
|
||||||
|
{
|
||||||
|
group = blamegroup,
|
||||||
|
pattern = 'fugitiveblame',
|
||||||
|
callback = function()
|
||||||
|
vim.api.nvim_set_option_value('winbar', 'fugitive', { scope = 'local' })
|
||||||
|
end,
|
||||||
|
}
|
||||||
|
)
|
||||||
|
|
||||||
|
local diffgroup = vim.api.nvim_create_augroup("fugitiveSagaDiffConflict", { clear = true })
|
||||||
|
vim.api.nvim_create_autocmd(
|
||||||
|
'BufReadCmd',
|
||||||
|
{
|
||||||
|
group = diffgroup,
|
||||||
|
pattern = "fugitive://*",
|
||||||
|
callback = function()
|
||||||
|
vim.api.nvim_set_option_value('winbar', 'fugitive', { scope = 'local' })
|
||||||
|
end,
|
||||||
|
}
|
||||||
|
)
|
||||||
|
|
||||||
|
--[[
|
||||||
|
let g:nvlime_cl_impl = "ros"
|
||||||
|
function! NvlimeBuildServerCommandFor_ros(nvlime_loader, nvlime_eval)
|
||||||
|
return ["ros", "run",
|
||||||
|
\ "--load", a:nvlime_loader,
|
||||||
|
\ "--eval", a:nvlime_eval]
|
||||||
|
endfunction
|
||||||
|
--]]
|
||||||
|
-- Roswell
|
||||||
|
vim.g.nvlime_cl_impl = "ros"
|
||||||
|
vim.cmd([[
|
||||||
|
function! NvlimeBuildServerCommandFor_ros(nvlime_loader, nvlime_eval)
|
||||||
|
return ["ros", "run",
|
||||||
|
\ "--load", a:nvlime_loader,
|
||||||
|
\ "--eval", a:nvlime_eval]
|
||||||
|
endfunction
|
||||||
|
]])
|
||||||
|
|
||||||
|
-- Switch syntax highlighting on
|
||||||
|
vim.cmd("syntax enable")
|
8
nvim/.gitignore
vendored
Normal file
8
nvim/.gitignore
vendored
Normal file
|
@ -0,0 +1,8 @@
|
||||||
|
tt.*
|
||||||
|
.tests
|
||||||
|
doc/tags
|
||||||
|
debug
|
||||||
|
.repro
|
||||||
|
foo.*
|
||||||
|
*.log
|
||||||
|
data
|
15
nvim/.neoconf.json
Normal file
15
nvim/.neoconf.json
Normal file
|
@ -0,0 +1,15 @@
|
||||||
|
{
|
||||||
|
"neodev": {
|
||||||
|
"library": {
|
||||||
|
"enabled": true,
|
||||||
|
"plugins": true
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"neoconf": {
|
||||||
|
"plugins": {
|
||||||
|
"lua_ls": {
|
||||||
|
"enabled": true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
201
nvim/LICENSE
Normal file
201
nvim/LICENSE
Normal file
|
@ -0,0 +1,201 @@
|
||||||
|
Apache License
|
||||||
|
Version 2.0, January 2004
|
||||||
|
http://www.apache.org/licenses/
|
||||||
|
|
||||||
|
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
||||||
|
|
||||||
|
1. Definitions.
|
||||||
|
|
||||||
|
"License" shall mean the terms and conditions for use, reproduction,
|
||||||
|
and distribution as defined by Sections 1 through 9 of this document.
|
||||||
|
|
||||||
|
"Licensor" shall mean the copyright owner or entity authorized by
|
||||||
|
the copyright owner that is granting the License.
|
||||||
|
|
||||||
|
"Legal Entity" shall mean the union of the acting entity and all
|
||||||
|
other entities that control, are controlled by, or are under common
|
||||||
|
control with that entity. For the purposes of this definition,
|
||||||
|
"control" means (i) the power, direct or indirect, to cause the
|
||||||
|
direction or management of such entity, whether by contract or
|
||||||
|
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
||||||
|
outstanding shares, or (iii) beneficial ownership of such entity.
|
||||||
|
|
||||||
|
"You" (or "Your") shall mean an individual or Legal Entity
|
||||||
|
exercising permissions granted by this License.
|
||||||
|
|
||||||
|
"Source" form shall mean the preferred form for making modifications,
|
||||||
|
including but not limited to software source code, documentation
|
||||||
|
source, and configuration files.
|
||||||
|
|
||||||
|
"Object" form shall mean any form resulting from mechanical
|
||||||
|
transformation or translation of a Source form, including but
|
||||||
|
not limited to compiled object code, generated documentation,
|
||||||
|
and conversions to other media types.
|
||||||
|
|
||||||
|
"Work" shall mean the work of authorship, whether in Source or
|
||||||
|
Object form, made available under the License, as indicated by a
|
||||||
|
copyright notice that is included in or attached to the work
|
||||||
|
(an example is provided in the Appendix below).
|
||||||
|
|
||||||
|
"Derivative Works" shall mean any work, whether in Source or Object
|
||||||
|
form, that is based on (or derived from) the Work and for which the
|
||||||
|
editorial revisions, annotations, elaborations, or other modifications
|
||||||
|
represent, as a whole, an original work of authorship. For the purposes
|
||||||
|
of this License, Derivative Works shall not include works that remain
|
||||||
|
separable from, or merely link (or bind by name) to the interfaces of,
|
||||||
|
the Work and Derivative Works thereof.
|
||||||
|
|
||||||
|
"Contribution" shall mean any work of authorship, including
|
||||||
|
the original version of the Work and any modifications or additions
|
||||||
|
to that Work or Derivative Works thereof, that is intentionally
|
||||||
|
submitted to Licensor for inclusion in the Work by the copyright owner
|
||||||
|
or by an individual or Legal Entity authorized to submit on behalf of
|
||||||
|
the copyright owner. For the purposes of this definition, "submitted"
|
||||||
|
means any form of electronic, verbal, or written communication sent
|
||||||
|
to the Licensor or its representatives, including but not limited to
|
||||||
|
communication on electronic mailing lists, source code control systems,
|
||||||
|
and issue tracking systems that are managed by, or on behalf of, the
|
||||||
|
Licensor for the purpose of discussing and improving the Work, but
|
||||||
|
excluding communication that is conspicuously marked or otherwise
|
||||||
|
designated in writing by the copyright owner as "Not a Contribution."
|
||||||
|
|
||||||
|
"Contributor" shall mean Licensor and any individual or Legal Entity
|
||||||
|
on behalf of whom a Contribution has been received by Licensor and
|
||||||
|
subsequently incorporated within the Work.
|
||||||
|
|
||||||
|
2. Grant of Copyright License. Subject to the terms and conditions of
|
||||||
|
this License, each Contributor hereby grants to You a perpetual,
|
||||||
|
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||||
|
copyright license to reproduce, prepare Derivative Works of,
|
||||||
|
publicly display, publicly perform, sublicense, and distribute the
|
||||||
|
Work and such Derivative Works in Source or Object form.
|
||||||
|
|
||||||
|
3. Grant of Patent License. Subject to the terms and conditions of
|
||||||
|
this License, each Contributor hereby grants to You a perpetual,
|
||||||
|
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||||
|
(except as stated in this section) patent license to make, have made,
|
||||||
|
use, offer to sell, sell, import, and otherwise transfer the Work,
|
||||||
|
where such license applies only to those patent claims licensable
|
||||||
|
by such Contributor that are necessarily infringed by their
|
||||||
|
Contribution(s) alone or by combination of their Contribution(s)
|
||||||
|
with the Work to which such Contribution(s) was submitted. If You
|
||||||
|
institute patent litigation against any entity (including a
|
||||||
|
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
||||||
|
or a Contribution incorporated within the Work constitutes direct
|
||||||
|
or contributory patent infringement, then any patent licenses
|
||||||
|
granted to You under this License for that Work shall terminate
|
||||||
|
as of the date such litigation is filed.
|
||||||
|
|
||||||
|
4. Redistribution. You may reproduce and distribute copies of the
|
||||||
|
Work or Derivative Works thereof in any medium, with or without
|
||||||
|
modifications, and in Source or Object form, provided that You
|
||||||
|
meet the following conditions:
|
||||||
|
|
||||||
|
(a) You must give any other recipients of the Work or
|
||||||
|
Derivative Works a copy of this License; and
|
||||||
|
|
||||||
|
(b) You must cause any modified files to carry prominent notices
|
||||||
|
stating that You changed the files; and
|
||||||
|
|
||||||
|
(c) You must retain, in the Source form of any Derivative Works
|
||||||
|
that You distribute, all copyright, patent, trademark, and
|
||||||
|
attribution notices from the Source form of the Work,
|
||||||
|
excluding those notices that do not pertain to any part of
|
||||||
|
the Derivative Works; and
|
||||||
|
|
||||||
|
(d) If the Work includes a "NOTICE" text file as part of its
|
||||||
|
distribution, then any Derivative Works that You distribute must
|
||||||
|
include a readable copy of the attribution notices contained
|
||||||
|
within such NOTICE file, excluding those notices that do not
|
||||||
|
pertain to any part of the Derivative Works, in at least one
|
||||||
|
of the following places: within a NOTICE text file distributed
|
||||||
|
as part of the Derivative Works; within the Source form or
|
||||||
|
documentation, if provided along with the Derivative Works; or,
|
||||||
|
within a display generated by the Derivative Works, if and
|
||||||
|
wherever such third-party notices normally appear. The contents
|
||||||
|
of the NOTICE file are for informational purposes only and
|
||||||
|
do not modify the License. You may add Your own attribution
|
||||||
|
notices within Derivative Works that You distribute, alongside
|
||||||
|
or as an addendum to the NOTICE text from the Work, provided
|
||||||
|
that such additional attribution notices cannot be construed
|
||||||
|
as modifying the License.
|
||||||
|
|
||||||
|
You may add Your own copyright statement to Your modifications and
|
||||||
|
may provide additional or different license terms and conditions
|
||||||
|
for use, reproduction, or distribution of Your modifications, or
|
||||||
|
for any such Derivative Works as a whole, provided Your use,
|
||||||
|
reproduction, and distribution of the Work otherwise complies with
|
||||||
|
the conditions stated in this License.
|
||||||
|
|
||||||
|
5. Submission of Contributions. Unless You explicitly state otherwise,
|
||||||
|
any Contribution intentionally submitted for inclusion in the Work
|
||||||
|
by You to the Licensor shall be under the terms and conditions of
|
||||||
|
this License, without any additional terms or conditions.
|
||||||
|
Notwithstanding the above, nothing herein shall supersede or modify
|
||||||
|
the terms of any separate license agreement you may have executed
|
||||||
|
with Licensor regarding such Contributions.
|
||||||
|
|
||||||
|
6. Trademarks. This License does not grant permission to use the trade
|
||||||
|
names, trademarks, service marks, or product names of the Licensor,
|
||||||
|
except as required for reasonable and customary use in describing the
|
||||||
|
origin of the Work and reproducing the content of the NOTICE file.
|
||||||
|
|
||||||
|
7. Disclaimer of Warranty. Unless required by applicable law or
|
||||||
|
agreed to in writing, Licensor provides the Work (and each
|
||||||
|
Contributor provides its Contributions) on an "AS IS" BASIS,
|
||||||
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
||||||
|
implied, including, without limitation, any warranties or conditions
|
||||||
|
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
||||||
|
PARTICULAR PURPOSE. You are solely responsible for determining the
|
||||||
|
appropriateness of using or redistributing the Work and assume any
|
||||||
|
risks associated with Your exercise of permissions under this License.
|
||||||
|
|
||||||
|
8. Limitation of Liability. In no event and under no legal theory,
|
||||||
|
whether in tort (including negligence), contract, or otherwise,
|
||||||
|
unless required by applicable law (such as deliberate and grossly
|
||||||
|
negligent acts) or agreed to in writing, shall any Contributor be
|
||||||
|
liable to You for damages, including any direct, indirect, special,
|
||||||
|
incidental, or consequential damages of any character arising as a
|
||||||
|
result of this License or out of the use or inability to use the
|
||||||
|
Work (including but not limited to damages for loss of goodwill,
|
||||||
|
work stoppage, computer failure or malfunction, or any and all
|
||||||
|
other commercial damages or losses), even if such Contributor
|
||||||
|
has been advised of the possibility of such damages.
|
||||||
|
|
||||||
|
9. Accepting Warranty or Additional Liability. While redistributing
|
||||||
|
the Work or Derivative Works thereof, You may choose to offer,
|
||||||
|
and charge a fee for, acceptance of support, warranty, indemnity,
|
||||||
|
or other liability obligations and/or rights consistent with this
|
||||||
|
License. However, in accepting such obligations, You may act only
|
||||||
|
on Your own behalf and on Your sole responsibility, not on behalf
|
||||||
|
of any other Contributor, and only if You agree to indemnify,
|
||||||
|
defend, and hold each Contributor harmless for any liability
|
||||||
|
incurred by, or claims asserted against, such Contributor by reason
|
||||||
|
of your accepting any such warranty or additional liability.
|
||||||
|
|
||||||
|
END OF TERMS AND CONDITIONS
|
||||||
|
|
||||||
|
APPENDIX: How to apply the Apache License to your work.
|
||||||
|
|
||||||
|
To apply the Apache License to your work, attach the following
|
||||||
|
boilerplate notice, with the fields enclosed by brackets "[]"
|
||||||
|
replaced with your own identifying information. (Don't include
|
||||||
|
the brackets!) The text should be enclosed in the appropriate
|
||||||
|
comment syntax for the file format. We also recommend that a
|
||||||
|
file or class name and description of purpose be included on the
|
||||||
|
same "printed page" as the copyright notice for easier
|
||||||
|
identification within third-party archives.
|
||||||
|
|
||||||
|
Copyright [yyyy] [name of copyright owner]
|
||||||
|
|
||||||
|
Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
you may not use this file except in compliance with the License.
|
||||||
|
You may obtain a copy of the License at
|
||||||
|
|
||||||
|
http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
|
||||||
|
Unless required by applicable law or agreed to in writing, software
|
||||||
|
distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
See the License for the specific language governing permissions and
|
||||||
|
limitations under the License.
|
4
nvim/README.md
Normal file
4
nvim/README.md
Normal file
|
@ -0,0 +1,4 @@
|
||||||
|
# 💤 LazyVim
|
||||||
|
|
||||||
|
A starter template for [LazyVim](https://github.com/LazyVim/LazyVim).
|
||||||
|
Refer to the [documentation](https://lazyvim.github.io/installation) to get started.
|
843
nvim/init.lua
843
nvim/init.lua
|
@ -1,841 +1,2 @@
|
||||||
HOME = os.getenv("HOME")
|
-- bootstrap lazy.nvim, LazyVim and your plugins
|
||||||
|
require("config.lazy")
|
||||||
-- Configure the clipboard to access the "+ and "* registers
|
|
||||||
-- N.B. JavaScript copy buttons on the web do not necessarily work as expected
|
|
||||||
vim.opt.clipboard = "unnamedplus,unnamed"
|
|
||||||
|
|
||||||
-- Spaces indentation
|
|
||||||
vim.opt.expandtab = true -- converts tabs to spaces
|
|
||||||
vim.opt.tabstop = 4 -- tab equals 4 spaces
|
|
||||||
vim.opt.shiftwidth = 4 -- indent size in characters
|
|
||||||
|
|
||||||
-- Show whitespace (:list)
|
|
||||||
vim.opt.listchars = "eol:¬,tab:>-,trail:~,extends:>,precedes:<,space:·"
|
|
||||||
|
|
||||||
-- Show line numbers
|
|
||||||
vim.opt.number = true
|
|
||||||
|
|
||||||
-- Vertically splitting a window (:vsplit) places new window to the right
|
|
||||||
vim.opt.splitright = true
|
|
||||||
|
|
||||||
-- Highlight cursor line
|
|
||||||
vim.opt.cursorline = true
|
|
||||||
|
|
||||||
-- Enable folding
|
|
||||||
vim.opt.foldmethod = "syntax"
|
|
||||||
vim.opt.foldlevel = 5
|
|
||||||
|
|
||||||
-- Enable 24-bit RGB color in the TUI
|
|
||||||
vim.opt.termguicolors = true
|
|
||||||
|
|
||||||
-- Minimal number of lines kept above and below the cursor
|
|
||||||
vim.opt.scrolloff = 5
|
|
||||||
|
|
||||||
-- Turn off highlight search
|
|
||||||
vim.opt.hlsearch = false
|
|
||||||
|
|
||||||
-- Temporary file locations
|
|
||||||
vim.opt.backupdir = ".backup/," .. HOME .. "/.backup/,/tmp//"
|
|
||||||
vim.opt.directory = ".swp/," .. HOME .. "/.swp/,/tmp//"
|
|
||||||
|
|
||||||
-- netrw
|
|
||||||
-- This is the workspace file explorer
|
|
||||||
vim.g.netrw_winsize = 25 -- width of the file explorer
|
|
||||||
vim.g.netrw_liststyle = 3 -- tree style listing
|
|
||||||
|
|
||||||
-- Sane vim split naviagation (via Gaslight blog)
|
|
||||||
vim.keymap.set("n", "<c-j>", "<c-w>j", { noremap = true, desc = 'Go to window below' })
|
|
||||||
vim.keymap.set("n", "<c-k>", "<c-w>k", { noremap = true, desc = 'Go to window above' })
|
|
||||||
vim.keymap.set("n", "<c-h>", "<c-w>h", { noremap = true, desc = 'Go to window to the left' })
|
|
||||||
-- N.B. This conflicts with the NetRW directory refresh command. Use the alternative `:e .`.
|
|
||||||
-- TODO: This seems not to work for netrw.
|
|
||||||
vim.keymap.set("n", "<c-l>", "<c-w>l", { noremap = true, desc = 'Go to window to the right' })
|
|
||||||
|
|
||||||
vim.keymap.set("t", "<c-j>", "<c-\\><c-n><c-w>j", { noremap = true, desc = 'Go to window below' })
|
|
||||||
vim.keymap.set("t", "<c-k>", "<c-\\><c-n><c-w>k", { noremap = true, desc = 'Go to window above' })
|
|
||||||
vim.keymap.set("t", "<c-h>", "<c-\\><c-n><c-w>h", { noremap = true, desc = 'Go to window to the left' })
|
|
||||||
vim.keymap.set("t", "<c-l>", "<c-\\><c-n><c-w>l", { noremap = true, desc = 'Go to window to the right' })
|
|
||||||
|
|
||||||
vim.keymap.set(
|
|
||||||
{ "n", "t" },
|
|
||||||
"<leader>z",
|
|
||||||
function()
|
|
||||||
-- This restores the UI to the saved layout 'idelayout' (if it exists)
|
|
||||||
if vim.fn.exists("idelayout") ~= 0 then
|
|
||||||
vim.cmd("exec idelayout")
|
|
||||||
end
|
|
||||||
end,
|
|
||||||
{ desc = "Revert window layout" }
|
|
||||||
)
|
|
||||||
|
|
||||||
local terminalgroup = vim.api.nvim_create_augroup("TerminalGroup", { clear = true })
|
|
||||||
vim.api.nvim_create_autocmd(
|
|
||||||
{ "TermOpen", "TermEnter" },
|
|
||||||
{
|
|
||||||
group = terminalgroup,
|
|
||||||
pattern = "*",
|
|
||||||
command = "set nonumber"
|
|
||||||
}
|
|
||||||
)
|
|
||||||
|
|
||||||
-- lazy.nvim
|
|
||||||
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)
|
|
||||||
|
|
||||||
local js_based_languages = { "javascript", "typescript" }
|
|
||||||
|
|
||||||
require("lazy").setup({
|
|
||||||
{
|
|
||||||
"afair/vibrantink2",
|
|
||||||
priority = 1000,
|
|
||||||
config = function()
|
|
||||||
vim.cmd.colorscheme("vibrantink2")
|
|
||||||
end
|
|
||||||
},
|
|
||||||
"nvim-lualine/lualine.nvim",
|
|
||||||
"nvim-tree/nvim-web-devicons",
|
|
||||||
{ "echasnovski/mini.nvim", version = false },
|
|
||||||
{ "nvim-treesitter/nvim-treesitter", build = ":TSUpdate" },
|
|
||||||
"neovim/nvim-lspconfig",
|
|
||||||
{
|
|
||||||
"kylechui/nvim-surround",
|
|
||||||
version = "*", -- Use for stability; omit to use `main` branch for the latest features
|
|
||||||
event = "VeryLazy",
|
|
||||||
config = function()
|
|
||||||
require("nvim-surround").setup({
|
|
||||||
-- Configuration here, or leave empty to use defaults
|
|
||||||
})
|
|
||||||
end
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"folke/which-key.nvim",
|
|
||||||
event = "VeryLazy",
|
|
||||||
-- init = function()
|
|
||||||
-- vim.o.timeout = true
|
|
||||||
-- -- N.B. Setting `timeoutlen` to 0 seems to break the plugin
|
|
||||||
-- vim.o.timeoutlen = 300 -- 0? 500? 300?
|
|
||||||
-- end,
|
|
||||||
opts = {
|
|
||||||
win = {
|
|
||||||
border = "single",
|
|
||||||
},
|
|
||||||
},
|
|
||||||
keys = {
|
|
||||||
{
|
|
||||||
"<leader>?",
|
|
||||||
function()
|
|
||||||
require("which-key").show({ global = false })
|
|
||||||
end,
|
|
||||||
desc = "Buffer Local Keymaps (which-key)",
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"ray-x/lsp_signature.nvim",
|
|
||||||
event = "VeryLazy",
|
|
||||||
opts = {},
|
|
||||||
config = function(_, opts) require 'lsp_signature'.setup(opts) end
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"folke/lazydev.nvim",
|
|
||||||
ft = "lua", -- only load on lua files
|
|
||||||
opts = {
|
|
||||||
library = {
|
|
||||||
-- See the configuration section for more details
|
|
||||||
-- Load luvit types when the `vim.uv` word is found
|
|
||||||
{ path = "luvit-meta/library", words = { "vim%.uv" } },
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
{ "Bilal2453/luvit-meta", lazy = true }, -- optional `vim.uv` typings
|
|
||||||
{ -- optional completion source for require statements and module annotations
|
|
||||||
"hrsh7th/nvim-cmp",
|
|
||||||
opts = function(_, opts)
|
|
||||||
opts.sources = opts.sources or {}
|
|
||||||
table.insert(opts.sources, {
|
|
||||||
name = "lazydev",
|
|
||||||
group_index = 0, -- set group index to 0 to skip loading LuaLS completions
|
|
||||||
})
|
|
||||||
end,
|
|
||||||
event = "InsertEnter",
|
|
||||||
dependencies = {
|
|
||||||
"hrsh7th/cmp-nvim-lsp",
|
|
||||||
"hrsh7th/cmp-buffer",
|
|
||||||
"hrsh7th/cmp-path",
|
|
||||||
"hrsh7th/cmp-cmdline",
|
|
||||||
"hrsh7th/cmp-vsnip",
|
|
||||||
"hrsh7th/vim-vsnip",
|
|
||||||
"hrsh7th/cmp-nvim-lsp-signature-help",
|
|
||||||
},
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"rcarriga/nvim-dap-ui",
|
|
||||||
dependencies = { "mfussenegger/nvim-dap", "nvim-neotest/nvim-nio" },
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"mfussenegger/nvim-dap",
|
|
||||||
event = "VeryLazy",
|
|
||||||
config = function()
|
|
||||||
local dap = require("dap")
|
|
||||||
|
|
||||||
-- local Config = require("lazyvim.config")
|
|
||||||
vim.api.nvim_set_hl(0, "DapStoppedLine", { default = true, link = "Visual" })
|
|
||||||
|
|
||||||
--[[
|
|
||||||
for name, sign in pairs(Config.icons.dap) do
|
|
||||||
sign = type(sign) == "table" and sign or { sign }
|
|
||||||
vim.fn.sign_define(
|
|
||||||
"Dap" .. name,
|
|
||||||
{ text = sign[1], texthl = sign[2] or "DiagnosticInfo", linehl = sign[3], numhl = sign[3] }
|
|
||||||
)
|
|
||||||
end
|
|
||||||
--]]
|
|
||||||
|
|
||||||
for _, language in ipairs({ "javascript", "typescript" }) do
|
|
||||||
dap.configurations[language] = {
|
|
||||||
-- Debug single nodejs files
|
|
||||||
{
|
|
||||||
type = "pwa-node",
|
|
||||||
request = "launch",
|
|
||||||
name = "Launch file",
|
|
||||||
program = "${file}",
|
|
||||||
cwd = vim.fn.getcwd(),
|
|
||||||
sourceMaps = true,
|
|
||||||
},
|
|
||||||
-- Debug nodejs processes (make sure to add --inspect when you run the process)
|
|
||||||
{
|
|
||||||
type = "pwa-node",
|
|
||||||
request = "attach",
|
|
||||||
name = "Attach",
|
|
||||||
processId = require("dap.utils").pick_process,
|
|
||||||
cwd = vim.fn.getcwd(),
|
|
||||||
sourceMaps = true,
|
|
||||||
},
|
|
||||||
-- Debug web applications (client side)
|
|
||||||
{
|
|
||||||
type = "pwa-chrome",
|
|
||||||
request = "launch",
|
|
||||||
name = "Launch & Debug Chrome",
|
|
||||||
url = function()
|
|
||||||
local co = coroutine.running()
|
|
||||||
return coroutine.create(function()
|
|
||||||
vim.ui.input({
|
|
||||||
prompt = "Enter URL: ",
|
|
||||||
default = "http://localhost:3000",
|
|
||||||
}, function(url)
|
|
||||||
if url == nil or url == "" then
|
|
||||||
return
|
|
||||||
else
|
|
||||||
coroutine.resume(co, url)
|
|
||||||
end
|
|
||||||
end)
|
|
||||||
end)
|
|
||||||
end,
|
|
||||||
webRoot = vim.fn.getcwd(),
|
|
||||||
protocol = "inspector",
|
|
||||||
sourceMaps = true,
|
|
||||||
userDataDir = false,
|
|
||||||
},
|
|
||||||
-- Divider for the launch.json derived configs
|
|
||||||
{
|
|
||||||
name = "----- ↓ launch.json configs ↓ -----",
|
|
||||||
type = "",
|
|
||||||
request = "launch",
|
|
||||||
},
|
|
||||||
}
|
|
||||||
end
|
|
||||||
end,
|
|
||||||
keys = {
|
|
||||||
{
|
|
||||||
"<leader>dO",
|
|
||||||
function()
|
|
||||||
require("dap").step_out()
|
|
||||||
end,
|
|
||||||
desc = "DAP: Step Out",
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"<leader>do",
|
|
||||||
function()
|
|
||||||
require("dap").step_over()
|
|
||||||
end,
|
|
||||||
desc = "DAP: Step Over",
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"<leader>db",
|
|
||||||
function()
|
|
||||||
require("dap").toggle_breakpoint()
|
|
||||||
end,
|
|
||||||
desc = "DAP: Toggle breakpoint",
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"<leader>dc",
|
|
||||||
function()
|
|
||||||
require("dap").continue()
|
|
||||||
end,
|
|
||||||
desc = "DAP: Continue",
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"<leader>di",
|
|
||||||
function()
|
|
||||||
require("dap").step_into()
|
|
||||||
end,
|
|
||||||
desc = "DAP: Step Into",
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"<leader>da",
|
|
||||||
function()
|
|
||||||
if vim.fn.filereadable(".vscode/launch.json") then
|
|
||||||
local dap_vscode = require("dap.ext.vscode")
|
|
||||||
dap_vscode.load_launchjs(nil, {
|
|
||||||
["pwa-node"] = js_based_languages,
|
|
||||||
["chrome"] = js_based_languages,
|
|
||||||
["pwa-chrome"] = js_based_languages,
|
|
||||||
})
|
|
||||||
end
|
|
||||||
require("dap").continue()
|
|
||||||
end,
|
|
||||||
desc = "DAP: Run with Args",
|
|
||||||
},
|
|
||||||
},
|
|
||||||
dependencies = {
|
|
||||||
-- Install the vscode-js-debug adapter
|
|
||||||
{
|
|
||||||
"microsoft/vscode-js-debug",
|
|
||||||
-- After install, build it and rename the dist directory to out
|
|
||||||
build =
|
|
||||||
"npm install --legacy-peer-deps --no-save && npx gulp vsDebugServerBundle && rm -rf out && mv dist out",
|
|
||||||
version = "1.*",
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"mxsdev/nvim-dap-vscode-js",
|
|
||||||
config = function()
|
|
||||||
---@diagnostic disable-next-line: missing-fields
|
|
||||||
require("dap-vscode-js").setup({
|
|
||||||
-- Path of node executable. Defaults to $NODE_PATH, and then "node"
|
|
||||||
-- node_path = "node",
|
|
||||||
|
|
||||||
-- Path to vscode-js-debug installation.
|
|
||||||
debugger_path = vim.fn.resolve(vim.fn.stdpath("data") .. "/lazy/vscode-js-debug"),
|
|
||||||
|
|
||||||
-- Command to use to launch the debug server. Takes precedence over "node_path" and "debugger_path"
|
|
||||||
-- debugger_cmd = { "js-debug-adapter" },
|
|
||||||
|
|
||||||
-- which adapters to register in nvim-dap
|
|
||||||
adapters = {
|
|
||||||
"chrome",
|
|
||||||
"pwa-node",
|
|
||||||
"pwa-chrome",
|
|
||||||
"pwa-msedge",
|
|
||||||
"pwa-extensionHost",
|
|
||||||
"node-terminal",
|
|
||||||
},
|
|
||||||
|
|
||||||
-- Path for file logging
|
|
||||||
-- log_file_path = "(stdpath cache)/dap_vscode_js.log",
|
|
||||||
|
|
||||||
-- Logging level for output to file. Set to false to disable logging.
|
|
||||||
-- log_file_level = false,
|
|
||||||
|
|
||||||
-- Logging level for output to console. Set to false to disable console output.
|
|
||||||
-- log_console_level = vim.log.levels.ERROR,
|
|
||||||
})
|
|
||||||
end,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"Joakker/lua-json5",
|
|
||||||
build = "./install.sh",
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
{ "leoluz/nvim-dap-go", event = "VeryLazy" },
|
|
||||||
{ "williamboman/mason.nvim", event = "VeryLazy" },
|
|
||||||
{ "williamboman/mason-lspconfig.nvim", event = "VeryLazy" },
|
|
||||||
{ "nvimdev/lspsaga.nvim", event = "VeryLazy" },
|
|
||||||
{
|
|
||||||
"nvim-telescope/telescope.nvim",
|
|
||||||
event = "VeryLazy",
|
|
||||||
branch = "0.1.x",
|
|
||||||
dependencies = {
|
|
||||||
"nvim-lua/plenary.nvim",
|
|
||||||
{
|
|
||||||
"nvim-telescope/telescope-fzf-native.nvim",
|
|
||||||
build =
|
|
||||||
"cmake -S. -Bbuild -DCMAKE_BUILD_TYPE=Release && cmake --build build --config Release && cmake --install build --prefix build",
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
{ "tpope/vim-fugitive", event = "VeryLazy" },
|
|
||||||
{ "lewis6991/gitsigns.nvim", event = "VeryLazy" },
|
|
||||||
{
|
|
||||||
"pwntester/octo.nvim",
|
|
||||||
requires = {
|
|
||||||
"nvim-lua/plenary.nvim",
|
|
||||||
"nvim-telescope/telescope.nvim",
|
|
||||||
"nvim-tree/nvim-web-devicons",
|
|
||||||
},
|
|
||||||
config = function()
|
|
||||||
require("octo").setup()
|
|
||||||
end,
|
|
||||||
event = "VeryLazy",
|
|
||||||
},
|
|
||||||
{ "famiu/bufdelete.nvim", event = "VeryLazy" },
|
|
||||||
-- { "vlime/vlime", config = function() rtp = 'vim/' end },
|
|
||||||
--[[
|
|
||||||
{
|
|
||||||
'windwp/nvim-autopairs',
|
|
||||||
event = "InsertEnter",
|
|
||||||
config = true,
|
|
||||||
-- use opts = {} for passing setup options
|
|
||||||
-- this is equalent to setup({}) function
|
|
||||||
},
|
|
||||||
--]]
|
|
||||||
--{ "bhurlow/vim-parinfer", event = "VeryLazy" },
|
|
||||||
{ "kovisoft/paredit" },
|
|
||||||
--{ "monkoose/parsley", event = "VeryLazy" },
|
|
||||||
{ "monkoose/nvlime", ft = { "lisp" }, dependencies = { "monkoose/parsley" } },
|
|
||||||
{
|
|
||||||
'MeanderingProgrammer/markdown.nvim',
|
|
||||||
-- name = 'render-markdown', -- Only needed if you have another plugin named markdown.nvim
|
|
||||||
dependencies = {
|
|
||||||
'nvim-treesitter/nvim-treesitter', -- Mandatory
|
|
||||||
'nvim-tree/nvim-web-devicons', -- Optional but recommended
|
|
||||||
},
|
|
||||||
config = function()
|
|
||||||
require('render-markdown').setup({})
|
|
||||||
end,
|
|
||||||
},
|
|
||||||
{ "jparise/vim-graphql" },
|
|
||||||
})
|
|
||||||
|
|
||||||
--[[ mason
|
|
||||||
Mason manages external editor plugins such as LSP servers, DAP servers,
|
|
||||||
linters, and formatters. There are further recommended plugins for better
|
|
||||||
integration.
|
|
||||||
--]]
|
|
||||||
require('mason').setup()
|
|
||||||
require('mason-lspconfig').setup()
|
|
||||||
|
|
||||||
--[[ lualine
|
|
||||||
Lualine provides the status bar as well as the tabline.
|
|
||||||
--]]
|
|
||||||
require('lualine').setup {
|
|
||||||
options = { theme = 'dracula' },
|
|
||||||
tabline = {
|
|
||||||
lualine_a = {
|
|
||||||
{
|
|
||||||
'buffers',
|
|
||||||
mode = 4,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
}
|
|
||||||
|
|
||||||
--[[ Telescope
|
|
||||||
Telescope provides lists, pickers, etc. This section includes just the
|
|
||||||
functions bound to keymaps.
|
|
||||||
--]]
|
|
||||||
local builtin = require('telescope.builtin')
|
|
||||||
vim.keymap.set('n', '<leader>ff', builtin.find_files, { desc = 'Telescope: find files' })
|
|
||||||
vim.keymap.set('n', '<leader>fg', builtin.live_grep, { desc = 'Telescope: live grep' })
|
|
||||||
vim.keymap.set('n', '<leader>fb', builtin.buffers, { desc = 'Telescope: buffers' })
|
|
||||||
vim.keymap.set('n', '<leader>fh', builtin.help_tags, { desc = 'Telescope: help tags' })
|
|
||||||
|
|
||||||
require "lsp_signature".setup()
|
|
||||||
|
|
||||||
--[[ nvim-cmp
|
|
||||||
nvim-cmp is a text completion engine.
|
|
||||||
]]
|
|
||||||
|
|
||||||
local cmp = require 'cmp'
|
|
||||||
|
|
||||||
cmp.setup({
|
|
||||||
snippet = {
|
|
||||||
-- REQUIRED - you must specify a snippet engine
|
|
||||||
expand = function(args)
|
|
||||||
vim.fn["vsnip#anonymous"](args.body) -- For `vsnip` users.
|
|
||||||
end,
|
|
||||||
},
|
|
||||||
window = {
|
|
||||||
completion = cmp.config.window.bordered(),
|
|
||||||
documentation = cmp.config.window.bordered(),
|
|
||||||
},
|
|
||||||
mapping = cmp.mapping.preset.insert({
|
|
||||||
['<C-b>'] = cmp.mapping.scroll_docs(-4),
|
|
||||||
['<C-f>'] = cmp.mapping.scroll_docs(4),
|
|
||||||
['<C-Space>'] = cmp.mapping.complete(),
|
|
||||||
['<C-e>'] = cmp.mapping.abort(),
|
|
||||||
['<CR>'] = cmp.mapping.confirm({ select = true }), -- Accept currently selected item. Set `select` to `false` to only confirm explicitly selected items.
|
|
||||||
}),
|
|
||||||
sources = cmp.config.sources({
|
|
||||||
{ name = 'nvim_lsp' },
|
|
||||||
{ name = 'vsnip' }, -- For vsnip users.
|
|
||||||
}, {
|
|
||||||
{ name = 'buffer' },
|
|
||||||
{ name = 'nvim_lsp_signature_help' },
|
|
||||||
})
|
|
||||||
})
|
|
||||||
|
|
||||||
-- Set configuration for specific filetype.
|
|
||||||
cmp.setup.filetype('gitcommit', {
|
|
||||||
sources = cmp.config.sources({
|
|
||||||
{ name = 'git' }, -- You can specify the `git` source if [you were installed it](https://github.com/petertriho/cmp-git).
|
|
||||||
}, {
|
|
||||||
{ name = 'buffer' },
|
|
||||||
})
|
|
||||||
})
|
|
||||||
|
|
||||||
-- Use buffer source for `/` and `?` (if you enabled `native_menu`, this won't work anymore).
|
|
||||||
cmp.setup.cmdline({ '/', '?' }, {
|
|
||||||
mapping = cmp.mapping.preset.cmdline(),
|
|
||||||
sources = {
|
|
||||||
{ name = 'buffer' }
|
|
||||||
}
|
|
||||||
})
|
|
||||||
|
|
||||||
-- Use cmdline & path source for ':' (if you enabled `native_menu`, this won't work anymore).
|
|
||||||
cmp.setup.cmdline(':', {
|
|
||||||
mapping = cmp.mapping.preset.cmdline(),
|
|
||||||
sources = cmp.config.sources({
|
|
||||||
{ name = 'path' }
|
|
||||||
}, {
|
|
||||||
{ name = 'cmdline' }
|
|
||||||
})
|
|
||||||
})
|
|
||||||
|
|
||||||
--[[ nvim-lspconfig
|
|
||||||
--]]
|
|
||||||
|
|
||||||
-- Setup language servers.
|
|
||||||
local lua_ls_setup = {
|
|
||||||
settings = {
|
|
||||||
Lua = {
|
|
||||||
runtime = {
|
|
||||||
-- Tell the language server which version of Lua you're using (most likely LuaJIT in the case of Neovim)
|
|
||||||
version = "LuaJIT",
|
|
||||||
},
|
|
||||||
diagnostics = {
|
|
||||||
-- Get the language server to recognize the `vim` global
|
|
||||||
globals = { "vim" },
|
|
||||||
},
|
|
||||||
workspace = {
|
|
||||||
-- Make the server aware of Neovim runtime files
|
|
||||||
library = vim.api.nvim_get_runtime_file("", true),
|
|
||||||
checkThirdParty = false,
|
|
||||||
},
|
|
||||||
-- Do not send telemetry data containing a randomized but unique identifier
|
|
||||||
telemetry = {
|
|
||||||
enable = false,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
}
|
|
||||||
|
|
||||||
local capabilities = require('cmp_nvim_lsp').default_capabilities()
|
|
||||||
|
|
||||||
local lspconfig = require('lspconfig')
|
|
||||||
lspconfig.gopls.setup { capabilities = capabilities }
|
|
||||||
lspconfig.lua_ls.setup(lua_ls_setup)
|
|
||||||
lspconfig.pyright.setup { capabilities = capabilities }
|
|
||||||
-- lspconfig.tsserver.setup { capabilities = capabilities }
|
|
||||||
lspconfig.ts_ls.setup { capabilities = capabilities }
|
|
||||||
lspconfig.rust_analyzer.setup {
|
|
||||||
-- Server-specific settings. See `:help lspconfig-setup`
|
|
||||||
capabilities = capabilities,
|
|
||||||
settings = {
|
|
||||||
['rust-analyzer'] = {},
|
|
||||||
},
|
|
||||||
}
|
|
||||||
|
|
||||||
-- Enable (broadcasting) snippet capability for completion
|
|
||||||
local capabilities_html = vim.lsp.protocol.make_client_capabilities()
|
|
||||||
capabilities_html.textDocument.completion.completionItem.snippetSupport = true
|
|
||||||
|
|
||||||
require 'lspconfig'.html.setup {
|
|
||||||
capabilities = capabilities_html,
|
|
||||||
}
|
|
||||||
|
|
||||||
-- Global mappings : Diagnostics
|
|
||||||
-- See `:help vim.diagnostic.*` for documentation on any of the below functions
|
|
||||||
vim.keymap.set('n', '<space>e', vim.diagnostic.open_float, { desc = 'Diagnostic: open float' })
|
|
||||||
vim.keymap.set('n', '[d', vim.diagnostic.goto_prev, { desc = 'Diagnostic: go to previous' })
|
|
||||||
vim.keymap.set('n', ']d', vim.diagnostic.goto_next, { desc = 'Diagnostic: go to next' })
|
|
||||||
vim.keymap.set('n', '<space>q', vim.diagnostic.setloclist, { desc = 'Diagnostic: set loclist' })
|
|
||||||
|
|
||||||
-- Add a border to LSP windows
|
|
||||||
local _border = "single"
|
|
||||||
|
|
||||||
vim.lsp.handlers["textDocument/hover"] = vim.lsp.with(
|
|
||||||
vim.lsp.handlers.hover, {
|
|
||||||
border = _border
|
|
||||||
}
|
|
||||||
)
|
|
||||||
|
|
||||||
-- TODO: Is this necessary? Or is signature help being handled with LSPSaga?
|
|
||||||
--[[
|
|
||||||
vim.lsp.handlers["textDocument/signatureHelp"] = vim.lsp.with(
|
|
||||||
vim.lsp.handlers.signature_help, {
|
|
||||||
border = _border
|
|
||||||
}
|
|
||||||
)
|
|
||||||
--]]
|
|
||||||
|
|
||||||
vim.diagnostic.config {
|
|
||||||
float = { border = _border, max_width = 120 }
|
|
||||||
}
|
|
||||||
-- 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.
|
|
||||||
-- See `:help vim.lsp.*` for documentation on any of the below functions
|
|
||||||
local opts = function(desc)
|
|
||||||
return { buffer = ev.buf, desc = desc }
|
|
||||||
end
|
|
||||||
vim.keymap.set('n', 'gD', vim.lsp.buf.declaration, opts('LSP: go to declaration'))
|
|
||||||
vim.keymap.set('n', 'gd', vim.lsp.buf.definition, opts('LSP: go to definition'))
|
|
||||||
vim.keymap.set('n', 'K', vim.lsp.buf.hover, opts('LSP: hover'))
|
|
||||||
vim.keymap.set('n', 'gi', vim.lsp.buf.implementation, opts('LSP: go to implementation'))
|
|
||||||
-- This setting steps on my split navigation setting, so I changed it
|
|
||||||
-- to the probably harmless F9.
|
|
||||||
-- vim.keymap.set('n', '<C-k>', vim.lsp.buf.signature_help, opts(''))
|
|
||||||
vim.keymap.set('n', '<F9>', vim.lsp.buf.signature_help, opts('LSP: signature help'))
|
|
||||||
vim.keymap.set('n', '<space>wa', vim.lsp.buf.add_workspace_folder, opts('LSP: add workspace folder'))
|
|
||||||
vim.keymap.set('n', '<space>wr', vim.lsp.buf.remove_workspace_folder, opts('LSP: remove workspace folder'))
|
|
||||||
vim.keymap.set('n', '<space>wl', function()
|
|
||||||
print(vim.inspect(vim.lsp.buf.list_workspace_folders()))
|
|
||||||
end, opts('LSP: list workspace folder'))
|
|
||||||
vim.keymap.set('n', '<space>D', vim.lsp.buf.type_definition, opts('LSP: go to type definition'))
|
|
||||||
vim.keymap.set('n', '<space>rn', vim.lsp.buf.rename, opts('LSP: rename token'))
|
|
||||||
vim.keymap.set({ 'n', 'v' }, '<space>ca', vim.lsp.buf.code_action, opts('LSP: code action'))
|
|
||||||
vim.keymap.set('n', 'gr', vim.lsp.buf.references, opts('LSP: go to references'))
|
|
||||||
vim.keymap.set('n', '<space>f', function()
|
|
||||||
vim.lsp.buf.format { async = true }
|
|
||||||
end, opts('LSP: format'))
|
|
||||||
end,
|
|
||||||
})
|
|
||||||
|
|
||||||
require('gitsigns').setup({
|
|
||||||
signs = {
|
|
||||||
add = { text = '│' },
|
|
||||||
change = { text = '│' },
|
|
||||||
delete = { text = '_' },
|
|
||||||
topdelete = { text = '‾' },
|
|
||||||
changedelete = { text = '~' },
|
|
||||||
untracked = { text = '┆' },
|
|
||||||
},
|
|
||||||
signcolumn = true, -- Toggle with `:Gitsigns toggle_signs`
|
|
||||||
numhl = false, -- Toggle with `:Gitsigns toggle_numhl`
|
|
||||||
linehl = false, -- Toggle with `:Gitsigns toggle_linehl`
|
|
||||||
word_diff = false, -- Toggle with `:Gitsigns toggle_word_diff`
|
|
||||||
watch_gitdir = {
|
|
||||||
follow_files = true
|
|
||||||
},
|
|
||||||
attach_to_untracked = true,
|
|
||||||
current_line_blame = false, -- Toggle with `:Gitsigns toggle_current_line_blame`
|
|
||||||
current_line_blame_opts = {
|
|
||||||
virt_text = true,
|
|
||||||
virt_text_pos = 'eol', -- 'eol' | 'overlay' | 'right_align'
|
|
||||||
delay = 1000,
|
|
||||||
ignore_whitespace = false,
|
|
||||||
},
|
|
||||||
current_line_blame_formatter = '<author>, <author_time:%Y-%m-%d> - <summary>',
|
|
||||||
sign_priority = 6,
|
|
||||||
update_debounce = 100,
|
|
||||||
status_formatter = nil, -- Use default
|
|
||||||
max_file_length = 40000, -- Disable if file is longer than this (in lines)
|
|
||||||
preview_config = {
|
|
||||||
-- Options passed to nvim_open_win
|
|
||||||
border = 'single',
|
|
||||||
style = 'minimal',
|
|
||||||
relative = 'cursor',
|
|
||||||
row = 0,
|
|
||||||
col = 1
|
|
||||||
},
|
|
||||||
-- [2024-09-10] This is invalid, suddenly.
|
|
||||||
-- yadm = { enable = false },
|
|
||||||
on_attach = function(bufnr)
|
|
||||||
local gs = package.loaded.gitsigns
|
|
||||||
|
|
||||||
local function map(mode, l, r, opts)
|
|
||||||
opts = opts or {}
|
|
||||||
opts.buffer = bufnr
|
|
||||||
vim.keymap.set(mode, l, r, opts)
|
|
||||||
end
|
|
||||||
|
|
||||||
-- Navigation
|
|
||||||
map('n', ']c', function()
|
|
||||||
if vim.wo.diff then return ']c' end
|
|
||||||
vim.schedule(function() gs.next_hunk() end)
|
|
||||||
return '<Ignore>'
|
|
||||||
end, { expr = true, desc = 'GitSigns: go to next hunk' })
|
|
||||||
|
|
||||||
map('n', '[c', function()
|
|
||||||
if vim.wo.diff then return '[c' end
|
|
||||||
vim.schedule(function() gs.prev_hunk() end)
|
|
||||||
return '<Ignore>'
|
|
||||||
end, { expr = true, desc = 'GitSigns: go to previous hunk' })
|
|
||||||
|
|
||||||
-- Actions
|
|
||||||
map('n', '<leader>hs', gs.stage_hunk, { desc = 'GitSigns: stage hunk' })
|
|
||||||
map('n', '<leader>hr', gs.reset_hunk, { desc = 'GitSigns: reset hunk' })
|
|
||||||
map('v', '<leader>hs', function() gs.stage_hunk { vim.fn.line('.'), vim.fn.line('v') } end,
|
|
||||||
{ desc = 'GitSigns: stage hunk' })
|
|
||||||
map('v', '<leader>hr', function() gs.reset_hunk { vim.fn.line('.'), vim.fn.line('v') } end,
|
|
||||||
{ desc = 'GitSigns: reset hunk' })
|
|
||||||
map('n', '<leader>hS', gs.stage_buffer, { desc = 'GitSigns: stage buffer' })
|
|
||||||
map('n', '<leader>hu', gs.undo_stage_hunk, { desc = 'GitSigns: undo stage hunk' })
|
|
||||||
map('n', '<leader>hR', gs.reset_buffer, { desc = 'GitSigns: reset_buffer' })
|
|
||||||
map('n', '<leader>hp', gs.preview_hunk, { desc = 'GitSigns: preview hunk' })
|
|
||||||
map('n', '<leader>hb', function() gs.blame_line { full = true } end, { desc = 'GitSigns: blame line' })
|
|
||||||
map('n', '<leader>tb', gs.toggle_current_line_blame, { desc = 'GitSigns: toggle current line blame' })
|
|
||||||
map('n', '<leader>hd', gs.diffthis, { desc = 'GitSigns: diff this' })
|
|
||||||
map('n', '<leader>hD', function() gs.diffthis('~') end, { desc = 'GitSigns: diff this' })
|
|
||||||
map('n', '<leader>td', gs.toggle_deleted, { desc = 'GitSigns: toggle deleted' })
|
|
||||||
end
|
|
||||||
})
|
|
||||||
|
|
||||||
--[[
|
|
||||||
-- LSPSaga : provides a diverse basket of utilities
|
|
||||||
--]]
|
|
||||||
require('lspsaga').setup({
|
|
||||||
beacon = {
|
|
||||||
enable = true,
|
|
||||||
frequency = 7,
|
|
||||||
}
|
|
||||||
})
|
|
||||||
vim.keymap.set('n', '<leader>si', '<cmd>Lspsaga incoming_calls<CR>')
|
|
||||||
vim.keymap.set('n', '<leader>so', '<cmd>Lspsaga outgoing_calls<CR>')
|
|
||||||
vim.keymap.set('n', '<leader>ca', '<cmd>Lspsaga code_action<CR>')
|
|
||||||
vim.keymap.set('n', '<leader>sd', '<cmd>Lspsaga peek_definition<CR>')
|
|
||||||
vim.keymap.set('n', '<leader>sp', '<cmd>Lspsaga peek_type_definition<CR>')
|
|
||||||
vim.keymap.set('n', '<leader>sx', '<cmd>Lspsaga goto_definition<CR>')
|
|
||||||
vim.keymap.set('n', '<leader>sg', '<cmd>Lspsaga goto_type_definition<CR>')
|
|
||||||
vim.keymap.set('n', '[e', '<cmd>Lspsaga diagnostic_jump_prev<CR>')
|
|
||||||
vim.keymap.set('n', ']e', '<cmd>Lspsaga diagnostic_jump_next<CR>')
|
|
||||||
vim.keymap.set('n', '<leader>sK', '<cmd>Lspsaga hover_doc<CR>')
|
|
||||||
vim.keymap.set('n', '<leader>sm', '<cmd>Lspsaga finder imp<CR>')
|
|
||||||
vim.keymap.set('n', '<leader>sf', '<cmd>Lspsaga finder<CR>')
|
|
||||||
vim.keymap.set('n', '<leader>sl', '<cmd>Lspsaga outline<CR>')
|
|
||||||
vim.keymap.set('n', '<leader>rn', '<cmd>Lspsaga rename<CR>')
|
|
||||||
vim.keymap.set('n', '<leader>st', '<cmd>Lspsaga term_toggle<CR>')
|
|
||||||
|
|
||||||
require('dap-go').setup()
|
|
||||||
|
|
||||||
local dap, dapui = require("dap"), require("dapui")
|
|
||||||
dapui.setup()
|
|
||||||
|
|
||||||
dap.listeners.after.event_initialized["dapui_config"] = function()
|
|
||||||
dapui.open()
|
|
||||||
end
|
|
||||||
dap.listeners.before.event_terminated["dapui_config"] = function()
|
|
||||||
dapui.close()
|
|
||||||
end
|
|
||||||
dap.listeners.before.event_exited["dapui_config"] = function()
|
|
||||||
dapui.close()
|
|
||||||
end
|
|
||||||
|
|
||||||
-- Handlebars: One way to get syntax highlighting in Handlebars files
|
|
||||||
--[[
|
|
||||||
local syntax_highlighting_tweaks = vim.api.nvim_create_augroup("SyntaxHighlightingTweaks", { clear = true })
|
|
||||||
vim.api.nvim_create_autocmd(
|
|
||||||
{ "BufRead", "BufNewFile" },
|
|
||||||
{
|
|
||||||
group = syntax_highlighting_tweaks,
|
|
||||||
pattern = "*.hbs",
|
|
||||||
command = "set filetype=html"
|
|
||||||
}
|
|
||||||
)
|
|
||||||
--]]
|
|
||||||
|
|
||||||
-- Treesitter
|
|
||||||
require('nvim-treesitter.configs').setup({
|
|
||||||
modules = {},
|
|
||||||
highlight = {
|
|
||||||
enable = true,
|
|
||||||
loaded = true,
|
|
||||||
module_path = "nvim-treesitter.highlight",
|
|
||||||
additional_vim_regex_highlighting = true,
|
|
||||||
},
|
|
||||||
indent = {
|
|
||||||
enable = true,
|
|
||||||
module_path = "nvim-treesitter.indent",
|
|
||||||
},
|
|
||||||
ensure_installed = { "bash", "comment", "go", "html", "javascript", "json", "kdl", "lua", "python", "typescript", "yaml" },
|
|
||||||
sync_install = false,
|
|
||||||
auto_install = false,
|
|
||||||
ignore_install = {},
|
|
||||||
})
|
|
||||||
|
|
||||||
vim.treesitter.language.register("html", "handlebars")
|
|
||||||
|
|
||||||
require('mini.icons').setup()
|
|
||||||
|
|
||||||
-- Tweak GitSigns blame color
|
|
||||||
-- This differentiates the cursorline from the git blame text
|
|
||||||
vim.cmd("highlight GitSignsCurrentLineBlame gui=bold guifg=#339944")
|
|
||||||
vim.cmd("highlight NonText gui=bold guifg=#999999")
|
|
||||||
|
|
||||||
--[[
|
|
||||||
Resolve conflict between fugitive and LSPSaga, wherein the latter's
|
|
||||||
breadcrumbs cause a mismatch between the buffer and fugitive's :Git blame
|
|
||||||
window and :Gvdiffsplit window(s). To kill the winbar (the top line where
|
|
||||||
the breadcrumbs and this blame title live), enter `:set winbar&`.
|
|
||||||
--]]
|
|
||||||
local blamegroup = vim.api.nvim_create_augroup("fugitiveSagaBlameConflict", { clear = true })
|
|
||||||
vim.api.nvim_create_autocmd(
|
|
||||||
'FileType',
|
|
||||||
{
|
|
||||||
group = blamegroup,
|
|
||||||
pattern = 'fugitiveblame',
|
|
||||||
callback = function()
|
|
||||||
vim.api.nvim_set_option_value('winbar', 'fugitive', { scope = 'local' })
|
|
||||||
end,
|
|
||||||
}
|
|
||||||
)
|
|
||||||
|
|
||||||
local diffgroup = vim.api.nvim_create_augroup("fugitiveSagaDiffConflict", { clear = true })
|
|
||||||
vim.api.nvim_create_autocmd(
|
|
||||||
'BufReadCmd',
|
|
||||||
{
|
|
||||||
group = diffgroup,
|
|
||||||
pattern = "fugitive://*",
|
|
||||||
callback = function()
|
|
||||||
vim.api.nvim_set_option_value('winbar', 'fugitive', { scope = 'local' })
|
|
||||||
end,
|
|
||||||
}
|
|
||||||
)
|
|
||||||
|
|
||||||
--[[
|
|
||||||
let g:nvlime_cl_impl = "ros"
|
|
||||||
function! NvlimeBuildServerCommandFor_ros(nvlime_loader, nvlime_eval)
|
|
||||||
return ["ros", "run",
|
|
||||||
\ "--load", a:nvlime_loader,
|
|
||||||
\ "--eval", a:nvlime_eval]
|
|
||||||
endfunction
|
|
||||||
--]]
|
|
||||||
-- Roswell
|
|
||||||
vim.g.nvlime_cl_impl = "ros"
|
|
||||||
vim.cmd([[
|
|
||||||
function! NvlimeBuildServerCommandFor_ros(nvlime_loader, nvlime_eval)
|
|
||||||
return ["ros", "run",
|
|
||||||
\ "--load", a:nvlime_loader,
|
|
||||||
\ "--eval", a:nvlime_eval]
|
|
||||||
endfunction
|
|
||||||
]])
|
|
||||||
|
|
||||||
-- Switch syntax highlighting on
|
|
||||||
vim.cmd("syntax enable")
|
|
||||||
|
|
8
nvim/lua/config/autocmds.lua
Normal file
8
nvim/lua/config/autocmds.lua
Normal file
|
@ -0,0 +1,8 @@
|
||||||
|
-- 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
|
||||||
|
-- with `vim.api.nvim_create_autocmd`
|
||||||
|
--
|
||||||
|
-- Or remove existing autocmds by their group name (which is prefixed with `lazyvim_` for the defaults)
|
||||||
|
-- e.g. vim.api.nvim_del_augroup_by_name("lazyvim_wrap_spell")
|
3
nvim/lua/config/keymaps.lua
Normal file
3
nvim/lua/config/keymaps.lua
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
-- 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
|
53
nvim/lua/config/lazy.lua
Normal file
53
nvim/lua/config/lazy.lua
Normal file
|
@ -0,0 +1,53 @@
|
||||||
|
local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim"
|
||||||
|
if not (vim.uv or vim.loop).fs_stat(lazypath) then
|
||||||
|
local lazyrepo = "https://github.com/folke/lazy.nvim.git"
|
||||||
|
local out = vim.fn.system({ "git", "clone", "--filter=blob:none", "--branch=stable", lazyrepo, lazypath })
|
||||||
|
if vim.v.shell_error ~= 0 then
|
||||||
|
vim.api.nvim_echo({
|
||||||
|
{ "Failed to clone lazy.nvim:\n", "ErrorMsg" },
|
||||||
|
{ out, "WarningMsg" },
|
||||||
|
{ "\nPress any key to exit..." },
|
||||||
|
}, true, {})
|
||||||
|
vim.fn.getchar()
|
||||||
|
os.exit(1)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
vim.opt.rtp:prepend(lazypath)
|
||||||
|
|
||||||
|
require("lazy").setup({
|
||||||
|
spec = {
|
||||||
|
-- add LazyVim and import its plugins
|
||||||
|
{ "LazyVim/LazyVim", import = "lazyvim.plugins" },
|
||||||
|
-- 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, -- check for plugin updates periodically
|
||||||
|
notify = false, -- notify on update
|
||||||
|
}, -- automatically check for plugin updates
|
||||||
|
performance = {
|
||||||
|
rtp = {
|
||||||
|
-- disable some rtp plugins
|
||||||
|
disabled_plugins = {
|
||||||
|
"gzip",
|
||||||
|
-- "matchit",
|
||||||
|
-- "matchparen",
|
||||||
|
-- "netrwPlugin",
|
||||||
|
"tarPlugin",
|
||||||
|
"tohtml",
|
||||||
|
"tutor",
|
||||||
|
"zipPlugin",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
})
|
3
nvim/lua/config/options.lua
Normal file
3
nvim/lua/config/options.lua
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
-- 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
|
197
nvim/lua/plugins/example.lua
Normal file
197
nvim/lua/plugins/example.lua
Normal file
|
@ -0,0 +1,197 @@
|
||||||
|
-- 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 },
|
||||||
|
|
||||||
|
-- override nvim-cmp and add cmp-emoji
|
||||||
|
{
|
||||||
|
"hrsh7th/nvim-cmp",
|
||||||
|
dependencies = { "hrsh7th/cmp-emoji" },
|
||||||
|
---@param opts cmp.ConfigSchema
|
||||||
|
opts = function(_, opts)
|
||||||
|
table.insert(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 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").lsp.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, {
|
||||||
|
function()
|
||||||
|
return "😄"
|
||||||
|
end,
|
||||||
|
})
|
||||||
|
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",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}
|
3
nvim/stylua.toml
Normal file
3
nvim/stylua.toml
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
indent_type = "Spaces"
|
||||||
|
indent_width = 2
|
||||||
|
column_width = 120
|
Loading…
Add table
Reference in a new issue