Merge branch 'dev' into gentoo
nvim: format config files add commenting plugin
This commit is contained in:
commit
67c6462ab0
@ -17,3 +17,6 @@ require("plugin.cmp") -- ./lua/plugin/cmp.lua
|
|||||||
|
|
||||||
-- treesitter
|
-- treesitter
|
||||||
require("plugin.treesitter") -- ./lua/plugin/treesitter.lua
|
require("plugin.treesitter") -- ./lua/plugin/treesitter.lua
|
||||||
|
|
||||||
|
-- commenting, done right
|
||||||
|
require("plugin.comment") -- ./lua/plugin/comment.lua
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
-- License : GPLv3
|
-- License : GPLv3
|
||||||
-- Description : neovim lsp config file
|
-- Description : neovim lsp config file
|
||||||
|
|
||||||
local lsp = {}
|
local M = {}
|
||||||
|
|
||||||
vim.fn.sign_define(
|
vim.fn.sign_define(
|
||||||
"DiagnosticSignError",
|
"DiagnosticSignError",
|
||||||
@ -38,39 +38,43 @@ vim.fn.sign_define(
|
|||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
||||||
-- symbols for autocomplete
|
M.icons = {
|
||||||
vim.lsp.protocol.CompletionItemKind = {
|
Class = " ",
|
||||||
" ", -- Text
|
Color = " ",
|
||||||
" ", -- Method
|
Constant = " µ ",
|
||||||
" ", -- Function
|
Constructor = " ",
|
||||||
" ", -- Constructor
|
Enum = " ",
|
||||||
" ﴲ ", -- Field
|
EnumMember = " ",
|
||||||
" ", -- Variable
|
Event = " ",
|
||||||
" ", -- Class
|
Field = " ",
|
||||||
" ﰮ ", -- Interface
|
File = " ",
|
||||||
" ", -- Module
|
Folder = " ",
|
||||||
" 襁 ", -- Property
|
Function = " ",
|
||||||
" ", -- Unit
|
Keyword = " ",
|
||||||
" ", -- Value
|
Interface = " ",
|
||||||
" 練 ", -- Enum
|
Method = " ",
|
||||||
" ", -- Keyword
|
Module = " ",
|
||||||
" ", -- Snippet
|
Operator = " ",
|
||||||
" ", -- Color
|
Property = " ",
|
||||||
" ", -- File
|
Reference = " ",
|
||||||
" ", -- Reference
|
Snippet = " ",
|
||||||
" ", -- Folder
|
Struct = " ",
|
||||||
" ", -- EnumMember
|
Text = " ",
|
||||||
" ﲀ ", -- Constant
|
TypeParameter = " ",
|
||||||
" ﳤ ", -- Struct
|
Unit = " ",
|
||||||
" ", -- Event
|
Value = " ",
|
||||||
" ", -- Operator
|
Variable = " ",
|
||||||
" ", -- TypeParameter
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function lsp.setup()
|
function M.setup()
|
||||||
|
local kinds = vim.lsp.protocol.CompletionItemKind
|
||||||
|
for i, kind in ipairs(kinds) do
|
||||||
|
kinds[i] = M.icons[kind] or kind
|
||||||
|
end
|
||||||
|
|
||||||
local ft = vim.bo.filetype
|
local ft = vim.bo.filetype
|
||||||
if ft == "cpp" then ft = "c" end
|
if ft == "cpp" then ft = "c" end
|
||||||
require("lsp." .. ft) -- ./<ft>.lua
|
require("lsp." .. ft) -- ./<ft>.lua
|
||||||
end
|
end
|
||||||
|
|
||||||
return lsp
|
return M
|
||||||
|
54
.config/nvim/lua/plugin/comment.lua
Normal file
54
.config/nvim/lua/plugin/comment.lua
Normal file
@ -0,0 +1,54 @@
|
|||||||
|
-- Author : swytch
|
||||||
|
-- Created : Tuesday Oct. 12, 2021 19:07:36 CET
|
||||||
|
-- License : GPLv3
|
||||||
|
-- Description : Comment plugin config file
|
||||||
|
|
||||||
|
require("Comment").setup {
|
||||||
|
---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 = nil,
|
||||||
|
|
||||||
|
---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 = nil,
|
||||||
|
|
||||||
|
---Post-hook, called after commenting is done
|
||||||
|
---@type function|nil
|
||||||
|
post_hook = nil,
|
||||||
|
}
|
||||||
|
|
@ -1,3 +1,8 @@
|
|||||||
|
-- Author : swytch
|
||||||
|
-- Created : Monday May 24, 2021 20:02:19 CET
|
||||||
|
-- License : GPLv3
|
||||||
|
-- Description : treesitter config file
|
||||||
|
|
||||||
require("nvim-treesitter.configs").setup {
|
require("nvim-treesitter.configs").setup {
|
||||||
ensure_installed = { "c", "lua", "python", "bash", "latex", "verilog" },
|
ensure_installed = { "c", "lua", "python", "bash", "latex", "verilog" },
|
||||||
ignore_install = { "javascript" },
|
ignore_install = { "javascript" },
|
||||||
|
@ -69,6 +69,9 @@ return require("packer").startup(function()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
-- commenting, simplified
|
||||||
|
use "numToStr/Comment.nvim"
|
||||||
|
|
||||||
-- display colors directly in editor
|
-- display colors directly in editor
|
||||||
use {
|
use {
|
||||||
"norcalli/nvim-colorizer.lua",
|
"norcalli/nvim-colorizer.lua",
|
||||||
|
Reference in New Issue
Block a user