Compare commits

...

10 Commits

17 changed files with 365 additions and 307 deletions

View File

@ -13,6 +13,6 @@ require("config.harpoon")
require("config.autopairs") require("config.autopairs")
require("config.autotags") require("config.autotags")
require("config.conform") require("config.conform")
-- require("config.dashboard")
require("options") require("options")
require("keymaps") require("keymaps")
require("commands")

View File

@ -1,34 +1,36 @@
{ {
"FTerm.nvim": { "branch": "master", "commit": "d1320892cc2ebab472935242d9d992a2c9570180" }, "FTerm.nvim": { "branch": "master", "commit": "d1320892cc2ebab472935242d9d992a2c9570180" },
"LuaSnip": { "branch": "master", "commit": "8ae1dedd988eb56441b7858bd1e8554dfadaa46d" }, "LuaSnip": { "branch": "master", "commit": "03c8e67eb7293c404845b3982db895d59c0d1538" },
"catppuccin": { "branch": "main", "commit": "02bdd749931a5d739063562e57531c118e081882" }, "catppuccin": { "branch": "main", "commit": "0b5df9c9e641b1212b21a0762ccad4434fd41322" },
"cmp-buffer": { "branch": "main", "commit": "3022dbc9166796b644a841a02de8dd1cc1d311fa" }, "cmp-buffer": { "branch": "main", "commit": "3022dbc9166796b644a841a02de8dd1cc1d311fa" },
"cmp-cmdline": { "branch": "main", "commit": "d250c63aa13ead745e3a40f61fdd3470efde3923" }, "cmp-cmdline": { "branch": "main", "commit": "d250c63aa13ead745e3a40f61fdd3470efde3923" },
"cmp-nvim-lsp": { "branch": "main", "commit": "5af77f54de1b16c34b23cba810150689a3a90312" }, "cmp-nvim-lsp": { "branch": "main", "commit": "39e2eda76828d88b773cc27a3f61d2ad782c922d" },
"cmp-path": { "branch": "main", "commit": "91ff86cd9c29299a64f968ebb45846c485725f23" }, "cmp-path": { "branch": "main", "commit": "91ff86cd9c29299a64f968ebb45846c485725f23" },
"conform.nvim": { "branch": "master", "commit": "9d5ba06d6ee7418c674f498634617416d15b6239" }, "conform.nvim": { "branch": "master", "commit": "797de8f79055334104cf77893cd93fe3fc2ac154" },
"copilot.vim": { "branch": "release", "commit": "f45ecd95c1474885e278f20d6ae86a6e30de2151" }, "copilot.vim": { "branch": "release", "commit": "25f73977033c597d530c7ab0e211d99b60927d2d" },
"dashboard-nvim": { "branch": "master", "commit": "681300934baf36f6184ca41f0b26aed22056d4ee" }, "dashboard-nvim": { "branch": "master", "commit": "fabf5feec96185817c732d47d363f34034212685" },
"git-blame.nvim": { "branch": "master", "commit": "a0282d05adbee80aaf4e2ff35b81b52940b67bed" }, "git-blame.nvim": { "branch": "master", "commit": "408d5487d908dfe5d48e5645d8b27ddcc16b11e0" },
"harpoon": { "branch": "harpoon2", "commit": "0378a6c428a0bed6a2781d459d7943843f374bce" }, "harpoon": { "branch": "harpoon2", "commit": "0378a6c428a0bed6a2781d459d7943843f374bce" },
"lazy.nvim": { "branch": "main", "commit": "31ddbea7c10b6920c9077b66c97951ca8682d5c8" }, "lazy.nvim": { "branch": "main", "commit": "9a374a0fb4d3ac42dac4a129d4bead7252473c77" },
"lspkind.nvim": { "branch": "master", "commit": "1735dd5a5054c1fb7feaf8e8658dbab925f4f0cf" }, "lspkind.nvim": { "branch": "master", "commit": "1735dd5a5054c1fb7feaf8e8658dbab925f4f0cf" },
"lualine.nvim": { "branch": "master", "commit": "0a5a66803c7407767b799067986b4dc3036e1983" }, "lualine.nvim": { "branch": "master", "commit": "544dd1583f9bb27b393f598475c89809c4d5e86b" },
"mason-lspconfig.nvim": { "branch": "main", "commit": "44509689b9bf3984d729cc264aacb31cb7f41668" }, "mason-lspconfig.nvim": { "branch": "main", "commit": "58bc9119ca273c0ce5a66fad1927ef0f617bd81b" },
"mason.nvim": { "branch": "main", "commit": "751b1fcbf3d3b783fcf8d48865264a9bcd8f9b10" }, "mason-nvim-dap.nvim": { "branch": "main", "commit": "4ba55f9755ebe8297d92c419b90a946123292ae6" },
"mason.nvim": { "branch": "main", "commit": "e2f7f9044ec30067bc11800a9e266664b88cda22" },
"monokai.nvim": { "branch": "master", "commit": "b8bd44d5796503173627d7a1fc51f77ec3a08a63" }, "monokai.nvim": { "branch": "master", "commit": "b8bd44d5796503173627d7a1fc51f77ec3a08a63" },
"nvim-autopairs": { "branch": "master", "commit": "4f41e5940bc0443fdbe5f995e2a596847215cd2a" }, "nvim-autopairs": { "branch": "master", "commit": "78a4507bb9ffc9b00f11ae0ac48243d00cb9194d" },
"nvim-cmp": { "branch": "main", "commit": "ce16de5665c766f39c271705b17fff06f7bcb84f" }, "nvim-cmp": { "branch": "main", "commit": "d818fd0624205b34e14888358037fb6f5dc51234" },
"nvim-comment": { "branch": "main", "commit": "e9ac16ab056695cad6461173693069ec070d2b23" }, "nvim-comment": { "branch": "main", "commit": "e9ac16ab056695cad6461173693069ec070d2b23" },
"nvim-dap": { "branch": "master", "commit": "405df1dcc2e395ab5173a9c3d00e03942c023074" }, "nvim-dap": { "branch": "master", "commit": "bc03b83c94d0375145ff5ac6a6dcf28c1241e06f" },
"nvim-grey": { "branch": "main", "commit": "e5fc8cc1e0c88c23bc6c92845f19a342f561c409" }, "nvim-grey": { "branch": "main", "commit": "b57f62baddc5a295bd0ffd61ff9a671a149df95a" },
"nvim-lspconfig": { "branch": "master", "commit": "e25c4cdecd3d58c0deccce0f372426c8c480bcce" }, "nvim-lspconfig": { "branch": "master", "commit": "e26da408cf955afa8e9ddbadd510e84ea8976cd7" },
"nvim-tree.lua": { "branch": "master", "commit": "81eb8d519233c105f30dc0a278607e62b20502fd" }, "nvim-tree.lua": { "branch": "master", "commit": "f9ff00bc06d7cb70548a3847d7a2a05e928bc988" },
"nvim-treesitter": { "branch": "master", "commit": "2bad828b48aed74efe8f7e4ea15550e18c7b482d" }, "nvim-treesitter": { "branch": "master", "commit": "4e387dd47833c1bb8c8df6c3a7cab0d4c55583f3" },
"nvim-ts-autotag": { "branch": "main", "commit": "531f48334c422222aebc888fd36e7d109cb354cd" }, "nvim-ts-autotag": { "branch": "main", "commit": "1624866a1379fc1861797f0ed05899a9c1d2ff61" },
"nvim-web-devicons": { "branch": "master", "commit": "6e355632387a085f15a66ad68cf681c1d7374a04" }, "nvim-web-devicons": { "branch": "master", "commit": "c0cfc1738361b5da1cd0a962dd6f774cc444f856" },
"plenary.nvim": { "branch": "master", "commit": "8aad4396840be7fc42896e3011751b7609ca4119" }, "plenary.nvim": { "branch": "master", "commit": "a3e3bc82a3f95c5ed0d7201546d5d2c19b20d683" },
"telescope.nvim": { "branch": "master", "commit": "6312868392331c9c0f22725041f1ec2bef57c751" }, "telescope.nvim": { "branch": "master", "commit": "6312868392331c9c0f22725041f1ec2bef57c751" },
"themery.nvim": { "branch": "main", "commit": "1005a58801276d29c4b1e11244cf7631250f9143" }, "themery.nvim": { "branch": "main", "commit": "f745a49d9c103babde35e1111b91faa6bc591d5c" },
"vim-maximizer": { "branch": "master", "commit": "2e54952fe91e140a2e69f35f22131219fcd9c5f1" } "vim-maximizer": { "branch": "master", "commit": "2e54952fe91e140a2e69f35f22131219fcd9c5f1" },
} "vscode-js-debug": { "branch": "main", "commit": "29ba3af04e436d85b035a08c03f55e421679fc25" }
}

