diff --git a/nvim/after/plugin/color.lua b/nvim/after/plugin/color.lua index 565df80..18f2d6b 100644 --- a/nvim/after/plugin/color.lua +++ b/nvim/after/plugin/color.lua @@ -1,2 +1,2 @@ -vim.cmd("colorscheme terafox") -vim.keymap.set("n", "aa", "AerialToggle!", { desc = "Toggle Aerial" }) +vim.cmd('colorscheme terafox') +vim.keymap.set('n', 'aa', 'AerialToggle!', { desc = 'Toggle Aerial' }) diff --git a/nvim/init.lua b/nvim/init.lua index b0074f2..7ff6dec 100644 --- a/nvim/init.lua +++ b/nvim/init.lua @@ -1,23 +1,23 @@ -- vim settings ++ mini.nvim.basics ---------------------------------------- -vim.opt.backspace = "indent,eol,start" -vim.opt.completeopt = "menuone" -vim.opt.expandtab = true -- insert tabs as spaces -vim.opt.inccommand = "split" -- incremental live completion +vim.opt.backspace = 'indent,eol,start' +vim.opt.completeopt = 'menuone' +vim.opt.expandtab = true -- insert tabs as spaces +vim.opt.inccommand = 'split' -- incremental live completion vim.opt.laststatus = 1 vim.opt.list = true -vim.opt.nrformats:append("alpha") -- let Ctrl-a do letters as well -vim.opt.path:append("**") -- enable fuzzy :find ing +vim.opt.nrformats:append('alpha') -- let Ctrl-a do letters as well +vim.opt.path:append('**') -- enable fuzzy :find ing vim.opt.relativenumber = true -vim.opt.shadafile = "NONE" -- disable shada -vim.opt.shiftwidth = 0 -- >> shifts by tabstop -vim.opt.showmatch = true -- highlight matching brackets +vim.opt.shadafile = 'NONE' -- disable shada +vim.opt.shiftwidth = 0 -- >> shifts by tabstop +vim.opt.showmatch = true -- highlight matching brackets vim.opt.showmode = true -vim.opt.softtabstop = -1 -- backspace removes tabstop +vim.opt.softtabstop = -1 -- backspace removes tabstop vim.opt.swapfile = false -vim.opt.tabstop = 2 -- 2 space tabs are based -vim.opt.updatetime = 250 -- decrease update time -vim.opt.virtualedit = "onemore" +vim.opt.tabstop = 2 -- 2 space tabs are based +vim.opt.updatetime = 250 -- decrease update time +vim.opt.virtualedit = 'onemore' vim.g.fzf_layout = { window = { width = 0.9, height = 0.6 } } @@ -25,16 +25,16 @@ vim.g.fzf_layout = { window = { width = 0.9, height = 0.6 } } vim.cmd([[ hi NormalFloat ctermbg=none ]]) -- Switch tab length on the fly -vim.keymap.set("n", "\\t", function() - vim.o.tabstop = vim.o.tabstop == 2 and 4 or 2 -end, { silent = true, desc = "toggle tabstop"}) +vim.keymap.set('n', '\\t', function() + vim.o.tabstop = vim.o.tabstop == 2 and 4 or 2 +end, { silent = true, desc = 'toggle tabstop' }) -- autocmd ---------------------------------------- -local undopath = "~/.local/share/nvim/undo" -vim.api.nvim_create_autocmd("VimEnter", { - command = "silent !mkdir -p " .. undopath, - group = vim.api.nvim_create_augroup("Init", {}), +local undopath = '~/.local/share/nvim/undo' +vim.api.nvim_create_autocmd('VimEnter', { + command = 'silent !mkdir -p ' .. undopath, + group = vim.api.nvim_create_augroup('Init', {}), }) -- Configure Neovim diagnostic messages diff --git a/nvim/plugin/aerial.lua b/nvim/plugin/aerial.lua index 30e63aa..22322fd 100644 --- a/nvim/plugin/aerial.lua +++ b/nvim/plugin/aerial.lua @@ -3,11 +3,11 @@ if vim.g.did_load_aerial_plugin then end vim.g.did_load_aerial_plugin = true -require("aerial").setup({ - default_direction = "left", +require('aerial').setup { + default_direction = 'left', autojump = true, on_attach = function(bufnr) - vim.keymap.set("n", "{", "AerialPrev", { buffer = bufnr }) - vim.keymap.set("n", "}", "AerialNext", { buffer = bufnr }) + vim.keymap.set('n', '{', 'AerialPrev', { buffer = bufnr }) + vim.keymap.set('n', '}', 'AerialNext', { buffer = bufnr }) end, -}) +} diff --git a/nvim/plugin/colors.lua b/nvim/plugin/colors.lua index 7ce4a3a..d76a039 100644 --- a/nvim/plugin/colors.lua +++ b/nvim/plugin/colors.lua @@ -3,17 +3,17 @@ if vim.g.did_load_colors_plugin then end vim.g.did_load_colors_plugin = true -require("rose-pine").setup({ - variant = "moon", - styles = { - bold = false, - italic = false, - transparency = true, - }, -}) -require('nightfox').setup({ - options = { - transparent = true, -- Disable setting background - terminal_colors = false, -- Set terminal colors (vim.g.terminal_color_*) used in `:terminal` +require('rose-pine').setup { + variant = 'moon', + styles = { + bold = false, + italic = false, + transparency = true, }, -}) +} +require('nightfox').setup { + options = { + transparent = true, -- Disable setting background + terminal_colors = false, -- Set terminal colors (vim.g.terminal_color_*) used in `:terminal` + }, +} diff --git a/nvim/plugin/completion.lua b/nvim/plugin/completion.lua index 0e30873..0b68498 100644 --- a/nvim/plugin/completion.lua +++ b/nvim/plugin/completion.lua @@ -2,9 +2,9 @@ if vim.g.did_load_completion_plugin then return end vim.g.did_load_completion_plugin = true -local cmp = require'cmp' +local cmp = require('cmp') -cmp.setup({ +cmp.setup { snippet = { expand = function(args) require('luasnip').lsp_expand(args.body) @@ -14,34 +14,34 @@ cmp.setup({ native_menu = false, ghost_text = true, }, - mapping = cmp.mapping.preset.insert({ + mapping = cmp.mapping.preset.insert { [''] = cmp.mapping.scroll_docs(-4), [''] = cmp.mapping.scroll_docs(4), [''] = cmp.mapping.complete(), ['q'] = cmp.mapping.abort(), - [''] = cmp.mapping.confirm({ select = true }), -- Accept currently selected item. Set `select` to `false` to only confirm explicitly selected items. - }), + [''] = cmp.mapping.confirm { select = true }, -- Accept currently selected item. Set `select` to `false` to only confirm explicitly selected items. + }, sources = cmp.config.sources({ { name = 'nvim_lsp' }, { name = 'luasnip' }, }, { { name = 'buffer' }, - }) -}) + }), +} cmp.setup.cmdline({ '/', '?' }, { mapping = cmp.mapping.preset.cmdline(), sources = { - { name = 'buffer' } - } + { name = 'buffer' }, + }, }) cmp.setup.cmdline(':', { mapping = cmp.mapping.preset.cmdline(), sources = cmp.config.sources({ - { name = 'path' } + { name = 'path' }, }, { - { name = 'cmdline' } + { name = 'cmdline' }, }), - matching = { disallow_symbol_nonprefix_matching = false } + matching = { disallow_symbol_nonprefix_matching = false }, }) diff --git a/nvim/plugin/diffview.lua b/nvim/plugin/diffview.lua index f63b149..01592e7 100644 --- a/nvim/plugin/diffview.lua +++ b/nvim/plugin/diffview.lua @@ -3,5 +3,5 @@ if vim.g.did_load_diffview_plugin then end vim.g.did_load_diffview_plugin = true -require("diffview").setup({ use_icons = false, }) +require('diffview').setup { use_icons = false } vim.keymap.set('n', 'gdd', vim.cmd.DiffviewOpen, { desc = '[g]it [d]iffview open' }) diff --git a/nvim/plugin/git.lua b/nvim/plugin/git.lua index 60125f1..1cc61f1 100644 --- a/nvim/plugin/git.lua +++ b/nvim/plugin/git.lua @@ -2,6 +2,6 @@ if vim.g.did_load_diffview_plugin then return end vim.g.did_load_diffview_plugin = true -require("diffview").setup({ +require('diffview').setup { use_icons = false, -}) +} diff --git a/nvim/plugin/gitsigns.lua b/nvim/plugin/gitsigns.lua index 96b55e3..1d61095 100644 --- a/nvim/plugin/gitsigns.lua +++ b/nvim/plugin/gitsigns.lua @@ -4,27 +4,39 @@ end vim.g.did_load_gitsigns_plugin = true vim.schedule(function() - require('gitsigns').setup{ - signcolumn = false, - numhl = true, - on_attach = function() - local gs = package.loaded.gitsigns - vim.keymap.set("n", "gg", gs.preview_hunk, {desc = "git preview hunk"}) - vim.keymap.set('n', 'gb', function() gs.blame_line{full=true} end, {desc = "git blame_line"}) - vim.keymap.set('n', 'gr', gs.reset_hunk, {desc = "git reset hunk"}) - vim.keymap.set('v', 'gr', function() gs.reset_hunk {vim.fn.line('.'), vim.fn.line('v')} end, {desc = "git reset hunk"}) - -- Navigation - vim.keymap.set('n', ']g', function() - if vim.wo.diff then return ']c' end - vim.schedule(function() gs.next_hunk() end) - return '' - end, {expr=true}) + require('gitsigns').setup { + signcolumn = false, + numhl = true, + on_attach = function() + local gs = package.loaded.gitsigns + vim.keymap.set('n', 'gg', gs.preview_hunk, { desc = 'git preview hunk' }) + vim.keymap.set('n', 'gb', function() + gs.blame_line { full = true } + end, { desc = 'git blame_line' }) + vim.keymap.set('n', 'gr', gs.reset_hunk, { desc = 'git reset hunk' }) + vim.keymap.set('v', 'gr', function() + gs.reset_hunk { vim.fn.line('.'), vim.fn.line('v') } + end, { desc = 'git reset hunk' }) + -- Navigation + vim.keymap.set('n', ']g', function() + if vim.wo.diff then + return ']c' + end + vim.schedule(function() + gs.next_hunk() + end) + return '' + end, { expr = true }) - vim.keymap.set('n', '[g', function() - if vim.wo.diff then return '[c' end - vim.schedule(function() gs.prev_hunk() end) - return '' - end, {expr=true}) - end + vim.keymap.set('n', '[g', function() + if vim.wo.diff then + return '[c' + end + vim.schedule(function() + gs.prev_hunk() + end) + return '' + end, { expr = true }) + end, } end) diff --git a/nvim/plugin/keymaps.lua b/nvim/plugin/keymaps.lua index 4b19444..8787061 100644 --- a/nvim/plugin/keymaps.lua +++ b/nvim/plugin/keymaps.lua @@ -1,13 +1,13 @@ -vim.keymap.set("n","gr", "gT", {noremap = true, silent = true}) -vim.keymap.set("n","n", "nzz", {noremap = true, silent = true}) -vim.keymap.set("n", "N", "Nzz", {noremap = true, silent = true}) +vim.keymap.set('n', 'gr', 'gT', { noremap = true, silent = true }) +vim.keymap.set('n', 'n', 'nzz', { noremap = true, silent = true }) +vim.keymap.set('n', 'N', 'Nzz', { noremap = true, silent = true }) vim.keymap.set('n', '', 'zz') vim.keymap.set('n', '', 'zz') vim.keymap.set('n', '', 'zz') vim.keymap.set('n', '', 'zz') -vim.keymap.set("n","", "m0i`0", {noremap = true, silent = true}) -vim.keymap.set({'v', 'i'}, 'wq', 'l', {noremap = true, silent = true}) -vim.keymap.set({'n', 'v', 'i'}, 'qwq', 'lwqa', {noremap = true, silent = true}) -vim.keymap.set({'n', 'v'}, 'yy', '"+y', {noremap = true, silent = true, desc = "Yank to clip"}) -vim.keymap.set({'n', 'v'}, 'yp', '"+p', {noremap = true, silent = true, desc = "Paste from clip"}) -vim.keymap.set({'n', 'v'}, 'yd', '"+d', {noremap = true, silent = true, desc = "Delete to clip"}) +vim.keymap.set('n', '', 'm0i`0', { noremap = true, silent = true }) +vim.keymap.set({ 'v', 'i' }, 'wq', 'l', { noremap = true, silent = true }) +vim.keymap.set({ 'n', 'v', 'i' }, 'qwq', 'lwqa', { noremap = true, silent = true }) +vim.keymap.set({ 'n', 'v' }, 'yy', '"+y', { noremap = true, silent = true, desc = 'Yank to clip' }) +vim.keymap.set({ 'n', 'v' }, 'yp', '"+p', { noremap = true, silent = true, desc = 'Paste from clip' }) +vim.keymap.set({ 'n', 'v' }, 'yd', '"+d', { noremap = true, silent = true, desc = 'Delete to clip' }) diff --git a/nvim/plugin/lsp.lua b/nvim/plugin/lsp.lua index b124502..5dde0b3 100644 --- a/nvim/plugin/lsp.lua +++ b/nvim/plugin/lsp.lua @@ -7,59 +7,99 @@ vim.g.did_load_lsp_plugin = true local lspconfig = require('lspconfig') local capabilities = require('cmp_nvim_lsp').default_capabilities() -lspconfig.gopls.setup { on_attach = function(_, bufnr) +lspconfig.gopls.setup { + on_attach = function(_, bufnr) capabilities = capabilities - vim.api.nvim_command("au BufWritePre lua vim.lsp.buf.format { async = false }") -end + vim.api.nvim_command('au BufWritePre lua vim.lsp.buf.format { async = false }') + end, } lspconfig.pyright.setup { capabilities = capabilities } lspconfig.nil_ls.setup { capabilities = capabilities } -vim.keymap.set('n', 'de', vim.diagnostic.open_float, {desc = "Toggle diagnostic"}) -vim.keymap.set('n', '[d', vim.diagnostic.goto_prev, {desc = "Prev diagnostic"}) -vim.keymap.set('n', ']d', vim.diagnostic.goto_next, {desc = "Next diagnostic"}) +vim.keymap.set('n', 'de', vim.diagnostic.open_float, { desc = 'Toggle diagnostic' }) +vim.keymap.set('n', '[d', vim.diagnostic.goto_prev, { desc = 'Prev diagnostic' }) +vim.keymap.set('n', ']d', vim.diagnostic.goto_next, { desc = 'Next diagnostic' }) -vim.diagnostic.config({ - virtual_text = true, - underline = true, - update_in_insert = false, -}) +vim.diagnostic.config { + virtual_text = true, + underline = true, + update_in_insert = false, +} -- Use LspAttach autocommand to only map the following keys -- after the language server attaches to the current buffer vim.api.nvim_create_autocmd('LspAttach', { - group = vim.api.nvim_create_augroup('UserLspConfig', {}), - callback = function(ev) - local bufnr = ev.buf - local client = vim.lsp.get_client_by_id(ev.data.client_id) - -- Buffer local mappings. - -- See `:help vim.lsp.*` for documentation on any of the below functions - vim.keymap.set('n', 'K', vim.lsp.buf.hover, { buffer = ev.buf, noremap = true, silent = true , desc = "LSP hover"}) - vim.keymap.set('n', 'rn', vim.lsp.buf.rename, { buffer = ev.buf, noremap = true, silent = true , desc = "LSP Rename"}) - vim.keymap.set({ 'n', 'v' }, 'da', vim.lsp.buf.code_action, { buffer = ev.buf, noremap = true, silent = true , desc = "LSP code action"}) - vim.keymap.set("n", "dd", "Telescope lsp_definitions", { buffer = ev.buf, noremap = true, silent = true , desc = "LSP definitions"}) - vim.keymap.set("n", "di", "Telescope lsp_implementations", { buffer = ev.buf, noremap = true, silent = true , desc = "LSP implementations"}) - vim.keymap.set("n", "dr", "Telescope lsp_references", { buffer = ev.buf, noremap = true, silent = true , desc = "LSP references"}) - vim.keymap.set("n", "dt", "Telescope lsp_type_definitions", { buffer = ev.buf, noremap = true, silent = true , desc = "LSP type defs"}) - vim.keymap.set("n", "ds", "Telescope lsp_document_symbols", { buffer = ev.buf, noremap = true, silent = true , desc = "LSP symbols"}) - vim.keymap.set('n', 'dl', vim.lsp.codelens.run, { buffer = ev.buf, noremap = true, silent = true , desc = "LSP codelens"}) - vim.keymap.set('n', 'df', function() - vim.lsp.buf.format { async = true } - end,{ buffer = ev.buf, noremap = true, silent = true , desc = "LSP format"}) - -- Auto-refresh code lenses - if not client then - return - end - local group = vim.api.nvim_create_augroup(string.format('lsp-%s-%s', bufnr, client.id), {}) - if client.server_capabilities.codeLensProvider then - vim.api.nvim_create_autocmd({ 'InsertLeave', 'BufWritePost', 'TextChanged' }, { - group = group, - callback = function() - vim.lsp.codelens.refresh { bufnr = bufnr } - end, - buffer = bufnr, - }) + group = vim.api.nvim_create_augroup('UserLspConfig', {}), + callback = function(ev) + local bufnr = ev.buf + local client = vim.lsp.get_client_by_id(ev.data.client_id) + -- Buffer local mappings. + -- See `:help vim.lsp.*` for documentation on any of the below functions + vim.keymap.set('n', 'K', vim.lsp.buf.hover, { buffer = ev.buf, noremap = true, silent = true, desc = 'LSP hover' }) + vim.keymap.set( + 'n', + 'rn', + vim.lsp.buf.rename, + { buffer = ev.buf, noremap = true, silent = true, desc = 'LSP Rename' } + ) + vim.keymap.set( + { 'n', 'v' }, + 'da', + vim.lsp.buf.code_action, + { buffer = ev.buf, noremap = true, silent = true, desc = 'LSP code action' } + ) + vim.keymap.set( + 'n', + 'dd', + 'Telescope lsp_definitions', + { buffer = ev.buf, noremap = true, silent = true, desc = 'LSP definitions' } + ) + vim.keymap.set( + 'n', + 'di', + 'Telescope lsp_implementations', + { buffer = ev.buf, noremap = true, silent = true, desc = 'LSP implementations' } + ) + vim.keymap.set( + 'n', + 'dr', + 'Telescope lsp_references', + { buffer = ev.buf, noremap = true, silent = true, desc = 'LSP references' } + ) + vim.keymap.set( + 'n', + 'dt', + 'Telescope lsp_type_definitions', + { buffer = ev.buf, noremap = true, silent = true, desc = 'LSP type defs' } + ) + vim.keymap.set( + 'n', + 'ds', + 'Telescope lsp_document_symbols', + { buffer = ev.buf, noremap = true, silent = true, desc = 'LSP symbols' } + ) + vim.keymap.set( + 'n', + 'dl', + vim.lsp.codelens.run, + { buffer = ev.buf, noremap = true, silent = true, desc = 'LSP codelens' } + ) + vim.keymap.set('n', 'df', function() + vim.lsp.buf.format { async = true } + end, { buffer = ev.buf, noremap = true, silent = true, desc = 'LSP format' }) + -- Auto-refresh code lenses + if not client then + return + end + local group = vim.api.nvim_create_augroup(string.format('lsp-%s-%s', bufnr, client.id), {}) + if client.server_capabilities.codeLensProvider then + vim.api.nvim_create_autocmd({ 'InsertLeave', 'BufWritePost', 'TextChanged' }, { + group = group, + callback = function() vim.lsp.codelens.refresh { bufnr = bufnr } - end - end, + end, + buffer = bufnr, + }) + vim.lsp.codelens.refresh { bufnr = bufnr } + end + end, }) - diff --git a/nvim/plugin/luasnip.lua b/nvim/plugin/luasnip.lua index b6840d6..4fc038b 100644 --- a/nvim/plugin/luasnip.lua +++ b/nvim/plugin/luasnip.lua @@ -3,35 +3,35 @@ if vim.g.did_load_luasnip_plugin then end vim.g.did_load_luasnip_plugin = true -local ls = require("luasnip") +local ls = require('luasnip') ls.config.set_config { history = true, - updateevents = "TextChanged, TextChangedI", + updateevents = 'TextChanged, TextChangedI', } -require("luasnip.loaders.from_vscode").lazy_load() +require('luasnip.loaders.from_vscode').lazy_load() -vim.keymap.set({"i", "s"}, "", function() +vim.keymap.set({ 'i', 's' }, '', function() if ls.expand_or_jumpable() then ls.expand_or_jump() - end -end, {silent = true}) + end +end, { silent = true }) -vim.keymap.set({"i", "s"}, "", function() +vim.keymap.set({ 'i', 's' }, '', function() if ls.jumpable(-1) then ls.jump(-1) - end -end, {silent = true}) + end +end, { silent = true }) -vim.keymap.set({"i", "s"}, "", function() - if ls.choice_active() then - ls.change_choice(1) - end -end, {silent = true}) +vim.keymap.set({ 'i', 's' }, '', function() + if ls.choice_active() then + ls.change_choice(1) + end +end, { silent = true }) -------------------- -- Snippets -- -------------------- -local fmta = require("luasnip.extras.fmt").fmta -ls.add_snippets("go", { - ls.snippet("ie", fmta("if err != nil {\n\treturn \n}", { err = ls.insert_node(1, "err") })), +local fmta = require('luasnip.extras.fmt').fmta +ls.add_snippets('go', { + ls.snippet('ie', fmta('if err != nil {\n\treturn \n}', { err = ls.insert_node(1, 'err') })), }) diff --git a/nvim/plugin/mini.lua b/nvim/plugin/mini.lua index 166b99e..e36b970 100644 --- a/nvim/plugin/mini.lua +++ b/nvim/plugin/mini.lua @@ -21,11 +21,9 @@ require('mini.surround').setup() -- :Trim require('mini.trailspace').setup() -vim.api.nvim_create_user_command('Trim', - function() - require("mini.trailspace").trim() - end, {} -) +vim.api.nvim_create_user_command('Trim', function() + require('mini.trailspace').trim() +end, {}) -- prefix \ -- `b` - |'background'|. @@ -39,31 +37,31 @@ vim.api.nvim_create_user_command('Trim', -- `r` - |'relativenumber'|. -- `s` - |'spell'|. -- `w` - |'wrap'|. -require('mini.basics').setup({ - mappings = { - windows = true - } -}) +require('mini.basics').setup { + mappings = { + windows = true, + }, +} -- gS -require('mini.splitjoin').setup({ - detect = { - separator = '[,;\n]' - } -}) +require('mini.splitjoin').setup { + detect = { + separator = '[,;\n]', + }, +} require('mini.pairs').setup() vim.cmd([[ hi MiniCursorwordCurrent ctermfg=240 ]]) -- f F t T require('mini.jump').setup() -require('mini.jump2d').setup({ - mappings = { start_jumping = 's' } -}) +require('mini.jump2d').setup { + mappings = { start_jumping = 's' }, +} indent = require('mini.indentscope') -indent.setup({ - options = { try_as_border = false }, - draw = { delay = 0 } -}) +indent.setup { + options = { try_as_border = false }, + draw = { delay = 0 }, +} indent.gen_animation.none() diff --git a/nvim/plugin/misc.lua b/nvim/plugin/misc.lua index 9c4d310..c567fcc 100644 --- a/nvim/plugin/misc.lua +++ b/nvim/plugin/misc.lua @@ -6,15 +6,15 @@ vim.g.did_load_plugins_plugin = true -- many plugins annoyingly require a call to a 'setup' function to be loaded, -- even with default configs -require("neogen").setup{} -vim.keymap.set("n","nd", "Neogen", {noremap = true, silent = true, desc = "Neogen - gen comments"}) +require('neogen').setup {} +vim.keymap.set('n', 'nd', 'Neogen', { noremap = true, silent = true, desc = 'Neogen - gen comments' }) -require("toggleterm").setup{ - open_mapping = [[]], - direction = "float", - close_on_exit = true, +require('toggleterm').setup { + open_mapping = [[]], + direction = 'float', + close_on_exit = true, } require('which-key').setup { - preset = 'helix' + preset = 'helix', } diff --git a/nvim/plugin/neogit.lua b/nvim/plugin/neogit.lua index 3ef2047..27e8bf2 100644 --- a/nvim/plugin/neogit.lua +++ b/nvim/plugin/neogit.lua @@ -12,4 +12,4 @@ neogit.setup { fzf_lua = true, }, } -vim.keymap.set('n', 'ng', neogit.open, { noremap = true, silent = true, desc = "Neogit"}) +vim.keymap.set('n', 'ng', neogit.open, { noremap = true, silent = true, desc = 'Neogit' }) diff --git a/nvim/plugin/oil.lua b/nvim/plugin/oil.lua index 1b38b6a..1c4a521 100644 --- a/nvim/plugin/oil.lua +++ b/nvim/plugin/oil.lua @@ -4,20 +4,20 @@ end vim.g.did_load_oil_plugin = true local oil = require('oil') -oil.setup({ - watch_for_changes = true, - columns = { - "permissions", - "size" - }, - view_options = { - show_hidden = true - }, - keymaps = { - ["wq"] = "actions.close" - } -}) -vim.keymap.set("n", "c", oil.toggle_float, {noremap = true, silent = true}); -vim.keymap.set("n", "u", "UndotreeToggle") +oil.setup { + watch_for_changes = true, + columns = { + 'permissions', + 'size', + }, + view_options = { + show_hidden = true, + }, + keymaps = { + ['wq'] = 'actions.close', + }, +} +vim.keymap.set('n', 'c', oil.toggle_float, { noremap = true, silent = true }) +vim.keymap.set('n', 'u', 'UndotreeToggle') vim.g.undotree_ShortIndicators = 1 vim.g.undotree_SetFocusWhenToggle = 1 diff --git a/nvim/plugin/statuscol.lua b/nvim/plugin/statuscol.lua index 60125f1..1cc61f1 100644 --- a/nvim/plugin/statuscol.lua +++ b/nvim/plugin/statuscol.lua @@ -2,6 +2,6 @@ if vim.g.did_load_diffview_plugin then return end vim.g.did_load_diffview_plugin = true -require("diffview").setup({ +require('diffview').setup { use_icons = false, -}) +} diff --git a/nvim/plugin/telescope.lua b/nvim/plugin/telescope.lua index ce35f8d..5d332f0 100644 --- a/nvim/plugin/telescope.lua +++ b/nvim/plugin/telescope.lua @@ -3,7 +3,7 @@ if vim.g.did_load_telescope_plugin then end vim.g.did_load_telescope_plugin = true -local telescope = require("telescope.builtin") +local telescope = require('telescope.builtin') -- Fall back to find_files if not in a git repo local project_files = function() @@ -14,49 +14,69 @@ local project_files = function() end end -vim.keymap.set("n", "", telescope.buffers, {noremap = true, silent = true, desc = "Fuzzy find buffers"}) -vim.keymap.set("n", "ff", project_files, {noremap = true, silent = true, desc = "Fuzzy find git files"}) -vim.keymap.set("n", "fg", telescope.find_files, {noremap = true, silent = true, desc = "Fuzzy find files"}) -vim.keymap.set("n", "fc", telescope.command_history, {noremap = true, silent = true, desc = "Fuzzy find command_history"}) -vim.keymap.set("n", "fa", telescope.live_grep, {noremap = true, silent = true, desc = "Fuzzy find grep"}) -vim.keymap.set("n", "f8", telescope.grep_string, {noremap = true, silent = true, desc = "Fuzzy find grep current word"}) -vim.keymap.set("n", "fs", telescope.treesitter, {noremap = true, silent = true, desc = "Fuzzy find treesitter objects"}) -vim.keymap.set("n", "fq", telescope.quickfix, {noremap = true, silent = true, desc = "Fuzzy find quickfix"}) -vim.keymap.set("n", "f", telescope.resume, {noremap = true, silent = true, desc = "Fuzzy find resume"}) +vim.keymap.set( + 'n', + '', + telescope.buffers, + { noremap = true, silent = true, desc = 'Fuzzy find buffers' } +) +vim.keymap.set('n', 'ff', project_files, { noremap = true, silent = true, desc = 'Fuzzy find git files' }) +vim.keymap.set('n', 'fg', telescope.find_files, { noremap = true, silent = true, desc = 'Fuzzy find files' }) +vim.keymap.set( + 'n', + 'fc', + telescope.command_history, + { noremap = true, silent = true, desc = 'Fuzzy find command_history' } +) +vim.keymap.set('n', 'fa', telescope.live_grep, { noremap = true, silent = true, desc = 'Fuzzy find grep' }) +vim.keymap.set( + 'n', + 'f8', + telescope.grep_string, + { noremap = true, silent = true, desc = 'Fuzzy find grep current word' } +) +vim.keymap.set( + 'n', + 'fs', + telescope.treesitter, + { noremap = true, silent = true, desc = 'Fuzzy find treesitter objects' } +) +vim.keymap.set('n', 'fq', telescope.quickfix, { noremap = true, silent = true, desc = 'Fuzzy find quickfix' }) +vim.keymap.set('n', 'f', telescope.resume, { noremap = true, silent = true, desc = 'Fuzzy find resume' }) -local telescope = require("telescope") -telescope.setup({ - defaults = { - layout_strategy = "vertical", - layout_config = { width = .90, }, - prompt_title = false, - results_title = false, - preview_title = false, - vimgrep_arguments = { - "rg", - '-L', - "--color=never", - "--no-heading", - "--hidden", - "--with-filename", - "--line-number", - "--column", - "--smart-case" - }, - preview = { - treesitter = true, - }, - path_display = { - 'truncate', - }, - mappings = { - i = { - ["wq"] = require("telescope.actions").close, - [""] = require("telescope.actions").close, - [""] = require("telescope.actions").move_selection_previous, - [""] = require("telescope.actions").move_selection_next, - }, - }, +local telescope = require('telescope') +telescope.setup { + defaults = { + layout_strategy = 'vertical', + layout_config = { width = 0.90 }, + prompt_title = false, + results_title = false, + preview_title = false, + vimgrep_arguments = { + 'rg', + '-L', + '--color=never', + '--no-heading', + '--hidden', + '--with-filename', + '--line-number', + '--column', + '--smart-case', }, -}) -telescope.load_extension("fzf") + preview = { + treesitter = true, + }, + path_display = { + 'truncate', + }, + mappings = { + i = { + ['wq'] = require('telescope.actions').close, + [''] = require('telescope.actions').close, + [''] = require('telescope.actions').move_selection_previous, + [''] = require('telescope.actions').move_selection_next, + }, + }, + }, +} +telescope.load_extension('fzf') diff --git a/nvim/plugin/treesitter.lua b/nvim/plugin/treesitter.lua index ed6e111..0ac66cd 100644 --- a/nvim/plugin/treesitter.lua +++ b/nvim/plugin/treesitter.lua @@ -3,61 +3,62 @@ if vim.g.did_load_treesitter_plugin then end vim.g.did_load_treesitter_plugin = true -require("nvim-treesitter.configs").setup { - ensure_installed = {}, - highlight = { +require('nvim-treesitter.configs').setup { + ensure_installed = {}, + highlight = { + enable = true, + disable = function(_, buf) + local max_filesize = 100 * 1024 -- 100 KiB + local ok, stats = pcall(vim.loop.fs_stat, vim.api.nvim_buf_get_name(buf)) + if ok and stats and stats.size > max_filesize then + return true + end + end, + }, + indent = { + enable = true, + }, + textobjects = { + select = { enable = true, - disable = function(_, buf) - local max_filesize = 100 * 1024 -- 100 KiB - local ok, stats = pcall(vim.loop.fs_stat, vim.api.nvim_buf_get_name(buf)) - if ok and stats and stats.size > max_filesize then - return true - end - end, + lookahead = true, + keymaps = { + ['af'] = '@function.outer', + ['if'] = '@function.inner', + ['aa'] = '@statement.outer', + ['ia'] = '@parameter.inner', + }, }, - indent = { - enable = true, + move = { + enable = true, + set_jumps = true, -- whether to set jumps in the jumplist + goto_next_start = { + [']]'] = '@function.outer', + [']a'] = '@parameter.inner', + }, + goto_previous_start = { + ['[['] = '@function.outer', + ['[a'] = '@parameter.inner', + }, }, - textobjects = { - select = { - enable = true, - lookahead = true, - keymaps = { - ["af"] = "@function.outer", - ["if"] = "@function.inner", - ["aa"] = "@statement.outer", - ["ia"] = "@parameter.inner", - }, - }, - move = { - enable = true, - set_jumps = true, -- whether to set jumps in the jumplist - goto_next_start = { - [']]'] = '@function.outer', - [']a'] = '@parameter.inner', - }, - goto_previous_start = { - ['[['] = '@function.outer', - ['[a'] = '@parameter.inner', - }, - }, - swap = { - enable = true, - swap_next = { - ["s]"] = "@parameter.inner", - }, - swap_previous = { - ["s["] = "@parameter.inner", - }, - }, }, - incremental_selection = { - enable = true, - keymaps = { - init_selection = '', - node_incremental = '', - node_decremental = '', - }, + swap = { + enable = true, + swap_next = { + ['s]'] = '@parameter.inner', + }, + swap_previous = { + ['s['] = '@parameter.inner', + }, }, + }, + incremental_selection = { + enable = true, + keymaps = { + init_selection = '', + node_incremental = '', + node_decremental = '', + }, + }, } require('treesitter-context').setup { diff --git a/nvim/plugin/which-key.lua b/nvim/plugin/which-key.lua index def52f8..89030a5 100644 --- a/nvim/plugin/which-key.lua +++ b/nvim/plugin/which-key.lua @@ -1,3 +1,3 @@ require('which-key').setup { - preset = 'helix' + preset = 'helix', }