Switch to new lazy-based config

Still a bit WIP. Gradually adding back old plugins and config from old config.
This commit is contained in:
2023-12-01 15:26:02 -05:00
parent 9a1c59026f
commit 1bd905a6bf
81 changed files with 1158 additions and 1927 deletions

View File

@@ -1 +0,0 @@
require('alpha').setup(require('alpha.themes.startify').config)

View File

@@ -1,7 +0,0 @@
vim.o.sessionoptions='blank,buffers,curdir,folds,help,tabpages,winsize,winpos,terminal'
require('auto-session').setup({
log_level = 'error',
auto_session_suppress_dirs = { '~/', '~/workspace', '~/Downloads', '/'},
auto_session_enable_last_session = false,
})

View File

@@ -1,7 +0,0 @@
vim.opt.termguicolors = true
require('bufferline').setup({
options = {
mode = 'tabs',
diagnostics = 'nvim_lsp',
},
})

View File

@@ -0,0 +1,9 @@
return {
{ "ellisonleao/gruvbox.nvim" },
{
"LazyVim/LazyVim",
opts = {
colorscheme = "gruvbox",
},
},
}

View File

@@ -1,69 +0,0 @@
require("Comment").setup({
---Add a space b/w comment and the line
---@type boolean|fun():boolean
padding = true,
---Whether the cursor should stay at its position
---NOTE: This only affects NORMAL mode mappings and doesn't work with dot-repeat
---@type boolean
sticky = true,
---Lines to be ignored while comment/uncomment.
---Could be a regex string or a function that returns a regex string.
---Example: Use '^$' to ignore empty lines
---@type string|fun():string
ignore = nil,
---LHS of toggle mappings in NORMAL + VISUAL mode
---@type table
toggler = {
---Line-comment toggle keymap
line = "gcc",
---Block-comment toggle keymap
block = "gbc",
},
---LHS of operator-pending mappings in NORMAL + VISUAL mode
---@type table
opleader = {
---Line-comment keymap
line = "gc",
---Block-comment keymap
block = "gb",
},
---LHS of extra mappings
---@type table
extra = {
---Add comment on the line above
above = "gcO",
---Add comment on the line below
below = "gco",
---Add comment at the end of line
eol = "gcA",
},
---Create basic (operator-pending) and extended mappings for NORMAL + VISUAL mode
---NOTE: If `mappings = false` then the plugin won't create any mappings
---@type boolean|table
mappings = {
---Operator-pending mapping
---Includes `gcc`, `gbc`, `gc[count]{motion}` and `gb[count]{motion}`
---NOTE: These mappings can be changed individually by `opleader` and `toggler` config
basic = true,
---Extra mapping
---Includes `gco`, `gcO`, `gcA`
extra = true,
---Extended mapping
---Includes `g>`, `g<`, `g>[count]{motion}` and `g<[count]{motion}`
extended = false,
},
---Pre-hook, called before commenting the line
---@type fun(ctx: CommentCtx):string
pre_hook = nil,
---Post-hook, called after commenting is done
---@type fun(ctx: CommentCtx)
post_hook = nil,
})

View File

@@ -1,3 +0,0 @@
local cmp = require('copilot_cmp')
cmp.setup()

View File

@@ -1,4 +0,0 @@
require('copilot').setup({
suggestion = { enabled = false },
panel = { enabled = false },
});

View File

@@ -1,23 +0,0 @@
local crates = require('crates')
local opts = { silent = true }
crates.setup()
vim.keymap.set('n', '<leader>ct', crates.toggle, { silent = true, desc = "Rust [C]rate [T]oggle" })
vim.keymap.set('n', '<leader>cr', crates.reload, { silent = true, desc = "Rust [C]rate [R]eload"})
vim.keymap.set('n', '<leader>cv', crates.show_versions_popup, { silent = true, desc = "Rust [C]rate show [V]ersions" })
vim.keymap.set('n', '<leader>cf', crates.show_features_popup, { silent = true, desc = "Rust [C]rate show [F]eatures" })
vim.keymap.set('n', '<leader>cd', crates.show_dependencies_popup, { silent = true, desc = "Rust [C]rate show [D]ependencies" })
vim.keymap.set('n', '<leader>cu', crates.update_crate, { silent = true, desc = "Rust [C]rate [U]pdate (to newest compatible version)" })
vim.keymap.set('v', '<leader>cu', crates.update_crates, { silent = true, desc = "Rust [C]rates [U]pdate (to newest compatible versions)" })
vim.keymap.set('n', '<leader>ca', crates.update_all_crates, { silent = true, desc = "Rust [C]rates update [A]ll (to newest compatible versions)" })
vim.keymap.set('n', '<leader>cU', crates.upgrade_crate, { silent = true, desc = "Rust [C]rate [U]pgrade" })
vim.keymap.set('v', '<leader>cU', crates.upgrade_crates, { silent = true, desc = "Rust [C]rates [U]pgrade" })
vim.keymap.set('n', '<leader>cA', crates.upgrade_all_crates, { silent = true, desc = "Rust [C]rates upgrade [A]ll" })
vim.keymap.set('n', '<leader>cH', crates.open_homepage, { silent = true, desc = "Rust [C]rate open [H]omepage" })
vim.keymap.set('n', '<leader>cR', crates.open_repository, { silent = true, desc = "Rust [C]rate open [R]epository" })
vim.keymap.set('n', '<leader>cD', crates.open_documentation, { silent = true, desc = "Rust [C]rate open [D]ocumentation" })
vim.keymap.set('n', '<leader>cC', crates.open_crates_io, { silent = true, desc = "Rust [C]rate open [C]rates.io" })

35
lua/plugins/dial.lua Normal file
View File

@@ -0,0 +1,35 @@
-- better increase/descrease
return {
"monaqa/dial.nvim",
keys = {
{
"<C-a>",
function()
return require("dial.map").inc_normal()
end,
expr = true,
desc = "Increment",
},
{
"<C-x>",
function()
return require("dial.map").dec_normal()
end,
expr = true,
desc = "Decrement",
},
},
config = function()
local augend = require("dial.augend")
require("dial.config").augends:register_group({
default = {
augend.integer.alias.decimal,
augend.integer.alias.hex,
augend.date.alias["%Y/%m/%d"],
augend.constant.alias.bool,
augend.semver.alias.semver,
augend.constant.new({ elements = { "let", "const" } }),
},
})
end,
}

View File

@@ -1,21 +1,24 @@
local actions = require("diffview.actions")
require("diffview").setup({
enhanced_diff_hl = true,
keymaps = {
view = {
["gq"] = "<Cmd>DiffviewClose<CR>",
},
file_panel = {
["gq"] = "<Cmd>DiffviewClose<CR>",
},
file_history_panel = {
["gq"] = "<Cmd>DiffviewClose<CR>",
},
}
})
vim.keymap.set('v', '<leader>gl', [[<Cmd>'<,'>DiffviewFileHistory<CR>]], { noremap = false, silent = true, desc = "Toggle [G]it [L]og of selected lines" })
vim.keymap.set('n', '<leader>gL', [[<Cmd>DiffviewFileHistory<CR>]], { noremap = false, silent = true, desc = "Toggle [G]it [L]og of current branch" })
vim.keymap.set('n', '<leader>gl', [[<Cmd>DiffviewFileHistory %<CR>]], { noremap = false, silent = true, desc = "Toggle [G]it [L]og of current file history" })
vim.keymap.set('n', '<leader>gd', [[<Cmd>DiffviewOpen<CR>]], { noremap = false, silent = true, desc = "[G]it [D]iff current file against index" })
return {
"sindrets/diffview.nvim",
cmd = { "DiffviewOpen", "DiffviewClose", "DiffviewToggleFiles", "DiffviewFocusFiles" },
opts = {
enhanced_diff_hl = true,
keymaps = {
view = {
["gq"] = "<Cmd>DiffviewClose<CR>",
},
file_panel = {
["gq"] = "<Cmd>DiffviewClose<CR>",
},
file_history_panel = {
["gq"] = "<Cmd>DiffviewClose<CR>",
},
},
},
keys = {
{ "v", "<leader>gl", "<cmd>'<,'>DiffviewFileHistory<cr>", desc = "Toggle git log of selected lines" },
{ "<leader>gL", "<cmd>DiffviewFileHistory<cr>", desc = "Toggle git log of current branch" },
{ "<leader>gl", "<cmd>DiffviewFileHistory %<cr>", desc = "Toggle git log of current file history" },
{ "<leader>gd", "<cmd>DiffviewOpen<cr>", desc = "Git diff current file against the index" },
},
}

265
lua/plugins/example.lua Normal file
View File

