From 622145d18311ee3947c590d1ccff814400205fec Mon Sep 17 00:00:00 2001 From: pr0c3550r Date: Sat, 25 Feb 2023 23:44:08 +0100 Subject: [PATCH] autoforamtted everything --- nvim/.config/nvim/lua/plugin/commenting.lua | 3 +- nvim/.config/nvim/lua/plugin/fugitive.lua | 16 +- nvim/.config/nvim/lua/plugin/gitsigns.lua | 14 +- .../nvim/lua/plugin/gruvbox-material.lua | 61 +++--- nvim/.config/nvim/lua/plugin/lspconfig.lua | 4 +- nvim/.config/nvim/lua/plugin/lualine.lua | 37 ++-- nvim/.config/nvim/lua/plugin/null-ls.lua | 17 +- nvim/.config/nvim/lua/plugin/nvim-cmp.lua | 201 +++++++++--------- nvim/.config/nvim/lua/plugin/surround.lua | 2 +- nvim/.config/nvim/lua/plugin/telescope.lua | 14 +- nvim/.config/nvim/lua/plugin/treesitter.lua | 8 +- nvim/.config/nvim/lua/plugin/twilight.lua | 2 +- 12 files changed, 184 insertions(+), 195 deletions(-) diff --git a/nvim/.config/nvim/lua/plugin/commenting.lua b/nvim/.config/nvim/lua/plugin/commenting.lua index d0ca0d9..d21d817 100644 --- a/nvim/.config/nvim/lua/plugin/commenting.lua +++ b/nvim/.config/nvim/lua/plugin/commenting.lua @@ -1,9 +1,8 @@ return { { "echasnovski/mini.comment", - config = function () + config = function() require("mini.comment").setup() end, }, } - diff --git a/nvim/.config/nvim/lua/plugin/fugitive.lua b/nvim/.config/nvim/lua/plugin/fugitive.lua index afe55c8..468940b 100644 --- a/nvim/.config/nvim/lua/plugin/fugitive.lua +++ b/nvim/.config/nvim/lua/plugin/fugitive.lua @@ -2,15 +2,15 @@ return { { 'tpope/vim-fugitive', keys = { - { "Gs", "Git status ", desc = "git status" }, - { "Gd", "Git diff ", desc = "git diff" }, - { "GD", "Git diff --staged ", desc = "git diff --staged" }, - { "Gl", "Git log --graph ", desc = "git log --graph" }, + { "Gs", "Git status ", desc = "git status" }, + { "Gd", "Git diff ", desc = "git diff" }, + { "GD", "Git diff --staged ", desc = "git diff --staged" }, + { "Gl", "Git log --graph ", desc = "git log --graph" }, { "Ga", "Git add --interactive ", desc = "git add" }, - { "GA", "Git add -A ", desc = "git add -A " }, - { "Gc", "Git commit ", desc = "git commit" }, - { "GC", "Git commit --amend ", desc = "git commit --amend " }, - { "Gp", "Git push ", desc = "git push" }, + { "GA", "Git add -A ", desc = "git add -A " }, + { "Gc", "Git commit ", desc = "git commit" }, + { "GC", "Git commit --amend ", desc = "git commit --amend " }, + { "Gp", "Git push ", desc = "git push" }, }, } } diff --git a/nvim/.config/nvim/lua/plugin/gitsigns.lua b/nvim/.config/nvim/lua/plugin/gitsigns.lua index 87f5426..9b63384 100644 --- a/nvim/.config/nvim/lua/plugin/gitsigns.lua +++ b/nvim/.config/nvim/lua/plugin/gitsigns.lua @@ -2,7 +2,7 @@ return { { 'lewis6991/gitsigns.nvim', event = "VeryLazy", - config = function () + config = function() require('gitsigns').setup({ preview_config = { border = 'rounded', @@ -21,29 +21,29 @@ return { if vim.wo.diff then return ']c' end vim.schedule(function() gs.next_hunk() end) return '' - end, {expr=true}) + end, { expr = true }) map('n', '[c', function() if vim.wo.diff then return '[c' end vim.schedule(function() gs.prev_hunk() end) return '' - end, {expr=true}) + end, { expr = true }) -- Actions - map({'n', 'v'}, 'hs', ':Gitsigns stage_hunk') - map({'n', 'v'}, 'hr', ':Gitsigns reset_hunk') + map({ 'n', 'v' }, 'hs', ':Gitsigns stage_hunk') + map({ 'n', 'v' }, 'hr', ':Gitsigns reset_hunk') map('n', 'hS', gs.stage_buffer) map('n', 'hu', gs.undo_stage_hunk) map('n', 'hR', gs.reset_buffer) map('n', 'hp', gs.preview_hunk) - map('n', 'hb', function() gs.blame_line{full=true} end) + map('n', 'hb', function() gs.blame_line { full = true } end) map('n', 'tb', gs.toggle_current_line_blame) map('n', 'hd', gs.diffthis) map('n', 'hD', function() gs.diffthis('~') end) map('n', 'td', gs.toggle_deleted) -- Text object - map({'o', 'x'}, 'ih', ':Gitsigns select_hunk') + map({ 'o', 'x' }, 'ih', ':Gitsigns select_hunk') end }) end, diff --git a/nvim/.config/nvim/lua/plugin/gruvbox-material.lua b/nvim/.config/nvim/lua/plugin/gruvbox-material.lua index 0101a74..fb9148b 100644 --- a/nvim/.config/nvim/lua/plugin/gruvbox-material.lua +++ b/nvim/.config/nvim/lua/plugin/gruvbox-material.lua @@ -12,54 +12,53 @@ return { vim.api.nvim_set_var("gruvbox_material_enable_italic", "1") vim.api.nvim_set_var("gruvbox_material_better_performance", "1") vim.cmd([[colo gruvbox-material]]) - + -- Settings to override colorscheme -- vim.api.nvim_set_hl(0, "ModeMsg", { bold = true, fg = "#d8a657"}) -- colors of tabline - vim.api.nvim_set_hl(0, "TabLine", {bg = "#3c3836", fg = "#89b482"}) - vim.api.nvim_set_hl(0, "TabLineFil", {bg = "#1d2021"}) - vim.api.nvim_set_hl(0, "TabLineSel", {bold = true, bg = "none", fg = "#d8a657"}) + vim.api.nvim_set_hl(0, "TabLine", { bg = "#3c3836", fg = "#89b482" }) + vim.api.nvim_set_hl(0, "TabLineFil", { bg = "#1d2021" }) + vim.api.nvim_set_hl(0, "TabLineSel", { bold = true, bg = "none", fg = "#d8a657" }) -- color of statusline - vim.api.nvim_set_hl(0, "StatusLine", {bold = false, bg = "#1d2021", fg = "#89b482"}) - vim.api.nvim_set_hl(0, "StatusLineNC", {bg = "#1d2021", fg = "#5b534d"}) + vim.api.nvim_set_hl(0, "StatusLine", { bold = false, bg = "#1d2021", fg = "#89b482" }) + vim.api.nvim_set_hl(0, "StatusLineNC", { bg = "#1d2021", fg = "#5b534d" }) -- color of vertical split line - vim.api.nvim_set_hl(0, "VertSplit", {bg = "#141617", fg = "#141617"}) + vim.api.nvim_set_hl(0, "VertSplit", { bg = "#141617", fg = "#141617" }) -- color of the cursorline and cursorlinenumber - vim.api.nvim_set_hl(0, "Cursorline", {bg = "#141617"}) - vim.api.nvim_set_hl(0, "CursorLineNr", {bold = true, bg = "#141617", fg = "#d8a657"}) + vim.api.nvim_set_hl(0, "Cursorline", { bg = "#141617" }) + vim.api.nvim_set_hl(0, "CursorLineNr", { bold = true, bg = "#141617", fg = "#d8a657" }) -- color of Floats and FloatBorders - vim.api.nvim_set_hl(0, "NormalFloat", {bg = none, fg = none }) - vim.api.nvim_set_hl(0, "FloatBorder", {bg = none, fg = "#d4be98"}) - vim.api.nvim_set_hl(0, "DiagnosticFloatingWarn", {bg = none, fg = "#d8a657"}) - vim.api.nvim_set_hl(0, "DiagnosticFloatingError", {bg = none, fg = "#ea6962"}) - vim.api.nvim_set_hl(0, "DiagnosticFloatingHint", {bg = none, fg = "#a9b665"}) - vim.api.nvim_set_hl(0, "DiagnosticFloatingInfo", {bg = none, fg = "#d4be98"}) + vim.api.nvim_set_hl(0, "NormalFloat", { bg = none, fg = none }) + vim.api.nvim_set_hl(0, "FloatBorder", { bg = none, fg = "#d4be98" }) + vim.api.nvim_set_hl(0, "DiagnosticFloatingWarn", { bg = none, fg = "#d8a657" }) + vim.api.nvim_set_hl(0, "DiagnosticFloatingError", { bg = none, fg = "#ea6962" }) + vim.api.nvim_set_hl(0, "DiagnosticFloatingHint", { bg = none, fg = "#a9b665" }) + vim.api.nvim_set_hl(0, "DiagnosticFloatingInfo", { bg = none, fg = "#d4be98" }) -- autocommand for overrides vim.api.nvim_create_autocmd("ColorScheme", { pattern = "gruvbox-material", - callback = function () - vim.api.nvim_set_hl(0, "TabLine", {bg = "#3c3836", fg = "#89b482"}) - vim.api.nvim_set_hl(0, "TabLineFil", {bg = "#1d2021"}) - vim.api.nvim_set_hl(0, "TabLineSel", {bold = true, bg = "none", fg = "#d8a657"}) + callback = function() + vim.api.nvim_set_hl(0, "TabLine", { bg = "#3c3836", fg = "#89b482" }) + vim.api.nvim_set_hl(0, "TabLineFil", { bg = "#1d2021" }) + vim.api.nvim_set_hl(0, "TabLineSel", { bold = true, bg = "none", fg = "#d8a657" }) -- color of statusline - vim.api.nvim_set_hl(0, "StatusLine", {bold = false, bg = "#1d2021", fg = "#89b482"}) - vim.api.nvim_set_hl(0, "StatusLineNC", {bg = "#1d2021", fg = "#5b534d"}) + vim.api.nvim_set_hl(0, "StatusLine", { bold = false, bg = "#1d2021", fg = "#89b482" }) + vim.api.nvim_set_hl(0, "StatusLineNC", { bg = "#1d2021", fg = "#5b534d" }) -- color of vertical split line - vim.api.nvim_set_hl(0, "VertSplit", {bg = "#141617", fg = "#141617"}) + vim.api.nvim_set_hl(0, "VertSplit", { bg = "#141617", fg = "#141617" }) -- color of the cursorline and cursorlinenumber - vim.api.nvim_set_hl(0, "Cursorline", {bg = "#141617"}) - vim.api.nvim_set_hl(0, "CursorLineNr", {bold = true, bg = "#141617", fg = "#d8a657"}) + vim.api.nvim_set_hl(0, "Cursorline", { bg = "#141617" }) + vim.api.nvim_set_hl(0, "CursorLineNr", { bold = true, bg = "#141617", fg = "#d8a657" }) -- color of Floats and FloatBorders - vim.api.nvim_set_hl(0, "NormalFloat", {bg = none, fg = none }) - vim.api.nvim_set_hl(0, "FloatBorder", {bg = none, fg = "#d4be98"}) - vim.api.nvim_set_hl(0, "DiagnosticFloatingWarn", {bg = none, fg = "#d8a657"}) - vim.api.nvim_set_hl(0, "DiagnosticFloatingError", {bg = none, fg = "#ea6962"}) - vim.api.nvim_set_hl(0, "DiagnosticFloatingHint", {bg = none, fg = "#a9b665"}) - vim.api.nvim_set_hl(0, "DiagnosticFloatingInfo", {bg = none, fg = "#d4be98"}) + vim.api.nvim_set_hl(0, "NormalFloat", { bg = none, fg = none }) + vim.api.nvim_set_hl(0, "FloatBorder", { bg = none, fg = "#d4be98" }) + vim.api.nvim_set_hl(0, "DiagnosticFloatingWarn", { bg = none, fg = "#d8a657" }) + vim.api.nvim_set_hl(0, "DiagnosticFloatingError", { bg = none, fg = "#ea6962" }) + vim.api.nvim_set_hl(0, "DiagnosticFloatingHint", { bg = none, fg = "#a9b665" }) + vim.api.nvim_set_hl(0, "DiagnosticFloatingInfo", { bg = none, fg = "#d4be98" }) end, }) end, }, } - diff --git a/nvim/.config/nvim/lua/plugin/lspconfig.lua b/nvim/.config/nvim/lua/plugin/lspconfig.lua index 82ec329..fb0d5e2 100644 --- a/nvim/.config/nvim/lua/plugin/lspconfig.lua +++ b/nvim/.config/nvim/lua/plugin/lspconfig.lua @@ -4,7 +4,7 @@ return { -- event = "BufReadPre", config = function() require('lspconfig.ui.windows').default_options.border = 'rounded' - vim.api.nvim_set_hl(0, "LspInfoBorder", {bg = none, fg = "#d4be98"}) + vim.api.nvim_set_hl(0, "LspInfoBorder", { bg = none, fg = "#d4be98" }) local opts = { noremap = true, silent = true } vim.keymap.set('n', 'e', vim.diagnostic.open_float, opts) vim.keymap.set('n', '[d', vim.diagnostic.goto_prev, opts) @@ -61,7 +61,6 @@ return { prefix = '●', -- Could be '●', '■', 'x', '▎' }, update_in_insert = true - }) -- LSP settings (for overriding per client) @@ -115,4 +114,3 @@ return { end, }, } - diff --git a/nvim/.config/nvim/lua/plugin/lualine.lua b/nvim/.config/nvim/lua/plugin/lualine.lua index 3c6e6cc..d887655 100644 --- a/nvim/.config/nvim/lua/plugin/lualine.lua +++ b/nvim/.config/nvim/lua/plugin/lualine.lua @@ -2,8 +2,8 @@ return { { "nvim-lualine/lualine.nvim", config = function() - vim.api.nvim_set_option("showmode",false) - local custom_gruvbox = require'lualine.themes.gruvbox-material' + vim.api.nvim_set_option("showmode", false) + local custom_gruvbox = require 'lualine.themes.gruvbox-material' custom_gruvbox.normal.a.bg = '#89b482' custom_gruvbox.normal.c.bg = '#141617' custom_gruvbox.insert.a.bg = '#d8a657' @@ -16,26 +16,26 @@ return { component_separators = ' ' }, sections = { - lualine_a = {'mode'}, + lualine_a = { 'mode' }, lualine_b = { { 'branch', icon = '', - color={fg='#d8a657', bg='#141617', gui='bold' }, + color = { fg = '#d8a657', bg = '#141617', gui = 'bold' }, } }, lualine_c = { { 'filename', - color={gui='italic', fg='#d3869b', bg='#1d2021'}, + color = { gui = 'italic', fg = '#d3869b', bg = '#1d2021' }, path = 1, } }, lualine_x = { { 'filetype', - color={bg='#1d2021', fg='#d4be98', gui='italic'}, - fmt = function (str) + color = { bg = '#1d2021', fg = '#d4be98', gui = 'italic' }, + fmt = function(str) return (str:gsub("^%l", string.upper)) end, } @@ -43,7 +43,7 @@ return { lualine_y = { { 'diagnostics', - color={gui='bold', bg='#141617'}, + color = { gui = 'bold', bg = '#141617' }, sections = { 'error', 'warn', 'info', 'hint' }, symbols = { error = "✘ ", warn = " ", info = " ", hint = "󰌶 " }, update_in_insert = true @@ -51,15 +51,15 @@ return { }, { 'diff', - icon = {' ', color={bg='#141617', fg='#d8a657', gui='bold'}}, - color={gui='bold', bg='#141617'}, + icon = { ' ', color = { bg = '#141617', fg = '#d8a657', gui = 'bold' } }, + color = { gui = 'bold', bg = '#141617' }, } }, - lualine_z = {'location'} + lualine_z = { 'location' } }, inactive_sections = { - lualine_a = {'mode'}, + lualine_a = { 'mode' }, lualine_b = { { 'branch', @@ -75,8 +75,8 @@ return { lualine_x = { { 'filetype', - color={gui='italic'}, - fmt = function (str) + color = { gui = 'italic' }, + fmt = function(str) return (str:gsub("^%l", string.upper)) end, } @@ -84,7 +84,7 @@ return { lualine_y = { { 'diagnostics', - color={gui='bold', bg='#141617'}, + color = { gui = 'bold', bg = '#141617' }, sections = { 'error', 'warn', 'info', 'hint' }, symbols = { error = "✘ ", warn = " ", info = " ", hint = "󰌶 " }, update_in_insert = true @@ -92,14 +92,13 @@ return { }, { 'diff', - icon = {' ', color={bg='#141617', gui='bold'}}, - color={gui='bold', bg='#141617'}, + icon = { ' ', color = { bg = '#141617', gui = 'bold' } }, + color = { gui = 'bold', bg = '#141617' }, } }, - lualine_z = {'location'} + lualine_z = { 'location' } }, } end, }, } - diff --git a/nvim/.config/nvim/lua/plugin/null-ls.lua b/nvim/.config/nvim/lua/plugin/null-ls.lua index 8a13796..8a4e98f 100644 --- a/nvim/.config/nvim/lua/plugin/null-ls.lua +++ b/nvim/.config/nvim/lua/plugin/null-ls.lua @@ -6,21 +6,21 @@ return { { "nvim-telescope/telescope-ui-select.nvim", lazy = true, - config = function () + config = function() -- This is your opts table require("telescope").setup { extensions = { ["ui-select"] = { -- require("telescope.themes").get_dropdown { - -- -- even more opts - -- } - } + -- -- even more opts + -- } } } - require("telescope").load_extension("ui-select") - end, - }, + } + require("telescope").load_extension("ui-select") + end, }, + }, opts = function() local null_ls = require('null-ls') return { @@ -39,7 +39,7 @@ return { vim.keymap.set('n', 'fm', function() vim.lsp.buf.format { async = true } end, bufopts) end, sources = { - null_ls.builtins.diagnostics.trail_space.with{ + null_ls.builtins.diagnostics.trail_space.with { disabled_filetypes = { "lua" } }, null_ls.builtins.diagnostics.shellcheck, @@ -51,4 +51,3 @@ return { end, }, } - diff --git a/nvim/.config/nvim/lua/plugin/nvim-cmp.lua b/nvim/.config/nvim/lua/plugin/nvim-cmp.lua index 4fd30f9..8900ab4 100644 --- a/nvim/.config/nvim/lua/plugin/nvim-cmp.lua +++ b/nvim/.config/nvim/lua/plugin/nvim-cmp.lua @@ -8,14 +8,14 @@ return { "rafamadriz/friendly-snippets", config = function() require("luasnip.loaders.from_vscode").lazy_load() - vim.api.nvim_set_hl( 0, "PmenuSel", { fg = 'NONE', bg = '#141617' } ) - vim.api.nvim_set_hl( 0, "Pmenu", { fg = 'NONE', bg = '#1d2021' } ) - vim.api.nvim_set_hl( 0, "CmpItemMenu", { fg = 'NONE', bg = '#141617' } ) - vim.api.nvim_set_hl( 0, "CmpItemMenuDefault", { fg = 'NONE', bg = '#141617' } ) - vim.api.nvim_set_hl( 0, "CmpItemKindFunction", { fg = '#d3869b', bg = 'NONE', italic = true } ) - vim.api.nvim_set_hl( 0, "CmpItemKindSnippet", { fg = '#d8a657', bg = 'NONE', italic = true } ) - vim.api.nvim_set_hl( 0, "CmpItemKindText", {fg = '#ddc7a1', bg = 'NONE', italic = true } ) - vim.api.nvim_set_hl( 0, "CmpItemKindVariable", {fg = '#7daea3', bg = 'NONE', italic = true } ) + vim.api.nvim_set_hl(0, "PmenuSel", { fg = 'NONE', bg = '#141617' }) + vim.api.nvim_set_hl(0, "Pmenu", { fg = 'NONE', bg = '#1d2021' }) + vim.api.nvim_set_hl(0, "CmpItemMenu", { fg = 'NONE', bg = '#141617' }) + vim.api.nvim_set_hl(0, "CmpItemMenuDefault", { fg = 'NONE', bg = '#141617' }) + vim.api.nvim_set_hl(0, "CmpItemKindFunction", { fg = '#d3869b', bg = 'NONE', italic = true }) + vim.api.nvim_set_hl(0, "CmpItemKindSnippet", { fg = '#d8a657', bg = 'NONE', italic = true }) + vim.api.nvim_set_hl(0, "CmpItemKindText", { fg = '#ddc7a1', bg = 'NONE', italic = true }) + vim.api.nvim_set_hl(0, "CmpItemKindVariable", { fg = '#7daea3', bg = 'NONE', italic = true }) end, }, }, @@ -24,7 +24,7 @@ return { { "hrsh7th/nvim-cmp", version = false, - event = { + event = { -- "InsertEnter", -- "CmdlineEnter", "BufWinEnter", @@ -37,7 +37,7 @@ return { "saadparwaiz1/cmp_luasnip", }, opts = function() - -- Set up nvim-cmp with luasnip + -- Set up nvim-cmp with luasnip local kind_icons = { Text = "", Method = "", @@ -69,34 +69,34 @@ return { local has_words_before = function() unpack = unpack or table.unpack local line, col = unpack(vim.api.nvim_win_get_cursor(0)) - return col ~= 0 and vim.api.nvim_buf_get_lines(0, line - 1, line, true)[1]:sub(col, col):match("%s") == nil + return col ~= 0 and + vim.api.nvim_buf_get_lines(0, line - 1, line, true)[1]:sub(col, col):match("%s") == nil end local luasnip = require("luasnip") local cmp = require("cmp") - return{ + return { formatting = { format = function(entry, vim_item) -- Kind icons vim_item.kind = string.format('%s %s', kind_icons[vim_item.kind], vim_item.kind) -- This concatonates the icons with the name of the item kind -- Source vim_item.menu = ({ - -- buffer = "[Buffer]", - -- nvim_lsp = "[LSP]", - -- luasnip = "[LuaSnip]", - -- nvim_lua = "[Lua]", - -- latex_symbols = "[LaTeX]", - buffer = "", - nvim_lsp = "", - luasnip = "", - nvim_lua = "", - latex_symbols = "", - })[entry.source.name] + -- buffer = "[Buffer]", + -- nvim_lsp = "[LSP]", + -- luasnip = "[LuaSnip]", + -- nvim_lua = "[Lua]", + -- latex_symbols = "[LaTeX]", + buffer = "", + nvim_lsp = "", + luasnip = "", + nvim_lua = "", + latex_symbols = "", + })[entry.source.name] return vim_item end }, - snippet = { -- REQUIRED - you must specify a snippet engine expand = function(args) @@ -106,90 +106,85 @@ return { -- vim.fn["UltiSnips#Anon"](args.body) -- For `ultisnips` users. end, }, - -- completion = { - -- autocomplete = false, - -- }, + -- autocomplete = false, + -- }, - window = { - completion = cmp.config.window.bordered(), - documentation = cmp.config.window.bordered(), - }, + window = { + completion = cmp.config.window.bordered(), + documentation = cmp.config.window.bordered(), + }, + mapping = cmp.mapping.preset.insert({ + [''] = cmp.mapping.scroll_docs( -4), + [''] = cmp.mapping.scroll_docs(4), + -- [''] = cmp.mapping.complete(), + -- [''] = cmp.mapping.abort(), + [''] = cmp.mapping(function(fallback) + if cmp.visible() then + cmp.abort() + else + cmp.complete() + end + end), + [''] = cmp.mapping.confirm({ select = false }), -- Accept currently selected item. Set `select` to `false` to only confirm explicitly selected items. + [""] = cmp.mapping(function(fallback) + if cmp.visible() then + cmp.select_next_item() + -- You could replace the expand_or_jumpable() calls with expand_or_locally_jumpable() + -- they way you will only jump inside the snippet region + elseif luasnip.expand_or_jumpable() then + luasnip.expand_or_jump() + elseif has_words_before() then + cmp.complete() + else + fallback() + end + end, { "i", "s" }), - mapping = cmp.mapping.preset.insert({ - [''] = cmp.mapping.scroll_docs(-4), - [''] = cmp.mapping.scroll_docs(4), - -- [''] = cmp.mapping.complete(), - -- [''] = cmp.mapping.abort(), - [''] = cmp.mapping(function(fallback) - if cmp.visible() then - cmp.abort() - else - cmp.complete() - end - end), - [''] = cmp.mapping.confirm({ select = false }), -- Accept currently selected item. Set `select` to `false` to only confirm explicitly selected items. - [""] = cmp.mapping(function(fallback) - if cmp.visible() then - cmp.select_next_item() - -- You could replace the expand_or_jumpable() calls with expand_or_locally_jumpable() - -- they way you will only jump inside the snippet region - elseif luasnip.expand_or_jumpable() then - luasnip.expand_or_jump() - elseif has_words_before() then - cmp.complete() - else - fallback() - end - end, { "i", "s" }), - - [""] = cmp.mapping(function(fallback) - if cmp.visible() then - cmp.select_prev_item() - elseif luasnip.jumpable(-1) then - luasnip.jump(-1) - else - fallback() - end - end, { "i", "s" }), - }), + [""] = cmp.mapping(function(fallback) + if cmp.visible() then + cmp.select_prev_item() + elseif luasnip.jumpable( -1) then + luasnip.jump( -1) + else + fallback() + end + end, { "i", "s" }), + }), + sources = cmp.config.sources({ + { name = 'nvim_lsp' }, + -- { name = 'vsnip' }, -- For vsnip users. + { name = 'luasnip' }, -- For luasnip users. + -- { name = 'ultisnips' }, -- For ultisnips users. + -- { name = 'snippy' }, -- For snippy users. + { name = 'buffer' }, + }, { + }), + -- Set configuration for specific filetype. + cmp.setup.filetype('gitcommit', { sources = cmp.config.sources({ - { name = 'nvim_lsp' }, - -- { name = 'vsnip' }, -- For vsnip users. - { name = 'luasnip' }, -- For luasnip users. - -- { name = 'ultisnips' }, -- For ultisnips users. - -- { name = 'snippy' }, -- For snippy users. - { name = 'buffer' }, + { name = 'cmp_git' }, -- You can specify the `cmp_git` source if you were installed it. }, { - }), - - -- Set configuration for specific filetype. - cmp.setup.filetype('gitcommit', { - sources = cmp.config.sources({ - { name = 'cmp_git' }, -- You can specify the `cmp_git` source if you were installed it. - }, { - { name = 'buffer' }, - }) - }), - - -- Use buffer source for `/` and `?` (if you enabled `native_menu`, this won't work anymore). - cmp.setup.cmdline({ '/', '?' }, { - mapping = cmp.mapping.preset.cmdline(), - sources = { - { name = 'buffer' } - } - }), - - -- Use cmdline & path source for ':' (if you enabled `native_menu`, this won't work anymore). - cmp.setup.cmdline(':', { - mapping = cmp.mapping.preset.cmdline(), - sources = cmp.config.sources({ - { name = 'path' } - }, { - { name = 'cmdline' } - }) - }), - } + { name = 'buffer' }, + }) + }), + -- Use buffer source for `/` and `?` (if you enabled `native_menu`, this won't work anymore). + cmp.setup.cmdline({ '/', '?' }, { + mapping = cmp.mapping.preset.cmdline(), + sources = { + { name = 'buffer' } + } + }), + -- Use cmdline & path source for ':' (if you enabled `native_menu`, this won't work anymore). + cmp.setup.cmdline(':', { + mapping = cmp.mapping.preset.cmdline(), + sources = cmp.config.sources({ + { name = 'path' } + }, { + { name = 'cmdline' } + }) + }), + } end, } } diff --git a/nvim/.config/nvim/lua/plugin/surround.lua b/nvim/.config/nvim/lua/plugin/surround.lua index 373a4d5..98bab01 100644 --- a/nvim/.config/nvim/lua/plugin/surround.lua +++ b/nvim/.config/nvim/lua/plugin/surround.lua @@ -13,7 +13,7 @@ return { update_n_lines = "gzn", }, }, - config = function (_, opts) + config = function(_, opts) require("mini.surround").setup(opts) end, } diff --git a/nvim/.config/nvim/lua/plugin/telescope.lua b/nvim/.config/nvim/lua/plugin/telescope.lua index d7f5243..55f7491 100644 --- a/nvim/.config/nvim/lua/plugin/telescope.lua +++ b/nvim/.config/nvim/lua/plugin/telescope.lua @@ -5,14 +5,14 @@ return { cmd = "Telescope", version = false, keys = { - { ":", "Telescope command_history", desc = "Command History" }, - { ",", "Telescope buffers show_all_buffers=true", desc = "Switch Buffer" }, + { ":", "Telescope command_history", desc = "Command History" }, + { ",", "Telescope buffers show_all_buffers=true", desc = "Switch Buffer" }, -- find - {"ff", "Telescope find_files", desc = "Find Files" }, - {"fg", "Telescope live_grep", desc = "Grep Content in Files" }, - {"/", "Telescope live_grep", desc = "Grep Content in Files" }, - {"fG", "Telescope git_files", desc = "Find Git Files" }, - {"fk", "Telescope keymaps", desc = "Find Git Files" }, + { "ff", "Telescope find_files", desc = "Find Files" }, + { "fg", "Telescope live_grep", desc = "Grep Content in Files" }, + { "/", "Telescope live_grep", desc = "Grep Content in Files" }, + { "fG", "Telescope git_files", desc = "Find Git Files" }, + { "fk", "Telescope keymaps", desc = "Find Git Files" }, }, }, } diff --git a/nvim/.config/nvim/lua/plugin/treesitter.lua b/nvim/.config/nvim/lua/plugin/treesitter.lua index dd6d6f3..0b73d09 100644 --- a/nvim/.config/nvim/lua/plugin/treesitter.lua +++ b/nvim/.config/nvim/lua/plugin/treesitter.lua @@ -5,22 +5,22 @@ return { build = ":TSUpdate", -- event = "BufReadPre", opts = { - ensure_installed = { + ensure_installed = { "c", "lua", "rust", "latex", - "bibtex", + "bibtex", "python", "vim", "yaml", - "json", + "json", }, sync_install = false, auto_install = true, highlight = { enable = true, - disable = { + disable = { "markdown", }, }, diff --git a/nvim/.config/nvim/lua/plugin/twilight.lua b/nvim/.config/nvim/lua/plugin/twilight.lua index 4bd435b..0799d0d 100644 --- a/nvim/.config/nvim/lua/plugin/twilight.lua +++ b/nvim/.config/nvim/lua/plugin/twilight.lua @@ -1,7 +1,7 @@ return { { "folke/twilight.nvim", - config = function () + config = function() require("twilight").setup { }