19
lua/commands.lua 100644
View File

@ -0,0 +1,19 @@
local api = vim.api
-- Show file path in command bar
api.nvim_create_user_command("ShowFilePath", function()
print(vim.fn.expand("%:p"))
end, { bang = true })
-- Toggle wrap
vim.api.nvim_create_user_command("ToggleWrap", function()
if vim.wo.wrap then
vim.wo.wrap = false
print("Word wrap disabled")
else
vim.wo.wrap = true
vim.wo.linebreak = true
vim.wo.breakindent = true
print("Word wrap enabled")
end
end, {})

View File

@ -1,18 +1,21 @@
require'nvim-treesitter.configs'.setup { require("nvim-treesitter.configs").setup({
autotag = { autotag = {
enable = true, enable = true,
} },
} opts = function(_, opts)
if type(opts.ensure_installed) == "table" then
vim.list_extend(opts.ensure_installed, { "typescript", "tsx" })
end
end,
})
-- Enable update on insert -- Enable update on insert
vim.lsp.handlers['textDocument/publishDiagnostics'] = vim.lsp.with( vim.lsp.handlers["textDocument/publishDiagnostics"] = vim.lsp.with(vim.lsp.diagnostic.on_publish_diagnostics, {
vim.lsp.diagnostic.on_publish_diagnostics, underline = true,
{ virtual_text = {
underline = true, spacing = 5,
virtual_text = { min = vim.diagnostic.severity.WARN, -- Updated from severity_limit
spacing = 5, },
severity_limit = 'Warning', update_in_insert = true,
}, })
update_in_insert = true, -- severity_limit is deprecated, use {min = severity} See vim.diagnostic.severity instead. :help deprecated Feature will be removed in Nvim 0.11
}
)

