Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ayamir main #30

Merged
merged 13 commits into from
Oct 31, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
482 changes: 97 additions & 385 deletions lazy-lock.json

Large diffs are not rendered by default.

25 changes: 11 additions & 14 deletions lua/core/init.lua
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
local settings = require("core.settings")
local global = require("core.global")

-- Create cache dir and data dirs
Expand Down Expand Up @@ -77,18 +78,15 @@ local leader_map = function()
vim.api.nvim_set_keymap("x", " ", "", { noremap = true })
end

local gui_config = function()
vim.api.nvim_set_option_value("guifont", settings.gui_config.font_name .. ":h" .. settings.gui_config.font_size, {})
end

local neovide_config = function()
vim.api.nvim_set_option_value("guifont", "Hack:h15", {})
vim.g.neovide_refresh_rate = 120
vim.g.neovide_cursor_vfx_mode = "railgun"
vim.g.neovide_no_idle = true
vim.g.neovide_cursor_animation_length = 0.03
vim.g.neovide_cursor_trail_length = 0.05
vim.g.neovide_cursor_antialiasing = true
vim.g.neovide_cursor_vfx_opacity = 200.0
vim.g.neovide_cursor_vfx_particle_lifetime = 1.2
vim.g.neovide_cursor_vfx_particle_speed = 20.0
vim.g.neovide_cursor_vfx_particle_density = 5.0
for name, config in ipairs(settings.neovide_config) do
vim.g["neovide_" .. name] = config
end
end

local dashboard_config = function()
Expand Down Expand Up @@ -213,6 +211,7 @@ local load_core = function()
disable_distribution_plugins()
leader_map()

gui_config()
neovide_config()
clipboard_config()
shell_config()
Expand All @@ -223,10 +222,8 @@ local load_core = function()
require("core.event")
require("core.pack")

-- vim.api.nvim_command([[set background=light]])
vim.api.nvim_command([[colorscheme catppuccin]])
local colorscheme = require("core.settings").colorscheme
local background = require("core.settings").background
local colorscheme = settings.colorscheme
local background = settings.background
vim.api.nvim_command("set background=" .. background)
vim.api.nvim_command("colorscheme " .. colorscheme)
vim.api.nvim_command("set modelines=" .. 0)
Expand Down
2 changes: 1 addition & 1 deletion lua/core/options.lua
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ local function load_options()
wildignorecase = true,
-- Do NOT adjust the following option (winblend) if you're using transparent background
winblend = 0,
winminwidth = 1,
winminwidth = 5,
winwidth = 30,
wrap = false,
wrapscan = true,
Expand Down
26 changes: 26 additions & 0 deletions lua/core/settings.lua
Original file line number Diff line number Diff line change
Expand Up @@ -161,4 +161,30 @@ settings["treesitter_deps"] = {
"yaml",
}

-- Set the options for neovim's gui clients like `neovide` and `neovim-qt` here.
-- NOTE: Currently, only the following options related to the GUI are supported. Other entries will be IGNORED.
---@type { font_name: string, font_size: number }
settings["gui_config"] = {
font_name = "JetBrainsMono Nerd Font",
font_size = 12,
}

-- Set the options specific to `neovide` here.
-- NOTE: You should remove the `neovide_` prefix (with trailing underscore) from all your entries below.
-- Check the below link for all supported entries:
-- https://neovide.dev/configuration.html
---@type table<string, boolean|number|string>
settings["neovide_config"] = {
no_idle = true,
refresh_rate = 120,
cursor_vfx_mode = "railgun",
cursor_vfx_opacity = 200.0,
cursor_antialiasing = true,
cursor_trail_length = 0.05,
cursor_animation_length = 0.03,
cursor_vfx_particle_speed = 20.0,
cursor_vfx_particle_density = 5.0,
cursor_vfx_particle_lifetime = 1.2,
}

