From 3acdbefa0dca21411a3df35e3cbd95eca5373029 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dobos=20=C3=81d=C3=A1m?= Date: Wed, 4 Jan 2023 18:55:38 +0100 Subject: [PATCH] Pimp my vim config --- .config/nvim/after/plugin/keymap.lua | 12 +++++++++++- .config/nvim/after/plugin/lspconfig.lua | 7 +++++-- .config/nvim/after/plugin/treesitter.lua | 22 ++++++++++++++++++++++ .config/nvim/lua/dobiadi/packer.lua | 6 ++++++ .config/nvim/lua/dobiadi/set.lua | 5 +++++ 5 files changed, 49 insertions(+), 3 deletions(-) create mode 100644 .config/nvim/after/plugin/treesitter.lua diff --git a/.config/nvim/after/plugin/keymap.lua b/.config/nvim/after/plugin/keymap.lua index 7a053fc..1727542 100644 --- a/.config/nvim/after/plugin/keymap.lua +++ b/.config/nvim/after/plugin/keymap.lua @@ -3,7 +3,7 @@ vim.keymap.set('v', 'y', '"+y', { noremap=true, silent=true }) vim.keymap.set('n', 'y', '"+y', { noremap=true, silent=true }) vim.keymap.set('n', 'Y', '"+yg_', { noremap=true, silent=true }) --- Space paste doesn't overwrite paste register +-- Space paste will not overwrite paste register vim.keymap.set('x', 'p', "\"_dP", { noremap=true, silent=true }) -- Telescope binding @@ -17,3 +17,13 @@ vim.keymap.set('n', '', 'zz', { noremap=true, silent=true }) vim.keymap.set('n', '', 'zz', { noremap=true, silent=true }) vim.keymap.set('n', 'n', 'nzzzv', { noremap=true, silent=true }) vim.keymap.set('n', 'N', 'Nzzzv', { noremap=true, silent=true }) + +-- Undotree +vim.keymap.set('n', 'u', vim.cmd.UndotreeToggle, { noremap=true, silent=true }) + +-- Git +vim.keymap.set('n', 'gs', vim.cmd.Git, { noremap=true, silent=true }) + +-- Move highlighted +vim.keymap.set("v", "J", ":m '>+1gv=gv") +vim.keymap.set("v", "K", ":m '<-2gv=gv") diff --git a/.config/nvim/after/plugin/lspconfig.lua b/.config/nvim/after/plugin/lspconfig.lua index c5f2824..fe7a415 100644 --- a/.config/nvim/after/plugin/lspconfig.lua +++ b/.config/nvim/after/plugin/lspconfig.lua @@ -102,12 +102,15 @@ vim.diagnostic.config({ require("null-ls").setup({ sources = { + -- JavaScript require("null-ls").builtins.formatting.prettier, require("null-ls").builtins.diagnostics.eslint_d, + -- Python require("null-ls").builtins.formatting.black.with({ extra_args = {"--fast"}}), - require("null-ls").builtins.formatting.phpcbf.with({ extra_args = {"--standard=PSR12"}}), - require("null-ls").builtins.diagnostics.phpcs.with({ extra_args = {"--standard=PSR12"}}), require("null-ls").builtins.formatting.isort, require("null-ls").builtins.diagnostics.flake8.with({ extra_args = {"--max-line-length", "88", "--ignore", "E203"}}), + -- PHP + require("null-ls").builtins.formatting.phpcbf.with({ extra_args = {"--standard=PSR12"}}), + require("null-ls").builtins.diagnostics.phpcs.with({ extra_args = {"--standard=PSR12"}}), }, }) diff --git a/.config/nvim/after/plugin/treesitter.lua b/.config/nvim/after/plugin/treesitter.lua new file mode 100644 index 0000000..3be8d42 --- /dev/null +++ b/.config/nvim/after/plugin/treesitter.lua @@ -0,0 +1,22 @@ +require'nvim-treesitter.configs'.setup { + -- A list of parser names, or "all" + ensure_installed = { "c", "lua", "php", "rust", "javascript", "typescript", "python", "bash" }, + + -- Install parsers synchronously (only applied to `ensure_installed`) + sync_install = false, + + -- Automatically install missing parsers when entering buffer + -- Recommendation: set to false if you don't have `tree-sitter` CLI installed locally + auto_install = true, + + highlight = { + -- `false` will disable the whole extension + enable = true, + + -- Setting this to true will run `:h syntax` and tree-sitter at the same time. + -- Set this to `true` if you depend on 'syntax' being enabled (like for indentation). + -- Using this option may slow down your editor, and you may see some duplicate highlights. + -- Instead of true it can also be a list of languages + additional_vim_regex_highlighting = false, + }, +} diff --git a/.config/nvim/lua/dobiadi/packer.lua b/.config/nvim/lua/dobiadi/packer.lua index 5a268a1..58346ee 100644 --- a/.config/nvim/lua/dobiadi/packer.lua +++ b/.config/nvim/lua/dobiadi/packer.lua @@ -33,4 +33,10 @@ return require('packer').startup(function(use) -- Statusline use 'nvim-lualine/lualine.nvim' + + -- Undotree + use 'mbbill/undotree' + + -- Git + use 'tpope/vim-fugitive' end) diff --git a/.config/nvim/lua/dobiadi/set.lua b/.config/nvim/lua/dobiadi/set.lua index 7ec999a..be4d1cc 100644 --- a/.config/nvim/lua/dobiadi/set.lua +++ b/.config/nvim/lua/dobiadi/set.lua @@ -27,3 +27,8 @@ vim.opt.cursorline = true vim.opt.mouse = "" vim.g.mapleader = " " + +vim.opt.undodir = os.getenv("HOME") .. "/.vim/undodir" +vim.opt.undofile = true + +vim.scrolloff = 8