add comments

11-gitsigns
christianchiarulli 3 years ago
parent b9a2bc855b
commit 62af78a2ad

@ -7,3 +7,4 @@ require "user.lsp"
require "user.telescope" require "user.telescope"
require "user.treesitter" require "user.treesitter"
require "user.autopairs" 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,
}

@ -68,3 +68,7 @@ keymap("t", "<C-h>", "<C-\\><C-N><C-w>h", term_opts)
keymap("t", "<C-j>", "<C-\\><C-N><C-w>j", term_opts) keymap("t", "<C-j>", "<C-\\><C-N><C-w>j", term_opts)
keymap("t", "<C-k>", "<C-\\><C-N><C-w>k", term_opts) keymap("t", "<C-k>", "<C-\\><C-N><C-w>k", term_opts)
keymap("t", "<C-l>", "<C-\\><C-N><C-w>l", term_opts) keymap("t", "<C-l>", "<C-\\><C-N><C-w>l", term_opts)
-- Comment
keymap("n", "<leader>/", "<cmd>lua require('Comment').toggle()<CR>", opts)
keymap("v", "<leader>/", ":lua require(\"Comment.api\").gc(vim.fn.visualmode())<cr>", opts)

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

@ -8,12 +8,16 @@ configs.setup {
sync_install = false, -- install languages synchronously (only applied to `ensure_installed`) sync_install = false, -- install languages synchronously (only applied to `ensure_installed`)
ignore_install = { "" }, -- List of parsers to ignore installing ignore_install = { "" }, -- List of parsers to ignore installing
autopairs = { autopairs = {
enable = true, enable = true,
}, },
highlight = { highlight = {
enable = true, -- false will disable the whole extension enable = true, -- false will disable the whole extension
disable = { "" }, -- list of language that will be disabled disable = { "" }, -- list of language that will be disabled
additional_vim_regex_highlighting = true, additional_vim_regex_highlighting = true,
}, },
indent = { enable = true, disable = { "yaml" } }, indent = { enable = true, disable = { "yaml" } },
context_commentstring = {
enable = true,
enable_autocmd = false,
},
} }

Loading…
Cancel
Save