Compare commits
No commits in common. "24f8d2889ba397f2f1a7a64b54026732ef747a9e" and "28db441192e7a94386497aade19a9832e72e2c24" have entirely different histories.
24f8d2889b
...
28db441192
2
init.lua
2
init.lua
|
@ -13,6 +13,6 @@ require("config.harpoon")
|
|||
require("config.autopairs")
|
||||
require("config.autotags")
|
||||
require("config.conform")
|
||||
-- require("config.dashboard")
|
||||
require("options")
|
||||
require("keymaps")
|
||||
require("commands")
|
||||
|
|
|
@ -1,36 +1,34 @@
|
|||
{
|
||||
"FTerm.nvim": { "branch": "master", "commit": "d1320892cc2ebab472935242d9d992a2c9570180" },
|
||||
"LuaSnip": { "branch": "master", "commit": "03c8e67eb7293c404845b3982db895d59c0d1538" },
|
||||
"catppuccin": { "branch": "main", "commit": "0b5df9c9e641b1212b21a0762ccad4434fd41322" },
|
||||
"LuaSnip": { "branch": "master", "commit": "8ae1dedd988eb56441b7858bd1e8554dfadaa46d" },
|
||||
"catppuccin": { "branch": "main", "commit": "02bdd749931a5d739063562e57531c118e081882" },
|
||||
"cmp-buffer": { "branch": "main", "commit": "3022dbc9166796b644a841a02de8dd1cc1d311fa" },
|
||||
"cmp-cmdline": { "branch": "main", "commit": "d250c63aa13ead745e3a40f61fdd3470efde3923" },
|
||||
"cmp-nvim-lsp": { "branch": "main", "commit": "39e2eda76828d88b773cc27a3f61d2ad782c922d" },
|
||||
"cmp-nvim-lsp": { "branch": "main", "commit": "5af77f54de1b16c34b23cba810150689a3a90312" },
|
||||
"cmp-path": { "branch": "main", "commit": "91ff86cd9c29299a64f968ebb45846c485725f23" },
|
||||
"conform.nvim": { "branch": "master", "commit": "797de8f79055334104cf77893cd93fe3fc2ac154" },
|
||||
"copilot.vim": { "branch": "release", "commit": "25f73977033c597d530c7ab0e211d99b60927d2d" },
|
||||
"dashboard-nvim": { "branch": "master", "commit": "fabf5feec96185817c732d47d363f34034212685" },
|
||||
"git-blame.nvim": { "branch": "master", "commit": "408d5487d908dfe5d48e5645d8b27ddcc16b11e0" },
|
||||
"conform.nvim": { "branch": "master", "commit": "9d5ba06d6ee7418c674f498634617416d15b6239" },
|
||||
"copilot.vim": { "branch": "release", "commit": "f45ecd95c1474885e278f20d6ae86a6e30de2151" },
|
||||
"dashboard-nvim": { "branch": "master", "commit": "681300934baf36f6184ca41f0b26aed22056d4ee" },
|
||||
"git-blame.nvim": { "branch": "master", "commit": "a0282d05adbee80aaf4e2ff35b81b52940b67bed" },
|
||||
"harpoon": { "branch": "harpoon2", "commit": "0378a6c428a0bed6a2781d459d7943843f374bce" },
|
||||
"lazy.nvim": { "branch": "main", "commit": "9a374a0fb4d3ac42dac4a129d4bead7252473c77" },
|
||||
"lazy.nvim": { "branch": "main", "commit": "31ddbea7c10b6920c9077b66c97951ca8682d5c8" },
|
||||
"lspkind.nvim": { "branch": "master", "commit": "1735dd5a5054c1fb7feaf8e8658dbab925f4f0cf" },
|
||||
"lualine.nvim": { "branch": "master", "commit": "544dd1583f9bb27b393f598475c89809c4d5e86b" },
|
||||
"mason-lspconfig.nvim": { "branch": "main", "commit": "58bc9119ca273c0ce5a66fad1927ef0f617bd81b" },
|
||||
"mason-nvim-dap.nvim": { "branch": "main", "commit": "4ba55f9755ebe8297d92c419b90a946123292ae6" },
|
||||
"mason.nvim": { "branch": "main", "commit": "e2f7f9044ec30067bc11800a9e266664b88cda22" },
|
||||
"lualine.nvim": { "branch": "master", "commit": "0a5a66803c7407767b799067986b4dc3036e1983" },
|
||||
"mason-lspconfig.nvim": { "branch": "main", "commit": "44509689b9bf3984d729cc264aacb31cb7f41668" },
|
||||
"mason.nvim": { "branch": "main", "commit": "751b1fcbf3d3b783fcf8d48865264a9bcd8f9b10" },
|
||||
"monokai.nvim": { "branch": "master", "commit": "b8bd44d5796503173627d7a1fc51f77ec3a08a63" },
|
||||
"nvim-autopairs": { "branch": "master", "commit": "78a4507bb9ffc9b00f11ae0ac48243d00cb9194d" },
|
||||
"nvim-cmp": { "branch": "main", "commit": "d818fd0624205b34e14888358037fb6f5dc51234" },
|
||||
"nvim-autopairs": { "branch": "master", "commit": "4f41e5940bc0443fdbe5f995e2a596847215cd2a" },
|
||||
"nvim-cmp": { "branch": "main", "commit": "ce16de5665c766f39c271705b17fff06f7bcb84f" },
|
||||
"nvim-comment": { "branch": "main", "commit": "e9ac16ab056695cad6461173693069ec070d2b23" },
|
||||
"nvim-dap": { "branch": "master", "commit": "bc03b83c94d0375145ff5ac6a6dcf28c1241e06f" },
|
||||
"nvim-grey": { "branch": "main", "commit": "b57f62baddc5a295bd0ffd61ff9a671a149df95a" },
|
||||
"nvim-lspconfig": { "branch": "master", "commit": "e26da408cf955afa8e9ddbadd510e84ea8976cd7" },
|
||||
"nvim-tree.lua": { "branch": "master", "commit": "f9ff00bc06d7cb70548a3847d7a2a05e928bc988" },
|
||||
"nvim-treesitter": { "branch": "master", "commit": "4e387dd47833c1bb8c8df6c3a7cab0d4c55583f3" },
|
||||
"nvim-ts-autotag": { "branch": "main", "commit": "1624866a1379fc1861797f0ed05899a9c1d2ff61" },
|
||||
"nvim-web-devicons": { "branch": "master", "commit": "c0cfc1738361b5da1cd0a962dd6f774cc444f856" },
|
||||
"plenary.nvim": { "branch": "master", "commit": "a3e3bc82a3f95c5ed0d7201546d5d2c19b20d683" },
|
||||
"nvim-dap": { "branch": "master", "commit": "405df1dcc2e395ab5173a9c3d00e03942c023074" },
|
||||
"nvim-grey": { "branch": "main", "commit": "e5fc8cc1e0c88c23bc6c92845f19a342f561c409" },
|
||||
"nvim-lspconfig": { "branch": "master", "commit": "e25c4cdecd3d58c0deccce0f372426c8c480bcce" },
|
||||
"nvim-tree.lua": { "branch": "master", "commit": "81eb8d519233c105f30dc0a278607e62b20502fd" },
|
||||
"nvim-treesitter": { "branch": "master", "commit": "2bad828b48aed74efe8f7e4ea15550e18c7b482d" },
|
||||
"nvim-ts-autotag": { "branch": "main", "commit": "531f48334c422222aebc888fd36e7d109cb354cd" },
|
||||
"nvim-web-devicons": { "branch": "master", "commit": "6e355632387a085f15a66ad68cf681c1d7374a04" },
|
||||
"plenary.nvim": { "branch": "master", "commit": "8aad4396840be7fc42896e3011751b7609ca4119" },
|
||||
"telescope.nvim": { "branch": "master", "commit": "6312868392331c9c0f22725041f1ec2bef57c751" },
|
||||
"themery.nvim": { "branch": "main", "commit": "f745a49d9c103babde35e1111b91faa6bc591d5c" },
|
||||
"vim-maximizer": { "branch": "master", "commit": "2e54952fe91e140a2e69f35f22131219fcd9c5f1" },
|
||||
"vscode-js-debug": { "branch": "main", "commit": "29ba3af04e436d85b035a08c03f55e421679fc25" }
|
||||
"themery.nvim": { "branch": "main", "commit": "1005a58801276d29c4b1e11244cf7631250f9143" },
|
||||
"vim-maximizer": { "branch": "master", "commit": "2e54952fe91e140a2e69f35f22131219fcd9c5f1" }
|
||||
}
|
|
@ -1,19 +0,0 @@
|
|||
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, {})
|
|
@ -1,21 +1,18 @@
|
|||
require("nvim-treesitter.configs").setup({
|
||||
autotag = {
|
||||
enable = true,
|
||||
},
|
||||
opts = function(_, opts)
|
||||
if type(opts.ensure_installed) == "table" then
|
||||
vim.list_extend(opts.ensure_installed, { "typescript", "tsx" })
|
||||
end
|
||||
end,
|
||||
})
|
||||
require'nvim-treesitter.configs'.setup {
|
||||
autotag = {
|
||||
enable = true,
|
||||
}
|
||||
}
|
||||
|
||||
-- Enable update on insert
|
||||
vim.lsp.handlers["textDocument/publishDiagnostics"] = vim.lsp.with(vim.lsp.diagnostic.on_publish_diagnostics, {
|
||||
underline = true,
|
||||
virtual_text = {
|
||||
spacing = 5,
|
||||
min = vim.diagnostic.severity.WARN, -- Updated from severity_limit
|
||||
},
|
||||
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
|
||||
vim.lsp.handlers['textDocument/publishDiagnostics'] = vim.lsp.with(
|
||||
vim.lsp.diagnostic.on_publish_diagnostics,
|
||||
{
|
||||
underline = true,
|
||||
virtual_text = {
|
||||
spacing = 5,
|
||||
severity_limit = 'Warning',
|
||||
},
|
||||
update_in_insert = true,
|
||||
}
|
||||
)
|
||||
|
|
|
@ -1,33 +1,30 @@
|
|||
require("conform").setup({
|
||||
formatters_by_ft = {
|
||||
lua = { "stylua" },
|
||||
javascript = { { "prettierd", "prettier" } },
|
||||
typescript = { { "prettierd", "prettier" } },
|
||||
javascriptreact = { "prettierd", "prettier" },
|
||||
typescriptreact = { "prettierd", "prettier" },
|
||||
json = { { "prettierd", "prettier" } },
|
||||
jsonc = { { "prettierd", "prettier" } },
|
||||
markdown = { { "marksman", "prettier", "prettierd" } },
|
||||
},
|
||||
formatters_by_ft = {
|
||||
lua = { "stylua" },
|
||||
javascript = { { "prettierd", "prettier" } },
|
||||
typescript = { { "prettierd", "prettier" } },
|
||||
json = { { "prettierd", "prettier" } },
|
||||
markdown = { { "marksman", "prettierd", "prettier" } },
|
||||
},
|
||||
})
|
||||
|
||||
local M = {}
|
||||
|
||||
M.format = function(args)
|
||||
local range = nil
|
||||
if args and args.count ~= -1 then
|
||||
-- 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]
|
||||
range = {
|
||||
start = { args.line1, 0 },
|
||||
["end"] = { args.line2, end_line:len() },
|
||||
}
|
||||
end
|
||||
require("conform").format({ async = true, lsp_fallback = true, range = range })
|
||||
local range = nil
|
||||
if args and args.count ~= -1 then
|
||||
-- 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]
|
||||
range = {
|
||||
start = { args.line1, 0 },
|
||||
["end"] = { args.line2, end_line:len() },
|
||||
}
|
||||
end
|
||||
require("conform").format({ async = true, lsp_fallback = true, range = range })
|
||||
end
|
||||
|
||||
vim.api.nvim_create_user_command("Format", function(args)
|
||||
M.format(args)
|
||||
M.format(args)
|
||||
end, { range = true })
|
||||
|
||||
return M
|
||||
|
|
|
@ -1,30 +0,0 @@
|
|||
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
|
|
@ -1,63 +0,0 @@
|
|||
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
|
|
@ -4,45 +4,49 @@ harpoon.setup({})
|
|||
-- basic telescope configuration
|
||||
local conf = require("telescope.config").values
|
||||
local function toggle_telescope(harpoon_files)
|
||||
local file_paths = {}
|
||||
for _, item in ipairs(harpoon_files.items) do
|
||||
table.insert(file_paths, item.value)
|
||||
end
|
||||
local file_paths = {}
|
||||
for _, item in ipairs(harpoon_files.items) do
|
||||
table.insert(file_paths, item.value)
|
||||
end
|
||||
|
||||
require("telescope.pickers")
|
||||
.new({}, {
|
||||
prompt_title = "Harpoon",
|
||||
finder = require("telescope.finders").new_table({
|
||||
results = file_paths,
|
||||
}),
|
||||
previewer = conf.file_previewer({}),
|
||||
sorter = conf.generic_sorter({}),
|
||||
})
|
||||
:find()
|
||||
require("telescope.pickers")
|
||||
.new({}, {
|
||||
prompt_title = "Harpoon",
|
||||
finder = require("telescope.finders").new_table({
|
||||
results = file_paths,
|
||||
}),
|
||||
previewer = conf.file_previewer({}),
|
||||
sorter = conf.generic_sorter({}),
|
||||
})
|
||||
:find()
|
||||
end
|
||||
|
||||
local function toggle_mark()
|
||||
local current_file = api.nvim_buf_get_name(0) -- Get the current buffer's file path
|
||||
local item, index = harpoon:list():get_by_value(current_file)
|
||||
if item then
|
||||
harpoon:list():remove_at(index)
|
||||
print("Removed from Harpoon: " .. current_file)
|
||||
else
|
||||
harpoon:list():add({ value = current_file })
|
||||
print("Added to Harpoon: " .. current_file)
|
||||
end
|
||||
local function maybe_remove_add()
|
||||
local bufnr = api.nvim_get_current_buf()
|
||||
local mark = harpoon:mark(bufnr)
|
||||
if mark then
|
||||
harpoon:list():add()
|
||||
else
|
||||
harpoon:list():remove()
|
||||
end
|
||||
end
|
||||
|
||||
-- Commands
|
||||
api.nvim_create_user_command("HarpoonClear", function()
|
||||
harpoon:list():clear()
|
||||
harpoon:list():clear()
|
||||
end, { bang = true })
|
||||
api.nvim_create_user_command("HarpoonAdd", function()
|
||||
harpoon:list():add()
|
||||
harpoon:list():add()
|
||||
end, { bang = true })
|
||||
api.nvim_create_user_command("HarpoonToggleFile", function()
|
||||
toggle_mark()
|
||||
maybe_remove_add()
|
||||
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 })
|
||||
api.nvim_create_user_command("HarpoonUI", function()
|
||||
toggle_telescope(harpoon:list())
|
||||
toggle_telescope(harpoon:list())
|
||||
end, { bang = true })
|
||||
|
|
|
@ -11,8 +11,15 @@ require("mason").setup({
|
|||
-- A list of servers to automatically install if they're not already installed
|
||||
require("mason-lspconfig").setup({
|
||||
ensure_installed = {
|
||||
"cssls",
|
||||
"cssmodules_ls",
|
||||
"graphql",
|
||||
"html",
|
||||
"intelephense",
|
||||
"tailwindcss",
|
||||
"tsserver",
|
||||
"jsonls",
|
||||
"lua_ls",
|
||||
"marksman",
|
||||
},
|
||||
})
|
||||
|
|
|
@ -4,7 +4,6 @@ require("nvim-tree").setup({
|
|||
},
|
||||
view = {
|
||||
width = 30,
|
||||
side = "right",
|
||||
},
|
||||
renderer = {
|
||||
group_empty = true,
|
||||
|
|
|
@ -1,15 +1,30 @@
|
|||
local actions = require("telescope.actions")
|
||||
|
||||
require("telescope").setup({
|
||||
defaults = {
|
||||
-- Default configuration for telescope goes here:
|
||||
-- config_key = value,
|
||||
mappings = {
|
||||
i = {
|
||||
["<esc>"] = actions.close,
|
||||
["<C-u>"] = false,
|
||||
},
|
||||
},
|
||||
},
|
||||
})
|
||||
|
||||
require('telescope').setup {
|
||||
defaults = {
|
||||
-- Default configuration for telescope goes here:
|
||||
-- config_key = value,
|
||||
mappings = {
|
||||
i = {
|
||||
["<esc>"] = actions.close,
|
||||
["<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
|
||||
}
|
||||
}
|
||||
|
|
|
@ -14,5 +14,6 @@ require("themery").setup({
|
|||
colorscheme = "catppuccin-mocha",
|
||||
},
|
||||
},
|
||||
themeConfigFile = "~/.config/nvim/lua/config/theme.lua", -- Desibed below
|
||||
livePreview = true, -- Apply theme while browsing. Default to true.
|
||||
})
|
||||
|
|
134
lua/keymaps.lua
134
lua/keymaps.lua
|
@ -2,75 +2,73 @@ local keymap = vim.api.nvim_set_keymap
|
|||
local opts = { noremap = true, silent = true }
|
||||
|
||||
local mappings = {
|
||||
n = {
|
||||
-- highlighting
|
||||
["<leader>nh"] = ":nohl<CR>",
|
||||
-- move between buffers
|
||||
["<c-h>"] = "<C-w>h",
|
||||
["<c-j>"] = "<C-w>j",
|
||||
["<c-k>"] = "<C-w>k",
|
||||
["<c-l>"] = "<C-w>l",
|
||||
-- open and close buggers
|
||||
["<leader>sv"] = "<C-w>s",
|
||||
["<leader>sh"] = "<C-w>v",
|
||||
["<leader>se"] = "<C-w>=",
|
||||
["<leader>sx"] = ":close<CR>",
|
||||
-- nvim-tree
|
||||
["<leader>e"] = ":NvimTreeFindFileToggle<CR>",
|
||||
["<leader>cf"] = ":NvimTreeCollapse<CR>",
|
||||
-- LSP
|
||||
["<leader>ls"] = ":lspstop<CR>",
|
||||
["<leader>lo"] = ":lspstart<CR>",
|
||||
-- Telescope
|
||||
["<leader>ff"] = "<cmd>Telescope find_files<CR>",
|
||||
["<leader>fw"] = "<cmd>Telescope live_grep<CR>",
|
||||
["<leader>fc"] = "<cmd>Telescope grep_string<CR>",
|
||||
["<leader>th"] = "<cmd>Themery<CR>",
|
||||
["<leader>sm"] = ":MaximizerToggle<CR>",
|
||||
-- FTerm
|
||||
["<leader>h"] = "<cmd>FTermToggle<CR>",
|
||||
-- Harpoon
|
||||
["<leader>a"] = "<cmd>HarpoonToggleFile<CR>",
|
||||
["<C-e>"] = "<cmd>HarpoonUI<CR>",
|
||||
["<leader>c"] = "<cmd>HarpoonClear<CR>",
|
||||
-- Formating
|
||||
["<leader>fm"] = "<cmd>Format<CR>",
|
||||
-- Disable help menu
|
||||
["<F1>"] = "<nop>",
|
||||
-- Toggle word wrap
|
||||
["<leader>w"] = "<cmd>ToggleWrap<CR>",
|
||||
},
|
||||
x = {
|
||||
["<A-j>"] = ":move '>+1<CR>gv-gv",
|
||||
["<A-k>"] = ":move '<-2<CR>gv-gv",
|
||||
},
|
||||
i = {
|
||||
["<C-Space>"] = { 'copilot#Accept("<CR>")', expr = true },
|
||||
["<A-l>"] = "<esc>",
|
||||
["C-BS"] = "<cmd>HarpoonRemove<CR>",
|
||||
-- Disable help menu
|
||||
["<F1>"] = "<nop>",
|
||||
},
|
||||
t = {
|
||||
["C-h"] = "<C-\\><C-n>:FTermClose<CR>",
|
||||
},
|
||||
n = {
|
||||
-- highlighting
|
||||
["<leader>nh"] = ":nohl<CR>",
|
||||
-- move between buffers
|
||||
["<c-h>"] = "<C-w>h",
|
||||
["<c-j>"] = "<C-w>j",
|
||||
["<c-k>"] = "<C-w>k",
|
||||
["<c-l>"] = "<C-w>l",
|
||||
-- open and close buggers
|
||||
["<leader>sv"] = "<C-w>s",
|
||||
["<leader>sh"] = "<C-w>v",
|
||||
["<leader>se"] = "<C-w>=",
|
||||
["<leader>sx"] = ":close<CR>",
|
||||
-- nvim-tree
|
||||
["<leader>e"] = ":NvimTreeFindFileToggle<CR>",
|
||||
["<leader>cf"] = ":NvimTreeCollapse<CR>",
|
||||
-- LSP
|
||||
["<leader>ls"] = ":lspstop<CR>",
|
||||
["<leader>lo"] = ":lspstart<CR>",
|
||||
-- Telescope
|
||||
["<leader>ff"] = "<cmd>Telescope find_files<CR>",
|
||||
["<leader>fw"] = "<cmd>Telescope live_grep<CR>",
|
||||
["<leader>fc"] = "<cmd>Telescope grep_string<CR>",
|
||||
["<leader>th"] = "<cmd>Themery<CR>",
|
||||
["<leader>sm"] = ":MaximizerToggle<CR>",
|
||||
-- FTerm
|
||||
["<leader>h"] = "<cmd>FTermToggle<CR>",
|
||||
-- Harpoon
|
||||
["<leader>a"] = "<cmd>HarpoonAdd<CR>",
|
||||
["<C-e>"] = "<cmd>HarpoonUI<CR>",
|
||||
["<leader>c"] = "<cmd>HarpoonClear<CR>",
|
||||
-- Formating
|
||||
["<leader>fm"] = "<cmd>Format<CR>",
|
||||
-- Disable help menu
|
||||
["<F1>"] = "<nop>",
|
||||
},
|
||||
x = {
|
||||
["<A-j>"] = ":move '>+1<CR>gv-gv",
|
||||
["<A-k>"] = ":move '<-2<CR>gv-gv",
|
||||
},
|
||||
i = {
|
||||
["<C-Space>"] = { 'copilot#Accept("<CR>")', expr = true },
|
||||
["<A-l>"] = "<esc>",
|
||||
["C-BS"] = "<cmd>HarpoonRemove<CR>",
|
||||
-- Disable help menu
|
||||
["<F1>"] = "<nop>",
|
||||
},
|
||||
t = {
|
||||
["C-h"] = "<C-\\><C-n>:FTermClose<CR>",
|
||||
},
|
||||
}
|
||||
|
||||
for mode, mode_mappings in pairs(mappings) do
|
||||
for key, mapping in pairs(mode_mappings) do
|
||||
if type(mapping) == "function" then
|
||||
-- For direct Lua function calls; ensure your function returns a string command
|
||||
keymap(mode, key, "<cmd>lua " .. mapping() .. "<CR>", opts)
|
||||
elseif type(mapping) == "table" and mapping.expr then
|
||||
-- For expression mappings, like for copilot
|
||||
local expr_opts = vim.tbl_extend("force", opts, { expr = true })
|
||||
keymap(mode, key, mapping[1], expr_opts)
|
||||
elseif type(mapping) == "table" then
|
||||
-- For mappings that have their options specified directly
|
||||
keymap(mode, key, mapping[1], mapping[2] or opts)
|
||||
else
|
||||
-- For simple string command mappings
|
||||
keymap(mode, key, mapping, opts)
|
||||
end
|
||||
end
|
||||
for key, mapping in pairs(mode_mappings) do
|
||||
if type(mapping) == "function" then
|
||||
-- For direct Lua function calls; ensure your function returns a string command
|
||||
keymap(mode, key, "<cmd>lua " .. mapping() .. "<CR>", opts)
|
||||
elseif type(mapping) == "table" and mapping.expr then
|
||||
-- For expression mappings, like for copilot
|
||||
local expr_opts = vim.tbl_extend("force", opts, { expr = true })
|
||||
keymap(mode, key, mapping[1], expr_opts)
|
||||
elseif type(mapping) == "table" then
|
||||
-- For mappings that have their options specified directly
|
||||
keymap(mode, key, mapping[1], mapping[2] or opts)
|
||||
else
|
||||
-- For simple string command mappings
|
||||
keymap(mode, key, mapping, opts)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
98
lua/lsp.lua
98
lua/lsp.lua
|
@ -1,69 +1,65 @@
|
|||
local lspconfig = require("lspconfig")
|
||||
|
||||
local mappings = {
|
||||
["<leader>k"] = vim.diagnostic.open_float,
|
||||
["[d"] = vim.diagnostic.goto_prev,
|
||||
["]d"] = vim.diagnostic.goto_next,
|
||||
["<leader>q"] = vim.diagnostic.setloclist,
|
||||
["gD"] = vim.lsp.buf.declaration,
|
||||
["gd"] = vim.lsp.buf.definition,
|
||||
["K"] = vim.lsp.buf.hover,
|
||||
["gi"] = vim.lsp.buf.implementation,
|
||||
["<leader>wa"] = vim.lsp.buf.add_workspace_folder,
|
||||
["<leader>wr"] = vim.lsp.buf.remove_workspace_folder,
|
||||
["<leader>wl"] = function()
|
||||
print(vim.inspect(vim.lsp.buf.list_workleader_folders()))
|
||||
end,
|
||||
["<leader>D"] = vim.lsp.buf.type_definition,
|
||||
["<leader>rn"] = vim.lsp.buf.rename,
|
||||
["<leader>ca"] = vim.lsp.buf.code_action,
|
||||
["gr"] = vim.lsp.buf.references,
|
||||
["<leader>k"] = vim.diagnostic.open_float,
|
||||
["[d"] = vim.diagnostic.goto_prev,
|
||||
["]d"] = vim.diagnostic.goto_next,
|
||||
["<leader>q"] = vim.diagnostic.setloclist,
|
||||
["gD"] = vim.lsp.buf.declaration,
|
||||
["gd"] = vim.lsp.buf.definition,
|
||||
["K"] = vim.lsp.buf.hover,
|
||||
["gi"] = vim.lsp.buf.implementation,
|
||||
["<leader>wa"] = vim.lsp.buf.add_workspace_folder,
|
||||
["<leader>wr"] = vim.lsp.buf.remove_workspace_folder,
|
||||
["<leader>wl"] = function()
|
||||
print(vim.inspect(vim.lsp.buf.list_workleader_folders()))
|
||||
end,
|
||||
["<leader>D"] = vim.lsp.buf.type_definition,
|
||||
["<leader>rn"] = vim.lsp.buf.rename,
|
||||
["<leader>ca"] = vim.lsp.buf.code_action,
|
||||
["gr"] = vim.lsp.buf.references,
|
||||
}
|
||||
|
||||
local on_attach = function(client, bufnr)
|
||||
-- Enable completion triggered by <c-x><c-o>
|
||||
vim.api.nvim_buf_set_option(bufnr, "omnifunc", "v:lua.vim.lsp.omnifunc")
|
||||
local bufopts = { noremap = true, silent = true, buffer = bufnr }
|
||||
for key, mapping in pairs(mappings) do
|
||||
vim.keymap.set("n", key, mapping, bufopts)
|
||||
end
|
||||
-- Enable completion triggered by <c-x><c-o>
|
||||
vim.api.nvim_buf_set_option(bufnr, "omnifunc", "v:lua.vim.lsp.omnifunc")
|
||||
local bufopts = { noremap = true, silent = true, buffer = bufnr }
|
||||
for key, mapping in pairs(mappings) do
|
||||
vim.keymap.set("n", key, mapping, bufopts)
|
||||
end
|
||||
end
|
||||
|
||||
local servers = {
|
||||
"tsserver",
|
||||
"lua_ls",
|
||||
"tsserver",
|
||||
"intelephense",
|
||||
"tailwindcss",
|
||||
"lua_ls",
|
||||
"marksman",
|
||||
}
|
||||
|
||||
local capabilities = vim.lsp.protocol.make_client_capabilities()
|
||||
|
||||
capabilities.textDocument.completion.completionItem = {
|
||||
documentationFormat = { "markdown", "plaintext" },
|
||||
snippetSupport = true,
|
||||
preselectSupport = true,
|
||||
insertReplaceSupport = true,
|
||||
labelDetailsSupport = true,
|
||||
deprecatedSupport = true,
|
||||
commitCharactersSupport = true,
|
||||
tagSupport = { valueSet = { 1 } },
|
||||
resolveSupport = {
|
||||
properties = {
|
||||
"documentation",
|
||||
"detail",
|
||||
"additionalTextEdits",
|
||||
},
|
||||
},
|
||||
documentationFormat = { "markdown", "plaintext" },
|
||||
snippetSupport = true,
|
||||
preselectSupport = true,
|
||||
insertReplaceSupport = true,
|
||||
labelDetailsSupport = true,
|
||||
deprecatedSupport = true,
|
||||
commitCharactersSupport = true,
|
||||
tagSupport = { valueSet = { 1 } },
|
||||
resolveSupport = {
|
||||
properties = {
|
||||
"documentation",
|
||||
"detail",
|
||||
"additionalTextEdits",
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
for _, lsp in ipairs(servers) do
|
||||
lspconfig[lsp].setup({
|
||||
on_attach = on_attach,
|
||||
capabilities = capabilities,
|
||||
-- For suppressing vim error messages in config
|
||||
settings = {
|
||||
Lua = {
|
||||
diagnostics = { globals = { "vim" } },
|
||||
},
|
||||
},
|
||||
})
|
||||
lspconfig[lsp].setup({
|
||||
on_attach = on_attach,
|
||||
capabilities = capabilities,
|
||||
})
|
||||
end
|
||||
|
||||
|
|
|
@ -31,8 +31,7 @@ opt.cursorline = true -- highlight cursor line underneath the cursor horizontall
|
|||
opt.splitbelow = true -- open new vertical split bottom
|
||||
opt.splitright = true -- open new horizontal splits right
|
||||
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
|
||||
opt.incsearch = true -- search as characters are entered
|
||||
opt.hlsearch = false -- do not highlight matches
|
||||
|
@ -58,7 +57,3 @@ vim.api.nvim_create_autocmd("BufWritePre", {
|
|||
formatter.format(nil)
|
||||
end,
|
||||
})
|
||||
|
||||
-- Logging --
|
||||
-- opt.verbosefile = '~/.config/nvim/nvim_log' -- Set the location for the log file
|
||||
-- opt.verbose = 15 -- Set the verbosity level
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
local dashboard = require("config.dashboard")
|
||||
local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim"
|
||||
|
||||
if not (vim.uv or vim.loop).fs_stat(lazypath) then
|
||||
|
@ -15,20 +14,77 @@ end
|
|||
vim.opt.rtp:prepend(lazypath)
|
||||
|
||||
require("lazy").setup({
|
||||
-- Dashboard
|
||||
{
|
||||
"nvimdev/dashboard-nvim",
|
||||
event = "VimEnter",
|
||||
opts = dashboard.dashboard_config,
|
||||
opts = function()
|
||||
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",
|
||||
"yorickpeterse/nvim-grey",
|
||||
{ "catppuccin/nvim", name = "catppuccin", priority = 1000 },
|
||||
{
|
||||
"onsails/lspkind.nvim",
|
||||
event = { "VimEnter" },
|
||||
},
|
||||
{ "catppuccin/nvim", name = "catppuccin", priority = 1000 },
|
||||
-- Auto-completion engine
|
||||
{
|
||||
"hrsh7th/nvim-cmp",
|
||||
|
@ -59,7 +115,6 @@ require("lazy").setup({
|
|||
"nvim-telescope/telescope.nvim",
|
||||
tag = "0.1.6",
|
||||
dependencies = { "nvim-lua/plenary.nvim" },
|
||||
requires = { "tami5/sqlite.lua" },
|
||||
},
|
||||
"zaldih/themery.nvim",
|
||||
"terrortylor/nvim-comment",
|
||||
|
@ -83,16 +138,11 @@ require("lazy").setup({
|
|||
},
|
||||
"windwp/nvim-ts-autotag",
|
||||
"nvim-treesitter/nvim-treesitter",
|
||||
{
|
||||
"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",
|
||||
"mfussenegger/nvim-dap",
|
||||
{
|
||||
"stevearc/conform.nvim",
|
||||
opts = {},
|
||||
},
|
||||
"f-person/git-blame.nvim",
|
||||
"yorickpeterse/nvim-grey",
|
||||
})
|
||||
|
|
|
@ -1,17 +1,14 @@
|
|||
# Requirements for my setup
|
||||
|
||||
- file tree x
|
||||
- lsp with mason x
|
||||
- telescope x
|
||||
- theming x
|
||||
- tabfluline x
|
||||
- rice x
|
||||
- rice x
|
||||
- terminal x
|
||||
- harpoon x
|
||||
- extended history x
|
||||
- auto-pairs x
|
||||
- lua vim linting x
|
||||
- dashboard x
|
||||
- suppress vim global warnings x
|
||||
- harpoon toggle file x
|
||||
- dashboard
|
||||
- debugger
|
||||
|
|
Loading…
Reference in New Issue