feat: add support for typescript formatting

main
jaredgoldman 2024-04-09 14:00:35 -04:00
parent c41927eb3c
commit cd67bb22f0
7 changed files with 122 additions and 198 deletions

View File

@ -1,123 +1,34 @@
{ {
"FTerm.nvim": { "FTerm.nvim": { "branch": "master", "commit": "d1320892cc2ebab472935242d9d992a2c9570180" },
"branch": "master", "LuaSnip": { "branch": "master", "commit": "8ae1dedd988eb56441b7858bd1e8554dfadaa46d" },
"commit": "d1320892cc2ebab472935242d9d992a2c9570180" "catppuccin": { "branch": "main", "commit": "02bdd749931a5d739063562e57531c118e081882" },
}, "cmp-buffer": { "branch": "main", "commit": "3022dbc9166796b644a841a02de8dd1cc1d311fa" },
"LuaSnip": { "cmp-cmdline": { "branch": "main", "commit": "d250c63aa13ead745e3a40f61fdd3470efde3923" },
"branch": "master", "cmp-nvim-lsp": { "branch": "main", "commit": "5af77f54de1b16c34b23cba810150689a3a90312" },
"commit": "8ae1dedd988eb56441b7858bd1e8554dfadaa46d" "cmp-path": { "branch": "main", "commit": "91ff86cd9c29299a64f968ebb45846c485725f23" },
}, "conform.nvim": { "branch": "master", "commit": "9d5ba06d6ee7418c674f498634617416d15b6239" },
"catppuccin": { "copilot.vim": { "branch": "release", "commit": "7097b09e52621a97d11f254e04de5e5a0f26e5f5" },
"branch": "main", "dashboard-nvim": { "branch": "master", "commit": "681300934baf36f6184ca41f0b26aed22056d4ee" },
"commit": "aebe43db9cb26e1c70fc5b2fd4158169c405e720" "git-blame.nvim": { "branch": "master", "commit": "a0282d05adbee80aaf4e2ff35b81b52940b67bed" },
}, "harpoon": { "branch": "harpoon2", "commit": "da326d0438ac68dee9b6b62a734be940a8bd8405" },
"cmp-buffer": { "lazy.nvim": { "branch": "main", "commit": "31ddbea7c10b6920c9077b66c97951ca8682d5c8" },
"branch": "main", "lspkind.nvim": { "branch": "master", "commit": "1735dd5a5054c1fb7feaf8e8658dbab925f4f0cf" },
"commit": "3022dbc9166796b644a841a02de8dd1cc1d311fa" "lualine.nvim": { "branch": "master", "commit": "0a5a66803c7407767b799067986b4dc3036e1983" },
}, "mason-lspconfig.nvim": { "branch": "main", "commit": "44509689b9bf3984d729cc264aacb31cb7f41668" },
"cmp-cmdline": { "mason.nvim": { "branch": "main", "commit": "751b1fcbf3d3b783fcf8d48865264a9bcd8f9b10" },
"branch": "main", "monokai.nvim": { "branch": "master", "commit": "b8bd44d5796503173627d7a1fc51f77ec3a08a63" },
"commit": "d250c63aa13ead745e3a40f61fdd3470efde3923" "nvim-autopairs": { "branch": "master", "commit": "4f41e5940bc0443fdbe5f995e2a596847215cd2a" },
}, "nvim-cmp": { "branch": "main", "commit": "ce16de5665c766f39c271705b17fff06f7bcb84f" },
"cmp-nvim-lsp": { "nvim-comment": { "branch": "main", "commit": "e9ac16ab056695cad6461173693069ec070d2b23" },
"branch": "main", "nvim-dap": { "branch": "master", "commit": "405df1dcc2e395ab5173a9c3d00e03942c023074" },
"commit": "5af77f54de1b16c34b23cba810150689a3a90312" "nvim-grey": { "branch": "main", "commit": "820bf3030bfd6c2f90567fc1b206ce517e8635ee" },
}, "nvim-lspconfig": { "branch": "master", "commit": "e25c4cdecd3d58c0deccce0f372426c8c480bcce" },
"cmp-path": { "nvim-tree.lua": { "branch": "master", "commit": "81eb8d519233c105f30dc0a278607e62b20502fd" },
"branch": "main", "nvim-treesitter": { "branch": "master", "commit": "fbe76211f45413feadb155a89073bf65b5766b2e" },
"commit": "91ff86cd9c29299a64f968ebb45846c485725f23" "nvim-ts-autotag": { "branch": "main", "commit": "531f48334c422222aebc888fd36e7d109cb354cd" },
}, "nvim-web-devicons": { "branch": "master", "commit": "fd4abfc5237246670977972c6f518186b621a32d" },
"conform.nvim": { "plenary.nvim": { "branch": "master", "commit": "8aad4396840be7fc42896e3011751b7609ca4119" },
"branch": "master", "telescope.nvim": { "branch": "master", "commit": "6312868392331c9c0f22725041f1ec2bef57c751" },
"commit": "9d5ba06d6ee7418c674f498634617416d15b6239" "themery.nvim": { "branch": "main", "commit": "1005a58801276d29c4b1e11244cf7631250f9143" },
}, "vim-maximizer": { "branch": "master", "commit": "2e54952fe91e140a2e69f35f22131219fcd9c5f1" }
"copilot.vim": { }
"branch": "release",
"commit": "7097b09e52621a97d11f254e04de5e5a0f26e5f5"
},
"dashboard-nvim": {
"branch": "master",
"commit": "681300934baf36f6184ca41f0b26aed22056d4ee"
},
"harpoon": {
"branch": "harpoon2",
"commit": "da326d0438ac68dee9b6b62a734be940a8bd8405"
},
"lazy.nvim": {
"branch": "main",
"commit": "31ddbea7c10b6920c9077b66c97951ca8682d5c8"
},
"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"
},
"monokai.nvim": {
"branch": "master",
"commit": "b8bd44d5796503173627d7a1fc51f77ec3a08a63"
},
"nvim-autopairs": {
"branch": "master",
"commit": "4f41e5940bc0443fdbe5f995e2a596847215cd2a"
},
"nvim-cmp": {
"branch": "main",
"commit": "ce16de5665c766f39c271705b17fff06f7bcb84f"
},
"nvim-comment": {
"branch": "main",
"commit": "e9ac16ab056695cad6461173693069ec070d2b23"
},
"nvim-dap": {
"branch": "master",
"commit": "405df1dcc2e395ab5173a9c3d00e03942c023074"
},
"nvim-lspconfig": {
"branch": "master",
"commit": "9619e53d3f99f0ca4ea3b88f5d97fce703131820"
},
"nvim-tree.lua": {
"branch": "master",
"commit": "81eb8d519233c105f30dc0a278607e62b20502fd"
},
"nvim-treesitter": {
"branch": "master",
"commit": "11a3584b81c3249d2b6279305aee1c7ad273985a"
},
"nvim-ts-autotag": {
"branch": "main",
"commit": "531f48334c422222aebc888fd36e7d109cb354cd"
},
"nvim-web-devicons": {
"branch": "master",
"commit": "93ddac6966d5d3416f96df728d7b92e27aaa4452"
},
"plenary.nvim": {
"branch": "master",
"commit": "8aad4396840be7fc42896e3011751b7609ca4119"
},
"telescope.nvim": {
"branch": "master",
"commit": "6312868392331c9c0f22725041f1ec2bef57c751"
},
"themery.nvim": {
"branch": "main",
"commit": "1005a58801276d29c4b1e11244cf7631250f9143"
},
"vim-maximizer": {
"branch": "master",
"commit": "2e54952fe91e140a2e69f35f22131219fcd9c5f1"
}
}