@@ -0,0 +1,265 @@
-- since this is just an example spec, don't actually load anything here and return an empty spec
-- stylua: ignore
if true then return {} end
-- every spec file under the "plugins" directory will be loaded automatically by lazy.nvim
--
-- In your plugin files, you can:
-- * add extra plugins
-- * disable/enabled LazyVim plugins
-- * override the configuration of LazyVim plugins
return {
-- add gruvbox
{ "ellisonleao/gruvbox.nvim" },
-- Configure LazyVim to load gruvbox
{
"LazyVim/LazyVim",
opts = {
colorscheme = "gruvbox",
},
},
-- change trouble config
{
"folke/trouble.nvim",
-- opts will be merged with the parent spec
opts = { use_diagnostic_signs = true },
},
-- disable trouble
{ "folke/trouble.nvim", enabled = false },
-- add symbols-outline
{
"simrat39/symbols-outline.nvim",
cmd = "SymbolsOutline",
keys = { { "<leader>cs", "<cmd>SymbolsOutline<cr>", desc = "Symbols Outline" } },
config = true,
},
-- override nvim-cmp and add cmp-emoji
{
"hrsh7th/nvim-cmp",
dependencies = { "hrsh7th/cmp-emoji" },
---@param opts cmp.ConfigSchema
opts = function(_, opts)
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 telescope-fzf-native
{
"telescope.nvim",
dependencies = {
"nvim-telescope/telescope-fzf-native.nvim",
build = "make",
config = function()
require("telescope").load_extension("fzf")
end,
},
},
-- add pyright to lspconfig
{
"neovim/nvim-lspconfig",
---@class PluginLspOpts
opts = {
---@type lspconfig.options
servers = {
-- pyright will be automatically installed with mason and loaded with lspconfig
pyright = {},
},
},
},
-- add tsserver and setup with typescript.nvim instead of lspconfig
{
"neovim/nvim-lspconfig",
dependencies = {
"jose-elias-alvarez/typescript.nvim",
init = function()
require("lazyvim.util").on_attach(function(_, buffer)
-- stylua: ignore
vim.keymap.set( "n", "<leader>co", "TypescriptOrganizeImports", { buffer = buffer, desc = "Organize Imports" })
vim.keymap.set("n", "<leader>cR", "TypescriptRenameFile", { desc = "Rename File", buffer = buffer })
end)
end,
},
---@class PluginLspOpts
opts = {
---@type lspconfig.options
servers = {
-- tsserver will be automatically installed with mason and loaded with lspconfig
tsserver = {},
},
-- you can do any additional lsp server setup here
-- return true if you don't want this server to be setup with lspconfig
---@type table<string, fun(server:string, opts:_.lspconfig.options):boolean?>
setup = {
-- example to setup with typescript.nvim
tsserver = function(_, opts)
require("typescript").setup({ server = opts })
return true
end,
-- Specify * to use this function as a fallback for any server
-- ["*"] = function(server, opts) end,
},
},
},
-- for typescript, LazyVim also includes extra specs to properly setup lspconfig,
-- treesitter, mason and typescript.nvim. So instead of the above, you can use:
{ import = "lazyvim.plugins.extras.lang.typescript" },
-- add more treesitter parsers
{
"nvim-treesitter/nvim-treesitter",
opts = {
ensure_installed = {
"bash",
"html",
"javascript",
"json",
"lua",
"markdown",
"markdown_inline",
"python",
"query",
"regex",
"tsx",
"typescript",
"vim",
"yaml",
},
},
},
-- since `vim.tbl_deep_extend`, can only merge tables and not lists, the code above
-- would overwrite `ensure_installed` with the new value.
-- If you'd rather extend the default config, use the code below instead:
{
"nvim-treesitter/nvim-treesitter",
opts = function(_, opts)
-- add tsx and treesitter
vim.list_extend(opts.ensure_installed, {
"tsx",
"typescript",
})
end,
},
-- the opts function can also be used to change the default opts:
{
"nvim-lualine/lualine.nvim",
event = "VeryLazy",
opts = function(_, opts)
table.insert(opts.sections.lualine_x, "😄")
end,
},
-- or you can return new options to override all the defaults
{
"nvim-lualine/lualine.nvim",
event = "VeryLazy",
opts = function()
return {
--[[add your custom lualine config here]]
}
end,
},
-- use mini.starter instead of alpha
{ import = "lazyvim.plugins.extras.ui.mini-starter" },
-- add jsonls and schemastore packages, and setup treesitter for json, json5 and jsonc
{ import = "lazyvim.plugins.extras.lang.json" },
-- add any tools you want to have installed below
{
"williamboman/mason.nvim",
opts = {
ensure_installed = {
"stylua",
"shellcheck",
"shfmt",
"flake8",
},
},
},
-- Use <tab> for completion and snippets (supertab)
-- first: disable default <tab> and <s-tab> behavior in LuaSnip
{
"L3MON4D3/LuaSnip",
keys = function()
return {}
end,
},
-- then: setup supertab in cmp
{
"hrsh7th/nvim-cmp",
dependencies = {
"hrsh7th/cmp-emoji",
},
---@param opts cmp.ConfigSchema
opts = function(_, opts)
local has_words_before = function()
unpack = unpack or table.unpack
local line, col = unpack(vim.api.nvim_win_get_cursor(0))
return col ~= 0 and vim.api.nvim_buf_get_lines(0, line - 1, line, true)[1]:sub(col, col):match("%s") == nil
end
local luasnip = require("luasnip")
local cmp = require("cmp")
opts.mapping = vim.tbl_extend("force", opts.mapping, {
["<Tab>"] = cmp.mapping(function(fallback)
if cmp.visible() then
cmp.select_next_item()
-- You could replace the expand_or_jumpable() calls with expand_or_locally_jumpable()
-- this way you will only jump inside the snippet region
elseif luasnip.expand_or_jumpable() then
luasnip.expand_or_jump()
elseif has_words_before() then
cmp.complete()
else
fallback()
end
end, { "i", "s" }),
["<S-Tab>"] = cmp.mapping(function(fallback)
if cmp.visible() then
cmp.select_prev_item()
elseif luasnip.jumpable(-1) then
luasnip.jump(-1)
else
fallback()
end
end, { "i", "s" }),
})
end,
},
}

View File

@@ -1 +0,0 @@
require('fidget').setup()

View File

@@ -1,11 +0,0 @@
vim.keymap.set('n', '<leader>gx', [[<Cmd>G<CR>]], { noremap = false, silent = true, desc = "Toggle [G]it status window" })
vim.keymap.set('n', '<leader>gs', [[<Cmd>Git<CR>]], { noremap = false, silent = true, desc = "Toggle [G]it [S]tatus window" })
vim.keymap.set('n', '<leader>gfd', [[<Cmd>Gdiffsplit<CR>]], { noremap = false, silent = true, desc = "[G]it [D]iff current file against index with [F]ugitive" })
vim.keymap.set('n', '<leader>gc', [[<Cmd>Git commit<CR>]], { noremap = false, silent = true, desc = "[G]it [C]ommit" })
vim.keymap.set('n', '<leader>gb', [[<Cmd>Git blame -C<CR>]], { noremap = false, silent = true, desc = "[G]it [B]lame" })
vim.keymap.set('n', '<leader>gp', [[<Cmd>Git push<CR>]], { noremap = false, silent = true, desc = "[G]it [P]ush" })
vim.keymap.set('n', '<leader>gf', [[<Cmd>Git push --force<CR>]], { noremap = false, silent = true, desc = "[G]it [F]orce push" })
vim.keymap.set('n', '<leader>gu', [[<Cmd>Git pull<CR>]], { noremap = false, silent = true, desc = "[G]it p[U]ll" })
vim.keymap.set('n', '<leader>gh', [[<Cmd>Git diff --cached<CR>]], { noremap = false, silent = true, desc = "[G]it diff current staged changes" })
vim.keymap.set('n', '<leader>go', [[<Cmd>GBrowse<CR>]], { noremap = false, silent = true, desc = "[B]rowse [G]it URL for fugitive object under cursor" })
vim.keymap.set('v', '<leader>go', [[<Cmd>'<,'>GBrowse<CR>]], { noremap = false, silent = true, desc = "[B]rowse [G]it URL for selected lines" })

View File

@@ -1 +0,0 @@
require('git-conflict').setup()

View File

@@ -1,41 +0,0 @@
require('gitsigns').setup({
update_debounce = 500,
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 = "Jump to next git hunk [C]hange" })
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 = "Jump to previous git hunk [C]hange" })
-- Actions
map({ 'n', 'v' }, '<leader>hs', ':Gitsigns stage_hunk<CR>', { desc = "[S]tage git [H]unk" })
map({ 'n', 'v' }, '<leader>hr', ':Gitsigns reset_hunk<CR>', { desc = "[R]eset git [H]unk" })
map('n', '<leader>hS', gs.stage_buffer, { desc = "[S]tage git buffer" })
map('n', '<leader>hu', gs.undo_stage_hunk, { desc = "[U]ndo git [H]unk" })
map('n', '<leader>hR', gs.reset_buffer, { desc = "[R]eset git buffer" })
map('n', '<leader>hp', gs.preview_hunk, { desc = "[P]review git [H]unk" })
map('n', '<leader>hb', function() gs.blame_line { full = true } end, { desc = "Git [B]lame line" })
map('n', '<leader>tb', gs.toggle_current_line_blame, { desc = "[T]oggle current line git [B]lame" })
map('n', '<leader>hd', gs.diffthis, { desc = "Git [D]iff current file with index" })
map('n', '<leader>hD', function() gs.diffthis('~') end, { desc = "Git [D]iff current file with last commit" })
map('n', '<leader>td', gs.toggle_deleted, { desc = "[T]oggle showing [D]eleted git hunks" })
-- Text object
map({ 'o', 'x' }, 'ih', ':<C-U>Gitsigns select_hunk<CR>', { desc = "Select git [H]unk under cursor" })
end
})

