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.autotags")
require("config.conform")
-- require("config.dashboard")
require("options")
require("keymaps")
require("commands")

View File

@ -1,34 +1,36 @@
{
"FTerm.nvim": { "branch": "master", "commit": "d1320892cc2ebab472935242d9d992a2c9570180" },
"LuaSnip": { "branch": "master", "commit": "8ae1dedd988eb56441b7858bd1e8554dfadaa46d" },
"catppuccin": { "branch": "main", "commit": "02bdd749931a5d739063562e57531c118e081882" },
"LuaSnip": { "branch": "master", "commit": "03c8e67eb7293c404845b3982db895d59c0d1538" },
"catppuccin": { "branch": "main", "commit": "0b5df9c9e641b1212b21a0762ccad4434fd41322" },
"cmp-buffer": { "branch": "main", "commit": "3022dbc9166796b644a841a02de8dd1cc1d311fa" },
"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" },
"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" },
"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" },
"harpoon": { "branch": "harpoon2", "commit": "0378a6c428a0bed6a2781d459d7943843f374bce" },
"lazy.nvim": { "branch": "main", "commit": "31ddbea7c10b6920c9077b66c97951ca8682d5c8" },
"lazy.nvim": { "branch": "main", "commit": "9a374a0fb4d3ac42dac4a129d4bead7252473c77" },
"lspkind.nvim": { "branch": "master", "commit": "1735dd5a5054c1fb7feaf8e8658dbab925f4f0cf" },
"lualine.nvim": { "branch": "master", "commit": "0a5a66803c7407767b799067986b4dc3036e1983" },
"mason-lspconfig.nvim": { "branch": "main", "commit": "44509689b9bf3984d729cc264aacb31cb7f41668" },
"mason.nvim": { "branch": "main", "commit": "751b1fcbf3d3b783fcf8d48865264a9bcd8f9b10" },
"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" },
"monokai.nvim": { "branch": "master", "commit": "b8bd44d5796503173627d7a1fc51f77ec3a08a63" },
"nvim-autopairs": { "branch": "master", "commit": "4f41e5940bc0443fdbe5f995e2a596847215cd2a" },
"nvim-cmp": { "branch": "main", "commit": "ce16de5665c766f39c271705b17fff06f7bcb84f" },
"nvim-autopairs": { "branch": "master", "commit": "78a4507bb9ffc9b00f11ae0ac48243d00cb9194d" },
"nvim-cmp": { "branch": "main", "commit": "d818fd0624205b34e14888358037fb6f5dc51234" },
"nvim-comment": { "branch": "main", "commit": "e9ac16ab056695cad6461173693069ec070d2b23" },
"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" },
"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" },
"telescope.nvim": { "branch": "master", "commit": "6312868392331c9c0f22725041f1ec2bef57c751" },
"themery.nvim": { "branch": "main", "commit": "1005a58801276d29c4b1e11244cf7631250f9143" },
"vim-maximizer": { "branch": "master", "commit": "2e54952fe91e140a2e69f35f22131219fcd9c5f1" }
"themery.nvim": { "branch": "main", "commit": "f745a49d9c103babde35e1111b91faa6bc591d5c" },
"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 = {
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
vim.lsp.handlers['textDocument/publishDiagnostics'] = vim.lsp.with(
vim.lsp.diagnostic.on_publish_diagnostics,
{
vim.lsp.handlers["textDocument/publishDiagnostics"] = vim.lsp.with(vim.lsp.diagnostic.on_publish_diagnostics, {
underline = true,
virtual_text = {
spacing = 5,
severity_limit = 'Warning',
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

View File

@ -3,8 +3,11 @@ require("conform").setup({
lua = { "stylua" },
javascript = { { "prettierd", "prettier" } },
typescript = { { "prettierd", "prettier" } },
javascriptreact = { "prettierd", "prettier" },
typescriptreact = { "prettierd", "prettier" },
json = { { "prettierd", "prettier" } },
markdown = { { "marksman", "prettierd", "prettier" } },
jsonc = { { "prettierd", "prettier" } },
markdown = { { "marksman", "prettier", "prettierd" } },
},
})

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

@ -21,13 +21,15 @@ local function toggle_telescope(harpoon_files)
:find()
end
local function maybe_remove_add()
local bufnr = api.nvim_get_current_buf()
local mark = harpoon:mark(bufnr)
if mark then
harpoon:list():add()
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():remove()
harpoon:list():add({ value = current_file })
print("Added to Harpoon: " .. current_file)
end
end
@ -39,13 +41,7 @@ api.nvim_create_user_command("HarpoonAdd", function()
harpoon:list():add()
end, { bang = true })
api.nvim_create_user_command("HarpoonToggleFile", function()
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()
toggle_mark()
end, { bang = true })
api.nvim_create_user_command("HarpoonUI", function()
toggle_telescope(harpoon:list())

View File

@ -11,15 +11,8 @@ 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",
},
})

View File

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

View File

@ -1,30 +1,15 @@
local actions = require("telescope.actions")
require('telescope').setup {
require("telescope").setup({
defaults = {
-- Default configuration for telescope goes here:
-- config_key = value,
mappings = {
i = {
["<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",
},
},
themeConfigFile = "~/.config/nvim/lua/config/theme.lua", -- Desibed below
livePreview = true, -- Apply theme while browsing. Default to true.
})

View File

@ -30,13 +30,15 @@ local mappings = {
-- FTerm
["<leader>h"] = "<cmd>FTermToggle<CR>",
-- Harpoon
["<leader>a"] = "<cmd>HarpoonAdd<CR>",
["<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",

View File

@ -31,10 +31,7 @@ end
local servers = {
"tsserver",
"intelephense",
"tailwindcss",
"lua_ls",
"marksman",
}
local capabilities = vim.lsp.protocol.make_client_capabilities()
@ -61,5 +58,12 @@ 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" } },
},
},
})
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.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
@ -57,3 +58,7 @@ 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

View File

@ -1,3 +1,4 @@
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
@ -14,77 +15,20 @@ end
vim.opt.rtp:prepend(lazypath)
require("lazy").setup({
-- Dashboard
{
"nvimdev/dashboard-nvim",
event = "VimEnter",
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,
opts = dashboard.dashboard_config,
},
-- 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",
@ -115,6 +59,7 @@ 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",
@ -138,11 +83,16 @@ 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",
{
"stevearc/conform.nvim",
opts = {},
},
"f-person/git-blame.nvim",
"yorickpeterse/nvim-grey",
})

View File

@ -1,4 +1,5 @@
# Requirements for my setup
- file tree x
- lsp with mason x
- telescope x
@ -10,5 +11,7 @@
- extended history x
- auto-pairs x
- lua vim linting x
- dashboard
- dashboard x
- suppress vim global warnings x
- harpoon toggle file x
- debugger