feat: add ShowFilePath command

main
jaredgoldman 2024-05-05 08:55:15 -04:00
parent 267f59c18a
commit cda2cae5e5
8 changed files with 176 additions and 172 deletions

View File

@ -6,15 +6,15 @@
"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": "5af77f54de1b16c34b23cba810150689a3a90312" },
"cmp-path": { "branch": "main", "commit": "91ff86cd9c29299a64f968ebb45846c485725f23" }, "cmp-path": { "branch": "main", "commit": "91ff86cd9c29299a64f968ebb45846c485725f23" },
"conform.nvim": { "branch": "master", "commit": "4660e534bf7678ee0f85879aa75fdcb6855612c2" }, "conform.nvim": { "branch": "master", "commit": "12b3995537f52ba2810a9857e8ca256881febbda" },
"copilot.vim": { "branch": "release", "commit": "1e135c5303bc60598f6314a2276f31dc91aa34dd" }, "copilot.vim": { "branch": "release", "commit": "1e135c5303bc60598f6314a2276f31dc91aa34dd" },
"dashboard-nvim": { "branch": "master", "commit": "6d06924b562de6f0bb136edf1bf549afbf6b7d00" }, "dashboard-nvim": { "branch": "master", "commit": "1c8b82c5b02bb890862538be2061e37ef801a99b" },
"git-blame.nvim": { "branch": "master", "commit": "ad1d1365c9189d89797fe8d559677d5f55dc2830" }, "git-blame.nvim": { "branch": "master", "commit": "ad1d1365c9189d89797fe8d559677d5f55dc2830" },
"harpoon": { "branch": "harpoon2", "commit": "0378a6c428a0bed6a2781d459d7943843f374bce" }, "harpoon": { "branch": "harpoon2", "commit": "0378a6c428a0bed6a2781d459d7943843f374bce" },
"lazy.nvim": { "branch": "main", "commit": "3f13f080434ac942b150679223d54f5ca91e0d52" }, "lazy.nvim": { "branch": "main", "commit": "3f13f080434ac942b150679223d54f5ca91e0d52" },
"lspkind.nvim": { "branch": "master", "commit": "1735dd5a5054c1fb7feaf8e8658dbab925f4f0cf" }, "lspkind.nvim": { "branch": "master", "commit": "1735dd5a5054c1fb7feaf8e8658dbab925f4f0cf" },
"lualine.nvim": { "branch": "master", "commit": "0a5a66803c7407767b799067986b4dc3036e1983" }, "lualine.nvim": { "branch": "master", "commit": "0a5a66803c7407767b799067986b4dc3036e1983" },
"mason-lspconfig.nvim": { "branch": "main", "commit": "1a14770dc8c7cb29643870ac79788eec6f7ce1f8" }, "mason-lspconfig.nvim": { "branch": "main", "commit": "273fdde8ac5e51f3a223ba70980e52bbc09d9f6f" },
"mason-nvim-dap.nvim": { "branch": "main", "commit": "67210c0e775adec55de9826b038e8b62de554afc" }, "mason-nvim-dap.nvim": { "branch": "main", "commit": "67210c0e775adec55de9826b038e8b62de554afc" },
"mason.nvim": { "branch": "main", "commit": "751b1fcbf3d3b783fcf8d48865264a9bcd8f9b10" }, "mason.nvim": { "branch": "main", "commit": "751b1fcbf3d3b783fcf8d48865264a9bcd8f9b10" },
"monokai.nvim": { "branch": "master", "commit": "b8bd44d5796503173627d7a1fc51f77ec3a08a63" }, "monokai.nvim": { "branch": "master", "commit": "b8bd44d5796503173627d7a1fc51f77ec3a08a63" },
@ -23,14 +23,14 @@
"nvim-comment": { "branch": "main", "commit": "e9ac16ab056695cad6461173693069ec070d2b23" }, "nvim-comment": { "branch": "main", "commit": "e9ac16ab056695cad6461173693069ec070d2b23" },
"nvim-dap": { "branch": "master", "commit": "6ae8a14828b0f3bff1721a35a1dfd604b6a933bb" }, "nvim-dap": { "branch": "master", "commit": "6ae8a14828b0f3bff1721a35a1dfd604b6a933bb" },
"nvim-grey": { "branch": "main", "commit": "d822f82a990198e354845fe4d191f5f527302444" }, "nvim-grey": { "branch": "main", "commit": "d822f82a990198e354845fe4d191f5f527302444" },
"nvim-lspconfig": { "branch": "master", "commit": "cfa386fc4027e847156ee16141ea1f4c0bc2f0a4" }, "nvim-lspconfig": { "branch": "master", "commit": "aa5f4f4ee10b2688fb37fa46215672441d5cd5d9" },
"nvim-tree.lua": { "branch": "master", "commit": "62008e5cf2e8745c9d23bb599ef642963131057e" }, "nvim-tree.lua": { "branch": "master", "commit": "347e1eb35264677f66a79466bb5e3d111968e12c" },
"nvim-treesitter": { "branch": "master", "commit": "b04ccbd0e041bb05f3eef271124da02497d9d10c" }, "nvim-treesitter": { "branch": "master", "commit": "bbc67f736e22c37c23f2c11a05bfa23b715af30c" },
"nvim-ts-autotag": { "branch": "main", "commit": "531f48334c422222aebc888fd36e7d109cb354cd" }, "nvim-ts-autotag": { "branch": "main", "commit": "531f48334c422222aebc888fd36e7d109cb354cd" },
"nvim-web-devicons": { "branch": "master", "commit": "beb6367ab8496c9e43f22e0252735fdadae1872d" }, "nvim-web-devicons": { "branch": "master", "commit": "794bba734ec95eaff9bb82fbd112473be2087283" },
"plenary.nvim": { "branch": "master", "commit": "5129a3693c482fcbc5ab99a7706ffc4360b995a0" }, "plenary.nvim": { "branch": "master", "commit": "08e301982b9a057110ede7a735dd1b5285eb341f" },
"telescope.nvim": { "branch": "master", "commit": "6312868392331c9c0f22725041f1ec2bef57c751" }, "telescope.nvim": { "branch": "master", "commit": "6312868392331c9c0f22725041f1ec2bef57c751" },
"themery.nvim": { "branch": "main", "commit": "1005a58801276d29c4b1e11244cf7631250f9143" }, "themery.nvim": { "branch": "main", "commit": "1005a58801276d29c4b1e11244cf7631250f9143" },
"vim-maximizer": { "branch": "master", "commit": "2e54952fe91e140a2e69f35f22131219fcd9c5f1" }, "vim-maximizer": { "branch": "master", "commit": "2e54952fe91e140a2e69f35f22131219fcd9c5f1" },
"vscode-js-debug": { "branch": "main", "commit": "774a6fb444c75724914f23c2d07e8b0a9fcb080d" } "vscode-js-debug": { "branch": "main", "commit": "0b40365364f2867691701bff5aedf68d7fa0fe9d" }
} }

