init nvim
This commit is contained in:
59
pwnvim/plugins/bufferline.lua
Normal file
59
pwnvim/plugins/bufferline.lua
Normal file
@@ -0,0 +1,59 @@
|
||||
require 'bufferline'.setup {
|
||||
options = {
|
||||
numbers = "none", -- | "ordinal" | "buffer_id" | "both" | function({ ordinal, id, lower, raise }): string,
|
||||
close_command = "Bdelete! %d", -- can be a string | function, see "Mouse actions"
|
||||
right_mouse_command = "Bdelete! %d", -- can be a string | function, see "Mouse actions"
|
||||
left_mouse_command = "buffer %d", -- can be a string | function, see "Mouse actions"
|
||||
middle_mouse_command = nil, -- can be a string | function, see "Mouse actions"
|
||||
indicator = {
|
||||
style = "icon",
|
||||
icon = "▎",
|
||||
},
|
||||
-- buffer_close_icon = '',
|
||||
modified_icon = "●",
|
||||
close_icon = SimpleUI and "x" or "",
|
||||
-- close_icon = '',
|
||||
-- hover doesn't work in tmux
|
||||
-- hover = {
|
||||
-- enabled = true,
|
||||
-- delay = 200,
|
||||
-- reveal = { 'close' }
|
||||
-- },
|
||||
left_trunc_marker = SimpleUI and "⬅️" or "",
|
||||
right_trunc_marker = SimpleUI and "➡️" or "",
|
||||
max_name_length = 40,
|
||||
max_prefix_length = 30, -- prefix used when a buffer is de-duplicated
|
||||
tab_size = 20,
|
||||
-- name_formatter = function(buf) -- buf contains a "name", "path" and "bufnr"
|
||||
-- -- remove extension from markdown files for example
|
||||
-- if buf.name:match('%.md') then
|
||||
-- return vim.fn.fnamemodify(buf.name, ':t:r')
|
||||
-- end
|
||||
-- end,
|
||||
diagnostics = false, -- | "nvim_lsp" | "coc",
|
||||
diagnostics_update_in_insert = false,
|
||||
offsets = { { filetype = "NvimTree", text = "", padding = 1 } },
|
||||
show_buffer_close_icons = true,
|
||||
show_close_icon = true,
|
||||
show_buffer_icons = not SimpleUI,
|
||||
show_buffer_default_icon = not SimpleUI,
|
||||
color_icons = not SimpleUI,
|
||||
buffer_close_icon = SimpleUI and "x" or "",
|
||||
show_tab_indicators = true,
|
||||
persist_buffer_sort = false, -- whether or not custom sorted buffers should persist
|
||||
-- can also be a table containing 2 custom separators
|
||||
-- [focused and unfocused]. eg: { '|', '|' }
|
||||
separator_style = "thick", -- | "thick" | "thin" | { 'any', 'any' },
|
||||
enforce_regular_tabs = false, -- if true, all tabs same width
|
||||
always_show_bufferline = true
|
||||
},
|
||||
highlights = {
|
||||
indicator_selected = {
|
||||
fg = {
|
||||
attribute = "fg",
|
||||
highlight = "LspDiagnosticsDefaultHint"
|
||||
},
|
||||
bg = { attribute = "bg", highlight = "Normal" }
|
||||
}
|
||||
}
|
||||
}
|
||||
99
pwnvim/plugins/gitsigns.lua
Normal file
99
pwnvim/plugins/gitsigns.lua
Normal file
@@ -0,0 +1,99 @@
|
||||
require("gitsigns").setup {
|
||||
signs = {
|
||||
add = {
|
||||
hl = 'GitSignsAdd',
|
||||
text = '✚',
|
||||
numhl = 'GitSignsAddNr',
|
||||
linehl = 'GitSignsAddLn'
|
||||
},
|
||||
change = {
|
||||
hl = 'GitSignsChange',
|
||||
text = '│',
|
||||
numhl = 'GitSignsChangeNr',
|
||||
linehl = 'GitSignsChangeLn'
|
||||
},
|
||||
delete = {
|
||||
hl = 'GitSignsDelete',
|
||||
text = '_',
|
||||
numhl = 'GitSignsDeleteNr',
|
||||
linehl = 'GitSignsDeleteLn'
|
||||
},
|
||||
topdelete = {
|
||||
hl = 'GitSignsDelete',
|
||||
text = '‾',
|
||||
numhl = 'GitSignsDeleteNr',
|
||||
linehl = 'GitSignsDeleteLn'
|
||||
},
|
||||
changedelete = {
|
||||
hl = 'GitSignsChange',
|
||||
text = '~',
|
||||
numhl = 'GitSignsChangeNr',
|
||||
linehl = 'GitSignsChangeLn'
|
||||
}
|
||||
},
|
||||
on_attach = function(bufnr)
|
||||
local gs = package.loaded.gitsigns
|
||||
|
||||
local function map(mode, l, r, opts)
|
||||
opts = opts or {}
|
||||
opts.buffer = bufnr
|
||||
vim.keymap.set(mode, l, r, opts)
|
||||
end
|
||||
|
||||
-- Navigation
|
||||
map('n', ']c', function()
|
||||
if vim.wo.diff then return ']c' end
|
||||
vim.schedule(function() gs.next_hunk() end)
|
||||
return '<Ignore>'
|
||||
end, { expr = true })
|
||||
|
||||
map('n', '[c', function()
|
||||
if vim.wo.diff then return '[c' end
|
||||
vim.schedule(function() gs.prev_hunk() end)
|
||||
return '<Ignore>'
|
||||
end, { expr = true })
|
||||
|
||||
-- Actions -- normal mode
|
||||
require("which-key").register(
|
||||
{
|
||||
["<leader>"] = {
|
||||
h = {
|
||||
name = "hunk (git)",
|
||||
s = { ':Gitsigns stage_hunk<CR>', "Stage hunk" },
|
||||
r = { ':Gitsigns reset_hunk<CR>', "Reset hunk" },
|
||||
S = { gs.stage_buffer, "Stage buffer" },
|
||||
u = { gs.undo_stage_hunk, "Undo stage hunk" },
|
||||
R = { gs.reset_buffer, "Reset buffer" },
|
||||
p = { gs.preview_hunk, "Preview hunk" },
|
||||
b = { function() gs.blame_line { full = true } end, "Blame hunk" },
|
||||
d = { gs.diffthis, "Diff this to index" },
|
||||
D = { function() gs.diffthis('~') end, "Diff this to previous" },
|
||||
},
|
||||
t = {
|
||||
name = "git toggles",
|
||||
b = { gs.toggle_current_line_blame, "Toggle current line blame" },
|
||||
d = { gs.toggle_deleted, "Toggle deleted" },
|
||||
}
|
||||
}
|
||||
}, { mode = "n", buffer = bufnr, silent = true, norewrap = true }
|
||||
)
|
||||
-- Actions -- visual and select mode
|
||||
require("which-key").register(
|
||||
{
|
||||
["<leader>"] = {
|
||||
h = {
|
||||
name = "hunk (git)",
|
||||
s = { ':Gitsigns stage_hunk<CR>', "Stage hunk" },
|
||||
r = { ':Gitsigns reset_hunk<CR>', "Reset hunk" },
|
||||
}
|
||||
}
|
||||
}, { mode = "v", buffer = bufnr, silent = true, norewrap = true }
|
||||
)
|
||||
-- Actions -- operator pending mode
|
||||
require("which-key").register(
|
||||
{
|
||||
["ih"] = { ':<C-U>Gitsigns select_hunk<CR>', "Select git hunk" }
|
||||
}, { mode = "o", buffer = bufnr, silent = true, norewrap = true }
|
||||
)
|
||||
end
|
||||
}
|
||||
30
pwnvim/plugins/indent-blankline.lua
Normal file
30
pwnvim/plugins/indent-blankline.lua
Normal file
@@ -0,0 +1,30 @@
|
||||
if not SimpleUI then
|
||||
vim.g.indentLine_enabled = 1
|
||||
vim.g.indent_blankline_char = '┊'
|
||||
-- vim.g.indent_blankline_char = "▏"
|
||||
vim.g.indent_blankline_filetype_exclude = { 'help', 'packer' }
|
||||
vim.g.indent_blankline_buftype_exclude = { 'terminal', 'nofile' }
|
||||
vim.g.indent_blankline_char_highlight = 'LineNr'
|
||||
vim.g.indent_blankline_show_trailing_blankline_indent = false
|
||||
vim.g.indent_blankline_filetype_exclude = {
|
||||
"help", "startify", "dashboard", "packer", "neogitstatus", "NvimTree",
|
||||
"Trouble"
|
||||
}
|
||||
vim.g.indent_blankline_use_treesitter = true
|
||||
vim.g.indent_blankline_show_current_context = true
|
||||
vim.g.indent_blankline_context_patterns = {
|
||||
"class", "return", "function", "method", "^if", "^while", "jsx_element",
|
||||
"^for", "^object", "^table", "block", "arguments", "if_statement",
|
||||
"else_clause", "jsx_element", "jsx_self_closing_element",
|
||||
"try_statement", "catch_clause", "import_statement", "operation_type"
|
||||
}
|
||||
-- HACK: work-around for https://github.com/lukas-reineke/indent-blankline.nvim/issues/59
|
||||
vim.wo.colorcolumn = "99999"
|
||||
|
||||
require('indent_blankline').setup({
|
||||
show_current_context = true,
|
||||
use_treesitter = true,
|
||||
buftype_exclude = { 'terminal' },
|
||||
filetype_exclude = { 'help', 'markdown' },
|
||||
})
|
||||
end
|
||||
27
pwnvim/plugins/lualine.lua
Normal file
27
pwnvim/plugins/lualine.lua
Normal file
@@ -0,0 +1,27 @@
|
||||
require('lualine').setup {
|
||||
options = {
|
||||
theme = 'papercolor_light',
|
||||
icons_enabled = not SimpleUI,
|
||||
component_separators = { left = SimpleUI and '>' or '', right = SimpleUI and '<' or '' },
|
||||
disabled_filetypes = { 'pager' },
|
||||
section_separators = { left = SimpleUI and '>' or '', right = SimpleUI and '<' or '' }
|
||||
},
|
||||
extensions = { 'quickfix', 'nvim-tree', 'fugitive' },
|
||||
sections = {
|
||||
lualine_a = { 'mode' },
|
||||
lualine_b = { 'branch' },
|
||||
lualine_c = { 'nvim-tree', 'filename' },
|
||||
lualine_x = { 'encoding', 'fileformat', 'filetype' },
|
||||
lualine_y = { 'progress' },
|
||||
lualine_z = {
|
||||
{
|
||||
'diagnostics',
|
||||
sources = { 'nvim_diagnostic' },
|
||||
-- displays diagnostics from defined severity
|
||||
sections = { 'error', 'warn' }, -- 'info', 'hint'},}}
|
||||
color_error = "#E06C75", -- changes diagnostic's error foreground color
|
||||
color_warn = "#E5C07B"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
74
pwnvim/plugins/nvim-tree.lua
Normal file
74
pwnvim/plugins/nvim-tree.lua
Normal file
@@ -0,0 +1,74 @@
|
||||
local signs = require("pwnvim.signs")
|
||||
require 'nvim-tree'.setup {
|
||||
renderer = {
|
||||
icons = {
|
||||
webdev_colors = true,
|
||||
git_placement = "before",
|
||||
padding = " ",
|
||||
symlink_arrow = " ➛ ",
|
||||
show = {
|
||||
file = not SimpleUI,
|
||||
folder = true,
|
||||
folder_arrow = true,
|
||||
git = true
|
||||
},
|
||||
glyphs = {
|
||||
default = SimpleUI and "🖹" or "",
|
||||
symlink = SimpleUI and "🔗" or "",
|
||||
git = {
|
||||
unstaged = SimpleUI and "•" or "",
|
||||
staged = "✓",
|
||||
unmerged = SimpleUI and "⚡︎" or "",
|
||||
renamed = "➜",
|
||||
deleted = SimpleUI and "⌦" or "",
|
||||
untracked = "U",
|
||||
ignored = "◌"
|
||||
},
|
||||
folder = {
|
||||
default = SimpleUI and "📁" or "",
|
||||
open = SimpleUI and "📂" or "",
|
||||
empty = SimpleUI and "🗀" or "",
|
||||
empty_open = SimpleUI and "🗁" or "",
|
||||
symlink = SimpleUI and "🔗" or ""
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
-- disables netrw completely
|
||||
disable_netrw = true,
|
||||
-- hijack netrw window on startup
|
||||
hijack_netrw = true,
|
||||
-- open the tree when running this setup function
|
||||
open_on_setup = false,
|
||||
update_cwd = true,
|
||||
-- update_to_buf_dir = { enable = true, auto_open = true },
|
||||
update_focused_file = { enable = true, update_cwd = true },
|
||||
-- show lsp diagnostics in the signcolumn
|
||||
diagnostics = {
|
||||
enable = true,
|
||||
icons = { hint = signs.hint, info = signs.info, warning = signs.warn, error = signs.error }
|
||||
},
|
||||
git = {
|
||||
enable = true,
|
||||
timeout = 400 -- (in ms)
|
||||
},
|
||||
view = {
|
||||
width = 30,
|
||||
-- height = 30,
|
||||
hide_root_folder = false,
|
||||
side = "left",
|
||||
-- auto_resize = true,
|
||||
mappings = {
|
||||
custom_only = false,
|
||||
list = {
|
||||
{ key = { "l", "<CR>", "o" }, action = "edit" },
|
||||
{ key = "h", action = "close_node" },
|
||||
{ key = "<F10>", action = "quicklook",
|
||||
action_cb = function(node) vim.cmd("silent !qlmanage -p '" .. node.absolute_path .. "'") end },
|
||||
{ key = "v", action = "vsplit" }
|
||||
}
|
||||
},
|
||||
number = false,
|
||||
relativenumber = false
|
||||
}
|
||||
}
|
||||
58
pwnvim/plugins/todo-comments.lua
Normal file
58
pwnvim/plugins/todo-comments.lua
Normal file
@@ -0,0 +1,58 @@
|
||||
local signs = require("pwnvim.signs")
|
||||
require("todo-comments").setup {
|
||||
-- your configuration comes here
|
||||
-- or leave it empty to use the default settings
|
||||
-- refer to the configuration section below
|
||||
signs = false, -- show icons in the signs column
|
||||
keywords = {
|
||||
FIX = {
|
||||
icon = " ", -- icon used for the sign, and in search results
|
||||
color = "error", -- can be a hex color, or a named color (see below)
|
||||
alt = { "ERROR", "FIXME", "BUG", "FIXIT", "ISSUE", "!!!" }, -- a set of other keywords that all map to this FIX keywords
|
||||
-- signs = false, -- configure signs for some keywords individually
|
||||
},
|
||||
TODO = { icon = " ", color = "info", alt = { "PWTODO", "TK" } },
|
||||
HACK = { icon = " ", color = "warning" },
|
||||
WARN = { icon = signs.warn, color = "warning", alt = { "WARNING", "XXX" } },
|
||||
PERF = { icon = " ", alt = { "OPTIM", "PERFORMANCE", "OPTIMIZE" } },
|
||||
NOTE = { icon = " ", color = "hint", alt = { "INFO" } },
|
||||
TEST = { icon = "⏲ ", color = "test", alt = { "TESTING", "PASSED", "FAILED" } },
|
||||
},
|
||||
merge_keywords = true, -- when true, custom keywords will be merged with the defaults
|
||||
-- highlighting of the line containing the todo comment
|
||||
-- * before: highlights before the keyword (typically comment characters)
|
||||
-- * keyword: highlights of the keyword
|
||||
-- * after: highlights after the keyword (todo text)
|
||||
highlight = {
|
||||
multiline = false,
|
||||
before = "", -- "fg" or "bg" or empty
|
||||
keyword = "wide", -- "fg", "bg", "wide" or empty. (wide is the same as bg, but will also highlight surrounding characters)
|
||||
after = "fg", -- "fg" or "bg" or empty
|
||||
pattern = [[<(KEYWORDS)]], -- pattern or table of patterns, used for highlightng (vim regex)
|
||||
comments_only = false, -- uses treesitter to match keywords in comments only
|
||||
max_line_len = 400, -- ignore lines longer than this
|
||||
exclude = {}, -- list of file types to exclude highlighting
|
||||
},
|
||||
-- list of named colors where we try to extract the guifg from the
|
||||
-- list of hilight groups or use the hex color if hl not found as a fallback
|
||||
colors = {
|
||||
error = { "DiagnosticError", "ErrorMsg", "#DC2626" },
|
||||
warning = { "DiagnosticWarning", "WarningMsg", "#FBBF24" },
|
||||
info = { "DiagnosticInfo", "#2563EB" },
|
||||
hint = { "DiagnosticHint", "#10B981" },
|
||||
default = { "Identifier", "#7C3AED" },
|
||||
},
|
||||
search = {
|
||||
command = "rg",
|
||||
args = {
|
||||
"--color=never",
|
||||
"--no-heading",
|
||||
"--with-filename",
|
||||
"--line-number",
|
||||
"--column",
|
||||
},
|
||||
-- regex that will be used to match keywords.
|
||||
-- don't replace the (KEYWORDS) placeholder
|
||||
pattern = [[\b(KEYWORDS)]], -- match without the extra colon. You'll likely get false positives
|
||||
},
|
||||
}
|
||||
60
pwnvim/plugins/treesitter.lua
Normal file
60
pwnvim/plugins/treesitter.lua
Normal file
@@ -0,0 +1,60 @@
|
||||
require 'nvim-treesitter.configs'.setup {
|
||||
auto_install = false,
|
||||
autotag = { enable = true },
|
||||
highlight = {
|
||||
enable = true,
|
||||
--disable = { "markdown", "markdown_inline" }, -- 2022-11-30 conflicts with markdown plugin, which detects more things like bold+italic and strikethrough
|
||||
--additional_vim_regex_highlighting = { "markdown" } -- leaving in case we bring back markdown plugin
|
||||
},
|
||||
indent = { enable = true, disable = { "yaml" } },
|
||||
incremental_selection = { enable = true },
|
||||
context_commentstring = {
|
||||
enable = true,
|
||||
},
|
||||
textobjects = {
|
||||
select = {
|
||||
enable = true,
|
||||
lookahead = true,
|
||||
keymaps = {
|
||||
-- You can use the capture groups defined in textobjects.scm
|
||||
["af"] = { query = "@function.outer", desc = "Select outer function" },
|
||||
["if"] = { query = "@function.inner", desc = "Select inner function" },
|
||||
["ac"] = { query = "@class.outer", desc = "Select outer class" },
|
||||
["ic"] = { query = "@class.inner", desc = "Select inner class" },
|
||||
["im"] = { query = "@block.inner", desc = "Select inner block" },
|
||||
["am"] = { query = "@block.outer", desc = "Select outer block" },
|
||||
-- ["il"] = { query = "@list.inner", desc = "Select inner list" },
|
||||
-- ["al"] = { query = "@list.outer", desc = "Select outer list" },
|
||||
-- ["ih"] = { query = "@section.inner", desc = "Select inner section" },
|
||||
-- ["ah"] = { query = "@section.outer", desc = "Select outer section" },
|
||||
},
|
||||
},
|
||||
move = {
|
||||
enable = true,
|
||||
set_jumps = true, -- whether to set jumps in the jumplist
|
||||
goto_next_start = {
|
||||
["]m"] = "@function.outer",
|
||||
["]]"] = { query = "@class.outer", desc = "Next class start" },
|
||||
},
|
||||
goto_next_end = {
|
||||
["]M"] = "@function.outer",
|
||||
["]["] = "@class.outer",
|
||||
},
|
||||
goto_previous_start = {
|
||||
["[m"] = "@function.outer",
|
||||
["[["] = "@class.outer",
|
||||
},
|
||||
goto_previous_end = {
|
||||
["[M"] = "@function.outer",
|
||||
["[]"] = "@class.outer",
|
||||
},
|
||||
},
|
||||
|
||||
}
|
||||
}
|
||||
require 'treesitter-context'.setup {
|
||||
max_lines = 0, -- no max window height
|
||||
patterns = {
|
||||
markdown = { "atx_heading" }
|
||||
},
|
||||
}
|
||||
Reference in New Issue
Block a user