nvim: switch from packer to lazy

This commit is contained in:
Daniel Lundin 2022-12-27 18:36:38 +01:00
parent 7c2f6e3d4a
commit bab0d9cb20
32 changed files with 1021 additions and 1010 deletions

View file

@ -1,2 +1,2 @@
require("plugins")
require("settings")
require("config.lazy")

View file

@ -0,0 +1,14 @@
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",
"--single-branch",
"https://github.com/folke/lazy.nvim.git",
lazypath,
})
end
vim.opt.runtimepath:prepend(lazypath)
require("lazy").setup("config.plugins")

View file

@ -0,0 +1,110 @@
local M = {
"hrsh7th/nvim-cmp",
dependencies = {
"andersevenrud/cmp-tmux",
"hrsh7th/cmp-nvim-lsp",
"hrsh7th/cmp-buffer",
"hrsh7th/cmp-path",
"hrsh7th/cmp-cmdline",
"hrsh7th/cmp-nvim-lsp-signature-help",
"L3MON4D3/LuaSnip",
"onsails/lspkind-nvim",
"saadparwaiz1/cmp_luasnip",
},
event = "InsertEnter",
}
function M.config()
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({
formatting = {
format = require("lspkind").cmp_format({
with_text = true,
menu = {
buffer = "[Buffer]",
tmux = "[Tmux]",
luasnip = "[LuaSnip]",
nvim_lsp = "[LSP]",
nvim_lua = "[Lua]",
path = "[Path]",
},
}),
},
window = {
completion = cmp.config.window.bordered({
winhighlight = "Normal:PMenu,FloatBorder:PMenuBorder,CursorLine:PMenuSel,Search:None",
}),
documentation = cmp.config.window.bordered({
winhighlight = "Normal:PMenu,FloatBorder:PMenu,CursorLine:PMenuSel,Search:None",
}),
},
snippet = {
expand = function(args)
luasnip.lsp_expand(args.body)
end,
},
mapping = {
["<Up>"] = cmp.mapping(cmp.mapping.select_prev_item(), { "i", "c" }),
["<Down>"] = cmp.mapping(cmp.mapping.select_next_item(), { "i", "c" }),
["<C-p>"] = cmp.mapping(cmp.mapping.select_prev_item(), { "i", "c" }),
["<C-n>"] = cmp.mapping(cmp.mapping.select_next_item(), { "i", "c" }),
["<C-d>"] = cmp.mapping.scroll_docs(-4),
["<C-u>"] = cmp.mapping.scroll_docs(4),
["<C-e>"] = cmp.mapping({
i = cmp.mapping.abort(),
c = cmp.mapping.close(),
}),
["<CR>"] = cmp.mapping(cmp.mapping.confirm({ select = false }), { "i", "c" }),
["<C-y>"] = cmp.mapping(cmp.mapping.confirm({ select = false }), { "i", "c" }),
["<C-Space>"] = cmp.mapping(cmp.mapping.complete(), { "i", "c" }),
["<Tab>"] = cmp.mapping(function(fallback)
if cmp.visible() then
cmp.select_next_item()
elseif luasnip.expand_or_locally_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 = "buffer", priority = 1 },
{ name = "luasnip", priority = 4 },
{ name = "copilot", group_index = 5 },
{
name = "tmux",
priority = 2,
option = {
all_panes = true,
trigger_characters = {},
},
},
{ name = "nvim_lsp", priority = 3 },
{ name = "nvim_lsp_signature_help", priority = 4 },
}),
})
end
return M

View file

@ -0,0 +1,54 @@
local M = {
"zbirenbaum/copilot.lua",
event = { "VeryLazy" },
dependencies = {
{
"zbirenbaum/copilot-cmp",
config = function()
require("copilot_cmp").setup()
end,
},
},
}
function M.config()
require("copilot").setup({
panel = {
enabled = true,
auto_refresh = false,
keymap = {
jump_prev = "[[",
jump_next = "]]",
accept = "<CR>",
refresh = "gr",
open = "<M-CR>",
},
},
suggestion = {
enabled = true,
auto_trigger = true,
debounce = 75,
keymap = {
accept = "<C-j>",
next = "<M-]>",
prev = "<M-[>",
dismiss = "<C-]>",
},
},
filetypes = {
yaml = false,
markdown = false,
help = false,
gitcommit = false,
gitrebase = false,
hgcommit = false,
svn = false,
cvs = false,
["."] = false,
},
copilot_node_command = "node", -- Node version must be < 18
server_opts_overrides = {},
})
end
return M

View file

@ -0,0 +1,39 @@
local M = {
"mfussenegger/nvim-dap",
dependencies = {
{ "rcarriga/nvim-dap-ui" },
{
"theHamsta/nvim-dap-virtual-text",
config = function()
require("nvim-dap-virtual-text").setup({
commented = true,
})
end,
},
{
"leoluz/nvim-dap-go",
config = function()
require("dap-go").setup()
end,
keys = {
{ "<leader>y", ":lua require('dap-go').debug_test()<CR>" },
},
},
},
}
function M.init()
local silent = { silent = true }
vim.fn.sign_define("DapStopped", { text = "", texthl = "", linehl = "debugPC", numhl = "" })
vim.fn.sign_define("DapBreakpoint", { text = "🧘", texthl = "", linehl = "debugPC", numhl = "" })
vim.keymap.set("n", "DD", ":lua require 'dap'.toggle_breakpoint()<CR>", silent)
vim.keymap.set("n", "Dc", ":lua require 'dap'.continue()<CR>", silent)
vim.keymap.set("n", "Di", ":lua require 'dap'.step_into()<CR>", silent)
vim.keymap.set("n", "Do", ":lua require 'dap'.step_over()<CR>", silent)
vim.keymap.set("n", "DO", ":lua require 'dap'.step_out()<CR>", silent)
vim.keymap.set("n", "Dr", ":lua require 'dap'.repl.toggle({height = 5})<CR>", silent)
vim.keymap.set("n", "Dh", ":lua require 'dap.ui.widgets'.hover()<CR>", silent)
end
return M

View file

@ -0,0 +1,122 @@
return {
"hashivim/vim-terraform",
"pierreglaser/folding-nvim",
"tjdevries/colorbuddy.vim",
"wbthomason/packer.nvim",
"jose-elias-alvarez/nvim-lsp-ts-utils",
"jjo/vim-cue",
"ckipp01/stylua-nvim",
{
"numToStr/Comment.nvim",
keys = {
{ "<C-_>", "<Plug>(comment_toggle_linewise_current)" },
{ "<C-_>", "<Plug>(comment_toggle_linewise_visual)", mode = "v" },
},
dependencies = {
"JoosepAlviste/nvim-ts-context-commentstring",
},
config = function()
require("Comment").setup({
pre_hook = require("ts_context_commentstring.integrations.comment_nvim").create_pre_hook(),
})
end,
},
{
"L3MON4D3/LuaSnip",
config = function()
require("luasnip/loaders/from_vscode").lazy_load()
end,
},
{
"lewis6991/gitsigns.nvim",
dependencies = {
"nvim-lua/plenary.nvim",
},
config = function()
require("gitsigns").setup({
numhl = true,
signs = {
add = { hl = "GitSignsAdd", text = "", numhl = "GitSignsAddNr", linehl = "GitSignsAddLn" },
change = {
hl = "GitSignsChange",
text = "",
numhl = "GitSignsChangeNr",
linehl = "GitSignsChangeLn",
},
delete = {
hl = "GitSignsDelete",
text = "",
numhl = "GitSignsDeleteNr",
linehl = "GitSignsDeleteLn",
},
topdelete = {
hl = "GitSignsDelete",
text = "",
numhl = "GitSignsDeleteNr",
linehl = "GitSignsDeleteLn",
},
changedelete = {
hl = "GitSignsChange",
text = "~",
numhl = "GitSignsChangeNr",
linehl = "GitSignsChangeLn",
},
},
})
end,
},
{
"lukas-reineke/indent-blankline.nvim",
branch = "master",
event = "VeryLazy",
init = function()
vim.g.indent_blankline_char = ""
vim.g.indent_blankline_space_char = ""
vim.g.indent_blankline_space_char_highlight_list = { "IndentSpace" }
-- vim.g.indent_blankline_char_list = {'|', '¦', '┆', '┊'}
vim.g.indent_blankline_buftype_exclude = { "help", "terminal" }
vim.g.indent_blankline_filetype_exclude = { "text", "markdown" }
-- vim.g.indent_blankline_show_end_of_line = true
vim.g.indent_blankline_show_first_indent_level = true
vim.g.indent_blankline_show_trailing_blankline_indent = true
vim.g.indent_blankline_char_highlight_list =
{ "Indent1", "Indent2", "Indent3", "Indent4", "Indent5", "Indent6" }
require("indent_blankline").setup({})
end,
},
{
"ray-x/go.nvim",
config = function()
require("go").setup({
comment_placeholder = "",
icons = { breakpoint = "🧘", currentpos = "🏃" },
dap_debug_gui = false,
})
vim.cmd("autocmd FileType go nmap <Leader>c :lua require('go.comment').gen()<cr>")
vim.cmd("autocmd BufWritePre *.go :silent! lua require('go.format').gofmt()")
vim.cmd("autocmd BufWritePre (InsertLeave?) <buffer> lua vim.lsp.buf.formatting_sync(nil,500)")
end,
},
{
"onsails/lspkind-nvim",
config = function()
require("lspkind").init({})
end,
},
{
url = "https://git.sr.ht/~whynothugo/lsp_lines.nvim",
config = function()
require("lsp_lines").setup()
vim.diagnostic.config({
virtual_text = false,
})
end,
},
}

