summaryrefslogtreecommitdiff
path: root/.config/nvim
diff options
context:
space:
mode:
authorGustaf Rydholm <gustaf.rydholm@gmail.com>2021-10-13 22:01:35 +0200
committerGustaf Rydholm <gustaf.rydholm@gmail.com>2021-10-13 22:01:35 +0200
commitf11eff223d021dd9553a7152278c00ca41b7ef37 (patch)
treedbb89a078f2ac19d782d9bfc5596314128c9461a /.config/nvim
parentdf66b461596d351367f90d41a0fabffb873de4be (diff)
Add lunarvim updates
Diffstat (limited to '.config/nvim')
-rw-r--r--.config/nvim/lua/core/comment.lua66
-rw-r--r--.config/nvim/lua/core/nvimtree.lua28
-rw-r--r--.config/nvim/lua/core/which-key.lua4
-rw-r--r--.config/nvim/lua/plugins.lua5
4 files changed, 76 insertions, 27 deletions
diff --git a/.config/nvim/lua/core/comment.lua b/.config/nvim/lua/core/comment.lua
index a97018d..f8d62c2 100644
--- a/.config/nvim/lua/core/comment.lua
+++ b/.config/nvim/lua/core/comment.lua
@@ -1,26 +1,66 @@
local M = {}
function M.config()
+ local pre_hook = nil
+ if options.builtin.treesitter.context_commentstring.enable then
+ pre_hook = function(_ctx)
+ return require("ts_context_commentstring.internal").calculate_commentstring()
+ end
+ end
options.builtin.comment = {
active = true,
on_config_done = nil,
- -- Linters prefer comment and line to have a space in between markers
- marker_padding = true,
- -- should comment out empty or whitespace only lines
- comment_empty = false,
- -- Should key mappings be created
- create_mappings = true,
- -- Normal mode mapping left hand side
- line_mapping = "gcc",
- -- Visual/Operator mapping left hand side
- operator_mapping = "gc",
- -- Hook function to call before commenting takes place
- hook = nil,
+ ---Add a space b/w comment and the line
+ ---@type boolean
+ padding = true,
+
+ ---Lines to be ignored while comment/uncomment.
+ ---Could be a regex string or a function that returns a regex string.
+ ---Example: Use '^$' to ignore empty lines
+ ---@type string|function
+ ignore = "^$",
+
+ ---Whether to create basic (operator-pending) and extra mappings for NORMAL/VISUAL mode
+ ---@type table
+ mappings = {
+ ---operator-pending mapping
+ ---Includes `gcc`, `gcb`, `gc[count]{motion}` and `gb[count]{motion}`
+ basic = true,
+ ---extended mapping
+ ---Includes `g>`, `g<`, `g>[count]{motion}` and `g<[count]{motion}`
+ extra = false,
+ },
+
+ ---LHS of line and block comment toggle mapping in NORMAL/VISUAL mode
+ ---@type table
+ toggler = {
+ ---line-comment toggle
+ line = "gcc",
+ ---block-comment toggle
+ block = "gbc",
+ },
+
+ ---LHS of line and block comment operator-mode mapping in NORMAL/VISUAL mode
+ ---@type table
+ opleader = {
+ ---line-comment opfunc mapping
+ line = "gc",
+ ---block-comment opfunc mapping
+ block = "gb",
+ },
+
+ ---Pre-hook, called before commenting the line
+ ---@type function|nil
+ pre_hook = pre_hook,
+
+ ---Post-hook, called after commenting is done
+ ---@type function|nil
+ post_hook = nil,
}
end
function M.setup()
- local nvim_comment = require "nvim_comment"
+ local nvim_comment = require "Comment"
nvim_comment.setup(options.builtin.comment)
if options.builtin.comment.on_config_done then
diff --git a/.config/nvim/lua/core/nvimtree.lua b/.config/nvim/lua/core/nvimtree.lua
index 86554ab..08f5605 100644
--- a/.config/nvim/lua/core/nvimtree.lua
+++ b/.config/nvim/lua/core/nvimtree.lua
@@ -6,13 +6,21 @@ function M.config()
active = true,
on_config_done = nil,
setup = {
- open_on_setup = 0,
- auto_close = 1,
- open_on_tab = 0,
+ open_on_setup = false,
+ auto_close = true,
+ open_on_tab = false,
update_focused_file = {
- enable = 1,
+ enable = true,
+ },
+ diagnostics = {
+ enable = true,
+ icons = {
+ hint = "",
+ info = "",
+ warning = "",
+ error = "",
+ },
},
- lsp_diagnostics = 1,
view = {
width = 30,
side = "left",
@@ -31,7 +39,7 @@ function M.config()
},
ignore = { ".git", "node_modules", ".cache" },
quit_on_open = 0,
- hide_dotfiles = 1,
+ hide_dotfiles = 0,
git_hl = 1,
root_folder_modifier = ":t",
allow_resize = 1,
@@ -74,10 +82,10 @@ function M.setup()
-- Implicitly update nvim-tree when project module is active
if options.builtin.project.active then
options.builtin.nvimtree.respect_buf_cwd = 1
- options.builtin.nvimtree.setup.update_cwd = 1
- options.builtin.nvimtree.setup.disable_netrw = 0
- options.builtin.nvimtree.setup.hijack_netrw = 0
- vim.g.netrw_banner = 0
+ options.builtin.nvimtree.setup.update_cwd = true
+ options.builtin.nvimtree.setup.disable_netrw = false
+ options.builtin.nvimtree.setup.hijack_netrw = false
+ vim.g.netrw_banner = false
end
local tree_cb = nvim_tree_config.nvim_tree_callback
diff --git a/.config/nvim/lua/core/which-key.lua b/.config/nvim/lua/core/which-key.lua
index dca1d77..ef95ce6 100644
--- a/.config/nvim/lua/core/which-key.lua
+++ b/.config/nvim/lua/core/which-key.lua
@@ -61,12 +61,12 @@ M.config = function()
-- NOTE: Prefer using : over <cmd> as the latter avoids going back in normal-mode.
-- see https://neovim.io/doc/user/map.html#:map-cmd
vmappings = {
- ["k"] = { ":CommentToggle<CR>", "Comment" },
+ ["k"] = { "<ESC><CMD>lua ___comment_gc(vim.fn.visualmode())<CR>", "Comment" },
},
mappings = {
["w"] = { "<cmd>w!<CR>", "Save" },
["q"] = { "<cmd>q!<CR>", "Quit" },
- ["k"] = { "<cmd>CommentToggle<CR>", "Comment" },
+ ["k"] = { "<cmd>lua require('Comment').toggle()<CR>", "Comment" },
["c"] = { "<cmd>BufferClose!<CR>", "Close Buffer" },
["f"] = { "<cmd>Telescope find_files<CR>", "Find File" },
["n"] = { "<cmd>nohlsearch<CR>", "No Highlight" },
diff --git a/.config/nvim/lua/plugins.lua b/.config/nvim/lua/plugins.lua
index 372f7f7..28e5780 100644
--- a/.config/nvim/lua/plugins.lua
+++ b/.config/nvim/lua/plugins.lua
@@ -90,7 +90,8 @@ return {
-- Whichkey
{
- "folke/which-key.nvim",
+ "abzcoding/which-key.nvim",
+ branch = "fix/neovim-6-position",
config = function()
require("core.which-key").setup()
end,
@@ -100,7 +101,7 @@ return {
-- Comments
{
- "terrortylor/nvim-comment",
+ "numToStr/Comment.nvim",
event = "BufRead",
config = function()
require("core.comment").setup()