View File

@ -1,30 +1,33 @@
require("conform").setup({ require("conform").setup({
formatters_by_ft = { formatters_by_ft = {
lua = { "stylua" }, lua = { "stylua" },
javascript = { { "prettierd", "prettier" } }, javascript = { { "prettierd", "prettier" } },
typescript = { { "prettierd", "prettier" } }, typescript = { { "prettierd", "prettier" } },
json = { { "prettierd", "prettier" } }, javascriptreact = { "prettierd", "prettier" },
markdown = { { "marksman", "prettierd", "prettier" } }, typescriptreact = { "prettierd", "prettier" },
}, json = { { "prettierd", "prettier" } },
jsonc = { { "prettierd", "prettier" } },
markdown = { { "marksman", "prettier", "prettierd" } },
},
}) })
local M = {} local M = {}
M.format = function(args) M.format = function(args)
local range = nil local range = nil
if args and args.count ~= -1 then if args and args.count ~= -1 then
-- Assuming args.line1 and args.line2 are provided and valid -- Assuming args.line1 and args.line2 are provided and valid
local end_line = vim.api.nvim_buf_get_lines(0, args.line2 - 1, args.line2, true)[1] local end_line = vim.api.nvim_buf_get_lines(0, args.line2 - 1, args.line2, true)[1]
range = { range = {
start = { args.line1, 0 }, start = { args.line1, 0 },
["end"] = { args.line2, end_line:len() }, ["end"] = { args.line2, end_line:len() },
} }
end end
require("conform").format({ async = true, lsp_fallback = true, range = range }) require("conform").format({ async = true, lsp_fallback = true, range = range })
end end
vim.api.nvim_create_user_command("Format", function(args) vim.api.nvim_create_user_command("Format", function(args)
M.format(args) M.format(args)
end, { range = true }) end, { range = true })
return M return M

30
lua/config/dap.lua 100644
View File

@ -0,0 +1,30 @@
require("dap-vscode-js").setup({
-- node_path = "node", -- Path of node executable. Defaults to $NODE_PATH, and then "node"
-- debugger_path = "(runtimedir)/site/pack/packer/opt/vscode-js-debug", -- Path to vscode-js-debug installation.
-- debugger_cmd = { "js-debug-adapter" }, -- Command to use to launch the debug server. Takes precedence over `node_path` and `debugger_path`.
adapters = { 'pwa-node', 'pwa-chrome', 'pwa-msedge', 'node-terminal', 'pwa-extensionHost' }, -- which adapters to register in nvim-dap
-- log_file_path = "(stdpath cache)/dap_vscode_js.log" -- Path for file logging
-- log_file_level = false -- Logging level for output to file. Set to false to disable file logging.
-- log_console_level = vim.log.levels.ERROR -- Logging level for output to console. Set to false to disable console output.
})
for _, language in ipairs({ "typescript", "javascript" }) do
require("dap").configurations[language] = {
{
{
type = "pwa-node",
request = "launch",
name = "Launch file",
program = "${file}",
cwd = "${workspaceFolder}",
},
{
type = "pwa-node",
request = "attach",
name = "Attach",
processId = require 'dap.utils'.pick_process,
cwd = "${workspaceFolder}",
}
}
}
end

View File

