diff --git a/lua/custom/plugins/conflictmarker.lua b/lua/custom/plugins/conflictmarker.lua index 896a921..d2c68fe 100644 --- a/lua/custom/plugins/conflictmarker.lua +++ b/lua/custom/plugins/conflictmarker.lua @@ -7,38 +7,40 @@ vim.g.conflict_marker_end = '^>>>>>>> .*$' -- Git conflict marker management plugin return { - 'rhysd/conflict-marker.vim', - config = function() - -- Highlight groups - vim.cmd 'highlight ConflictMarkerBegin guibg=#2f7366' - vim.cmd 'highlight ConflictMarkerOurs guibg=#2e5049' - vim.cmd 'highlight ConflictMarkerTheirs guibg=#344f69' - vim.cmd 'highlight ConflictMarkerEnd guibg=#2f628e' - vim.cmd 'highlight ConflictMarkerCommonAncestorsHunk guibg=#754a81' + { + 'rhysd/conflict-marker.vim', + config = function() + -- Highlight groups + vim.cmd 'highlight ConflictMarkerBegin guibg=#2f7366' + vim.cmd 'highlight ConflictMarkerOurs guibg=#2e5049' + vim.cmd 'highlight ConflictMarkerTheirs guibg=#344f69' + vim.cmd 'highlight ConflictMarkerEnd guibg=#2f628e' + vim.cmd 'highlight ConflictMarkerCommonAncestorsHunk guibg=#754a81' - -- Read all lines in buffer, check if there is any conflict marker - function git_conflict_detection() - local lines = vim.api.nvim_buf_get_lines(0, 0, -1, false) - -- Check if strict regex is contained in any line - local beginning = vim.fn.match(lines, vim.g.conflict_marker_begin) - local ending = vim.fn.match(lines, vim.g.conflict_marker_end) - local enabled = vim.diagnostic.is_enabled() - if (beginning > -1 or ending > -1) and enabled then - vim.diagnostic.enable(false) - elseif not enabled then - vim.diagnostic.enable(true) + -- Read all lines in buffer, check if there is any conflict marker + function git_conflict_detection() + local lines = vim.api.nvim_buf_get_lines(0, 0, -1, false) + -- Check if strict regex is contained in any line + local beginning = vim.fn.match(lines, vim.g.conflict_marker_begin) + local ending = vim.fn.match(lines, vim.g.conflict_marker_end) + local enabled = vim.diagnostic.is_enabled() + if (beginning > -1 or ending > -1) and enabled then + vim.diagnostic.enable(false) + elseif not enabled then + vim.diagnostic.enable(true) + end end - end - -- Autocommand to disable diagnostics on buffer enter - vim.api.nvim_create_autocmd('BufRead', { - group = vim.api.nvim_create_augroup('git-conflict-lsp-disable', { clear = true }), - callback = git_conflict_detection, - }) - -- Autocommand to disable diagnostics on save - vim.api.nvim_create_autocmd('BufWritePre', { - group = vim.api.nvim_create_augroup('git-conflict-lsp-disable', { clear = false }), - callback = git_conflict_detection, - }) - end, + -- Autocommand to disable diagnostics on buffer enter + vim.api.nvim_create_autocmd('BufRead', { + group = vim.api.nvim_create_augroup('git-conflict-lsp-disable', { clear = true }), + callback = git_conflict_detection, + }) + -- Autocommand to disable diagnostics on save + vim.api.nvim_create_autocmd('BufWritePre', { + group = vim.api.nvim_create_augroup('git-conflict-lsp-disable', { clear = false }), + callback = git_conflict_detection, + }) + end, + }, } diff --git a/lua/custom/plugins/fugitive.lua b/lua/custom/plugins/fugitive.lua index c6f71a0..65121d3 100644 --- a/lua/custom/plugins/fugitive.lua +++ b/lua/custom/plugins/fugitive.lua @@ -1,24 +1,26 @@ return { - -- Git related plugins - 'tpope/vim-fugitive', - dependencies = { - { - 'rbong/vim-flog', - lazy = true, - cmd = { 'Flogsplit' }, + { + -- Git related plugins + 'tpope/vim-fugitive', + dependencies = { + { + 'rbong/vim-flog', + lazy = true, + cmd = { 'Flogsplit' }, + }, + 'idanarye/vim-merginal', }, - 'idanarye/vim-merginal', + config = function() + -- Switch in fugitive.vim status window with the current one + vim.keymap.set('n', 'gs', 'Gedit :', { desc = '[G]it [S]tatus' }) + -- Fetch all changes + vim.keymap.set('n', 'gF', 'Git fetch', { desc = '[G]it [F]etch' }) + -- Push changes + vim.keymap.set('n', 'gP', 'Git push', { desc = '[G]it [P]ush' }) + -- Pull changes + vim.keymap.set('n', 'gp', 'Git pull', { desc = '[G]it [P]ull' }) + -- Open history graph + vim.keymap.set('n', 'gl', 'Flogsplitwincmd kq', { desc = '[G]it [L]og' }) + end, }, - config = function() - -- Switch in fugitive.vim status window with the current one - vim.keymap.set('n', 'gs', 'Gedit :', { desc = '[G]it [S]tatus' }) - -- Fetch all changes - vim.keymap.set('n', 'gF', 'Git fetch', { desc = '[G]it [F]etch' }) - -- Push changes - vim.keymap.set('n', 'gP', 'Git push', { desc = '[G]it [P]ush' }) - -- Pull changes - vim.keymap.set('n', 'gp', 'Git pull', { desc = '[G]it [P]ull' }) - -- Open history graph - vim.keymap.set('n', 'gl', 'Flogsplitwincmd kq', { desc = '[G]it [L]og' }) - end, } diff --git a/lua/custom/plugins/lastplace.lua b/lua/custom/plugins/lastplace.lua index 0859311..61e50c4 100644 --- a/lua/custom/plugins/lastplace.lua +++ b/lua/custom/plugins/lastplace.lua @@ -1,4 +1,6 @@ -- Plugin to intelligently reopen files at last edit position return { - 'farmergreg/vim-lastplace', + { + 'farmergreg/vim-lastplace', + }, } diff --git a/lua/custom/plugins/lualine.lua b/lua/custom/plugins/lualine.lua index 59c98e6..070430a 100644 --- a/lua/custom/plugins/lualine.lua +++ b/lua/custom/plugins/lualine.lua @@ -1,13 +1,15 @@ return { - -- Set lualine as statusline - 'nvim-lualine/lualine.nvim', - -- See `:help lualine.txt` - opts = { - options = { - icons_enabled = vim.g.have_nerd_font, - theme = 'catppuccin', - section_separators = { left = '', right = '' }, - component_separators = { left = '', right = '' }, + { + -- Set lualine as statusline + 'nvim-lualine/lualine.nvim', + -- See `:help lualine.txt` + opts = { + options = { + icons_enabled = vim.g.have_nerd_font, + theme = 'catppuccin', + section_separators = { left = '', right = '' }, + component_separators = { left = '', right = '' }, + }, }, }, } diff --git a/lua/custom/plugins/markdown.lua b/lua/custom/plugins/markdown.lua index 53baa36..79e6d9c 100644 --- a/lua/custom/plugins/markdown.lua +++ b/lua/custom/plugins/markdown.lua @@ -1,10 +1,12 @@ -- Markdown preview plugin return { - 'iamcco/markdown-preview.nvim', - cmd = { 'MarkdownPreviewToggle', 'MarkdownPreview', 'MarkdownPreviewStop' }, - build = 'cd app; npm install', - init = function() - vim.g.mkdp_filetypes = { 'markdown' } - end, - ft = { 'markdown' }, + { + 'iamcco/markdown-preview.nvim', + cmd = { 'MarkdownPreviewToggle', 'MarkdownPreview', 'MarkdownPreviewStop' }, + build = 'cd app; npm install', + init = function() + vim.g.mkdp_filetypes = { 'markdown' } + end, + ft = { 'markdown' }, + }, } diff --git a/lua/custom/plugins/neoscroll.lua b/lua/custom/plugins/neoscroll.lua index 61b9ac7..5dfa325 100644 --- a/lua/custom/plugins/neoscroll.lua +++ b/lua/custom/plugins/neoscroll.lua @@ -1,28 +1,30 @@ -- Smooth scroll plugin and keymaps return { - 'karb94/neoscroll.nvim', - enabled = not vim.g.neovide, - config = function() - require('neoscroll').setup { - hide_cursor = false, - easing_function = nil, - respect_scrolloff = true, - } + { + 'karb94/neoscroll.nvim', + enabled = not vim.g.neovide, + config = function() + require('neoscroll').setup { + hide_cursor = false, + easing_function = nil, + respect_scrolloff = true, + } - require('neoscroll.config').set_mappings { - -- Scroll normally - [''] = { 'scroll', { '-vim.wo.scroll', 'true', '50' } }, - [''] = { 'scroll', { 'vim.wo.scroll', 'true', '50' } }, - -- Scroll entire page height - [''] = { 'scroll', { '-vim.api.nvim_win_get_height(0)', 'true', '80' } }, - [''] = { 'scroll', { 'vim.api.nvim_win_get_height(0)', 'true', '80' } }, - -- Scroll 10% at a time - [''] = { 'scroll', { '-0.10', 'false', '25' } }, - [''] = { 'scroll', { '0.10', 'false', '25' } }, - -- Jump to top, bottom and center - ['zt'] = { 'zt', { '40' } }, - ['zz'] = { 'zz', { '50' } }, - ['zb'] = { 'zb', { '40' } }, - } - end, + require('neoscroll.config').set_mappings { + -- Scroll normally + [''] = { 'scroll', { '-vim.wo.scroll', 'true', '50' } }, + [''] = { 'scroll', { 'vim.wo.scroll', 'true', '50' } }, + -- Scroll entire page height + [''] = { 'scroll', { '-vim.api.nvim_win_get_height(0)', 'true', '80' } }, + [''] = { 'scroll', { 'vim.api.nvim_win_get_height(0)', 'true', '80' } }, + -- Scroll 10% at a time + [''] = { 'scroll', { '-0.10', 'false', '25' } }, + [''] = { 'scroll', { '0.10', 'false', '25' } }, + -- Jump to top, bottom and center + ['zt'] = { 'zt', { '40' } }, + ['zz'] = { 'zz', { '50' } }, + ['zb'] = { 'zb', { '40' } }, + } + end, + }, } diff --git a/lua/custom/plugins/oil.lua b/lua/custom/plugins/oil.lua index 4704761..01c9cdf 100644 --- a/lua/custom/plugins/oil.lua +++ b/lua/custom/plugins/oil.lua @@ -9,23 +9,25 @@ vim.api.nvim_create_autocmd('BufLeave', { }) return { - 'stevearc/oil.nvim', - -- Optional dependencies - dependencies = { 'nvim-tree/nvim-web-devicons' }, - config = function() - local oil = require 'oil' - oil.setup { - view_options = { - show_hidden = true, - }, - } + { + 'stevearc/oil.nvim', + -- Optional dependencies + dependencies = { 'nvim-tree/nvim-web-devicons' }, + config = function() + local oil = require 'oil' + oil.setup { + view_options = { + show_hidden = true, + }, + } - vim.keymap.set('n', 'fe', function() - if vim.bo.filetype == 'oil' then - oil.close() - else - oil.open() - end - end, { desc = '[F]ile [E]xplorer' }) - end, + vim.keymap.set('n', 'fe', function() + if vim.bo.filetype == 'oil' then + oil.close() + else + oil.open() + end + end, { desc = '[F]ile [E]xplorer' }) + end, + }, } diff --git a/lua/custom/plugins/overseer.lua b/lua/custom/plugins/overseer.lua index 51946f0..380929a 100644 --- a/lua/custom/plugins/overseer.lua +++ b/lua/custom/plugins/overseer.lua @@ -1,47 +1,49 @@ return { - -- Simple task runner plugin - 'stevearc/overseer.nvim', - opts = {}, - config = function() - local overseer = require 'overseer' - overseer.setup { - templates = { - 'builtin', - 'golang.run_project', - 'golang.run_file', - }, - task_list = { - bindings = { - [''] = false, - [''] = false, - [''] = false, - [''] = false, - ['q'] = false, + { + -- Simple task runner plugin + 'stevearc/overseer.nvim', + opts = {}, + config = function() + local overseer = require 'overseer' + overseer.setup { + templates = { + 'builtin', + 'golang.run_project', + 'golang.run_file', }, - }, - } + task_list = { + bindings = { + [''] = false, + [''] = false, + [''] = false, + [''] = false, + ['q'] = false, + }, + }, + } - -- Reference: overseer.nvim/lua/overseer/window.lua - local function is_open() - for _, winid in ipairs(vim.api.nvim_tabpage_list_wins(0)) do - local bufnr = vim.api.nvim_win_get_buf(winid) - if vim.bo[bufnr].filetype == 'OverseerList' then - return true + -- Reference: overseer.nvim/lua/overseer/window.lua + local function is_open() + for _, winid in ipairs(vim.api.nvim_tabpage_list_wins(0)) do + local bufnr = vim.api.nvim_win_get_buf(winid) + if vim.bo[bufnr].filetype == 'OverseerList' then + return true + end end + return false end - return false - end - -- Display status info about tasks - vim.keymap.set('n', 'ol', function() - overseer.toggle { winid = 0 } - if is_open() then - vim.cmd.winc '_' - else - vim.api.nvim_buf_delete(vim.api.nvim_get_current_buf(), {}) - end - end, { desc = '[O]verseer [L]og' }) - -- Run task by listing all in floating - vim.keymap.set('n', 'or', 'OverseerRun', { desc = '[O]verseer [R]un' }) - end, + -- Display status info about tasks + vim.keymap.set('n', 'ol', function() + overseer.toggle { winid = 0 } + if is_open() then + vim.cmd.winc '_' + else + vim.api.nvim_buf_delete(vim.api.nvim_get_current_buf(), {}) + end + end, { desc = '[O]verseer [L]og' }) + -- Run task by listing all in floating + vim.keymap.set('n', 'or', 'OverseerRun', { desc = '[O]verseer [R]un' }) + end, + }, }