big update again

This commit is contained in:
2024-09-05 07:22:41 -04:00
parent 7c6f52de48
commit dde724ef34
18 changed files with 452 additions and 360 deletions

View File

@@ -1,5 +1,3 @@
local api = vim.api
local g = vim.g
local opt = vim.opt
-- Bootstrap lazy.nvim
@@ -19,11 +17,6 @@ if not (vim.uv or vim.loop).fs_stat(lazypath) then
end
vim.opt.rtp:prepend(lazypath)
-- Remap leader and local leader to <Space>
api.nvim_set_keymap("", "<Space>", "<Nop>", { noremap = true, silent = true })
g.mapleader = " "
g.maplocalleader = ","
-- Setup lazy.nvim
require("lazy").setup({
spec = {
@@ -33,34 +26,20 @@ require("lazy").setup({
checker = { enabled = true },
})
vim.cmd 'colorscheme catppuccin-frappe'
-- Load core settings
opt.termguicolors = true -- Enable colors in terminal
opt.hlsearch = false -- turn off highlight on search
opt.incsearch = true -- Keep incremental highlighting on search
opt.number = true --Make line numbers default
opt.relativenumber = true --Make relative number default
opt.mouse = "a" --Enable mouse mode
opt.breakindent = true --Enable break indent
opt.undofile = true --Save undo history
opt.ignorecase = true --Case insensitive searching unless /C or capital in search
opt.smartcase = true -- Smart case
opt.updatetime = 50 --Decrease update time
opt.signcolumn = 'yes' -- Always show sign column
opt.clipboard = 'unnamedplus' -- Access system clipboard
opt.laststatus = 3 -- Global status line
opt.swapfile = false
opt.wrap = false
vim.opt_local.conceallevel = 2
vim.opt.inccommand = 'split'
-- Time in milliseconds to wait for a mapped sequence to complete.
opt.timeoutlen = 300
opt.showmode = false -- Do not need to show the mode. We use the statusline instead.
opt.scrolloff = 10 -- Lines of context
opt.smartindent = true --Smart indent
opt.expandtab = true
opt.smarttab = true
opt.textwidth = 0
@@ -68,15 +47,8 @@ opt.autoindent = true
opt.shiftwidth = 2
opt.tabstop = 2
opt.softtabstop = 2
opt.splitbelow = true
opt.splitright = true
opt.cursorline = true
opt.guifont = "Iosevka Nerd Font Mono"
-- Remappings
vim.keymap.set("v", "J", ":m '>+1<CR>gv=gv")
vim.keymap.set("v", "K", ":m '<-2<CR>gv=gv")
vim.keymap.set("n", "<C-d>", "<C-d>zz")
vim.keymap.set("n", "<C-u>", "<C-u>zz")
vim.keymap.set("n", "n", "nzzzv")
@@ -90,16 +62,4 @@ vim.keymap.set({"n", "v"}, "<leader>d", [["_d]])
vim.keymap.set("n", "Q", "<nop>")
vim.keymap.set("n", "<c-f>", "<nop>")
vim.keymap.set("n", "<C-f>", "<cmd>silent !tmux neww tmux-sessionizer<CR>")
vim.keymap.set("n", "J", "mzJ`z")
vim.keymap.set("i", "jk", "<Esc>")
vim.api.nvim_create_autocmd('TextYankPost', {
desc = 'Highlight when yanking (copying) text',
group = vim.api.nvim_create_augroup('highlight-yank', { clear = true }),
callback = function()
vim.highlight.on_yank()
end,
})

View File

@@ -1,24 +0,0 @@
return {
"catppuccin/nvim",
name = "catppuccin",
priority = 1000,
opts = {
integrations = {
cmp = true,
gitsigns = true,
treesitter = true,
fidget = true,
harpoon = true,
leap = true,
mason = true,
mini = {
enabled = true,
},
neotest = true,
markdown = true,
telescope = {
enabled = true,
},
},
},
}

View File

@@ -1,10 +0,0 @@
return {
'j-hui/fidget.nvim',
opts = {
notification = {
window = {
winblend = 0,
},
}
}
}

View File

@@ -1,12 +0,0 @@
return { -- Adds git related signs to the gutter, as well as utilities for managing changes
'lewis6991/gitsigns.nvim',
opts = {
signs = {
add = { text = '+' },
change = { text = '~' },
delete = { text = '_' },
topdelete = { text = '' },
changedelete = { text = '~' },
}
}
}

View File

@@ -1,6 +0,0 @@
return {
'ggandor/leap.nvim',
config = function()
require("leap").set_default_keymaps()
end
}

View File

@@ -1,52 +0,0 @@
return { -- Linting
'mfussenegger/nvim-lint',
event = { 'BufReadPre', 'BufNewFile' },
config = function()
local lint = require 'lint'
lint.linters_by_ft = {
vue = { 'stylelint' },
}
-- To allow other plugins to add linters to require('lint').linters_by_ft,
-- instead set linters_by_ft like this:
-- lint.linters_by_ft = lint.linters_by_ft or {}
-- lint.linters_by_ft['markdown'] = { 'markdownlint' }
--
-- However, note that this will enable a set of default linters,
-- which will cause errors unless these tools are available:
-- {
-- clojure = { "clj-kondo" },
-- dockerfile = { "hadolint" },
-- inko = { "inko" },
-- janet = { "janet" },
-- json = { "jsonlint" },
-- markdown = { "vale" },
-- rst = { "vale" },
-- ruby = { "ruby" },
-- terraform = { "tflint" },
-- text = { "vale" }
-- }
--
-- You can disable the default linters by setting their filetypes to nil:
-- lint.linters_by_ft['clojure'] = nil
-- lint.linters_by_ft['dockerfile'] = nil
-- lint.linters_by_ft['inko'] = nil
-- lint.linters_by_ft['janet'] = nil
-- lint.linters_by_ft['json'] = nil
-- lint.linters_by_ft['markdown'] = nil
-- lint.linters_by_ft['rst'] = nil
-- lint.linters_by_ft['ruby'] = nil
-- lint.linters_by_ft['terraform'] = nil
-- lint.linters_by_ft['text'] = nil
-- Create autocommand which carries out the actual linting
-- on the specified events.
local lint_augroup = vim.api.nvim_create_augroup('lint', { clear = true })
vim.api.nvim_create_autocmd({ 'BufEnter', 'BufWritePost', 'InsertLeave' }, {
group = lint_augroup,
callback = function()
require('lint').try_lint()
end,
})
end,
}

View File

@@ -1,112 +1,183 @@
return {
'VonHeikemen/lsp-zero.nvim',
branch = 'v3.x',
dependencies = {
-- LSP Support
{'neovim/nvim-lspconfig'}, -- Required
-- {'williamboman/mason.nvim'}, -- Optional
-- {'williamboman/mason-lspconfig.nvim'}, -- Optional
-- Autocompletion
{'hrsh7th/nvim-cmp'}, -- Required
{'hrsh7th/cmp-nvim-lsp'}, -- Required
{'L3MON4D3/LuaSnip'}, -- Required
{'saadparwaiz1/cmp_luasnip'},
{'onsails/lspkind.nvim'} -- Optional
{
'folke/lazydev.nvim',
ft = 'lua',
opts = {
library = {
{ path = 'luvit-meta/library', words = { 'vim%.uv' } },
},
},
},
config = function()
local lsp_zero = require('lsp-zero')
{ 'Bilal2453/luvit-meta', lazy = true },
{
'neovim/nvim-lspconfig',
cmd = 'LspInfo',
event = {'BufReadPre', 'BufNewFile'},
config = function()
vim.api.nvim_create_autocmd('LspAttach', {
group = vim.api.nvim_create_augroup('lsp-attach', { clear = true }),
callback = function(event)
local map = function(keys, func, desc, mode)
mode = mode or 'n'
vim.keymap.set(mode, keys, func, { buffer = event.buf, desc = "LSP: " .. desc })
end
lsp_zero.on_attach(function(client, bufnr)
local opts = {buffer = bufnr, remap = false}
map("gd", function() vim.lsp.buf.definition() end, 'goto defintion')
map("gr", function() vim.lsp.buf.references() end, 'goto references')
map("K", function() vim.lsp.buf.hover() end, 'hover')
map("<leader>ws", function() vim.lsp.buf.workspace_symbol() end, 'workspace symbols')
map("<leader>d", function() vim.diagnostic.open_float() end, 'diagnostic float')
map("[d", function() vim.diagnostic.jump({ count = 1, float = true }) end, 'next diagnostic')
map("]d", function() vim.diagnostic.jump({ count = -1, float = true }) end, 'prev diagnostic')
map("<leader>ca", function() vim.lsp.buf.code_action() end, 'code actions')
map("<leader>rn", function() vim.lsp.buf.rename() end, 'rename')
map("<C-h>", function() vim.lsp.buf.signature_help() end, 'signature help', "i")
end
})
vim.keymap.set("n", "gd", function() vim.lsp.buf.definition() end, opts)
vim.keymap.set("n", "gr", function() vim.lsp.buf.references() end, opts)
vim.keymap.set("n", "K", function() vim.lsp.buf.hover() end, opts)
vim.keymap.set("n", "<leader>ws", function() vim.lsp.buf.workspace_symbol() end, opts)
vim.keymap.set("n", "<leader>d", function() vim.diagnostic.open_float() end, opts)
vim.keymap.set("n", "[d", function() vim.diagnostic.goto_next() end, opts)
vim.keymap.set("n", "]d", function() vim.diagnostic.goto_prev() end, opts)
vim.keymap.set("n", "<leader>ca", function() vim.lsp.buf.code_action() end, opts)
vim.keymap.set("n", "<leader>rn", function() vim.lsp.buf.rename() end, opts)
vim.keymap.set("i", "<C-h>", function() vim.lsp.buf.signature_help() end, opts)
end)
local capabilities = vim.lsp.protocol.make_client_capabilities()
capabilities = vim.tbl_deep_extend('force', capabilities, require('cmp_nvim_lsp').default_capabilities())
-- Mason Config
-- require('mason').setup({})
-- require('mason-lspconfig').setup({
-- ensure_installed = {},
-- handlers = {
-- lsp_zero.default_setup,
-- }
-- })
-- Server configs
local lsp = require('lspconfig')
-- cmp Config
-- vue
lsp.volar.setup({
capabilities = capabilities,
})
local cmp = require('cmp')
local cmp_action = require('lsp-zero').cmp_action()
-- typescript / javascript
require'lspconfig'.ts_ls.setup{
capabilities = capabilities,
init_options = {
plugins = {
{
name = "@vue/typescript-plugin",
location = "",
languages = {"javascript", "typescript", "vue"},
},
},
},
filetypes = { "javascript", "javascriptreact", "javascript.jsx", "typescript", "typescriptreact", "typescript.tsx", "vue" }
}
cmp.setup({
sources = {
{name = 'path'},
{name = 'nvim_lsp'},
{name = 'nvim_lua'},
{name = 'luasnip'},
{name = 'cmp_luasnip'},
{name = 'buffer'},
{name = 'neorg'}
-- eslint
lsp.eslint.setup({
capabilities = capabilities,
})
-- tailwind
lsp.tailwindcss.setup({
capabilities = capabilities,
root_dir = lsp.util.root_pattern('tailwind.config.js', 'tailwind.config.cjs', 'tailwind.config.mjs', 'tailwind.config.ts')
})
-- html
lsp.html.setup({
capabilities = capabilities,
})
-- go
lsp.gopls.setup({
capabilities = capabilities,
settings = {
gopls = {
usePlaceholders = true,
}
}
})
lsp.golangci_lint_ls.setup({
capabilities = capabilities,
})
-- templ
vim.filetype.add({ extension = { templ = "templ" } })
lsp.templ.setup({
capabilities = capabilities,
})
lsp.lua_ls.setup({
capabilities = capabilities,
})
lsp.nil_ls.setup({
capabilities = capabilities,
})
end,
},
{
'hrsh7th/nvim-cmp',
event = 'InsertEnter',
dependencies = {
{
'L3MON4D3/LuaSnip',
build = (function()
-- Build Step is needed for regex support in snippets.
-- This step is not supported in many windows environments.
-- Remove the below condition to re-enable on windows.
if vim.fn.has 'win32' == 1 or vim.fn.executable 'make' == 0 then
return
end
return 'make install_jsregexp'
end)(),
dependencies = {
{
'rafamadriz/friendly-snippets',
config = function()
require('luasnip.loaders.from_vscode').lazy_load()
end,
},
},
},
window = {
completion = cmp.config.window.bordered(),
documentation = cmp.config.window.bordered(),
},
formatting = {
fields = {'abbr', 'kind', 'menu'},
format = require('lspkind').cmp_format({
mode = 'symbol', -- show only symbol annotations
maxwidth = 50, -- prevent the popup from showing more than provided characters
ellipsis_char = '...', -- when popup menu exceed maxwidth, the truncated part would show ellipsis_char instead
})
},
mapping = cmp.mapping.preset.insert({
['<CR>'] = cmp.mapping.confirm({select = false}),
-- scroll up and down the documentation window
['<C-u>'] = cmp.mapping.scroll_docs(-4),
['<C-d>'] = cmp.mapping.scroll_docs(4),
-- ['<Tab>'] = cmp_action.luasnip_supertab(),
-- ['<S-Tab>'] = cmp_action.luasnip_shift_supertab(),
}),
})
'saadparwaiz1/cmp_luasnip',
'hrsh7th/cmp-nvim-lsp',
'hrsh7th/cmp-path',
},
config = function()
-- See `:help cmp`
local cmp = require 'cmp'
local luasnip = require 'luasnip'
luasnip.config.setup {}
-- Server configs
local lsp = require('lspconfig')
-- vue
lsp.volar.setup({})
-- typescript / javascript
require'lspconfig'.tsserver.setup{
filetypes = { "javascript", "javascriptreact", "javascript.jsx", "typescript", "typescriptreact", "typescript.tsx", "vue" }
}
-- eslint
lsp.eslint.setup({})
-- tailwind
lsp.tailwindcss.setup({
root_dir = lsp.util.root_pattern('tailwind.config.js', 'tailwind.config.cjs', 'tailwind.config.mjs', 'tailwind.config.ts')
})
-- html
lsp.html.setup({})
-- go
lsp.gopls.setup({})
lsp.golangci_lint_ls.setup{}
-- templ
vim.filetype.add({ extension = { templ = "templ" } })
lsp.templ.setup{}
end,
cmp.setup {
snippet = {
expand = function(args)
luasnip.lsp_expand(args.body)
end,
},
completion = { completeopt = 'menu,menuone,noinsert' },
mapping = cmp.mapping.preset.insert {
['<C-n>'] = cmp.mapping.select_next_item(),
['<C-p>'] = cmp.mapping.select_prev_item(),
['<C-b>'] = cmp.mapping.scroll_docs(-4),
['<C-f>'] = cmp.mapping.scroll_docs(4),
['<C-y>'] = cmp.mapping.confirm { select = true },
['<C-Space>'] = cmp.mapping.complete {},
['<C-l>'] = cmp.mapping(function()
if luasnip.expand_or_locally_jumpable() then
luasnip.expand_or_jump()
end
end, { 'i', 's' }),
['<C-h>'] = cmp.mapping(function()
if luasnip.locally_jumpable(-1) then
luasnip.jump(-1)
end
end, { 'i', 's' }),
},
sources = {
{
name = 'lazydev',
-- set group index to 0 to skip loading LuaLS completions as lazydev recommends it
group_index = 0,
},
{ name = 'nvim_lsp' },
{ name = 'luasnip' },
{ name = 'path' },
},
}
end,
},
{
'nvim-tree/nvim-web-devicons',
}
}

View File

@@ -1,12 +0,0 @@
return {
"L3MON4D3/LuaSnip",
dependencies = { "rafamadriz/friendly-snippets" },
-- follow latest release.
version = "v2.*", -- Replace <CurrentMajor> by the latest released major (first number of latest release)
-- install jsregexp (optional!).
build = "make install_jsregexp",
config = function ()
require('luasnip.loaders.from_vscode').lazy_load()
end
}

View File

@@ -1,5 +1,6 @@
return { -- Collection of various small independent plugins/modules
'echasnovski/mini.nvim',
version = false,
config = function()
local keymap = vim.keymap.set
@@ -14,17 +15,37 @@ return { -- Collection of various small independent plugins/modules
return '%2l:%-2v'
end
require('mini.basics').setup({
options = {
extra_ui = true,
win_borders = "bold"
}
})
require('mini.comment').setup()
require('mini.icons').setup()
-- local icons = require('mini.icons')
-- icons.setup()
-- icons.tweak_lsp_kind()
require('mini.cursorword').setup()
require('mini.indentscope').setup({
draw = {
delay = 0,
animation = require('mini.indentscope').gen_animation.none()
}
})
require('mini.diff').setup()
require('mini.extra').setup()
files = require('mini.files')
require('mini.jump').setup()
require('mini.jump2d').setup()
local files = require('mini.files')
files.setup()
keymap("n", "<leader>fe", files.open, { noremap = true, silent = true })
keymap("n", "<leader>fe", function() files.open(vim.api.nvim_buf_get_name(0)) end, { noremap = true, silent = true })
require('mini.git').setup()
@@ -53,10 +74,43 @@ return { -- Collection of various small independent plugins/modules
keymap("n", "<leader>ff", pick.builtin.files, { noremap = true, silent = true })
keymap("n", "<leader>fg", pick.builtin.grep_live, { noremap = true, silent = true })
keymap("n", "<leader>fwg", function()
local wrd = vim.fn.expand("<cWORD>")
local wrd = vim.fn.expand("<cword>")
pick.builtin.grep_live({ pattern = wrd })
end, { noremap = true, silent = true })
-- require('mini.base16').setup({
-- palette = {
-- base00 = "#303446",
-- base01 = "#292c3c",
-- base02 = "#414559",
-- base03 = "#51576d",
-- base04 = "#626880",
-- base05 = "#c6d0f5",
-- base06 = "#f2d5cf",
-- base07 = "#babbf1",
-- base08 = "#e78284",
-- base09 = "#ef9f76",
-- base0A = "#e5c890",
-- base0B = "#a6d189",
-- base0C = "#81c8be",
-- base0D = "#8caaee",
-- base0E = "#ca9ee6",
-- base0F = "#eebebe",
-- }
-- })
--
-- require('mini.hues').setup({
-- foreground = '#fbf7f0',
-- background = '#000000',
-- n_hues = 4,
-- accent = 'bg',
-- saturation = 'high'
-- })
-- require('mini.completion').setup()
require('mini.splitjoin').setup()
require('mini.trailspace').setup()
end,
}

View File

@@ -1,43 +0,0 @@
return {
"nvim-neorg/neorg",
lazy = false,
version = "*",
config = function()
require("neorg").setup({
load = {
["core.defaults"] = {},
["core.completion"] = { config = { engine = "nvim-cmp", name = "[Neorg]" } },
["core.integrations.nvim-cmp"] = {},
["core.concealer"] = {},
["core.keybinds"] = {
config = {
default_keybinds = true,
},
},
["core.dirman"] = {
config = {
workspaces = {
notes = "~/notes",
}
}
},
["core.esupports.metagen"] = { config = { type = "auto", update_date = true } },
["core.qol.toc"] = {},
["core.qol.todo_items"] = {},
["core.looking-glass"] = {},
["core.presenter"] = { config = { zen_mode = "zen-mode" } },
["core.export"] = {},
["core.export.markdown"] = { config = { extensions = "all" } },
["core.summary"] = {},
["core.tangle"] = { config = { report_on_empty = false } },
["core.ui.calendar"] = {},
["core.journal"] = {
config = {
strategy = "flat",
workspace = "notes",
},
},
},
})
end,
}

View File

@@ -1,3 +0,0 @@
return {
'windwp/nvim-ts-autotag',
}

View File

@@ -0,0 +1,7 @@
return {
"shatur/neovim-ayu",
config = function()
require('ayu').setup({})
vim.cmd.colorscheme "ayu"
end
}