@ -0,0 +1,63 @@
local M = {}
M.dashboard_config = function()
local logo = [[
]]
logo = string.rep("\n", 8) .. logo .. "\n\n"
local opts = {
theme = "doom",
hide = {
statusline = false,
},
config = {
header = vim.split(logo, "\n"),
-- stylua: ignore
center = {
{ action = "Telescope find_files", desc = " Find File", icon = "", key = "f" },
{ action = "ene | startinsert", desc = " New File", icon = "", key = "n" },
{ action = "Telescope oldfiles", desc = " Recent Files", icon = "", key = "r" },
{ action = "Telescope live_grep", desc = " Find Text", icon = "", key = "g" },
-- { action = [[lua Lazy.telescope.config_files()()]], desc = " Config", icon = " ", key = "c" },
-- { action = 'lua require("persistence").load()', desc = " Restore Session", icon = " ", key = "s" },
-- { action = "LazyExtras", desc = " Lazy Extras", icon = " ", key = "x" },
{ action = "Lazy", desc = " Lazy", icon = "󰒲 ", key = "l" },
{ action = "qa", desc = " Quit", icon = "", key = "q" },
},
footer = function()
local stats = require("lazy").stats()
local ms = (math.floor(stats.startuptime * 100 + 0.5) / 100)
return {
"⚡ Neovim loaded " .. stats.loaded .. "/" .. stats.count .. " plugins in " .. ms .. "ms",
}
end,
},
}
for _, button in ipairs(opts.config.center) do
button.desc = button.desc .. string.rep(" ", 43 - #button.desc)
button.key_format = " %s"
end
-- close Lazy and re-open when the dashboard is ready
if vim.o.filetype == "lazy" then
vim.cmd.close()
vim.api.nvim_create_autocmd("User", {
pattern = "DashboardLoaded",
callback = function()
require("lazy").show()
end,
})
end
return opts
end
return M

View File

@ -4,49 +4,45 @@ harpoon.setup({})
-- basic telescope configuration -- basic telescope configuration
local conf = require("telescope.config").values local conf = require("telescope.config").values
local function toggle_telescope(harpoon_files) local function toggle_telescope(harpoon_files)
local file_paths = {} local file_paths = {}
for _, item in ipairs(harpoon_files.items) do for _, item in ipairs(harpoon_files.items) do
table.insert(file_paths, item.value) table.insert(file_paths, item.value)
end end
require("telescope.pickers") require("telescope.pickers")
.new({}, { .new({}, {
prompt_title = "Harpoon", prompt_title = "Harpoon",
finder = require("telescope.finders").new_table({ finder = require("telescope.finders").new_table({
results = file_paths, results = file_paths,
}), }),
previewer = conf.file_previewer({}), previewer = conf.file_previewer({}),
sorter = conf.generic_sorter({}), sorter = conf.generic_sorter({}),
}) })
:find() :find()
end end
local function maybe_remove_add() local function toggle_mark()
local bufnr = api.nvim_get_current_buf() local current_file = api.nvim_buf_get_name(0) -- Get the current buffer's file path
local mark = harpoon:mark(bufnr) local item, index = harpoon:list():get_by_value(current_file)
if mark then if item then
harpoon:list():add() harpoon:list():remove_at(index)
else print("Removed from Harpoon: " .. current_file)
harpoon:list():remove() else
end harpoon:list():add({ value = current_file })
print("Added to Harpoon: " .. current_file)
end
end end
-- Commands -- Commands
api.nvim_create_user_command("HarpoonClear", function() api.nvim_create_user_command("HarpoonClear", function()
harpoon:list():clear() harpoon:list():clear()
end, { bang = true }) end, { bang = true })
api.nvim_create_user_command("HarpoonAdd", function() api.nvim_create_user_command("HarpoonAdd", function()
harpoon:list():add() harpoon:list():add()
end, { bang = true }) end, { bang = true })
api.nvim_create_user_command("HarpoonToggleFile", function() api.nvim_create_user_command("HarpoonToggleFile", function()
maybe_remove_add() toggle_mark()
end, { bang = true })
api.nvim_create_user_command("HarpoonTogglePrev", function()
harpoon:list():prev()
end, { bang = true })
api.nvim_create_user_command("HarpoonToggleNext", function()
harpoon:list():next()
end, { bang = true }) end, { bang = true })
api.nvim_create_user_command("HarpoonUI", function() api.nvim_create_user_command("HarpoonUI", function()
toggle_telescope(harpoon:list()) toggle_telescope(harpoon:list())
end, { bang = true }) end, { bang = true })

View File

@ -11,15 +11,8 @@ require("mason").setup({
-- A list of servers to automatically install if they're not already installed -- A list of servers to automatically install if they're not already installed
require("mason-lspconfig").setup({ require("mason-lspconfig").setup({
ensure_installed = { ensure_installed = {
"cssls",
"cssmodules_ls",
"graphql",
"html",
"intelephense",
"tailwindcss",
"tsserver", "tsserver",
"jsonls", "jsonls",
"lua_ls", "lua_ls",
"marksman",
}, },
}) })

View File

@ -4,6 +4,7 @@ require("nvim-tree").setup({
}, },
view = { view = {
width = 30, width = 30,
side = "right",
}, },
renderer = { renderer = {
group_empty = true, group_empty = true,

View File

@ -1,30 +1,15 @@
local actions = require("telescope.actions") local actions = require("telescope.actions")
require('telescope').setup { require("telescope").setup({
defaults = { defaults = {
-- Default configuration for telescope goes here: -- Default configuration for telescope goes here:
-- config_key = value, -- config_key = value,
mappings = { mappings = {
i = { i = {
["<esc>"] = actions.close, ["<esc>"] = actions.close,
["<C-u>"] = false ["<C-u>"] = false,
} },
} },
}, },
pickers = { })
-- Default configuration for builtin pickers goes here:
-- picker_name = {
-- picker_config_key = value,
-- ...
-- }
-- Now the picker_config_key will be applied every time you call this
-- builtin picker
},
extensions = {
-- Your extension configuration goes here:
-- extension_name = {
-- extension_config_key = value,
-- }
-- please take a look at the readme of the extension you want to configure
}
}

View File

@ -14,6 +14,5 @@ require("themery").setup({
colorscheme = "catppuccin-mocha", colorscheme = "catppuccin-mocha",
}, },
}, },
themeConfigFile = "~/.config/nvim/lua/config/theme.lua", -- Desibed below
livePreview = true, -- Apply theme while browsing. Default to true. livePreview = true, -- Apply theme while browsing. Default to true.
}) })

View File

@ -2,73 +2,75 @@ local keymap = vim.api.nvim_set_keymap
local opts = { noremap = true, silent = true } local opts = { noremap = true, silent = true }
local mappings = { local mappings = {
n = { n = {
-- highlighting -- highlighting
["<leader>nh"] = ":nohl<CR>", ["<leader>nh"] = ":nohl<CR>",
-- move between buffers -- move between buffers
["<c-h>"] = "<C-w>h", ["<c-h>"] = "<C-w>h",
["<c-j>"] = "<C-w>j", ["<c-j>"] = "<C-w>j",
["<c-k>"] = "<C-w>k", ["<c-k>"] = "<C-w>k",
["<c-l>"] = "<C-w>l", ["<c-l>"] = "<C-w>l",
-- open and close buggers -- open and close buggers
["<leader>sv"] = "<C-w>s", ["<leader>sv"] = "<C-w>s",
["<leader>sh"] = "<C-w>v", ["<leader>sh"] = "<C-w>v",
["<leader>se"] = "<C-w>=", ["<leader>se"] = "<C-w>=",
["<leader>sx"] = ":close<CR>", ["<leader>sx"] = ":close<CR>",
-- nvim-tree -- nvim-tree
["<leader>e"] = ":NvimTreeFindFileToggle<CR>", ["<leader>e"] = ":NvimTreeFindFileToggle<CR>",
["<leader>cf"] = ":NvimTreeCollapse<CR>", ["<leader>cf"] = ":NvimTreeCollapse<CR>",
-- LSP -- LSP
["<leader>ls"] = ":lspstop<CR>", ["<leader>ls"] = ":lspstop<CR>",
["<leader>lo"] = ":lspstart<CR>", ["<leader>lo"] = ":lspstart<CR>",
-- Telescope -- Telescope
["<leader>ff"] = "<cmd>Telescope find_files<CR>", ["<leader>ff"] = "<cmd>Telescope find_files<CR>",
["<leader>fw"] = "<cmd>Telescope live_grep<CR>", ["<leader>fw"] = "<cmd>Telescope live_grep<CR>",
["<leader>fc"] = "<cmd>Telescope grep_string<CR>", ["<leader>fc"] = "<cmd>Telescope grep_string<CR>",
["<leader>th"] = "<cmd>Themery<CR>", ["<leader>th"] = "<cmd>Themery<CR>",
["<leader>sm"] = ":MaximizerToggle<CR>", ["<leader>sm"] = ":MaximizerToggle<CR>",
-- FTerm -- FTerm
["<leader>h"] = "<cmd>FTermToggle<CR>", ["<leader>h"] = "<cmd>FTermToggle<CR>",
-- Harpoon -- Harpoon
["<leader>a"] = "<cmd>HarpoonAdd<CR>", ["<leader>a"] = "<cmd>HarpoonToggleFile<CR>",
["<C-e>"] = "<cmd>HarpoonUI<CR>", ["<C-e>"] = "<cmd>HarpoonUI<CR>",
["<leader>c"] = "<cmd>HarpoonClear<CR>", ["<leader>c"] = "<cmd>HarpoonClear<CR>",
-- Formating -- Formating
["<leader>fm"] = "<cmd>Format<CR>", ["<leader>fm"] = "<cmd>Format<CR>",
-- Disable help menu -- Disable help menu
["<F1>"] = "<nop>", ["<F1>"] = "<nop>",
}, -- Toggle word wrap
x = { ["<leader>w"] = "<cmd>ToggleWrap<CR>",
["<A-j>"] = ":move '>+1<CR>gv-gv", },
["<A-k>"] = ":move '<-2<CR>gv-gv", x = {
}, ["<A-j>"] = ":move '>+1<CR>gv-gv",
i = { ["<A-k>"] = ":move '<-2<CR>gv-gv",
["<C-Space>"] = { 'copilot#Accept("<CR>")', expr = true }, },
["<A-l>"] = "<esc>", i = {
["C-BS"] = "<cmd>HarpoonRemove<CR>", ["<C-Space>"] = { 'copilot#Accept("<CR>")', expr = true },
-- Disable help menu ["<A-l>"] = "<esc>",
["<F1>"] = "<nop>", ["C-BS"] = "<cmd>HarpoonRemove<CR>",
}, -- Disable help menu
t = { ["<F1>"] = "<nop>",
["C-h"] = "<C-\\><C-n>:FTermClose<CR>", },
}, t = {
["C-h"] = "<C-\\><C-n>:FTermClose<CR>",
},
} }
for mode, mode_mappings in pairs(mappings) do for mode, mode_mappings in pairs(mappings) do
for key, mapping in pairs(mode_mappings) do for key, mapping in pairs(mode_mappings) do
if type(mapping) == "function" then if type(mapping) == "function" then
-- For direct Lua function calls; ensure your function returns a string command -- For direct Lua function calls; ensure your function returns a string command
keymap(mode, key, "<cmd>lua " .. mapping() .. "<CR>", opts) keymap(mode, key, "<cmd>lua " .. mapping() .. "<CR>", opts)
elseif type(mapping) == "table" and mapping.expr then elseif type(mapping) == "table" and mapping.expr then
-- For expression mappings, like for copilot -- For expression mappings, like for copilot
local expr_opts = vim.tbl_extend("force", opts, { expr = true }) local expr_opts = vim.tbl_extend("force", opts, { expr = true })
keymap(mode, key, mapping[1], expr_opts) keymap(mode, key, mapping[1], expr_opts)
elseif type(mapping) == "table" then elseif type(mapping) == "table" then
-- For mappings that have their options specified directly -- For mappings that have their options specified directly
keymap(mode, key, mapping[1], mapping[2] or opts) keymap(mode, key, mapping[1], mapping[2] or opts)
else else
-- For simple string command mappings -- For simple string command mappings
keymap(mode, key, mapping, opts) keymap(mode, key, mapping, opts)
end end
end end
end end