View file

@ -0,0 +1,239 @@
local M = {
"neovim/nvim-lspconfig",
event = "VeryLazy",
}
function M.config()
local lspconfig = require("lspconfig")
local capabilities = require("cmp_nvim_lsp").default_capabilities()
vim.keymap.set("n", "K", "<Cmd>lua vim.lsp.buf.hover()<CR>")
vim.keymap.set("i", "<C-k>", "<Cmd>lua vim.lsp.buf.signature_help()<CR>")
vim.keymap.set("n", "1gd", "<Cmd>lua vim.lsp.buf.type_definition()<CR>")
vim.keymap.set("n", "gf", "<Cmd>lua vim.lsp.buf.format()<CR>")
vim.keymap.set("n", "rn", "<Cmd>lua vim.lsp.buf.rename()<CR>")
vim.keymap.set("n", "[d", "<Cmd>lua vim.lsp.diagnostic.goto_prev()<CR>")
vim.keymap.set("n", "]d", "<Cmd>lua vim.lsp.diagnostic.goto_next()<CR>")
vim.keymap.set("n", "gwa", "<Cmd>lua vim.lsp.buf.add_workspace_folder()<CR>")
vim.keymap.set("n", "gwr", "<Cmd>lua vim.lsp.buf.add_workspace_folder()<CR>")
vim.keymap.set("n", "gwl", "<Cmd>lua vim.lsp.buf.add_workspace_folder()<CR>")
vim.cmd([[autocmd BufWritePre * lua vim.lsp.buf.format({sync = true})]])
local border = {
{ "🭽", "FloatBorder" },
{ "", "FloatBorder" },
{ "🭾", "FloatBorder" },
{ "", "FloatBorder" },
{ "🭿", "FloatBorder" },
{ "", "FloatBorder" },
{ "🭼", "FloatBorder" },
{ "", "FloatBorder" },
}
vim.lsp.handlers["textDocument/hover"] = vim.lsp.with(vim.lsp.handlers.hover, { border = border })
vim.lsp.handlers["textDocument/signatureHelp"] = vim.lsp.with(vim.lsp.handlers.signature_help, { border = border })
vim.lsp.handlers["textDocument/publishDiagnostics"] = vim.lsp.with(vim.lsp.diagnostic.on_publish_diagnostics, {
update_in_insert = false,
virtual_text = false,
})
local signs = { Error = "🔥", Warn = "⚠️ ", Hint = "💡", Info = "💡" }
for type, icon in pairs(signs) do
local hl = "DiagnosticSign" .. type
vim.fn.sign_define(hl, { text = icon, texthl = hl, numhl = hl })
end
local on_attach = function()
-- require("folding").on_attach()
end
-- simple setups --
local servers = {
"bashls",
"dockerls",
"gopls",
"jsonls",
-- "sql",
"pyright",
"sumneko_lua",
"terraformls",
"yamlls",
}
for _, lsp in ipairs(servers) do
lspconfig[lsp].setup({ on_attach = on_attach })
end
local efm_prettier = {
formatCommand = "prettier --stdin-filepath ${INPUT}",
formatStdin = true,
}
lspconfig.gopls.setup({
on_attach = on_attach,
settings = {
gopls = {
directoryFilters = {
"-bazel-bin",
"-bazel-out",
"-bazel-testlogs",
"-proto",
},
},
},
})
lspconfig.sumneko_lua.setup({
on_attach = function()
on_attach()
vim.cmd([[autocmd BufWritePre <buffer> lua require'stylua-nvim'.format_file()]])
end,
settings = {
Lua = {
completion = { kewordSnippet = "Disable" },
diagnostics = {
enable = true,
globals = { "renoise", "use", "vim" },
},
runtime = {
version = "LuaJIT",
path = { "?.lua", "?/init.lua", "?/?.lua" },
},
workspace = {
library = vim.api.nvim_get_runtime_file("", true),
maxPreload = 2000,
preloadFileSize = 1000,
checkThirdParty = false,
},
},
},
})
lspconfig.terraformls.setup({})
local yaml_is_k8s = function(bufnr)
local lines = vim.api.nvim_buf_get_lines(bufnr, 0, 50, false) -- Stop after the first 50 lines
for _, l in pairs(lines) do
if string.find(l, "apiVersion") ~= nil then
return true
end
end
return false
end
lspconfig.cssls.setup({
cmd = { "vscode-css-languageserver", "--stdio" },
capabilities = capabilities,
})
lspconfig.cssmodules_ls.setup({})
lspconfig.html.setup({
cmd = { "vscode-html-languageserver", "--stdio" },
filetypes = { "html" },
init_options = {
configurationSection = { "html", "css", "javascript" },
embeddedLanguages = {
css = true,
javascript = true,
},
},
settings = {},
})
lspconfig.yamlls.setup({
settings = {
yaml = {
format = { enable = true, singleQuote = true },
schemaStore = { enable = true, url = "https://json.schemastore.org" },
schemas = {
-- ["https://json.schemastore.org/github-workflow"] = "*.github/workflows/*",
["https://json.schemastore.org/kustomization.json"] = "kustomization.yaml",
-- ["https://json.schemastore.org/ansible-role-2.9.json"] = "*/tasks/*.y*ml",
kubernetes = {
"clusterrolebinding.yaml",
"clusterrole-contour.yaml",
"clusterrole.yaml",
"configmap.yaml",
"cronjob.yaml",
"daemonset.yaml",
"deployment-*.yaml",
"deployment.yaml",
"*-deployment.yaml",
"hpa.yaml",
"ingress.yaml",
"job.yaml",
"namespace.yaml",
"pvc.yaml",
"rbac.yaml",
"rolebinding.yaml",
"role.yaml",
"sa.yaml",
"secret.yaml",
"serviceaccounts.yaml",
"service-account.yaml",
"serviceaccount.yaml",
"service-*.yaml",
"service.yaml",
"*-service.yaml",
"statefulset.yaml",
},
},
validate = true,
},
},
})
require("lspconfig").tsserver.setup({})
-- npm install -g typescript typescript-language-server
-- require("lspconfig").tsserver.setup({
-- on_attach = function(client, bufnr)
-- client.resolved_capabilities.document_formatting = false
-- on_attach(client)
-- local ts_utils = require("nvim-lsp-ts-utils")
-- ts_utils.setup({
-- debug = false,
-- disable_commands = false,
-- enable_import_on_completion = false,
-- import_all_timeout = 5000, -- ms
-- -- eslint
-- eslint_enable_code_actions = true,
-- eslint_enable_disable_comments = true,
-- eslint_bin = "eslint_d",
-- eslint_config_fallback = nil,
-- eslint_enable_diagnostics = true,
-- -- formatting
-- enable_formatting = true,
-- formatter = "prettier",
-- formatter_config_fallback = nil,
-- -- parentheses completion
-- complete_parens = false,
-- signature_help_in_parens = false,
-- -- update imports on file move
-- update_imports_on_move = true,
-- require_confirmation_on_move = true,
-- watch_dir = nil,
-- })
-- ts_utils.setup_client(client)
-- vim.api.nvim_buf_set_keymap(bufnr, "n", "<Leader>co", ":TSLspOrganize<CR>", { silent = true })
-- vim.api.nvim_buf_set_keymap(bufnr, "n", "qq", ":TSLspFixCurrent<CR>", { silent = true })
-- vim.api.nvim_buf_set_keymap(bufnr, "n", "<Leader>cR", ":TSLspRenameFile<CR>", { silent = true })
-- vim.api.nvim_buf_set_keymap(bufnr, "n", "<Leader>ci", ":TSLspImportAll<CR>", { silent = true })
-- end,
-- })
--
end
return M

