add comments

add comments
10-comments
christianchiarulli 3 years ago committed by ChristianChiarulli
parent b9a2bc855b
commit 54c2bb0782

@ -7,3 +7,4 @@ require "user.lsp"
require "user.telescope"
require "user.treesitter"
require "user.autopairs"
require "user.comment"

@ -0,0 +1,22 @@
local status_ok, comment = pcall(require, "Comment")
if not status_ok then
return
end
comment.setup {
pre_hook = function(ctx)
local U = require "Comment.utils"
local location = nil
if ctx.ctype == U.ctype.block then
location = require("ts_context_commentstring.utils").get_cursor_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
return require("ts_context_commentstring.internal").calculate_commentstring {
key = ctx.ctype == U.ctype.line and "__default" or "__multiline",
location = location,
}
end,
}

@ -45,6 +45,7 @@ return packer.startup(function(use)
use "nvim-lua/popup.nvim" -- An implementation of the Popup API from vim in Neovim
use "nvim-lua/plenary.nvim" -- Useful lua functions used ny lots of plugins
use "windwp/nvim-autopairs" -- Autopairs, integrates with both cmp and treesitter
use "numToStr/Comment.nvim" -- Easily comment stuff
-- Colorschemes
-- use "lunarvim/colorschemes" -- A bunch of colorschemes you can try out
@ -75,6 +76,7 @@ return packer.startup(function(use)
"nvim-treesitter/nvim-treesitter",
run = ":TSUpdate",
}
use 'JoosepAlviste/nvim-ts-context-commentstring'
-- Automatically set up your configuration after cloning packer.nvim
-- Put this at the end after all plugins

@ -16,4 +16,8 @@ configs.setup {
additional_vim_regex_highlighting = true,
},
indent = { enable = true, disable = { "yaml" } },
context_commentstring = {
enable = true,
enable_autocmd = false,
},
}

Loading…
Cancel
Save