1
0
mirror of https://github.com/jdhao/nvim-config.git synced 2025-06-08 14:14:33 +02:00

Compare commits

..

4 Commits

Author SHA1 Message Date
jdhao
3bb8b224e7
Merge pull request #98 from jdhao/clean-plug
remove unused plugins
2022-09-08 20:36:19 +08:00
jdhao
b69320b4e2 remove unused plugins 2022-09-08 20:35:34 +08:00
jdhao
5c63ade4a0
Merge pull request #97 from jdhao/gitsigns
use gitsigns instead of signify
2022-09-08 20:33:06 +08:00
jdhao
b504c932e6 use gitsigns instead of signify 2022-09-08 20:31:33 +08:00
2 changed files with 113 additions and 98 deletions

44
lua/config/gitsigns.lua Normal file
View File

@ -0,0 +1,44 @@
local gs = require "gitsigns"
gs.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" },
},
word_diff = true, -- Toggle with `:Gitsigns toggle_word_diff`
on_attach = function(bufnr)
local function map(mode, l, r, opts)
opts = opts or {}
opts.buffer = bufnr
vim.keymap.set(mode, l, r, opts)
end
-- Navigation
map("n", "]c", function()
if vim.wo.diff then
return "]c"
end
vim.schedule(function()
gs.next_hunk()
end)
return "<Ignore>"
end, { expr = true, desc = 'next hunk' })
map("n", "[c", function()
if vim.wo.diff then
return "[c"
end
vim.schedule(function()
gs.prev_hunk()
end)
return "<Ignore>"
end, { expr = true, desc = 'previous hunk' })
-- Actions
map("n", "<leader>hp", gs.preview_hunk)
map("n", "<leader>hb", function() gs.blame_line { full = true } end)
end,
}

View File

@ -41,12 +41,9 @@ packer.startup({
-- nvim-cmp completion sources
use { "hrsh7th/cmp-nvim-lsp", after = "nvim-cmp" }
-- use {"hrsh7th/cmp-nvim-lua", after = "nvim-cmp"}
use { "hrsh7th/cmp-path", after = "nvim-cmp" }
use { "hrsh7th/cmp-buffer", after = "nvim-cmp" }
use { "hrsh7th/cmp-omni", after = "nvim-cmp" }
-- use {"hrsh7th/cmp-cmdline", after = "nvim-cmp"}
use { "quangnguyen30192/cmp-nvim-ultisnips", after = { 'nvim-cmp', 'ultisnips' } }
if vim.g.is_mac then
use { "hrsh7th/cmp-emoji", after = 'nvim-cmp' }
@ -56,7 +53,8 @@ packer.startup({
use({ "neovim/nvim-lspconfig", after = "cmp-nvim-lsp", config = [[require('config.lsp')]] })
if vim.g.is_mac then
use({ "nvim-treesitter/nvim-treesitter", event = 'BufEnter', run = ":TSUpdate", config = [[require('config.treesitter')]] })
use({ "nvim-treesitter/nvim-treesitter", event = 'BufEnter', run = ":TSUpdate",
config = [[require('config.treesitter')]] })
end
-- Python indent (follows the PEP8 style)
@ -82,9 +80,6 @@ packer.startup({
end
}
-- Clear highlight search automatically for you
-- use({"romainl/vim-cool", event = "VimEnter"})
-- Show match number and index for searching
use {
'kevinhwang91/nvim-hlslens',
@ -110,15 +105,6 @@ packer.startup({
-- search emoji and other symbols
use { 'nvim-telescope/telescope-symbols.nvim', after = 'telescope.nvim' }
-- Another similar plugin is command-t
-- use 'wincent/command-t'
-- Another grep tool (similar to Sublime Text Ctrl+Shift+F)
-- use 'dyng/ctrlsf.vim'
-- A grepping tool
-- use {'mhinz/vim-grepper', cmd = {'Grepper', '<plug>(GrepperOperator)'}}
-- A list of colorscheme plugin you may want to try. Find what suits you.
use({ "lifepillar/vim-gruvbox8", opt = true })
use({ "navarasu/onedark.nvim", opt = true })
@ -132,11 +118,6 @@ packer.startup({
use({ "rebelot/kanagawa.nvim", opt = true })
use({ "catppuccin/nvim", as = "catppuccin", opt = true })
-- Show git change (change, delete, add) signs in vim sign column
use({"mhinz/vim-signify", event = 'BufEnter'})
-- Another similar plugin
-- use 'airblade/vim-gitgutter'
use { 'kyazdani42/nvim-web-devicons', event = 'VimEnter' }
use {
@ -211,8 +192,6 @@ packer.startup({
-- Repeat vim motions
use({ "tpope/vim-repeat", event = "VimEnter" })
-- Show the content of register in preview window
-- Plug 'junegunn/vim-peekaboo'
use({ "nvim-zh/better-escape.vim", event = { "InsertEnter" } })
if vim.g.is_mac then
@ -221,12 +200,8 @@ packer.startup({
use({ "Neur1n/neuims", event = { "InsertEnter" } })
end
-- Syntax check and make
-- use 'neomake/neomake'
-- Auto format tools
use({ "sbdchd/neoformat", cmd = { "Neoformat" } })
-- use 'Chiel92/vim-autoformat'
-- Git command inside vim
use({ "tpope/vim-fugitive", event = "User InGitRepo", config = [[require('config.fugitive')]] })
@ -243,11 +218,14 @@ packer.startup({
config = [[require('config.git-linker')]]
}
use({ "kevinhwang91/nvim-bqf", ft = "qf", config = [[require('config.bqf')]] })
-- Show git change (change, delete, add) signs in vim sign column
use({ 'lewis6991/gitsigns.nvim', config = [[require('config.gitsigns')]] })
-- Better git commit experience
use({ "rhysd/committia.vim", opt = true, setup = [[vim.cmd('packadd committia.vim')]] })
use({ "kevinhwang91/nvim-bqf", ft = "qf", config = [[require('config.bqf')]] })
-- Another markdown plugin
use({ "plasticboy/vim-markdown", ft = { "markdown" } })
@ -284,7 +262,6 @@ packer.startup({
use({ "wellle/targets.vim", event = "VimEnter" })
-- Plugin to manipulate character pairs quickly
-- use 'tpope/vim-surround'
use({ "machakann/vim-sandwich", event = "VimEnter" })
-- Add indent object for vim (useful for languages like Python)
@ -293,9 +270,6 @@ packer.startup({
-- Only use these plugin on Windows and Mac and when LaTeX is installed
if vim.g.is_win or vim.g.is_mac and utils.executable("latex") then
use({ "lervag/vimtex", ft = { "tex" } })
-- use {'matze/vim-tex-fold', ft = {'tex', }}
-- use 'Konfekt/FastFold'
end
-- Since tmux is only available on Linux and Mac, we only enable these plugins
@ -309,7 +283,6 @@ packer.startup({
use({ "andymass/vim-matchup", event = "VimEnter" })
-- Smoothie motions
-- use 'psliwka/vim-smoothie'
use({
"karb94/neoscroll.nvim",
event = "VimEnter",
@ -322,8 +295,6 @@ packer.startup({
-- Asynchronous command execution
use({ "skywind3000/asyncrun.vim", opt = true, cmd = { "AsyncRun" } })
-- Another asynchronous plugin
-- Plug 'tpope/vim-dispatch'
use({ "cespare/vim-toml", ft = { "toml" }, branch = "main" })