View file

@ -0,0 +1,36 @@
local M = {
"nvim-lualine/lualine.nvim",
dependencies = { "kyazdani42/nvim-web-devicons" },
event = "VeryLazy",
}
local function clock()
return os.date("%H:%M")
end
function M.config()
local lualine = require("lualine")
lualine.setup({
options = {
globalstatus = true,
theme = "onelight",
component_separators = { left = "", right = "" },
section_separators = { left = "", right = "" },
},
sections = {
lualine_c = {
{
"filename",
path = 1,
file_status = true,
},
},
lualine_x = { "filetype" },
lualine_y = { "location", "progress" },
lualine_z = { clock },
},
})
end
return M

View file

@ -0,0 +1,37 @@
local M = {
"chentoast/marks.nvim",
event = "VeryLazy",
}
function M.config()
local marks = require("marks")
marks.setup({
default_mappings = true,
-- which builtin marks to show. default {}
-- builtin_marks = { ".", "<", ">", "^" },
cyclic = true,
force_write_shada = false,
-- marks, and bookmarks.
-- can be either a table with all/none of the keys, or a single number, in which case
-- the priority applies to all marks.
-- default 10.
-- sign_priority = { lower=10, upper=15, builtin=8, bookmark=20 },
--
-- disables mark tracking for specific filetypes. default {}
excluded_filetypes = {},
-- marks.nvim allows you to configure up to 10 bookmark groups, each with its own
-- sign/virttext. Bookmarks can be used to group together positions and quickly move
-- across multiple buffers. default sign is '!@#$%^&*()' (from 0 to 9), and
-- default virt_text is "".
bookmark_1 = {
sign = "",
virt_text = "",
},
})
end
return M

View file

@ -0,0 +1,35 @@
local M = {
"jose-elias-alvarez/null-ls.nvim",
dependencies = { "nvim-lua/plenary.nvim" },
}
function M.config()
local null_ls = require("null-ls")
local builtins = require("null-ls.builtins")
null_ls.setup({
sources = {
builtins.formatting.black,
builtins.formatting.buf,
builtins.formatting.cue_fmt,
builtins.formatting.shfmt,
builtins.formatting.buildifier,
builtins.completion.spell,
builtins.diagnostics.buf.with({
args = { "lint", "--disable-symlinks", "--path", "$FILENAME" },
cwd = function()
local file_dir = vim.fn.expand("%:p:h") .. ";"
local buf_yaml = vim.fn.findfile("buf.yaml", file_dir)
if buf_yaml then
return vim.fn.fnamemodify(buf_yaml, ":h")
end
end,
}),
builtins.diagnostics.buildifier,
builtins.diagnostics.cue_fmt,
},
debug = true,
})
end
return M

View file

@ -0,0 +1,18 @@
local M = {
"ojroques/nvim-osc52",
}
function M.config()
local osc52 = require("osc52")
osc52.setup({
max_length = 0, -- Maximum length of selection (0 for no limit)
silent = false, -- Disable message on successful copy
trim = false, -- Trim text before copy
})
vim.keymap.set("n", "<leader>c", require("osc52").copy_operator, { expr = true })
vim.keymap.set("n", "<leader>cc", "<leader>c_", { remap = true })
vim.keymap.set("x", "<leader>c", require("osc52").copy_visual)
end
return M

View file

@ -0,0 +1,94 @@
local function project_files()
require("telescope.builtin").find_files({
cwd = require("lspconfig.util").root_pattern(".git")(vim.fn.expand("%:p")),
})
end
local M = {
"nvim-telescope/telescope.nvim",
dependencies = {
"nvim-lua/popup.nvim",
"nvim-lua/plenary.nvim",
"nvim-telescope/telescope-fzy-native.nvim",
"nvim-telescope/telescope-github.nvim",
"nvim-telescope/telescope-dap.nvim",
},
}
function M.config()
local telescope = require("telescope")
local actions = require("telescope.actions")
local previewers = require("telescope.previewers")
vim.keymap.set("n", "<leader>b", '<cmd>lua require("telescope.builtin").buffers()<CR>')
vim.keymap.set("n", "<leader>f", '<cmd>lua require("telescope.builtin").oldfiles()<CR>')
vim.keymap.set("n", "<space>", '<cmd>lua require("telescope.builtin").oldfiles()<CR>')
vim.keymap.set("n", "<leader>d", '<cmd>lua require("telescope.builtin").diagnostics()<CR>')
vim.keymap.set("n", "<leader>e", '<cmd>lua require("telescope.builtin").git_files()<CR>')
vim.keymap.set("n", "<leader>g", '<cmd>lua require("telescope.builtin").git_status()<CR>')
vim.keymap.set("n", "<leader>a", '<cmd>lua require("telescope.builtin").lsp_code_actions()<CR>')
vim.keymap.set("n", "<leader>m", '<cmd>lua require("telescope.builtin").marks()<CR>')
vim.keymap.set("n", "<leader>s", '<cmd>lua require("telescope.builtin").lsp_document_symbols()<CR>')
vim.keymap.set("n", "<leader>t", '<cmd>lua require("telescope.builtin").treesitter()<CR>')
vim.keymap.set("n", "<leader>/", '<cmd>lua require("telescope.builtin").live_grep()<CR>')
vim.keymap.set("n", "<leader>.", '<cmd>lua require("telescope.builtin").file_browser()<CR>')
vim.keymap.set("n", "<leader>p", '<cmd>lua require("telescope.builtin").registers()<CR>')
vim.keymap.set("n", "gr", '<cmd>lua require("telescope.builtin").lsp_references()<CR>')
vim.keymap.set("n", "gd", '<cmd>lua require("telescope.builtin").lsp_definitions()<CR>')
vim.keymap.set("n", "g/", '<cmd>lua require("telescope.builtin").lsp_document_symbols()<CR>')
vim.keymap.set("n", "g?", '<cmd>lua require("telescope.builtin").lsp_workspace_symbols()<CR>')
vim.keymap.set("n", "ge", '<cmd>lua require("telescope.builtin").lsp_document_diagnostics()<CR>')
vim.keymap.set("n", "Db", '<cmd>lua require("telescope").extensions.dap.list_breakpoints()<CR>')
vim.keymap.set("n", "Dcc", '<cmd>lua require("telescope").extensions.dap.commands()<CR>')
vim.keymap.set("n", "Df", '<cmd>lua require("telescope").extensions.dap.frames()<CR>')
vim.keymap.set("n", "Dv", '<cmd>lua require("telescope").extensions.dap.variables()<CR>')
-- Setup
telescope.setup({
defaults = {
layout_strategy = "flex",
-- layout_defaults = {flip_columns = 160},
layout_config = {
preview_cutoff = 10,
},
mappings = {
i = {
["<CR>"] = actions.select_default + actions.center,
["<esc>"] = actions.close,
["<tab>"] = actions.add_selection,
},
},
color_devicons = true,
file_previewer = previewers.vim_buffer_cat.new,
grep_previewer = previewers.vim_buffer_vimgrep.new,
qflist_previewer = previewers.vim_buffer_qflist.new,
},
})
local layout_strategies = require("telescope.pickers.layout_strategies")
local config = require("telescope.config")
layout_strategies.flex = function(self, max_columns, max_lines)
local layout_config = self.layout_config or {}
local flip_columns = layout_config.flip_columns or 160 -- Here's why.
local flip_lines = layout_config.flip_lines or 20
if max_columns < flip_columns and max_lines > flip_lines then
self.layout_config = (config.values.layout_defaults or {})["vertical"]
return layout_strategies.vertical(self, max_columns, max_lines)
else
self.layout_config = (config.values.layout_defaults or {})["horizontal"]
return layout_strategies.horizontal(self, max_columns, max_lines)
end
end
-- Extensions
telescope.load_extension("dap")
telescope.load_extension("fzy_native")
telescope.load_extension("gh")
-- telescope.load_extension("packer") -- currently breaking packer
--
end
return M