View File

@ -3,7 +3,8 @@ require("conform").setup({
lua = { "stylua" }, lua = { "stylua" },
python = { "isort", "black" }, python = { "isort", "black" },
javascript = { { "prettierd", "prettier" } }, javascript = { { "prettierd", "prettier" } },
json = { { "prettierd", "prettier" } }, typescript = { { "prettierd", "prettier" } },
json = { { "prettier", "prettierd" } },
markdown = { { "marksman", "prettierd", "prettier" } }, markdown = { { "marksman", "prettierd", "prettier" } },
}, },
}) })

View File

@ -35,6 +35,9 @@ end
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()
harpoon:list():add()
end, { bang = true })
api.nvim_create_user_command("HarpoonToggleFile", function() api.nvim_create_user_command("HarpoonToggleFile", function()
maybe_remove_add() maybe_remove_add()
end, { bang = true }) end, { bang = true })

View File

@ -1,13 +1,19 @@
-- Set custom name to the list -- Set custom name to the list
require("themery").setup({ require("themery").setup({
themes = { { themes = {
name = "Day", {
colorscheme = "catppuccin-latte", name = "Day",
}, colorscheme = "catppuccin-latte",
{ },
name = "Night", -- {
colorscheme = "catppuccin-mocha", -- name = "Afternoon",
} }, -- colorscheme = "nvim-grey",
themeConfigFile = "~/.config/nvim/lua/config/theme.lua", -- Desibed below -- },
livePreview = true, -- Apply theme while browsing. Default to true. {
name = "Night",
colorscheme = "catppuccin-mocha",
},
},
themeConfigFile = "~/.config/nvim/lua/config/theme.lua", -- Desibed below
livePreview = true, -- Apply theme while browsing. Default to true.
}) })

View File

@ -2,69 +2,73 @@ 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"] = ":NvimTreeCollapseKeepBuffers<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>HarpoonAdd<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
x = { ["<F1>"] = "<nop>",
["<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 },
}, ["<A-l>"] = "<esc>",
t = { ["C-BS"] = "<cmd>HarpoonRemove<CR>",
["C-h"] = "<C-\\><C-n>:FTermClose<CR>", -- Disable help menu
}, ["<F1>"] = "<nop>",
},
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,6 +1,6 @@
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,
@ -18,9 +18,6 @@ local lspconfig = require("lspconfig")
["<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,
["<leader>fm"] = function()
vim.lsp.buf.format({ async = true })
end,
} }
local on_attach = function(client, bufnr) local on_attach = function(client, bufnr)
@ -37,6 +34,7 @@ local servers = {
"intelephense", "intelephense",
"tailwindcss", "tailwindcss",
"lua_ls", "lua_ls",
"marksman",
} }
local capabilities = vim.lsp.protocol.make_client_capabilities() local capabilities = vim.lsp.protocol.make_client_capabilities()

View File

@ -144,4 +144,5 @@ require("lazy").setup({
opts = {}, opts = {},
}, },
"f-person/git-blame.nvim", "f-person/git-blame.nvim",
"yorickpeterse/nvim-grey",
}) })