View File

@@ -1,5 +0,0 @@
require('goto-preview').setup({
default_mappings = true,
-- resizing_mappings = true,
opacity = 90,
})

View File

@@ -1,38 +1,11 @@
require("gruvbox").setup({
undercurl = true,
underline = true,
bold = true,
italic = {
strings = true,
comments = true,
operators = false,
folds = true,
return {
"ellisonleao/gruvbox.nvim",
opts = {
contrast = "hard",
palette_overrides = {
dark0_hard = "#131516",
dark1 = "#242424",
},
dim_inactive = true,
},
strikethrough = true,
invert_selection = false,
invert_signs = false,
invert_tabline = false,
invert_intend_guides = false,
inverse = true, -- invert background for search, diffs, statuslines and errors
contrast = "hard", -- can be "hard" or "soft"
dim_inactive = true,
transparent_mode = false,
palette_overrides = {
dark0_hard = '#131516',
dark1 = '#242424',
},
overrides = {
Pmenu = { bg = '#222222'},
GruvboxAquaSign = { bg = "NONE" },
GruvboxBlueSign = { bg = "NONE" },
GruvboxGreenSign = { bg = "NONE" },
GruvboxOrangeSign = { bg = "NONE" },
GruvboxPurpleSign = { bg = "NONE" },
GruvboxRedSign = { bg = "NONE" },
GruvboxYellowSign = { bg = "NONE" },
SignColumn = { bg = "NONE" },
Search = { fg = "#E1A416" },
IncSearch = { fg = "#E56700" },
}
})
vim.o.background = "dark"
}

View File

@@ -1,8 +0,0 @@
require('gui-font-resize').setup({
default_size = 11.0, -- absolute size it will fallback to when :GUIFontSizeSet is not specified
change_by = 1, -- step value that will inc/dec the fontsize by
})
vim.keymap.set('n', '<D-Up>', [[<Cmd>GUIFontSizeUp<CR>]], { noremap = true, silent = true, desc = "Increase font size" })
vim.keymap.set('n', '<D-Down>', [[<Cmd>GUIFontSizeDown<CR>]], { noremap = true, silent = true, desc = "Decrease font size" })
vim.keymap.set('n', '<D-0>', [[<Cmd>set guifont=Hack:h11 | GUIFontSizeSet<CR>]], { noremap = true, silent = true, desc = "Set font family and size to default" })

View File

@@ -0,0 +1,8 @@
return {
"smjonas/inc-rename.nvim",
cmd = "IncRename",
config = true,
keys = {
{ "<leader>rn", ":IncRename ", desc = "Incremental Rename" },
},
}

View File

@@ -1,6 +0,0 @@
require("ibl").setup({
scope = {
show_start = false,
show_end = false,
}
})

View File

@@ -1 +0,0 @@
require('kanagawa').setup()

View File

@@ -1,5 +0,0 @@
require('nvim-lastplace').setup({
lastplace_ignore_buftype = { 'quickfix', 'nofile', 'nowrite', 'help' },
lastplace_ignore_filetype = { 'gitcommit', 'gitrebase', 'svn', 'hgcommit' },
lastplace_open_folds = true,
})

View File

@@ -1 +0,0 @@
require('leap').add_default_mappings()

View File

@@ -1,111 +0,0 @@
require('mason').setup({
max_concurrent_installers = 10,
})
require('mason-lspconfig').setup({
automatic_installation = true,
})
local on_attach = require('plugins.lsp.on_attach')
-- Mappings.
-- See `:help vim.diagnostic.*` for documentation on any of the below functions
local opts = { noremap=true, silent=true }
vim.keymap.set('n', '<space>e', vim.diagnostic.open_float, opts)
vim.keymap.set('n', '[d', vim.diagnostic.goto_prev, opts)
vim.keymap.set('n', ']d', vim.diagnostic.goto_next, opts)
vim.keymap.set('n', '<space>q', vim.diagnostic.setloclist, opts)
local lsp_flags = {
-- This is the default in Nvim 0.7+
debounce_text_changes = 150,
}
require('lspconfig')['pyright'].setup({
on_attach = on_attach,
flags = lsp_flags,
})
-- Setup by typescript.nvim automatically
-- require('lspconfig')['tsserver'].setup({
-- on_attach = on_attach,
-- flags = lsp_flags,
-- })
require('lspconfig')['jsonls'].setup({
on_attach = on_attach,
flags = lsp_flags,
})
require('lspconfig')['eslint'].setup({
on_attach = on_attach,
flags = lsp_flags,
-- root_dir = require('lspconfig').util.find_git_ancestor,
})
require('lspconfig')['html'].setup({
on_attach = on_attach,
flags = lsp_flags,
})
require('lspconfig')['cssls'].setup({
on_attach = on_attach,
flags = lsp_flags,
})
-- Setup by rust-tools automatically
-- require('lspconfig')['rust_analyzer'].setup({
-- on_attach = on_attach,
-- flags = lsp_flags,
-- -- Server-specific settings...
-- settings = {
-- ['rust-analyzer'] = {}
-- }
-- })
require('lspconfig')['lua_ls'].setup({
on_attach = on_attach,
flags = lsp_flags,
settings = {
Lua = {
completion = {
callSnippet = "Replace"
},
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),
},
},
},
})
require('lspconfig')['bashls'].setup({
on_attach = on_attach,
flags = lsp_flags,
})
require('lspconfig')['marksman'].setup({
on_attach = on_attach,
flags = lsp_flags,
})
require('lspconfig')['sqlls'].setup({
on_attach = function(client, bufn)
on_attach(client, bufn)
require('sqlls').on_attach(client, bufn)
end,
flags = lsp_flags,
})
require('lspconfig')['taplo'].setup({
on_attach = on_attach,
flags = lsp_flags,
})
require('lspconfig')['zls'].setup({
on_attach = on_attach,
flags = lsp_flags,
})
require('lspconfig')['terraformls'].setup({
on_attach = on_attach,
flags = lsp_flags,
})
vim.api.nvim_create_autocmd({"BufWritePre"}, {
pattern = {"*.tf", "*.tfvars"},
callback = function()
vim.lsp.buf.format()
end,
})

View File

