comment hotkeys + manager
This commit is contained in:
parent
8a1f67d50f
commit
e31fb9b976
29
lua/configs/comment.lua
Normal file
29
lua/configs/comment.lua
Normal file
@ -0,0 +1,29 @@
|
|||||||
|
local M = {}
|
||||||
|
|
||||||
|
function M.config()
|
||||||
|
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,
|
||||||
|
}
|
||||||
|
end
|
||||||
|
|
||||||
|
return M
|
||||||
|
|
@ -25,4 +25,7 @@ map("n", "<S-h>", "<cmd>bprevious<CR>", opts)
|
|||||||
map('n', '<leader>e', '<cmd>NvimTreeToggle<CR>', opts)
|
map('n', '<leader>e', '<cmd>NvimTreeToggle<CR>', opts)
|
||||||
map('n', '<leader>o', '<cmd>NvimTreeFocus<CR>', opts)
|
map('n', '<leader>o', '<cmd>NvimTreeFocus<CR>', opts)
|
||||||
|
|
||||||
|
-- Comment
|
||||||
|
map('n', '<leader>/', '<cmd>lua require(\'Comment.api\').toggle_current_linewise()<CR>', opts)
|
||||||
|
map('v', '<leader>/', '<esc><cmd>lua require(\'Comment.api\').toggle_linewise_op(vim.fn.visualmode())<CR>', opts)
|
||||||
|
|
||||||
|
@ -92,6 +92,9 @@ packer.startup {
|
|||||||
-- Quality of Life
|
-- Quality of Life
|
||||||
--
|
--
|
||||||
|
|
||||||
|
-- Commenting
|
||||||
|
use { 'numToStr/Comment.nvim', config = function() require'configs.comment'.config() end }
|
||||||
|
|
||||||
-- Automatically colorize color strings (#f1b8f1)
|
-- Automatically colorize color strings (#f1b8f1)
|
||||||
use { 'norcalli/nvim-colorizer.lua', config = function() require'configs.colorizer'.config() end }
|
use { 'norcalli/nvim-colorizer.lua', config = function() require'configs.colorizer'.config() end }
|
||||||
|
|
||||||
|
6
todo.txt
6
todo.txt
@ -5,8 +5,8 @@
|
|||||||
[x] Theme
|
[x] Theme
|
||||||
[x] VSCode Dark
|
[x] VSCode Dark
|
||||||
|
|
||||||
[ ] File Explorer
|
[x] File Explorer
|
||||||
[ ] NvimTree
|
[x] NvimTree
|
||||||
|
|
||||||
[x] Status Line
|
[x] Status Line
|
||||||
[x] lualine
|
[x] lualine
|
||||||
@ -46,3 +46,5 @@
|
|||||||
[ ] which-key
|
[ ] which-key
|
||||||
|
|
||||||
|
|
||||||
|
[ ] Bugs
|
||||||
|
[ ] Comment Colors don't show (but they show if you delete the compiled config and resync)
|
||||||
|
Loading…
Reference in New Issue
Block a user