Skip to content

Commit

Permalink
perf(mix): some opts
Browse files Browse the repository at this point in the history
  • Loading branch information
liubang committed Dec 9, 2023
1 parent 4a3bb21 commit d18eb8a
Show file tree
Hide file tree
Showing 7 changed files with 92 additions and 62 deletions.
31 changes: 31 additions & 0 deletions lua/lb/bootstrap.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
-- =====================================================================
--
-- bootstrap.lua -
--
-- Created by liubang on 2021/04/19 11:00
-- Last Modified: 2022/12/31 22:30
--
-- =====================================================================

local M = {}

M.echo = function(str)
vim.cmd("redraw")
vim.api.nvim_echo({ { str, "Bold" } }, true, {})
end

local function shell_call(args)
local output = fn.system(args)
assert(vim.v.shell_error == 0, "External call failed with error code: " .. vim.v.shell_error .. "\n" .. output)
end

M.lazy = function(install_path)
M.echo(" Installing lazy.nvim & plugins ...")
local repo = "https://github.com/folke/lazy.nvim.git"
shell_call({ "git", "clone", "--filter=blob:none", "--branch=stable", repo, install_path })
vim.opt.rtp:prepend(install_path)
end

return M

-- vim: fdm=marker fdl=0
4 changes: 0 additions & 4 deletions lua/lb/commands.lua
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,6 @@ vim.api.nvim_create_user_command("TrimWhiteSpace", function() -- {{{
require("lb.utils.util").trim_whitespace()
end, { nargs = 0 }) -- }}}

vim.api.nvim_create_user_command("P", function(obj) -- {{{
vim.pretty_print(vim.fn.luaeval(obj.args))
end, { nargs = 1 }) -- }}}

vim.api.nvim_create_user_command("DocUpdate", function() -- {{{
require("lb.utils.doc").update()
end, { nargs = 0 }) -- }}}
Expand Down
23 changes: 13 additions & 10 deletions lua/lb/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -11,16 +11,19 @@ vim.g.mapleader = " "
vim.g.maplocalleader = " "

require("lb.options") -- global options
require("lb.lazy") -- plugins spec

vim.api.nvim_create_autocmd("User", { -- {{{
group = vim.api.nvim_create_augroup("LazyVim", { clear = true }),
pattern = "VeryLazy",
callback = function()
require("lb.autocmd") -- events
require("lb.commands")
require("lb.mappings")
end,
}) -- }}}
local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim"

-- bootstrap lazy.nvim!
if not vim.loop.fs_stat(lazypath) then
require("lb.bootstrap").lazy(lazypath)
end

vim.opt.rtp:prepend(lazypath)

require("lb.plugins")
require("lb.autocmd")
require("lb.commands")
require("lb.mappings")

-- vim: fdm=marker fdl=0
39 changes: 18 additions & 21 deletions lua/lb/lazy.lua → lua/lb/plugins.lua
Original file line number Diff line number Diff line change
@@ -1,24 +1,11 @@
-- =====================================================================
--=====================================================================
--
-- lazy.lua -
-- plugins.lua -
--
-- Created by liubang on 2021/04/19 11:00
-- Last Modified: 2022/12/31 22:30
-- Created by liubang on 2023/12/09 22:41
-- Last Modified: 2023/12/09 22:41
--
-- =====================================================================

local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim"
if not vim.loop.fs_stat(lazypath) then
vim.fn.system({
"git",
"clone",
"--filter=blob:none",
"https://github.com/folke/lazy.nvim.git",
"--branch=stable",
lazypath,
})
end
vim.opt.rtp:prepend(lazypath)
--=====================================================================

require("lazy").setup({
spec = { import = "plugins" },
Expand All @@ -39,7 +26,15 @@ require("lazy").setup({
change_detection = {
enabled = false,
},
ui = { border = "single" },
ui = {
border = "single",
icons = {
ft = "",
lazy = "󰂠 ",
loaded = "",
not_loaded = "",
},
},
performance = { -- {{{
cache = {
enabled = true,
Expand All @@ -48,6 +43,7 @@ require("lazy").setup({
rtp = {
reset = true,
disabled_plugins = {
"2html_plugin",
"gzip",
"matchit",
"matchparen",
Expand All @@ -57,6 +53,9 @@ require("lazy").setup({
"tohtml",
"tutor",
"zipPlugin",
"syntax",
"vimball",
"vimballPlugin",
},
},
}, -- }}}
Expand All @@ -74,5 +73,3 @@ require("lazy").setup({
require = false,
},
})

-- vim: fdm=marker fdl=0
5 changes: 5 additions & 0 deletions lua/plugins/lsp/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,11 @@ return {
opts = {
ui = {
border = "single",
icons = {
package_pending = "",
package_installed = "󰄳 ",
package_uninstalled = "",
},
},
},
},
Expand Down
26 changes: 7 additions & 19 deletions lua/plugins/nvim_tree.lua
Original file line number Diff line number Diff line change
Expand Up @@ -38,17 +38,6 @@ return {
number = false,
relativenumber = false,
signcolumn = "yes",
float = {
enable = false,
open_win_config = {
relative = "editor",
border = "rounded",
width = 30,
height = 30,
row = 1,
col = 1,
},
},
},
on_attach = function(bufnr)
local api = require("nvim-tree.api")
Expand Down Expand Up @@ -91,6 +80,7 @@ return {
end)
end,
renderer = {
root_folder_label = false,
add_trailing = false,
group_empty = true,
highlight_git = true,
Expand All @@ -100,12 +90,6 @@ return {
symlink_destination = true,
indent_markers = {
enable = false,
icons = {
corner = "",
edge = "",
item = "",
none = " ",
},
},
icons = {
webdev_colors = true,
Expand All @@ -130,8 +114,12 @@ return {
},
folder = {
default = "",
open = "",
empty = "",
empty = "",
empty_open = "",
open = "",
symlink_open = "",
arrow_open = "",
arrow_closed = "",
},
},
},
Expand Down
26 changes: 18 additions & 8 deletions lua/plugins/telescope.lua
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,16 @@ function M.config()

telescope.setup({
defaults = { --{{{
vimgrep_arguments = {
"rg",
"-L",
"--color=never",
"--no-heading",
"--with-filename",
"--line-number",
"--column",
"--smart-case",
},
prompt_prefix = "",
selection_caret = "",
entry_prefix = " ",
Expand All @@ -65,15 +75,10 @@ function M.config()
use_less = true,
border = {},
preview = false,
path_display = { truncate = 3 },
path_display = { "truncate" },
winblend = 0,
layout_config = {
prompt_position = "top",
width = function(_, max_columns, _)
return math.min(max_columns, 120)
end,
height = function(_, _, max_lines)
return math.min(max_lines, 28)
end,
horizontal = {
prompt_position = "top",
mirror = false,
Expand All @@ -83,8 +88,13 @@ function M.config()
vertical = {
mirror = false,
},
width = 0.87,
height = 0.80,
preview_cutoff = 120,
},
cache = false,
file_sorter = require("telescope.sorters").get_fuzzy_file,
generic_sorter = require("telescope.sorters").get_generic_fuzzy_sorter,
file_ignore_patterns = { "node_modules" },
mappings = {
i = {
["<C-x>"] = false,
Expand Down

0 comments on commit d18eb8a

Please sign in to comment.