View file

@ -0,0 +1,48 @@
local M = {
"nvim-treesitter/nvim-treesitter-context",
dependencies = {
"nvim-treesitter/nvim-treesitter",
},
}
function M.config()
local config = require("treesitter-context")
config.setup({
enable = true, -- Enable this plugin (Can be enabled/disabled later via commands)
max_lines = 0, -- How many lines the window should span. Values <= 0 mean no limit.
patterns = { -- Match patterns for TS nodes. These get wrapped to match at word boundaries.
-- For all filetypes
-- Note that setting an entry here replaces all other patterns for this entry.
-- By setting the 'default' entry below, you can control which nodes you want to
-- appear in the context window.
default = {
"class",
"function",
"method",
-- 'for', -- These won't appear in the context
-- 'while',
-- 'if',
-- 'switch',
-- 'case',
},
-- Example for a specific filetype.
-- If a pattern is missing, *open a PR* so everyone can benefit.
-- rust = {
-- 'impl_item',
-- },
},
exact_patterns = {
-- Example for a specific filetype with Lua patterns
-- Treat patterns.rust as a Lua pattern (i.e "^impl_item$" will
-- exactly match "impl_item" only)
-- rust = true,
},
-- [!] The options below are exposed but shouldn't require your attention,
-- you can safely ignore them.
zindex = 20, -- The Z-index of the context window
})
end
return M

View file

@ -0,0 +1,70 @@
return {
{ "nvim-treesitter/playground", cmd = "TSPlaygroundToggle" },
{
"nvim-treesitter/nvim-treesitter",
build = ":TSUpdate",
event = "BufReadPost",
dependencies = {
"nvim-treesitter/nvim-treesitter-textobjects",
"windwp/nvim-ts-autotag",
},
config = function()
require("nvim-treesitter.configs").setup({
ensure_installed = "all",
highlight = {
enable = true,
use_languagetree = true,
},
indent = {
enable = false,
},
playground = {
enable = true,
disable = {},
updatetime = 25,
persist_queries = false,
},
incremental_selection = {
enable = true,
keymaps = {
init_selection = "ss",
node_incremental = "sq",
scope_incremental = "sd",
node_decremental = "sa",
},
},
textobjects = {
move = {
enable = true,
goto_next_start = {
["]]"] = "@function.outer",
["]m"] = "@class.outer",
},
goto_next_end = {
["]["] = "@function.outer",
["]M"] = "@class.outer",
},
goto_previous_start = {
["[["] = "@function.outer",
["[m"] = "@class.outer",
},
goto_previous_end = {
["[]"] = "@function.outer",
["[M"] = "@class.outer",
},
},
},
--- nvim-ts-autotag ---
autotag = {
enable = true,
filetypes = { "html", "javascriptreact", "xml" },
},
})
end,
},
}

View file

@ -0,0 +1,24 @@
local M = {
"folke/yanky.nvim",
}
function M.config()
require("yanky").setup({
ring = {
history_length = 100,
storage = "memory",
sync_with_numbered_registers = false,
cancel_event = "update",
},
})
vim.keymap.set({ "n", "x" }, "p", "<Plug>(YankyPutAfter)")
vim.keymap.set({ "n", "x" }, "P", "<Plug>(YankyPutBefore)")
vim.keymap.set({ "n", "x" }, "gp", "<Plug>(YankyGPutAfter)")
vim.keymap.set({ "n", "x" }, "gP", "<Plug>(YankyGPutBefore)")
vim.keymap.set("n", "<c-p>", "<Plug>(YankyCycleForward)")
vim.keymap.set("n", "<c-n>", "<Plug>(YankyCycleBackward)")
end
return M

View file

@ -0,0 +1,78 @@
local M = {
"mcchrish/zenbones.nvim",
event = "VeryLazy",
dependencies = {
"rktjmp/lush.nvim",
},
}
function M.config()
vim.g.zenbones = {
style = "light",
lightness = "bright",
colorize_diagnostic_underline_text = true,
transparent_background = true,
}
local lush = require("lush")
local base = require("zenbones")
-- Create some specs
---@diagnostic disable = undefined-global
local specs = lush.parse(function()
return {
CursorLine({ bg = "#f5f5f0" }),
Error({ fg = "#d9534f" }),
CursorLineNr({ fg = "#BCAAA4", bg = "#f5f5f0" }),
MsgArea({ fg = "#A1887F", bg = "#f1f1f1" }),
String({ fg = "#2E7D32", gui = "italic" }),
Comment({ fg = "#114499", gui = "bold,italic" }),
CopilotSuggestion({ fg = "#0066cc", gui = "bold,italic" }),
LineNr({ fg = "#9FA8AC", gui = "bold,italic" }),
LineNrAbove({ fg = "#9F080C", gui = "bold,italic" }),
Indent1({ fg = "#DFDF9A", gui = "italic" }),
Indent2({ fg = "#BAE1FF", gui = "italic" }),
Indent3({ fg = "#BAFFC9", gui = "italic" }),
Indent4({ fg = "#FFB3BA", gui = "italic" }),
Indent5({ fg = "#FFDFBA", gui = "italic" }),
Indent6({ fg = "#F3E5F5", gui = "italic" }),
NormalFloat({ bg = "#FFF9C4" }),
FloatBorder({ fg = "#FFB74D", bg = "#FFF9C4" }),
TelescopeNormal({ bg = "#EFEBE9" }),
TelescopeBorder({ fg = "#A1887F", bg = "#EFEBE9" }),
TelescopeSelection({ fg = "#FFFFFF", bg = "#1976D2" }),
DiagnosticSignError({ fg = "#ff2200", bg = "#fff5ff", gui = "bold" }),
DiagnosticVirtualTextInfo({ fg = "#0033bb", bg = "#f7fcff", gui = "bold,italic" }),
DiagnosticVirtualTextWarn({ fg = "#bb2200", bg = "#fff9f3", gui = "bold,italic" }),
DiagnosticVirtualTextError({ fg = "#ff2200", bg = "#fff5f3", gui = "italic" }),
DiagnosticUnderlineError({ fg = "#ff0000", gui = "undercurl" }),
DiagnosticUnderlineWarn({ fg = "#ff7700", gui = "undercurl" }),
DiagnosticUnderlineInfo({ fg = "#3366cc", gui = "undercurl" }),
MarkSignHL({ fg = "#009688", bg = "#E0F7FA" }),
MarkSignNumHL({ fg = "#B2DFDB", bg = "#E0F7FA" }),
GitSignsAdd({ fg = "#81C784" }),
GitSignsAddNr({ fg = "#C8E6C9" }),
GitSignsDelete({ fg = "#E53935" }),
GitSignsDeleteNr({ fg = "#FFCDD2" }),
GitSignsChange({ fg = "#FFA726" }),
GitSignsChangeNr({ fg = "#FFE0B2" }),
PMenu({ bg = "#F7F5F0" }),
PMenuBorder({ bg = "#F7F5F0", fg = "#886622" }),
PMenuSel({ fg = "#FFFFFF", bg = "#1976D2" }),
PMenuSbar({ bg = "#90CAF9" }),
PMenuThumb({ bg = "#64B5F6" }),
StatusLine({ base = base.VertSplit, fg = "#BCAAA4" }),
StatusLineNC({ base = base.VertSplit, fg = "#BCAAA4" }),
TreesitterContext({ bg = "#f0f0f0", fg = "#BCAAA4", gui = "bold,italic" }),
TreesitterContextLineNumber({ bg = "#f0f0f0", fg = "#979770", gui = "bold,italic" }),
}
end)
-- Apply specs using lush tool-chain
vim.cmd("colorscheme zenbones")
lush.apply(lush.compile(specs))
end
return M

View file