View File

@ -1,65 +1,69 @@
local lspconfig = require("lspconfig") local lspconfig = require("lspconfig")
local mappings = { local mappings = {
["<leader>k"] = vim.diagnostic.open_float, ["<leader>k"] = vim.diagnostic.open_float,
["[d"] = vim.diagnostic.goto_prev, ["[d"] = vim.diagnostic.goto_prev,
["]d"] = vim.diagnostic.goto_next, ["]d"] = vim.diagnostic.goto_next,
["<leader>q"] = vim.diagnostic.setloclist, ["<leader>q"] = vim.diagnostic.setloclist,
["gD"] = vim.lsp.buf.declaration, ["gD"] = vim.lsp.buf.declaration,
["gd"] = vim.lsp.buf.definition, ["gd"] = vim.lsp.buf.definition,
["K"] = vim.lsp.buf.hover, ["K"] = vim.lsp.buf.hover,
["gi"] = vim.lsp.buf.implementation, ["gi"] = vim.lsp.buf.implementation,
["<leader>wa"] = vim.lsp.buf.add_workspace_folder, ["<leader>wa"] = vim.lsp.buf.add_workspace_folder,
["<leader>wr"] = vim.lsp.buf.remove_workspace_folder, ["<leader>wr"] = vim.lsp.buf.remove_workspace_folder,
["<leader>wl"] = function() ["<leader>wl"] = function()
print(vim.inspect(vim.lsp.buf.list_workleader_folders())) print(vim.inspect(vim.lsp.buf.list_workleader_folders()))
end, end,
["<leader>D"] = vim.lsp.buf.type_definition, ["<leader>D"] = vim.lsp.buf.type_definition,
["<leader>rn"] = vim.lsp.buf.rename, ["<leader>rn"] = vim.lsp.buf.rename,
["<leader>ca"] = vim.lsp.buf.code_action, ["<leader>ca"] = vim.lsp.buf.code_action,
["gr"] = vim.lsp.buf.references, ["gr"] = vim.lsp.buf.references,
} }
local on_attach = function(client, bufnr) local on_attach = function(client, bufnr)
-- Enable completion triggered by <c-x><c-o> -- Enable completion triggered by <c-x><c-o>
vim.api.nvim_buf_set_option(bufnr, "omnifunc", "v:lua.vim.lsp.omnifunc") vim.api.nvim_buf_set_option(bufnr, "omnifunc", "v:lua.vim.lsp.omnifunc")
local bufopts = { noremap = true, silent = true, buffer = bufnr } local bufopts = { noremap = true, silent = true, buffer = bufnr }
for key, mapping in pairs(mappings) do for key, mapping in pairs(mappings) do
vim.keymap.set("n", key, mapping, bufopts) vim.keymap.set("n", key, mapping, bufopts)
end end
end end
local servers = { local servers = {
"tsserver", "tsserver",
"intelephense", "lua_ls",
"tailwindcss",
"lua_ls",
"marksman",
} }
local capabilities = vim.lsp.protocol.make_client_capabilities() local capabilities = vim.lsp.protocol.make_client_capabilities()
capabilities.textDocument.completion.completionItem = { capabilities.textDocument.completion.completionItem = {
documentationFormat = { "markdown", "plaintext" }, documentationFormat = { "markdown", "plaintext" },
snippetSupport = true, snippetSupport = true,
preselectSupport = true, preselectSupport = true,
insertReplaceSupport = true, insertReplaceSupport = true,
labelDetailsSupport = true, labelDetailsSupport = true,
deprecatedSupport = true, deprecatedSupport = true,
commitCharactersSupport = true, commitCharactersSupport = true,
tagSupport = { valueSet = { 1 } }, tagSupport = { valueSet = { 1 } },
resolveSupport = { resolveSupport = {
properties = { properties = {
"documentation", "documentation",
"detail", "detail",
"additionalTextEdits", "additionalTextEdits",
}, },
}, },
} }
for _, lsp in ipairs(servers) do for _, lsp in ipairs(servers) do
lspconfig[lsp].setup({ lspconfig[lsp].setup({
on_attach = on_attach, on_attach = on_attach,
capabilities = capabilities, capabilities = capabilities,
}) -- For suppressing vim error messages in config
settings = {
Lua = {
diagnostics = { globals = { "vim" } },
},
},
})
end end