return require("modules.utils").extend_config(settings, "user.settings")
47 changes: 33 additions & 14 deletions lua/keymap/completion.lua
Original file line number Diff line number Diff line change
Expand Up @@ -13,26 +13,45 @@ local mapping = {}
function mapping.lsp(buf)
local map = {
-- LSP-related keymaps, ONLY effective in buffers with LSP(s) attached
["n|<leader>li"] = map_cr("LspInfo"):with_buffer(buf):with_desc("lsp: Info"),
["n|<leader>lr"] = map_cr("LspRestart"):with_buffer(buf):with_nowait():with_desc("lsp: Restart"),
["n|go"] = map_cr("SymbolsOutline"):with_buffer(buf):with_desc("lsp: Toggle outline"),
["n|g["] = map_cr("Lspsaga diagnostic_jump_prev"):with_buffer(buf):with_desc("lsp: Prev diagnostic"),
["n|g]"] = map_cr("Lspsaga diagnostic_jump_next"):with_buffer(buf):with_desc("lsp: Next diagnostic"),
["n|<leader>li"] = map_cr("LspInfo"):with_silent():with_buffer(buf):with_desc("lsp: Info"),
["n|<leader>lr"] = map_cr("LspRestart"):with_silent():with_buffer(buf):with_nowait():with_desc("lsp: Restart"),
["n|go"] = map_cr("SymbolsOutline"):with_silent():with_buffer(buf):with_desc("lsp: Toggle outline"),
["n|g["] = map_cr("Lspsaga diagnostic_jump_prev")
:with_silent()
:with_buffer(buf)
:with_desc("lsp: Prev diagnostic"),
["n|g]"] = map_cr("Lspsaga diagnostic_jump_next")
:with_silent()
:with_buffer(buf)
:with_desc("lsp: Next diagnostic"),
["n|<leader>ld"] = map_cr("Lspsaga show_line_diagnostics ++unfocus")
:with_silent()
:with_buffer(buf)
:with_desc("lsp: Line diagnostic"),
["n|gs"] = map_callback(function()
vim.lsp.buf.signature_help()
end):with_desc("lsp: Signature help"),
["n|gr"] = map_cr("Lspsaga rename"):with_buffer(buf):with_desc("lsp: Rename in file range"),
["n|gR"] = map_cr("Lspsaga rename ++project"):with_buffer(buf):with_desc("lsp: Rename in project range"),
["n|K"] = map_cr("Lspsaga hover_doc"):with_buffer(buf):with_desc("lsp: Show doc"),
["nv|ga"] = map_cr("Lspsaga code_action"):with_buffer(buf):with_desc("lsp: Code action for cursor"),
["n|gd"] = map_cr("Glance definitions"):with_buffer(buf):with_desc("lsp: Preview definition"),
["n|gD"] = map_cr("Lspsaga goto_definition"):with_buffer(buf):with_desc("lsp: Goto definition"),
["n|gh"] = map_cr("Glance references"):with_buffer(buf):with_desc("lsp: Show reference"),
["n|<leader>ci"] = map_cr("Lspsaga incoming_calls"):with_buffer(buf):with_desc("lsp: Show incoming calls"),
["n|<leader>co"] = map_cr("Lspsaga outgoing_calls"):with_buffer(buf):with_desc("lsp: Show outgoing calls"),
["n|gr"] = map_cr("Lspsaga rename"):with_silent():with_buffer(buf):with_desc("lsp: Rename in file range"),
["n|gR"] = map_cr("Lspsaga rename ++project")
:with_silent()
:with_buffer(buf)
:with_desc("lsp: Rename in project range"),
["n|K"] = map_cr("Lspsaga hover_doc"):with_silent():with_buffer(buf):with_desc("lsp: Show doc"),
["nv|ga"] = map_cr("Lspsaga code_action")
:with_silent()
:with_buffer(buf)
:with_desc("lsp: Code action for cursor"),
["n|gd"] = map_cr("Glance definitions"):with_silent():with_buffer(buf):with_desc("lsp: Preview definition"),
["n|gD"] = map_cr("Lspsaga goto_definition"):with_silent():with_buffer(buf):with_desc("lsp: Goto definition"),
["n|gh"] = map_cr("Glance references"):with_silent():with_buffer(buf):with_desc("lsp: Show reference"),
["n|<leader>ci"] = map_cr("Lspsaga incoming_calls")
:with_silent()
:with_buffer(buf)
:with_desc("lsp: Show incoming calls"),
["n|<leader>co"] = map_cr("Lspsaga outgoing_calls")
:with_silent()
:with_buffer(buf)
:with_desc("lsp: Show outgoing calls"),
}
bind.nvim_load_mapping(map)

Expand Down
91 changes: 51 additions & 40 deletions lua/modules/configs/ui/lualine.lua
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
return function()
local has_catppuccin = vim.g.colors_name:find("catppuccin") ~= nil
local colors = require("modules.utils").get_palette()
local icons = {
diagnostics = require("modules.utils.icons").get("diagnostics", true),
Expand All @@ -13,39 +14,44 @@ return function()
group = vim.api.nvim_create_augroup("LualineColorScheme", { clear = true }),
pattern = "*",
callback = function()
has_catppuccin = vim.g.colors_name:find("catppuccin") ~= nil
require("lualine").setup({ options = { theme = custom_theme() } })
end,
})