@ -1,279 +0,0 @@
return require("packer").startup(function()
use("hashivim/vim-terraform")
use("pierreglaser/folding-nvim")
use("tjdevries/colorbuddy.vim")
use("wbthomason/packer.nvim")
use("jose-elias-alvarez/nvim-lsp-ts-utils")
use("rafamadriz/friendly-snippets")
use({ "rcarriga/nvim-dap-ui", requires = { "mfussenegger/nvim-dap" } })
use({ "ray-x/guihua.lua", run = "cd lua/fzy && make" })
use("jjo/vim-cue")
use("ckipp01/stylua-nvim")
use({
"theHamsta/nvim-dap-virtual-text",
config = function()
require("nvim-dap-virtual-text").setup({
commented = true,
})
end,
})
use({
"jose-elias-alvarez/null-ls.nvim",
requires = { "nvim-lua/plenary.nvim" },
config = function()
require("plugins/null-ls")
end,
})
use({
"folke/yanky.nvim",
config = function()
require("plugins/yanky")
end,
})
use({
"b3nj5m1n/kommentary",
config = function()
require("kommentary.config").use_extended_mappings()
vim.api.nvim_set_keymap("n", "", "<Plug>kommentary_line_default", {}) -- C-/
vim.api.nvim_set_keymap("v", "", "<Plug>kommentary_visual_default", {}) -- C-/
require("kommentary.config").configure_language("default", {
prefer_single_line_comments = true,
})
end,
})
use({
"L3MON4D3/LuaSnip",
config = function()
require("luasnip/loaders/from_vscode").lazy_load()
end,
})
-- cmp
use({
"hrsh7th/nvim-cmp",
requires = {
"andersevenrud/cmp-tmux",
"hrsh7th/cmp-nvim-lsp",
"hrsh7th/cmp-buffer",
"hrsh7th/cmp-path",
"hrsh7th/cmp-cmdline",
"hrsh7th/cmp-nvim-lsp-signature-help",
"L3MON4D3/LuaSnip",
"saadparwaiz1/cmp_luasnip",
},
config = function()
require("plugins/nvim-cmp")
end,
})
use({
"lewis6991/gitsigns.nvim",
requires = {
"nvim-lua/plenary.nvim",
},
config = function()
require("gitsigns").setup({
numhl = true,
signs = {
add = { hl = "GitSignsAdd", text = "", numhl = "GitSignsAddNr", linehl = "GitSignsAddLn" },
change = {
hl = "GitSignsChange",
text = "",
numhl = "GitSignsChangeNr",
linehl = "GitSignsChangeLn",
},
delete = {
hl = "GitSignsDelete",
text = "",
numhl = "GitSignsDeleteNr",
linehl = "GitSignsDeleteLn",
},
topdelete = {
hl = "GitSignsDelete",
text = "",
numhl = "GitSignsDeleteNr",
linehl = "GitSignsDeleteLn",
},
changedelete = {
hl = "GitSignsChange",
text = "~",
numhl = "GitSignsChangeNr",
linehl = "GitSignsChangeLn",
},
},
})
end,
})
use({
"lukas-reineke/indent-blankline.nvim",
branch = "master",
config = function()
-- vim.wo.colorcolumn = "100"
vim.g.indent_blankline_char = ""
vim.g.indent_blankline_space_char = ""
vim.g.indent_blankline_space_char_highlight_list = { "IndentSpace" }
-- vim.g.indent_blankline_char_list = {'|', '¦', '┆', '┊'}
vim.g.indent_blankline_buftype_exclude = { "help", "terminal" }
vim.g.indent_blankline_filetype_exclude = { "text", "markdown" }
-- vim.g.indent_blankline_show_end_of_line = true
vim.g.indent_blankline_show_first_indent_level = true
vim.g.indent_blankline_show_trailing_blankline_indent = true
vim.g.indent_blankline_char_highlight_list =
{ "Indent1", "Indent2", "Indent3", "Indent4", "Indent5", "Indent6" }
end,
})
use({
"neovim/nvim-lspconfig",
config = function()
require("plugins/lsp-config")
end,
})
use({
"nvim-telescope/telescope.nvim",
requires = {
"nvim-lua/popup.nvim",
"nvim-lua/plenary.nvim",
"nvim-telescope/telescope-fzy-native.nvim",
"nvim-telescope/telescope-github.nvim",
"nvim-telescope/telescope-dap.nvim",
},
config = function()
require("plugins/telescope")
end,
})
-- treesitter
use({
"nvim-treesitter/nvim-treesitter",
requires = {
"nvim-treesitter/playground",
"nvim-treesitter/nvim-treesitter-textobjects",
"windwp/nvim-ts-autotag",
},
run = ":TSUpdate",
config = function()
require("plugins/treesitter")
end,
})
use({
"ray-x/go.nvim",
config = function()
require("go").setup({
comment_placeholder = "",
icons = { breakpoint = "🧘", currentpos = "🏃" },
dap_debug_gui = false,
})
vim.cmd("autocmd FileType go nmap <Leader>c :lua require('go.comment').gen()<cr>")
vim.cmd("autocmd BufWritePre *.go :silent! lua require('go.format').gofmt()")
vim.cmd("autocmd BufWritePre (InsertLeave?) <buffer> lua vim.lsp.buf.formatting_sync(nil,500)")
end,
})
use({
"nvim-treesitter/nvim-treesitter-context",
requires = {
"nvim-treesitter/nvim-treesitter",
},
config = function()
require("plugins/treesitter-context")
end,
})
use({
"onsails/lspkind-nvim",
config = function()
require("lspkind").init({})
end,
})
use({
"ojroques/nvim-osc52",
config = function()
require("plugins/osc52")
end,
})
-- marks
use({
"chentoast/marks.nvim",
config = function()
require("plugins/marks")
end,
})
-- dap
use({
"mfussenegger/nvim-dap",
config = function()
require("plugins/dap")
end,
})
-- go
use({
"leoluz/nvim-dap-go",
config = function()
require("plugins/nvim-dap-go")
end,
})
-- lualine
use({
"nvim-lualine/lualine.nvim",
requires = { "kyazdani42/nvim-web-devicons", opt = true },
config = function()
require("plugins/lualine")
end,
})
-- lsp_lines
use({
"https://git.sr.ht/~whynothugo/lsp_lines.nvim",
config = function()
require("lsp_lines").setup()
vim.diagnostic.config({
virtual_text = false,
})
end,
})
-- zenbones
use({
"mcchrish/zenbones.nvim",
requires = {
"rktjmp/lush.nvim",
},
config = function()
require("plugins/zenbones")
end,
})
-- copilot
use({
"zbirenbaum/copilot.lua",
event = "VimEnter",
config = function()
vim.defer_fn(function()
require("plugins/copilot")
end, 100)
end,
})
use({
"zbirenbaum/copilot-cmp",
after = { "copilot.lua" },
config = function()
require("copilot_cmp").setup()
end,
})
end)

View file

@ -1,39 +0,0 @@
local copilot = require("copilot")
copilot.setup({
panel = {
enabled = true,
auto_refresh = false,
keymap = {
jump_prev = "[[",
jump_next = "]]",
accept = "<CR>",
refresh = "gr",
open = "<M-CR>",
},
},
suggestion = {
enabled = true,
auto_trigger = true,
debounce = 75,
keymap = {
accept = "<C-j>",
next = "<M-]>",
prev = "<M-[>",
dismiss = "<C-]>",
},
},
filetypes = {
yaml = false,
markdown = false,
help = false,
gitcommit = false,
gitrebase = false,
hgcommit = false,
svn = false,
cvs = false,
["."] = false,
},
copilot_node_command = "node", -- Node version must be < 18
server_opts_overrides = {},
})

View file

@ -1,13 +0,0 @@
require("dap")
local silent = { silent = true }
vim.fn.sign_define("DapStopped", { text = "", texthl = "", linehl = "debugPC", numhl = "" })
vim.fn.sign_define("DapBreakpoint", { text = "🧘", texthl = "", linehl = "debugPC", numhl = "" })
vim.keymap.set("n", "DD", ":lua require 'dap'.toggle_breakpoint()<CR>", silent)
vim.keymap.set("n", "Dc", ":lua require 'dap'.continue()<CR>", silent)
vim.keymap.set("n", "Di", ":lua require 'dap'.step_into()<CR>", silent)
vim.keymap.set("n", "Do", ":lua require 'dap'.step_over()<CR>", silent)
vim.keymap.set("n", "DO", ":lua require 'dap'.step_out()<CR>", silent)
vim.keymap.set("n", "Dr", ":lua require 'dap'.repl.toggle({height = 5})<CR>", silent)
vim.keymap.set("n", "Dh", ":lua require 'dap.ui.widgets'.hover()<CR>", silent)

