kitchen sink:
- add code action previews - change indent blankline style - more luasnip snippets - change default mason stuff - customize neorg more - change notify style - change startpage completely - add line info to statusline - change telescope style - change how todo comments look - make indentation work via treesitter
This commit is contained in:
@ -1,8 +1,6 @@
|
||||
if not pcall(require, "el") then
|
||||
return
|
||||
end
|
||||
if not pcall(require, "el") then return end
|
||||
|
||||
local Job = require "plenary.job"
|
||||
local job = require "plenary.job"
|
||||
local el_sub = require "el.subscribe"
|
||||
|
||||
local M = {}
|
||||
@ -71,14 +69,14 @@ local function wrap_fnc(opts, fn)
|
||||
window = { win_id = vim.fn.bufwinid(buffer.bufnr) }
|
||||
end
|
||||
if opts.hide_inactive and window and
|
||||
window.win_id ~= vim.api.nvim_get_current_win() then
|
||||
window.win_id ~= vim.api.nvim_get_current_win() then
|
||||
return ""
|
||||
end
|
||||
return fn(window, buffer)
|
||||
end
|
||||
end
|
||||
|
||||
M.mode = function(opts)
|
||||
function M.mode(opts)
|
||||
opts = opts or {}
|
||||
return wrap_fnc(opts, function(_, _)
|
||||
local fmt = opts.fmt or "%s%s"
|
||||
@ -92,79 +90,49 @@ M.mode = function(opts)
|
||||
end)
|
||||
end
|
||||
|
||||
M.try_devicons = function()
|
||||
if not M._has_devicons then
|
||||
M._has_devicons, M._devicons = pcall(require, "nvim-web-devicons")
|
||||
end
|
||||
return M._devicons
|
||||
end
|
||||
|
||||
M.file_icon = function(opts)
|
||||
opts = opts or {}
|
||||
return el_sub.buf_autocmd("el_file_icon", "BufRead",
|
||||
wrap_fnc(opts, function(_, buffer)
|
||||
if not M.try_devicons() then return "" end
|
||||
local fmt = opts.fmt or "%s"
|
||||
local ext = vim.fn.fnamemodify(buffer.name, ":p:e")
|
||||
local icon, hl = M._devicons.get_icon(buffer.name, ext:lower(), { default = true })
|
||||
-- local icon = extensions.file_icon(_, bufnr)
|
||||
if icon then
|
||||
if opts.hl_icon then
|
||||
local hlgroup = M.extract_hl({
|
||||
bg = { StatusLine = "bg" },
|
||||
fg = { [hl] = "fg" },
|
||||
})
|
||||
icon = set_hl(hlgroup, icon)
|
||||
end
|
||||
return (fmt):format(icon)
|
||||
end
|
||||
return ""
|
||||
end))
|
||||
end
|
||||
|
||||
M.git_branch = function(opts)
|
||||
function M.git_branch(opts)
|
||||
opts = opts or {}
|
||||
return el_sub.buf_autocmd("el_git_branch", "BufEnter",
|
||||
wrap_fnc(opts, function(_, buffer)
|
||||
-- Try fugitive first as it's most reliable
|
||||
local branch = vim.g.loaded_fugitive == 1 and
|
||||
vim.fn.FugitiveHead() or nil
|
||||
-- buffer can be null and code will crash with:
|
||||
-- E5108: Error executing lua ... 'attempt to index a nil value'
|
||||
if not buffer or not (buffer.bufnr > 0) then
|
||||
return
|
||||
end
|
||||
-- fugitive is empty or not loaded, try gitsigns
|
||||
if not branch or #branch == 0 then
|
||||
local ok, res = pcall(vim.api.nvim_buf_get_var,
|
||||
buffer.bufnr, "gitsigns_head")
|
||||
if ok then branch = res end
|
||||
end
|
||||
-- last resort run git command
|
||||
if not branch then
|
||||
local j = Job:new {
|
||||
command = "git",
|
||||
args = { "branch", "--show-current" },
|
||||
cwd = vim.fn.fnamemodify(buffer.name, ":h"),
|
||||
}
|
||||
wrap_fnc(opts, function(_, buffer)
|
||||
-- Try fugitive first as it's most reliable
|
||||
local branch = vim.g.loaded_fugitive == 1 and
|
||||
vim.fn.FugitiveHead() or nil
|
||||
-- buffer can be null and code will crash with:
|
||||
-- E5108: Error executing lua ... 'attempt to index a nil value'
|
||||
if not buffer or not (buffer.bufnr > 0) then
|
||||
return
|
||||
end
|
||||
-- fugitive is empty or not loaded, try gitsigns
|
||||
if not branch or #branch == 0 then
|
||||
local ok, res = pcall(vim.api.nvim_buf_get_var,
|
||||
buffer.bufnr, "gitsigns_head")
|
||||
if ok then branch = res end
|
||||
end
|
||||
-- last resort run git command
|
||||
if not branch then
|
||||
local j = job:new {
|
||||
command = "git",
|
||||
args = { "branch", "--show-current" },
|
||||
cwd = vim.fn.fnamemodify(buffer.name, ":h"),
|
||||
}
|
||||
|
||||
local ok, result = pcall(function()
|
||||
return vim.trim(j:sync()[1])
|
||||
end)
|
||||
if ok then
|
||||
branch = result
|
||||
end
|
||||
local ok, result = pcall(function()
|
||||
return vim.trim(j:sync()[1])
|
||||
end)
|
||||
if ok then
|
||||
branch = result
|
||||
end
|
||||
end
|
||||
|
||||
if branch and #branch > 0 then
|
||||
local fmt = opts.fmt or "%s %s"
|
||||
local icon = opts.icon or ""
|
||||
return set_hl(opts.hl, (fmt):format(icon, branch))
|
||||
end
|
||||
end))
|
||||
if branch and #branch > 0 then
|
||||
local fmt = opts.fmt or "%s %s"
|
||||
local icon = opts.icon or ""
|
||||
return set_hl(opts.hl, (fmt):format(icon, branch))
|
||||
end
|
||||
end))
|
||||
end
|
||||
|
||||
local git_changes_formatter = function(opts)
|
||||
local function git_changes_formatter(opts)
|
||||
local specs = {
|
||||
insert = {
|
||||
regex = "(%d+) insertions?",
|
||||
@ -198,24 +166,24 @@ local git_changes_formatter = function(opts)
|
||||
table.insert(result, set_hl(v.hl, ("%s%d"):format(v.icon, count)))
|
||||
end
|
||||
end
|
||||
return table.concat(result, ", ")
|
||||
return table.concat(result, " ")
|
||||
end
|
||||
end
|
||||
|
||||
-- requires gitsigns
|
||||
M.git_changes_buf = function(opts)
|
||||
function M.git_changes_buf(opts)
|
||||
opts = opts or {}
|
||||
local formatter = opts.formatter or git_changes_formatter(opts)
|
||||
return wrap_fnc(opts, function(window, buffer)
|
||||
local stats = {}
|
||||
if buffer and buffer.bufnr > 0 then
|
||||
local ok, res = pcall(vim.api.nvim_buf_get_var,
|
||||
buffer.bufnr, "vgit_status")
|
||||
buffer.bufnr, "vgit_status")
|
||||
if ok then stats = res end
|
||||
end
|
||||
if buffer and buffer.bufnr > 0 then
|
||||
local ok, res = pcall(vim.api.nvim_buf_get_var,
|
||||
buffer.bufnr, "gitsigns_status_dict")
|
||||
buffer.bufnr, "gitsigns_status_dict")
|
||||
if ok then stats = res end
|
||||
end
|
||||
local counts = {
|
||||
@ -235,82 +203,79 @@ M.git_changes_buf = function(opts)
|
||||
end)
|
||||
end
|
||||
|
||||
M.git_changes_all = function(opts)
|
||||
function M.git_changes_all(opts)
|
||||
opts = opts or {}
|
||||
local formatter = opts.formatter or git_changes_formatter(opts)
|
||||
return el_sub.buf_autocmd("el_git_changes", "BufWritePost",
|
||||
wrap_fnc(opts, function(window, buffer)
|
||||
if not buffer or
|
||||
not (buffer.bufnr > 0) or
|
||||
vim.bo[buffer.bufnr].bufhidden ~= "" or
|
||||
vim.bo[buffer.bufnr].buftype == "nofile" or
|
||||
vim.fn.filereadable(buffer.name) ~= 1 then
|
||||
return
|
||||
end
|
||||
wrap_fnc(opts, function(window, buffer)
|
||||
if not buffer or
|
||||
not (buffer.bufnr > 0) or
|
||||
vim.bo[buffer.bufnr].bufhidden ~= "" or
|
||||
vim.bo[buffer.bufnr].buftype == "nofile" or
|
||||
vim.fn.filereadable(buffer.name) ~= 1 then
|
||||
return
|
||||
end
|
||||
|
||||
local j = Job:new {
|
||||
command = "git",
|
||||
args = { "diff", "--shortstat" },
|
||||
-- makes no sense to run for one file as
|
||||
-- 'file(s) changed' will always be 1
|
||||
-- args = { "diff", "--shortstat", buffer.name },
|
||||
cwd = vim.fn.fnamemodify(buffer.name, ":h"),
|
||||
}
|
||||
local j = job:new {
|
||||
command = "git",
|
||||
args = { "diff", "--shortstat" },
|
||||
-- makes no sense to run for one file as
|
||||
-- 'file(s) changed' will always be 1
|
||||
-- args = { "diff", "--shortstat", buffer.name },
|
||||
cwd = vim.fn.fnamemodify(buffer.name, ":h"),
|
||||
}
|
||||
|
||||
local ok, git_changes = pcall(function()
|
||||
return formatter(window, buffer, vim.trim(j:sync()[1]))
|
||||
end)
|
||||
local ok, git_changes = pcall(function()
|
||||
return formatter(window, buffer, vim.trim(j:sync()[1]))
|
||||
end)
|
||||
|
||||
if ok then
|
||||
local fmt = opts.fmt or "%s"
|
||||
return git_changes and fmt:format(git_changes) or nil
|
||||
end
|
||||
end))
|
||||
if ok then
|
||||
local fmt = opts.fmt or "%s"
|
||||
return git_changes and fmt:format(git_changes) or nil
|
||||
end
|
||||
end))
|
||||
end
|
||||
|
||||
local function lsp_srvname(bufnr)
|
||||
local buf_clients = vim.lsp.buf_get_clients(bufnr)
|
||||
function M.lsp_srvname(opts)
|
||||
local fmt = opts.fmt or "%s"
|
||||
local icon = opts.icon or ""
|
||||
local buf_clients = vim.lsp.buf_get_clients(0)
|
||||
if not buf_clients or #buf_clients == 0 then
|
||||
return nil
|
||||
return ""
|
||||
end
|
||||
local names = ""
|
||||
for i, c in ipairs(buf_clients) do
|
||||
if i > 1 then names = names .. ", " end
|
||||
names = names .. c.name
|
||||
end
|
||||
return names
|
||||
return icon..fmt:format(names)
|
||||
end
|
||||
|
||||
local function diag_formatter(opts)
|
||||
return function(_, buffer, counts)
|
||||
local items = {}
|
||||
local icons = {
|
||||
["errors"] = { opts.icon_err or "E", opts.hl_err },
|
||||
["warnings"] = { opts.icon_warn or "W", opts.hl_warn },
|
||||
["infos"] = { opts.icon_info or "I", opts.hl_info },
|
||||
["hints"] = { opts.icon_hint or "H", opts.hl_hint },
|
||||
["errors"] = { opts.icon_err or "x", opts.hl_err or "DiagnosticError"},
|
||||
["warnings"] = { opts.icon_warn or "!", opts.hl_warn or "DiagnosticWarn"},
|
||||
["infos"] = { opts.icon_info or "i", opts.hl_info or "DiagnosticInfo"},
|
||||
["hints"] = { opts.icon_hint or "h", opts.hl_hint or "DiagnosticHint"},
|
||||
}
|
||||
for _, k in ipairs({ "errors", "warnings", "infos", "hints" }) do
|
||||
if counts[k] > 0 then
|
||||
table.insert(items,
|
||||
set_hl(icons[k][2], ("%s:%s"):format(icons[k][1], counts[k])))
|
||||
set_hl(icons[k][2], ("%s:%s"):format(icons[k][1], counts[k])))
|
||||
end
|
||||
end
|
||||
local fmt = opts.fmt or "%s"
|
||||
local lsp_name = opts.lsp and lsp_srvname(buffer.bufnr)
|
||||
if not lsp_name and vim.tbl_isempty(items) then
|
||||
if vim.tbl_isempty(items) then
|
||||
return ""
|
||||
else
|
||||
local contents = lsp_name
|
||||
if not vim.tbl_isempty(items) then
|
||||
contents = ("%s %s"):format(lsp_name, table.concat(items, " "))
|
||||
end
|
||||
return fmt:format(contents)
|
||||
return fmt:format(table.concat(items, " "))
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
local get_buffer_counts = function(diagnostic, _, buffer)
|
||||
local function get_buffer_counts(diagnostic, _, buffer)
|
||||
local counts = { 0, 0, 0, 0 }
|
||||
local diags = diagnostic.get(buffer.bufnr)
|
||||
if diags and not vim.tbl_isempty(diags) then
|
||||
@ -328,13 +293,23 @@ local get_buffer_counts = function(diagnostic, _, buffer)
|
||||
}
|
||||
end
|
||||
|
||||
M.diagnostics = function(opts)
|
||||
function M.diagnostics(opts)
|
||||
opts = opts or {}
|
||||
local formatter = opts.formatter or diag_formatter(opts)
|
||||
return el_sub.buf_autocmd("el_buf_diagnostic", "LspAttach,DiagnosticChanged",
|
||||
wrap_fnc(opts, function(window, buffer)
|
||||
return formatter(window, buffer, get_buffer_counts(vim.diagnostic, window, buffer))
|
||||
end))
|
||||
wrap_fnc(opts, function(window, buffer)
|
||||
return formatter(window, buffer, get_buffer_counts(vim.diagnostic, window, buffer))
|
||||
end))
|
||||
end
|
||||
|
||||
function M.line(opts)
|
||||
opts = opts or {}
|
||||
local fmt = opts.fmt or "%s"
|
||||
return wrap_fnc(opts, function(_, _)
|
||||
local al = vim.api.nvim_buf_line_count(0)
|
||||
local cl = vim.api.nvim_win_get_cursor(0)[1]
|
||||
return (fmt):format(cl.."/"..al.." "..math.floor((cl / al) * 100).."%%")
|
||||
end)
|
||||
end
|
||||
|
||||
return M
|
||||
|
@ -2,7 +2,7 @@ local function auto(event, opts)
|
||||
a.nvim_create_autocmd(event, opts)
|
||||
end
|
||||
|
||||
a.nvim_create_augroup('bufcheck', {clear = true})
|
||||
a.nvim_create_augroup('bufcheck', { clear = true })
|
||||
|
||||
auto('TextYankPost', { -- highlight yanks
|
||||
group = 'bufcheck',
|
||||
@ -26,43 +26,6 @@ auto('BufRead', { -- return to last place
|
||||
desc = 'Return to the last place the buffer was closed in.',
|
||||
})
|
||||
|
||||
auto('TermOpen', { -- start terminal in insert mode
|
||||
group = 'bufcheck',
|
||||
pattern = '*',
|
||||
desc = 'Start terminal in insert mode.',
|
||||
callback = function()
|
||||
vim.cmd('startinsert | set winfixheight')
|
||||
o.winfixheight = true
|
||||
o.cmdheight = 0
|
||||
end
|
||||
})
|
||||
|
||||
auto('TermClose', { -- close terminal buffers after shell dies
|
||||
group = 'bufcheck',
|
||||
pattern = 'term://*',
|
||||
desc = 'Close terminal after shell dies.',
|
||||
callback = function()
|
||||
vim.cmd('call nvim_input("<CR>")')
|
||||
o.cmdheight = 1
|
||||
end
|
||||
})
|
||||
|
||||
auto('InsertEnter', { -- toggle things when entering insert mode
|
||||
group = 'bufcheck',
|
||||
desc = 'Turn things on insert mode.',
|
||||
callback = function()
|
||||
o.colorcolumn = { 80 }
|
||||
end
|
||||
})
|
||||
|
||||
auto('InsertLeave', { -- toggle things when exiting insert mode
|
||||
group = 'bufcheck',
|
||||
desc = 'Turn things off insert mode.',
|
||||
callback = function()
|
||||
o.colorcolumn = { 0 }
|
||||
end
|
||||
})
|
||||
|
||||
auto('BufWritePre', { -- make dirs when they don't exist
|
||||
pattern = '*',
|
||||
group = vim.api.nvim_create_augroup('auto_create_dir', { clear = true }),
|
||||
|
@ -9,17 +9,6 @@ local function map(mode, bind, cmd, opts)
|
||||
end
|
||||
elseif type(bind) == 'string' then
|
||||
vim.keymap.set(mode, bind, cmd, opts)
|
||||
else
|
||||
vim.notify('-- Invalid bind for keymap:\nvim.keymap.set(\''
|
||||
.. mode .. '\', ' .. bind .. ', \'' .. cmd .. '\')',
|
||||
vim.log.levels.WARN, {
|
||||
title = 'Neovim Config',
|
||||
on_open = function(win)
|
||||
local buf = vim.api.nvim_win_get_buf(win)
|
||||
vim.api.nvim_buf_set_option(buf, "filetype", "lua")
|
||||
end
|
||||
}
|
||||
)
|
||||
end
|
||||
end
|
||||
|
||||
@ -40,7 +29,7 @@ map('n', 'N', 'Nzzzv')
|
||||
map('n', '<C-d>', '<C-d>zz') -- half page jumping
|
||||
map('n', '<C-u>', '<C-u>zz')
|
||||
|
||||
map('n', '<leader>x', '<cmd>!chmod +x %<CR>') -- execute order 111
|
||||
map('n', '<leader>x', '<cmd>!chmod +x "%"<CR>') -- execute order 111
|
||||
|
||||
-- add some keybinds to the file view (netrw)
|
||||
a.nvim_create_autocmd('FileType', {
|
||||
@ -51,17 +40,17 @@ a.nvim_create_autocmd('FileType', {
|
||||
end
|
||||
bind('h', '-^') -- Go up a directory
|
||||
bind('l', '<CR>') -- Go down a directory / open a file
|
||||
bind('.', 'gh') -- Toggle dotfiles
|
||||
bind('.', 'gh') -- Toggle hidden files
|
||||
bind('P', '<C-w>z') -- Close preview window
|
||||
bind('<esc>', '<cmd>q<CR>') -- Close netrw
|
||||
end
|
||||
})
|
||||
|
||||
-- tabs
|
||||
map('n', '<C-q>n', '<cmd>tabnew<CR>')
|
||||
map('n', '<C-q>w', '<cmd>tabclose<CR>')
|
||||
map('n', '<C-q>h', '<cmd>tabprev<CR>')
|
||||
map('n', '<C-q>l', '<cmd>tabnext<CR>')
|
||||
map('n', '[]', '<cmd>tabnew<CR>')
|
||||
map('n', '][', '<cmd>tabc<CR>')
|
||||
map('n', '[[', '<cmd>tabp<CR>')
|
||||
map('n', ']]', '<cmd>tabN<CR>')
|
||||
|
||||
-- plugin binds ---------------------------------------------------------------
|
||||
|
||||
@ -78,22 +67,41 @@ end
|
||||
|
||||
if pcall(require, "telescope") then
|
||||
local telebuilt = require('telescope.builtin') -- telescope
|
||||
-- local telexten = require('telescope').extensions
|
||||
map('n', '<leader>sf', telebuilt.find_files, { desc = 'Find files.' })
|
||||
map('n', '<leader>sg', telebuilt.git_files, { desc = 'Find git files.' })
|
||||
map('n', '<leader>sp', function()
|
||||
telebuilt.grep_string({ search = vim.fn.input(
|
||||
'Find string in project > '
|
||||
) })
|
||||
end, { desc = 'Find string in project.' })
|
||||
map('n', '<leader>so', telebuilt.oldfiles, { desc = 'Find old files.' })
|
||||
map('n', '<leader>sg', telebuilt.git_files, { desc = 'Find git files.' })
|
||||
-- search urls in buffer
|
||||
map('n', '<leader>su', '<Cmd>UrlView<CR>', { desc = 'Find urls in buffer.' })
|
||||
-- search lsp symbols
|
||||
map('n', '<leader>ss', telebuilt.lsp_document_symbols,
|
||||
{ desc = 'Find LSP Symbols.' })
|
||||
-- search for keybinds
|
||||
map('n', '<leader>sk', telebuilt.keymaps,
|
||||
{ desc = 'Find nvim Highlights.' })
|
||||
-- search for highlights
|
||||
map('n', '<leader>sh', telebuilt.highlights,
|
||||
{ desc = 'Find nvim Highlights.' })
|
||||
-- search for autocommands
|
||||
map('n', '<leader>sa', telebuilt.autocommands,
|
||||
{ desc = 'Find nvim Autocommands.' })
|
||||
-- search for vim options
|
||||
map('n', '<leader>sv', telebuilt.vim_options, { desc = 'Find vim options.' })
|
||||
-- search for string in project
|
||||
map('n', '<leader>sp', function()
|
||||
telebuilt.grep_string({ search = vim.fn.input('Find string in project > ')})
|
||||
end, { desc = 'Find string in project.' })
|
||||
-- Code Actions (requires telescope)
|
||||
if pcall(require, "actions-preview") then
|
||||
map({ "n", "v" }, "<leader>ca", require("actions-preview").code_actions, {
|
||||
desc = 'preview code actions'
|
||||
})
|
||||
end
|
||||
end
|
||||
|
||||
map('n', '<leader>u', '<cmd>UndotreeToggle<CR>', { desc = 'Open undo tree.' })
|
||||
map('n', '<leader>f', '<cmd>SFMToggle<CR>', { desc = 'Open file tree view.' })
|
||||
map('n', '<leader>b', '<cmd>JABSOpen<CR>', { desc = 'Switch between buffers.' })
|
||||
map('n', '<leader>tt', '<cmd>TroubleToggle<CR>', { desc = 'Diagnostic list.' })
|
||||
map('n', '<leader>tc', '<cmd>TodoTrouble<CR>', { desc = 'Comment list.' })
|
||||
map('n', '<C-e>', '<cmd>IconPickerYank<CR>', { desc = 'Icon picker list.' })
|
||||
|
||||
if pcall(require, "dapui") then
|
||||
local dapui = require('dapui') -- dap ui
|
||||
@ -122,14 +130,38 @@ if pcall(require, "true-zen") then
|
||||
})
|
||||
end
|
||||
|
||||
-- Git
|
||||
map('n', '<leader>gph', '<cmd>Gitsigns preview_hunk_inline<CR>')
|
||||
map('n', '<leader>gsh', '<cmd>Gitsigns stage_hunk<CR>')
|
||||
-- git
|
||||
map('n', '<leader>gp', '<cmd>Gitsigns preview_hunk_inline<CR>')
|
||||
map('n', '<leader>gs', '<cmd>Gitsigns stage_hunk<CR>')
|
||||
map('n', '<leader>gb', '<cmd>Gitsigns blame_line<CR>')
|
||||
map('n', '<leader>g]', '<cmd>Gitsigns next_hunk<CR>')
|
||||
map('n', '<leader>g[', '<cmd>Gitsigns prev_hunk<CR>')
|
||||
|
||||
-- neogen
|
||||
if pcall(require, "neogen") then
|
||||
map('n', '<leader>df', require("neogen").generate, {
|
||||
desc = 'Generate anootations',
|
||||
desc = 'Generate anotations',
|
||||
})
|
||||
end
|
||||
|
||||
-- venn
|
||||
function _G.Toggle_venn()
|
||||
local venn_enabled = vim.inspect(vim.b.venn_enabled)
|
||||
if venn_enabled == "nil" then
|
||||
vim.b.venn_enabled = true
|
||||
vim.cmd([[setlocal ve=all]])
|
||||
-- draw a line on HJKL keystokes
|
||||
vim.api.nvim_buf_set_keymap(0, "n", "J", "<C-v>j:VBox<CR>", {noremap = true})
|
||||
vim.api.nvim_buf_set_keymap(0, "n", "K", "<C-v>k:VBox<CR>", {noremap = true})
|
||||
vim.api.nvim_buf_set_keymap(0, "n", "L", "<C-v>l:VBox<CR>", {noremap = true})
|
||||
vim.api.nvim_buf_set_keymap(0, "n", "H", "<C-v>h:VBox<CR>", {noremap = true})
|
||||
-- draw a box by pressing "f" with visual selection
|
||||
vim.api.nvim_buf_set_keymap(0, "v", "f", ":VBox<CR>", {noremap = true})
|
||||
else
|
||||
vim.cmd[[setlocal ve=]]
|
||||
vim.cmd[[mapclear <buffer>]]
|
||||
vim.b.venn_enabled = nil
|
||||
end
|
||||
end
|
||||
-- toggle keymappings for venn using <leader>v
|
||||
vim.api.nvim_set_keymap('n', '<leader>v', ":lua Toggle_venn()<CR>", { noremap = true})
|
||||
|
@ -3,4 +3,6 @@ local function cmd(name, exec, opts)
|
||||
vim.api.nvim_create_user_command(name, exec, opts)
|
||||
end
|
||||
|
||||
cmd('Colorscheme', 'Telescope colorscheme')
|
||||
cmd('Colorscheme', function()
|
||||
require('telescope.builtin').colorscheme()
|
||||
end)
|
||||
|
@ -1,6 +1,6 @@
|
||||
-- better ui ------------------------------------------------------------------
|
||||
if pcall(require, "notify") then vim.notify = require("notify") end
|
||||
-- o.colorcolumn = { 80 }
|
||||
o.colorcolumn = { 80 }
|
||||
|
||||
-- buffer
|
||||
o.scrolloff = 5
|
||||
@ -11,16 +11,13 @@ o.cursorline = true
|
||||
-- statusbar
|
||||
o.laststatus = 3
|
||||
o.cmdheight = 1
|
||||
if o.cmdheight == 0 then
|
||||
o.showcmdloc = 'statusline'
|
||||
end
|
||||
o.showmode = false -- stop vim from showing mode (we have a statusbar)
|
||||
|
||||
-- tabline
|
||||
o.showtabline = 2
|
||||
|
||||
-- status column
|
||||
o.signcolumn = 'yes:1' -- show gutter
|
||||
o.relativenumber = true
|
||||
o.number = true
|
||||
o.numberwidth = 2
|
||||
|
||||
-- indents + tabs
|
||||
local tabwidth = 2
|
||||
@ -38,7 +35,7 @@ vim.cmd('colorscheme mellow') -- mellow
|
||||
vim.cmd('colorscheme mellow+') -- some changes
|
||||
|
||||
-- better editing -------------------------------------------------------------
|
||||
o.clipboard = 'unnamedplus' -- system clipboard (on unix like)
|
||||
o.clipboard = 'unnamedplus' -- system clipboard
|
||||
|
||||
-- file saving ----------------------------------------------------------------
|
||||
o.swapfile = false
|
||||
|
@ -16,8 +16,9 @@ require 'dep' {
|
||||
-- { 'andweeb/presence.nvim' },
|
||||
|
||||
-- colorschemes -------------------------------------------------------------
|
||||
{ 'kvrohit/mellow.nvim' },
|
||||
{ 'rockerBOO/boo-colorscheme-nvim' },
|
||||
{ 'kvrohit/mellow.nvim',
|
||||
requires = 'nvim-treesitter/nvim-treesitter'
|
||||
},
|
||||
|
||||
-- ui -----------------------------------------------------------------------
|
||||
{ 'lukas-reineke/indent-blankline.nvim' }, -- indentation indicators
|
||||
@ -28,35 +29,41 @@ require 'dep' {
|
||||
},
|
||||
{ 'goolord/alpha-nvim' }, -- start page
|
||||
{ 'dinhhuy258/sfm.nvim', -- tree view
|
||||
requires = 'dinhhuy258/sfm-git.nvim',
|
||||
deps = 'dinhhuy258/sfm-git.nvim',
|
||||
},
|
||||
{ 'mrjones2014/smart-splits.nvim'}, -- buffer resizing
|
||||
{ 'axieax/urlview.nvim' }, -- view urls in current buffer
|
||||
{ 'matbme/JABS.nvim' }, -- buffer switcher
|
||||
{ 'ziontee113/icon-picker.nvim' }, -- icons
|
||||
{ 'petertriho/nvim-scrollbar' }, -- scrollbar
|
||||
-- { 'lewis6991/satellite.nvim' }, -- new scrollbar for nvim 0.10
|
||||
{ 'pocco81/true-zen.nvim' }, -- focus on the current thing
|
||||
{ 'tomiis4/Hypersonic.nvim' }, -- regex helper/displayer
|
||||
|
||||
{ 'lewis6991/cleanfold.nvim' }, -- nice fold line
|
||||
{ 'yaocccc/nvim-foldsign' }, -- fold sign in gutter
|
||||
|
||||
-- functional plugins -------------------------------------------------------
|
||||
{ 'lewis6991/gitsigns.nvim' },
|
||||
{ 'chentoast/marks.nvim' },
|
||||
{ 'pta2002/intellitab.nvim' },
|
||||
{ 'lewis6991/gitsigns.nvim' }, -- very helpful git things
|
||||
{ 'squibid/git-yodel', -- git cache diff preview when in commit buffer
|
||||
url = 'https://git.squi.bid/git-yodel'
|
||||
},
|
||||
{ 'chentoast/marks.nvim' }, -- marks in gutter
|
||||
{ 'pta2002/intellitab.nvim' }, -- better tabbing into indents
|
||||
{ 'mbbill/undotree' }, -- careful this one is written in vimscript
|
||||
{ 'dhruvasagar/vim-table-mode' }, -- same with this one
|
||||
{ 'windwp/nvim-autopairs' },
|
||||
{ 'numToStr/Comment.nvim' },
|
||||
{ 'numtostr/BufOnly.nvim' }, -- kill the other buffers with :BufOnly
|
||||
{ 'ahmedkhalf/project.nvim' }, -- cd into root of project
|
||||
{ 'akinsho/toggleterm.nvim' },
|
||||
{ 'chomosuke/term-edit.nvim' }, -- full vim keybinds in terminals
|
||||
{ 'akinsho/toggleterm.nvim' }, -- TODO: switch to tmux based popup terminal
|
||||
{ 'mrjones2014/smart-splits.nvim'}, -- buffer resizing
|
||||
|
||||
-- note taking --------------------------------------------------------------
|
||||
{ 'nvim-neorg/neorg' },
|
||||
{ 'nvim-neorg/neorg-telescope' },
|
||||
{ 'nvim-neorg/neorg',
|
||||
config = function()
|
||||
if package.loaded['nvim-treesitter'] then
|
||||
vim.cmd(':Neorg sync-parsers<CR>')
|
||||
end
|
||||
end,
|
||||
requires = {
|
||||
'nvim-lua/plenary.nvim',
|
||||
'nvim-treesitter/nvim-treesitter'
|
||||
},
|
||||
deps = 'nvim-neorg/neorg-telescope'
|
||||
},
|
||||
|
||||
{ 'jbyuki/venn.nvim' },
|
||||
|
||||
-- fzf ----------------------------------------------------------------------
|
||||
{ 'nvim-telescope/telescope.nvim',
|
||||
@ -64,19 +71,23 @@ require 'dep' {
|
||||
deps = {
|
||||
'nvim-telescope/telescope-file-browser.nvim',
|
||||
'nvim-telescope/telescope-ui-select.nvim',
|
||||
'AckslD/nvim-neoclip.lua',
|
||||
'nvim-telescope/telescope-symbols.nvim',
|
||||
'axieax/urlview.nvim',
|
||||
}
|
||||
},
|
||||
|
||||
-- treesitter + colorizing --------------------------------------------------
|
||||
{ 'nvim-treesitter/nvim-treesitter',
|
||||
deps = {
|
||||
{ 'm-demare/hlargs.nvim' },
|
||||
{ 'Wansmer/treesj' },
|
||||
{ 'nvim-treesitter/nvim-treesitter-context' },
|
||||
'm-demare/hlargs.nvim',
|
||||
'Wansmer/treesj',
|
||||
'nvim-treesitter/nvim-treesitter-context',
|
||||
}
|
||||
},
|
||||
{ 'NvChad/nvim-colorizer.lua' },
|
||||
{ 'folke/todo-comments.nvim',
|
||||
requires = 'nvim-lua/plenary.nvim',
|
||||
},
|
||||
|
||||
-- cmp ----------------------------------------------------------------------
|
||||
{ 'hrsh7th/nvim-cmp',
|
||||
@ -103,15 +114,16 @@ require 'dep' {
|
||||
{ 'j-hui/fidget.nvim', -- shows lsp progress
|
||||
branch = 'legacy',
|
||||
},
|
||||
{ 'folke/neodev.nvim' }, -- configure lua lsp for neovim
|
||||
|
||||
{ 'ray-x/lsp_signature.nvim' }, -- see information about the current function
|
||||
{ 'dnlhc/glance.nvim' }, -- diagnostic info at a glance
|
||||
{ 'aznhe21/actions-preview.nvim', -- codeactions
|
||||
requires = 'nvim-telescope/telescope.nvim'
|
||||
},
|
||||
|
||||
{ 'folke/trouble.nvim' },
|
||||
{ 'folke/todo-comments.nvim' },
|
||||
|
||||
{ 'danymat/neogen' }, -- generate lsp annotations
|
||||
{ 'danymat/neogen', -- generate lsp annotations
|
||||
requires = 'nvim-treesitter/nvim-treesitter'
|
||||
},
|
||||
|
||||
{ 'whynothugo/lsp_lines.nvim',
|
||||
url = 'https://git.sr.ht/~whynothugo/lsp_lines.nvim',
|
||||
@ -120,9 +132,11 @@ require 'dep' {
|
||||
-- dap + lsp + linter + formatter installer ---------------------------------
|
||||
{ 'williamboman/mason.nvim',
|
||||
deps = {
|
||||
{ 'WhoIsSethDaniel/mason-tool-installer.nvim' },
|
||||
{ 'williamboman/mason-lspconfig.nvim' },
|
||||
{ 'jay-babu/mason-nvim-dap.nvim' },
|
||||
},
|
||||
'WhoIsSethDaniel/mason-tool-installer.nvim',
|
||||
'williamboman/mason-lspconfig.nvim',
|
||||
}
|
||||
},
|
||||
{ 'mfussenegger/nvim-dap',
|
||||
deps = 'rcarriga/nvim-dap-ui'
|
||||
},
|
||||
}
|
||||
|
Reference in New Issue
Block a user