View File

@ -31,7 +31,8 @@ opt.cursorline = true -- highlight cursor line underneath the cursor horizontall
opt.splitbelow = true -- open new vertical split bottom opt.splitbelow = true -- open new vertical split bottom
opt.splitright = true -- open new horizontal splits right opt.splitright = true -- open new horizontal splits right
opt.termguicolors = true -- enabl 24-bit RGB color in the TUI opt.termguicolors = true -- enabl 24-bit RGB color in the TUI
api.nvim_set_hl(0, "LineNr", { fg = "#5f87af", blend = 0 })
api.nvim_set_hl(0, "CursorLineNr", { fg = "#ffd700", blend = 0 })
-- Searching -- Searching
opt.incsearch = true -- search as characters are entered opt.incsearch = true -- search as characters are entered
opt.hlsearch = false -- do not highlight matches opt.hlsearch = false -- do not highlight matches
@ -57,3 +58,7 @@ vim.api.nvim_create_autocmd("BufWritePre", {
formatter.format(nil) formatter.format(nil)
end, end,
}) })
-- Logging --
-- opt.verbosefile = '~/.config/nvim/nvim_log' -- Set the location for the log file
-- opt.verbose = 15 -- Set the verbosity level

View File

@ -1,3 +1,4 @@
local dashboard = require("config.dashboard")
local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim" local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim"
if not (vim.uv or vim.loop).fs_stat(lazypath) then if not (vim.uv or vim.loop).fs_stat(lazypath) then
@ -14,77 +15,20 @@ end
vim.opt.rtp:prepend(lazypath) vim.opt.rtp:prepend(lazypath)
require("lazy").setup({ require("lazy").setup({
-- Dashboard
{ {
"nvimdev/dashboard-nvim", "nvimdev/dashboard-nvim",
event = "VimEnter", event = "VimEnter",
opts = function() opts = dashboard.dashboard_config,
local logo = [[
Z
Z
z
z
]]
logo = string.rep("\n", 8) .. logo .. "\n\n"
local opts = {
theme = "doom",
hide = {
-- this is taken care of by lualine
-- enabling this messes up the actual laststatus setting after loading a file
statusline = false,
},
config = {
header = vim.split(logo, "\n"),
-- stylua: ignore
center = {
-- { action = LazyVim.telescope("files"), desc = " Find File", icon = " ", key = "f" },
{ action = "ene | startinsert", desc = " New File", icon = "", key = "n" },
{ action = "Telescope oldfiles", desc = " Recent Files", icon = "", key = "r" },
{ action = "Telescope live_grep", desc = " Find Text", icon = "", key = "g" },
{ action = [[lua LazyVim.telescope.config_files()()]], desc = " Config", icon = "", key = "c" },
{ action = 'lua require("persistence").load()', desc = " Restore Session", icon = "", key = "s" },
{ action = "LazyExtras", desc = " Lazy Extras", icon = "", key = "x" },
{ action = "Lazy", desc = " Lazy", icon = "󰒲 ", key = "l" },
{ action = "qa", desc = " Quit", icon = "", key = "q" },
},
footer = function()
local stats = require("lazy").stats()
local ms = (math.floor(stats.startuptime * 100 + 0.5) / 100)
return {
"⚡ Neovim loaded " .. stats.loaded .. "/" .. stats.count .. " plugins in " .. ms .. "ms",
}
end,
},
}
for _, button in ipairs(opts.config.center) do
button.desc = button.desc .. string.rep(" ", 43 - #button.desc)
button.key_format = " %s"
end
-- close Lazy and re-open when the dashboard is ready
if vim.o.filetype == "lazy" then
vim.cmd.close()
vim.api.nvim_create_autocmd("User", {
pattern = "DashboardLoaded",
callback = function()
require("lazy").show()
end,
})
end
return opts
end,
}, },
-- Theming
"tanvirtin/monokai.nvim", "tanvirtin/monokai.nvim",
"yorickpeterse/nvim-grey",
{ "catppuccin/nvim", name = "catppuccin", priority = 1000 },
{ {
"onsails/lspkind.nvim", "onsails/lspkind.nvim",
event = { "VimEnter" }, event = { "VimEnter" },
}, },
{ "catppuccin/nvim", name = "catppuccin", priority = 1000 },
-- Auto-completion engine -- Auto-completion engine
{ {
"hrsh7th/nvim-cmp", "hrsh7th/nvim-cmp",
@ -115,6 +59,7 @@ require("lazy").setup({
"nvim-telescope/telescope.nvim", "nvim-telescope/telescope.nvim",
tag = "0.1.6", tag = "0.1.6",
dependencies = { "nvim-lua/plenary.nvim" }, dependencies = { "nvim-lua/plenary.nvim" },
requires = { "tami5/sqlite.lua" },
}, },
"zaldih/themery.nvim", "zaldih/themery.nvim",
"terrortylor/nvim-comment", "terrortylor/nvim-comment",
@ -138,11 +83,16 @@ require("lazy").setup({
}, },
"windwp/nvim-ts-autotag", "windwp/nvim-ts-autotag",
"nvim-treesitter/nvim-treesitter", "nvim-treesitter/nvim-treesitter",
"mfussenegger/nvim-dap", {
"mfussenegger/nvim-dap",
opt = true,
run = "npm install --legacy-peer-deps && npx gulp vsDebugServerBundle && mv dist out",
},
"jay-babu/mason-nvim-dap.nvim",
"microsoft/vscode-js-debug",
{ {
"stevearc/conform.nvim", "stevearc/conform.nvim",
opts = {}, opts = {},
}, },
"f-person/git-blame.nvim", "f-person/git-blame.nvim",
"yorickpeterse/nvim-grey",
}) })

View File

@ -1,14 +1,17 @@
# Requirements for my setup # Requirements for my setup
- file tree x - file tree x
- lsp with mason x - lsp with mason x
- telescope x - telescope x
- theming x - theming x
- tabfluline x - tabfluline x
- rice x - rice x
- terminal x - terminal x
- harpoon x - harpoon x
- extended history x - extended history x
- auto-pairs x - auto-pairs x
- lua vim linting x - lua vim linting x
- dashboard - dashboard x
- suppress vim global warnings x
- harpoon toggle file x
- debugger - debugger