View file

@ -1,229 +0,0 @@
local lspconfig = require("lspconfig")
local capabilities = require("cmp_nvim_lsp").default_capabilities()
vim.keymap.set("n", "K", "<Cmd>lua vim.lsp.buf.hover()<CR>")
vim.keymap.set("i", "<C-k>", "<Cmd>lua vim.lsp.buf.signature_help()<CR>")
vim.keymap.set("n", "1gd", "<Cmd>lua vim.lsp.buf.type_definition()<CR>")
vim.keymap.set("n", "gf", "<Cmd>lua vim.lsp.buf.format()<CR>")
vim.keymap.set("n", "rn", "<Cmd>lua vim.lsp.buf.rename()<CR>")
vim.keymap.set("n", "[d", "<Cmd>lua vim.lsp.diagnostic.goto_prev()<CR>")
vim.keymap.set("n", "]d", "<Cmd>lua vim.lsp.diagnostic.goto_next()<CR>")
vim.keymap.set("n", "gwa", "<Cmd>lua vim.lsp.buf.add_workspace_folder()<CR>")
vim.keymap.set("n", "gwr", "<Cmd>lua vim.lsp.buf.add_workspace_folder()<CR>")
vim.keymap.set("n", "gwl", "<Cmd>lua vim.lsp.buf.add_workspace_folder()<CR>")
vim.cmd([[autocmd BufWritePre * lua vim.lsp.buf.format({sync = true})]])
local border = {
{ "🭽", "FloatBorder" },
{ "", "FloatBorder" },
{ "🭾", "FloatBorder" },
{ "", "FloatBorder" },
{ "🭿", "FloatBorder" },
{ "", "FloatBorder" },
{ "🭼", "FloatBorder" },
{ "", "FloatBorder" },
}
vim.lsp.handlers["textDocument/hover"] = vim.lsp.with(vim.lsp.handlers.hover, { border = border })
vim.lsp.handlers["textDocument/signatureHelp"] = vim.lsp.with(vim.lsp.handlers.signature_help, { border = border })
vim.lsp.handlers["textDocument/publishDiagnostics"] = vim.lsp.with(vim.lsp.diagnostic.on_publish_diagnostics, {
update_in_insert = false,
virtual_text = false,
})
local signs = { Error = "🔥", Warn = "⚠️ ", Hint = "💡", Info = "💡" }
for type, icon in pairs(signs) do
local hl = "DiagnosticSign" .. type
vim.fn.sign_define(hl, { text = icon, texthl = hl, numhl = hl })
end
local on_attach = function()
require("folding").on_attach()
end
-- simple setups --
local servers = {
"bashls",
"dockerls",
"gopls",
"jsonls",
-- "sql",
"pyright",
"sumneko_lua",
"terraformls",
"yamlls",
}
for _, lsp in ipairs(servers) do
lspconfig[lsp].setup({ on_attach = on_attach })
end
local efm_prettier = {
formatCommand = "prettier --stdin-filepath ${INPUT}",
formatStdin = true,
}
lspconfig.gopls.setup({
on_attach = on_attach,
settings = {
gopls = {
directoryFilters = {
"-bazel-bin",
"-bazel-out",
"-bazel-testlogs",
"-proto",
},
},
},
})
lspconfig.sumneko_lua.setup({
on_attach = function()
on_attach()
vim.cmd([[autocmd BufWritePre <buffer> lua require'stylua-nvim'.format_file()]])
end,
settings = {
Lua = {
completion = { kewordSnippet = "Disable" },
diagnostics = {
enable = true,
globals = { "renoise", "use", "vim" },
},
runtime = {
version = "LuaJIT",
path = { "?.lua", "?/init.lua", "?/?.lua" },
},
workspace = {
library = vim.api.nvim_get_runtime_file("", true),
maxPreload = 2000,
preloadFileSize = 1000,
checkThirdParty = false,
},
},
},
})
lspconfig.terraformls.setup({})
local yaml_is_k8s = function(bufnr)
local lines = vim.api.nvim_buf_get_lines(bufnr, 0, 50, false) -- Stop after the first 50 lines
for _, l in pairs(lines) do
if string.find(l, "apiVersion") ~= nil then
return true
end
end
return false
end
lspconfig.cssls.setup({
cmd = { "vscode-css-languageserver", "--stdio" },
capabilities = capabilities,
})
lspconfig.cssmodules_ls.setup({})
lspconfig.html.setup({
cmd = { "vscode-html-languageserver", "--stdio" },
filetypes = { "html" },
init_options = {
configurationSection = { "html", "css", "javascript" },
embeddedLanguages = {
css = true,
javascript = true,
},
},
settings = {},
})
lspconfig.yamlls.setup({
settings = {
yaml = {
format = { enable = true, singleQuote = true },
schemaStore = { enable = true, url = "https://json.schemastore.org" },
schemas = {
-- ["https://json.schemastore.org/github-workflow"] = "*.github/workflows/*",
["https://json.schemastore.org/kustomization.json"] = "kustomization.yaml",
-- ["https://json.schemastore.org/ansible-role-2.9.json"] = "*/tasks/*.y*ml",
kubernetes = {
"clusterrolebinding.yaml",
"clusterrole-contour.yaml",
"clusterrole.yaml",
"configmap.yaml",
"cronjob.yaml",
"daemonset.yaml",
"deployment-*.yaml",
"deployment.yaml",
"*-deployment.yaml",
"hpa.yaml",
"ingress.yaml",
"job.yaml",
"namespace.yaml",
"pvc.yaml",
"rbac.yaml",
"rolebinding.yaml",
"role.yaml",
"sa.yaml",
"secret.yaml",
"serviceaccounts.yaml",
"service-account.yaml",
"serviceaccount.yaml",
"service-*.yaml",
"service.yaml",
"*-service.yaml",
"statefulset.yaml",
},
},
validate = true,
},
},
})
require("lspconfig").tsserver.setup({})
-- npm install -g typescript typescript-language-server
-- require("lspconfig").tsserver.setup({
-- on_attach = function(client, bufnr)
-- client.resolved_capabilities.document_formatting = false
-- on_attach(client)
-- local ts_utils = require("nvim-lsp-ts-utils")
-- ts_utils.setup({
-- debug = false,
-- disable_commands = false,
-- enable_import_on_completion = false,
-- import_all_timeout = 5000, -- ms
-- -- eslint
-- eslint_enable_code_actions = true,
-- eslint_enable_disable_comments = true,
-- eslint_bin = "eslint_d",
-- eslint_config_fallback = nil,
-- eslint_enable_diagnostics = true,
-- -- formatting
-- enable_formatting = true,
-- formatter = "prettier",
-- formatter_config_fallback = nil,
-- -- parentheses completion
-- complete_parens = false,
-- signature_help_in_parens = false,
-- -- update imports on file move
-- update_imports_on_move = true,
-- require_confirmation_on_move = true,
-- watch_dir = nil,
-- })
-- ts_utils.setup_client(client)
-- vim.api.nvim_buf_set_keymap(bufnr, "n", "<Leader>co", ":TSLspOrganize<CR>", { silent = true })
-- vim.api.nvim_buf_set_keymap(bufnr, "n", "qq", ":TSLspFixCurrent<CR>", { silent = true })
-- vim.api.nvim_buf_set_keymap(bufnr, "n", "<Leader>cR", ":TSLspRenameFile<CR>", { silent = true })
-- vim.api.nvim_buf_set_keymap(bufnr, "n", "<Leader>ci", ":TSLspImportAll<CR>", { silent = true })
-- end,
-- })

View file

@ -1,26 +0,0 @@
local lualine = require("lualine")
local function clock()
return os.date("%H:%M")
end
lualine.setup({
options = {
globalstatus = true,
theme = "onelight",
component_separators = { left = "", right = "" },
section_separators = { left = "", right = "" },
},
sections = {
lualine_c = {
{
"filename",
path = 1,
file_status = true,
},
},
lualine_x = { "filetype" },
lualine_y = { "location", "progress" },
lualine_z = { clock },
},
})

View file