@@ -1,77 +0,0 @@
-- From: https://github.com/Saecki/crates.nvim
local function show_documentation()
local filetype = vim.bo.filetype
if vim.tbl_contains({ 'vim','help' }, filetype) then
vim.cmd('h '..vim.fn.expand('<cword>'))
elseif vim.tbl_contains({ 'man' }, filetype) then
vim.cmd('Man '..vim.fn.expand('<cword>'))
elseif vim.fn.expand('%:t') == 'Cargo.toml' and require('crates').popup_available() then
require('crates').show_popup()
else
vim.lsp.buf.hover()
end
end
-- Use an on_attach function to only map the following keys
-- after the language server attaches to the current buffer
-- thallada: NOTE: copied also in lsp/init.lua since I can't figure out how to import it here
local on_attach = function(_, bufnr)
-- Enable completion triggered by <c-x><c-o>
vim.api.nvim_buf_set_option(bufnr, 'omnifunc', 'v:lua.vim.lsp.omnifunc')
-- Mappings.
-- See `:help vim.lsp.*` for documentation on any of the below functions
local bufopts = { noremap=true, silent=true, buffer=bufnr }
vim.keymap.set('n', 'gD', vim.lsp.buf.declaration, bufopts)
vim.keymap.set('n', 'K', show_documentation, bufopts)
vim.keymap.set('n', 'gi', vim.lsp.buf.implementation, bufopts)
vim.keymap.set('n', '<M-k>', vim.lsp.buf.signature_help, bufopts)
vim.keymap.set('n', '<leader>wa', vim.lsp.buf.add_workspace_folder, bufopts)
vim.keymap.set('n', '<leader>wr', vim.lsp.buf.remove_workspace_folder, bufopts)
vim.keymap.set('n', '<leader>wl', function()
print(vim.inspect(vim.lsp.buf.list_workspace_folders()))
end, bufopts)
vim.keymap.set('n', '<leader>rn', vim.lsp.buf.rename, bufopts)
vim.keymap.set('n', '<leader>a', vim.lsp.buf.code_action, bufopts)
vim.keymap.set('v', '<leader>a', vim.lsp.buf.code_action, bufopts)
vim.keymap.set('n', 'ga', vim.lsp.buf.code_action, bufopts)
vim.keymap.set('n', '<leader>f', function() vim.lsp.buf.format { async = true } end, bufopts)
vim.keymap.set('n', '<leader>F', function() vim.lsp.buf.format { async = true } end, bufopts)
-- vim.keymap.set('n', 'gr', vim.lsp.buf.references, bufopts)
-- vim.keymap.set('n', 'gd', vim.lsp.buf.definition, bufopts)
-- vim.keymap.set('n', '<leader>D', vim.lsp.buf.type_definition, bufopts)
-- vim.keymap.set('n', 'gW', vim.lsp.buf.workspace_symbol, bufopts)
-- vim.keymap.set('n', 'g0', vim.lsp.buf.document_symbol, bufopts)
vim.keymap.set(
'n',
'gr',
[[<Cmd>lua require('telescope.builtin').lsp_references()<CR>]],
{ noremap = true, silent = true }
)
vim.keymap.set(
'n',
'gd',
[[<Cmd>lua require('telescope.builtin').lsp_definitions()<CR>]],
{ noremap = true, silent = true }
)
vim.keymap.set(
'n',
'<leader>D',
[[<Cmd>lua require('telescope.builtin').lsp_type_definitions()<CR>]],
{ noremap = true, silent = true }
)
vim.keymap.set(
'n',
'gW',
[[<Cmd>lua require('telescope.builtin').lsp_dynamic_workspace_symbols()<CR>]],
{ noremap = true, silent = true }
)
vim.keymap.set(
'n',
'g0',
[[<Cmd>lua require('telescope.builtin').lsp_document_symbols()<CR>]],
{ noremap = true, silent = true }
)
end
return on_attach

View File

@@ -1,24 +0,0 @@
require('lualine').setup({
sections = {
lualine_c = {
require('auto-session.lib').current_session_name,
{
'filename',
file_status = true, -- displays file status (readonly status, modified status)
path = 1, -- 0 = just filename, 1 = relative path, 2 = absolute path
},
},
},
inactive_sections = {
lualine_a = {},
lualine_b = {},
lualine_c = { {
'filename',
file_status = true, -- displays file status (readonly status, modified status)
path = 1 -- 0 = just filename, 1 = relative path, 2 = absolute path
} },
lualine_x = { 'location' },
lualine_y = {},
lualine_z = {}
},
})

7
lua/plugins/luasnip.lua Normal file
View File

@@ -0,0 +1,7 @@
-- Disable <tab> and <s-tab> behavior in luasnip for supertab: https://www.lazyvim.org/configuration/recipes#supertab
return {
"L3MON4D3/LuaSnip",
keys = function()
return {}
end,
}

View File

@@ -0,0 +1,11 @@
return {
"echasnovski/mini.indentscope",
opts = {
draw = {
-- Speed up distracting animation
animation = function()
return 1
end,
},
},
}

View File

@@ -1,12 +0,0 @@
require('neoai').setup()
vim.keymap.set('n', '<leader>ai', '<cmd>NeoAI<cr>',
{ silent = true, noremap = true, desc = "Toggle Neo[AI]" }
)
vim.keymap.set('n', '<leader>ac', '<cmd>NeoAIContext<cr>',
{ silent = true, noremap = true, desc = "Toggle Neo[A]i with [C]ontext of current buffer" }
)
-- Can't get this to work :/
-- vim.keymap.set('x', '<leader>ai', [[<cmd>'<,'>NeoAIContext<cr>]],
-- { silent = true, noremap = true, desc = "Toggle Neo[AI] with context of selected text" }
-- )

View File

@@ -1 +0,0 @@
require('neodev').setup({})

View File

@@ -1,17 +0,0 @@
local neotest = require('neotest')
neotest.setup({
adapters = {
require('neotest-rust'),
},
})
vim.keymap.set("n", "<leader>t", function() neotest.run.run() end, { desc = "Run neo[T]ests under cursor"})
vim.keymap.set("n", "<leader>tf", function() neotest.run.run(vim.fn.expand('%')) end, { desc = "Run neo[T]ests in current file" })
vim.keymap.set("n", "<leader>tt", function() neotest.run.run({ strategy = 'dap' }) end, { desc = "Run neo[T]ests in DAP debugging mode" })
vim.keymap.set("n", "<leader>ta", function() neotest.run.attach() end, { desc = "[A]ttach to neo[T]est process" })
vim.keymap.set("n", "<leader>to", function() neotest.output.open({ enter = true }) end, { desc = "[O]pen neo[T]ests summary window" })
vim.keymap.set("n", "<leader>ts", function() neotest.summary.toggle() end, { desc = "Toggle neo[T]est [S]ummary window"})
vim.diagnostic.config({
neotest = true,
}, vim.api.nvim_create_namespace('neotest'))

View File

@@ -1,84 +0,0 @@
local null_ls = require("null-ls")
-- From: https://github.com/jose-elias-alvarez/null-ls.nvim/wiki/Formatting-on-save
local async_formatting = function(bufnr)
bufnr = bufnr or vim.api.nvim_get_current_buf()
vim.lsp.buf_request(
bufnr,
"textDocument/formatting",
vim.lsp.util.make_formatting_params({}),
function(err, res, ctx)
if err then
local err_msg = type(err) == "string" and err or err.message
-- you can modify the log message / level (or ignore it completely)
vim.notify("formatting: " .. err_msg, vim.log.levels.WARN)
return
end
-- don't apply results if buffer is unloaded or has been modified
if not vim.api.nvim_buf_is_loaded(bufnr) or vim.api.nvim_buf_get_option(bufnr, "modified") then
return
end
if res then
local client = vim.lsp.get_client_by_id(ctx.client_id)
vim.lsp.util.apply_text_edits(res, bufnr, client and client.offset_encoding or "utf-16")
vim.api.nvim_buf_call(bufnr, function()
vim.cmd("silent noautocmd update")
end)
end
end
)
end
local augroup = vim.api.nvim_create_augroup("LspFormatting", {})
null_ls.setup({
-- thallada: broken
-- on_attach = function(client, bufnr)
-- if client.supports_method("textDocument/formatting") then
-- vim.api.nvim_clear_autocmds({ group = augroup, buffer = bufnr })
-- vim.api.nvim_create_autocmd("BufWritePost", {
-- group = augroup,
-- buffer = bufnr,
-- callback = function()
-- async_formatting(bufnr)
-- end,
-- })
-- end
-- end,
sources = {
-- Linter
-- null_ls.builtins.diagnostics.eslint_d,
-- null_ls.builtins.diagnostics.prettierd,
null_ls.builtins.diagnostics.jsonlint,
null_ls.builtins.diagnostics.markdownlint,
null_ls.builtins.diagnostics.stylelint,
null_ls.builtins.diagnostics.tidy,
-- Somehow breaks tsx syntax highlighting in new buffers... wtf???
-- Issue made here: https://github.com/jose-elias-alvarez/null-ls.nvim/issues/1527
null_ls.builtins.diagnostics.todo_comments,
null_ls.builtins.diagnostics.tsc,
null_ls.builtins.diagnostics.fish,
null_ls.builtins.diagnostics.codespell,
-- Formatter
null_ls.builtins.formatting.eslint_d,
null_ls.builtins.formatting.markdownlint,
null_ls.builtins.formatting.prettierd,
null_ls.builtins.formatting.sqlfluff.with({
extra_args = { "--dialect", "postgres" },
}),
null_ls.builtins.formatting.stylua,
null_ls.builtins.formatting.rustfmt,
null_ls.builtins.formatting.tidy,
null_ls.builtins.formatting.taplo,
-- Refactoring
null_ls.builtins.code_actions.refactoring,
-- Shells
-- Git
null_ls.builtins.code_actions.gitsigns,
-- Plugins
require('typescript.extensions.null-ls.code-actions'),
},
})

View File

