diff options
Diffstat (limited to 'nvim/custom')
-rw-r--r-- | nvim/custom/chadrc.lua | 7 | ||||
-rw-r--r-- | nvim/custom/configs/conform.lua | 36 | ||||
-rw-r--r-- | nvim/custom/mappings.lua | 28 | ||||
-rw-r--r-- | nvim/custom/plugins.lua | 20 |
4 files changed, 91 insertions, 0 deletions
diff --git a/nvim/custom/chadrc.lua b/nvim/custom/chadrc.lua new file mode 100644 index 0000000..d9858e1 --- /dev/null +++ b/nvim/custom/chadrc.lua @@ -0,0 +1,7 @@ +---@type ChadrcConfig +local M = {} + +M.ui = { theme = 'gruvchad' } +M.plugins = "custom.plugins" + +return M diff --git a/nvim/custom/configs/conform.lua b/nvim/custom/configs/conform.lua new file mode 100644 index 0000000..550b659 --- /dev/null +++ b/nvim/custom/configs/conform.lua @@ -0,0 +1,36 @@ +--type conform.options +local util = require("conform.util") + +local options = { + lsp_fallback = true, + + formatters_by_ft = { + lua = { "stylua" }, + + javascript = { "prettier", "eslint" }, + javascriptreact = { "prettier", "eslint" }, + css = { "prettier" }, + html = { "prettier" }, + + sh = { "shfmt" }, + }, + + format_on_save = { + -- These options will be passed to conform.format() + timeout_ms = 1000, + lsp_fallback = true, + }, + + formatters = { + eslint = { + command = util.from_node_modules("eslint"), + args = { "$FILENAME", "--fix" }, + cwd = util.root_file({ + "package.json", + ".eslintrc.cjs" + }), + } + } +} + +require("conform").setup(options) diff --git a/nvim/custom/mappings.lua b/nvim/custom/mappings.lua new file mode 100644 index 0000000..f7690a1 --- /dev/null +++ b/nvim/custom/mappings.lua @@ -0,0 +1,28 @@ +---@type MappingsTable +local M = {} + +M.general = { + n = { + [";"] = { ":", "enter command mode", opts = { nowait = true } }, + + -- format with conform + ["<leader>fm"] = { + function() + require("conform").format({ + lsp_fallback = true, + async = false, + timeout_ms = 500, + }) + end, + "formatting", + } + + }, + v = { + [">"] = { ">gv", "indent"}, + }, +} + +-- more keybinds! + +return M diff --git a/nvim/custom/plugins.lua b/nvim/custom/plugins.lua new file mode 100644 index 0000000..8ad68d1 --- /dev/null +++ b/nvim/custom/plugins.lua @@ -0,0 +1,20 @@ +local plugins = { + { + "tpope/vim-fugitive", + lazy = false + }, + { + "stevearc/conform.nvim", + -- for users those who want auto-save conform + lazyloading! + -- event = "BufWritePre" + lazy = false, + config = function() + require "custom.configs.conform" + end, + }, + { + 'Exafunction/codeium.vim', + lazy=false + } +} +return plugins |