@ -1,28 +0,0 @@
local marks = require("marks")
marks.setup{
default_mappings = true,
-- which builtin marks to show. default {}
-- builtin_marks = { ".", "<", ">", "^" },
cyclic = true,
force_write_shada = false,
-- marks, and bookmarks.
-- can be either a table with all/none of the keys, or a single number, in which case
-- the priority applies to all marks.
-- default 10.
-- sign_priority = { lower=10, upper=15, builtin=8, bookmark=20 },
--
-- disables mark tracking for specific filetypes. default {}
excluded_filetypes = {},
-- marks.nvim allows you to configure up to 10 bookmark groups, each with its own
-- sign/virttext. Bookmarks can be used to group together positions and quickly move
-- across multiple buffers. default sign is '!@#$%^&*()' (from 0 to 9), and
-- default virt_text is "".
bookmark_1 = {
sign = "",
virt_text = ""
},
}

View file

@ -1,26 +0,0 @@
local null_ls = require("null-ls")
local builtins = require("null-ls.builtins")
null_ls.setup({
sources = {
builtins.formatting.black,
builtins.formatting.buf,
builtins.formatting.cue_fmt,
builtins.formatting.shfmt,
builtins.formatting.buildifier,
builtins.completion.spell,
builtins.diagnostics.buf.with({
args = { "lint", "--disable-symlinks", "--path", "$FILENAME" },
cwd = function()
local file_dir = vim.fn.expand("%:p:h") .. ";"
local buf_yaml = vim.fn.findfile("buf.yaml", file_dir)
if buf_yaml then
return vim.fn.fnamemodify(buf_yaml, ":h")
end
end,
}),
builtins.diagnostics.buildifier,
builtins.diagnostics.cue_fmt,
},
debug = true,
})

View file

@ -1,90 +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({
formatting = {
format = require("lspkind").cmp_format({
with_text = true,
menu = {
buffer = "[Buffer]",
tmux = "[Tmux]",
luasnip = "[LuaSnip]",
nvim_lsp = "[LSP]",
nvim_lua = "[Lua]",
path = "[Path]",
},
}),
},
window = {
completion = cmp.config.window.bordered({
winhighlight = "Normal:PMenu,FloatBorder:PMenuBorder,CursorLine:PMenuSel,Search:None",
}),
documentation = cmp.config.window.bordered({
winhighlight = "Normal:PMenu,FloatBorder:PMenu,CursorLine:PMenuSel,Search:None",
}),
},
snippet = {
expand = function(args)
luasnip.lsp_expand(args.body)
end,
},
mapping = {
["<Up>"] = cmp.mapping(cmp.mapping.select_prev_item(), { "i", "c" }),
["<Down>"] = cmp.mapping(cmp.mapping.select_next_item(), { "i", "c" }),
["<C-p>"] = cmp.mapping(cmp.mapping.select_prev_item(), { "i", "c" }),
["<C-n>"] = cmp.mapping(cmp.mapping.select_next_item(), { "i", "c" }),
["<C-d>"] = cmp.mapping.scroll_docs(-4),
["<C-u>"] = cmp.mapping.scroll_docs(4),
["<C-e>"] = cmp.mapping({
i = cmp.mapping.abort(),
c = cmp.mapping.close(),
}),
["<CR>"] = cmp.mapping(cmp.mapping.confirm({ select = false }), { "i", "c" }),
["<C-y>"] = cmp.mapping(cmp.mapping.confirm({ select = false }), { "i", "c" }),
["<C-Space>"] = cmp.mapping(cmp.mapping.complete(), { "i", "c" }),
["<Tab>"] = cmp.mapping(function(fallback)
if cmp.visible() then
cmp.select_next_item()
elseif luasnip.expand_or_locally_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 = "buffer", priority = 1 },
{ name = "luasnip", priority = 4 },
{ name = "copilot", group_index = 5 },
{
name = "tmux",
priority = 2,
option = {
all_panes = true,
trigger_characters = {},
},
},
{ name = "nvim_lsp", priority = 3 },
{ name = "nvim_lsp_signature_help", priority = 4 },
}),
})

View file

@ -1,5 +0,0 @@
local dapgo = require("dap-go")
local silent = { silent = true }
dapgo.setup()
vim.keymap.set("n", "<leader>y", ":lua require('dap-go').debug_test()<CR>", silent)

View file

@ -1,10 +0,0 @@
local osc52 = require("osc52")
osc52.setup({
max_length = 0, -- Maximum length of selection (0 for no limit)
silent = false, -- Disable message on successful copy
trim = false, -- Trim text before copy
})
vim.keymap.set("n", "<leader>c", require("osc52").copy_operator, { expr = true })
vim.keymap.set("n", "<leader>cc", "<leader>c_", { remap = true })
vim.keymap.set("x", "<leader>c", require("osc52").copy_visual)

View file

@ -1,83 +0,0 @@
local telescope = require("telescope")
local actions = require("telescope.actions")
local previewers = require("telescope.previewers")
vim.keymap.set("n", "<leader>b", '<cmd>lua require("telescope.builtin").buffers()<CR>')
vim.keymap.set("n", "<leader>f", '<cmd>lua require("telescope.builtin").oldfiles()<CR>')
vim.keymap.set("n", "<space>", '<cmd>lua require("telescope.builtin").oldfiles()<CR>')
vim.keymap.set("n", "<leader>d", '<cmd>lua require("telescope.builtin").diagnostics()<CR>')
vim.keymap.set("n", "<leader>e", '<cmd>lua require("telescope.builtin").git_files()<CR>')
vim.keymap.set("n", "<leader>g", '<cmd>lua require("telescope.builtin").git_status()<CR>')
vim.keymap.set("n", "<leader>a", '<cmd>lua require("telescope.builtin").lsp_code_actions()<CR>')
vim.keymap.set("n", "<leader>m", '<cmd>lua require("telescope.builtin").marks()<CR>')
vim.keymap.set("n", "<leader>s", '<cmd>lua require("telescope.builtin").lsp_document_symbols()<CR>')
vim.keymap.set("n", "<leader>t", '<cmd>lua require("telescope.builtin").treesitter()<CR>')
vim.keymap.set("n", "<leader>/", '<cmd>lua require("telescope.builtin").live_grep()<CR>')
vim.keymap.set("n", "<leader>.", '<cmd>lua require("telescope.builtin").file_browser()<CR>')
vim.keymap.set("n", "<leader>p", '<cmd>lua require("telescope.builtin").registers()<CR>')
vim.keymap.set("n", "gr", '<cmd>lua require("telescope.builtin").lsp_references()<CR>')
vim.keymap.set("n", "gd", '<cmd>lua require("telescope.builtin").lsp_definitions()<CR>')
vim.keymap.set("n", "g/", '<cmd>lua require("telescope.builtin").lsp_document_symbols()<CR>')
vim.keymap.set("n", "g?", '<cmd>lua require("telescope.builtin").lsp_workspace_symbols()<CR>')
vim.keymap.set("n", "ge", '<cmd>lua require("telescope.builtin").lsp_document_diagnostics()<CR>')
vim.keymap.set("n", "Db", '<cmd>lua require("telescope").extensions.dap.list_breakpoints()<CR>')
vim.keymap.set("n", "Dcc", '<cmd>lua require("telescope").extensions.dap.commands()<CR>')
vim.keymap.set("n", "Df", '<cmd>lua require("telescope").extensions.dap.frames()<CR>')
vim.keymap.set("n", "Dv", '<cmd>lua require("telescope").extensions.dap.variables()<CR>')
-- Setup
telescope.setup({
defaults = {
layout_strategy = "flex",
-- layout_defaults = {flip_columns = 160},
layout_config = {
preview_cutoff = 10,
},
mappings = {
i = {
["<CR>"] = actions.select_default + actions.center,
["<esc>"] = actions.close,
["<tab>"] = actions.add_selection,
},
},
color_devicons = true,
file_previewer = previewers.vim_buffer_cat.new,
grep_previewer = previewers.vim_buffer_vimgrep.new,
qflist_previewer = previewers.vim_buffer_qflist.new,
},
})
local layout_strategies = require("telescope.pickers.layout_strategies")
local config = require("telescope.config")
layout_strategies.flex = function(self, max_columns, max_lines)
local layout_config = self.layout_config or {}
local flip_columns = layout_config.flip_columns or 160 -- Here's why.
local flip_lines = layout_config.flip_lines or 20
if max_columns < flip_columns and max_lines > flip_lines then
self.layout_config = (config.values.layout_defaults or {})["vertical"]
return layout_strategies.vertical(self, max_columns, max_lines)
else
self.layout_config = (config.values.layout_defaults or {})["horizontal"]
return layout_strategies.horizontal(self, max_columns, max_lines)
end
end
-- Extensions
telescope.load_extension("dap")
telescope.load_extension("fzy_native")
telescope.load_extension("gh")
-- telescope.load_extension("packer") -- currently breaking packer
local M = {}
-- Pickers
M.project_files = function()
require("telescope.builtin").find_files({
cwd = require("lspconfig.util").root_pattern(".git")(vim.fn.expand("%:p")),
})
end
return M

