feat: some shit
This commit is contained in:
parent
a13300d1b5
commit
265e4df8f3
@ -10,7 +10,7 @@ _fx(){
|
||||
|
||||
case $state in
|
||||
(action) _arguments '1:profiles:(s i o)' ;;
|
||||
(*) compadd "$@" $(echo $(ls ~/Projects) | tr \\n ' ')
|
||||
(*) compadd "$@" $(echo $(find ~/Projects -type d -maxdepth 2 | sed 's/\/home\/max\/Projects\///g') | tr \\n ' ')
|
||||
|
||||
esac
|
||||
|
||||
|
@ -1,6 +1,4 @@
|
||||
set-option -g default-terminal "screen-256color"
|
||||
set-option -ga terminal-overrides ",xterm-256color:Tc"
|
||||
set -g default-terminal "tmux-256color"
|
||||
set -g default-terminal "tmux"
|
||||
|
||||
set-option -g focus-events on
|
||||
set-option -sg escape-time 10
|
||||
|
@ -124,7 +124,7 @@ fi
|
||||
export PNPM_HOME="$HOME/.local/share/pnpm"
|
||||
export PATH="$PNPM_HOME:$PATH"
|
||||
|
||||
[ -n "$TMUX" ] && export TERM=screen-256color
|
||||
[ -n "$TMUX" ] && export TERM=tmux-256color
|
||||
|
||||
# tabtab source for packages
|
||||
# uninstall by removing these lines
|
||||
|
@ -1,14 +1,12 @@
|
||||
vim.opt.termguicolors = true
|
||||
|
||||
require("max.core.bootstrap")
|
||||
|
||||
require("max.theme.statuscolumn");
|
||||
|
||||
require("max.core.plugins")
|
||||
|
||||
|
||||
require("max.core.autocommands")
|
||||
require("max.core.keymappings")
|
||||
|
||||
require("max.theme.catpuccin")
|
||||
require("max.core.keymappings")
|
||||
|
||||
require("max.overlays")
|
||||
|
||||
|
@ -2,11 +2,11 @@
|
||||
"ChatGPT.nvim": { "branch": "main", "commit": "dac83f630fc6aafd256b149a2c2ae0d4466ec85e" },
|
||||
"Comment.nvim": { "branch": "master", "commit": "eab2c83a0207369900e92783f56990808082eac2" },
|
||||
"FixCursorHold.nvim": { "branch": "master", "commit": "70a9516a64668cbfe59f31b66d0a21678c5e9b12" },
|
||||
"LuaSnip": { "branch": "master", "commit": "8c23e1af82bdafa86556a36c4e075079dd167771" },
|
||||
"LuaSnip": { "branch": "master", "commit": "d404ec306bfa4cdb0c3605dbb17e8a93a9597337" },
|
||||
"alpha-nvim": { "branch": "main", "commit": "21a0f2520ad3a7c32c0822f943368dc063a569fb" },
|
||||
"autolist.nvim": { "branch": "main", "commit": "f8b4c11b79b0fef77a64b03810839a1abbbc67d5" },
|
||||
"boole.nvim": { "branch": "main", "commit": "f4f9996f91159e54b8f1893b20e2e599c91bc1bd" },
|
||||
"catppuccin": { "branch": "main", "commit": "6368edcd0b5e5cb5d9fb7cdee9d62cffe3e14f0e" },
|
||||
"catppuccin": { "branch": "main", "commit": "8769e767f12f5bf0b7d1250ee067088e7054809a" },
|
||||
"cmp-buffer": { "branch": "main", "commit": "3022dbc9166796b644a841a02de8dd1cc1d311fa" },
|
||||
"cmp-emoji": { "branch": "main", "commit": "19075c36d5820253d32e2478b6aaf3734aeaafa0" },
|
||||
"cmp-nvim-lsp": { "branch": "main", "commit": "59224771f91b86d1de12570b4070fe4ad7cd1eeb" },
|
||||
@ -14,65 +14,62 @@
|
||||
"cmp-path": { "branch": "main", "commit": "91ff86cd9c29299a64f968ebb45846c485725f23" },
|
||||
"cmp_luasnip": { "branch": "master", "commit": "18095520391186d634a0045dacaa346291096566" },
|
||||
"copilot-cmp": { "branch": "master", "commit": "b732a58ac8b7287b981cd9f0d9c0f61e5e9d5760" },
|
||||
"copilot.lua": { "branch": "master", "commit": "6ca9b4b3eda9138406291493750a6890c927dbfa" },
|
||||
"copilot.lua": { "branch": "master", "commit": "a54e7b11a2c6efc9ddd3f42e56cf7d9eed1a9683" },
|
||||
"dressing.nvim": { "branch": "master", "commit": "4436d6f41e2f6b8ada57588acd1a9f8b3d21453c" },
|
||||
"editorconfig-vim": { "branch": "master", "commit": "ed23a49992a8adfc0a1db765cb5353adeb12f9ff" },
|
||||
"flit.nvim": { "branch": "main", "commit": "be110f9814a45788d10537fd59b3c76d956bb7ad" },
|
||||
"friendly-snippets": { "branch": "main", "commit": "046e4d3491baf664e0eef5231d28beb49333578b" },
|
||||
"friendly-snippets": { "branch": "main", "commit": "a6f7a1609addb4e57daa6bedc300f77f8d225ab7" },
|
||||
"fwatch.nvim": { "branch": "main", "commit": "a691f7349dc66285cd75a1a698dd28bca45f2bf8" },
|
||||
"fzf": { "branch": "master", "commit": "d51980a3f50dfa8ce43b01a3dce216afb8a0bd8f" },
|
||||
"gesture.nvim": { "branch": "master", "commit": "9451add0df9c32f3e41e6cc45211e3f2c6809025" },
|
||||
"git-conflict.nvim": { "branch": "main", "commit": "cbefa7075b67903ca27f6eefdc9c1bf0c4881017" },
|
||||
"git-conflict.nvim": { "branch": "main", "commit": "80bc8931d4ed8c8c4d289a08e1838fcf4741408d" },
|
||||
"git-worktree.nvim": { "branch": "master", "commit": "d7f4e2584e81670154f07ca9fa5dd791d9c1b458" },
|
||||
"gitsigns.nvim": { "branch": "main", "commit": "7b37bd5c2dd4d7abc86f2af096af79120608eeca" },
|
||||
"lazy.nvim": { "branch": "main", "commit": "96d759d1cbd8b0bd0ea0a0c2987f99410272f348" },
|
||||
"leap.nvim": { "branch": "main", "commit": "ff4c3663e5a0a0ecbb3fffbc8318825def35d2aa" },
|
||||
"gitsigns.nvim": { "branch": "main", "commit": "ec4742a7eebf68bec663041d359b95637242b5c3" },
|
||||
"lazy.nvim": { "branch": "main", "commit": "3d2dcb2d5ef99106c5ff412da88c6f59a9f8a693" },
|
||||
"leap.nvim": { "branch": "main", "commit": "f565a9c4d92245d8b619235bebeaa73cc38aa40e" },
|
||||
"lsp-format.nvim": { "branch": "master", "commit": "ca0df5c8544e51517209ea7b86ecc522c98d4f0a" },
|
||||
"lspkind.nvim": { "branch": "master", "commit": "c68b3a003483cf382428a43035079f78474cd11e" },
|
||||
"lspsaga.nvim": { "branch": "main", "commit": "fb5ec294f833ce5563fc5abce4eb9725d7809652" },
|
||||
"lspsaga.nvim": { "branch": "main", "commit": "46231733235e44e9c4b32ddd9de1e77e37bc377f" },
|
||||
"lualine-lsp-progress": { "branch": "master", "commit": "56842d097245a08d77912edf5f2a69ba29f275d7" },
|
||||
"lualine.nvim": { "branch": "master", "commit": "0050b308552e45f7128f399886c86afefc3eb988" },
|
||||
"mason-lspconfig.nvim": { "branch": "main", "commit": "5b388c0de30f1605671ebfb9a20a620cda50ffce" },
|
||||
"mason.nvim": { "branch": "main", "commit": "bb88357eff0d0c69ab8ecc5985952e0a9a72175a" },
|
||||
"neodev.nvim": { "branch": "main", "commit": "34dd33cd283b3a89f70d32c8f55bb5ec4ce2de93" },
|
||||
"neotest": { "branch": "master", "commit": "6676edc3078b8936df989df639900dc9a70dfc8a" },
|
||||
"neotest-jest": { "branch": "main", "commit": "8b8926480865e56053681d0c56e3be0a3b5e716c" },
|
||||
"mason-lspconfig.nvim": { "branch": "main", "commit": "53f3a8bdcb77d4a95b082fd57e12173f353c6c3e" },
|
||||
"mason.nvim": { "branch": "main", "commit": "4952a48722b3fa01e03c67ab939d5b7d3037309e" },
|
||||
"mini.nvim": { "branch": "main", "commit": "551a8726ab382cb02b1e925512162da478ff3811" },
|
||||
"neo-tree.nvim": { "branch": "v2.x", "commit": "8238865e1d9c61f1a260c290653f2c419503e0a9" },
|
||||
"neodev.nvim": { "branch": "main", "commit": "70cab52c9d19e982f306716534e90c37a254b046" },
|
||||
"neotest": { "branch": "master", "commit": "392808a91d6ee28d27cbfb93c9fd9781759b5d00" },
|
||||
"neotest-jest": { "branch": "main", "commit": "821bb227e31259307db30c88671a1c3724f78637" },
|
||||
"neotest-vitest": { "branch": "main", "commit": "d6577b191e16c174bffbec1eadfcd65c22fdcc0d" },
|
||||
"no-neck-pain.nvim": { "branch": "main", "commit": "40369b2d38271e320d3584860c89b87299bf60ae" },
|
||||
"nui.nvim": { "branch": "main", "commit": "b99e6cb13dc51768abc1c4c8585045a0c0459ef1" },
|
||||
"null-ls.nvim": { "branch": "main", "commit": "33cfeb7a761f08e8535dca722d4b237cabadd371" },
|
||||
"nvim-autopairs": { "branch": "master", "commit": "31042a5823b55c4bfb30efcbba2fc1b5b53f90dc" },
|
||||
"nvim-cmp": { "branch": "main", "commit": "11a95792a5be0f5a40bab5fc5b670e5b1399a939" },
|
||||
"no-neck-pain.nvim": { "branch": "main", "commit": "26085b03b99bbd298fefe51ad65f1dd6debafb5e" },
|
||||
"noice.nvim": { "branch": "main", "commit": "34f7cf628666c6eb0c93fbe8a0490e977ac78b7b" },
|
||||
"nui.nvim": { "branch": "main", "commit": "d147222a1300901656f3ebd5b95f91732785a329" },
|
||||
"null-ls.nvim": { "branch": "main", "commit": "8f5d730021497233c39d3adbf4b8043d4be163f8" },
|
||||
"nvim-cmp": { "branch": "main", "commit": "cfafe0a1ca8933f7b7968a287d39904156f2c57d" },
|
||||
"nvim-colorizer.lua": { "branch": "master", "commit": "36c610a9717cc9ec426a07c8e6bf3b3abcb139d6" },
|
||||
"nvim-dap": { "branch": "master", "commit": "c64a6627bb01eb151da96b28091797beaac09536" },
|
||||
"nvim-dap-ui": { "branch": "master", "commit": "b80227ea56a48177786904f6322abc8b2dc0bc36" },
|
||||
"nvim-dap": { "branch": "master", "commit": "0e376f00e7fac143e29e1017d2ac2cc3df13d185" },
|
||||
"nvim-dap-ui": { "branch": "master", "commit": "885e958ff9de30cfbc359259eccf28cc493ad46b" },
|
||||
"nvim-dap-vscode-js": { "branch": "main", "commit": "e7c05495934a658c8aa10afd995dacd796f76091" },
|
||||
"nvim-lspconfig": { "branch": "master", "commit": "85cd2ecacd8805614efe3fb3a5146ac7d0f88a17" },
|
||||
"nvim-lspconfig": { "branch": "master", "commit": "902d6aa31450d26e11bedcbef8af5b6fe2e1ffe8" },
|
||||
"nvim-notify": { "branch": "master", "commit": "bdd647f61a05c9b8a57c83b78341a0690e9c29d7" },
|
||||
"nvim-scrollbar": { "branch": "main", "commit": "6a2065fbcd032075a06d2ab54508b69842bc4496" },
|
||||
"nvim-toggleterm.lua": { "branch": "main", "commit": "a54e6c471ce1cd8ef8357e34598a28a955297131" },
|
||||
"nvim-tree.lua": { "branch": "master", "commit": "96506fee49542f3aedab76368d400a147fea344e" },
|
||||
"nvim-treesitter": { "branch": "master", "commit": "405fe27cd1b81faadd08fd5895dc54a34154103e" },
|
||||
"nvim-treesitter-textobjects": { "branch": "master", "commit": "2fb97bd6c53d78517d2022a0b84422c18ce5686e" },
|
||||
"nvim-toggleterm.lua": { "branch": "main", "commit": "19aad0f41f47affbba1274f05e3c067e6d718e1e" },
|
||||
"nvim-treesitter": { "branch": "master", "commit": "24d5be6e7192a855a0eba21829717614fa1cf54e" },
|
||||
"nvim-treesitter-textobjects": { "branch": "master", "commit": "249d90a84df63f3ffff65fcc06a45d58415672de" },
|
||||
"nvim-ts-autotag": { "branch": "main", "commit": "fdefe46c6807441460f11f11a167a2baf8e4534b" },
|
||||
"nvim-ts-context-commentstring": { "branch": "main", "commit": "a0f89563ba36b3bacd62cf967b46beb4c2c29e52" },
|
||||
"nvim-ufo": { "branch": "main", "commit": "e3528c9b7ca20e9e0d69d588037f484257f0d652" },
|
||||
"nvim-web-devicons": { "branch": "master", "commit": "13d06d74afad093d8312fe051633b55f24049c16" },
|
||||
"nvim-ufo": { "branch": "main", "commit": "b70c9ef0f8e2673a11387a39185ff249e00df19f" },
|
||||
"nvim-web-devicons": { "branch": "master", "commit": "2b96193abe4372e18e4f4533895a42a466d53c17" },
|
||||
"persisted.nvim": { "branch": "main", "commit": "325cda4fb406601929fbc2084816dc5e49d5e5aa" },
|
||||
"plenary.nvim": { "branch": "master", "commit": "1c7e3e6b0f4dd5a174fcea9fda8a4d7de593b826" },
|
||||
"plenary.nvim": { "branch": "master", "commit": "9a0d3bf7b832818c042aaf30f692b081ddd58bd9" },
|
||||
"popup.nvim": { "branch": "master", "commit": "b7404d35d5d3548a82149238289fa71f7f6de4ac" },
|
||||
"promise-async": { "branch": "main", "commit": "842dca33e6b1af7bedcefc72cffbc807d54dbfca" },
|
||||
"promise-async": { "branch": "main", "commit": "7fa127fa80e7d4d447e0e2c78e99af4355f4247b" },
|
||||
"sniprun": { "branch": "master", "commit": "79806dad094770a1563ac0227c9692f7592df744" },
|
||||
"symbols-outline.nvim": { "branch": "master", "commit": "6a3ed24c5631da7a5d418bced57c16b32af7747c" },
|
||||
"telescope.nvim": { "branch": "master", "commit": "dce1156ca103b8222e4abbfc63f9c6887abf5ec6" },
|
||||
"todo-comments.nvim": { "branch": "main", "commit": "077c59586d9d0726b0696dc5680eb863f4e04bc5" },
|
||||
"symbols-outline.nvim": { "branch": "master", "commit": "512791925d57a61c545bc303356e8a8f7869763c" },
|
||||
"telescope-fzf-native.nvim": { "branch": "main", "commit": "580b6c48651cabb63455e97d7e131ed557b8c7e2" },
|
||||
"telescope.nvim": { "branch": "master", "commit": "203bf5609137600d73e8ed82703d6b0e320a5f36" },
|
||||
"todo-comments.nvim": { "branch": "main", "commit": "74c7d28cb50b0713c881ef69bcb6cdd77d8907d1" },
|
||||
"translate.nvim": { "branch": "main", "commit": "7b2fd50c21ecfe536d572d62dcd3fa83acad3743" },
|
||||
"trouble.nvim": { "branch": "main", "commit": "b2a0afac2c319a481f0f0318963a74d672ba5766" },
|
||||
"ts-node-action": { "branch": "master", "commit": "88881ab67207b578d5d680b75ef74e59dcc47610" },
|
||||
"trouble.nvim": { "branch": "main", "commit": "490f7fe6d227f4f7a64f00be8c7dcd7a508ed271" },
|
||||
"undotree": { "branch": "master", "commit": "1a23ea84bd02c34f50d8e10a8b4bfc89597ffe4e" },
|
||||
"vim-dadbod": { "branch": "master", "commit": "a09e40664e9cd30cd2b3f8866b796598302070f6" },
|
||||
"vim-dadbod-completion": { "branch": "master", "commit": "e71eb6140556c5ced80de6299a1fdfe22bd3c1b1" },
|
||||
"vim-dadbod-ui": { "branch": "master", "commit": "f4ead480930a37dd2b0cf917a8c387ed36c2d86a" },
|
||||
"vim-styled-components": { "branch": "main", "commit": "75e178916fc3e61385350933a23055927f5f60b7" },
|
||||
"vim-surround": { "branch": "master", "commit": "3d188ed2113431cf8dac77be61b842acb64433d9" },
|
||||
"which-key.nvim": { "branch": "main", "commit": "e4fa445065a2bb0bbc3cca85346b67817f28e83e" }
|
||||
"which-key.nvim": { "branch": "main", "commit": "684e96c5e8477f1ee9b3f2e9a12d802fd12c5531" }
|
||||
}
|
@ -4,14 +4,12 @@ require("luasnip/loaders/from_vscode").lazy_load()
|
||||
|
||||
local lspkind = require("lspkind")
|
||||
local cmp = require("cmp")
|
||||
local cmp_autopairs = require("nvim-autopairs.completion.cmp")
|
||||
|
||||
local capabilities = require("cmp_nvim_lsp").default_capabilities()
|
||||
require("lspconfig").html.setup({
|
||||
capabilities = capabilities,
|
||||
})
|
||||
|
||||
require("nvim-autopairs").setup()
|
||||
require("copilot").setup({
|
||||
suggestion = { enabled = false },
|
||||
panel = { enabled = false },
|
||||
@ -25,7 +23,6 @@ local check_backspace = function()
|
||||
return col == 0 or vim.fn.getline("."):sub(col, col):match("%s")
|
||||
end
|
||||
|
||||
|
||||
cmp.setup({
|
||||
window = {
|
||||
documentation = cmp.config.window.bordered(),
|
||||
@ -97,6 +94,7 @@ cmp.setup({
|
||||
},
|
||||
})
|
||||
|
||||
|
||||
-- Use buffer source for `/` (if you enabled `native_menu`, this won't work anymore).
|
||||
cmp.setup.cmdline("/", {
|
||||
sources = {
|
||||
@ -112,5 +110,3 @@ cmp.setup.cmdline(":", {
|
||||
{ name = "cmdline" },
|
||||
}),
|
||||
})
|
||||
|
||||
cmp.event:on("confirm_done", cmp_autopairs.on_confirm_done({ map_char = { tex = "" } }))
|
||||
|
@ -1,27 +0,0 @@
|
||||
local command_center = require("command_center")
|
||||
local noremap = { noremap = true }
|
||||
|
||||
command_center.add({
|
||||
{
|
||||
description = "Show Sessions",
|
||||
cmd = ":lua require('session-lens').search_session()<CR>",
|
||||
keybindings = { "n", "<leader><C-o>", noremap },
|
||||
},
|
||||
{
|
||||
description = "Search inside current buffer",
|
||||
cmd = "<CMD>Telescope current_buffer_fuzzy_find<CR>",
|
||||
keybindings = { "n", "<leader>fl", noremap },
|
||||
},
|
||||
{
|
||||
description = "Show document symbols",
|
||||
cmd = "<CMD>Telescope lsp_document_symbols<CR>",
|
||||
},
|
||||
{
|
||||
description = "Show function signaure (hover)",
|
||||
cmd = "<CMD>lua vim.lsp.buf.hover()<CR>",
|
||||
},
|
||||
{
|
||||
description = "(TS) Organize Imports",
|
||||
cmd = "<CMD>OrganizeImports<CR>",
|
||||
},
|
||||
})
|
@ -25,7 +25,7 @@ dashboard.section.footer.val = {
|
||||
-- Custom Section
|
||||
dashboard.section.buttons.val = {
|
||||
dashboard.button("n", " Create New file", ":set laststatus=3 | :ene <BAR> startinsert <CR>"),
|
||||
dashboard.button("e", " Open File Manager", ":set laststatus=3 | :NvimTreeOpen <CR>"),
|
||||
dashboard.button("e", " Open File Manager", ":set laststatus=3 | :Neotree toggle <CR>"),
|
||||
dashboard.button("s", "Δ Search Sessions", ":Telescope persisted<CR>"),
|
||||
dashboard.button("v", " Neovim Settings ", ":set laststatus=3 | e ~/.config/nvim/init.lua <CR>"),
|
||||
dashboard.button("b", "⟳ Recent Files", ":Telescope oldfiles<CR>"),
|
||||
|
@ -1,27 +0,0 @@
|
||||
local gesture = require("gesture")
|
||||
|
||||
vim.keymap.set("n", "<RightMouse>", [[<Nop>]])
|
||||
vim.keymap.set("n", "<RightDrag>", [[<Cmd>lua require("gesture").draw()<CR>]], { silent = true })
|
||||
vim.keymap.set("n", "<RightRelease>", [[<Cmd>lua require("gesture").finish()<CR>]], { silent = true })
|
||||
|
||||
gesture.register({
|
||||
name = "go back",
|
||||
inputs = { gesture.right() },
|
||||
-- map to `<C-o>` keycode
|
||||
action = [[lua vim.cmd('sp')]],
|
||||
})
|
||||
|
||||
|
||||
gesture.register({
|
||||
name = "go back",
|
||||
inputs = { gesture.down() },
|
||||
-- map to `<C-o>` keycode
|
||||
action = [[lua vim.cmd('vsp')]],
|
||||
})
|
||||
|
||||
-- gesture.register({
|
||||
-- name = "scroll to bottom",
|
||||
-- inputs = { gesture.right() },
|
||||
-- action = "normal! G",
|
||||
-- })
|
||||
|
@ -22,7 +22,8 @@ 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", {
|
||||
@ -78,6 +79,7 @@ custom_lsp.sumneko_lua = {
|
||||
workspace = {
|
||||
-- Make the server aware of Neovim runtime files
|
||||
library = vim.api.nvim_get_runtime_file("", true),
|
||||
checkThirdParty = false
|
||||
},
|
||||
-- Do not send telemetry data containing a randomized but unique identifier
|
||||
telemetry = {
|
||||
|
@ -45,7 +45,7 @@ local config = {
|
||||
-- Disable sections and component separators
|
||||
component_separators = "",
|
||||
section_separators = "",
|
||||
theme = "catppuccin",
|
||||
theme = require("max.theme").name,
|
||||
},
|
||||
|
||||
-- These are to remove the defaults
|
||||
@ -79,15 +79,6 @@ local function ins_right(component)
|
||||
table.insert(config.sections.lualine_x, component)
|
||||
end
|
||||
|
||||
-- Begining Of The StatusLine
|
||||
-- ins_left {
|
||||
-- function()
|
||||
-- return '|'
|
||||
-- end,
|
||||
-- color = { fg = colors.blue }, -- Sets highlighting of component
|
||||
-- padding = { left = 0, right = 1 }, -- We don't need space before this
|
||||
-- }
|
||||
|
||||
-- Icon Of Diffrent Mode: -- normal -- | -- insert -- | -- visual --
|
||||
ins_left({
|
||||
-- mode component
|
||||
@ -139,9 +130,11 @@ ins_left({
|
||||
},
|
||||
})
|
||||
|
||||
ins_left({
|
||||
"lsp_progress",
|
||||
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,
|
||||
@ -151,19 +144,19 @@ ins_left({
|
||||
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" },
|
||||
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", "percentage" },
|
||||
display_components = { 'lsp_client_name', 'spinner', { 'title', 'percentage', 'message' } },
|
||||
timer = { progress_enddelay = 500, spinner = 1000, lsp_client_name_enddelay = 1000 },
|
||||
spinner_symbols = { "🌑 ", "🌒 ", "🌓 ", "🌔 ", "🌕 ", "🌖 ", "🌗 ", "🌘 " },
|
||||
})
|
||||
spinner_symbols = { '🌑 ', '🌒 ', '🌓 ', '🌔 ', '🌕 ', '🌖 ', '🌗 ', '🌘 ' },
|
||||
}
|
||||
|
||||
-- Git Diff
|
||||
local function diff_source()
|
||||
@ -206,16 +199,6 @@ ins_right({
|
||||
-- Add components to right sections
|
||||
})
|
||||
|
||||
-- File Format
|
||||
-- ins_right {
|
||||
-- 'fileformat',
|
||||
-- -- fmt = string.upper,
|
||||
-- -- icons_enabled = false, -- I think icons are cool but Eviline doesn't have them. sigh
|
||||
-- padding = { right = 2 },
|
||||
-- symbols = { unix = 'NIX '},
|
||||
-- -- color = { fg = colors.green, gui = 'bold' },
|
||||
-- }
|
||||
|
||||
-- File Size
|
||||
ins_right({
|
||||
-- filesize component
|
||||
@ -224,14 +207,6 @@ ins_right({
|
||||
cond = conditions.buffer_not_empty,
|
||||
})
|
||||
|
||||
-- Text Progress
|
||||
|
||||
ins_right({
|
||||
"progress",
|
||||
padding = { right = 1 },
|
||||
-- padding = { left = 1 },
|
||||
})
|
||||
|
||||
-- File Location
|
||||
ins_right({
|
||||
"location",
|
||||
@ -247,13 +222,13 @@ ins_left({
|
||||
})
|
||||
|
||||
-- End Of The Status Bar
|
||||
-- ins_right {
|
||||
-- function()
|
||||
-- return ''
|
||||
-- end,
|
||||
-- color = { fg = colors.blue }, -- Sets highlighting of component
|
||||
-- padding = { left = 1, right = 0 }, -- We don't need space before this
|
||||
-- }
|
||||
ins_right {
|
||||
function()
|
||||
return ''
|
||||
end,
|
||||
color = { fg = colors.blue }, -- Sets highlighting of component
|
||||
padding = { left = 1, right = 0 }, -- We don't need space before this
|
||||
}
|
||||
|
||||
-- Now don't forget to initialize lualine
|
||||
lualine.setup(config)
|
||||
|
@ -11,5 +11,6 @@ require("scrollbar").setup({
|
||||
"TelescopePrompt",
|
||||
"noice",
|
||||
"NvimTree",
|
||||
"neo-tree"
|
||||
},
|
||||
})
|
||||
|
@ -3,15 +3,14 @@ require("persisted").setup({
|
||||
before_save = function()
|
||||
local tree = pcall(require, "nvim-tree")
|
||||
if tree then
|
||||
vim.cmd("NvimTreeClose")
|
||||
vim.cmd("Neotree close")
|
||||
end
|
||||
end,
|
||||
after_save = function()
|
||||
vim.cmd("NvimTreeOpen")
|
||||
vim.cmd("Neotree show")
|
||||
end,
|
||||
after_source = function()
|
||||
vim.lsp.stop_client(vim.lsp.get_active_clients())
|
||||
vim.cmd("filetype detect")
|
||||
end,
|
||||
})
|
||||
require("telescope").load_extension("persisted") -- To load the telescope extension
|
||||
|
@ -66,5 +66,5 @@ local default = {
|
||||
}
|
||||
|
||||
telescope.setup(default)
|
||||
telescope.load_extension("git_worktree")
|
||||
telescope.load_extension("notify")
|
||||
telescope.load_extension("persisted") -- To load the telescope extension
|
||||
|
@ -37,6 +37,3 @@ require("nvim-tree").setup({
|
||||
},
|
||||
},
|
||||
})
|
||||
|
||||
-- vim.cmd("NvimTreeOpen")
|
||||
-- vim.api.nvim_input("<C-l>")
|
||||
|
@ -18,14 +18,16 @@ autocmd({ "BufReadPost" }, {
|
||||
})
|
||||
|
||||
local save_fold = augroup("Persistent Folds", { clear = true })
|
||||
autocmd("BufWinLeave", {
|
||||
autocmd({ "BufWinLeave" }, {
|
||||
pattern = "*.*",
|
||||
callback = function()
|
||||
vim.cmd.mkview()
|
||||
vim.cmd("SessionSave")
|
||||
end,
|
||||
group = save_fold,
|
||||
})
|
||||
autocmd("BufWinEnter", {
|
||||
|
||||
autocmd({ "BufWinEnter" }, {
|
||||
pattern = "*.*",
|
||||
callback = function()
|
||||
vim.cmd.loadview({ mods = { emsg_silent = true } })
|
||||
@ -33,13 +35,11 @@ autocmd("BufWinEnter", {
|
||||
group = save_fold,
|
||||
})
|
||||
|
||||
require("max.theme.statuscolumn");
|
||||
|
||||
autocmd({ "BufWinEnter", "BufAdd" }, {
|
||||
desc = 'hide statuscolumn in nvimtree',
|
||||
desc = 'hide statuscolumn in neotree',
|
||||
group = vim.api.nvim_create_augroup('hide_nvimtree_stc', { clear = true }),
|
||||
callback = function(opts)
|
||||
if vim.bo[opts.buf].filetype == 'NvimTree' then
|
||||
if vim.bo[opts.buf].filetype == 'NvimTree' or vim.bo[opts.buf].filetype == "neo-tree" then
|
||||
vim.opt.statuscolumn = ''
|
||||
else
|
||||
-- vim.o.statuscolumn = '%=%r%s%#FoldColumn#%{foldlevel(v:lnum) > foldlevel(v:lnum - 1) ? (foldclosed(v:lnum) == -1 ? "" : "") : " " } %*'
|
||||
@ -48,8 +48,6 @@ autocmd({ "BufWinEnter","BufAdd" }, {
|
||||
end,
|
||||
})
|
||||
|
||||
vim.cmd [[au BufWinEnter NvimTree setlocal statuscolumn=""]]
|
||||
|
||||
vim.cmd([[
|
||||
augroup filetypedetect
|
||||
au BufNewFile,BufRead *.frag setl ft=glsl
|
||||
@ -67,3 +65,5 @@ autocmd("BufReadPost", {
|
||||
end
|
||||
end,
|
||||
})
|
||||
|
||||
|
||||
|
@ -1,25 +1,22 @@
|
||||
-- local map = vim.api.nvim_set_keymap
|
||||
local map = vim.keymap.set
|
||||
local opts = { noremap = true, silent = true }
|
||||
|
||||
|
||||
-- Set Leader key
|
||||
vim.g.mapleader = " "
|
||||
|
||||
-- Telescope
|
||||
map("n", "<C-o>", ":Telescope find_files preview={timeout=1000}<CR>", opts)
|
||||
map("n", "<C-f>", ":lua require'telescope.builtin'.live_grep{ cwd = vim.fn.getcwd() }<CR>", opts)
|
||||
map("n", "<Leader><leader>", "za", opts)
|
||||
map("n", "<C-f>", ":Telescope live_grep<CR>", opts)
|
||||
map("n", "<leader>o", ":Telescope buffers<CR>", opts)
|
||||
|
||||
map("v", ">", ">gv", opts)
|
||||
map("v", "<", "<gv", opts)
|
||||
map("n", "<Leader><leader>", "za", opts)
|
||||
|
||||
local function zenMode()
|
||||
vim.cmd("NvimTreeClose");
|
||||
vim.cmd("Neotree close");
|
||||
vim.cmd("NoNeckPain");
|
||||
end
|
||||
|
||||
map("n", "zz", zenMode, opts);
|
||||
map("n", "<Leader>z", zenMode, opts);
|
||||
map("n", "<Leader>a", ":Alpha<CR>", opts);
|
||||
|
||||
-- LSP Functionality
|
||||
@ -31,21 +28,23 @@ map("n", "gd", ":lua vim.lsp.buf.definition()<CR>", opts)
|
||||
map("n", "gi", ":lua vim.lsp.buf.implementation()<CR>", opts)
|
||||
map("n", "K", ":lua vim.lsp.buf.hover()<CR>", opts)
|
||||
|
||||
map("n", "<Leader>ii", ":Lspsaga incomming_calls<CR>", opts)
|
||||
map("n", "<Leader>io", ":Lspsaga outgoing_calls<CR>", opts)
|
||||
map("n", "<Leader>rn", "<cmd>lua vim.lsp.buf.rename()<CR>", opts)
|
||||
map({ "n", "v" }, "<Leader>c", "<cmd>Lspsaga code_action<CR>", { silent = true })
|
||||
map({ "n", "v" }, "<Leader>c", "<cmd>lua vim.lsp.buf.code_action()<CR>", { silent = true })
|
||||
map({ "n", "v" }, "gr", "<cmd>Lspsaga lsp_finder<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)
|
||||
|
||||
-- This is my [i]nspect section, [i]nspect [s]ymbols
|
||||
map("n", "<Leader>is", "<cmd>SymbolsOutline<cr>", opts)
|
||||
map("n", "<Leader>io", "<cmd>Lspsaga outline<CR>", opts)
|
||||
map("n", "<Leader>ip", ":TroubleToggle<CR>", opts)
|
||||
-- This is my [i]nspect section,
|
||||
map("n", "<Leader>is", ":SymbolsOutline<cr>", opts) -- [i]nspect [s]ymbols
|
||||
map("n", "<Leader>io", ":Lspsaga outline<CR>", opts) -- [i]nspect [o]utline
|
||||
map("n", "<Leader>in", ":Telescope notify<CR>", opts) -- [i]nspect [n]otifications
|
||||
map("n", "<Leader>ip", ":TroubleToggle<CR>", opts) -- [i]nspect [p]roblems
|
||||
map("n", "<Leader>ii", ":Lspsaga incomming_calls<CR>", opts) --[i]nspect [i]ncomming_calls
|
||||
map("n", "<Leader>io", ":Lspsaga outgoing_calls<CR>", opts) --[i]nspect [o]utgoing_calls
|
||||
|
||||
map({ "n", "v" }, "<Leader>t", require("max.configs.translate"), opts)
|
||||
|
||||
-- DAP Functionality
|
||||
@ -55,9 +54,6 @@ map("n", "<Leader>b", ":lua require('dap').toggle_breakpoint()<CR>", opts)
|
||||
map("n", "tt", ":lua require('neotest').run.run()<CR>", opts)
|
||||
map("n", "to", ":lua require('neotest').summary.open()<CR>", opts)
|
||||
|
||||
map({ "n", "v" }, "+", "<cmd>:Boole increment<CR>", opts)
|
||||
map({ "n", "v" }, "-", "<cmd>:Boole decrement<CR>", opts)
|
||||
|
||||
-- Navigate Buffers
|
||||
map("n", "<C-h>", "<C-w>h", opts)
|
||||
map("n", "<C-j>", "<C-w>j", opts)
|
||||
@ -70,9 +66,9 @@ map("n", "<Leader>3", "3gt", opts)
|
||||
map("n", "<Leader>4", "4gt", opts)
|
||||
map("n", "<Leader>0", ":tablast<CR>", opts)
|
||||
|
||||
-- Browser like next/previous
|
||||
map("n", "<A-Left>", ":bprevious<CR>", opts)
|
||||
map("n", "<A-Right>", ":bnext<CR>", opts)
|
||||
-- Browser like next/previous for navigating the jumplist
|
||||
map("n", "<A-Left>", "<C-O>", opts)
|
||||
map("n", "<A-Right>", "<C-I>", opts)
|
||||
|
||||
-- Copy visual selection to keyboard
|
||||
map("v", "Y", '"+y', opts)
|
||||
@ -80,14 +76,16 @@ map("n", "<Leader-k>", "{", opts)
|
||||
map("n", "<Leader-j>", "}", opts)
|
||||
|
||||
-- Move lines vscode style
|
||||
map("n", "<A-j>", "<cmd>move +1<CR>", opts)
|
||||
map("n", "<A-k>", "<cmd>move -2<CR>", opts)
|
||||
map("i", "<A-j>", "<cmd>move +1<CR>", opts)
|
||||
map("i", "<A-k>", "<cmd>move -2<CR>", opts)
|
||||
map("n", "<A-j>", ":move +1<CR>", opts)
|
||||
map("n", "<A-k>", ":move -2<CR>", opts)
|
||||
map("i", "<A-j>", ":move +1<CR>", opts)
|
||||
map("i", "<A-k>", ":move -2<CR>", opts)
|
||||
map("v", "<A-j>", ":m '>+1<CR>gv=gv", opts)
|
||||
map("v", "<A-k>", ":m '<-2<CR>gv=gv", opts)
|
||||
map("n", "<A-S-K>", "yyP", opts)
|
||||
map("n", "<A-S-J>", "yyp", opts)
|
||||
map("v", ">", ">gv", opts)
|
||||
map("v", "<", "<gv", opts)
|
||||
|
||||
-- If i paste with p, the replaced content doesnt replace my clipboard
|
||||
map("v", "p", '"_dP', opts)
|
||||
@ -96,16 +94,10 @@ map("v", "p", '"_dP', opts)
|
||||
map("n", "<leader>cl", ":noh<CR>", opts);
|
||||
map("n", "<leader>m", ":Mason<CR>", opts);
|
||||
map("n", "<leader>l", ":Lazy<CR>", opts);
|
||||
map("n", "<leader>so", ":so %<CR>", opts);
|
||||
|
||||
-- Faster git merge
|
||||
map("n", "<Leader>gd", ":Gvdiffsplit!<CR>", opts)
|
||||
map("n", "<Leader>gdl", ":diffget //3<CR>", opts)
|
||||
map("n", "<Leader>gdh", ":diffget //2<CR>", opts)
|
||||
|
||||
-- Find file in NvimTree
|
||||
map("n", "<Leader>j", ":NvimTreeToggle<CR>", opts)
|
||||
map("n", "<Leader>f", ":NvimTreeFindFile<CR><c-w>", opts)
|
||||
-- Find file in NeoTree
|
||||
map("n", "<Leader>j", ":Neotree toggle<CR>", opts)
|
||||
map("n", "<Leader>f", ":Neotree action=focus reveal=true<CR>", opts)
|
||||
|
||||
-- I aint no weak boy
|
||||
map("n", "<Left>", ":echo 'No Left for you'<CR><i><dw>", opts)
|
||||
@ -113,19 +105,13 @@ map("n", "<Right>", ":echo 'No Right for you'<CR><dw>", opts)
|
||||
map("n", "<Up>", ":echo 'No Up for you'<CR><dw>", opts)
|
||||
map("n", "<Down>", ":echo 'No Down for you'<CR><dw>", opts)
|
||||
|
||||
-- Run Requests
|
||||
-- Run Scripts
|
||||
map("n", "<Leader>r", ":SnipRun<CR>", opts)
|
||||
map("v", "<Leader>r", ":'<,'>SnipRun<CR>", opts)
|
||||
|
||||
-- Close on q
|
||||
local function closeAll()
|
||||
vim.cmd("SessionSave")
|
||||
vim.cmd("qall")
|
||||
end
|
||||
|
||||
map("n", "<Leader>q", ":q<CR>", opts)
|
||||
map("n", "<Leader><C-q>", closeAll, opts)
|
||||
map("n", "<Leader><C-q>", ":qall<CR>", opts)
|
||||
|
||||
-- Make ctrl+s work
|
||||
map("n", "<C-s>", "<Esc>:w<CR>", opts)
|
||||
map("n", "<C-s>", ":w<CR>", opts)
|
||||
map("i", "<C-s>", "<Esc>:w<CR>i", opts)
|
||||
|
@ -1,79 +1,54 @@
|
||||
-------------
|
||||
-- General --
|
||||
-------------
|
||||
local set = vim.opt
|
||||
local g = vim.g
|
||||
vim.g.mapleader = " "
|
||||
vim.g.maplocalleader = " "
|
||||
|
||||
set.swapfile = false -- Don't use swapfile
|
||||
set.updatetime = 0 -- Faster completion
|
||||
set.smartindent = true -- Makes indenting smart
|
||||
set.iskeyword:append("-") -- treat dash separated words as a word text object"
|
||||
set.clipboard = "unnamedplus" -- Copy paste between vim and everything else
|
||||
set.smarttab = true -- Makes tabbing smarter will realize you have 2 vs 4
|
||||
set.expandtab = true -- Converts tabs to spaces
|
||||
set.autoindent = true -- Good auto indent
|
||||
set.autochdir = false -- Your working directory will always be the same as your working directory
|
||||
set.incsearch = true -- sets incremental search
|
||||
set.undofile = true
|
||||
set.undodir = vim.fn.stdpath("data") .. "/undo"
|
||||
set.shell = "/bin/zsh" -- Set your shell to bash or zsh
|
||||
set.shortmess:append("sI") -- Disable nvim intro
|
||||
vim.cmd([[set nobackup]]) -- creates a backup file
|
||||
vim.cmd([[set nowritebackup]]) -- creates a backup file i guess
|
||||
vim.cmd([[set formatoptions-=cro]]) -- Stop newline continution of comments
|
||||
vim.cmd([[set complete+=kspell]]) -- auto complete with spellcheck
|
||||
vim.cmd([[set completeopt=menuone,noselect]]) -- auto complete menu (It's pretty great)
|
||||
vim.cmd([[set nocompatible]]) -- Disable compatibility to old-time vi
|
||||
set.mouse = "a" -- Enable mouse support
|
||||
set.signcolumn = "yes"
|
||||
set.sessionoptions = { "buffers", "curdir", "tabpages", "winsize" }
|
||||
local opt = vim.opt
|
||||
|
||||
-- Configure Folds
|
||||
vim.cmd([[set wildmode=list:longest,full]]) -- Command-line completion mode
|
||||
g.loaded_netrw = 1;
|
||||
g.loaded_netrwPlugin = 1;
|
||||
opt.autowrite = true -- Enable auto write
|
||||
opt.clipboard = "unnamedplus" -- Sync with system clipboard
|
||||
opt.completeopt = "menu,menuone,noselect"
|
||||
opt.conceallevel = 3 -- Hide * markup for bold and italic
|
||||
opt.confirm = true -- Confirm to save changes before exiting modified buffer
|
||||
opt.cursorline = true -- Enable highlighting of the current line
|
||||
opt.expandtab = true -- Use spaces instead of tabs
|
||||
opt.formatoptions = "jcroqlnt" -- tcqj
|
||||
opt.grepformat = "%f:%l:%c:%m"
|
||||
opt.grepprg = "rg --vimgrep"
|
||||
opt.ignorecase = true -- Ignore case
|
||||
opt.inccommand = "nosplit" -- preview incremental substitute
|
||||
opt.laststatus = 3 -- laststatus=3 enables global statusline
|
||||
opt.list = false -- Show some invisible characters (tabs...
|
||||
opt.mouse = "a" -- Enable mouse mode
|
||||
opt.number = true -- Print line number
|
||||
opt.pumblend = 10 -- Popup blend
|
||||
opt.pumheight = 10 -- Maximum number of entries in a popup
|
||||
opt.relativenumber = true -- Relative line numbers
|
||||
opt.scrolloff = 4 -- Lines of context
|
||||
opt.sessionoptions = { "buffers", "curdir", "tabpages", "winsize" }
|
||||
opt.shiftround = true -- Round indent
|
||||
opt.shiftwidth = 2 -- Size of an indent
|
||||
opt.shortmess:append { W = true, I = true, c = true }
|
||||
opt.showmode = false -- Dont show mode since we have a statusline
|
||||
opt.sidescrolloff = 8 -- Columns of context
|
||||
opt.signcolumn = "no" -- Always show the signcolumn, otherwise it would shift the text each time
|
||||
opt.smartcase = true -- Don't ignore case with capitals
|
||||
opt.smartindent = true -- Insert indents automatically
|
||||
opt.spelllang = { "en" }
|
||||
opt.splitbelow = true -- Put new windows below current
|
||||
opt.splitright = true -- Put new windows right of current
|
||||
opt.tabstop = 2 -- Number of spaces tabs count for
|
||||
opt.termguicolors = true -- True color support
|
||||
opt.timeoutlen = 300
|
||||
opt.undofile = true
|
||||
opt.undolevels = 10000
|
||||
opt.updatetime = 200 -- Save swap file and trigger CursorHold
|
||||
opt.wildmode = "longest:full,full" -- Command-line completion mode
|
||||
opt.winminwidth = 5 -- Minimum window width
|
||||
opt.wrap = false -- Disable line wrap
|
||||
|
||||
---------------
|
||||
-- Neovim UI --
|
||||
---------------
|
||||
set.pumheight = 15 -- Makes popup menu smaller
|
||||
set.ruler = true -- Show the cursor position all the time
|
||||
set.splitbelow = true -- Horizontal splits will automatically be below
|
||||
set.splitright = true -- Vertical splits will automatically be to the right
|
||||
set.conceallevel = 0 -- So that I can see `` in markdown files
|
||||
g.markdown_fenced_languages = { "javascript", "typescript", "bash", "lua", "go", "rust", "c", "cpp" }
|
||||
set.tabstop = 2 -- Insert 2 spaces for a tab
|
||||
set.number = true -- Line numbers
|
||||
set.background = "dark" -- tell vim what the background color looks like
|
||||
set.virtualedit = "onemore" -- With This option you can move the cursor one character over the end
|
||||
set.ignorecase = true -- ignores case when searching
|
||||
set.smartcase = true -- turns on case sensitive search when letters are capitalized
|
||||
set.termguicolors = true -- set term gui colors (most terminals support this)
|
||||
set.laststatus = 3 -- Always display the status line
|
||||
set.title = true -- Show current txt that you editing
|
||||
set.relativenumber = true -- Vim’s absolute, relative and hybrid line numbers
|
||||
set.cursorline = true -- Enable highlighting of the current line
|
||||
set.synmaxcol = 128
|
||||
vim.cmd("syntax sync minlines=256")
|
||||
set.mousescroll = "ver:1,hor:1"
|
||||
set.shiftwidth = 2 -- Change the number of space characters inserted for indentation
|
||||
set.showtabline = 1 -- Always show tabs
|
||||
set.cmdheight = 1 -- More space for displaying messages
|
||||
vim.cmd([[set nowrap]]) -- Display long lines as just one line
|
||||
vim.cmd([[set noshowmode]]) -- We don't need to see things like -- INSERT -- anymore
|
||||
vim.cmd([[syntax enable]]) -- Enables syntax highlighing
|
||||
vim.cmd([[set t_Co=256]]) -- Support 256 colors
|
||||
vim.cmd "set whichwrap+=<,>,[,],h,l" -- Breaks Space-Time Continuum
|
||||
vim.diagnostic.config({
|
||||
virtual_text = true,
|
||||
})
|
||||
if vim.fn.has("nvim-0.9.0") == 1 then
|
||||
opt.splitkeep = "screen"
|
||||
opt.shortmess:append { C = true }
|
||||
end
|
||||
|
||||
-----------------
|
||||
-- Memory, CPU --
|
||||
-----------------
|
||||
set.hidden = true -- Required to keep multiple buffers open multiple buffers
|
||||
set.timeoutlen = 500 -- By default timeoutlen is 1000 ms
|
||||
set.lazyredraw = false -- Disable lazyredraw
|
||||
set.synmaxcol = 240 -- Max column for syntax highlight
|
||||
set.updatetime = 700 -- ms to wait for trigger an event
|
||||
vim.o.fillchars = 'eob: '
|
||||
-- Fix markdown indentation settings
|
||||
vim.g.markdown_recommended_style = 0
|
||||
|
@ -1,19 +1,22 @@
|
||||
local plugins = {
|
||||
|
||||
{
|
||||
dir = "~/Projects/sudoku.nvim",
|
||||
cmd = "Sudoku",
|
||||
config = true
|
||||
},
|
||||
|
||||
"nvim-lua/plenary.nvim",
|
||||
|
||||
---------------------
|
||||
-- Theming Section --
|
||||
---------------------
|
||||
require("max.theme"),
|
||||
|
||||
"rktjmp/fwatch.nvim", -- d to check dark/light theme
|
||||
{ "catppuccin/nvim", name = "catppuccin", priority = 1000, lazy = false },
|
||||
-- local plugins need to be explicitly configured with dir
|
||||
{
|
||||
dir = "~/Projects/sudoku.nvim",
|
||||
cmd = "Sudoku",
|
||||
config = true,
|
||||
},
|
||||
--------------------
|
||||
-- Layout Plugins --
|
||||
--------------------
|
||||
"nvim-lua/popup.nvim",
|
||||
{
|
||||
"nvim-lualine/lualine.nvim",
|
||||
lazy = false,
|
||||
@ -21,19 +24,68 @@ local plugins = {
|
||||
require("max.configs.lualine")
|
||||
end,
|
||||
},
|
||||
{
|
||||
'echasnovski/mini.nvim',
|
||||
version = false,
|
||||
event = "VeryLazy",
|
||||
config = function()
|
||||
require("mini.pairs").setup({
|
||||
})
|
||||
|
||||
--------------------
|
||||
-- Layout Plugins --
|
||||
--------------------
|
||||
require("mini.surround").setup({
|
||||
})
|
||||
|
||||
require("mini.animate").setup({
|
||||
cursor = {
|
||||
enable = false,
|
||||
}
|
||||
})
|
||||
end
|
||||
},
|
||||
{ "shortcuts/no-neck-pain.nvim", cmd = "NoNeckPain", config = true },
|
||||
{
|
||||
"stevearc/dressing.nvim",
|
||||
"folke/noice.nvim",
|
||||
event = "VeryLazy",
|
||||
config = true,
|
||||
opts = {
|
||||
lsp = {
|
||||
override = {
|
||||
["vim.lsp.util.convert_input_to_markdown_lines"] = true,
|
||||
["vim.lsp.util.stylize_markdown"] = true,
|
||||
},
|
||||
},
|
||||
presets = {
|
||||
bottom_search = true,
|
||||
command_palette = true,
|
||||
long_message_to_split = true,
|
||||
lsp_doc_border = true
|
||||
},
|
||||
},
|
||||
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" },
|
||||
},
|
||||
},
|
||||
{
|
||||
"stevearc/dressing.nvim",
|
||||
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",
|
||||
event = "VimEnter",
|
||||
event = "VeryLazy",
|
||||
config = function()
|
||||
require("which-key").setup({})
|
||||
end,
|
||||
@ -43,23 +95,28 @@ local plugins = {
|
||||
cmd = "SymbolsOutline",
|
||||
config = true,
|
||||
},
|
||||
{ "mbbill/undotree", event = "VeryLazy" },
|
||||
{ "mbbill/undotree", cmd = { "Undotree", "UndotreeToggle" } },
|
||||
{
|
||||
"petertriho/nvim-scrollbar",
|
||||
event = "VeryLazy",
|
||||
config = function()
|
||||
require("max.configs.scrollbar")
|
||||
end,
|
||||
},
|
||||
{
|
||||
"lewis6991/gitsigns.nvim",
|
||||
lazy = false,
|
||||
event = "BufReadPost",
|
||||
config = function()
|
||||
require("gitsigns").setup()
|
||||
end,
|
||||
},
|
||||
"akinsho/nvim-toggleterm.lua",
|
||||
{
|
||||
"akinsho/git-conflict.nvim",
|
||||
version = "*",
|
||||
dependencies = {
|
||||
"akinsho/nvim-toggleterm.lua",
|
||||
},
|
||||
event = "BufReadPost",
|
||||
config = function()
|
||||
require("git-conflict").setup()
|
||||
end,
|
||||
@ -71,11 +128,6 @@ local plugins = {
|
||||
end,
|
||||
event = "VimEnter",
|
||||
},
|
||||
{
|
||||
"folke/neodev.nvim",
|
||||
lazy = false,
|
||||
config = true,
|
||||
},
|
||||
{
|
||||
"kevinhwang91/nvim-ufo",
|
||||
event = "BufReadPost",
|
||||
@ -83,15 +135,21 @@ local plugins = {
|
||||
config = require("max.configs.ufo"),
|
||||
},
|
||||
{
|
||||
"kyazdani42/nvim-tree.lua",
|
||||
event = "VeryLazy",
|
||||
-- lazy = false,
|
||||
dependencies = { "kyazdani42/nvim-web-devicons" },
|
||||
config = function()
|
||||
require("max.configs.tree")
|
||||
"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,
|
||||
},
|
||||
"nvim-lua/popup.nvim",
|
||||
{
|
||||
"goolord/alpha-nvim",
|
||||
lazy = false,
|
||||
@ -99,13 +157,6 @@ local plugins = {
|
||||
require("max.configs.dashboard")
|
||||
end,
|
||||
}, -- startup screen
|
||||
{
|
||||
"notomo/gesture.nvim",
|
||||
lazy = false,
|
||||
config = function()
|
||||
require("max.configs.gestures")
|
||||
end,
|
||||
},
|
||||
{
|
||||
"numToStr/Comment.nvim",
|
||||
event = "InsertEnter",
|
||||
@ -116,17 +167,22 @@ local plugins = {
|
||||
---------------------
|
||||
-- Code Navigation --
|
||||
---------------------
|
||||
"junegunn/fzf",
|
||||
{
|
||||
"ggandor/flit.nvim",
|
||||
dependencies = {
|
||||
"ggandor/leap.nvim",
|
||||
},
|
||||
event = "VimEnter",
|
||||
event = "VeryLazy",
|
||||
config = true,
|
||||
},
|
||||
{
|
||||
"nvim-telescope/telescope.nvim",
|
||||
dependencies = {
|
||||
"nvim-lua/popup.nvim",
|
||||
"nvim-lua/plenary.nvim",
|
||||
"nvim-telescope/telescope-fzf-native.nvim",
|
||||
},
|
||||
event = "VeryLazy",
|
||||
config = function()
|
||||
require("max.configs.telescope")
|
||||
end,
|
||||
@ -163,7 +219,7 @@ local plugins = {
|
||||
{
|
||||
"folke/trouble.nvim",
|
||||
cmd = "TroubleToggle",
|
||||
dependencies = "kyazdani42/nvim-web-devicons",
|
||||
dependencies = "nvim-tree/nvim-web-devicons",
|
||||
config = function()
|
||||
require("trouble").setup({})
|
||||
end,
|
||||
@ -171,13 +227,11 @@ local plugins = {
|
||||
-------------------
|
||||
-- Autocomplete --
|
||||
-------------------
|
||||
{ "tpope/vim-surround", lazy = false },
|
||||
{
|
||||
"hrsh7th/nvim-cmp",
|
||||
event = "InsertEnter",
|
||||
dependencies = {
|
||||
"hrsh7th/cmp-buffer",
|
||||
"windwp/nvim-autopairs",
|
||||
"hrsh7th/cmp-path",
|
||||
"hrsh7th/cmp-emoji",
|
||||
"saadparwaiz1/cmp_luasnip",
|
||||
@ -196,15 +250,21 @@ local plugins = {
|
||||
"nat-418/boole.nvim",
|
||||
event = "InsertEnter",
|
||||
config = function()
|
||||
require("boole").setup()
|
||||
require("boole").setup({
|
||||
mappings = {
|
||||
increment = '-',
|
||||
decrement = '+'
|
||||
},
|
||||
additions = {
|
||||
{ "const", "let", "var" }
|
||||
}
|
||||
})
|
||||
end,
|
||||
},
|
||||
{
|
||||
"gaoDean/autolist.nvim",
|
||||
event = "InsertEnter",
|
||||
config = function()
|
||||
require("autolist").setup({})
|
||||
end,
|
||||
config = true,
|
||||
},
|
||||
-------------------------
|
||||
-- Syntax Highlighting --
|
||||
@ -212,17 +272,13 @@ local plugins = {
|
||||
{
|
||||
"norcalli/nvim-colorizer.lua",
|
||||
config = true,
|
||||
event = "VeryLazy",
|
||||
event = "BufReadPost",
|
||||
},
|
||||
{
|
||||
"folke/todo-comments.nvim",
|
||||
config = true,
|
||||
event = "VeryLazy",
|
||||
},
|
||||
{
|
||||
"styled-components/vim-styled-components",
|
||||
lazy = false,
|
||||
},
|
||||
{
|
||||
"nvim-treesitter/nvim-treesitter",
|
||||
event = "VeryLazy",
|
||||
@ -236,19 +292,9 @@ local plugins = {
|
||||
end,
|
||||
build = ":TSUpdate",
|
||||
},
|
||||
{
|
||||
"ckolkey/ts-node-action",
|
||||
dependencies = { "nvim-treesitter" },
|
||||
opts = {},
|
||||
},
|
||||
--------------------
|
||||
-- IDE Type Stuff --
|
||||
--------------------
|
||||
{
|
||||
"ThePrimeagen/git-worktree.nvim",
|
||||
config = true,
|
||||
event = "VeryLazy"
|
||||
},
|
||||
{
|
||||
"jackMort/ChatGPT.nvim",
|
||||
cmd = "ChatGPT",
|
||||
@ -275,7 +321,6 @@ local plugins = {
|
||||
require("max.configs.dap")
|
||||
end,
|
||||
},
|
||||
"editorconfig/editorconfig-vim",
|
||||
{
|
||||
"michaelb/sniprun",
|
||||
event = "BufRead",
|
||||
@ -305,11 +350,14 @@ local plugins = {
|
||||
},
|
||||
{
|
||||
"tpope/vim-dadbod",
|
||||
lazy = false,
|
||||
dependencies = {
|
||||
"kristijanhusak/vim-dadbod-completion",
|
||||
"kristijanhusak/vim-dadbod-ui",
|
||||
},
|
||||
cmd = "DBUI"
|
||||
},
|
||||
{ "kristijanhusak/vim-dadbod-ui", lazy = false },
|
||||
}
|
||||
|
||||
local opts = { defaults = { lazy = true }, install = { colorscheme = { "catppuccin" } } }
|
||||
local opts = { defaults = { lazy = true }, install = { colorscheme = { require("max.theme").name } } }
|
||||
|
||||
require("lazy").setup(plugins, opts)
|
||||
|
16
configs/nvim/lua/max/theme/ayu.lua
Normal file
16
configs/nvim/lua/max/theme/ayu.lua
Normal file
@ -0,0 +1,16 @@
|
||||
return {
|
||||
"Shatur/neovim-ayu",
|
||||
lazy = false,
|
||||
name = "ayu",
|
||||
config = function()
|
||||
require('ayu').setup({
|
||||
mirage = false, -- Set to `true` to use `mirage` variant instead of `dark` for dark background.
|
||||
overrides = {
|
||||
normal = { bg = "NONE" },
|
||||
}
|
||||
})
|
||||
vim.cmd("hi Normal guibg=none")
|
||||
vim.cmd("colorscheme ayu")
|
||||
vim.cmd("hi Normal guibg=none")
|
||||
end
|
||||
}
|
@ -1,8 +1,11 @@
|
||||
-- Enable Theming / Syntax
|
||||
return {
|
||||
"catppuccin/nvim",
|
||||
name = "catppuccin",
|
||||
lazy = false,
|
||||
config = function()
|
||||
vim.g.catppuccin_flavour = "frappe" -- latte, frappe, macchiato, mocha
|
||||
|
||||
local cat = require("catppuccin")
|
||||
cat.setup({
|
||||
require("catppuccin").setup({
|
||||
transparent_background = true,
|
||||
compile = {
|
||||
enabled = true,
|
||||
@ -19,7 +22,7 @@ cat.setup({
|
||||
cmp = true,
|
||||
lsp_saga = true,
|
||||
notify = true,
|
||||
nvimtree = {
|
||||
neotree = {
|
||||
enabled = true,
|
||||
show_root = false,
|
||||
},
|
||||
@ -39,3 +42,5 @@ cat.setup({
|
||||
})
|
||||
|
||||
vim.cmd("colorscheme catppuccin")
|
||||
end
|
||||
} -- Enable Theming / Syntax
|
||||
|
@ -1,59 +0,0 @@
|
||||
local defaults = {
|
||||
-- colorscheme can be a string like `catppuccin` or a function that will load the colorscheme
|
||||
---@type string|fun()
|
||||
colorscheme = function()
|
||||
require("tokyonight").load()
|
||||
end,
|
||||
-- icons used by other plugins
|
||||
icons = {
|
||||
diagnostics = {
|
||||
Error = " ",
|
||||
Warn = " ",
|
||||
Hint = " ",
|
||||
Info = " ",
|
||||
},
|
||||
git = {
|
||||
added = " ",
|
||||
modified = " ",
|
||||
removed = " ",
|
||||
},
|
||||
kinds = {
|
||||
Array = " ",
|
||||
Boolean = " ",
|
||||
Class = " ",
|
||||
Color = " ",
|
||||
Constant = " ",
|
||||
Constructor = " ",
|
||||
Enum = " ",
|
||||
EnumMember = " ",
|
||||
Event = " ",
|
||||
Field = " ",
|
||||
File = " ",
|
||||
Folder = " ",
|
||||
Function = " ",
|
||||
Interface = " ",
|
||||
Key = " ",
|
||||
Keyword = " ",
|
||||
Method = " ",
|
||||
Module = " ",
|
||||
Namespace = " ",
|
||||
Null = "ﳠ ",
|
||||
Number = " ",
|
||||
Object = " ",
|
||||
Operator = " ",
|
||||
Package = " ",
|
||||
Property = " ",
|
||||
Reference = " ",
|
||||
Snippet = " ",
|
||||
String = " ",
|
||||
Struct = " ",
|
||||
Text = " ",
|
||||
TypeParameter = " ",
|
||||
Unit = " ",
|
||||
Value = " ",
|
||||
Variable = " ",
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
return defaults
|
1
configs/nvim/lua/max/theme/init.lua
Normal file
1
configs/nvim/lua/max/theme/init.lua
Normal file
@ -0,0 +1 @@
|
||||
return require("max.theme.catpuccin");
|
@ -1,3 +1,7 @@
|
||||
return {
|
||||
"folke/tokyonight.nvim",
|
||||
name = "tokyonight",
|
||||
config = function()
|
||||
require("tokyonight").setup({
|
||||
-- your configuration comes here
|
||||
-- or leave it empty to use the default settings
|
||||
@ -35,3 +39,5 @@ require("tokyonight").setup({
|
||||
})
|
||||
|
||||
vim.cmd("colorscheme tokyonight")
|
||||
end
|
||||
}
|
||||
|
@ -0,0 +1,21 @@
|
||||
return {
|
||||
"sam4llis/nvim-tundra",
|
||||
name = "tundra",
|
||||
config = function()
|
||||
require("nvim-tundra").setup({
|
||||
transparent_background = true,
|
||||
plugins = {
|
||||
lsp = true,
|
||||
treesitter = true,
|
||||
telescope = true,
|
||||
nvimtree = true,
|
||||
cmp = true,
|
||||
dbui = true,
|
||||
gitsigns = true,
|
||||
}
|
||||
})
|
||||
|
||||
vim.opt.background = 'dark'
|
||||
vim.cmd('colorscheme tundra')
|
||||
end
|
||||
}
|
@ -1,34 +0,0 @@
|
||||
local M = {}
|
||||
local cmd = vim.cmd
|
||||
|
||||
function M.create_augroup(autocmds, name)
|
||||
cmd("augroup " .. name)
|
||||
cmd("autocmd!")
|
||||
for _, autocmd in ipairs(autocmds) do
|
||||
cmd("autocmd " .. table.concat(autocmd, " "))
|
||||
end
|
||||
cmd("augroup END")
|
||||
end
|
||||
|
||||
function M.ReloadConfig()
|
||||
for name, _ in pairs(package.loaded) do
|
||||
if name:match("^cnull") then
|
||||
package.loaded[name] = nil
|
||||
end
|
||||
end
|
||||
|
||||
dofile(vim.env.MYVIMRC)
|
||||
end
|
||||
|
||||
local inspect = require("inspect")
|
||||
|
||||
function M.dump(o)
|
||||
print(inspect.inspect(o))
|
||||
end
|
||||
|
||||
function M.has_plugin(pluginName)
|
||||
local status = pcall(require, pluginName)
|
||||
return status
|
||||
end
|
||||
|
||||
return M
|
@ -1,337 +0,0 @@
|
||||
local _tl_compat; if (tonumber((_VERSION or ''):match('[%d.]*$')) or 0) < 5.3 then local p, m = pcall(require, 'compat53.module'); if p then _tl_compat = m end end; local math = _tl_compat and _tl_compat.math or math; local string = _tl_compat and _tl_compat.string or string; local table = _tl_compat and _tl_compat.table or table
|
||||
local inspect = {Options = {}, }
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
inspect._VERSION = 'inspect.lua 3.1.0'
|
||||
inspect._URL = 'http://github.com/kikito/inspect.lua'
|
||||
inspect._DESCRIPTION = 'human-readable representations of tables'
|
||||
inspect._LICENSE = [[
|
||||
MIT LICENSE
|
||||
|
||||
Copyright (c) 2022 Enrique García Cota
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a
|
||||
copy of this software and associated documentation files (the
|
||||
"Software"), to deal in the Software without restriction, including
|
||||
without limitation the rights to use, copy, modify, merge, publish,
|
||||
distribute, sublicense, and/or sell copies of the Software, and to
|
||||
permit persons to whom the Software is furnished to do so, subject to
|
||||
the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included
|
||||
in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
||||
OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
||||
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
||||
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
||||
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
||||
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
]]
|
||||
inspect.KEY = setmetatable({}, { __tostring = function() return 'inspect.KEY' end })
|
||||
inspect.METATABLE = setmetatable({}, { __tostring = function() return 'inspect.METATABLE' end })
|
||||
|
||||
local tostring = tostring
|
||||
local rep = string.rep
|
||||
local match = string.match
|
||||
local char = string.char
|
||||
local gsub = string.gsub
|
||||
local fmt = string.format
|
||||
|
||||
local function rawpairs(t)
|
||||
return next, t, nil
|
||||
end
|
||||
|
||||
|
||||
|
||||
local function smartQuote(str)
|
||||
if match(str, '"') and not match(str, "'") then
|
||||
return "'" .. str .. "'"
|
||||
end
|
||||
return '"' .. gsub(str, '"', '\\"') .. '"'
|
||||
end
|
||||
|
||||
|
||||
local shortControlCharEscapes = {
|
||||
["\a"] = "\\a", ["\b"] = "\\b", ["\f"] = "\\f", ["\n"] = "\\n",
|
||||
["\r"] = "\\r", ["\t"] = "\\t", ["\v"] = "\\v", ["\127"] = "\\127",
|
||||
}
|
||||
local longControlCharEscapes = { ["\127"] = "\127" }
|
||||
for i = 0, 31 do
|
||||
local ch = char(i)
|
||||
if not shortControlCharEscapes[ch] then
|
||||
shortControlCharEscapes[ch] = "\\" .. i
|
||||
longControlCharEscapes[ch] = fmt("\\%03d", i)
|
||||
end
|
||||
end
|
||||
|
||||
local function escape(str)
|
||||
return (gsub(gsub(gsub(str, "\\", "\\\\"),
|
||||
"(%c)%f[0-9]", longControlCharEscapes),
|
||||
"%c", shortControlCharEscapes))
|
||||
end
|
||||
|
||||
local function isIdentifier(str)
|
||||
return type(str) == "string" and not not str:match("^[_%a][_%a%d]*$")
|
||||
end
|
||||
|
||||
local flr = math.floor
|
||||
local function isSequenceKey(k, sequenceLength)
|
||||
return type(k) == "number" and
|
||||
flr(k) == k and
|
||||
1 <= (k) and
|
||||
k <= sequenceLength
|
||||
end
|
||||
|
||||
local defaultTypeOrders = {
|
||||
['number'] = 1, ['boolean'] = 2, ['string'] = 3, ['table'] = 4,
|
||||
['function'] = 5, ['userdata'] = 6, ['thread'] = 7,
|
||||
}
|
||||
|
||||
local function sortKeys(a, b)
|
||||
local ta, tb = type(a), type(b)
|
||||
|
||||
|
||||
if ta == tb and (ta == 'string' or ta == 'number') then
|
||||
return (a) < (b)
|
||||
end
|
||||
|
||||
local dta = defaultTypeOrders[ta] or 100
|
||||
local dtb = defaultTypeOrders[tb] or 100
|
||||
|
||||
|
||||
return dta == dtb and ta < tb or dta < dtb
|
||||
end
|
||||
|
||||
local function getKeys(t)
|
||||
|
||||
local seqLen = 1
|
||||
while rawget(t, seqLen) ~= nil do
|
||||
seqLen = seqLen + 1
|
||||
end
|
||||
seqLen = seqLen - 1
|
||||
|
||||
local keys, keysLen = {}, 0
|
||||
for k in rawpairs(t) do
|
||||
if not isSequenceKey(k, seqLen) then
|
||||
keysLen = keysLen + 1
|
||||
keys[keysLen] = k
|
||||
end
|
||||
end
|
||||
table.sort(keys, sortKeys)
|
||||
return keys, keysLen, seqLen
|
||||
end
|
||||
|
||||
local function countCycles(x, cycles)
|
||||
if type(x) == "table" then
|
||||
if cycles[x] then
|
||||
cycles[x] = cycles[x] + 1
|
||||
else
|
||||
cycles[x] = 1
|
||||
for k, v in rawpairs(x) do
|
||||
countCycles(k, cycles)
|
||||
countCycles(v, cycles)
|
||||
end
|
||||
countCycles(getmetatable(x), cycles)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
local function makePath(path, a, b)
|
||||
local newPath = {}
|
||||
local len = #path
|
||||
for i = 1, len do newPath[i] = path[i] end
|
||||
|
||||
newPath[len + 1] = a
|
||||
newPath[len + 2] = b
|
||||
|
||||
return newPath
|
||||
end
|
||||
|
||||
|
||||
local function processRecursive(process,
|
||||
item,
|
||||
path,
|
||||
visited)
|
||||
if item == nil then return nil end
|
||||
if visited[item] then return visited[item] end
|
||||
|
||||
local processed = process(item, path)
|
||||
if type(processed) == "table" then
|
||||
local processedCopy = {}
|
||||
visited[item] = processedCopy
|
||||
local processedKey
|
||||
|
||||
for k, v in rawpairs(processed) do
|
||||
processedKey = processRecursive(process, k, makePath(path, k, inspect.KEY), visited)
|
||||
if processedKey ~= nil then
|
||||
processedCopy[processedKey] = processRecursive(process, v, makePath(path, processedKey), visited)
|
||||
end
|
||||
end
|
||||
|
||||
local mt = processRecursive(process, getmetatable(processed), makePath(path, inspect.METATABLE), visited)
|
||||
if type(mt) ~= 'table' then mt = nil end
|
||||
setmetatable(processedCopy, mt)
|
||||
processed = processedCopy
|
||||
end
|
||||
return processed
|
||||
end
|
||||
|
||||
local function puts(buf, str)
|
||||
buf.n = buf.n + 1
|
||||
buf[buf.n] = str
|
||||
end
|
||||
|
||||
|
||||
|
||||
local Inspector = {}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
local Inspector_mt = { __index = Inspector }
|
||||
|
||||
local function tabify(inspector)
|
||||
puts(inspector.buf, inspector.newline .. rep(inspector.indent, inspector.level))
|
||||
end
|
||||
|
||||
function Inspector:getId(v)
|
||||
local id = self.ids[v]
|
||||
local ids = self.ids
|
||||
if not id then
|
||||
local tv = type(v)
|
||||
id = (ids[tv] or 0) + 1
|
||||
ids[v], ids[tv] = id, id
|
||||
end
|
||||
return tostring(id)
|
||||
end
|
||||
|
||||
function Inspector:putValue(v)
|
||||
local buf = self.buf
|
||||
local tv = type(v)
|
||||
if tv == 'string' then
|
||||
puts(buf, smartQuote(escape(v)))
|
||||
elseif tv == 'number' or tv == 'boolean' or tv == 'nil' or
|
||||
tv == 'cdata' or tv == 'ctype' then
|
||||
puts(buf, tostring(v))
|
||||
elseif tv == 'table' and not self.ids[v] then
|
||||
local t = v
|
||||
|
||||
if t == inspect.KEY or t == inspect.METATABLE then
|
||||
puts(buf, tostring(t))
|
||||
elseif self.level >= self.depth then
|
||||
puts(buf, '{...}')
|
||||
else
|
||||
if self.cycles[t] > 1 then puts(buf, fmt('<%d>', self:getId(t))) end
|
||||
|
||||
local keys, keysLen, seqLen = getKeys(t)
|
||||
|
||||
puts(buf, '{')
|
||||
self.level = self.level + 1
|
||||
|
||||
for i = 1, seqLen + keysLen do
|
||||
if i > 1 then puts(buf, ',') end
|
||||
if i <= seqLen then
|
||||
puts(buf, ' ')
|
||||
self:putValue(t[i])
|
||||
else
|
||||
local k = keys[i - seqLen]
|
||||
tabify(self)
|
||||
if isIdentifier(k) then
|
||||
puts(buf, k)
|
||||
else
|
||||
puts(buf, "[")
|
||||
self:putValue(k)
|
||||
puts(buf, "]")
|
||||
end
|
||||
puts(buf, ' = ')
|
||||
self:putValue(t[k])
|
||||
end
|
||||
end
|
||||
|
||||
local mt = getmetatable(t)
|
||||
if type(mt) == 'table' then
|
||||
if seqLen + keysLen > 0 then puts(buf, ',') end
|
||||
tabify(self)
|
||||
puts(buf, '<metatable> = ')
|
||||
self:putValue(mt)
|
||||
end
|
||||
|
||||
self.level = self.level - 1
|
||||
|
||||
if keysLen > 0 or type(mt) == 'table' then
|
||||
tabify(self)
|
||||
elseif seqLen > 0 then
|
||||
puts(buf, ' ')
|
||||
end
|
||||
|
||||
puts(buf, '}')
|
||||
end
|
||||
|
||||
else
|
||||
puts(buf, fmt('<%s %d>', tv, self:getId(v)))
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
|
||||
|
||||
function inspect.inspect(root, options)
|
||||
options = options or {}
|
||||
|
||||
local depth = options.depth or (math.huge)
|
||||
local newline = options.newline or '\n'
|
||||
local indent = options.indent or ' '
|
||||
local process = options.process
|
||||
|
||||
if process then
|
||||
root = processRecursive(process, root, {}, {})
|
||||
end
|
||||
|
||||
local cycles = {}
|
||||
countCycles(root, cycles)
|
||||
|
||||
local inspector = setmetatable({
|
||||
buf = { n = 0 },
|
||||
ids = {},
|
||||
cycles = cycles,
|
||||
depth = depth,
|
||||
level = 0,
|
||||
newline = newline,
|
||||
indent = indent,
|
||||
}, Inspector_mt)
|
||||
|
||||
inspector:putValue(root)
|
||||
|
||||
return table.concat(inspector.buf)
|
||||
end
|
||||
|
||||
setmetatable(inspect, {
|
||||
__call = function(_, root, options)
|
||||
return inspect.inspect(root, options)
|
||||
end,
|
||||
})
|
||||
|
||||
return inspect
|
@ -1,5 +0,0 @@
|
||||
local fn = vim.fn
|
||||
local install_path = fn.stdpath('data') .. '/site/pack/packer/start/packer.nvim'
|
||||
if fn.empty(fn.glob(install_path)) > 0 then
|
||||
fn.system({ 'git', 'clone', '--depth=1', 'https://github.com/wbthomason/packer.nvim', install_path })
|
||||
end
|
@ -1,43 +0,0 @@
|
||||
-- see if the file exists
|
||||
local function file_exists(file)
|
||||
local f = io.open(file, "rb")
|
||||
if f then
|
||||
f:close()
|
||||
end
|
||||
return f ~= nil
|
||||
end
|
||||
|
||||
-- get all lines from a file, returns an empty
|
||||
-- list/table if the file does not exist
|
||||
local function line_from(file)
|
||||
if not file_exists(file) then
|
||||
return ""
|
||||
end
|
||||
local f = io.open(file) -- 'r' is unnecessary because it's a default value.
|
||||
if f == nil then
|
||||
return ""
|
||||
end
|
||||
local line = f:read() -- '*l' is unnecessary because it's a default value.
|
||||
f:close()
|
||||
return line
|
||||
end
|
||||
|
||||
local filePath = os.getenv("HOME") .. "/.cache/dark-mode"
|
||||
local function updateTheme()
|
||||
local line = line_from(filePath)
|
||||
if line then
|
||||
local light = string.find(line, "light")
|
||||
if light then
|
||||
vim.g.catppuccin_flavour = "latte"
|
||||
vim.cmd("Catppuccin latte")
|
||||
else
|
||||
vim.g.catppuccin_flavour = "mocha"
|
||||
vim.cmd("Catppuccin mocha")
|
||||
end
|
||||
vim.cmd("colorscheme catppuccin")
|
||||
end
|
||||
end
|
||||
|
||||
updateTheme()
|
||||
local w = vim.loop.new_fs_event()
|
||||
w:start(filePath, {}, vim.schedule_wrap(updateTheme))
|
Loading…
Reference in New Issue
Block a user