From 87e1645ff32b91f28bee66dfd34ea3eb43575382 Mon Sep 17 00:00:00 2001 From: Yigit Sever Date: Sun, 7 Nov 2021 23:37:50 +0300 Subject: nvim: migrate to gitsigns from gitgutter --- .config/nvim/lua/plugin_settings.lua | 70 +++++++ .config/nvim/lua/plugins.lua | 12 +- .config/nvim/plugin/packer_compiled.lua | 360 -------------------------------- 3 files changed, 79 insertions(+), 363 deletions(-) delete mode 100644 .config/nvim/plugin/packer_compiled.lua (limited to '.config') diff --git a/.config/nvim/lua/plugin_settings.lua b/.config/nvim/lua/plugin_settings.lua index bff9bcb..ddc7371 100644 --- a/.config/nvim/lua/plugin_settings.lua +++ b/.config/nvim/lua/plugin_settings.lua @@ -462,3 +462,73 @@ require'nvim-tree'.setup { -- nvim-colorizer {{{ -- require 'colorizer'.setup() -- }}} nvim-colorizer -- + +-- gitsigns.nvim {{{ -- + +require('gitsigns').setup { + signs = { + add = {hl = 'GitSignsAdd' , text = '│', numhl='GitSignsAddNr' , linehl='GitSignsAddLn'}, + change = {hl = 'GitSignsChange', text = '│', numhl='GitSignsChangeNr', linehl='GitSignsChangeLn'}, + delete = {hl = 'GitSignsDelete', text = '_', numhl='GitSignsDeleteNr', linehl='GitSignsDeleteLn'}, + topdelete = {hl = 'GitSignsDelete', text = '‾', numhl='GitSignsDeleteNr', linehl='GitSignsDeleteLn'}, + changedelete = {hl = 'GitSignsChange', text = '~', numhl='GitSignsChangeNr', linehl='GitSignsChangeLn'}, + + }, + signcolumn = true, -- Toggle with `:Gitsigns toggle_signs` + numhl = false, -- Toggle with `:Gitsigns toggle_numhl` + linehl = false, -- Toggle with `:Gitsigns toggle_linehl` + word_diff = false, -- Toggle with `:Gitsigns toggle_word_diff` + keymaps = { + -- Default keymap options + noremap = true, + + ['n ]c'] = { expr = true, "&diff ? ']c' : 'lua require\"gitsigns.actions\".next_hunk()'"}, + ['n [c'] = { expr = true, "&diff ? '[c' : 'lua require\"gitsigns.actions\".prev_hunk()'"}, + + ['n hs'] = 'lua require"gitsigns".stage_hunk()', + ['v hs'] = 'lua require"gitsigns".stage_hunk({vim.fn.line("."), vim.fn.line("v")})', + ['n hu'] = 'lua require"gitsigns".undo_stage_hunk()', + ['n hr'] = 'lua require"gitsigns".reset_hunk()', + ['v hr'] = 'lua require"gitsigns".reset_hunk({vim.fn.line("."), vim.fn.line("v")})', + ['n hR'] = 'lua require"gitsigns".reset_buffer()', + ['n hp'] = 'lua require"gitsigns".preview_hunk()', + ['n hb'] = 'lua require"gitsigns".blame_line(true)', + ['n hS'] = 'lua require"gitsigns".stage_buffer()', + ['n hU'] = 'lua require"gitsigns".reset_buffer_index()', + + -- Text objects + ['o ih'] = ':lua require"gitsigns.actions".select_hunk()', + ['x ih'] = ':lua require"gitsigns.actions".select_hunk()' + }, + watch_gitdir = { + interval = 1000, + follow_files = true + }, + attach_to_untracked = true, + current_line_blame = false, -- Toggle with `:Gitsigns toggle_current_line_blame` + current_line_blame_opts = { + virt_text = true, + virt_text_pos = 'eol', -- 'eol' | 'overlay' | 'right_align' + delay = 1000, + }, + current_line_blame_formatter_opts = { + relative_time = false + }, + sign_priority = 6, + update_debounce = 100, + status_formatter = nil, -- Use default + max_file_length = 40000, + preview_config = { + -- Options passed to nvim_open_win + border = 'single', + style = 'minimal', + relative = 'cursor', + row = 0, + col = 1 + }, + yadm = { + enable = true + }, +} + +-- }}} gitsigns.nvim -- diff --git a/.config/nvim/lua/plugins.lua b/.config/nvim/lua/plugins.lua index 6d982de..b3a87b2 100644 --- a/.config/nvim/lua/plugins.lua +++ b/.config/nvim/lua/plugins.lua @@ -31,10 +31,18 @@ return require('packer').startup(function() -- find, filter, preview, pick use { 'nvim-telescope/telescope.nvim', - requires = { {'nvim-lua/plenary.nvim'} } + requires = { 'nvim-lua/plenary.nvim' } } use {'nvim-telescope/telescope-fzf-native.nvim', run = 'make' } + -- git integration for buffers + use { + 'lewis6991/gitsigns.nvim', + requires = { + 'nvim-lua/plenary.nvim' + }, + } + -- manages tag files use 'ludovicchabant/vim-gutentags' -- run tests (todo: write tests) @@ -45,8 +53,6 @@ return require('packer').startup(function() use {'SirVer/ultisnips', 'honza/vim-snippets'} -- autopairs for neovim use 'windwp/nvim-autopairs' - -- git diff in the sign column - use 'airblade/vim-gitgutter' -- completion preview of floating window use 'ncm2/float-preview.nvim' -- indent guides diff --git a/.config/nvim/plugin/packer_compiled.lua b/.config/nvim/plugin/packer_compiled.lua deleted file mode 100644 index 04db45e..0000000 --- a/.config/nvim/plugin/packer_compiled.lua +++ /dev/null @@ -1,360 +0,0 @@ --- Automatically generated packer.nvim plugin loader code - -if vim.api.nvim_call_function('has', {'nvim-0.5'}) ~= 1 then - vim.api.nvim_command('echohl WarningMsg | echom "Invalid Neovim version for packer.nvim! | echohl None"') - return -end - -vim.api.nvim_command('packadd packer.nvim') - -local no_errors, error_msg = pcall(function() - - local time - local profile_info - local should_profile = false - if should_profile then - local hrtime = vim.loop.hrtime - profile_info = {} - time = function(chunk, start) - if start then - profile_info[chunk] = hrtime() - else - profile_info[chunk] = (hrtime() - profile_info[chunk]) / 1e6 - end - end - else - time = function(chunk, start) end - end - -local function save_profiles(threshold) - local sorted_times = {} - for chunk_name, time_taken in pairs(profile_info) do - sorted_times[#sorted_times + 1] = {chunk_name, time_taken} - end - table.sort(sorted_times, function(a, b) return a[2] > b[2] end) - local results = {} - for i, elem in ipairs(sorted_times) do - if not threshold or threshold and elem[2] > threshold then - results[i] = elem[1] .. ' took ' .. elem[2] .. 'ms' - end - end - - _G._packer = _G._packer or {} - _G._packer.profile_output = results -end - -time([[Luarocks path setup]], true) -local package_path_str = "/home/yigit/.cache/nvim/packer_hererocks/2.0.5/share/lua/5.1/?.lua;/home/yigit/.cache/nvim/packer_hererocks/2.0.5/share/lua/5.1/?/init.lua;/home/yigit/.cache/nvim/packer_hererocks/2.0.5/lib/luarocks/rocks-5.1/?.lua;/home/yigit/.cache/nvim/packer_hererocks/2.0.5/lib/luarocks/rocks-5.1/?/init.lua" -local install_cpath_pattern = "/home/yigit/.cache/nvim/packer_hererocks/2.0.5/lib/lua/5.1/?.so" -if not string.find(package.path, package_path_str, 1, true) then - package.path = package.path .. ';' .. package_path_str -end - -if not string.find(package.cpath, install_cpath_pattern, 1, true) then - package.cpath = package.cpath .. ';' .. install_cpath_pattern -end - -time([[Luarocks path setup]], false) -time([[try_loadstring definition]], true) -local function try_loadstring(s, component, name) - local success, result = pcall(loadstring(s)) - if not success then - vim.schedule(function() - vim.api.nvim_notify('packer.nvim: Error running ' .. component .. ' for ' .. name .. ': ' .. result, vim.log.levels.ERROR, {}) - end) - end - return result -end - -time([[try_loadstring definition]], false) -time([[Defining packer_plugins]], true) -_G.packer_plugins = { - ["beacon.nvim"] = { - loaded = true, - path = "/home/yigit/.local/share/nvim/site/pack/packer/start/beacon.nvim" - }, - ["cmp-buffer"] = { - loaded = true, - path = "/home/yigit/.local/share/nvim/site/pack/packer/start/cmp-buffer" - }, - ["cmp-nvim-lsp"] = { - loaded = true, - path = "/home/yigit/.local/share/nvim/site/pack/packer/start/cmp-nvim-lsp" - }, - ["cmp-nvim-ultisnips"] = { - loaded = true, - path = "/home/yigit/.local/share/nvim/site/pack/packer/start/cmp-nvim-ultisnips" - }, - ["dashboard-nvim"] = { - loaded = true, - path = "/home/yigit/.local/share/nvim/site/pack/packer/start/dashboard-nvim" - }, - ["filetype.nvim"] = { - loaded = true, - path = "/home/yigit/.local/share/nvim/site/pack/packer/start/filetype.nvim" - }, - ["float-preview.nvim"] = { - loaded = true, - path = "/home/yigit/.local/share/nvim/site/pack/packer/start/float-preview.nvim" - }, - ["goyo.vim"] = { - loaded = true, - path = "/home/yigit/.local/share/nvim/site/pack/packer/start/goyo.vim" - }, - ["i3config.vim"] = { - loaded = true, - path = "/home/yigit/.local/share/nvim/site/pack/packer/start/i3config.vim" - }, - ["indent-blankline.nvim"] = { - loaded = true, - path = "/home/yigit/.local/share/nvim/site/pack/packer/start/indent-blankline.nvim" - }, - ["limelight.vim"] = { - loaded = true, - path = "/home/yigit/.local/share/nvim/site/pack/packer/start/limelight.vim" - }, - ["lualine.nvim"] = { - loaded = true, - path = "/home/yigit/.local/share/nvim/site/pack/packer/start/lualine.nvim" - }, - neovim = { - loaded = true, - path = "/home/yigit/.local/share/nvim/site/pack/packer/start/neovim" - }, - ["nvim-autopairs"] = { - loaded = true, - path = "/home/yigit/.local/share/nvim/site/pack/packer/start/nvim-autopairs" - }, - ["nvim-cmp"] = { - loaded = true, - path = "/home/yigit/.local/share/nvim/site/pack/packer/start/nvim-cmp" - }, - ["nvim-colorizer.lua"] = { - loaded = true, - path = "/home/yigit/.local/share/nvim/site/pack/packer/start/nvim-colorizer.lua" - }, - ["nvim-lspconfig"] = { - loaded = true, - path = "/home/yigit/.local/share/nvim/site/pack/packer/start/nvim-lspconfig" - }, - ["nvim-tree.lua"] = { - loaded = true, - path = "/home/yigit/.local/share/nvim/site/pack/packer/start/nvim-tree.lua" - }, - ["nvim-treesitter"] = { - loaded = true, - path = "/home/yigit/.local/share/nvim/site/pack/packer/start/nvim-treesitter" - }, - ["nvim-web-devicons"] = { - loaded = true, - path = "/home/yigit/.local/share/nvim/site/pack/packer/start/nvim-web-devicons" - }, - ["packer.nvim"] = { - loaded = true, - path = "/home/yigit/.local/share/nvim/site/pack/packer/start/packer.nvim" - }, - ["plenary.nvim"] = { - loaded = true, - path = "/home/yigit/.local/share/nvim/site/pack/packer/start/plenary.nvim" - }, - tabular = { - loaded = true, - path = "/home/yigit/.local/share/nvim/site/pack/packer/start/tabular" - }, - ["targets.vim"] = { - loaded = true, - path = "/home/yigit/.local/share/nvim/site/pack/packer/start/targets.vim" - }, - ["telescope-fzf-native.nvim"] = { - loaded = true, - path = "/home/yigit/.local/share/nvim/site/pack/packer/start/telescope-fzf-native.nvim" - }, - ["telescope.nvim"] = { - loaded = true, - path = "/home/yigit/.local/share/nvim/site/pack/packer/start/telescope.nvim" - }, - ["traces.vim"] = { - loaded = true, - path = "/home/yigit/.local/share/nvim/site/pack/packer/start/traces.vim" - }, - ["turkish-deasciifier.vim"] = { - loaded = true, - path = "/home/yigit/.local/share/nvim/site/pack/packer/start/turkish-deasciifier.vim" - }, - ultisnips = { - loaded = true, - path = "/home/yigit/.local/share/nvim/site/pack/packer/start/ultisnips" - }, - undotree = { - commands = { "UndotreeToggle" }, - config = { "vim.g.undotree_SetFocusWhenToggle = 1" }, - loaded = false, - needs_bufread = false, - only_cond = false, - path = "/home/yigit/.local/share/nvim/site/pack/packer/opt/undotree" - }, - ["vim-characterize"] = { - loaded = true, - path = "/home/yigit/.local/share/nvim/site/pack/packer/start/vim-characterize" - }, - ["vim-commentary"] = { - loaded = true, - path = "/home/yigit/.local/share/nvim/site/pack/packer/start/vim-commentary" - }, - ["vim-cutlass"] = { - loaded = true, - path = "/home/yigit/.local/share/nvim/site/pack/packer/start/vim-cutlass" - }, - ["vim-dispatch"] = { - commands = { "Dispatch", "Make", "Focus", "Start" }, - loaded = false, - needs_bufread = false, - only_cond = false, - path = "/home/yigit/.local/share/nvim/site/pack/packer/opt/vim-dispatch" - }, - ["vim-fugitive"] = { - commands = { "Git", "Gstatus", "Gblame", "Gpush", "Gpull" }, - loaded = false, - needs_bufread = true, - only_cond = false, - path = "/home/yigit/.local/share/nvim/site/pack/packer/opt/vim-fugitive" - }, - ["vim-gitgutter"] = { - loaded = true, - path = "/home/yigit/.local/share/nvim/site/pack/packer/start/vim-gitgutter" - }, - ["vim-gutentags"] = { - loaded = true, - path = "/home/yigit/.local/share/nvim/site/pack/packer/start/vim-gutentags" - }, - ["vim-indent-object"] = { - loaded = true, - path = "/home/yigit/.local/share/nvim/site/pack/packer/start/vim-indent-object" - }, - ["vim-interestingwords"] = { - loaded = true, - path = "/home/yigit/.local/share/nvim/site/pack/packer/start/vim-interestingwords" - }, - ["vim-kitty"] = { - loaded = true, - path = "/home/yigit/.local/share/nvim/site/pack/packer/start/vim-kitty" - }, - ["vim-lastplace"] = { - loaded = true, - path = "/home/yigit/.local/share/nvim/site/pack/packer/start/vim-lastplace" - }, - ["vim-ledger"] = { - loaded = true, - path = "/home/yigit/.local/share/nvim/site/pack/packer/start/vim-ledger" - }, - ["vim-move"] = { - loaded = true, - path = "/home/yigit/.local/share/nvim/site/pack/packer/start/vim-move" - }, - ["vim-peekaboo"] = { - loaded = true, - path = "/home/yigit/.local/share/nvim/site/pack/packer/start/vim-peekaboo" - }, - ["vim-repeat"] = { - loaded = true, - path = "/home/yigit/.local/share/nvim/site/pack/packer/start/vim-repeat" - }, - ["vim-sandwich"] = { - loaded = true, - path = "/home/yigit/.local/share/nvim/site/pack/packer/start/vim-sandwich" - }, - ["vim-slime"] = { - loaded = true, - path = "/home/yigit/.local/share/nvim/site/pack/packer/start/vim-slime" - }, - ["vim-sneak"] = { - loaded = true, - path = "/home/yigit/.local/share/nvim/site/pack/packer/start/vim-sneak" - }, - ["vim-snippets"] = { - loaded = true, - path = "/home/yigit/.local/share/nvim/site/pack/packer/start/vim-snippets" - }, - ["vim-speeddating"] = { - loaded = true, - path = "/home/yigit/.local/share/nvim/site/pack/packer/start/vim-speeddating" - }, - ["vim-subversive"] = { - loaded = true, - path = "/home/yigit/.local/share/nvim/site/pack/packer/start/vim-subversive" - }, - ["vim-swap"] = { - loaded = true, - path = "/home/yigit/.local/share/nvim/site/pack/packer/start/vim-swap" - }, - ["vim-test"] = { - loaded = true, - path = "/home/yigit/.local/share/nvim/site/pack/packer/start/vim-test" - }, - ["vim-unimpaired"] = { - loaded = true, - path = "/home/yigit/.local/share/nvim/site/pack/packer/start/vim-unimpaired" - }, - ["vim-yoink"] = { - loaded = true, - path = "/home/yigit/.local/share/nvim/site/pack/packer/start/vim-yoink" - }, - vimtex = { - loaded = false, - needs_bufread = true, - only_cond = false, - path = "/home/yigit/.local/share/nvim/site/pack/packer/opt/vimtex" - }, - vimwiki = { - loaded = true, - path = "/home/yigit/.local/share/nvim/site/pack/packer/start/vimwiki" - }, - ["vista.vim"] = { - loaded = true, - path = "/home/yigit/.local/share/nvim/site/pack/packer/start/vista.vim" - } -} - -time([[Defining packer_plugins]], false) - --- Command lazy-loads -time([[Defining lazy-load commands]], true) -pcall(vim.cmd, [[command -nargs=* -range -bang -complete=file Make lua require("packer.load")({'vim-dispatch'}, { cmd = "Make", l1 = , l2 = , bang = , args = , mods = "" }, _G.packer_plugins)]]) -pcall(vim.cmd, [[command -nargs=* -range -bang -complete=file Gblame lua require("packer.load")({'vim-fugitive'}, { cmd = "Gblame", l1 = , l2 = , bang = , args = , mods = "" }, _G.packer_plugins)]]) -pcall(vim.cmd, [[command -nargs=* -range -bang -complete=file Gstatus lua require("packer.load")({'vim-fugitive'}, { cmd = "Gstatus", l1 = , l2 = , bang = , args = , mods = "" }, _G.packer_plugins)]]) -pcall(vim.cmd, [[command -nargs=* -range -bang -complete=file UndotreeToggle lua require("packer.load")({'undotree'}, { cmd = "UndotreeToggle", l1 = , l2 = , bang = , args = , mods = "" }, _G.packer_plugins)]]) -pcall(vim.cmd, [[command -nargs=* -range -bang -complete=file Focus lua require("packer.load")({'vim-dispatch'}, { cmd = "Focus", l1 = , l2 = , bang = , args = , mods = "" }, _G.packer_plugins)]]) -pcall(vim.cmd, [[command -nargs=* -range -bang -complete=file Gpull lua require("packer.load")({'vim-fugitive'}, { cmd = "Gpull", l1 = , l2 = , bang = , args = , mods = "" }, _G.packer_plugins)]]) -pcall(vim.cmd, [[command -nargs=* -range -bang -complete=file Gpush lua require("packer.load")({'vim-fugitive'}, { cmd = "Gpush", l1 = , l2 = , bang = , args = , mods = "" }, _G.packer_plugins)]]) -pcall(vim.cmd, [[command -nargs=* -range -bang -complete=file Git lua require("packer.load")({'vim-fugitive'}, { cmd = "Git", l1 = , l2 = , bang = , args = , mods = "" }, _G.packer_plugins)]]) -pcall(vim.cmd, [[command -nargs=* -range -bang -complete=file Dispatch lua require("packer.load")({'vim-dispatch'}, { cmd = "Dispatch", l1 = , l2 = , bang = , args = , mods = "" }, _G.packer_plugins)]]) -pcall(vim.cmd, [[command -nargs=* -range -bang -complete=file Start lua require("packer.load")({'vim-dispatch'}, { cmd = "Start", l1 = , l2 = , bang = , args = , mods = "" }, _G.packer_plugins)]]) -time([[Defining lazy-load commands]], false) - -vim.cmd [[augroup packer_load_aucmds]] -vim.cmd [[au!]] - -- Filetype lazy-loads -time([[Defining lazy-load filetype autocommands]], true) -vim.cmd [[au FileType plaintext ++once lua require("packer.load")({'vimtex'}, { ft = "plaintext" }, _G.packer_plugins)]] -vim.cmd [[au FileType latex ++once lua require("packer.load")({'vimtex'}, { ft = "latex" }, _G.packer_plugins)]] -vim.cmd [[au FileType tex ++once lua require("packer.load")({'vimtex'}, { ft = "tex" }, _G.packer_plugins)]] -time([[Defining lazy-load filetype autocommands]], false) -vim.cmd("augroup END") -vim.cmd [[augroup filetypedetect]] -time([[Sourcing ftdetect script at: /home/yigit/.local/share/nvim/site/pack/packer/opt/vimtex/ftdetect/cls.vim]], true) -vim.cmd [[source /home/yigit/.local/share/nvim/site/pack/packer/opt/vimtex/ftdetect/cls.vim]] -time([[Sourcing ftdetect script at: /home/yigit/.local/share/nvim/site/pack/packer/opt/vimtex/ftdetect/cls.vim]], false) -time([[Sourcing ftdetect script at: /home/yigit/.local/share/nvim/site/pack/packer/opt/vimtex/ftdetect/tex.vim]], true) -vim.cmd [[source /home/yigit/.local/share/nvim/site/pack/packer/opt/vimtex/ftdetect/tex.vim]] -time([[Sourcing ftdetect script at: /home/yigit/.local/share/nvim/site/pack/packer/opt/vimtex/ftdetect/tex.vim]], false) -time([[Sourcing ftdetect script at: /home/yigit/.local/share/nvim/site/pack/packer/opt/vimtex/ftdetect/tikz.vim]], true) -vim.cmd [[source /home/yigit/.local/share/nvim/site/pack/packer/opt/vimtex/ftdetect/tikz.vim]] -time([[Sourcing ftdetect script at: /home/yigit/.local/share/nvim/site/pack/packer/opt/vimtex/ftdetect/tikz.vim]], false) -vim.cmd("augroup END") -if should_profile then save_profiles() end - -end) - -if not no_errors then - vim.api.nvim_command('echohl ErrorMsg | echom "Error in packer_compiled: '..error_msg..'" | echom "Please check your config for correctness" | echohl None') -end -- cgit v1.2.3-61-g4310