mirror of
https://github.com/LunarVim/LunarVim.git
synced 2025-08-03 01:25:03 +02:00
more lazy load be careful
This commit is contained in:
parent
a247d69c82
commit
23c7fab3b4
7 changed files with 94 additions and 84 deletions
5
init.lua
5
init.lua
|
@ -4,9 +4,7 @@ vim.cmd("luafile " .. CONFIG_PATH .. "/lv-config.lua")
|
|||
require "settings"
|
||||
require "plugins"
|
||||
require "lv-utils"
|
||||
require "lv-galaxyline"
|
||||
require "lv-treesitter"
|
||||
require "lv-neoformat"
|
||||
if O.plugin.dashboard.active then
|
||||
require("lv-dashboard").config()
|
||||
end
|
||||
|
@ -16,5 +14,4 @@ end
|
|||
-- require "lsp.emmet-ls"
|
||||
-- end
|
||||
-- if O.lang.tailwindcss.active then
|
||||
-- require "lsp.tailwindcss-ls"
|
||||
-- end
|
||||
-- require "lsp.tailwind
|
||||
|
|
27
lua/lv-barbar/init.lua
Normal file
27
lua/lv-barbar/init.lua
Normal file
|
@ -0,0 +1,27 @@
|
|||
vim.api.nvim_set_keymap("n", "<TAB>", ":BufferNext<CR>", { noremap = true, silent = true })
|
||||
vim.api.nvim_set_keymap("n", "<S-TAB>", ":BufferPrevious<CR>", { noremap = true, silent = true })
|
||||
vim.api.nvim_set_keymap("n", "<S-x>", ":BufferClose<CR>", { noremap = true, silent = true })
|
||||
|
||||
O.user_which_key["b"] = {
|
||||
name = "Buffers",
|
||||
j = { "<cmd>BufferPick<cr>", "jump to buffer" },
|
||||
f = { "<cmd>Telescope buffers<cr>", "Find buffer" },
|
||||
w = { "<cmd>BufferWipeout<cr>", "wipeout buffer" },
|
||||
e = {
|
||||
"<cmd>BufferCloseAllButCurrent<cr>",
|
||||
"close all but current buffer",
|
||||
},
|
||||
h = { "<cmd>BufferCloseBuffersLeft<cr>", "close all buffers to the left" },
|
||||
l = {
|
||||
"<cmd>BufferCloseBuffersRight<cr>",
|
||||
"close all BufferLines to the right",
|
||||
},
|
||||
D = {
|
||||
"<cmd>BufferOrderByDirectory<cr>",
|
||||
"sort BufferLines automatically by directory",
|
||||
},
|
||||
L = {
|
||||
"<cmd>BufferOrderByLanguage<cr>",
|
||||
"sort BufferLines automatically by language",
|
||||
},
|
||||
}
|
|
@ -127,44 +127,48 @@ table.insert(gls.left, {
|
|||
})
|
||||
-- get output from shell command
|
||||
function os.capture(cmd, raw)
|
||||
local f = assert(io.popen(cmd, 'r'))
|
||||
local s = assert(f:read('*a'))
|
||||
local f = assert(io.popen(cmd, "r"))
|
||||
local s = assert(f:read "*a")
|
||||
f:close()
|
||||
if raw then return s end
|
||||
s = string.gsub(s, '^%s+', '')
|
||||
s = string.gsub(s, '%s+$', '')
|
||||
s = string.gsub(s, '[\n\r]+', ' ')
|
||||
if raw then
|
||||
return s
|
||||
end
|
||||
s = string.gsub(s, "^%s+", "")
|
||||
s = string.gsub(s, "%s+$", "")
|
||||
s = string.gsub(s, "[\n\r]+", " ")
|
||||
return s
|
||||
end
|
||||
-- cleanup virtual env
|
||||
function env_cleanup(venv)
|
||||
if string.find(venv, "/") then
|
||||
final_venv = venv
|
||||
for w in venv:gmatch("([^/]+)") do final_venv=w end
|
||||
venv = final_venv
|
||||
local function env_cleanup(venv)
|
||||
if string.find(venv, "/") then
|
||||
local final_venv = venv
|
||||
for w in venv:gmatch "([^/]+)" do
|
||||
final_venv = w
|
||||
end
|
||||
return venv
|
||||
end
|
||||
local PythonEnv = function ()
|
||||
if vim.bo.filetype == 'python' then
|
||||
venv = os.getenv('CONDA_DEFAULT_ENV')
|
||||
if venv ~= nil then
|
||||
return "🅒 " .. env_cleanup(venv)
|
||||
end
|
||||
venv = os.getenv('VIRTUAL_ENV')
|
||||
if venv ~= nil then
|
||||
return "🐍 " .. env_cleanup(venv)
|
||||
end
|
||||
return ''
|
||||
venv = final_venv
|
||||
end
|
||||
return ''
|
||||
return venv
|
||||
end
|
||||
local PythonEnv = function()
|
||||
if vim.bo.filetype == "python" then
|
||||
local venv = os.getenv "CONDA_DEFAULT_ENV"
|
||||
if venv ~= nil then
|
||||
return "🅒 (" .. env_cleanup(venv) .. ")"
|
||||
end
|
||||
venv = os.getenv "VIRTUAL_ENV"
|
||||
if venv ~= nil then
|
||||
return " (" .. env_cleanup(venv) .. ")"
|
||||
end
|
||||
return ""
|
||||
end
|
||||
return ""
|
||||
end
|
||||
table.insert(gls.left, {
|
||||
VirtualEnv = {
|
||||
provider = PythonEnv,
|
||||
highlight = {colors.green, colors.bg},
|
||||
event = 'BufEnter'
|
||||
}
|
||||
highlight = "StatusLineTreeSitter",
|
||||
event = "BufEnter",
|
||||
},
|
||||
})
|
||||
|
||||
table.insert(gls.right, {
|
||||
|
|
|
@ -74,7 +74,11 @@ lv_utils.define_augroups {
|
|||
},
|
||||
_auto_resize = {
|
||||
-- will cause split windows to be resized evenly if main window is resized
|
||||
{ "VimResized ", "*", "wincmd =" },
|
||||
{ "VimResized", "*", "wincmd =" },
|
||||
},
|
||||
_packer_compile = {
|
||||
-- will cause split windows to be resized evenly if main window is resized
|
||||
{ "BufWritePost", "plugins.lua", "PackerCompile" },
|
||||
},
|
||||
-- _fterm_lazygit = {
|
||||
-- -- will cause esc key to exit lazy git
|
||||
|
|
|
@ -2,6 +2,16 @@ vim.g.vimtex_compiler_method = "latexmk"
|
|||
vim.g.vimtex_view_method = "zathura"
|
||||
vim.g.vimtex_fold_enabled = 0
|
||||
|
||||
O.user_which_key["L"] = {
|
||||
name = "+Latex",
|
||||
c = { "<cmd>VimtexCompile<cr>", "Toggle Compilation Mode" },
|
||||
f = { "<cmd>call vimtex#fzf#run()<cr>", "Fzf Find" },
|
||||
i = { "<cmd>VimtexInfo<cr>", "Project Information" },
|
||||
s = { "<cmd>VimtexStop<cr>", "Stop Project Compilation" },
|
||||
t = { "<cmd>VimtexTocToggle<cr>", "Toggle Table Of Content" },
|
||||
v = { "<cmd>VimtexView<cr>", "View PDF" },
|
||||
}
|
||||
|
||||
-- Compile on initialization, cleanup on quit
|
||||
vim.api.nvim_exec(
|
||||
[[
|
||||
|
|
|
@ -101,29 +101,6 @@ local mappings = {
|
|||
["f"] = "Find File",
|
||||
["h"] = "No Highlight",
|
||||
[";"] = "Dashboard",
|
||||
b = {
|
||||
name = "Buffers",
|
||||
j = { "<cmd>BufferPick<cr>", "jump to buffer" },
|
||||
f = { "<cmd>Telescope buffers<cr>", "Find buffer" },
|
||||
w = { "<cmd>BufferWipeout<cr>", "wipeout buffer" },
|
||||
e = {
|
||||
"<cmd>BufferCloseAllButCurrent<cr>",
|
||||
"close all but current buffer",
|
||||
},
|
||||
h = { "<cmd>BufferCloseBuffersLeft<cr>", "close all buffers to the left" },
|
||||
l = {
|
||||
"<cmd>BufferCloseBuffersRight<cr>",
|
||||
"close all BufferLines to the right",
|
||||
},
|
||||
D = {
|
||||
"<cmd>BufferOrderByDirectory<cr>",
|
||||
"sort BufferLines automatically by directory",
|
||||
},
|
||||
L = {
|
||||
"<cmd>BufferOrderByLanguage<cr>",
|
||||
"sort BufferLines automatically by language",
|
||||
},
|
||||
},
|
||||
p = {
|
||||
name = "Packer",
|
||||
c = { "<cmd>PackerCompile<cr>", "Compile" },
|
||||
|
@ -161,6 +138,7 @@ local mappings = {
|
|||
"Checkout commit(for current file)",
|
||||
},
|
||||
},
|
||||
|
||||
l = {
|
||||
name = "LSP",
|
||||
a = { "<cmd>lua vim.lsp.buf.code_action()<cr>", "Code Action" },
|
||||
|
@ -187,6 +165,7 @@ local mappings = {
|
|||
"Workspace Symbols",
|
||||
},
|
||||
},
|
||||
|
||||
s = {
|
||||
name = "Search",
|
||||
b = { "<cmd>Telescope git_branches<cr>", "Checkout branch" },
|
||||
|
@ -198,11 +177,6 @@ local mappings = {
|
|||
R = { "<cmd>Telescope registers<cr>", "Registers" },
|
||||
t = { "<cmd>Telescope live_grep<cr>", "Text" },
|
||||
},
|
||||
S = {
|
||||
name = "Session",
|
||||
s = { "<cmd>SessionSave<cr>", "Save Session" },
|
||||
l = { "<cmd>SessionLoad<cr>", "Load Session" },
|
||||
},
|
||||
T = {
|
||||
name = "Treesitter",
|
||||
i = { ":TSConfigInfo<cr>", "Info" },
|
||||
|
@ -246,20 +220,6 @@ if O.plugin.telescope_project.active then
|
|||
mappings["P"] = "Projects"
|
||||
end
|
||||
|
||||
-- [";"] = "Dashboard",
|
||||
|
||||
if O.lang.latex.active then
|
||||
mappings["L"] = {
|
||||
name = "+Latex",
|
||||
c = { "<cmd>VimtexCompile<cr>", "Toggle Compilation Mode" },
|
||||
f = { "<cmd>call vimtex#fzf#run()<cr>", "Fzf Find" },
|
||||
i = { "<cmd>VimtexInfo<cr>", "Project Information" },
|
||||
s = { "<cmd>VimtexStop<cr>", "Stop Project Compilation" },
|
||||
t = { "<cmd>VimtexTocToggle<cr>", "Toggle Table Of Content" },
|
||||
v = { "<cmd>VimtexView<cr>", "View PDF" },
|
||||
}
|
||||
end
|
||||
|
||||
if O.lushmode then
|
||||
mappings["L"] = {
|
||||
name = "+Lush",
|
||||
|
|
|
@ -22,8 +22,6 @@ packer.init {
|
|||
},
|
||||
}
|
||||
|
||||
vim.cmd "autocmd BufWritePost plugins.lua PackerCompile"
|
||||
|
||||
return require("packer").startup(function(use)
|
||||
-- Packer can manage itself as an optional plugin
|
||||
use "wbthomason/packer.nvim"
|
||||
|
@ -57,7 +55,13 @@ return require("packer").startup(function(use)
|
|||
use { "nvim-treesitter/nvim-treesitter", run = ":TSUpdate" }
|
||||
|
||||
-- Neoformat
|
||||
use { "sbdchd/neoformat" }
|
||||
use {
|
||||
"sbdchd/neoformat",
|
||||
config = function()
|
||||
require "lv-neoformat"
|
||||
end,
|
||||
event = "BufRead",
|
||||
}
|
||||
|
||||
use {
|
||||
"kyazdani42/nvim-tree.lua",
|
||||
|
@ -118,16 +122,20 @@ return require("packer").startup(function(use)
|
|||
use { "kyazdani42/nvim-web-devicons" }
|
||||
|
||||
-- Status Line and Bufferline
|
||||
use { "glepnir/galaxyline.nvim" }
|
||||
use {
|
||||
"glepnir/galaxyline.nvim",
|
||||
config = function()
|
||||
require "lv-galaxyline"
|
||||
end,
|
||||
-- event = "VimEnter",
|
||||
}
|
||||
|
||||
use {
|
||||
"romgrk/barbar.nvim",
|
||||
config = function()
|
||||
vim.api.nvim_set_keymap("n", "<TAB>", ":BufferNext<CR>", { noremap = true, silent = true })
|
||||
vim.api.nvim_set_keymap("n", "<S-TAB>", ":BufferPrevious<CR>", { noremap = true, silent = true })
|
||||
vim.api.nvim_set_keymap("n", "<S-x>", ":BufferClose<CR>", { noremap = true, silent = true })
|
||||
require "lv-barbar"
|
||||
end,
|
||||
-- event = "BufRead",
|
||||
event = "BufWinEnter",
|
||||
}
|
||||
|
||||
-- Builtins, these do not load by default
|
||||
|
@ -156,7 +164,7 @@ return require("packer").startup(function(use)
|
|||
|
||||
use {
|
||||
"norcalli/nvim-colorizer.lua",
|
||||
event = "BufRead",
|
||||
event = "BufWinEnter",
|
||||
config = function()
|
||||
require "lv-colorizer"
|
||||
-- vim.cmd "ColorizerReloadAllBuffers"
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue