Changed a couple of nvim settings, added some keybinds, disabled treej, and added conform.nvim

This commit is contained in:
Dreaded_X 2024-04-13 05:38:25 +02:00
parent f2d0e639b4
commit b19f90dc7f
Signed by: Dreaded_X
GPG Key ID: FA5F485356B0D2D4
5 changed files with 605 additions and 475 deletions

File diff suppressed because it is too large Load Diff

View File

@ -5,6 +5,7 @@
"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" },
"cmp_luasnip": { "branch": "master", "commit": "05a9ab28b53f71d1aece421ef32fee2cb857a843" }, "cmp_luasnip": { "branch": "master", "commit": "05a9ab28b53f71d1aece421ef32fee2cb857a843" },
"conform.nvim": { "branch": "master", "commit": "9d5ba06d6ee7418c674f498634617416d15b6239" },
"document-color.nvim": { "branch": "main", "commit": "74c487f0e5accfaae033755451b9e367220693fd" }, "document-color.nvim": { "branch": "main", "commit": "74c487f0e5accfaae033755451b9e367220693fd" },
"fidget.nvim": { "branch": "main", "commit": "1ba38e4cbb24683973e00c2e36f53ae64da38ef5" }, "fidget.nvim": { "branch": "main", "commit": "1ba38e4cbb24683973e00c2e36f53ae64da38ef5" },
"gitsigns.nvim": { "branch": "main", "commit": "c097cb255096f333e14d341082a84f572b394fa2" }, "gitsigns.nvim": { "branch": "main", "commit": "c097cb255096f333e14d341082a84f572b394fa2" },
@ -40,7 +41,6 @@
"telescope-ui-select.nvim": { "branch": "master", "commit": "6e51d7da30bd139a6950adf2a47fda6df9fa06d2" }, "telescope-ui-select.nvim": { "branch": "master", "commit": "6e51d7da30bd139a6950adf2a47fda6df9fa06d2" },
"telescope.nvim": { "branch": "master", "commit": "6312868392331c9c0f22725041f1ec2bef57c751" }, "telescope.nvim": { "branch": "master", "commit": "6312868392331c9c0f22725041f1ec2bef57c751" },
"todo-comments.nvim": { "branch": "main", "commit": "a736bbe08c8eff370dfa60701f1e669816d4e3c8" }, "todo-comments.nvim": { "branch": "main", "commit": "a736bbe08c8eff370dfa60701f1e669816d4e3c8" },
"treesj": { "branch": "main", "commit": "60e27280030f9cd8dfb6ceb335922c6ff76682cc" },
"trouble.nvim": { "branch": "main", "commit": "b9cf677f20bb2faa2dacfa870b084e568dca9572" }, "trouble.nvim": { "branch": "main", "commit": "b9cf677f20bb2faa2dacfa870b084e568dca9572" },
"undotree": { "branch": "master", "commit": "aa93a7e5890dbbebbc064cd22260721a6db1a196" }, "undotree": { "branch": "master", "commit": "aa93a7e5890dbbebbc064cd22260721a6db1a196" },
"which-key.nvim": { "branch": "main", "commit": "4433e5ec9a507e5097571ed55c02ea9658fb268a" }, "which-key.nvim": { "branch": "main", "commit": "4433e5ec9a507e5097571ed55c02ea9658fb268a" },

View File

@ -1,6 +1,6 @@
-- See `:help vim.o` -- Set highlight on search, clear by pressing esc
-- Set highlight on search vim.o.hlsearch = true
vim.o.hlsearch = false vim.keymap.set('n', '<Esc>', '<cmd>nohlsearch<CR>')
-- Make line numbers default -- Make line numbers default
vim.wo.number = true vim.wo.number = true
@ -52,3 +52,9 @@ vim.o.confirm = true
-- Turn on cursorline -- Turn on cursorline
vim.o.cursorline = true vim.o.cursorline = true
-- Don't show mode, powerline already shows it
vim.o.showmode = false
-- Minimum number of screen lines above and below the cursor
vim.o.scrolloff = 10

View File

@ -0,0 +1,63 @@
-- https://github.com/stevearc/conform.nvim
return {
"stevearc/conform.nvim",
event = { "BufWritePre" },
cmd = { "ConformInfo" },
keys = {
{
-- Customize or remove this keymap to your liking
"<leader>f",
function()
require("conform").format({ async = true, lsp_fallback = true })
end,
mode = "",
desc = "[F]ormat buffer",
},
},
opts = {
-- TODO: Automate installing these using e.g. mason
formatters_by_ft = {
c = { "clang-format" },
cpp = { "clang-format" },
go = { "goimports", "gofmt" },
python = { "ruff_format" },
rust = { "rustfmt" },
javascript = { { "prettierd", "prettier" } },
typescript = { { "prettierd", "prettier" } },
typescriptreact = { { "prettierd", "prettier" } },
css = { { "prettierd", "prettier" } },
markdown = { { "prettierd", "prettier" } },
lua = { "stylua" },
json = { "jq" },
yaml = { { "prettierd", "prettier" } },
toml = { "taplo" },
cmake = { "cmake_format" },
-- ["*"] = { "codespell" },
["_"] = { "trim_whitespace", "trim_newlines" },
},
format_after_save = {
lsp_fallback = true,
},
notify_on_error = true,
},
init = function()
vim.api.nvim_create_user_command("FormatDisable", function(args)
if args.bang then
-- FormatDisable! will disable formatting just for this buffer
vim.b.disable_autoformat = true
else
vim.g.disable_autoformat = true
end
end, {
desc = "Disable autoformat-on-save",
bang = true,
})
vim.api.nvim_create_user_command("FormatEnable", function()
vim.b.disable_autoformat = false
vim.g.disable_autoformat = false
end, {
desc = "Re-enable autoformat-on-save",
})
vim.o.formatexpr = "v:lua.require'conform'.formatexpr()"
end,
}

View File

@ -1,5 +1,6 @@
-- https://github.com/Wansmer/treesj -- https://github.com/Wansmer/treesj
return { return {
enabled = false,
'Wansmer/treesj', 'Wansmer/treesj',
keys = { keys = {
{ {