nvim: comment.nvim + treesitter
This commit is contained in:
parent
a542d40a10
commit
68259adac0
1 changed files with 30 additions and 26 deletions
|
@ -95,7 +95,7 @@ return require('packer').startup({function()
|
||||||
context_commentstring = {
|
context_commentstring = {
|
||||||
enable = true,
|
enable = true,
|
||||||
enable_autocmd = false,
|
enable_autocmd = false,
|
||||||
}
|
},
|
||||||
}
|
}
|
||||||
end,
|
end,
|
||||||
}
|
}
|
||||||
|
@ -277,28 +277,35 @@ return require('packer').startup({function()
|
||||||
use { -- cheat.sh integration
|
use { -- cheat.sh integration
|
||||||
'dbeniamine/cheat.sh-vim',
|
'dbeniamine/cheat.sh-vim',
|
||||||
}
|
}
|
||||||
-- use { -- Comments (gb and gc)
|
use { -- Comments (gb and gc)
|
||||||
-- 'numToStr/Comment.nvim',
|
'numToStr/Comment.nvim',
|
||||||
-- config = function()
|
config = function()
|
||||||
-- require('Comment').setup {
|
require('Comment').setup {
|
||||||
-- pre_hook = function(ctx)
|
pre_hook = function(ctx)
|
||||||
-- local U = require 'Comment.utils'
|
-- Only calculate commentstring for tsx filetypes
|
||||||
--
|
if vim.bo.filetype == 'typescriptreact' then
|
||||||
-- local location = nil
|
local U = require('Comment.utils')
|
||||||
-- if ctx.ctype == U.ctype.block then
|
|
||||||
-- location = require('ts_context_commentstring.utils').get_cursor_location()
|
-- Detemine whether to use linewise or blockwise commentstring
|
||||||
-- elseif ctx.cmotion == U.cmotion.v or ctx.cmotion == U.cmotion.V then
|
local type = ctx.ctype == U.ctype.line and '__default' or '__multiline'
|
||||||
-- location = require('ts_context_commentstring.utils').get_visual_start_location()
|
|
||||||
-- end
|
-- Determine the location where to calculate commentstring from
|
||||||
--
|
local location = nil
|
||||||
-- return require('ts_context_commentstring.internal').calculate_commentstring {
|
if ctx.ctype == U.ctype.block then
|
||||||
-- key = ctx.ctype == U.ctype.line and '__default' or '__multiline',
|
location = require('ts_context_commentstring.utils').get_cursor_location()
|
||||||
-- location = location,
|
elseif ctx.cmotion == U.cmotion.v or ctx.cmotion == U.cmotion.V then
|
||||||
-- }
|
location = require('ts_context_commentstring.utils').get_visual_start_location()
|
||||||
-- end,
|
end
|
||||||
-- }
|
|
||||||
-- end
|
return require('ts_context_commentstring.internal').calculate_commentstring({
|
||||||
-- }
|
key = type,
|
||||||
|
location = location,
|
||||||
|
})
|
||||||
|
end
|
||||||
|
end,
|
||||||
|
}
|
||||||
|
end
|
||||||
|
}
|
||||||
-- use { -- lewis6991: spellsitter: Spell checking in treesitter files
|
-- use { -- lewis6991: spellsitter: Spell checking in treesitter files
|
||||||
-- 'lewis6991/spellsitter.nvim',
|
-- 'lewis6991/spellsitter.nvim',
|
||||||
-- config = function()
|
-- config = function()
|
||||||
|
@ -317,9 +324,6 @@ return require('packer').startup({function()
|
||||||
require('foldsigns').setup()
|
require('foldsigns').setup()
|
||||||
end,
|
end,
|
||||||
}
|
}
|
||||||
use { -- tpope: commentary
|
|
||||||
'tpope/vim-commentary',
|
|
||||||
}
|
|
||||||
use { -- tpope: surround
|
use { -- tpope: surround
|
||||||
'tpope/vim-surround'
|
'tpope/vim-surround'
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue