This commit is contained in:
2023-02-25 17:12:20 +01:00
parent 265e4df8f3
commit 2f600e438b
19 changed files with 982 additions and 246 deletions

View File

@@ -1,6 +1,5 @@
local luasnip = require("luasnip")
require("luasnip/loaders/from_vscode").lazy_load()
require("max.configs.snippets")
local lspkind = require("lspkind")
local cmp = require("cmp")
@@ -60,8 +59,8 @@ cmp.setup({
["<S-Tab>"] = cmp.mapping(function(fallback)
if cmp.visible() then
cmp.select_prev_item()
elseif luasnip.jumpable(-1) then
luasnip.jump(-1)
elseif luasnip.jumpable( -1) then
luasnip.jump( -1)
else
fallback()
end

View File

@@ -2,29 +2,19 @@ local mason = require("mason")
local mason_lsp = require("mason-lspconfig")
local lsp = require("lspconfig")
-- local null_ls = require("null-ls")
-- null_ls.setup({
-- sources = {
-- -- null_ls.builtins.formatting.stylua,
-- -- null_ls.builtins.code_actions.eslint_d,
-- -- null_ls.builtins.formatting.prettierd
-- -- require("null-ls").builtins.completion.spell,
-- },
-- })
local null_ls = require("null-ls")
null_ls.setup({
sources = {
null_ls.builtins.diagnostics.eslint_d,
},
})
mason.setup()
mason_lsp.setup({
ensure_installed = { "sumneko_lua", "jsonls", "tsserver", "svelte", "cssls" },
ensure_installed = { "lua_ls", "jsonls", "tsserver", "svelte", "cssls", "prismals" },
})
local runtime_path = vim.split(package.path, ";")
table.insert(runtime_path, "lua/?.lua")
table.insert(runtime_path, "lua/?/init.lua")
local function on_attach(client, bufnr)
-- disable semantic tokens
-- client.server_capabilities.semanticTokensProvider = nil
if client.supports_method("textDocument/formatting") then
vim.api.nvim_create_autocmd("BufWritePre", {
buffer = bufnr,
@@ -63,7 +53,10 @@ custom_lsp.tsserver = {
root_dir = lsp.util.root_pattern("tsconfig.json", "package.json", "jsconfig.json", ".git"),
}
custom_lsp.sumneko_lua = {
local runtime_path = vim.split(package.path, ";")
table.insert(runtime_path, "lua/?.lua")
table.insert(runtime_path, "lua/?/init.lua")
custom_lsp.lua_ls = {
settings = {
Lua = {
runtime = {

View File

@@ -45,9 +45,9 @@ local config = {
-- Disable sections and component separators
component_separators = "",
section_separators = "",
globalstatus = true,
theme = require("max.theme").name,
},
-- These are to remove the defaults
sections = {
lualine_a = {},
@@ -131,31 +131,33 @@ ins_left({
})
ins_left {
'lsp_progress',
display_components = { 'lsp_client_name', { 'title', 'percentage', 'message' }},
-- With spinner
-- display_components = { 'lsp_client_name', 'spinner', { 'title', 'percentage', 'message' }},
colors = {
percentage = colors.cyan,
title = colors.cyan,
message = colors.cyan,
spinner = colors.cyan,
lsp_client_name = colors.magenta,
use = true,
},
separators = {
component = ' ',
progress = ' | ',
message = { pre = '(', post = ')'},
percentage = { pre = '', post = '%% ' },
title = { pre = '', post = ': ' },
lsp_client_name = { pre = '[', post = ']' },
spinner = { pre = '', post = '' },
message = { commenced = 'In Progress', completed = 'Completed' },
},
display_components = { 'lsp_client_name', 'spinner', { 'title', 'percentage', 'message' } },
timer = { progress_enddelay = 500, spinner = 1000, lsp_client_name_enddelay = 1000 },
spinner_symbols = { '🌑 ', '🌒 ', '🌓 ', '🌔 ', '🌕 ', '🌖 ', '🌗 ', '🌘 ' },
require("recorder").recordingStatus
}
ins_left {
'lsp_progress',
display_components = { 'lsp_client_name', { 'title', 'percentage', 'message' } },
-- With spinner
-- display_components = { 'lsp_client_name', 'spinner', { 'title', 'percentage', 'message' }},
colors = {
percentage = colors.cyan,
title = colors.cyan,
message = colors.cyan,
spinner = colors.cyan,
lsp_client_name = colors.magenta,
use = true,
},
separators = {
component = ' ',
progress = ' | ',
message = { pre = '(', post = ')' },
percentage = { pre = '', post = '%% ' },
title = { pre = '', post = ': ' },
lsp_client_name = { pre = '[', post = ']' },
spinner = { pre = '', post = '' },
},
timer = { progress_enddelay = 500, spinner = 1000, lsp_client_name_enddelay = 1000 },
spinner_symbols = { '🌑 ', '🌒 ', '🌓 ', '🌔 ', '🌕 ', '🌖 ', '🌗 ', '🌘 ' },
}
-- Git Diff

View File

@@ -0,0 +1,15 @@
return {
"nvim-neo-tree/neo-tree.nvim",
cmd = "Neotree",
dependencies = {
"nvim-lua/plenary.nvim",
"nvim-tree/nvim-web-devicons", -- not strictly required, but recommended
"MunifTanjim/nui.nvim"
},
init = function()
vim.g.neo_tree_remove_legacy_commands = 1
require("neo-tree").setup({
hide_root_node = true,
})
end,
}

View File

@@ -0,0 +1,159 @@
return {
"nvim-tree/nvim-tree.lua",
cmd = "NvimTreeToggle",
dependencies = {
"nvim-tree/nvim-web-devicons",
},
opts = {
auto_reload_on_write = true,
create_in_closed_folder = false,
disable_netrw = false,
hijack_cursor = false,
hijack_netrw = true,
hijack_unnamed_buffer_when_opening = false,
ignore_buffer_on_setup = false,
open_on_setup = false,
open_on_setup_file = false,
open_on_tab = false,
sort_by = "name",
update_cwd = true,
reload_on_bufenter = true,
respect_buf_cwd = false,
view = {
adaptive_size = false,
width = 35,
hide_root_folder = true,
side = "left",
preserve_window_proportions = false,
number = false,
relativenumber = false,
signcolumn = "yes",
mappings = {
list = {
{ key = "d", action = "trash" },
{ key = "D", action = "remove" },
},
},
},
renderer = {
add_trailing = false,
group_empty = true,
highlight_git = true,
highlight_opened_files = "none",
indent_markers = {
enable = true,
icons = {
corner = "",
edge = "",
none = "",
},
},
icons = {
webdev_colors = true,
git_placement = "signcolumn",
padding = " ",
symlink_arrow = "",
show = {
file = true,
folder = true,
folder_arrow = true,
git = false,
},
glyphs = {
default = "",
symlink = "",
folder = {
default = "",
empty = "",
empty_open = "",
open = "",
symlink = "",
symlink_open = "",
arrow_open = "",
arrow_closed = "",
},
git = {
unstaged = "",
staged = "",
unmerged = "",
renamed = "",
untracked = "",
deleted = "",
ignored = "",
},
},
},
special_files = { "Cargo.toml", "Makefile", "README.md", "readme.md", "package.json" },
},
hijack_directories = {
enable = true,
auto_open = true,
},
update_focused_file = {
enable = true,
update_cwd = true,
ignore_list = {},
},
ignore_ft_on_setup = {},
system_open = {
cmd = "",
args = {},
},
diagnostics = {
enable = false,
show_on_dirs = false,
},
filters = {
dotfiles = false,
custom = {
"^.git$",
},
exclude = {},
},
git = {
enable = true,
ignore = false,
timeout = 400,
},
actions = {
use_system_clipboard = true,
change_dir = {
enable = true,
global = false,
restrict_above_cwd = false,
},
open_file = {
quit_on_open = true,
resize_window = true,
window_picker = {
enable = true,
chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890",
exclude = {
filetype = { "notify", "packer", "qf", "diff", "fugitive", "fugitiveblame" },
buftype = { "nofile", "terminal", "help" },
},
},
},
},
trash = {
cmd = "trash",
require_confirm = true,
},
live_filter = {
prefix = "[FILTER]: ",
always_show_folders = true,
},
log = {
enable = false,
truncate = false,
types = {
all = false,
config = false,
copy_paste = false,
diagnostics = false,
git = false,
profile = false,
},
},
},
}

View File

@@ -1,16 +1,3 @@
require("persisted").setup({
autoload = true,
before_save = function()
local tree = pcall(require, "nvim-tree")
if tree then
vim.cmd("Neotree close")
end
end,
after_save = function()
vim.cmd("Neotree show")
end,
after_source = function()
vim.lsp.stop_client(vim.lsp.get_active_clients())
vim.cmd("filetype detect")
end,
})

View File

@@ -0,0 +1,38 @@
local Terminal = require("toggleterm.terminal").Terminal
local lazygit = Terminal:new({
cmd = "lazygit",
dir = "git_dir",
direction = "float",
float_opts = {
winblend = 0,
border = "shadow",
},
on_close = function()
Terminal:close()
end,
})
function _Lazygit_toggle()
lazygit:toggle()
end
vim.api.nvim_set_keymap("n", "<C-g>", "<cmd>lua _Lazygit_toggle()<CR>", { noremap = true, silent = true })
local pnpm = Terminal:new({
dir = "git_dir",
direction = "float",
float_opts = {
winblend = 0,
padding = 10,
border = "shadow",
},
on_close = function()
Terminal:close()
end,
})
function _Pnpm_toggle()
pnpm:toggle()
end
vim.api.nvim_set_keymap("n", "<C-t>", "<cmd>lua _Pnpm_toggle()<CR>", { noremap = true, silent = true })

View File

@@ -20,11 +20,11 @@ require("nvim-treesitter.configs").setup({
"tsx",
"go",
"lua",
"json",
"yaml",
"prisma",
},
highlight = { enable = true, disable = { "tsx" } },
highlight = { enable = true },
textobjects = {
select = {
enable = true,

View File

@@ -30,12 +30,12 @@ map("n", "K", ":lua vim.lsp.buf.hover()<CR>", opts)
map("n", "<Leader>rn", ":lua vim.lsp.buf.rename()<CR>", opts)
map({ "n", "v" }, "<Leader>c", ":Lspsaga code_action<CR>", { silent = true })
map({ "n", "v" }, "<Leader>c", ":lua vim.lsp.buf.code_action()<CR>", { silent = true })
map({ "n", "v" }, "gr", ":Lspsaga lsp_finder<CR>", opts)
map("n", "<Leader>u", ":UndotreeToggle<CR>", opts)
map("n", "<Leader>wq", ":wqall!<CR>", opts)
map("n", "<Leader>li", ":LspInfo<CR>", opts)
map("n", "<Leader>lr", ":LspRestart<CR>", opts)
-- This is my [i]nspect section,
map("n", "<Leader>is", ":SymbolsOutline<cr>", opts) -- [i]nspect [s]ymbols
@@ -92,6 +92,7 @@ map("v", "p", '"_dP', opts)
-- clear highlights after search
map("n", "<leader>cl", ":noh<CR>", opts);
map("n", "<leader>m", ":Mason<CR>", opts);
map("n", "<leader>l", ":Lazy<CR>", opts);

View File

@@ -1,8 +1,15 @@
vim.g.mapleader = " "
vim.g.maplocalleader = " "
local g = vim.g
local opt = vim.opt
g.mapleader = " "
g.maplocalleader = " "
g.loaded_netrwPlugin = 1
g.loaded_netrw = 1
g.loaded_netrwSettings = 1
g.loaded_netrwFileHandlers = 1
g.loaded_netrw_gitignore = 1
opt.autowrite = true -- Enable auto write
opt.clipboard = "unnamedplus" -- Sync with system clipboard
opt.completeopt = "menu,menuone,noselect"

View File

@@ -11,12 +11,14 @@ local plugins = {
---------------------
-- Theming Section --
---------------------
require("max.theme"),
--------------------
-- Layout Plugins --
--------------------
"nvim-lua/popup.nvim",
require("max.configs.neotree"),
{
"nvim-lualine/lualine.nvim",
lazy = false,
@@ -42,12 +44,19 @@ local plugins = {
})
end
},
{ "shortcuts/no-neck-pain.nvim", cmd = "NoNeckPain", config = true },
{
"shortcuts/no-neck-pain.nvim",
cmd = "NoNeckPain",
config = true
},
{
"folke/noice.nvim",
event = "VeryLazy",
opts = {
lsp = {
progress = {
enabled = false
},
override = {
["vim.lsp.util.convert_input_to_markdown_lines"] = true,
["vim.lsp.util.stylize_markdown"] = true,
@@ -61,27 +70,16 @@ local plugins = {
},
},
keys = {
{ "<S-Enter>", function() require("noice").redirect(vim.fn.getcmdline()) end, mode = "c", desc = "Redirect Cmdline" },
{ "<leader>snl", function() require("noice").cmd("last") end, desc = "Noice Last Message" },
{ "<leader>snh", function() require("noice").cmd("history") end, desc = "Noice History" },
{ "<leader>sna", function() require("noice").cmd("all") end, desc = "Noice All" },
{ "<S-Enter>", function() require("noice").redirect(vim.fn.getcmdline()) end, mode = "c", desc = "Redirect Cmdline" },
{ "<leader>snl", function() require("noice").cmd("last") end, desc = "Noice Last Message" },
{ "<leader>snh", function() require("noice").cmd("history") end, desc = "Noice History" },
{ "<leader>sna", function() require("noice").cmd("all") end, desc = "Noice All" },
},
},
{
"stevearc/dressing.nvim",
enabled = false,
lazy = true,
init = function()
---@diagnostic disable-next-line: duplicate-set-field
vim.ui.select = function(...)
require("lazy").load({ plugins = { "dressing.nvim" } })
return vim.ui.select(...)
end
---@diagnostic disable-next-line: duplicate-set-field
vim.ui.input = function(...)
require("lazy").load({ plugins = { "dressing.nvim" } })
return vim.ui.input(...)
end
end,
},
{
"folke/which-key.nvim",
@@ -110,12 +108,16 @@ local plugins = {
require("gitsigns").setup()
end,
},
{
"akinsho/nvim-toggleterm.lua",
event = "VeryLazy",
config = function()
require("max.configs.toggleterm");
end,
},
{
"akinsho/git-conflict.nvim",
version = "*",
dependencies = {
"akinsho/nvim-toggleterm.lua",
},
event = "BufReadPost",
config = function()
require("git-conflict").setup()
@@ -134,22 +136,6 @@ local plugins = {
dependencies = "kevinhwang91/promise-async",
config = require("max.configs.ufo"),
},
{
"nvim-neo-tree/neo-tree.nvim",
cmd = "Neotree",
dependencies = {
"nvim-lua/plenary.nvim",
"nvim-tree/nvim-web-devicons", -- not strictly required, but recommended
"MunifTanjim/nui.nvim"
},
init = function()
vim.g.neo_tree_remove_legacy_commands = 1
require("neo-tree").setup({
hide_root_node = true,
highlight_background = "Normal",
})
end,
},
{
"goolord/alpha-nvim",
lazy = false,
@@ -159,7 +145,7 @@ local plugins = {
}, -- startup screen
{
"numToStr/Comment.nvim",
event = "InsertEnter",
event = "BufReadPost",
config = function()
require("Comment").setup()
end,
@@ -211,7 +197,7 @@ local plugins = {
"onsails/lspkind.nvim",
{ "lukas-reineke/lsp-format.nvim", config = true },
},
event = "InsertEnter",
event = "BufReadPost",
config = function()
require("max.configs.lsp")
end,
@@ -252,11 +238,12 @@ local plugins = {
config = function()
require("boole").setup({
mappings = {
increment = '-',
decrement = '+'
increment = '+',
decrement = '-'
},
additions = {
{ "const", "let", "var" }
{ "const", "let", "var" },
{ "absolute", "relative", "fixed", "sticky" }
}
})
end,
@@ -295,6 +282,23 @@ local plugins = {
--------------------
-- IDE Type Stuff --
--------------------
{
"rest-nvim/rest.nvim",
cmd = "RestNvim",
dependencies = { "nvim-lua/plenary.nvim" },
config = function()
require("rest-nvim").setup({})
end
},
{
"chrisgrieser/nvim-recorder",
event = "VeryLazy",
config = function()
require("recorder").setup({
logLevel = vim.log.levels.OFF,
})
end,
},
{
"jackMort/ChatGPT.nvim",
cmd = "ChatGPT",
@@ -358,6 +362,39 @@ local plugins = {
},
}
local opts = { defaults = { lazy = true }, install = { colorscheme = { require("max.theme").name } } }
local opts = {
defaults = { lazy = true },
install = { colorscheme = { require("max.theme").name } },
change_detection = {
enabled = true, -- automatically check for config file changes and reload the ui
notify = true, -- get a notification when changes are found
},
performance = {
rtp = {
reset = true,
disabled_plugins = {
"gzip",
"zip",
"zipPlugin",
"fzf",
"tar",
"tarPlugin",
"getscript",
"getscriptPlugin",
"vimball",
"vimballPlugin",
"2html_plugin",
"matchit",
"matchparen",
"logiPat",
"rrhelper",
"netrw",
"netrwPlugin",
"netrwSettings",
"netrwFileHandlers",
},
},
}
}
require("lazy").setup(plugins, opts)

View File

@@ -1,47 +0,0 @@
local Terminal = require("toggleterm.terminal").Terminal
local lazygit = Terminal:new({
cmd = "lazygit",
dir = "git_dir",
direction = "float",
float_opts = {
winblend = 0,
border = "shadow",
},
on_close = function()
Terminal:close()
end,
})
function _Lazygit_toggle()
lazygit:toggle()
end
vim.api.nvim_set_keymap("n", "<C-g>", "<cmd>lua _Lazygit_toggle()<CR>", { noremap = true, silent = true })
local pnpm = Terminal:new({
cmd = "pnpm dev",
dir = "git_dir",
size = 5,
direction = "vertical",
})
function _Pnpm_toggle()
pnpm:toggle()
end
vim.api.nvim_set_keymap("n", "<Leader>d", "<cmd>lua _Pnpm_toggle()<CR>", { noremap = true, silent = true })
local chtConfig = Terminal:new({
cmd = "cht",
direction = "float",
})
function _ChtConfig_toggle()
chtConfig:toggle()
end
vim.api.nvim_set_keymap("n", "<Leader><C-l>", "<cmd>lua _ChtConfig_toggle()<CR>", { noremap = true, silent = true })
require("toggleterm").setup({
shade_terminals = true,
})

View File

@@ -2,45 +2,40 @@ return {
"catppuccin/nvim",
name = "catppuccin",
lazy = false,
config = function()
vim.g.catppuccin_flavour = "frappe" -- latte, frappe, macchiato, mocha
require("catppuccin").setup({
transparent_background = true,
compile = {
opts = {
-- transparent_background = true,
flavour = "mocha", -- latte, frappe, macchiato, mocha
compile = {
enabled = true,
path = vim.fn.stdpath("cache") .. "/catppuccin",
},
styles = {
comments = { "italic" },
strings = { "italic" },
},
integrations = {
gitsigns = true,
telescope = true,
-- treesitter = true,
cmp = true,
lsp_saga = true,
notify = true,
neotree = {
enabled = true,
path = vim.fn.stdpath("cache") .. "/catppuccin",
show_root = false,
},
styles = {
comments = { "italic" },
strings = { "italic" },
dap = {
enabled = true,
enable_ui = true,
},
integrations = {
gitsigns = true,
telescope = true,
-- treesitter = true,
cmp = true,
lsp_saga = true,
notify = true,
neotree = {
enabled = true,
show_root = false,
},
dap = {
enabled = true,
enable_ui = true,
},
native_lsp = {
enabled = true,
},
ts_rainbow = true,
indent_blankline = {
enabled = true,
colored_indent_levels = false,
},
native_lsp = {
enabled = true,
},
})
vim.cmd("colorscheme catppuccin")
end
ts_rainbow = true,
indent_blankline = {
enabled = true,
colored_indent_levels = false,
},
},
}
} -- Enable Theming / Syntax

View File

@@ -1 +1,2 @@
require("max.theme.statuscolumn")
return require("max.theme.catpuccin");