@@ -1,6 +0,0 @@
require("numb").setup({
show_numbers = true, -- Enable 'number' for the window while peeking
show_cursorline = true, -- Enable 'cursorline' for the window while peeking
number_only = false, -- Peek only when the command is only a number instead of when it starts with a number
centered_peeking = true, -- Peeked line will be centered relative to window
})

11
lua/plugins/numb.lua Normal file
View File

@@ -0,0 +1,11 @@
return {
"nacro90/numb.nvim",
config = function()
require("numb").setup({
show_numbers = true, -- Enable 'number' for the window while peeking
show_cursorline = true, -- Enable 'cursorline' for the window while peeking
number_only = false, -- Peek only when the command is only a number instead of when it starts with a number
centered_peeking = true, -- Peeked line will be centered releative to window
})
end,
}

View File

@@ -1,28 +0,0 @@
local npairs = require("nvim-autopairs")
local Rule = require('nvim-autopairs.rule')
local cmp = require('cmp')
local cmp_autopairs = require('nvim-autopairs.completion.cmp')
npairs.setup({
check_ts = true,
ts_config = {
lua = {'string'},-- it will not add a pair on that treesitter node
javascript = {'template_string'},
java = false,-- don't check treesitter on java
}
})
local ts_conds = require('nvim-autopairs.ts-conds')
-- press % => %% only while inside a comment or string
npairs.add_rules({
Rule("%", "%", "lua")
:with_pair(ts_conds.is_ts_node({'string','comment'})),
Rule("$", "$", "lua")
:with_pair(ts_conds.is_not_ts_node({'function'}))
})
cmp.event:on(
'confirm_done',
cmp_autopairs.on_confirm_done()
)

View File

