1
0
Fork 1

Medium Sized Config Tweaks

This commit is contained in:
Snoweuph 2024-12-15 06:34:42 +01:00
parent 61d0f5cf4c
commit 44c9268d67
Signed by: snoweuph
GPG key ID: BEFC41DA223CEC55
11 changed files with 253 additions and 27 deletions

View file

@ -1 +1,2 @@
# [Dotfiles](https://git.euph.dev/Snoweuph/Dotfiles)/nvim
# [Dotfiles](https://git.euph.dev/Snoweuph/Dotfiles)/nvim

View file

@ -44,6 +44,5 @@ command -v markdownlint &>/dev/null || volta install markdownlint-cli
command -v stylelint &>/dev/null || volta install stylelint
command -v prettierd &>/dev/null || volta install @fsouza/prettierd
# Angular
command -v ng &>/dev/null || volta install @angular/cli

View file

@ -17,6 +17,20 @@ K.FOCUS_SHADE = {
},
}
--[[ Sessions ]]
K.SESSIONS = {
CREATE = {
mode = 'n',
shortcut = '<leader>sc',
description = 'Create Session',
},
MENU = {
mode = "n",
shortcut = '<leader>sm',
description = "Open Session Menu"
}
}
--[[ Git ]]
K.GIT = {
OPEN = {

View file

@ -6,27 +6,132 @@ return {
config = function()
-- Setup --
local alpha = require('alpha')
local dashboard = require('alpha.themes.startify')
local SECTIONS = {}
-- Header --
dashboard.section.header.val = {
[[ ]],
[[ ]],
[[ ]],
[[ ]],
[[  ]],
[[ ████ ██████ █████ ██ ]],
[[ ███████████ █████  ]],
[[ █████████ ███████████████████ ███ ███████████ ]],
[[ █████████ ███ █████████████ █████ ██████████████ ]],
[[ █████████ ██████████ █████████ █████ █████ ████ █████ ]],
[[ ███████████ ███ ███ █████████ █████ █████ ████ █████ ]],
[[ ██████ █████████████████████ ████ █████ █████ ████ ██████ ]],
[[ ]],
[[ ]],
[[ ]],
SECTIONS.header = {
type = 'text',
opts = {
position = 'center',
hl = 'DashboardHeader',
},
val = {
[[ ]],
[[ ]],
[[ ]],
[[ ]],
[[ ██ ]],
[[ ████ ██████ ████ ██ ]],
[[ ███████████ ████ ████  ]],
[[ █████████ ████████ ████ ████ ██ ████████ ]],
[[ █████████ ███ ██████████████ █████ █████████████ ]],
[[ █████████ ██████████ ██████████ █████ █████ ████ ████ ]],
[[ ███████████ ███ ███ ██████████ █████ █████ ████ ████ ]],
[[ ██████ ██████████████████████ █████ █████ █████ ████ ████ ]],
[[ ]],
[[ ]],
[[ ]],
},
}
alpha.setup(dashboard.opts)
SECTIONS.sessions = {
type = 'group',
val = function()
local session_rows = {}
local session_utils = require('session_manager.utils')
local sessions = session_utils.get_sessions()
table.sort(
sessions,
function(a, b) return a.dir.filename < b.dir.filename end
)
local line_len = 0
for i = 1, #sessions, 1 do
local len = string.len(sessions[i].dir.filename)
if len > line_len then
line_len = len
end
end
for i = 1, #sessions, 1 do
local session_name = sessions[i].dir.filename
local home_dir = os.getenv('HOME')
session_name = vim.fn.substitute(
session_name,
'^' .. home_dir .. '/Downloads',
'󰇚',
''
)
session_name = vim.fn.substitute(
session_name,
'^' .. home_dir .. '/Workspace/Learning',
'󰑴 ',
''
)
session_name = vim.fn.substitute(
session_name,
'^' .. home_dir .. '/Workspace/AdventOfCode',
'',
''
)
session_name = vim.fn.substitute(
session_name,
'^' .. home_dir .. '/Workspace/School',
'',
''
)
session_name = vim.fn.substitute(
session_name,
'^' .. home_dir .. '/Workspace',
'',
''
)
session_name = vim.fn.substitute(
session_name,
'^' .. home_dir,
'',
''
)
local start_session = function()
session_utils.load_session(sessions[i].filename, false)
end
local row = {
type = 'button',
val = ' ' .. session_name,
on_press = start_session,
opts = {
keymap = { 'n', tostring(i), start_session },
shortcut = string.format('[%d]', i),
align_shortcut = 'left',
hl_shortcut = 'DashboardKey',
position = 'center',
cursor = 1,
width = line_len + 5,
},
}
table.insert(session_rows, row)
end
return session_rows
end,
}
local theme = {
layout = {
{ type = 'padding', val = 2 },
SECTIONS.header,
{ type = 'padding', val = 2 },
SECTIONS.sessions,
},
opts = {
margin = 5,
},
}
alpha.setup(theme)
end,
}

40
lua/editor/sessions.lua Normal file
View file

@ -0,0 +1,40 @@
local K = require('core.keymap')
return {
'shatur/neovim-session-manager',
dependencies = {
'nvim-lua/plenary.nvim',
},
config = function()
local Path = require('plenary.path')
local config = require('session_manager.config')
local session_manager = require('session_manager')
session_manager.setup({
sessions_dir = Path:new(vim.fn.stdpath('data'), 'sessions'),
autoload_mode = config.AutoloadMode.Disabled,
autosave_last_session = true,
autosave_ignore_not_normal = true,
autosave_ignore_dirs = {},
autosave_ignore_filetypes = {
'gitcommit',
'gitrebase',
},
autosave_ignore_buftypes = {},
autosave_only_in_session = true,
max_path_length = 80,
})
vim.keymap.set(
K.SESSIONS.MENU.mode,
K.SESSIONS.MENU.shortcut,
session_manager.available_commands,
{ desc = K.SESSIONS.MENU.description }
)
vim.keymap.set(
K.SESSIONS.CREATE.mode,
K.SESSIONS.CREATE.shortcut,
session_manager.save_current_session,
{ desc = K.SESSIONS.CREATE.description }
)
end,
}

View file

@ -4,10 +4,12 @@ return {
dependencies = {
'nvim-tree/nvim-web-devicons',
'nvimdev/lspsaga.nvim',
'linrongbin16/lsp-progress.nvim',
},
after = 'rcarriga/nvim-dap-ui',
config = function()
-- Setup --
require('lsp-progress').setup()
local lspsaga_breadcrumbs = require('lspsaga.symbol.winbar').get_bar
require('lualine').setup({
@ -39,8 +41,11 @@ return {
},
sections = {
lualine_a = { 'mode' },
lualine_b = { 'diagnostics' },
lualine_c = { lspsaga_breadcrumbs },
lualine_b = {
function() return require('lsp-progress').progress() end,
},
lualine_c = { 'diagnostics' },
lualine_d = { lspsaga_breadcrumbs },
lualine_x = { 'location' },
lualine_y = { 'diff', 'branch' },
lualine_z = { 'filetype' },

View file

@ -1,4 +1,4 @@
local K = require('core.keymap')
--local K = require('core.keymap')
return {
{
@ -9,7 +9,7 @@ return {
-- Set Theme --
vim.cmd('colorscheme catppuccin')
end,
},
},--[[ --TODO: Disabled, because it Conflicts with the Session Management
{
'sunjon/shade.nvim',
opts = {
@ -20,5 +20,5 @@ return {
brightness_down = K.FOCUS_SHADE.DOWN.shortcut,
},
},
},
},]]--
}

52
lua/toolchain/angular.lua Normal file
View file

@ -0,0 +1,52 @@
local T = require('toolchain')
local M = {}
function M.setup()
T.add_highlighter_autoinstalls('angular')
T.add_null_ls_module(function(null_ls)
return {
-- Diagnostics
null_ls.builtins.diagnostics.stylelint,
-- Formatter
null_ls.builtins.formatting.prettier.with({
command = 'prettierd',
}),
}
end)
T.add_lsp_autoinstalls('angularls')
T.add_lsps(function(lspconfig, capabilities)
local config = { capabilities = capabilities }
lspconfig.html.setup(config)
lspconfig.emmet_ls.setup(config)
lspconfig.cssls.setup(config)
lspconfig.tailwindcss.setup(config)
lspconfig.ts_ls.setup(config)
lspconfig.eslint.setup(config)
end)
T.add_plugins({
'joeveiga/ng.nvim',
config = function()
local opts = { noremap = true, silent = true }
local ng = require('ng')
vim.keymap.set(
'n',
'<leader>at',
ng.goto_template_for_component,
opts
)
vim.keymap.set(
'n',
'<leader>ac',
ng.goto_component_with_template_file,
opts
)
vim.keymap.set('n', '<leader>aT', ng.get_template_tcb, opts)
end,
})
end
return M

View file

@ -104,6 +104,7 @@ function TOOLCHAINS.init()
require('toolchain.scripts').setup()
require('toolchain.text').setup()
require('toolchain.web').setup()
require('toolchain.angular').setup()
end
return TOOLCHAINS

4
selene.toml Normal file
View file

@ -0,0 +1,4 @@
std="vim"
[lints]
mixed_table="allow"

5
vim.toml Normal file
View file

@ -0,0 +1,5 @@
[selene]
base = "lua51"
[vim]
any = true