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

Add orgmode, replace nvimtree with oil, replace nvim-cmp with blink.cmp #84

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
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
79 changes: 79 additions & 0 deletions .config/cava/shaders/bar_spectrum.frag
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
#version 330

in vec2 fragCoord;
out vec4 fragColor;

// bar values. defaults to left channels first (low to high), then right (high to low).
uniform float bars[512];

uniform int bars_count; // number of bars (left + right) (configurable)
uniform int bar_width; // bar width (configurable), not used here
uniform int bar_spacing; // space bewteen bars (configurable)

uniform vec3 u_resolution; // window resolution

//colors, configurable in cava config file (r,g,b) (0.0 - 1.0)
uniform vec3 bg_color; // background color
uniform vec3 fg_color; // foreground color

uniform int gradient_count;
uniform vec3 gradient_colors[8]; // gradient colors

vec3 normalize_C(float y,vec3 col_1, vec3 col_2, float y_min, float y_max)
{
//create color based on fraction of this color and next color
float yr = (y - y_min) / (y_max - y_min);
return col_1 * (1.0 - yr) + col_2 * yr;
}

void main()
{
// find which bar to use based on where we are on the x axis
float x = u_resolution.x * fragCoord.x;
int bar = int(bars_count * fragCoord.x);

//calculate a bar size
float bar_size = u_resolution.x / bars_count;

//the y coordinate and bar values are the same
float y = bars[bar];

// make sure there is a thin line at bottom
if (y * u_resolution.y < 1.0)
{
y = 1.0 / u_resolution.y;
}

//draw the bar up to current height
if (y > fragCoord.y)
{
//make some space between bars basen on settings
if (x > (bar + 1) * (bar_size) - bar_spacing)
{
fragColor = vec4(bg_color,1.0);
}
else
{
if (gradient_count == 0)
{
fragColor = vec4(fg_color,1.0);
}
else
{
//find which color in the configured gradient we are at
int color = int((gradient_count - 1) * fragCoord.y);

//find where on y this and next color is supposed to be
float y_min = color / (gradient_count - 1.0);
float y_max = (color + 1.0) / (gradient_count - 1.0);

//make color
fragColor = vec4(normalize_C(fragCoord.y, gradient_colors[color], gradient_colors[color + 1], y_min, y_max), 1.0);
}
}
}
else
{
fragColor = vec4(bg_color,1.0);
}
}
34 changes: 34 additions & 0 deletions .config/cava/shaders/northern_lights.frag
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
#version 330

in vec2 fragCoord;
out vec4 fragColor;

// bar values. defaults to left channels first (low to high), then right (high to low).
uniform float bars[512];

uniform int bars_count; // number of bars (left + right) (configurable)

uniform vec3 u_resolution; // window resolution, not used here

//colors, configurable in cava config file
uniform vec3 bg_color; // background color(r,g,b) (0.0 - 1.0), not used here
uniform vec3 fg_color; // foreground color, not used here

void main()
{
// find which bar to use based on where we are on the x axis
int bar = int(bars_count * fragCoord.x);

float bar_y = 1.0 - abs((fragCoord.y - 0.5)) * 2.0;
float y = (bars[bar]) * bar_y;

float bar_x = (fragCoord.x - float(bar) / float(bars_count)) * bars_count;
float bar_r = 1.0 - abs((bar_x - 0.5)) * 2;

bar_r = bar_r * bar_r * 2;

// set color
fragColor.r = fg_color.x * y * bar_r;
fragColor.g = fg_color.y * y * bar_r;
fragColor.b = fg_color.z * y * bar_r;
}
14 changes: 14 additions & 0 deletions .config/cava/shaders/pass_through.vert
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#version 330


// Input vertex data, different for all executions of this shader.
layout(location = 0) in vec3 vertexPosition_modelspace;

// Output data ; will be interpolated for each fragment.
out vec2 fragCoord;

void main()
{
gl_Position = vec4(vertexPosition_modelspace,1);
fragCoord = (vertexPosition_modelspace.xy+vec2(1,1))/2.0;
}
49 changes: 26 additions & 23 deletions .config/nvim/lazy-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 5 additions & 0 deletions .config/nvim/lua/config/lazy.lua
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,13 @@ end
vim.opt.rtp:prepend(vim.env.LAZY or lazypath)

require("lazy").setup({
change_detection = {
notify = false,
},
spec = {
{ import = "plugins" },
{ import = "plugins.lsp" },
{ import = "plugins.org" },
},
checker = { enabled = true },
defaults = {
Expand Down
91 changes: 42 additions & 49 deletions .config/nvim/lua/core/helpers.lua
Original file line number Diff line number Diff line change
@@ -1,82 +1,75 @@
---@alias RHS
---| string
---| function
---@alias KeyCommand string | function
---@alias KeyOpts { desc?: string, silent?: boolean, noremap?: boolean }

local M = {}

---@module "vim"
---@alias MapOpts string | vim.keymap.set.Opts options or description

--- Simple keymap helper
--- Create a keymap with sensible defaults
---@param mode string | string[]
---@param keys "n" | "i" | "t"
---@param command RHS
---@param opts? MapOpts
---@param keys string
---@param command KeyCommand
---@param opts? string | KeyOpts
local function keymap(mode, keys, command, opts)
local options = (type(opts) == "table" and opts)
or { noremap = true, silent = true, desc = opts }
local options = type(opts) == "table" and opts or { desc = opts }
options.noremap = options.noremap ~= false
options.silent = options.silent ~= false

vim.keymap.set(mode, keys, command, options)
end

--- Simple `n` keymap shorthand basically a shorter version of:
--- `vim.keymap.set('n', keys, command, { noremap = true, silent = true, desc = desc })`
--- Map keys in normal mode
---@param keys string
---@param command RHS
---@param opts? MapOpts
---@param command KeyCommand
---@param opts? string | KeyOpts
function M.nmap(keys, command, opts)
keymap("n", keys, command, opts)
end

--- Simple `i` keymap shorthand basically a shorter version of:
--- `vim.keymap.set('i', keys, command, { noremap = true, silent = true, desc = desc })`
--- Map keys in insert mode
---@param keys string
---@param command RHS
---@param opts? MapOpts
---@param command KeyCommand
---@param opts? string | KeyOpts
function M.imap(keys, command, opts)
keymap("i", keys, command, opts)
end

--- Simple `t` keymap shorthand basically a shorter version of:
--- `vim.keymap.set('t', keys, command, { noremap = true, silent = true, desc = desc })`
--- Map keys in terminal mode
---@param keys string
---@param command RHS
---@param opts? MapOpts
---@param command KeyCommand
---@param opts? string | KeyOpts
function M.tmap(keys, command, opts)
keymap("t", keys, command, opts)
end

--- Simple way to create augroups
---@param defintions table<string, table<string, string>>
function M.augroups(defintions)
for group_name, definition in pairs(defintions) do
vim.api.nvim_command("augroup " .. group_name)
vim.api.nvim_command("autocmd!")
--- Map keys in visual mode
---@param keys string
---@param command KeyCommand
---@param opts? string | KeyOpts
function M.vmap(keys, command, opts)
keymap("v", keys, command, opts)
end

--- Create autocommand groups
---@param definitions table<string, string[][]>
function M.augroups(definitions)
for group_name, definition in pairs(definitions) do
local group = vim.api.nvim_create_augroup(group_name, { clear = true })

for _, def in ipairs(definition) do
local command = table.concat(
vim.iter({ "autocmd", def }):flatten():totable(),
" "
)
vim.api.nvim_command(command)
vim.api.nvim_create_autocmd(def[1], {
group = group,
pattern = def[2],
command = def[3],
})
end

vim.api.nvim_command("augroup END")
end
end

--- Shallowly merge two tables
---@param a? table
---@param b? table
function M.merge(a, b)
local first_table = a or {}
local second_table = b or {}

for k, v in pairs(second_table) do
first_table[k] = v
end

return first_table
--- Merge two tables
---@param target? table
---@param source? table
---@return table
function M.merge(target, source)
return vim.tbl_extend("force", target or {}, source or {})
end

return M
20 changes: 13 additions & 7 deletions .config/nvim/lua/core/lsp.lua
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@ end
--- @module "vim"
--- @type vim.diagnostic.Opts.Signs
local signs = {
{ name = "DiagnosticSignError", text = "" },
{ name = "DiagnosticSignWarn", text = "" },
{ name = "DiagnosticSignHint", text = "" },
{ name = "DiagnosticSignInfo", text = "" },
{ name = "DiagnosticSignError", text = "" },
{ name = "DiagnosticSignWarn", text = "" },
{ name = "DiagnosticSignHint", text = "" },
{ name = "DiagnosticSignInfo", text = "" },
}

for _, sign in ipairs(signs) do
Expand All @@ -23,10 +23,12 @@ end
--- @module "vim"
--- @type vim.diagnostic.Opts
local config = {
virtual_text = {
source = "if_many",
},
-- virtual_text = {
-- hl_mode = "combine",
-- source = "if_many",
-- },
-- show signs
virtual_text = false,
signs = {
active = signs,
},
Expand Down Expand Up @@ -66,6 +68,10 @@ helpers.nmap(
"LSP - Add buffer diagnostics to location list"
)

helpers.nmap("<leader>td", function()
vim.diagnostic.enable(not vim.diagnostic.is_enabled())
end, "LSP - Toggle Diagnostics")

-- Use LspAttach autocommand to only map the following keys
-- after the language server attaches to the current buffer
vim.api.nvim_create_autocmd("LspAttach", {
Expand Down
7 changes: 7 additions & 0 deletions .config/nvim/lua/core/settings.lua
Original file line number Diff line number Diff line change
Expand Up @@ -35,3 +35,10 @@ set.hidden = true

-- yank to clipboard
set.clipboard = "unnamed,unnamedplus"

-- orgmode conceal
set.conceallevel = 2
set.concealcursor = "nc"

-- views can only be fully collapsed with the global statusline
vim.opt.laststatus = 3
4 changes: 2 additions & 2 deletions .config/nvim/lua/plugins/alpha-nvim.lua
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,8 @@ return {
local height = 25 -- two pixels per vertical space

dashboard.section.terminal.command = "cat | "
.. os.getenv("HOME")
.. "/.config/art/thisisfine.sh"
.. os.getenv("XDG_CONFIG_HOME")
.. "/art/thisisfine.sh"
dashboard.section.terminal.width = width
dashboard.section.terminal.height = height
dashboard.section.terminal.opts.redraw = true
Expand Down
Loading