@@ -1,144 +1,83 @@
local cmp = require('cmp')
local lspkind = require('lspkind')
local has_words_before = function()
if vim.api.nvim_buf_get_option(0, "buftype") == "prompt" then return false end
local line, col = unpack(vim.api.nvim_win_get_cursor(0))
return col ~= 0 and vim.api.nvim_buf_get_text(0, line-1, 0, line-1, col, {})[1]:match("^%s*$") == nil
end
cmp.setup({
experimental = { ghost_text = true },
snippet = {
-- REQUIRED - you must specify a snippet engine
expand = function(args)
vim.fn['vsnip#anonymous'](args.body) -- For `vsnip` users.
-- require('luasnip').lsp_expand(args.body) -- For `luasnip` users.
-- require('snippy').expand_snippet(args.body) -- For `snippy` users.
-- vim.fn["UltiSnips#Anon"](args.body) -- For `ultisnips` 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.
["<Tab>"] = cmp.mapping(function(fallback)
if cmp.visible() and has_words_before() then
cmp.select_next_item({ behavior = cmp.SelectBehavior.Select })
else
fallback()
end
end, { "i", "s" }),
["<S-Tab>"] = cmp.mapping(function(fallback)
if cmp.visible() then
cmp.select_prev_item()
else
fallback()
end
end, { "i", "s" }),
}),
sources = cmp.config.sources({
{ name = "copilot", priority = 100, group_index = 1 },
{
name = 'nvim_lsp_signature_help',
priority = 90,
group_index = 2,
},
{
name = 'nvim_lsp',
priority = 90,
group_index = 2,
},
{
name = 'buffer',
priority = 80,
group_index = 3,
},
{
name = 'path',
priority = 80,
group_index = 3,
},
{ name = 'vsnip' }, -- For vsnip users.
-- { name = 'luasnip' }, -- For luasnip users.
-- { name = 'ultisnips' }, -- For ultisnips users.
-- { name = 'snippy' }, -- For snippy users.
}),
sorting = {
priority_weight = 2,
comparators = {
require("copilot_cmp.comparators").prioritize,
require("copilot_cmp.comparators").score,
-- Below is the default comparitor list and order for nvim-cmp
cmp.config.compare.offset,
-- cmp.config.compare.scopes, --this is commented in nvim-cmp too
cmp.config.compare.exact,
cmp.config.compare.score,
cmp.config.compare.recently_used,
cmp.config.compare.locality,
cmp.config.compare.kind,
cmp.config.compare.sort_text,
cmp.config.compare.length,
cmp.config.compare.order,function(...) return require('cmp_buffer'):compare_locality(...) end,
}
},
formatting = {
format = lspkind.cmp_format({
mode = 'symbol_text',
maxwidth = 50,
ellipsis_char = '',
-- symbol_map = { Copilot = '🤖' },
})
}
})
-- Set configuration for specific filetype.
cmp.setup.filetype('gitcommit', {
sources = cmp.config.sources({
{ name = 'cmp_git' }, -- You can specify the `cmp_git` source if you were installed it.
}, {
{ 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', keyword_pattern=[=[[^[:blank:]\!]*]=], keyword_length=3 }
})
})
-- Add additional capabilities supported by nvim-cmp
local capabilities = require('cmp_nvim_lsp').default_capabilities()
local lspconfig = require("lspconfig")
-- Enable some language servers with the additional completion capabilities offered by nvim-cmp
local servers = { 'pyright', 'tsserver', 'html', 'cssls' }
for _, lsp in ipairs(servers) do
lspconfig[lsp].setup({
-- on_attach = my_custom_on_attach,
capabilities = capabilities,
})
end
-- Configure nvim-cmp with "supertab"-like behavior for LuaSnip integration: https://www.lazyvim.org/configuration/recipes#supertab
-- Also, prevent autocomplete from automatically selecting the first item in the list on <CR>, and instead require the user to press <Tab> to select the first item.
return {
capabilities,
"hrsh7th/nvim-cmp",
dependencies = {
"hrsh7th/cmp-calc",
"hrsh7th/cmp-emoji",
"hrsh7th/cmp-cmdline",
"petertriho/cmp-git",
},
---@param opts cmp.ConfigSchema
opts = function(_, opts)
local has_words_before = function()
unpack = unpack or table.unpack
local line, col = unpack(vim.api.nvim_win_get_cursor(0))
return col ~= 0 and vim.api.nvim_buf_get_lines(0, line - 1, line, true)[1]:sub(col, col):match("%s") == nil
end
local luasnip = require("luasnip")
local cmp = require("cmp")
opts.mapping = vim.tbl_extend("force", opts.mapping, {
["<Tab>"] = cmp.mapping(function(fallback)
-- This bit is for preventing auto-completion auto-triggering from copilot-cmp:
-- https://github.com/zbirenbaum/copilot-cmp?tab=readme-ov-file#tab-completion-configuration-highly-recommended
if cmp.visible() and has_words_before() then
-- You could replace select_next_item() with confirm({ select = true }) to get VS Code autocompletion behavior
cmp.select_next_item({ behavior = cmp.SelectBehavior.Select })
-- You could replace the expand_or_jumpable() calls with expand_or_locally_jumpable()
-- this way you will only jump inside the snippet region
elseif luasnip.expand_or_jumpable() then
luasnip.expand_or_jump()
elseif has_words_before() then
cmp.complete()
else
fallback()
end
end, { "i", "s" }),
["<S-Tab>"] = cmp.mapping(function(fallback)
if cmp.visible() then
cmp.select_prev_item()
elseif luasnip.jumpable(-1) then
luasnip.jump(-1)
else
fallback()
end
end, { "i", "s" }),
["<CR>"] = cmp.mapping.confirm({ select = false }), -- Accept currently selected item. Set `select` to `false` to only confirm explicitly selected items.
})
-- Do not auto-select the first auto-complete item, require a <Tab> to select the first item.
opts.completion.completeopt = "menu,menuone,noinsert,noselect"
opts.sources = cmp.config.sources(vim.list_extend(opts.sources, {
{ name = "emoji" },
{ name = "git" },
{ name = "calc" },
}))
-- `/` cmdline setup.
cmp.setup.cmdline("/", {
mapping = cmp.mapping.preset.cmdline(),
sources = {
{ name = "buffer" },
},
})
-- `:` cmdline setup.
cmp.setup.cmdline(":", {
mapping = cmp.mapping.preset.cmdline(),
sources = cmp.config.sources({
{ name = "path" },
}, {
{
name = "cmdline",
option = {
ignore_cmds = { "Man", "!" },
},
},
}),
})
end,
}

View File

@@ -1 +0,0 @@
require('colorizer').setup()

View File

@@ -1 +0,0 @@
require('dapui').setup()

View File

@@ -1 +0,0 @@
require('nvim-dap-virtual-text').setup()

View File

@@ -1,27 +0,0 @@
-- thallada: this is setup in rust-tools
local dap = require('dap')
-- dap.adapters.codelldb = {
-- type = 'server',
-- port = '${port}',
-- executable = {
-- command = '/home/thallada/vscode-lldb/extension/adapter/codelldb',
-- args = { '--port', '${port}'}
-- }
-- }
-- dap.configurations.rust = {
-- {
-- name = "Launch file",
-- type = "codelldb",
-- request = "launch",
-- program = function()
-- return vim.fn.input('Path to executable: ', vim.fn.getcwd() .. '/', 'file')
-- end,
-- cwd = '${workspaceFolder}',
-- stopOnEntry = true,
-- },
-- }
vim.keymap.set('n', '<leader>b', [[<Cmd>lua require('dap').toggle_breakpoint()<CR>]], { desc = "Toggle DAP [B]reakpoint"})
vim.keymap.set('n', '<leader>be', [[<Cmd>lua require('dap').set_exception_breakpoints()<CR>]], { desc = "Toggle DAP [B]reak on [E]xceptions" })
vim.keymap.set('n', '<leader>bc', [[<Cmd>lua require('dap').clear_breakpoints()<CR>]], { desc = "[C]lear DAP [B]reakpoints" })
vim.keymap.set('n', '<leader>bo', [[<Cmd>lua require('dapui').toggle()<CR>]], { desc = "Toggle nvim dapui" })

View File

@@ -1 +0,0 @@
require('nvim-lightbulb').setup({ autocmd = { enabled = true } })

View File

@@ -1 +0,0 @@
require('pqf').setup()

View File

@@ -1,5 +0,0 @@
require('treesitter-context').setup{
enable = true,
max_lines = 0,
min_window_height = 10,
}

View File

@@ -1,105 +0,0 @@
require('nvim-treesitter.configs').setup {
ensure_installed = 'all',
ignore_install = { 'phpdoc' },
sync_install = false,
auto_install = true,
highlight = {
enable = true,
disable = { 'sql' }, -- since pgsql.vim is currently better at highlighting
},
incremental_selection = {
enable = true,
keymaps = {
init_selection = "<c-space>",
node_incremental = "<c-space>",
scope_incremental = "<c-s>",
node_decremental = "<c-backspace>",
},
},
indent = {
enable = true
},
textobjects = {
select = {
enable = true,
lookahead = true, -- Automatically jump forward to textobj, similar to targets.vim
keymaps = {
-- You can use the capture groups defined in textobjects.scm
['aa'] = '@parameter.outer',
['ia'] = '@parameter.inner',
['af'] = '@function.outer',
['if'] = '@function.inner',
['ac'] = '@class.outer',
['ic'] = '@class.inner',
}
}
},
move = {
enable = true,
set_jumps = true, -- whether to set jumps in the jumplist
goto_next_start = {
[']m'] = '@function.outer',
[']]'] = '@class.outer',
},
goto_next_end = {
[']M'] = '@function.outer',
[']['] = '@class.outer',
},
goto_previous_start = {
['[m'] = '@function.outer',
['[['] = '@class.outer',
},
goto_previous_end = {
['[M'] = '@function.outer',
['[]'] = '@class.outer',
},
},
swap = {
enable = true,
swap_next = {
['<leader>a'] = '@parameter.inner',
},
swap_previous = {
['<leader>A'] = '@parameter.inner',
},
},
autotag = {
enable = true,
},
refactor = {
highlight_definitions = {
enable = true,
clear_on_cursor_move = true,
},
smart_rename = {
enable = true,
keymaps = {
smart_rename = 'grr',
},
},
},
context_commentstring = {
enable = true,
enable_autocmd = false,
},
pairs = {
enable = true,
disable = {},
highlight_pair_events = {}, -- e.g. {"CursorMoved"}, -- when to highlight the pairs, use {} to deactivate highlighting
highlight_self = false, -- whether to highlight also the part of the pair under cursor (or only the partner)
goto_right_end = false, -- whether to go to the end of the right partner or the beginning
fallback_cmd_normal = "call matchit#Match_wrapper('',1,'n')", -- What command to issue when we can't find a pair (e.g. "normal! %")
keymaps = {
goto_partner = "<leader>%",
delete_balanced = "X",
},
delete_balanced = {
only_on_first_char = false, -- whether to trigger balanced delete when on first character of a pair
fallback_cmd_normal = nil, -- fallback command when no pair found, can be nil
longest_partner = false, -- whether to delete the longest or the shortest pair when multiple found.
-- E.g. whether to delete the angle bracket or whole tag in <pair> </pair>
}
},
}

View File

@@ -1,4 +0,0 @@
require('octo').setup()
-- Doesn't work, need to set this in settings too
vim.api.nvim_set_hl(0, 'OctoEditable', { bg = '#313131' })

View File

@@ -1,3 +0,0 @@
require("oil").setup()
vim.keymap.set("n", "-", require("oil").open, { desc = "Open parent directory" })

8
lua/plugins/oil.lua Normal file
View File

@@ -0,0 +1,8 @@
return {
"stevearc/oil.nvim",
opts = {},
dependencies = { "nvim-tree/nvim-web-devicons" },
keys = {
{ "-", "<cmd>Oil<cr>", { desc = "Open parent directory in current buffer" } },
},
}

View File

@@ -1 +0,0 @@
vim.g.sql_type_default = 'pgsql';

View File

@@ -1,7 +0,0 @@
require('rest-nvim').setup({
skip_ssl_verification = true,
})
vim.keymap.set('n', '<leader>rd', [[<Plug>RestNvim]], { noremap = false, silent = true, desc = "Run rest.nvim under cursor" })
vim.keymap.set('n', '<leader>ry', [[<Plug>RestNvimPreview]], { noremap = false, silent = true, desc = "Show cURL command for rest.nvim under cursor"})
vim.keymap.set('n', '<leader>ri', [[<Plug>RestNvimLast]], { noremap = false, silent = true })

View File

@@ -1,51 +0,0 @@
local rt = require('rust-tools')
local lsp_on_attach = require('plugins.lsp.on_attach')
local nvim_cmp_capabilities = require('plugins.nvim-cmp').capabilities
local extension_path = vim.env.HOME .. '/vscode-lldb/extension/'
local codelldb_path = extension_path .. 'adapter/codelldb'
local liblldb_path = extension_path .. 'lldb/lib/liblldb.so'
rt.setup({
tools = {
runnables = {
use_telescope = true
},
},
server = {
capabilities = nvim_cmp_capabilities,
on_attach = function(client, bufnr)
lsp_on_attach(client, bufnr)
vim.keymap.set('n', '<C-space>', rt.hover_actions.hover_actions, { buffer = bufnr, desc = "Show hover actions under cursor" })
-- Code action groups
vim.keymap.set('n', '<leader>a', rt.code_action_group.code_action_group, { buffer = bufnr, desc = "Show code actions under cursor" })
vim.keymap.set('n', '<leader>rc', rt.open_cargo_toml.open_cargo_toml, { buffer = bufnr, desc = "Open Cargo.toml for current project" })
vim.keymap.set('n', '<leader>rp', rt.parent_module.parent_module, { buffer = bufnr, desc = "Go to parent Rust module" })
vim.keymap.set('n', '<leader>rm', rt.expand_macro.expand_macro, { buffer = bufnr, desc = "Expand Rust macro" })
end,
settings = {
-- to enable rust-analyzer settings visit:
-- https://github.com/rust-analyzer/rust-analyzer/blob/master/docs/user/generated_config.adoc
['rust-analyzer'] = {
-- enable clippy on save
checkOnSave = {
command = 'clippy'
},
}
},
},
dap = {
adapter = require('rust-tools.dap').get_codelldb_adapter(
codelldb_path,
liblldb_path
)
}
})
vim.api.nvim_create_autocmd('BufRead', {
group = vim.api.nvim_create_augroup('CmpSourceCargo', { clear = true }),
pattern = 'Cargo.toml',
callback = function()
require('cmp').setup.buffer({ sources = { { name = 'crates' } } })
end,
})

View File

@@ -1 +0,0 @@
require('session-lens').setup()

13
lua/plugins/ssr.lua Normal file
View File

@@ -0,0 +1,13 @@
return {
"cshuaimin/ssr.nvim",
keys = {
{
"<leader>sR",
function()
require("ssr").open()
end,
mode = { "n", "x" },
desc = "Structural Replace",
},
},
}

View File

@@ -1 +0,0 @@
require("nvim-surround").setup({})

View File

@@ -1,175 +1,30 @@
local trouble = require('trouble.providers.telescope')
local telescope = require('telescope')
telescope.setup {
defaults = {
mappings = {
i = {
['<c-t>'] = trouble.open_with_trouble,
['<c-h>'] = 'which_key',
},
n = {
['<c-t>'] = trouble.open_with_trouble,
['<c-h>'] = 'which_key',
},
return {
"telescope.nvim",
dependencies = {
{
"debugloop/telescope-undo.nvim",
keys = { { "<leader>U", "<cmd>Telescope undo<cr>" } },
config = function()
require("telescope").load_extension("undo")
end,
},
{
"xiyaowong/telescope-emoji.nvim",
keys = { { "<leader>fj", "<cmd>Telescope emoji<cr>" } },
config = function()
require("telescope").load_extension("undo")
end,
},
},
keys = {
{
"<leader>fp",
function()
require("telescope.builtin").find_files({
cwd = require("lazy.core.config").options.root,
})
end,
desc = "Find Plugin File",
},
},
extensions = {
project = {
theme = 'dropdown',
}
}
}
require('telescope').load_extension('fzf')
require('telescope').load_extension('gh')
require('telescope').load_extension('env')
require('telescope').load_extension('emoji')
require('telescope').load_extension('ui-select')
require('telescope').load_extension('project')
require('telescope').load_extension('session-lens')
vim.keymap.set(
'n',
'<leader>fgf',
[[<Cmd>lua require('telescope.builtin').git_files({ show_untracked = true })<CR>]],
{ noremap = true, silent = true, desc = "[F]ind [G]it [F]iles" }
)
vim.keymap.set(
'n',
'<leader>f.',
[[<Cmd>lua require('telescope.builtin').git_files({ no_ignore = true })<CR>]],
{ noremap = true, silent = true, desc = "[F]ind ALL git files including ignored [.]" }
)
vim.keymap.set(
'n',
'_',
[[<Cmd>lua require('telescope.builtin').live_grep()<CR>]],
{ noremap = true, silent = true, desc = "Search by live grep" }
)
vim.keymap.set(
'n',
'<leader>_',
[[<Cmd>lua require('telescope.builtin').live_grep({ search_dirs = { vim.fn.expand('%:p:h') } })<CR>]],
{ noremap = true, silent = true, desc = "Search by live grep in current (present) working directory" }
)
vim.keymap.set(
'n',
'<leader>8',
[[<Cmd>lua require('telescope.builtin').grep_string()<CR>]],
{ noremap = true, silent = true, desc = "Search by grep" }
)
vim.keymap.set(
'n',
'<leader>3',
[[<Cmd>lua require('telescope.builtin').grep_string()<CR>]],
{ noremap = true, silent = true, desc = "Search by grep" }
)
vim.keymap.set(
"n",
"<leader>fd",
[[<Cmd>lua require('telescope.builtin').find_files({cwd=require('telescope.utils').buffer_dir()})<CR>]],
{ noremap = true, silent = true, desc = "[F]ind [D]irectories" }
)
vim.keymap.set(
'n',
'<leader>fb',
[[<Cmd>lua require('telescope.builtin').buffers()<CR>]],
{ noremap = true, silent = true, desc = "[F]ind [B]uffers" }
)
vim.keymap.set(
'n',
'<leader>fh',
[[<Cmd>lua require('telescope.builtin').help_tags()<CR>]],
{ noremap = true, silent = true, desc = "[F]ind [T]ags" }
)
vim.keymap.set(
'n',
'<leader>ft',
[[<Cmd>lua require('telescope.builtin').treesitter()<CR>]],
{ noremap = true, silent = true, desc = "[F]ind [T]reesitter objects" }
)
vim.keymap.set(
'n',
'<leader>fr',
[[<Cmd>lua require('telescope.builtin').resume()<CR>]],
{ noremap = true, silent = true, desc = "[R]esume last [F]ind" }
)
vim.keymap.set(
'n',
'<leader>fs',
[[<Cmd>lua require('telescope.builtin').spell_suggest()<CR>]],
{ noremap = true, silent = true, desc = "[F]ind [S]pelling suggestion" }
)
vim.keymap.set(
'n',
'<Leader>fgc',
[[<Cmd>lua require('telescope.builtin').git_commits()<CR>]],
{ noremap = true, silent = true, desc = "[F]ind [G]it [C]ommits" }
)
vim.keymap.set(
"n",
'<Leader>fga',
[[<Cmd>lua require('telescope.builtin').git_bcommits()<CR>]],
{ noremap = true, silent = true, desc = "[F]ind [G]it commits for current buffer" }
)
vim.keymap.set(
'n',
'<Leader>fgb',
[[<Cmd>lua require('telescope.builtin').git_branches()<CR>]],
{ noremap = true, silent = true, desc = "[F]ind [G]it [B]ranches" }
)
vim.keymap.set(
'n',
'<Leader>fe',
[[<Cmd>Telescope emoji<CR>]],
{ noremap = true, silent = true, desc = "[F]ind [E]moji" }
)
vim.keymap.set(
'n',
'<Leader>f"',
[[<Cmd>lua require('telescope.builtin').registers()<CR>]],
{ noremap = true, silent = true, desc = "[F]ind registers [\"]" }
)
vim.keymap.set(
'n',
'<Leader>fm',
[[<Cmd>lua require('telescope.builtin').keymaps()<CR>]],
{ noremap = true, silent = true, desc = "[F]ind key [M]appings" }
)
vim.keymap.set(
'n',
'<Leader><tab>',
[[<Cmd>lua require('telescope.builtin').find_files()<CR>]],
{ noremap = true, silent = true, desc = "find files shortcut" }
)
vim.keymap.set(
'n',
'<Leader>ff',
[[<Cmd>lua require('telescope.builtin').find_files()<CR>]],
{ noremap = true, silent = true, desc = "[F]ind [F]iles" }
)
vim.keymap.set(
'n',
'<Leader>fi',
[[<Cmd>lua require('telescope.builtin').builtin()<CR>]],
{ noremap = true, silent = true, desc = "[F]ind telescope f[i]nders" }
)
vim.keymap.set(
'n',
'<Leader>fl',
[[<Cmd>lua require('telescope.builtin').reloader()<CR>]],
{ noremap = true, silent = true, desc = "[F]ind [L]ua module to reload" }
)
vim.keymap.set(
'n',
'<C-p>',
[[<Cmd>lua require('telescope').extensions.project.project({ display_type = 'full' })<CR>]],
{ noremap = true, silent = true, desc = "Find projects" }
)
vim.keymap.set(
'n',
'<leader>`',
[[<Cmd>lua require('session-lens').search_session()<CR>]],
{ noremap = true, silent = true, desc = "Find sessions" }
)

View File

@@ -1,60 +0,0 @@
require("toggleterm").setup({
direction = "horizontal",
open_mapping = [[<C-\>]],
hide_numbers = true,
-- shell = 'fish',
})
vim.keymap.set('n', [[<M-=>]], [[<Cmd>ToggleTerm direction=float<CR>]], { desc = "Toggle terminal in floating window" })
vim.keymap.set('n', [[<M-\>]], [[<Cmd>ToggleTerm direction=horizontal<CR>]], { desc = "Toggle terminal in horizontal bottom window" })
-- tmux muscle-memory for fullscreening nvim window
-- replaced with true-zen.nvim
-- vim.keymap.set('n', [[<C-a>z]], [[<Cmd>ToggleTermToggleAll<CR>]])
-- vim.keymap.set('t', [[<C-a>z]], [[<Cmd>tab split<CR>]])
vim.keymap.set('t', '<Esc>', [[<C-\><C-n>]], { desc = "Escape terminal mode" })
vim.keymap.set('t', '<C-j>', [[<Cmd>wincmd h<CR>]], { desc = "Move focus down one window" })
vim.keymap.set('t', '<C-k>', [[<Cmd>wincmd k<CR>]], { desc = "Move focus up one window" })
vim.keymap.set('t', '<C-h>', [[<Cmd>wincmd h<CR>]], { desc = "Move focus left one window" })
vim.keymap.set('t', '<C-l>', [[<Cmd>wincmd l<CR>]], { desc = "Move focus right one window" })
-- vim.keymap.set('n', '<F12>', [[<Cmd>ToggleTerm<CR>]], { noremap = true, silent = true })
-- vim.keymap.set('t', '<F12>', [[<Cmd>ToggleTerm<CR>]], { noremap = true, silent = true })
-- Custom gitui terminal
local Terminal = require('toggleterm.terminal').Terminal
local gitui = Terminal:new({
cmd = 'gitui',
direction = 'float',
float_opts = {
border = "curved",
width = function() return math.ceil(vim.o.columns * 0.8) end,
height = function() return math.ceil(vim.o.lines * 0.8) end,
winblend = 3,
},
hidden = true,
})
function _gitui_toggle()
gitui:toggle()
end
vim.keymap.set('n', '<leader>G', '<cmd>lua _gitui_toggle()<CR>', { noremap = true, silent = true, desc = "Toggle gitui floating terminal" })
-- Custom clx commandline hacker news terminal
local clx = Terminal:new({
cmd = 'clx',
direction = 'float',
float_opts = {
border = "curved",
width = function() return math.ceil(vim.o.columns * 0.8) end,
height = function() return math.ceil(vim.o.lines * 0.8) end,
winblend = 3,
},
hidden = true,
})
function _clx_toggle()
clx:toggle()
end
vim.keymap.set('n', '<leader>H', '<cmd>lua _clx_toggle()<CR>', { noremap = true, silent = true, desc = "Toggle clx (console HackerNews) floating terminal" })

View File

@@ -0,0 +1,42 @@
return {
"akinsho/toggleterm.nvim",
version = "*",
opts = {
direction = "horizontal",
open_mapping = [[<C-\>]],
hide_numbers = true,
},
cmd = {
"ToggleTerm",
"TermExec",
"ToggleTermSendCurrentLine",
"ToggleTermSendVisualLines",
"ToggleTermSendVisualSelection",
"ToggleTermOpenAll",
"ToggleTermCloseAll",
"ToggleTermToggleAll",
},
keys = {
[[<C-\>]],
{ "<M-=>", [[<Cmd>ToggleTerm direction=float<CR>]], { desc = "Toggle terminal in floating window" } },
{
"<M->",
[[<Cmd>ToggleTerm direction=horizontal<CR>]],
{ desc = "Toggle terminal in horizontal bottom window" },
},
-- tmux muscle-memory for fullscreening nvim window
-- replaced with true-zen.nvim
-- vim.keymap.set('n', [[<C-a>z]], [[<Cmd>ToggleTermToggleAll<CR>]])
-- vim.keymap.set('t', [[<C-a>z]], [[<Cmd>tab split<CR>]])
{ "t", "<Esc>", [[<C-\><C-n>]], { desc = "Escape terminal mode" } },
{ "t", "<C-j>", [[<Cmd>wincmd h<CR>]], { desc = "Move focus down one window" } },
{ "t", "<C-k>", [[<Cmd>wincmd k<CR>]], { desc = "Move focus up one window" } },
{ "t", "<C-h>", [[<Cmd>wincmd h<CR>]], { desc = "Move focus left one window" } },
{ "t", "<C-l>", [[<Cmd>wincmd l<CR>]], { desc = "Move focus right one window" } },
{ "n", [[<C-\>]], [[<Cmd>ToggleTerm<CR>]] },
{ "n", "<F12>", [[<Cmd>ToggleTerm<CR>]] },
{ "t", "<F12>", [[<Cmd>ToggleTerm<CR>]] },
-- { "<leader>H", "<cmd>lua _clx_toggle()<CR>", { desc = "Toggle clx (console HackerNews) floating terminal" } },
-- { "<leader>G", "<cmd>lua _gitui_toggle()<CR>", { desc = "Toggle gitui floating terminal" } },
},
}

View File

@@ -1 +1,7 @@
require('treesj').setup()
return {
"Wansmer/treesj",
keys = {
{ "J", "<cmd>TSJToggle<cr>", desc = "Join Toggle" },
},
opts = { use_default_keymaps = false, max_join_length = 150 },
}

View File

@@ -1,18 +0,0 @@
vim.keymap.set('n', '<leader>xx', '<cmd>TroubleToggle<cr>',
{ silent = true, noremap = true, desc = "Toggle trouble buffer diagnostics" }
)
vim.keymap.set('n', '<leader>xw', '<cmd>TroubleToggle workspace_diagnostics<cr>',
{ silent = true, noremap = true, desc = "Toggle trouble workspace diagnostics" }
)
vim.keymap.set('n', '<leader>xd', '<cmd>TroubleToggle document_diagnostics<cr>',
{ silent = true, noremap = true, desc = "Toggle trouble document diagnostics" }
)
vim.keymap.set('n', '<leader>xl', '<cmd>TroubleToggle loclist<cr>',
{ silent = true, noremap = true, desc = "Toggle trouble diagnostics in loclist" }
)
vim.keymap.set('n', '<leader>xq', '<cmd>TroubleToggle quickfix<cr>',
{ silent = true, noremap = true, desc = "Toggle trouble diagnostics in quickfix" }
)
vim.keymap.set('n', 'gR', '<cmd>TroubleToggle lsp_references<cr>',
{ silent = true, noremap = true, desc = "Toggle trouble LSP [R]eferences under cursor" }
)

View File

@@ -1,10 +0,0 @@
require('true-zen').setup()
vim.keymap.set('n', '<leader>zn', [[<Cmd>:TZNarrow<CR>]], { noremap = true, silent = true, desc = "[Z]oom [N]arrow current line" })
vim.keymap.set('v', '<leader>zn', [[<Cmd>:'<,'>TZNarrow<CR>]], { noremap = true, silent = true, desc = "[Z]oom [N]arrow selected lines" })
vim.keymap.set('n', '<leader>zf', [[<Cmd>:TZFocus<CR>]], { noremap = true, silent = true, desc = "[Z]oom [N]arrow current buffer in new tab" })
vim.keymap.set('n', '<leader>zm', [[<Cmd>:TZMinimalist<CR>]], { noremap = true, silent = true, desc = "[Z] Toggle minimalist nvim UI mode" })
vim.keymap.set('n', '<leader>za', [[<Cmd>:TZAtaraxis<CR>]], { noremap = true, silent = true, desc = "[Z]oom [A]taraxis current buffer minimalist mode" })
-- tmux muscle-memory for fullscreening nvim window
vim.keymap.set('n', [[<C-a>z]], [[<Cmd>:TZFocus<CR>]], { desc = "Toggle [Z]oom current buffer in new tab" })
vim.keymap.set('t', [[<C-a>z]], [[<Cmd>:TZFocus<CR>]], { desc = "Toggle [Z]oom current terminal buffer in new tab" })

14
lua/plugins/true-zen.lua Normal file
View File

@@ -0,0 +1,14 @@
return {
"Pocco81/true-zen.nvim",
cmd = { "TZNarrow", "TZFocus", "TZMinimalist", "TZAtaraxis" },
keys = {
{ "n", "<leader>zn", [[<Cmd>:TZNarrow<CR>]], { desc = "[Z]oom [N]arrow current line" } },
{ "v", "<leader>zn", [[<Cmd>:'<,'>TZNarrow<CR>]], { desc = "[Z]oom [N]arrow selected lines" } },
{ "n", "<leader>zf", [[<Cmd>:TZFocus<CR>]], { desc = "[Z]oom [N]arrow current buffer in new tab" } },
{ "n", "<leader>zm", [[<Cmd>:TZMinimalist<CR>]], { desc = "[Z] Toggle minimalist nvim UI mode" } },
{ "n", "<leader>za", [[<Cmd>:TZAtaraxis<CR>]], { desc = "[Z]oom [A]taraxis current buffer minimalist mode" } },
-- tmux memory for fullscreening nvim window
{ "n", [[<C-a>z]], [[<Cmd>:TZFocus<CR>]], { desc = "Toggle [Z]oom current buffer in new tab" } },
{ "t", [[<C-a>z]], [[<Cmd>:TZFocus<CR>]], { desc = "Toggle [Z]oom current terminal buffer in new tab" } },
},
}

View File

@@ -1,7 +0,0 @@
local on_attach = require('plugins.lsp.on_attach')
require('typescript').setup({
server = { -- pass options to lspconfig's setup method
on_attach = on_attach,
},
})

View File

@@ -1 +0,0 @@
vim.keymap.set('n', '<leader>u', [[<Cmd>MundoToggle<CR>]], { noremap = true, silent = true, desc = "Toggle [U]ndo UI"})

View File

@@ -0,0 +1 @@
return { "justinsgithub/wezterm-types" }

View File

@@ -1 +0,0 @@
require('which-key').setup()

View File

@@ -1,11 +0,0 @@
require('winshift').setup()
vim.keymap.set('n', '<C-W><C-M>', [[<Cmd>WinShift<CR>]], { noremap = true, silent = true })
vim.keymap.set('n', '<C-W>m', [[<Cmd>WinShift<CR>]], { noremap = true, silent = true })
vim.keymap.set('n', '<C-W>X', [[<Cmd>WinShift swap<CR>]], { noremap = true, silent = true })
vim.keymap.set('n', '<C-M-H>', [[<Cmd>WinShift left<CR>]], { noremap = true, silent = true })
vim.keymap.set('n', '<C-M-J>', [[<Cmd>WinShift down<CR>]], { noremap = true, silent = true })
vim.keymap.set('n', '<C-M-K>', [[<Cmd>WinShift up<CR>]], { noremap = true, silent = true })
vim.keymap.set('n', '<C-M-L>', [[<Cmd>WinShift right<CR>]], { noremap = true, silent = true })