From ccc9ffa2db26103c0b887e7e1365e7ae29b0e4e8 Mon Sep 17 00:00:00 2001 From: CronyAkatsuki Date: Sun, 24 Dec 2023 19:46:29 +0100 Subject: [PATCH] Add support for more formatter's, stylua config. --- after/plugin/autopairs.lua | 80 ++++----- after/plugin/catppuccin.lua | 108 ++++++------ after/plugin/colorizer.lua | 46 ++--- after/plugin/conform.lua | 14 ++ after/plugin/fugitive.lua | 36 ++-- after/plugin/gitsigns.lua | 28 +-- after/plugin/harpoon.lua | 32 +++- after/plugin/indent-blankline.lua | 32 ++-- after/plugin/lsp.lua | 100 ++++++----- after/plugin/mini-indentscope.lua | 36 ++-- after/plugin/mkdnflow.lua | 16 +- after/plugin/oil.lua | 6 +- after/plugin/telescope.lua | 12 +- after/plugin/treesitter.lua | 18 +- init.lua | 2 +- lua/crony/init.lua | 32 ++-- lua/crony/lazy.lua | 272 +++++++++++++++--------------- lua/crony/map.lua | 16 +- lua/crony/set.lua | 6 +- 19 files changed, 472 insertions(+), 420 deletions(-) create mode 100644 after/plugin/conform.lua diff --git a/after/plugin/autopairs.lua b/after/plugin/autopairs.lua index bbc887f..24ea013 100644 --- a/after/plugin/autopairs.lua +++ b/after/plugin/autopairs.lua @@ -1,44 +1,44 @@ -require("nvim-autopairs").setup {} +require("nvim-autopairs").setup({}) -local cmp_autopairs = require('nvim-autopairs.completion.cmp') -local cmp = require('cmp') -local handlers = require('nvim-autopairs.completion.handlers') +local cmp_autopairs = require("nvim-autopairs.completion.cmp") +local cmp = require("cmp") +local handlers = require("nvim-autopairs.completion.handlers") cmp.event:on( - 'confirm_done', - cmp_autopairs.on_confirm_done({ - filetypes = { - -- "*" is a alias to all filetypes - ["*"] = { - ["("] = { - kind = { - cmp.lsp.CompletionItemKind.Function, - cmp.lsp.CompletionItemKind.Method, - }, - handler = handlers["*"] - } - }, - lua = { - ["("] = { - kind = { - cmp.lsp.CompletionItemKind.Function, - cmp.lsp.CompletionItemKind.Method - }, - ---@param char string - ---@param item table item completion - ---@param bufnr number buffer number - ---@param rules table - ---@param commit_character table - handler = function(char, item, bufnr, rules, commit_character) - -- Your handler function. Inpect with print(vim.inspect{char, item, bufnr, rules, commit_character}) - end - } - }, - -- Disable for tex - tex = false, - sh = false, - bash = false, - zsh = false, - } - }) + "confirm_done", + cmp_autopairs.on_confirm_done({ + filetypes = { + -- "*" is a alias to all filetypes + ["*"] = { + ["("] = { + kind = { + cmp.lsp.CompletionItemKind.Function, + cmp.lsp.CompletionItemKind.Method, + }, + handler = handlers["*"], + }, + }, + lua = { + ["("] = { + kind = { + cmp.lsp.CompletionItemKind.Function, + cmp.lsp.CompletionItemKind.Method, + }, + ---@param char string + ---@param item table item completion + ---@param bufnr number buffer number + ---@param rules table + ---@param commit_character table + handler = function(char, item, bufnr, rules, commit_character) + -- Your handler function. Inpect with print(vim.inspect{char, item, bufnr, rules, commit_character}) + end, + }, + }, + -- Disable for tex + tex = false, + sh = false, + bash = false, + zsh = false, + }, + }) ) diff --git a/after/plugin/catppuccin.lua b/after/plugin/catppuccin.lua index 0b83121..2eb8b89 100644 --- a/after/plugin/catppuccin.lua +++ b/after/plugin/catppuccin.lua @@ -1,57 +1,57 @@ require("catppuccin").setup({ - flavour = "frappe", - styles = { - comments = { "italic" }, - conditionals = { "italic" }, - loops = {}, - functions = { "bold" }, - keywords = { "bold" }, - strings = {}, - variables = {}, - numbers = {}, - booleans = {}, - properties = {}, - types = {}, - operators = {}, - }, - integrations = { - cmp = true, - gitsigns = true, - harpoon = true, - indent_blankline = { - enabled = true, - }, - markdown = true, - mason = true, - mini = { - enabled = true - }, - dap = { - enabled = true, - }, - native_lsp = { - enabled = true, - virtual_text = { - errors = { "italic" }, - hints = { "italic" }, - warnings = { "italic" }, - information = { "italic" }, - }, - underlines = { - errors = { "undercurl" }, - hints = { "undercurl" }, - warnings = { "undercurl" }, - information = { "undercurl" }, - }, - }, - notify = true, - telescope = { - enabled = true, - }, - treesitter = true, - which_key = true, - fidget = true, - }, + flavour = "frappe", + styles = { + comments = { "italic" }, + conditionals = { "italic" }, + loops = {}, + functions = { "bold" }, + keywords = { "bold" }, + strings = {}, + variables = {}, + numbers = {}, + booleans = {}, + properties = {}, + types = {}, + operators = {}, + }, + integrations = { + cmp = true, + gitsigns = true, + harpoon = true, + indent_blankline = { + enabled = true, + }, + markdown = true, + mason = true, + mini = { + enabled = true, + }, + dap = { + enabled = true, + }, + native_lsp = { + enabled = true, + virtual_text = { + errors = { "italic" }, + hints = { "italic" }, + warnings = { "italic" }, + information = { "italic" }, + }, + underlines = { + errors = { "undercurl" }, + hints = { "undercurl" }, + warnings = { "undercurl" }, + information = { "undercurl" }, + }, + }, + notify = true, + telescope = { + enabled = true, + }, + treesitter = true, + which_key = true, + fidget = true, + }, }) -vim.cmd.colorscheme 'catppuccin' +vim.cmd.colorscheme("catppuccin") diff --git a/after/plugin/colorizer.lua b/after/plugin/colorizer.lua index 26d2713..85a9c50 100644 --- a/after/plugin/colorizer.lua +++ b/after/plugin/colorizer.lua @@ -1,25 +1,25 @@ require("colorizer").setup({ - filetypes = { "*" }, - user_default_options = { - RGB = true, -- #RGB hex codes - RRGGBB = true, -- #RRGGBB hex codes - names = false, -- "Name" codes like Blue or blue - RRGGBBAA = true, -- #RRGGBBAA hex codes - AARRGGBB = true, -- 0xAARRGGBB hex codes - rgb_fn = true, -- CSS rgb() and rgba() functions - hsl_fn = true, -- CSS hsl() and hsla() functions - css = true, -- Enable all CSS features: rgb_fn, hsl_fn, names, RGB, RRGGBB - css_fn = true, -- Enable all CSS *functions*: rgb_fn, hsl_fn - -- Available modes for `mode`: foreground, background, virtualtext - mode = "background", -- Set the display mode. - -- Available methods are false / true / "normal" / "lsp" / "both" - -- True is same as normal - tailwind = false, -- Enable tailwind colors - -- parsers can contain values used in |user_default_options| - sass = { enable = false, parsers = { "css" } }, -- Enable sass colors - virtualtext = "■", - -- update color values even if buffer is not focused - -- example use: cmp_menu, cmp_docs - always_update = true, - }, + filetypes = { "*" }, + user_default_options = { + RGB = true, -- #RGB hex codes + RRGGBB = true, -- #RRGGBB hex codes + names = false, -- "Name" codes like Blue or blue + RRGGBBAA = true, -- #RRGGBBAA hex codes + AARRGGBB = true, -- 0xAARRGGBB hex codes + rgb_fn = true, -- CSS rgb() and rgba() functions + hsl_fn = true, -- CSS hsl() and hsla() functions + css = true, -- Enable all CSS features: rgb_fn, hsl_fn, names, RGB, RRGGBB + css_fn = true, -- Enable all CSS *functions*: rgb_fn, hsl_fn + -- Available modes for `mode`: foreground, background, virtualtext + mode = "background", -- Set the display mode. + -- Available methods are false / true / "normal" / "lsp" / "both" + -- True is same as normal + tailwind = false, -- Enable tailwind colors + -- parsers can contain values used in |user_default_options| + sass = { enable = false, parsers = { "css" } }, -- Enable sass colors + virtualtext = "■", + -- update color values even if buffer is not focused + -- example use: cmp_menu, cmp_docs + always_update = true, + }, }) diff --git a/after/plugin/conform.lua b/after/plugin/conform.lua new file mode 100644 index 0000000..9281010 --- /dev/null +++ b/after/plugin/conform.lua @@ -0,0 +1,14 @@ +local conform = require("conform") + +conform.setup({ + formatters_by_ft = { + python = { "isort", "black" }, + lua = { "stylua" }, + }, +}) + +vim.keymap.set({ "n", "v" }, "f", function() + conform.format({ + lsp_fallback = true, + }) +end, { desc = "Format file or range (in visual mode)" }) diff --git a/after/plugin/fugitive.lua b/after/plugin/fugitive.lua index ffb3fac..88f2f1a 100644 --- a/after/plugin/fugitive.lua +++ b/after/plugin/fugitive.lua @@ -1,27 +1,27 @@ -vim.keymap.set("n", "gs", vim.cmd.Git, {desc = "Git status"}) +vim.keymap.set("n", "gs", vim.cmd.Git, { desc = "Git status" }) local Crony_Fugitive = vim.api.nvim_create_augroup("Crony_Fugitive", {}) local autocmd = vim.api.nvim_create_autocmd autocmd("BufWinEnter", { - group = Crony_Fugitive, - pattern = "*", - callback = function() - if vim.bo.ft ~= "fugitive" then - return - end + group = Crony_Fugitive, + pattern = "*", + callback = function() + if vim.bo.ft ~= "fugitive" then + return + end - local bufnr = vim.api.nvim_get_current_buf() - local opts = {buffer = bufnr, remap = false} - vim.keymap.set("n", "p", function() - vim.cmd.Git('push') - end, opts) + local bufnr = vim.api.nvim_get_current_buf() + local opts = { buffer = bufnr, remap = false } + vim.keymap.set("n", "p", function() + vim.cmd.Git("push") + end, opts) - -- rebase always - vim.keymap.set("n", "P", function() - vim.cmd.Git({'pull', '--rebase'}) - end, opts) + -- rebase always + vim.keymap.set("n", "P", function() + vim.cmd.Git({ "pull", "--rebase" }) + end, opts) - vim.keymap.set("n", "t", ":Git push -u origin ", opts); - end, + vim.keymap.set("n", "t", ":Git push -u origin ", opts) + end, }) diff --git a/after/plugin/gitsigns.lua b/after/plugin/gitsigns.lua index a40f442..e7ab463 100644 --- a/after/plugin/gitsigns.lua +++ b/after/plugin/gitsigns.lua @@ -1,21 +1,21 @@ require("gitsigns").setup({ - signs = { - add = { text = "▎" }, - change = { text = "▎" }, - delete = { text = "▎" }, - topdelete = { text = "▎" }, - changedelete = { text = "▎" }, - untracked = { text = "▎" }, - }, - on_attach = function(buffer) - local gs = package.loaded.gitsigns + signs = { + add = { text = "▎" }, + change = { text = "▎" }, + delete = { text = "▎" }, + topdelete = { text = "▎" }, + changedelete = { text = "▎" }, + untracked = { text = "▎" }, + }, + on_attach = function(buffer) + local gs = package.loaded.gitsigns - local function map(mode, l, r, desc) - vim.keymap.set(mode, l, r, { buffer = buffer, desc = desc }) - end + local function map(mode, l, r, desc) + vim.keymap.set(mode, l, r, { buffer = buffer, desc = desc }) + end -- stylua: ignore start map("n", "]g", gs.next_hunk, "Next git hunk") map("n", "[g", gs.prev_hunk, "Previous git hunk") - end, + end, }) diff --git a/after/plugin/harpoon.lua b/after/plugin/harpoon.lua index d0df053..bd5aeef 100644 --- a/after/plugin/harpoon.lua +++ b/after/plugin/harpoon.lua @@ -4,14 +4,30 @@ local harpoon = require("harpoon") harpoon:setup() -- REQUIRED -vim.keymap.set("n", "a", function() harpoon:list():append() end, {desc = "Append file to harpoon starred list"}) -vim.keymap.set("n", "", function() harpoon.ui:toggle_quick_menu(harpoon:list()) end, {desc = "Check the list of files in harpoon"}) +vim.keymap.set("n", "a", function() + harpoon:list():append() +end, { desc = "Append file to harpoon starred list" }) +vim.keymap.set("n", "", function() + harpoon.ui:toggle_quick_menu(harpoon:list()) +end, { desc = "Check the list of files in harpoon" }) -vim.keymap.set("n", "", function() harpoon:list():select(1) end, {desc = "Harpoon to 1st file in list"}) -vim.keymap.set("n", "", function() harpoon:list():select(2) end, {desc = "Harpoon to 2nd file in list"}) -vim.keymap.set("n", "", function() harpoon:list():select(3) end, {desc = "Harpoon to 3rd file in list"}) -vim.keymap.set("n", "", function() harpoon:list():select(4) end, {desc = "Harpoon to 4th file in list"}) +vim.keymap.set("n", "", function() + harpoon:list():select(1) +end, { desc = "Harpoon to 1st file in list" }) +vim.keymap.set("n", "", function() + harpoon:list():select(2) +end, { desc = "Harpoon to 2nd file in list" }) +vim.keymap.set("n", "", function() + harpoon:list():select(3) +end, { desc = "Harpoon to 3rd file in list" }) +vim.keymap.set("n", "", function() + harpoon:list():select(4) +end, { desc = "Harpoon to 4th file in list" }) -- Toggle previous & next buffers stored within Harpoon list -vim.keymap.set("n", "", function() harpoon:list():prev() end, {desc = "Harpoon to previous file in list"}) -vim.keymap.set("n", "", function() harpoon:list():next() end, {desc = "Harpoon to next file in list"}) +vim.keymap.set("n", "", function() + harpoon:list():prev() +end, { desc = "Harpoon to previous file in list" }) +vim.keymap.set("n", "", function() + harpoon:list():next() +end, { desc = "Harpoon to next file in list" }) diff --git a/after/plugin/indent-blankline.lua b/after/plugin/indent-blankline.lua index 82f856e..8790f97 100644 --- a/after/plugin/indent-blankline.lua +++ b/after/plugin/indent-blankline.lua @@ -1,18 +1,18 @@ require("ibl").setup({ - indent = { char = "│" }, - scope = { enabled = false }, - exclude = { - filetypes = { - "help", - "alpha", - "dashboard", - "neo-tree", - "Trouble", - "lazy", - "mason", - "notify", - "toggleterm", - "lazyterm", - }, - }, + indent = { char = "│" }, + scope = { enabled = false }, + exclude = { + filetypes = { + "help", + "alpha", + "dashboard", + "neo-tree", + "Trouble", + "lazy", + "mason", + "notify", + "toggleterm", + "lazyterm", + }, + }, }) diff --git a/after/plugin/lsp.lua b/after/plugin/lsp.lua index 4e82771..b0f1d91 100644 --- a/after/plugin/lsp.lua +++ b/after/plugin/lsp.lua @@ -1,62 +1,82 @@ local lsp = require("lsp-zero") lsp.extend_cmp() -local cmp = require('cmp') +local cmp = require("cmp") cmp.setup({ - window = { - completion = cmp.config.window.bordered(), - documentation = cmp.config.window.bordered(), - }, - mapping = cmp.mapping.preset.insert({ - [''] = cmp.mapping.select_prev_item(), - [''] = cmp.mapping.select_next_item(), - [''] = cmp.mapping.confirm({ select = true }), - [""] = cmp.mapping.complete(), - [''] = nil, - [''] = nil, - }), - sources = { - { name = 'nvim_lsp' }, - { name = 'buffer' }, - { name = 'path' }, - { name = 'nvim_lua' }, - { name = 'luasnip' }, - } + window = { + completion = cmp.config.window.bordered(), + documentation = cmp.config.window.bordered(), + }, + mapping = cmp.mapping.preset.insert({ + [""] = cmp.mapping.select_prev_item(), + [""] = cmp.mapping.select_next_item(), + [""] = cmp.mapping.confirm({ select = true }), + [""] = cmp.mapping.complete(), + [""] = nil, + [""] = nil, + }), + sources = { + { name = "nvim_lsp" }, + { name = "buffer" }, + { name = "path" }, + { name = "nvim_lua" }, + { name = "luasnip" }, + }, }) lsp.set_sign_icons({ - error = 'E', - warn = 'W', - hint = 'H', - info = 'I' + error = "E", + warn = "W", + hint = "H", + info = "I", }) lsp.extend_lspconfig() lsp.on_attach(function(client, bufnr) - local opts = { buffer = bufnr, remap = false } + local opts = { buffer = bufnr, remap = false } - vim.keymap.set("n", "gd", function() vim.lsp.buf.definition() end, opts) - vim.keymap.set("n", "K", function() vim.lsp.buf.hover() end, opts) - vim.keymap.set("n", "vws", function() vim.lsp.buf.workspace_symbol() end, opts) - vim.keymap.set("n", "vd", function() vim.diagnostic.open_float() end, opts) - vim.keymap.set("n", "[d", function() vim.diagnostic.goto_next() end, opts) - vim.keymap.set("n", "]d", function() vim.diagnostic.goto_prev() end, opts) - vim.keymap.set("n", "vca", function() vim.lsp.buf.code_action() end, opts) - vim.keymap.set("n", "vrr", function() vim.lsp.buf.references() end, opts) - vim.keymap.set("n", "vrn", function() vim.lsp.buf.rename() end, opts) - vim.keymap.set("i", "", function() vim.lsp.buf.signature_help() end, opts) + vim.keymap.set("n", "gd", function() + vim.lsp.buf.definition() + end, opts) + vim.keymap.set("n", "K", function() + vim.lsp.buf.hover() + end, opts) + vim.keymap.set("n", "vws", function() + vim.lsp.buf.workspace_symbol() + end, opts) + vim.keymap.set("n", "vd", function() + vim.diagnostic.open_float() + end, opts) + vim.keymap.set("n", "[d", function() + vim.diagnostic.goto_next() + end, opts) + vim.keymap.set("n", "]d", function() + vim.diagnostic.goto_prev() + end, opts) + vim.keymap.set("n", "vca", function() + vim.lsp.buf.code_action() + end, opts) + vim.keymap.set("n", "vrr", function() + vim.lsp.buf.references() + end, opts) + vim.keymap.set("n", "vrn", function() + vim.lsp.buf.rename() + end, opts) + vim.keymap.set("i", "", function() + vim.lsp.buf.signature_help() + end, opts) end) vim.diagnostic.config({ - virtual_text = true + virtual_text = true, }) require("mason").setup({}) require("mason-lspconfig").setup({ - ensure_installed = { 'lua_ls' }, - handlers = { - lsp.default_setup, - } + ensure_installed = { "lua_ls" }, + handlers = { + lsp.default_setup, + }, }) diff --git a/after/plugin/mini-indentscope.lua b/after/plugin/mini-indentscope.lua index 9c07b5c..8e40111 100644 --- a/after/plugin/mini-indentscope.lua +++ b/after/plugin/mini-indentscope.lua @@ -1,22 +1,22 @@ -require('mini.indentscope').setup({ - symbol = "│", - options = { try_as_border = true }, +require("mini.indentscope").setup({ + symbol = "│", + options = { try_as_border = true }, }) vim.api.nvim_create_autocmd("FileType", { - pattern = { - "help", - "alpha", - "dashboard", - "neo-tree", - "Trouble", - "lazy", - "mason", - "notify", - "toggleterm", - "lazyterm", - }, - callback = function() - vim.b.miniindentscope_disable = true - end, + pattern = { + "help", + "alpha", + "dashboard", + "neo-tree", + "Trouble", + "lazy", + "mason", + "notify", + "toggleterm", + "lazyterm", + }, + callback = function() + vim.b.miniindentscope_disable = true + end, }) diff --git a/after/plugin/mkdnflow.lua b/after/plugin/mkdnflow.lua index a760f77..e9f46d9 100644 --- a/after/plugin/mkdnflow.lua +++ b/after/plugin/mkdnflow.lua @@ -1,10 +1,10 @@ require("mkdnflow").setup({ - modules = { - bib = false, - yaml = false, - cmp = false, - }, - links = { - conceal = true, - } + modules = { + bib = false, + yaml = false, + cmp = false, + }, + links = { + conceal = true, + }, }) diff --git a/after/plugin/oil.lua b/after/plugin/oil.lua index a9041c6..97ece0e 100644 --- a/after/plugin/oil.lua +++ b/after/plugin/oil.lua @@ -1,7 +1,7 @@ require("oil").setup({ - view_options = { - show_hidden = true - } + view_options = { + show_hidden = true, + }, }) vim.keymap.set("n", "e", "Oil", { desc = "Open parent directory" }) diff --git a/after/plugin/telescope.lua b/after/plugin/telescope.lua index 36846cb..3e114ce 100644 --- a/after/plugin/telescope.lua +++ b/after/plugin/telescope.lua @@ -1,7 +1,7 @@ -local builtin = require('telescope.builtin') -vim.keymap.set('n', 'pf', builtin.find_files, { desc = "Find files" }) -vim.keymap.set('n', '', builtin.git_files, { desc = "Find git files" }) -vim.keymap.set('n', 'ps', function() - builtin.grep_string({ search = vim.fn.input("Grep > ") }) +local builtin = require("telescope.builtin") +vim.keymap.set("n", "pf", builtin.find_files, { desc = "Find files" }) +vim.keymap.set("n", "", builtin.git_files, { desc = "Find git files" }) +vim.keymap.set("n", "ps", function() + builtin.grep_string({ search = vim.fn.input("Grep > ") }) end, { desc = "Find string" }) -vim.keymap.set('n', 'vh', builtin.help_tags, { desc = "Find help tags" }) +vim.keymap.set("n", "vh", builtin.help_tags, { desc = "Find help tags" }) diff --git a/after/plugin/treesitter.lua b/after/plugin/treesitter.lua index 7fa21da..1eb6fa5 100644 --- a/after/plugin/treesitter.lua +++ b/after/plugin/treesitter.lua @@ -1,10 +1,10 @@ -require 'nvim-treesitter.configs'.setup { - ensure_installed = { "lua", "bash" }, - sync_install = false, - auto_install = true, +require("nvim-treesitter.configs").setup({ + ensure_installed = { "lua", "bash" }, + sync_install = false, + auto_install = true, - highlight = { - enable = true, - additional_vim_regex_highlighting = false, - }, -} + highlight = { + enable = true, + additional_vim_regex_highlighting = false, + }, +}) diff --git a/init.lua b/init.lua index a4daae3..a7c1a02 100644 --- a/init.lua +++ b/init.lua @@ -1 +1 @@ -require('crony') +require("crony") diff --git a/lua/crony/init.lua b/lua/crony/init.lua index d83fa9c..b2c402e 100644 --- a/lua/crony/init.lua +++ b/lua/crony/init.lua @@ -1,29 +1,29 @@ -require('crony.set') -require('crony.map') -require('crony.lazy') +require("crony.set") +require("crony.map") +require("crony.lazy") local autocmd = vim.api.nvim_create_autocmd local function augroup(name) - return vim.api.nvim_create_augroup("crony_" .. name, { clear = true }) + return vim.api.nvim_create_augroup("crony_" .. name, { clear = true }) end -- [[ Highlight on yank ]] autocmd("TextYankPost", { - group = augroup("highlight_yank"), - callback = function() - vim.highlight.on_yank() - end, + group = augroup("highlight_yank"), + callback = function() + vim.highlight.on_yank() + end, }) -- [[ Auto create parent directory if it doesn't exist ]] autocmd({ "BufWritePre" }, { - group = augroup("auto_create_dir"), - callback = function(event) - if event.match:match("^%w%w+://") then - return - end - local file = vim.loop.fs_realpath(event.match) or event.match - vim.fn.mkdir(vim.fn.fnamemodify(file, ":p:h"), "p") - end, + group = augroup("auto_create_dir"), + callback = function(event) + if event.match:match("^%w%w+://") then + return + end + local file = vim.loop.fs_realpath(event.match) or event.match + vim.fn.mkdir(vim.fn.fnamemodify(file, ":p:h"), "p") + end, }) diff --git a/lua/crony/lazy.lua b/lua/crony/lazy.lua index 47525a8..a50094d 100644 --- a/lua/crony/lazy.lua +++ b/lua/crony/lazy.lua @@ -1,166 +1,168 @@ -- bootstraping local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim" if not vim.loop.fs_stat(lazypath) then - vim.fn.system({ - "git", - "clone", - "--filter=blob:none", - "https://github.com/folke/lazy.nvim.git", - "--branch=stable", -- latest stable release - lazypath, - }) + vim.fn.system({ + "git", + "clone", + "--filter=blob:none", + "https://github.com/folke/lazy.nvim.git", + "--branch=stable", -- latest stable release + lazypath, + }) end vim.opt.rtp:prepend(lazypath) -- plugins installation and configuration -require('lazy').setup({ - -- Git plugins - 'tpope/vim-fugitive', +require("lazy").setup({ + -- Git plugins + "tpope/vim-fugitive", - { - 'VonHeikemen/lsp-zero.nvim', - branch = 'v3.x', - dependencies = { - -- LSP Support - { 'neovim/nvim-lspconfig' }, - { 'williamboman/mason.nvim' }, - { 'williamboman/mason-lspconfig.nvim' }, + { + "VonHeikemen/lsp-zero.nvim", + branch = "v3.x", + dependencies = { + -- LSP Support + { "neovim/nvim-lspconfig" }, + { "williamboman/mason.nvim" }, + { "williamboman/mason-lspconfig.nvim" }, - -- Autocompletion - { 'hrsh7th/nvim-cmp' }, - { 'hrsh7th/cmp-buffer' }, - { 'hrsh7th/cmp-path' }, - { 'saadparwaiz1/cmp_luasnip' }, - { 'hrsh7th/cmp-nvim-lsp' }, - { 'hrsh7th/cmp-nvim-lua' }, + -- Autocompletion + { "hrsh7th/nvim-cmp" }, + { "hrsh7th/cmp-buffer" }, + { "hrsh7th/cmp-path" }, + { "saadparwaiz1/cmp_luasnip" }, + { "hrsh7th/cmp-nvim-lsp" }, + { "hrsh7th/cmp-nvim-lua" }, - -- Snippets - { 'L3MON4D3/LuaSnip' }, - { 'rafamadriz/friendly-snippets' }, + -- Snippets + { "L3MON4D3/LuaSnip" }, + { "rafamadriz/friendly-snippets" }, - -- Nice lsp info - { 'j-hui/fidget.nvim', opts = {} }, + -- Nice lsp info + { "j-hui/fidget.nvim", opts = {} }, - -- Additional neovim docs - 'folke/neodev.nvim', - opts = {}, - } - }, + -- Additional neovim docs + "folke/neodev.nvim", + opts = {}, + }, + }, - -- Emacs which key but in a much nicer form - { 'folke/which-key.nvim', opts = {}, event = "VeryLazy" }, + -- Emacs which key but in a much nicer form + { "folke/which-key.nvim", opts = {}, event = "VeryLazy" }, - { - -- Adds git related signs to the gutter, as well as utilities for managing changes - 'lewis6991/gitsigns.nvim', - }, + { + -- Adds git related signs to the gutter, as well as utilities for managing changes + "lewis6991/gitsigns.nvim", + }, - { - -- Catppuccin, the best pastell color scheme - "catppuccin/nvim", - name = "catppuccin", - priority = 1000, - }, + { + -- Catppuccin, the best pastell color scheme + "catppuccin/nvim", + name = "catppuccin", + priority = 1000, + }, - { - -- Set lualine as statusline - 'nvim-lualine/lualine.nvim', - -- See `:help lualine.txt` - opts = { - options = { - icons_enabled = false, - theme = 'catppuccin', - component_separators = '|', - section_separators = '', - }, - }, - }, + { + -- Set lualine as statusline + "nvim-lualine/lualine.nvim", + -- See `:help lualine.txt` + opts = { + options = { + icons_enabled = false, + theme = "catppuccin", + component_separators = "|", + section_separators = "", + }, + }, + }, - { - -- show indent line - 'lukas-reineke/indent-blankline.nvim', - }, + { + -- show indent line + "lukas-reineke/indent-blankline.nvim", + }, - -- highlight indentscope - "echasnovski/mini.indentscope", + -- highlight indentscope + "echasnovski/mini.indentscope", - -- "gc" to comment visual regions/lines - { 'numToStr/Comment.nvim', opts = {}, event = "VeryLazy" }, + -- "gc" to comment visual regions/lines + { "numToStr/Comment.nvim", opts = {}, event = "VeryLazy" }, - -- Fuzzy Finder (files, lsp, etc) - { - 'nvim-telescope/telescope.nvim', - lazy = true, - dependencies = { - 'nvim-lua/plenary.nvim', - }, - }, + -- Fuzzy Finder (files, lsp, etc) + { + "nvim-telescope/telescope.nvim", + lazy = true, + dependencies = { + "nvim-lua/plenary.nvim", + }, + }, - { - -- Highlight, edit, and navigate code - 'nvim-treesitter/nvim-treesitter', - build = ':TSUpdate', - }, + { + -- Highlight, edit, and navigate code + "nvim-treesitter/nvim-treesitter", + build = ":TSUpdate", + }, - { - -- netrw on crack - 'stevearc/oil.nvim', - opts = { - }, - -- Optional dependencies - dependencies = { "nvim-tree/nvim-web-devicons", lazy = true }, - }, + { + -- netrw on crack + "stevearc/oil.nvim", + opts = {}, + -- Optional dependencies + dependencies = { "nvim-tree/nvim-web-devicons", lazy = true }, + }, - { - -- harpoon your way around code - { - "ThePrimeagen/harpoon", - branch = "harpoon2", - requires = { "nvim-lua/plenary.nvim", lazy = true } - } - }, + { + -- harpoon your way around code + { + "ThePrimeagen/harpoon", + branch = "harpoon2", + requires = { "nvim-lua/plenary.nvim", lazy = true }, + }, + }, - "NvChad/nvim-colorizer.lua", + "NvChad/nvim-colorizer.lua", - { - "stevearc/dressing.nvim", - event = "VeryLazy", - opts = { - input = { default_prompt = "➤ " }, - select = { backend = { "telescope", "builtin" } }, - }, - }, + { + "stevearc/dressing.nvim", + event = "VeryLazy", + opts = { + input = { default_prompt = "➤ " }, + select = { backend = { "telescope", "builtin" } }, + }, + }, - -- nice tmux integration - 'christoomey/vim-tmux-navigator', + -- nice tmux integration + "christoomey/vim-tmux-navigator", - -- smart autopairs - 'windwp/nvim-autopairs', + -- smart autopairs + "windwp/nvim-autopairs", - { - -- nicer notification's - 'rcarriga/nvim-notify', - config = function() - vim.notify = require("notify") - end - }, + { + -- nicer notification's + "rcarriga/nvim-notify", + config = function() + vim.notify = require("notify") + end, + }, - -- markdown editing super powered - 'jakewvincent/mkdnflow.nvim', + -- markdown editing super powered + "jakewvincent/mkdnflow.nvim", + + -- additional formater support + "stevearc/conform.nvim", }, { - install = { - colorscheme = { "catppuccin" } - }, - performance = { - rtp = { - disabled_plugins = { - "gzip", - "netrwPlugin", - "tarPlugin", - "tohtml", - "tutor", - "zipPlugin", - } - } - } + install = { + colorscheme = { "catppuccin" }, + }, + performance = { + rtp = { + disabled_plugins = { + "gzip", + "netrwPlugin", + "tarPlugin", + "tohtml", + "tutor", + "zipPlugin", + }, + }, + }, }) diff --git a/lua/crony/map.lua b/lua/crony/map.lua index a14a806..514c55e 100644 --- a/lua/crony/map.lua +++ b/lua/crony/map.lua @@ -1,17 +1,17 @@ local map = vim.keymap.set -- Leader -vim.g.mapleader = ' ' -vim.g.maplocalleader = ';' +vim.g.mapleader = " " +vim.g.maplocalleader = ";" -- Diagnostic keymaps -map('n', '[d', vim.diagnostic.goto_prev, { desc = 'Go to previous diagnostic message' }) -map('n', ']d', vim.diagnostic.goto_next, { desc = 'Go to next diagnostic message' }) -map('n', 'e', vim.diagnostic.open_float, { desc = 'Open floating diagnostic message' }) -map('n', 'q', vim.diagnostic.setloclist, { desc = 'Open diagnostics list' }) +map("n", "[d", vim.diagnostic.goto_prev, { desc = "Go to previous diagnostic message" }) +map("n", "]d", vim.diagnostic.goto_next, { desc = "Go to next diagnostic message" }) +map("n", "e", vim.diagnostic.open_float, { desc = "Open floating diagnostic message" }) +map("n", "q", vim.diagnostic.setloclist, { desc = "Open diagnostics list" }) -- Lsp format -map('n', 'f', vim.lsp.buf.format, { desc = "Format current buffer" }) +-- map('n', 'f', vim.lsp.buf.format, { desc = "Format current buffer" }) -- Move text easilly map("v", "J", ":m '>+1gv=gv", { desc = "Move selected text up" }) @@ -28,7 +28,7 @@ map("x", "p", [["_dP]], { desc = "Paste while keeping the registry" }) -- source current lua config file map("n", "", function() - vim.cmd("so") + vim.cmd("so") end, { desc = "Source current source file" }) -- better indenting diff --git a/lua/crony/set.lua b/lua/crony/set.lua index d736bf4..c8d4a82 100644 --- a/lua/crony/set.lua +++ b/lua/crony/set.lua @@ -18,7 +18,7 @@ opt.expandtab = true opt.smartindent = true -- Enable the mouse, just to have it -opt.mouse = 'a' +opt.mouse = "a" -- Enable break indent opt.breakindent = true @@ -34,14 +34,14 @@ opt.ignorecase = true opt.smartcase = true -- Keep signcolumn on by default -opt.signcolumn = 'yes' +opt.signcolumn = "yes" -- Decrease update time opt.updatetime = 50 opt.timeoutlen = 300 -- Set completeopt to have a better completion experience -opt.completeopt = 'menuone,noselect' +opt.completeopt = "menuone,noselect" -- Enable true color support opt.termguicolors = true