View file

@ -1,37 +0,0 @@
local config = require("treesitter-context")
config.setup({
enable = true, -- Enable this plugin (Can be enabled/disabled later via commands)
max_lines = 0, -- How many lines the window should span. Values <= 0 mean no limit.
patterns = { -- Match patterns for TS nodes. These get wrapped to match at word boundaries.
-- For all filetypes
-- Note that setting an entry here replaces all other patterns for this entry.
-- By setting the 'default' entry below, you can control which nodes you want to
-- appear in the context window.
default = {
"class",
"function",
"method",
-- 'for', -- These won't appear in the context
-- 'while',
-- 'if',
-- 'switch',
-- 'case',
},
-- Example for a specific filetype.
-- If a pattern is missing, *open a PR* so everyone can benefit.
-- rust = {
-- 'impl_item',
-- },
},
exact_patterns = {
-- Example for a specific filetype with Lua patterns
-- Treat patterns.rust as a Lua pattern (i.e "^impl_item$" will
-- exactly match "impl_item" only)
-- rust = true,
},
-- [!] The options below are exposed but shouldn't require your attention,
-- you can safely ignore them.
zindex = 20, -- The Z-index of the context window
})

View file

@ -1,58 +0,0 @@
vim.wo.foldmethod = "expr"
vim.wo.foldexpr = "nvim_treesitter#foldexpr()"
require("nvim-treesitter.configs").setup {
ensure_installed = "all",
highlight = {
enable = true,
use_languagetree = true,
},
indent = {
enable = false
},
playground = {
enable = true,
disable = {},
updatetime = 25,
persist_queries = false
},
incremental_selection = {
enable = true,
keymaps = {
init_selection = "ss",
node_incremental = "sq",
scope_incremental = "sd",
node_decremental = "sa",
},
},
textobjects = {
move = {
enable = true,
goto_next_start = {
["]]"] = "@function.outer",
["]m"] = "@class.outer"
},
goto_next_end = {
["]["] = "@function.outer",
["]M"] = "@class.outer"
},
goto_previous_start = {
["[["] = "@function.outer",
["[m"] = "@class.outer"
},
goto_previous_end = {
["[]"] = "@function.outer",
["[M"] = "@class.outer"
}
},
},
--- nvim-ts-autotag ---
autotag = {
enable = true,
filetypes = {"html", "javascriptreact", "xml"}
}
}

View file

@ -1,17 +0,0 @@
local yanky = require("yanky")
yanky.setup({
ring = {
history_length = 100,
storage = "memory",
sync_with_numbered_registers = false,
cancel_event = "update",
},
})
vim.keymap.set({ "n", "x" }, "p", "<Plug>(YankyPutAfter)")
vim.keymap.set({ "n", "x" }, "P", "<Plug>(YankyPutBefore)")
vim.keymap.set({ "n", "x" }, "gp", "<Plug>(YankyGPutAfter)")
vim.keymap.set({ "n", "x" }, "gP", "<Plug>(YankyGPutBefore)")
vim.keymap.set("n", "<c-p>", "<Plug>(YankyCycleForward)")
vim.keymap.set("n", "<c-n>", "<Plug>(YankyCycleBackward)")

View file

@ -1,67 +0,0 @@
vim.g.zenbones = {
style = "light",
lightness = "bright",
colorize_diagnostic_underline_text = true,
transparent_background = true,
zenbones_compat = 1,
}
local lush = require("lush")
local base = require("zenbones")
-- Create some specs
---@diagnostic disable = undefined-global
local specs = lush.parse(function()
return {
CursorLine({ bg = "#f5f5f0" }),
Error({ fg = "#d9534f" }),
CursorLineNr({ fg = "#BCAAA4", bg = "#f5f5f0" }),
MsgArea({ fg = "#A1887F", bg = "#f1f1f1" }),
String({ fg = "#2E7D32", gui = "italic" }),
Comment({ fg = "#114499", gui = "bold,italic" }),
CopilotSuggestion({ fg = "#0066cc", gui = "bold,italic" }),
LineNr({ fg = "#9FA8AC", gui = "bold,italic" }),
LineNrAbove({ fg = "#9F080C", gui = "bold,italic" }),
Indent1({ fg = "#DFDF9A", gui = "italic" }),
Indent2({ fg = "#BAE1FF", gui = "italic" }),
Indent3({ fg = "#BAFFC9", gui = "italic" }),
Indent4({ fg = "#FFB3BA", gui = "italic" }),
Indent5({ fg = "#FFDFBA", gui = "italic" }),
Indent6({ fg = "#F3E5F5", gui = "italic" }),
NormalFloat({ bg = "#FFF9C4" }),
FloatBorder({ fg = "#FFB74D", bg = "#FFF9C4" }),
TelescopeNormal({ bg = "#EFEBE9" }),
TelescopeBorder({ fg = "#A1887F", bg = "#EFEBE9" }),
TelescopeSelection({ fg = "#FFFFFF", bg = "#1976D2" }),
DiagnosticSignError({ fg = "#ff2200", bg = "#fff5ff", gui = "bold" }),
DiagnosticVirtualTextInfo({ fg = "#0033bb", bg = "#f7fcff", gui = "bold,italic" }),
DiagnosticVirtualTextWarn({ fg = "#bb2200", bg = "#fff9f3", gui = "bold,italic" }),
DiagnosticVirtualTextError({ fg = "#ff2200", bg = "#fff5f3", gui = "italic" }),
DiagnosticUnderlineError({ fg = "#ff0000", gui = "undercurl" }),
DiagnosticUnderlineWarn({ fg = "#ff7700", gui = "undercurl" }),
DiagnosticUnderlineInfo({ fg = "#3366cc", gui = "undercurl" }),
MarkSignHL({ fg = "#009688", bg = "#E0F7FA" }),
MarkSignNumHL({ fg = "#B2DFDB", bg = "#E0F7FA" }),
GitSignsAdd({ fg = "#81C784" }),
GitSignsAddNr({ fg = "#C8E6C9" }),
GitSignsDelete({ fg = "#E53935" }),
GitSignsDeleteNr({ fg = "#FFCDD2" }),
GitSignsChange({ fg = "#FFA726" }),
GitSignsChangeNr({ fg = "#FFE0B2" }),
PMenu({ bg = "#F7F5F0" }),
PMenuBorder({ bg = "#F7F5F0", fg = "#886622" }),
PMenuSel({ fg = "#FFFFFF", bg = "#1976D2" }),
PMenuSbar({ bg = "#90CAF9" }),
PMenuThumb({ bg = "#64B5F6" }),
StatusLine({ base = base.VertSplit, fg = "#BCAAA4" }),
StatusLineNC({ base = base.VertSplit, fg = "#BCAAA4" }),
TreesitterContext({ bg = "#f0f0f0", fg = "#BCAAA4", gui = "bold,italic" }),
TreesitterContextLineNumber({ bg = "#f0f0f0", fg = "#979770", gui = "bold,italic" }),
}
end)
-- Apply specs using lush tool-chain
vim.cmd("colorscheme zenbones")
lush.apply(lush.compile(specs))

View file

@ -62,8 +62,8 @@ vim.o.cmdheight = 1
-- vim.o.title = true
-- vim.o.titlestring = "%F%m %r %y"
vim.o.fillchars = "stl: ,stlnc: "
vim.wo.foldmethod = "expr"
vim.wo.foldexpr = "nvim_treesitter#foldexpr()"
-- vim.wo.foldmethod = "expr"
-- vim.wo.foldexpr = "nvim_treesitter#foldexpr()"
vim.g.netrw_dirhistmax = 0
--- Key mappings