colors = require("modules.utils").get_palette()
local universal_bg = require("core.settings").transparent_background and "NONE" or colors.mantle
return {
normal = {
a = { fg = colors.lavender, bg = colors.surface0, gui = "bold" },
b = { fg = colors.text, bg = universal_bg },
c = { fg = colors.text, bg = universal_bg },
},
command = {
a = { fg = colors.peach, bg = colors.surface0, gui = "bold" },
},
insert = {
a = { fg = colors.green, bg = colors.surface0, gui = "bold" },
},
visual = {
a = { fg = colors.flamingo, bg = colors.surface0, gui = "bold" },
},
terminal = {
a = { fg = colors.teal, bg = colors.surface0, gui = "bold" },
},
replace = {
a = { fg = colors.red, bg = colors.surface0, gui = "bold" },
},
inactive = {
a = { fg = colors.subtext0, bg = universal_bg, gui = "bold" },
b = { fg = colors.subtext0, bg = universal_bg },
c = { fg = colors.subtext0, bg = universal_bg },
},
}
if has_catppuccin then
colors = require("modules.utils").get_palette()
local universal_bg = require("core.settings").transparent_background and "NONE" or colors.mantle
return {
normal = {
a = { fg = colors.lavender, bg = colors.surface0, gui = "bold" },
b = { fg = colors.text, bg = universal_bg },
c = { fg = colors.text, bg = universal_bg },
},
command = {
a = { fg = colors.peach, bg = colors.surface0, gui = "bold" },
},
insert = {
a = { fg = colors.green, bg = colors.surface0, gui = "bold" },
},
visual = {
a = { fg = colors.flamingo, bg = colors.surface0, gui = "bold" },
},
terminal = {
a = { fg = colors.teal, bg = colors.surface0, gui = "bold" },
},
replace = {
a = { fg = colors.red, bg = colors.surface0, gui = "bold" },
},
inactive = {
a = { fg = colors.subtext0, bg = universal_bg, gui = "bold" },
b = { fg = colors.subtext0, bg = universal_bg },
c = { fg = colors.subtext0, bg = universal_bg },
},
}
else
return "auto"
end
end

local mini_sections = {
Expand Down Expand Up @@ -104,18 +110,23 @@ return function()
---@param special_nobg boolean @Disable guibg for transparent backgrounds?
---@param bg string? @Background hl group
---@param gui string? @GUI highlight arguments
---@return fun():lualine_hlgrp
---@return nil|fun():lualine_hlgrp
gen_hl = function(fg, gen_bg, special_nobg, bg, gui)
return function()
local guifg = colors[fg]
local guibg = gen_bg and require("modules.utils").hl_to_rgb("StatusLine", true, colors.mantle)
or colors[bg]
local nobg = special_nobg and require("core.settings").transparent_background
return {
fg = guifg and guifg or colors.none,
bg = (guibg and not nobg) and guibg or colors.none,
gui = gui and gui or nil,
}
if has_catppuccin then
return function()
local guifg = colors[fg]
local guibg = gen_bg and require("modules.utils").hl_to_rgb("StatusLine", true, colors.mantle)
or colors[bg]
local nobg = special_nobg and require("core.settings").transparent_background
return {
fg = guifg and guifg or colors.none,
bg = (guibg and not nobg) and guibg or colors.none,
gui = gui and gui or nil,
}
end
else
-- Return `nil` if the theme is user-defined
return nil
end
end,
}
Expand Down
2 changes: 1 addition & 1 deletion lua/modules/utils/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -260,7 +260,7 @@ local function tbl_recursive_merge(dst, src)
dst[key] = value(dst[key])
elseif type(dst[key]) == "table" and vim.tbl_islist(dst[key]) then
vim.list_extend(dst[key], value)
elseif type(dst[key]) == "table" and not vim.tbl_islist(dst[key]) then
elseif type(dst[key]) == "table" and type(value) == "table" and not vim.tbl_islist(dst[key]) then
tbl_recursive_merge(dst[key], value)
else
dst[key] = value
Expand Down
2 changes: 1 addition & 1 deletion scripts/install.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ function query_pack {
} else {
_abort -Msg "Required executable not found." -Type "NotInstalled" -Info_msg @'
You must install a modern package manager before installing this Nvim config.
Avaliable choices are:
Available choices are:
- Chocolatey
https://chocolatey.org/install#individual
¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
Expand Down