6
lua/commands.lua 100644
View File

@ -0,0 +1,6 @@
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 })

View File

@ -1,18 +1,20 @@
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 = { severity_limit = "Warning",
spacing = 5, },
severity_limit = 'Warning', update_in_insert = true,
}, })
update_in_insert = true,
}
)

View File

@ -6,6 +6,7 @@ require("conform").setup({
javascriptreact = { "prettierd", "prettier" }, javascriptreact = { "prettierd", "prettier" },
typescriptreact = { "prettierd", "prettier" }, typescriptreact = { "prettierd", "prettier" },
json = { { "prettierd", "prettier" } }, json = { { "prettierd", "prettier" } },
jsonc = { { "prettierd", "prettier" } },
markdown = { { "marksman", "prettier", "prettierd" } }, markdown = { { "marksman", "prettier", "prettierd" } },
}, },
}) })

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

@ -1,71 +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 -- For suppressing vim error messages in config
settings = { settings = {
Lua = { Lua = {
diagnostics = { globals = { "vim" } }, diagnostics = { globals = { "vim" } },
}, },
}, },
}) })
end end

View File

@ -57,3 +57,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

@ -2,96 +2,96 @@ 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
vim.fn.system({ vim.fn.system({
"git", "git",
"clone", "clone",
"--filter=blob:none", "--filter=blob:none",
"https://github.com/folke/lazy.nvim.git", "https://github.com/folke/lazy.nvim.git",
"--branch=stable", -- latest stable release "--branch=stable", -- latest stable release
lazypath, lazypath,
}) })
end end
vim.opt.rtp:prepend(lazypath) vim.opt.rtp:prepend(lazypath)
require("lazy").setup({ require("lazy").setup({
-- Dashboard -- Dashboard
{ {
"nvimdev/dashboard-nvim", "nvimdev/dashboard-nvim",
event = "VimEnter", event = "VimEnter",
opts = dashboard.dashboard_config, opts = dashboard.dashboard_config,
}, },
-- Theming -- Theming
"tanvirtin/monokai.nvim", "tanvirtin/monokai.nvim",
"yorickpeterse/nvim-grey", "yorickpeterse/nvim-grey",
{ "catppuccin/nvim", name = "catppuccin", priority = 1000 }, { "catppuccin/nvim", name = "catppuccin", priority = 1000 },
{ {
"onsails/lspkind.nvim", "onsails/lspkind.nvim",
event = { "VimEnter" }, event = { "VimEnter" },
}, },
-- Auto-completion engine -- Auto-completion engine
{ {
"hrsh7th/nvim-cmp", "hrsh7th/nvim-cmp",
dependencies = { "lspkind.nvim" }, dependencies = { "lspkind.nvim" },
config = function() config = function()
require("config.nvim-cmp") require("config.nvim-cmp")
end, end,
}, },
{ "hrsh7th/cmp-nvim-lsp", dependencies = { "nvim-cmp" } }, { "hrsh7th/cmp-nvim-lsp", dependencies = { "nvim-cmp" } },
{ "hrsh7th/cmp-buffer", dependencies = { "nvim-cmp" } }, -- buffer auto-completion { "hrsh7th/cmp-buffer", dependencies = { "nvim-cmp" } }, -- buffer auto-completion
{ "hrsh7th/cmp-path", dependencies = { "nvim-cmp" } }, -- path auto-completion { "hrsh7th/cmp-path", dependencies = { "nvim-cmp" } }, -- path auto-completion
{ "hrsh7th/cmp-cmdline", dependencies = { "nvim-cmp" } }, -- cmdline auto-completion { "hrsh7th/cmp-cmdline", dependencies = { "nvim-cmp" } }, -- cmdline auto-completion
-- Code snippet engine -- Code snippet engine
{ {
"L3MON4D3/LuaSnip", "L3MON4D3/LuaSnip",
version = "v2.*", version = "v2.*",
}, },
"williamboman/mason.nvim", "williamboman/mason.nvim",
"williamboman/mason-lspconfig.nvim", "williamboman/mason-lspconfig.nvim",
"neovim/nvim-lspconfig", "neovim/nvim-lspconfig",
"nvim-tree/nvim-tree.lua", "nvim-tree/nvim-tree.lua",
version = "*", version = "*",
lazy = false, lazy = false,
dependencies = { dependencies = {
"nvim-tree/nvim-web-devicons", "nvim-tree/nvim-web-devicons",
}, },
{ {
"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" },
}, },
"zaldih/themery.nvim", "zaldih/themery.nvim",
"terrortylor/nvim-comment", "terrortylor/nvim-comment",
"szw/vim-maximizer", "szw/vim-maximizer",
{ {
"nvim-lualine/lualine.nvim", "nvim-lualine/lualine.nvim",
dependencies = { "nvim-tree/nvim-web-devicons" }, dependencies = { "nvim-tree/nvim-web-devicons" },
}, },
"numToStr/FTerm.nvim", "numToStr/FTerm.nvim",
"github/copilot.vim", "github/copilot.vim",
"nvim-lua/plenary.nvim", "nvim-lua/plenary.nvim",
{ {
"ThePrimeagen/harpoon", "ThePrimeagen/harpoon",
branch = "harpoon2", branch = "harpoon2",
requires = { { "nvim-lua/plenary.nvim" } }, requires = { { "nvim-lua/plenary.nvim" } },
}, },
{ {
"windwp/nvim-autopairs", "windwp/nvim-autopairs",
event = "InsertEnter", event = "InsertEnter",
config = true, config = true,
}, },
"windwp/nvim-ts-autotag", "windwp/nvim-ts-autotag",
"nvim-treesitter/nvim-treesitter", "nvim-treesitter/nvim-treesitter",
{ {
"mfussenegger/nvim-dap", "mfussenegger/nvim-dap",
opt = true, opt = true,
run = "npm install --legacy-peer-deps && npx gulp vsDebugServerBundle && mv dist out" run = "npm install --legacy-peer-deps && npx gulp vsDebugServerBundle && mv dist out",
}, },
"jay-babu/mason-nvim-dap.nvim", "jay-babu/mason-nvim-dap.nvim",
"microsoft/vscode-js-debug", "microsoft/vscode-js-debug",
{ {
"stevearc/conform.nvim", "stevearc/conform.nvim",
opts = {}, opts = {},
}, },
"f-person/git-blame.nvim", "f-person/git-blame.nvim",
}) })