nvim: replace comment plugin
This commit is contained in:
parent
15c21ad586
commit
2730bb8c55
@ -2,9 +2,39 @@ require('my/plugins')
|
||||
require('my/keymaps')
|
||||
require('my/tools')
|
||||
|
||||
vim.g.tcomment_opleader1 = '<Leader>c'
|
||||
vim.g.tcomment_mapleader1 = ''
|
||||
vim.g.tcomment_mapleader2 = ''
|
||||
require('Comment').setup({
|
||||
toggler = {
|
||||
line = '<Leader>cc',
|
||||
block = '<Leader>CC'
|
||||
},
|
||||
opleader = {
|
||||
line = '<Leader>c',
|
||||
block = '<Leader>C'
|
||||
},
|
||||
extra = {
|
||||
above = '<Leader>cO',
|
||||
below = '<Leader>co',
|
||||
eol = '<Leader>cA',
|
||||
},
|
||||
pre_hook = function(ctx)
|
||||
local comment_utils = require "Comment.utils"
|
||||
local context_utils = require('ts_context_commentstring.utils')
|
||||
local context_internal = require('ts_context_commentstring.internal')
|
||||
|
||||
local location = nil
|
||||
if ctx.ctype == comment_utils.ctype.blockwise then
|
||||
location = context_utils.get_cursor_location()
|
||||
elseif ctx.cmotion == comment_utils.cmotion.v or ctx.cmotion == comment_utils.cmotion.V then
|
||||
location = context_utils.utils.get_visual_start_location()
|
||||
end
|
||||
|
||||
return context_internal.calculate_commentstring {
|
||||
key = ctx.ctype == comment_utils.ctype.linewise and "__default" or "__multiline",
|
||||
location = location,
|
||||
}
|
||||
end
|
||||
})
|
||||
map('i', '<M-c>', '<Leader>cA')
|
||||
|
||||
local neogit = require('neogit')
|
||||
neogit.setup {
|
||||
|
@ -6,6 +6,10 @@ require'nvim-treesitter.configs'.setup {
|
||||
enable = true,
|
||||
additional_vim_regex_highlighting = { 'org' }
|
||||
},
|
||||
context_commentstring = {
|
||||
enable = true,
|
||||
enable_autocmd = false -- handled by Comment
|
||||
}
|
||||
}
|
||||
|
||||
require('orgmode').setup{}
|
||||
|
@ -28,6 +28,10 @@ require('packer').startup(function(use)
|
||||
tag = '*',
|
||||
requires = 'https://github.com/nvim-treesitter/nvim-treesitter'
|
||||
}
|
||||
use {
|
||||
'https://github.com/JoosepAlviste/nvim-ts-context-commentstring',
|
||||
requires = 'https://github.com/nvim-treesitter/nvim-treesitter'
|
||||
}
|
||||
|
||||
-- completion
|
||||
use {
|
||||
@ -77,8 +81,8 @@ require('packer').startup(function(use)
|
||||
|
||||
-- coding
|
||||
use {
|
||||
'https://github.com/tomtom/tcomment_vim',
|
||||
-- tag = '*' -- NOTE: reactivate when tagged after 2022-08-15
|
||||
'https://github.com/numToStr/Comment.nvim',
|
||||
tag = '*'
|
||||
}
|
||||
use {
|
||||
'https://github.com/TimUntersberger/neogit',
|
||||
|
Loading…
x
Reference in New Issue
Block a user