summaryrefslogtreecommitdiff
path: root/.config/nvim/lua/core
diff options
context:
space:
mode:
Diffstat (limited to '.config/nvim/lua/core')
-rw-r--r--.config/nvim/lua/core/autocmds.lua5
-rw-r--r--.config/nvim/lua/core/dashboard.lua3
-rw-r--r--.config/nvim/lua/core/info.lua325
-rw-r--r--.config/nvim/lua/core/log.lua66
-rw-r--r--.config/nvim/lua/core/lualine/components.lua53
-rw-r--r--.config/nvim/lua/core/lualine/conditions.lua10
-rw-r--r--.config/nvim/lua/core/lualine/styles.lua7
-rw-r--r--.config/nvim/lua/core/nvimtree.lua7
-rw-r--r--.config/nvim/lua/core/terminal.lua4
-rw-r--r--.config/nvim/lua/core/which-key.lua23
10 files changed, 273 insertions, 230 deletions
diff --git a/.config/nvim/lua/core/autocmds.lua b/.config/nvim/lua/core/autocmds.lua
index 036cc80..3432e14 100644
--- a/.config/nvim/lua/core/autocmds.lua
+++ b/.config/nvim/lua/core/autocmds.lua
@@ -9,6 +9,11 @@ options.autocommands = {
"lua require('utils.ft').do_filetype(vim.fn.expand(\"<amatch>\"))",
},
{
+ "FileType",
+ "qf",
+ "nnoremap <silent> <buffer> q :q<CR>",
+ },
+ {
"TextYankPost",
"*",
"lua require('vim.highlight').on_yank({higroup = 'Search', timeout = 200})",
diff --git a/.config/nvim/lua/core/dashboard.lua b/.config/nvim/lua/core/dashboard.lua
index f9eec22..70e862e 100644
--- a/.config/nvim/lua/core/dashboard.lua
+++ b/.config/nvim/lua/core/dashboard.lua
@@ -1,4 +1,5 @@
local M = {}
+local home_dir = vim.loop.os_homedir()
M.config = function(config)
options.builtin.dashboard = {
@@ -6,7 +7,7 @@ M.config = function(config)
on_config_done = nil,
search_handler = "telescope",
disable_at_vim_enter = 0,
- session_directory = os.getenv "HOME" .. "/.cache/options/sessions",
+ session_directory = home_dir .. "/.cache/options/sessions",
custom_header = {
" ##############..... ############## ",
" ##############......############## ",
diff --git a/.config/nvim/lua/core/info.lua b/.config/nvim/lua/core/info.lua
index 5b7ef53..83e3542 100644
--- a/.config/nvim/lua/core/info.lua
+++ b/.config/nvim/lua/core/info.lua
@@ -1,208 +1,201 @@
-local M = {}
-local u = require "utils"
-local null_ls_handler = require "lsp.null-ls"
-local indent = " "
-
-M.banner = {
- "",
- "",
- " ⠀⠀⠀ ⠀⠀ ⣺⡿⠀⠀⠀⠀⠀⠀⠀ ⠀⠀⠀",
- " ⣿⣯ ⣿⡟⠀ ⣤⣤⠀⠀⠀⠀⣠⣤⣤⣤⣄⣤⣤",
- "⠀⣿⣿⠀⣰⡟⠀⠀⠀⠀⠀⢸⣿⠀⠀⠀⠀⣿⡟⢸⣿⡇⢀⣿",
- "⠀⢻⣿⢰⣿⠀⠀⠀⠀⠀⠀⣾⡇⠀⠀⠀⢸⣿⠇⢸⣿⠀⢸⡏",
- "⠀⢸⣿⣿⠋⠀⠀⠀⢠⣤⣤⣿⣥⣤⡄⠀⣼⣿⠀⣸⡏⠀⣿⠃",
- "⠀⠈⠉⠉⠀⠀⠀⠀⠈⠉⠉⠉⠉⠉⠁⠀⠉⠁⠀⠉⠁⠀⠉⠀",
- "",
- "",
+local M = {
+ banner = {
+ "",
+ [[ _ ___ ]],
+ [[| | / (_)___ ___ ]],
+ [[| | / / / __ `__ \]],
+ [[| |/ / / / / / / /]],
+ [[|___/_/_/ /_/ /_/ ]],
+ },
}
+local fmt = string.format
+
local function str_list(list)
- return "[ " .. table.concat(list, ", ") .. " ]"
+ return fmt("[ %s ]", table.concat(list, ", "))
end
local function get_formatter_suggestion_msg(ft)
- local supported_formatters = u.get_supported_formatters_by_filetype(ft)
- return {
- "-------------------------------------------------------------------",
- "",
- "  HINT ",
- "",
- indent .. "* List of supported formatters: " .. str_list(supported_formatters),
- "",
- indent .. "You can enable a supported formatter by adding this to your config.lua",
- "",
- indent
- .. "options.lang."
- .. tostring(ft)
- .. [[.formatting = { { exe = ']]
- .. table.concat(supported_formatters, "|")
- .. [[' } }]],
+ local config = require "config"
+ local null_formatters = require "lsp.null-ls.formatters"
+ local supported_formatters = null_formatters.list_available(ft)
+ local section = {
+ " HINT ",
"",
- "-------------------------------------------------------------------",
+ fmt("* List of supported formatters: %s", str_list(supported_formatters)),
}
+
+ if not vim.tbl_isempty(supported_formatters) then
+ vim.list_extend(section, {
+ "* Configured formatter needs to be installed and executable.",
+ fmt("* Enable installed formatter(s) with following config in %s", config.path),
+ "",
+ fmt(
+ " options.lang.%s.formatters = { { exe = '%s' } }",
+ ft,
+ table.concat(supported_formatters, "│")
+ ),
+ })
+ end
+
+ return section
end
local function get_linter_suggestion_msg(ft)
- local supported_linters = u.get_supported_linters_by_filetype(ft)
- return {
- "-------------------------------------------------------------------",
- "",
- "  HINT ",
+ local config = require "config"
+ local null_linters = require "lsp.null-ls.linters"
+ local supported_linters = null_linters.list_available(ft)
+ local section = {
+ " HINT ",
"",
- indent .. "* List of supported linters: " .. str_list(supported_linters),
- "",
- indent .. "You can enable a supported linter by adding this to your config.lua",
- "",
- indent
- .. "options.lang."
- .. tostring(ft)
- .. [[.linters = { { exe = ']]
- .. table.concat(supported_linters, "|")
- .. [[' } }]],
- "",
- "-------------------------------------------------------------------",
+ fmt("* List of supported linters: %s", str_list(supported_linters)),
}
-end
----creates an average size popup
----@param buf_lines a list of lines to print
----@param callback could be used to set syntax highlighting rules for example
----@return bufnr buffer number of the created buffer
----@return win_id window ID of the created popup
-function M.create_simple_popup(buf_lines, callback)
- -- runtime/lua/vim/lsp/util.lua
- local bufnr = vim.api.nvim_create_buf(false, true)
- local height_percentage = 0.7
- local width_percentage = 0.8
- local row_start_percentage = (1 - height_percentage) / 2
- local col_start_percentage = (1 - width_percentage) / 2
- local opts = {}
- opts.relative = "editor"
- opts.height = math.ceil(vim.o.lines * height_percentage)
- opts.row = math.ceil(vim.o.lines * row_start_percentage)
- opts.col = math.floor(vim.o.columns * col_start_percentage)
- opts.width = math.floor(vim.o.columns * width_percentage)
- opts.border = {
- "┌",
- "-",
- "┐",
- "|",
- "┘",
- "-",
- "└",
- "|",
- }
+ if not vim.tbl_isempty(supported_linters) then
+ vim.list_extend(section, {
+ "* Configured linter needs to be installed and executable.",
+ fmt("* Enable installed linter(s) with following config in %s", config.path),
+ "",
+ fmt(
+ " options.lang.%s.linters = { { exe = '%s' } }",
+ ft,
+ table.concat(supported_linters, "│")
+ ),
+ })
+ end
- local win_id = vim.api.nvim_open_win(bufnr, true, opts)
-
- vim.api.nvim_win_set_buf(win_id, bufnr)
- -- this needs to be window option!
- vim.api.nvim_win_set_option(win_id, "number", false)
- vim.cmd "setlocal nocursorcolumn"
- vim.cmd "setlocal wrap"
- -- set buffer options
- vim.api.nvim_buf_set_option(bufnr, "filetype", "lspinfo")
- vim.lsp.util.close_preview_autocmd({ "BufHidden", "BufLeave" }, win_id)
- buf_lines = vim.lsp.util._trim(buf_lines, {})
- vim.api.nvim_buf_set_lines(bufnr, 0, -1, false, buf_lines)
- vim.api.nvim_buf_set_option(bufnr, "modifiable", false)
- if type(callback) == "function" then
- callback()
+ return section
+end
+
+local function tbl_set_highlight(terms, highlight_group)
+ for _, v in pairs(terms) do
+ vim.cmd('let m=matchadd("' .. highlight_group .. '", "' .. v .. "[ ,│']\")")
end
- return bufnr, win_id
end
function M.toggle_popup(ft)
- local client = u.get_active_client_by_ft(ft)
- local is_client_active = not client.is_stopped()
- local client_enabled_caps = require("lsp").get_ls_capabilities(client.id)
- local num_caps = vim.tbl_count(client_enabled_caps)
- local null_ls_providers = null_ls_handler.get_registered_providers_by_filetype(ft)
-
- local missing_linters = options.lang[ft].linters._failed_requests or {}
- local missing_formatters = options.lang[ft].formatters._failed_requests or {}
-
- local buf_lines = {}
- vim.list_extend(buf_lines, M.banner)
+ local lsp_utils = require "lsp.utils"
+ local client = lsp_utils.get_active_client_by_ft(ft)
+ local is_client_active = false
+ local client_enabled_caps = {}
+ local client_name = ""
+ local client_id = 0
+ local document_formatting = false
+ if client ~= nil then
+ is_client_active = not client.is_stopped()
+ client_enabled_caps = require("lsp").get_ls_capabilities(client.id)
+ client_name = client.name
+ client_id = client.id
+ document_formatting = client.resolved_capabilities.document_formatting
+ end
local header = {
- "Detected filetype is: " .. tostring(ft),
- "",
- "Treesitter active: " .. tostring(next(vim.treesitter.highlighter.active) ~= nil),
- "",
- "",
+ fmt("Detected filetype: %s", ft),
+ fmt(
+ "Treesitter active: %s",
+ tostring(next(vim.treesitter.highlighter.active) ~= nil)
+ ),
}
- vim.list_extend(buf_lines, header)
+ local text = require "interface.text"
local lsp_info = {
- "Associated language-server: " .. client.name,
- indent .. "* Active: " .. tostring(is_client_active) .. ", id: " .. tostring(
- client.id
- ),
- indent .. "* Formatting support: " .. tostring(
- client.resolved_capabilities.document_formatting
- ),
- indent .. "* Capabilities list: " .. table.concat(
- vim.list_slice(client_enabled_caps, 1, num_caps / 2),
- ", "
- ),
- indent .. indent .. indent .. table.concat(
- vim.list_slice(client_enabled_caps, ((num_caps / 2) + 1)),
- ", "
- ),
- "",
+ "Language Server Protocol (LSP) info",
+ fmt("* Associated server: %s", client_name),
+ fmt("* Active: %s (id: %d)", tostring(is_client_active), client_id),
+ fmt("* Supports formatting: %s", tostring(document_formatting)),
}
- vim.list_extend(buf_lines, lsp_info)
-
+ if not vim.tbl_isempty(client_enabled_caps) then
+ local caps_text = "* Capabilities list: "
+ local caps_text_len = caps_text:len()
+ local enabled_caps = text.format_table(client_enabled_caps, 3, " | ")
+ enabled_caps = text.shift_left(enabled_caps, caps_text_len)
+ enabled_caps[1] = fmt("%s%s", caps_text, enabled_caps[1]:sub(caps_text_len + 1))
+ vim.list_extend(lsp_info, enabled_caps)
+ end
+ local null_ls = require "lsp.null-ls"
+ local registered_providers = null_ls.list_supported_provider_names(ft)
+ local registered_count = vim.tbl_count(registered_providers)
local null_ls_info = {
- "Configured providers: " .. table.concat(null_ls_providers, "  , ") .. "  ",
- "",
+ "Formatters and linters",
+ fmt(
+ "* Configured providers: %s%s",
+ table.concat(registered_providers, "  , "),
+ registered_count > 0 and "  " or ""
+ ),
}
- vim.list_extend(buf_lines, null_ls_info)
- local missing_formatters_status
- if vim.tbl_count(missing_formatters) > 0 then
+ local null_formatters = require "lsp.null-ls.formatters"
+ local missing_formatters = null_formatters.list_unsupported_names(ft)
+ local missing_formatters_status = {}
+ if not vim.tbl_isempty(missing_formatters) then
missing_formatters_status = {
- "Missing formatters: " .. table.concat(missing_formatters, "  , ") .. "  ",
- "",
+ fmt(
+ "* Missing formatters: %s",
+ table.concat(missing_formatters, "  , ") .. "  "
+ ),
}
- vim.list_extend(buf_lines, missing_formatters_status)
end
- local missing_linters_status
- if vim.tbl_count(missing_linters) > 0 then
+ local null_linters = require "lsp.null-ls.linters"
+ local missing_linters = null_linters.list_unsupported_names(ft)
+ local missing_linters_status = {}
+ if not vim.tbl_isempty(missing_linters) then
missing_linters_status = {
- "Missing linters: " .. table.concat(missing_linters, "  , ") .. "  ",
- "",
+ fmt(
+ "* Missing linters: %s",
+ table.concat(missing_linters, "  , ") .. "  "
+ ),
}
- vim.list_extend(buf_lines, missing_linters_status)
end
- vim.list_extend(buf_lines, get_formatter_suggestion_msg(ft))
-
- vim.list_extend(buf_lines, get_linter_suggestion_msg(ft))
+ local content_provider = function(popup)
+ local content = {}
+
+ for _, section in ipairs {
+ M.banner,
+ { "" },
+ { "" },
+ header,
+ { "" },
+ lsp_info,
+ { "" },
+ null_ls_info,
+ missing_formatters_status,
+ missing_linters_status,
+ { "" },
+ { "" },
+ get_formatter_suggestion_msg(ft),
+ { "" },
+ { "" },
+ get_linter_suggestion_msg(ft),
+ } do
+ vim.list_extend(content, section)
+ end
+
+ return text.align(popup, content, 0.5)
+ end
local function set_syntax_hl()
- --TODO: highlighting is either inconsistent or not working :\
- vim.cmd("syntax match Identifier /filetype is: .*\\zs\\<" .. ft .. "\\>/")
- vim.cmd("syntax match Identifier /server: .*\\zs\\<" .. client.name .. "\\>/")
- vim.cmd(
- "syntax match Identifier /providers: .*\\zs\\<"
- .. table.concat(null_ls_providers, ", ")
- .. "\\>/"
- )
- vim.cmd(
- "syntax match Identifier /formatters: .*\\zs\\<"
- .. table.concat(missing_formatters, ", ")
- .. "\\>/"
- )
- vim.cmd(
- "syntax match Identifier /linters: .*\\zs\\<"
- .. table.concat(missing_linters, ", ")
- .. "\\>/"
- )
+ vim.cmd [[highlight NvimInfoIdentifier gui=bold]]
+ vim.cmd [[highlight link NvimInfoHeader Type]]
+ vim.cmd [[let m=matchadd("NvimInfoHeader", "Language Server Protocol (LSP) info")]]
+ vim.cmd [[let m=matchadd("NvimInfoHeader", "Formatters and linters")]]
+ vim.cmd('let m=matchadd("NvimInfoIdentifier", " ' .. ft .. '$")')
+ vim.cmd 'let m=matchadd("string", "true")'
+ vim.cmd 'let m=matchadd("error", "false")'
+ tbl_set_highlight(registered_providers, "NvimInfoIdentifier")
+ tbl_set_highlight(missing_formatters, "NvimInfoIdentifier")
+ tbl_set_highlight(missing_linters, "NvimInfoIdentifier")
+ vim.cmd('let m=matchadd("NvimInfoIdentifier", "' .. client_name .. '")')
end
- return M.create_simple_popup(buf_lines, set_syntax_hl)
+ local Popup = require("interface.popup"):new {
+ win_opts = { number = false },
+ buf_opts = { modifiable = false, filetype = "lspinfo" },
+ }
+ Popup:display(content_provider)
+ set_syntax_hl()
+
+ return Popup
end
return M
diff --git a/.config/nvim/lua/core/log.lua b/.config/nvim/lua/core/log.lua
index 35ba4be..bcc68e4 100644
--- a/.config/nvim/lua/core/log.lua
+++ b/.config/nvim/lua/core/log.lua
@@ -1,29 +1,59 @@
local Log = {}
---- Creates a log handle based on Plenary.log
----@param opts these are passed verbatim to Plenary.log
----@return log handle
-function Log:new(opts)
- local status_ok, _ = pcall(require, "plenary.log")
- if not status_ok then
- return nil
+--- Adds a log entry using Plenary.log
+---@param msg any
+---@param level string [same as vim.log.log_levels]
+function Log:add_entry(msg, level)
+ assert(type(level) == "string")
+ if self.__handle then
+ -- plenary uses lower-case log levels
+ self.__handle[level:lower()](msg)
end
+ local status_ok, plenary = pcall(require, "plenary")
+ if status_ok then
+ local default_opts = { plugin = "nvim", level = options.log.level }
+ local handle = plenary.log.new(default_opts)
+ handle[level:lower()](msg)
+ self.__handle = handle
+ end
+ -- don't do anything if plenary is not available
+end
- local obj = require("plenary.log").new(opts)
- local path = string.format("%s/%s.log", vim.api.nvim_call_function("stdpath", { "cache" }), opts.plugin)
+---Retrieves the path of the logfile
+---@return string path of the logfile
+function Log:get_path()
+ return string.format("%s/%s.log", vim.fn.stdpath "cache", "nvim")
+end
- obj.get_path = function()
- return path
- end
+---Add a log entry at TRACE level
+---@param msg any
+function Log:trace(msg)
+ self:add_entry(msg, "TRACE")
+end
+
+---Add a log entry at DEBUG level
+---@param msg any
+function Log:debug(msg)
+ self:add_entry(msg, "DEBUG")
+end
+
+---Add a log entry at INFO level
+---@param msg any
+function Log:info(msg)
+ self:add_entry(msg, "INFO")
+end
- return obj
+---Add a log entry at WARN level
+---@param msg any
+function Log:warn(msg)
+ self:add_entry(msg, "WARN")
end
---- Creates or retrieves a log handle for the default logfile
---- based on Plenary.log
----@return log handle
-function Log:get_default()
- return Log:new { plugin = "lunarvim", level = options.log.level }
+---Add a log entry at ERROR level
+---@param msg any
+function Log:error(msg)
+ self:add_entry(msg, "ERROR")
end
+setmetatable({}, Log)
return Log
diff --git a/.config/nvim/lua/core/lualine/components.lua b/.config/nvim/lua/core/lualine/components.lua
index 4777392..adae368 100644
--- a/.config/nvim/lua/core/lualine/components.lua
+++ b/.config/nvim/lua/core/lualine/components.lua
@@ -1,6 +1,17 @@
local conditions = require "core.lualine.conditions"
local colors = require "core.lualine.colors"
+local function diff_source()
+ local gitsigns = vim.b.gitsigns_status_dict
+ if gitsigns then
+ return {
+ added = gitsigns.added,
+ modified = gitsigns.changed,
+ removed = gitsigns.removed,
+ }
+ end
+end
+
return {
mode = {
function()
@@ -22,34 +33,29 @@ return {
end,
left_padding = 0,
right_padding = 0,
- condition = function()
- return true
- end,
+ condition = nil,
color = { fg = colors.fg, bg = colors.bg },
},
branch = {
- "branch",
+ "b:gitsigns_head",
icon = " ",
- condition = function()
- return conditions.hide_in_width() and conditions.check_git_workspace()
- end,
color = { gui = "bold", fg = colors.fg, bg = colors.bg },
+ condition = conditions.hide_in_width,
},
filename = {
"filename",
- condition = function()
- return true
- end,
color = { fg = colors.fg, bg = colors.bg },
+ condition = nil,
},
diff = {
"diff",
+ source = diff_source,
symbols = { added = "  ", modified = "柳", removed = " " },
color_added = { fg = colors.green },
color_modified = { fg = colors.yellow },
color_removed = { fg = colors.red },
- condition = conditions.hide_in_width,
color = {},
+ condition = nil,
},
python_env = {
function()
@@ -67,15 +73,15 @@ return {
end
return ""
end,
- condition = conditions.hide_in_width,
color = { fg = colors.green },
+ condition = conditions.hide_in_width,
},
diagnostics = {
"diagnostics",
sources = { "nvim_lsp" },
symbols = { error = " ", warn = " ", info = " ", hint = " " },
- condition = conditions.hide_in_width,
color = {},
+ condition = conditions.hide_in_width,
},
treesitter = {
function()
@@ -84,14 +90,17 @@ return {
end
return ""
end,
- condition = conditions.hide_in_width,
color = { fg = colors.green },
+ condition = conditions.hide_in_width,
},
lsp = {
function(msg)
- msg = msg or "LSP Inactive"
+ msg = msg or "LS Inactive"
local buf_clients = vim.lsp.buf_get_clients()
if next(buf_clients) == nil then
+ if type(msg) == "boolean" or #msg == 0 then
+ return "LS Inactive"
+ end
return msg
end
local buf_ft = vim.bo.filetype
@@ -120,18 +129,18 @@ return {
return table.concat(buf_client_names, ", ")
end,
icon = " ",
- condition = conditions.hide_in_width,
color = { fg = colors.fg, bg = colors.bg },
+ condition = conditions.hide_in_width,
},
location = {
"location",
- condition = conditions.hide_in_width,
color = { fg = colors.fg, bg = colors.bg },
+ condition = conditions.hide_in_width,
},
progress = {
"progress",
- condition = conditions.hide_in_width,
color = { fg = colors.fg, bg = colors.bg },
+ condition = conditions.hide_in_width,
},
spaces = {
function()
@@ -141,14 +150,14 @@ return {
end
return label .. vim.api.nvim_buf_get_option(0, "shiftwidth") .. " "
end,
- condition = conditions.hide_in_width,
color = {},
+ condition = conditions.hide_in_width,
},
encoding = {
"o:encoding",
upper = true,
- condition = conditions.hide_in_width,
color = { fg = colors.fg, bg = colors.bg },
+ condition = conditions.hide_in_width,
},
filetype = { "filetype", condition = conditions.hide_in_width, color = {} },
scrollbar = {
@@ -172,9 +181,7 @@ return {
end,
left_padding = 0,
right_padding = 0,
- condition = function()
- return true
- end,
+ condition = nil,
color = { fg = colors.yellow, bg = colors.bg },
},
}
diff --git a/.config/nvim/lua/core/lualine/conditions.lua b/.config/nvim/lua/core/lualine/conditions.lua
index 2d2d81e..3ee4fbb 100644
--- a/.config/nvim/lua/core/lualine/conditions.lua
+++ b/.config/nvim/lua/core/lualine/conditions.lua
@@ -7,11 +7,11 @@ local conditions = {
hide_in_width = function()
return vim.fn.winwidth(0) > window_width_limit
end,
- check_git_workspace = function()
- local filepath = vim.fn.expand "%:p:h"
- local gitdir = vim.fn.finddir(".git", filepath .. ";")
- return gitdir and #gitdir > 0 and #gitdir < #filepath
- end,
+ -- check_git_workspace = function()
+ -- local filepath = vim.fn.expand "%:p:h"
+ -- local gitdir = vim.fn.finddir(".git", filepath .. ";")
+ -- return gitdir and #gitdir > 0 and #gitdir < #filepath
+ -- end,
}
return conditions
diff --git a/.config/nvim/lua/core/lualine/styles.lua b/.config/nvim/lua/core/lualine/styles.lua
index 014ba81..e13e214 100644
--- a/.config/nvim/lua/core/lualine/styles.lua
+++ b/.config/nvim/lua/core/lualine/styles.lua
@@ -14,7 +14,7 @@ styles.clean = {
icons_enabled = true,
component_separators = "",
section_separators = "",
- disabled_filetypes = { "dashboard" },
+ disabled_filetypes = { "dashboard", "NvimTree", "Outline" },
},
sections = {
lualine_a = {
@@ -160,14 +160,13 @@ function M.get_style(style)
local style_keys = vim.tbl_keys(styles)
if not vim.tbl_contains(style_keys, style) then
local Log = require "core.log"
- local logger = Log:get_default()
- logger.error(
+ Log:error(
"Invalid lualine style",
string.format('"%s"', style),
"options are: ",
string.format('"%s"', table.concat(style_keys, '", "'))
)
- logger.info '"lvim" style is applied.'
+ Log:debug '"lvim" style is applied.'
style = "lvim"
end
diff --git a/.config/nvim/lua/core/nvimtree.lua b/.config/nvim/lua/core/nvimtree.lua
index c640583..1e764c7 100644
--- a/.config/nvim/lua/core/nvimtree.lua
+++ b/.config/nvim/lua/core/nvimtree.lua
@@ -15,7 +15,7 @@ function M.config()
tree_width = 30,
},
ignore = { ".git", "node_modules", ".cache" },
- auto_open = 1,
+ auto_open = 0,
auto_close = 1,
quit_on_open = 0,
follow = 1,
@@ -52,7 +52,7 @@ end
function M.setup()
local status_ok, nvim_tree_config = pcall(require, "nvim-tree.config")
if not status_ok then
- Log:get_default().error "Failed to load nvim-tree.config"
+ Log:error("Failed to load nvim-tree.config")
return
end
local g = vim.g
@@ -65,6 +65,9 @@ function M.setup()
if options.builtin.project.active then
vim.g.nvim_tree_update_cwd = 1
vim.g.nvim_tree_respect_buf_cwd = 1
+ vim.g.nvim_tree_disable_netrw = 0
+ vim.g.nvim_tree_hijack_netrw = 0
+ vim.g.netrw_banner = 0
end
local tree_cb = nvim_tree_config.nvim_tree_callback
diff --git a/.config/nvim/lua/core/terminal.lua b/.config/nvim/lua/core/terminal.lua
index 80dc9d0..01b7709 100644
--- a/.config/nvim/lua/core/terminal.lua
+++ b/.config/nvim/lua/core/terminal.lua
@@ -82,7 +82,7 @@ M._exec_toggle = function(exec)
local binary = M._split(exec)[1]
if vim.fn.executable(binary) ~= 1 then
local Log = require "core.log"
- Log:get_default().error("Unable to run executable " .. binary .. ". Please make sure it is installed properly.")
+ Log:error("Unable to run executable " .. binary .. ". Please make sure it is installed properly.")
return
end
local Terminal = require("toggleterm.terminal").Terminal
@@ -122,7 +122,7 @@ M.toggle_log_view = function(name)
local Terminal = require("toggleterm.terminal").Terminal
local log_view = Terminal:new(term_opts)
- -- require("core.log"):get_default().debug("term", vim.inspect(term_opts))
+ -- require("core.log"):debug("term", vim.inspect(term_opts))
log_view:toggle()
end
diff --git a/.config/nvim/lua/core/which-key.lua b/.config/nvim/lua/core/which-key.lua
index 7ea86a8..d4ef1a2 100644
--- a/.config/nvim/lua/core/which-key.lua
+++ b/.config/nvim/lua/core/which-key.lua
@@ -72,32 +72,33 @@ M.config = function()
["n"] = { "<cmd>nohlsearch<CR>", "No Highlight" },
b = {
name = "Buffers",
- j = { "<cmd>BufferPick<cr>", "jump to buffer" },
- f = { "<cmd>Telescope buffers<cr>", "Find buffer" },
- w = { "<cmd>BufferWipeout<cr>", "wipeout buffer" },
+ j = { "<cmd>BufferPick<cr>", "Jump" },
+ f = { "<cmd>Telescope buffers<cr>", "Find" },
+ b = { "<cmd>b#<cr>", "Previous" },
+ w = { "<cmd>BufferWipeout<cr>", "Wipeout" },
e = {
"<cmd>BufferCloseAllButCurrent<cr>",
- "close all but current buffer",
+ "Close all but current",
},
- h = { "<cmd>BufferCloseBuffersLeft<cr>", "close all buffers to the left" },
+ h = { "<cmd>BufferCloseBuffersLeft<cr>", "Close all to the left" },
l = {
"<cmd>BufferCloseBuffersRight<cr>",
- "close all BufferLines to the right",
+ "Close all to the right",
},
D = {
"<cmd>BufferOrderByDirectory<cr>",
- "sort BufferLines automatically by directory",
+ "Sort by directory",
},
L = {
"<cmd>BufferOrderByLanguage<cr>",
- "sort BufferLines automatically by language",
+ "Sort by language",
},
},
p = {
name = "Packer",
c = { "<cmd>PackerCompile<cr>", "Compile" },
i = { "<cmd>PackerInstall<cr>", "Install" },
- r = { "<cmd>lua require('utils').reload_lv_config()<cr>", "Reload" },
+ r = { "<cmd>lua require('utils').reload_config()<cr>", "Reload" },
s = { "<cmd>PackerSync<cr>", "Sync" },
S = { "<cmd>PackerStatus<cr>", "Status" },
u = { "<cmd>PackerUpdate<cr>", "Update" },
@@ -130,6 +131,10 @@ M.config = function()
"<cmd>Telescope git_bcommits<cr>",
"Checkout commit(for current file)",
},
+ d = {
+ "<cmd>Gitsigns diffthis HEAD<cr>",
+ "Git Diff",
+ },
},
l = {