Skip to content

Commit

Permalink
Code improvements
Browse files Browse the repository at this point in the history
  • Loading branch information
lvim-tech committed Sep 8, 2022
1 parent b6a31f5 commit ca46af1
Show file tree
Hide file tree
Showing 5 changed files with 90 additions and 42 deletions.
39 changes: 39 additions & 0 deletions LVIM/modules/ui.org
Original file line number Diff line number Diff line change
Expand Up @@ -1070,6 +1070,45 @@
}
if vim.fn.has("nvim-0.8") == 1 then
heirline.setup(status_lines, win_bars)
vim.api.nvim_create_autocmd("User", {
pattern = "HeirlineInitWinbar",
callback = function(args)
local buf = args.buf
local buftype = vim.tbl_contains({
"nofile",
"prompt",
"help",
"quickfix",
}, vim.bo[buf].buftype)
local filetype = vim.tbl_contains({
"ctrlspace",
"ctrlspace_help",
"packer",
"undotree",
"diff",
"Outline",
"LvimHelper",
"floaterm",
"dashboard",
"vista",
"spectre_panel",
"DiffviewFiles",
"flutterToolsOutline",
"log",
"qf",
"dapui_scopes",
"dapui_breakpoints",
"dapui_stacks",
"dapui_watches",
"calendar",
"neo-tree",
"neo-tree-popup",
}, vim.bo[buf].filetype)
if buftype or filetype then
vim.opt_local.winbar = nil
end
end,
})
else
heirline.setup(status_lines)
end
Expand Down
41 changes: 0 additions & 41 deletions lua/configs/base/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -50,47 +50,6 @@ configs["base_events"] = function()
end,
group = group,
})
if vim.fn.has("nvim-0.8") == 1 then
vim.api.nvim_create_autocmd("User", {
pattern = "HeirlineInitWinbar",
callback = function(args)
local buf = args.buf
local buftype = vim.tbl_contains({
"nofile",
"prompt",
"help",
"quickfix",
}, vim.bo[buf].buftype)
local filetype = vim.tbl_contains({
"ctrlspace",
"ctrlspace_help",
"packer",
"undotree",
"diff",
"Outline",
"LvimHelper",
"floaterm",
"dashboard",
"vista",
"spectre_panel",
"DiffviewFiles",
"flutterToolsOutline",
"log",
"qf",
"dapui_scopes",
"dapui_breakpoints",
"dapui_stacks",
"dapui_watches",
"calendar",
"neo-tree",
"neo-tree-popup",
}, vim.bo[buf].filetype)
if buftype or filetype then
vim.opt_local.winbar = nil
end
end,
})
end
end

configs["base_languages"] = function()
Expand Down
4 changes: 3 additions & 1 deletion lua/configs/base/keymaps.lua
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,16 @@ local keymaps = {}
keymaps["normal"] = {
{ "<space><space>", ":CtrlSpace<CR>" }, -- CtrlSpace
{ "<F1>", ":TTOne<CR>" }, -- Toggleterm one open
{ "u", "u:ColorizerAttachToBuffer<CR>" }, -- Toggleterm one open
{ "<C-r>", "<C-r>:ColorizerAttachToBuffer<CR>" }, -- Toggleterm one open
{ "<F2>", ":TTTwo<CR>" }, -- Toggleterm two open
{ "<F3>", ":TTThree<CR>" }, -- Toggleterm three open
{ "<F4>", ":TTFloat<CR>" }, -- Toggleterm float open
{ "<F5>", ":UndotreeToggle<CR>" }, -- UndoTree toggle
{ "<F11>", ":LvimHelper<CR>" }, -- LvimHelper
{ "<Esc>", "<Esc>:noh<CR>:SnipClose<CR>" }, -- Remove highlight after search
{ "<C-c>n", ":enew<CR>" }, -- Create empty buffer
{ "<C-c>s", ":w<CR>:ColorizerAttachToBuffer<CR>" }, -- Save
{ "<C-c>s", ":w<CR>" }, -- Save
{ "<C-c>a", ":wa<CR>" }, -- Save all
{ "<C-c>e", ":qa!<CR>" }, -- Close all, exit nvim
{ "<C-c>x", "<C-w>c" }, -- Close current window
Expand Down
9 changes: 9 additions & 0 deletions lua/core/pack.lua
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,15 @@ function plugins.load_compile()
end
vim.cmd("command! PackerShowCurrentSnapshot lua require('core.pack').snapshot_current_show()")
vim.cmd("command! PackerChoiceSnapshotToRollback lua require('core.pack').snapshot_file_choice()")
local PackerHooks = vim.api.nvim_create_augroup("PackerHooks", { clear = true })
vim.api.nvim_create_autocmd("User", {
group = PackerHooks,
pattern = "PackerCompileDone",
callback = function()
vim.notify("Compile Done!", vim.log.levels.INFO, { title = "Packer" })
dofile(vim.env.MYVIMRC)
end,
})
end

return plugins
39 changes: 39 additions & 0 deletions lua/modules/base/configs/ui/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -948,6 +948,45 @@ function config.heirline_nvim()
}
if vim.fn.has("nvim-0.8") == 1 then
heirline.setup(status_lines, win_bars)
vim.api.nvim_create_autocmd("User", {
pattern = "HeirlineInitWinbar",
callback = function(args)
local buf = args.buf
local buftype = vim.tbl_contains({
"nofile",
"prompt",
"help",
"quickfix",
}, vim.bo[buf].buftype)
local filetype = vim.tbl_contains({
"ctrlspace",
"ctrlspace_help",
"packer",
"undotree",
"diff",
"Outline",
"LvimHelper",
"floaterm",
"dashboard",
"vista",
"spectre_panel",
"DiffviewFiles",
"flutterToolsOutline",
"log",
"qf",
"dapui_scopes",
"dapui_breakpoints",
"dapui_stacks",
"dapui_watches",
"calendar",
"neo-tree",
"neo-tree-popup",
}, vim.bo[buf].filetype)
if buftype or filetype then
vim.opt_local.winbar = nil
end
end,
})
else
heirline.setup(status_lines)
end
Expand Down

0 comments on commit ca46af1

Please sign in to comment.