move to snowfall

This commit is contained in:
zackartz 2024-05-23 20:26:30 +00:00
parent 9d7ad7c973
commit 769d4b0df5
No known key found for this signature in database
GPG key ID: 5B53E53A9A514DBA
188 changed files with 2203 additions and 3041 deletions

View file

@ -0,0 +1,29 @@
import { Utils, App } from "./imports.js";
// Windows
import { Bar } from "./modules/bar/bar.js";
import { Dashboard } from "./modules/dashboard/dashboard.js";
// Apply css
const applyScss = () => {
// Compile scss
Utils.exec(
`sassc ${App.configDir}/scss/main.scss ${App.configDir}/style.css`,
);
console.log("Scss compiled");
// Apply compiled css
App.resetCss();
App.applyCss(`${App.configDir}/style.css`);
console.log("Compiled css applied");
};
// Apply css then check for changes
applyScss();
// Main config
export default {
style: `${App.configDir}/style.css`,
windows: [Bar(), Dashboard() ],
};

View file

@ -0,0 +1,32 @@
import App from "resource:///com/github/Aylur/ags/app.js";
import Widget from "resource:///com/github/Aylur/ags/widget.js";
import Service from "resource:///com/github/Aylur/ags/service.js";
import Variable from "resource:///com/github/Aylur/ags/variable.js";
import * as Utils from "resource:///com/github/Aylur/ags/utils.js";
import Applications from "resource:///com/github/Aylur/ags/service/applications.js";
import Audio from "resource:///com/github/Aylur/ags/service/audio.js";
import Battery from "resource:///com/github/Aylur/ags/service/battery.js";
import Bluetooth from "resource:///com/github/Aylur/ags/service/bluetooth.js";
import Hyprland from "resource:///com/github/Aylur/ags/service/hyprland.js";
import Mpris from "resource:///com/github/Aylur/ags/service/mpris.js";
import Network from "resource:///com/github/Aylur/ags/service/network.js";
import Notifications from 'resource:///com/github/Aylur/ags/service/notifications.js';
import SystemTray from "resource:///com/github/Aylur/ags/service/systemtray.js";
export {
App,
Widget,
Service,
Variable,
Utils,
Applications,
Audio,
Battery,
Bluetooth,
Hyprland,
Mpris,
Network,
Notifications,
SystemTray,
};

View file

@ -0,0 +1,35 @@
import { Widget } from "../../imports.js";
const { Window, Box, CenterBox } = Widget;
// Widgets
import { Workspaces } from "./workspaces.js";
import { Title } from "./title.js";
import { Media } from "./media.js";
import { Notification } from "./notification.js"
import { SysInfo } from "./sysinfo/sysinfo.js";
import { sysTray } from "./tray.js";
import { Clock } from "./clock.js";
const Left = () => Box({
children: [Workspaces(), Title()],
});
const Center = () => Box({
children: [Media()],
});
const Right = () => Box({
hpack: "end",
children: [Notification(), sysTray(), SysInfo(), Clock()],
});
export const Bar = () => Window({
name: "bar",
anchor: ["top", "right", "left"],
margins: [10, 15, 0],
exclusivity: "exclusive",
child: CenterBox({
className: "bar",
start_widget: Left(),
center_widget: Center(),
end_widget: Right(),
}),
});

View file

@ -0,0 +1,13 @@
import { Widget, Utils } from "../../imports.js";
const { execAsync } = Utils;
export const Clock = () => Widget.Button({
className: "clock",
setup: (self) => {
self.poll(1000, (self) =>
execAsync(["date", "+%a %b %d %H:%M"])
.then((time) => (self.label = time))
.catch(console.error),
);
},
});

View file

@ -0,0 +1,21 @@
import { Widget, Utils, Mpris } from "../../imports.js";
const { execAsync } = Utils;
export const Media = () => Widget.Button({
class_name: 'media',
on_primary_click: () => Mpris.getPlayer('').playPause(),
onSecondaryClickRelease: () => {
execAsync(['bash', '-c', 'anyrun', '&']);
},
on_scroll_up: () => Mpris.getPlayer('').next(),
on_scroll_down: () => Mpris.getPlayer('').previous(),
child: Widget.Label('-').hook(Mpris, self => {
if (Mpris.players[0]) {
const { track_title } = Mpris.players[0];
self.label = track_title.length > 60 ? `${track_title.substring(0, 60)}...` : track_title;
} else {
self.label = 'Nothing is playing';
}
}, 'player-changed'),
});

View file

@ -0,0 +1,20 @@
import { Widget, Notifications } from "../../imports.js"
const { Box } = Widget
export const Notification = () => Box({
class_name: 'barNotification',
visible: Notifications.bind('popups').transform(p => p.length > 0),
children: [
Widget.Label({
label: '󰍡 ',
}),
Widget.Label({
label: Notifications.bind('popups').transform(p => {
const summary = p[0]?.summary || '';
const maxLength = 50;
return summary.length > maxLength ? summary.slice(0, maxLength) + '...' : summary;
}),
}),
],
});

View file

@ -0,0 +1,38 @@
import { Widget, Utils, Battery } from "../../../imports.js";
const { Box } = Widget;
export const BatteryWidget = () => Box({
className: "battery",
children: [
Widget.Label({
className: "batIcon",
hexpand: true,
setup: (self) => {
self.hook(Battery, (self) => {
const icons = [
["󰂎", "󰁺", "󰁻", "󰁼", "󰁽", "󰁾", "󰁿", "󰂀", "󰂁", "󰂂", "󰁹"],
["󰢟", "󰢜", "󰂆", "󰂇", "󰂈", "󰢝", "󰂉", "󰢞", "󰂊", "󰂋", "󰂅"],
];
self.label =
icons[Battery.charging ? 1 : 0][
Math.floor(Battery.percent / 10)
].toString();
if (Battery.percent <= 15 && Battery.charging === false) {
self.toggleClassName("low", true);
} else {
self.toggleClassName("low", false);
}
});
},
}),
Widget.Label({
setup: (self) => {
self.hook(Battery, (self) => {
self.label = `${Battery.percent}%`;
});
},
}),
],
});

View file

@ -0,0 +1,13 @@
import { Widget } from "../../../imports.js";
import { Bluetooth } from "../../../imports.js";
const { Box } = Widget;
export const BluetoothWidget = () => Box({
class_name: 'bluetoothindicator',
children: [
Widget.Icon({
icon: Bluetooth.bind('enabled').transform(on =>
`bluetooth-${on ? 'active' : 'disabled'}-symbolic`),
})
]
})

View file

@ -0,0 +1,23 @@
import { Network } from "../../../imports.js"
import { Widget } from "../../../imports.js";
const WifiIndicator = () => Widget.Box({
children: [
Widget.Icon({
icon: Network.wifi.bind('icon_name'),
}),
],
})
const WiredIndicator = () => Widget.Icon({
icon: Network.wired.bind('icon_name'),
})
export const NetworkWidget = () => Widget.Stack({
class_name: 'network',
items: [
['wifi', WifiIndicator()],
['wired', WiredIndicator()],
],
shown: Network.bind('primary').transform(p => p || 'wifi'),
})

View file

@ -0,0 +1,20 @@
import { Widget } from "../../../imports.js"
const { Box } = Widget;
import{ NetworkWidget } from "./network.js"
import{ BluetoothWidget } from "./bluetooth.js"
import{ Volume } from "./volume.js"
import{ BatteryWidget } from "./battery.js"
export const SysInfo = () => Widget.Button({
class_name: 'sysinfo',
onClicked: () => App.toggleWindow("dashboard"),
child: Box({
children: [
NetworkWidget(),
BluetoothWidget(),
Volume(),
// BatteryWidget(),
]
}),
});

View file

@ -0,0 +1,25 @@
import { Widget, Audio } from "../../../imports.js";
const { Box } = Widget;
export const Volume = () => Box({
class_name: 'volume',
children: [
Widget.Icon().hook(Audio, self => {
if (!Audio.speaker)
return;
const category = {
101: 'overamplified',
67: 'high',
34: 'medium',
1: 'low',
0: 'muted',
};
const icon = Audio.speaker.is_muted ? 0 : [101, 67, 34, 1, 0].find(
threshold => threshold <= Audio.speaker.volume * 100);
self.icon = `audio-volume-${category[icon]}-symbolic`;
}, 'speaker-changed'),
],
});

View file

@ -0,0 +1,11 @@
import { Widget, Hyprland, Utils } from "../../imports.js";
const { execAsync } = Utils;
export const Title = () => Widget.Button({
className: 'title',
visible:Hyprland.active.client.bind('title').transform(title => title.length > 0),
label: Hyprland.active.client.bind('title').transform(title => title.length > 40 ? title.substring(0, 40) + '...' : title),
onClicked: () => {
execAsync(['bash', '-c', 'hyprctl dispatch killactive', '&']);
},
});

View file

@ -0,0 +1,15 @@
import { SystemTray } from "../../imports.js"
import { Widget } from "../../imports.js";
const { Box } = Widget;
const SysTrayItem = item => Widget.Button({
child: Widget.Icon().bind('icon', item, 'icon'),
tooltipMarkup: item.bind('tooltip_markup'),
onPrimaryClick: (_, event) => item.activate(event),
onSecondaryClick: (_, event) => item.openMenu(event),
});
export const sysTray = () => Box({
class_name: 'tray',
children: SystemTray.bind('items').transform(i => i.map(SysTrayItem))
})

View file

@ -0,0 +1,43 @@
import { Utils, Widget, Hyprland } from "../../imports.js";
const { execAsync } = Utils;
const { Box } = Widget;
export const Workspaces = () => Box({
className:"workspaces_pill",
child:Box({
className: "workspaces",
child: Box({
children: Array.from({ length: 10 }, (_, i) => i + 1).map((i) =>
Widget.Button({
cursor: "pointer",
attribute: { index: i },
onClicked: () =>
execAsync(["hyprctl", "dispatch", "workspace", `${i}`]).catch(
console.error,
),
onSecondaryClick: () =>
execAsync([
"hyprctl",
"dispatch",
"movetoworkspacesilent",
`${i}`,
]).catch(console.error),
}),
),
setup: (self) => {
self.hook(Hyprland, (self) =>
self.children.forEach((btn) => {
btn.className =
btn.attribute.index === Hyprland.active.workspace.id
? "focused"
: "";
btn.visible = Hyprland.workspaces.some(
(ws) => ws.id === btn.attribute.index,
);
}),
);
},
}),
}),
});

View file

@ -0,0 +1,52 @@
import { Widget, Bluetooth, Utils } from "../../imports.js";
const { execAsync } = Utils
const { Box } = Widget;
export const BluetoothWidget = () =>
Widget.Button({
onClicked: () => Bluetooth.toggle(),
onSecondaryClickRelease: () => {
execAsync(['bash', '-c', 'blueman-manager', '&']);
App.closeWindow('dashboard');
},
child: Box({
className: "bluetooth",
vpack: "center",
vexpand: true,
setup: (self) => {
self.hook(Bluetooth, (self) => {
if (Bluetooth.enabled) {
self.toggleClassName("off", false);
} else {
self.toggleClassName("off", true);
}
});
},
children: [
Widget.Label({
className: "bluetoothIcon",
label: "󰂲",
setup: (self) => {
self.hook(Bluetooth, (self) => {
if (Bluetooth.enabled) {
self.label = "󰂯";
} else {
self.label = "󰂲";
}
});
},
}),
Box({
vertical: true,
vpack: "center",
children: [
Widget.Label({
className: "bluetoothLabel",
label: "Bluetooth",
hpack: "start",
}),
],
}),
],
}),
});

View file

@ -0,0 +1,42 @@
import { Widget } from "../../imports.js";
import Brightness from "../../services/brightness.js";
const { Box } = Widget;
const Icon = () =>
Widget.Label({
className: "sldIcon",
setup: (self) => {
self.hook(Brightness, (self) => {
const icons = ["󰃚", "󰃛", "󰃜", "󰃝", "󰃞", "󰃟", "󰃠"];
self.label =
icons[Math.floor((Brightness.screen * 100) / 14)].toString();
});
},
});
const Slider = () =>
Widget.Slider({
className: "sldSlider",
drawValue: false,
onChange: ({ value }) => (Brightness.screen = value),
setup: (self) => {
self.hook(Brightness, (self) => (self.value = Brightness.screen));
},
});
export const BrightnessSlider = () =>
Box({
className: "Slider",
vertical: true,
children: [
Widget.Label({
className: "sldLabel",
label: "Brightness",
hpack: "start",
}),
Box({
children: [Icon(), Slider()],
}),
],
});

View file

@ -0,0 +1,16 @@
import Gtk from 'gi://Gtk';
import { Widget } from "../../imports.js";
const { Box } = Widget;
export const CalendarWidget = () => Box({
className: "calendar",
vpack: 'end',
vertical: true,
children: [
Widget.subclass(Gtk.Calendar)({
showDayNames: true,
showHeading: true,
className: 'calendarWidget',
})
]
})

View file

@ -0,0 +1,62 @@
import { Widget, Utils } from "../../imports.js";
const { Box } = Widget;
const { execAsync } = Utils;
import PopupWindow from "../../utils/popupWindow.js";
import { PowerIcon, TerminalIcon } from "./iconButtons.js"
import { WiFi } from "./wifi.js";
import { BluetoothWidget } from "./bluetooth.js";
import { VolumeSlider } from "./volumeSlider.js"
import { BrightnessSlider } from "./brightnessSlider.js";
import { NotificationList } from "./notificationList.js";
import { CalendarWidget } from "./calendar.js";
const uptime = Box({
children: [
Widget.Label({
setup: (self) => self
.poll(5000, label => {
execAsync(['bash', '-c', `w | sed -n '1p' | cut -d, -f1 | cut -d' ' -f4-`])
.then(upTimeString => {
label.label = `Uptime: ${upTimeString}`;
}).catch(print);
})
,
}),
Box({ hexpand: true }),
TerminalIcon({ hpack: 'end' }),
PowerIcon({ hpack: 'end' }),
]
});
export const Dashboard = () => PopupWindow({
name: "dashboard",
anchor: ["top","bottom", "right"],
margins: [12, 12, 15],
transition: "slide_left",
transitionDuration: 150,
child:
Box({
vertical:true,
children: [
Box({
className: "quicktoggles",
vertical: true,
vexpand: false,
children: [
uptime,
Box({
className: "buttons",
children: [
WiFi(),
BluetoothWidget(),
]
}),
]
}),
VolumeSlider(),
// BrightnessSlider(),
NotificationList(),
CalendarWidget(),
]
})
});

View file

@ -0,0 +1,21 @@
import { Widget, Utils } from "../../imports.js"
const { execAsync } = Utils;
export const PowerIcon = () => Widget.Button({
className: 'Icon',
child: Widget.Label({ label:"⏻" }),
onClicked: () => {
App.closeWindow('dashboard');
execAsync(['bash', '-c', '~/.config/hypr/scripts/powermenu.sh', '&']);
},
})
export const TerminalIcon = () => Widget.Button({
className: 'Icon',
child: Widget.Label({ label:"󰄛" }),
onClicked: () => {
execAsync(['bash', '-c', 'kitty', '&']);
App.closeWindow('dashboard');
},
})

View file

@ -0,0 +1,117 @@
import { Widget, Notifications, Utils } from "../../imports.js";
const { Box } = Widget;
const Notifs = Widget.Box({
class_name: "panel-notifs",
spacing: 20,
vertical: true,
vexpand: true,
setup: (self) => {
self.hook(Notifications, (self) => {
self.children = Notifications.notifications.map(n => Widget.Box({
class_name: "notification",
vertical: true,
children: [
Widget.Button({
on_clicked: () => {
n.close()
},
child: Box({
class_name: "notificationBody",
spacing: 20,
children: [
Widget.Label({
label: "󰍡",
class_name: "notificationImage"
}),
Box({
vertical: true,
children: [
Widget.Label({
label: `${n.summary}`,
class_name: "notificationTitle",
xalign: 0,
wrap: true
}),
Widget.Label({
vpack: "start",
hpack: "start",
class_name: "notificationDescription",
xalign: 0,
wrap: true,
label: n.body
})
]
})
]
})
})
],
})
)
})
}
})
const NotifBox = Widget.Scrollable({
vscroll: 'always',
hscroll: 'never',
vexpand: true,
class_name: 'notificationBox',
child: Notifs,
})
const Empty = Widget.Box({
class_name: "notificationEmpty",
spacing: 20,
hpack: "center",
vpack: "center",
vertical: true,
children: [
Widget.Label({
label: ` 󱙎 `,
vpack: "center",
vexpand: true,
})
]
})
export const NotificationList = () => Widget.Box({
class_name: "notificationList",
spacing: 20,
vertical: true,
children: [
Widget.CenterBox({
start_widget: Widget.Label({
label: "Notifications",
hpack: 'start',
class_name: "nt"
}),
end_widget: Widget.Button({
label: "  ",
hpack: 'end',
class_name: "icon ni",
on_clicked: () => {
const list = Array.from(Notifications.notifications);
for (let i = 0; i < list.length; i++) {
Utils.timeout(50 * i, () => list[i]?.close());
}
}
})
}),
Widget.Stack({
transition: 'crossfade',
transitionDuration: 150,
items: [
['empty', Empty],
['list', NotifBox]
],
setup: (self) => {
self.hook(Notifications, (self) => {
self.shown = (Notifications.notifications.length == 0 ? 'empty' : 'list')
})
}
}),
],
})

View file

@ -0,0 +1,60 @@
import { Widget, Audio } from "../../imports.js";
const { Box } = Widget;
const Icon = () => Widget.Label({
className: "sldIcon",
setup: (self) => {
self.hook(
Audio,
(self) => {
if (!Audio.speaker) return;
const icons = ["󰝟", "󰕿", "󰖀", "󰕾"];
self.label =
icons[
Audio.speaker.stream.isMuted
? 0
: Math.floor((Audio.speaker.volume * 100) / 26)
].toString();
},
"speaker-changed",
);
},
});
const Slider = () => Widget.Slider({
className: "sldSlider",
drawValue: false,
onChange: ({ value }) => (Audio.speaker.volume = value),
setup: (self) => {
self.hook(
Audio,
(self) => {
if (!Audio.speaker) return;
self.value = Audio.speaker.volume;
},
"speaker-changed",
);
},
});
export const VolumeSlider = () => Box({
className: "Slider",
vertical: true,
children: [
Widget.Label({
className: "sldLabel",
label: "Volume",
hpack: "start",
}),
Box({
children: [
Icon(),
Slider()
],
}),
],
});

View file

@ -0,0 +1,52 @@
import { Widget, Network, Utils } from "../../imports.js";
const { execAsync } = Utils
const { Box } = Widget;
export const WiFi = () =>
Widget.Button({
onClicked: () => Network.toggleWifi(),
onSecondaryClickRelease: () => {
execAsync(['bash', '-c', 'XDG_CURRENT_DESKTOP="gnome" gnome-control-center wifi', '&']);
App.closeWindow('dashboard');
},
child: Box({
className: "wifi",
vpack: "center",
vexpand: true,
setup: (self) => {
self.hook(Network, (self) => {
if (Network.wifi.internet === "disconnected") {
self.toggleClassName("off", true);
} else {
self.toggleClassName("off", false);
}
});
},
children: [
Widget.Label({
className: "wifiIcon",
label: "󰤭",
setup: (self) => {
self.hook(Network, (self) => {
if (Network.wifi.internet === "disconnected") {
self.label = "󰤭";
} else {
self.label = "󰤨";
}
});
},
}),
Box({
vertical: true,
vpack: "center",
children: [
Widget.Label({
className: "wifiLabel",
label: "Wi-Fi",
hpack: "start",
}),
],
}),
],
}),
});

View file

@ -0,0 +1 @@
$accent: #74C7EC;

View file

@ -0,0 +1,11 @@
@import "clock";
@import "media";
@import "notification";
@import "sysinfo";
@import "title";
@import "tray";
@import "workspaces";
.bar {
font-family: $font;
}

View file

@ -0,0 +1,8 @@
.clock {
background-color: #1e1e2e;
border-radius: 15px;
border: 3px solid #11111b;
color: #cdd6f4;
font-weight: bold;
padding: 1px 15px;
}

View file

@ -0,0 +1,12 @@
.media {
background-color: #1e1e2e;
border-radius: 15px;
border: 3px solid #11111b;
color: #cdd6f4;
font-weight: bold;
padding: 1px 15px;
&:hover {
color: $accent;
border: 3px solid $accent;
}
}

View file

@ -0,0 +1,9 @@
.barNotification {
background-color: #1e1e2e;
border-radius: 15px;
border: 3px solid #11111b;
color: #cdd6f4;
font-weight: bold;
margin-right: 10px;
padding: 1px 15px;
}

View file

@ -0,0 +1,39 @@
@keyframes lowBlink {
0% {
color: $accent;
}
50% {
color: #cdd6f4;
}
100% {
color: $accent;
}
}
.sysinfo {
background-color: #1e1e2e;
border-radius: 15px;
border: 3px solid #11111b;
color: #cdd6f4;
font-weight: bold;
margin-right: 10px;
padding: 1px 15px;
&:hover {
color: $accent;
border: 3px solid $accent;
}
}
.volume {
margin-left: 8px;
}
.bluetoothindicator {
margin-left: 8px;
}
.batIcon {
margin-left: 8px;
margin-right: 4px;
&.low {
animation: lowBlink 2s infinite;
}
}

View file

@ -0,0 +1,13 @@
.title {
background: #1e1e2e;
border-radius: 15px;
border: 3px solid #11111b;
color: #cdd6f4;
font-weight: bold;
margin-left: 10px;
padding: 1px 15px;
&:hover {
color: $accent;
border: 3px solid $accent;
}
}

View file

@ -0,0 +1,26 @@
.tray{
> * {
margin: 0 4px;
}
background-color: #1e1e2e;
border-radius: 15px;
border: 3px solid #11111b;
color: #cdd6f4;
font-weight: bold;
margin-right: 10px;
padding: 1px 11px;
}
menu {
menuitem {
background-color: #1e1e2e;
border-radius: 15px;
border: 3px solid #11111b;
color: #cdd6f4;
margin: 1px;
padding: 5px;
&:hover {
color: $accent;
border: 3px solid $accent;
}
}
}

View file

@ -0,0 +1,27 @@
.workspaces_pill {
background: #1e1e2e;
border-radius: 15px;
border: 3px solid #11111b;
padding: 1px 15px;
}
.workspaces {
margin: 3px 0;
& button {
background: #cdd6f4;
border-radius: 24px;
margin: 0 3px;
min-height: 16px;
min-width: 16px;
transition: all 0.3s $materialStandard;
&:hover {
min-width: 24px;
}
&.focused {
background: $accent;
min-width: 32px;
}
}
}

View file

@ -0,0 +1,31 @@
.Slider {
background: #1e1e2e;
border-radius: 15px;
border: 3px solid #11111b;
margin-bottom: 15px;
padding: 12px;
}
.sld {
&Label {
margin-bottom: 6px;
}
&Icon {
margin-right: 6px;
}
&Slider {
min-width: 300px;
& slider {
background: none;
}
& trough {
background: #313244;
border-radius: 24px;
min-height: 16px;
}
& highlight {
background: $accent;
border-radius: 24px;
min-width: 16px;
}
}
}

View file

@ -0,0 +1,13 @@
.calendar {
background-color: #1e1e2e;
border-radius: 16px;
border: 3px solid #11111b;
color: #cdd6f4;
padding: 10px;
}
.calendarWidget {
padding: 3px;
&:selected {
color: $accent;
}
}

View file

@ -0,0 +1,9 @@
@import "Slider";
@import "calendar";
@import "notifications";
@import "quicktoggles";
.dashboard {
font-weight: bold;
}

View file

@ -0,0 +1,26 @@
.notificationList {
background-color: #1e1e2e;
border-radius: 15px;
border: 3px solid #11111b;
margin-bottom: 15px;
padding: 10px;
}
.notificationEmpty {
color: #313244;
font-size: 80px;
}
.notificationImage {
color: #cdd6f4;
font-size: 40px;
}
.notification {
background-color: #313244;
border-radius: 15px;
padding:10px;
}
.notificationTitle {
color: #cdd6f4;
}
.notificationDescription {
color: #bac2de;
}

View file

@ -0,0 +1,37 @@
.quicktoggles {
background: #1e1e2e;
border-radius: 15px;
border: 3px solid #11111b;
margin-bottom: 15px;
min-width: 300px;
padding: 20px 20px;
}
.buttons {
margin-top: 10px;
}
.bluetooth, .wifi {
background: $accent;
border-radius: 24px;
min-width: 125px;
padding: 9px;
&.off {
background: #313244;
}
}
.wifi {
margin-right: 10px;
}
.wifi, .bluetooth, {
&Icon {
margin-right: 6px;
}
}
.Icon {
background: #313244;
border-radius: 50%;
margin-left: 5px;
min-height: 32px;
min-width: 32px;
}

View file

@ -0,0 +1,14 @@
*:not(selection):not(tooltip) {
all: unset;
}
// Vars
$font: JetBrains Mono Nerd Font;
$materialStandard: cubic-bezier(0.2, 0, 0, 1);
$materialAccel: cubic-bezier(0.3, 0, 1, 1);
$materialDecel: cubic-bezier(0, 0, 0, 1);
// Components
@import "./colors";
@import "bar/bar";
@import "dashboard/dashboard";

View file

@ -0,0 +1,49 @@
import { Service, Utils } from "../imports.js";
class Brightness extends Service {
static {
Service.register(
this,
{},
{
screen: ["float", "rw"],
},
);
}
_screen = 0;
get screen() {
return this._screen;
}
set screen(percent) {
if (percent < 0) percent = 0;
if (percent > 1) percent = 1;
Utils.execAsync(`brightnessctl s ${percent * 100}% -q`)
.then(() => {
this._screen = percent;
this.changed("screen");
})
.catch(console.error);
}
constructor() {
super();
try {
this._screen =
Number(Utils.exec("brightnessctl g")) /
Number(Utils.exec("brightnessctl m"));
} catch (error) {
console.error("missing dependancy: brightnessctl");
}
}
}
const service = new Brightness();
globalThis.brightness = service;
export default service;

View file

@ -0,0 +1,219 @@
*:not(selection):not(tooltip) {
all: unset; }
.clock {
background-color: #1e1e2e;
border-radius: 15px;
border: 3px solid #11111b;
color: #cdd6f4;
font-weight: bold;
padding: 1px 15px; }
.media {
background-color: #1e1e2e;
border-radius: 15px;
border: 3px solid #11111b;
color: #cdd6f4;
font-weight: bold;
padding: 1px 15px; }
.media:hover {
color: #74C7EC;
border: 3px solid #74C7EC; }
.barNotification {
background-color: #1e1e2e;
border-radius: 15px;
border: 3px solid #11111b;
color: #cdd6f4;
font-weight: bold;
margin-right: 10px;
padding: 1px 15px; }
@keyframes lowBlink {
0% {
color: #74C7EC; }
50% {
color: #cdd6f4; }
100% {
color: #74C7EC; } }
.sysinfo {
background-color: #1e1e2e;
border-radius: 15px;
border: 3px solid #11111b;
color: #cdd6f4;
font-weight: bold;
margin-right: 10px;
padding: 1px 15px; }
.sysinfo:hover {
color: #74C7EC;
border: 3px solid #74C7EC; }
.volume {
margin-left: 8px; }
.bluetoothindicator {
margin-left: 8px; }
.batIcon {
margin-left: 8px;
margin-right: 4px; }
.batIcon.low {
animation: lowBlink 2s infinite; }
.title {
background: #1e1e2e;
border-radius: 15px;
border: 3px solid #11111b;
color: #cdd6f4;
font-weight: bold;
margin-left: 10px;
padding: 1px 15px; }
.title:hover {
color: #74C7EC;
border: 3px solid #74C7EC; }
.tray {
background-color: #1e1e2e;
border-radius: 15px;
border: 3px solid #11111b;
color: #cdd6f4;
font-weight: bold;
margin-right: 10px;
padding: 1px 11px; }
.tray > * {
margin: 0 4px; }
menu menuitem {
background-color: #1e1e2e;
border-radius: 15px;
border: 3px solid #11111b;
color: #cdd6f4;
margin: 1px;
padding: 5px; }
menu menuitem:hover {
color: #74C7EC;
border: 3px solid #74C7EC; }
.workspaces_pill {
background: #1e1e2e;
border-radius: 15px;
border: 3px solid #11111b;
padding: 1px 15px; }
.workspaces {
margin: 3px 0; }
.workspaces button {
background: #cdd6f4;
border-radius: 24px;
margin: 0 3px;
min-height: 16px;
min-width: 16px;
transition: all 0.3s cubic-bezier(0.2, 0, 0, 1); }
.workspaces button:hover {
min-width: 24px; }
.workspaces button.focused {
background: #74C7EC;
min-width: 32px; }
.bar {
font-family: JetBrains Mono Nerd Font; }
.Slider {
background: #1e1e2e;
border-radius: 15px;
border: 3px solid #11111b;
margin-bottom: 15px;
padding: 12px; }
.sldLabel {
margin-bottom: 6px; }
.sldIcon {
margin-right: 6px; }
.sldSlider {
min-width: 300px; }
.sldSlider slider {
background: none; }
.sldSlider trough {
background: #313244;
border-radius: 24px;
min-height: 16px; }
.sldSlider highlight {
background: #74C7EC;
border-radius: 24px;
min-width: 16px; }
.calendar {
background-color: #1e1e2e;
border-radius: 16px;
border: 3px solid #11111b;
color: #cdd6f4;
padding: 10px; }
.calendarWidget {
padding: 3px; }
.calendarWidget:selected {
color: #74C7EC; }
.notificationList {
background-color: #1e1e2e;
border-radius: 15px;
border: 3px solid #11111b;
margin-bottom: 15px;
padding: 10px; }
.notificationEmpty {
color: #313244;
font-size: 80px; }
.notificationImage {
color: #cdd6f4;
font-size: 40px; }
.notification {
background-color: #313244;
border-radius: 15px;
padding: 10px; }
.notificationTitle {
color: #cdd6f4; }
.notificationDescription {
color: #bac2de; }
.quicktoggles {
background: #1e1e2e;
border-radius: 15px;
border: 3px solid #11111b;
margin-bottom: 15px;
min-width: 300px;
padding: 20px 20px; }
.buttons {
margin-top: 10px; }
.bluetooth, .wifi {
background: #74C7EC;
border-radius: 24px;
min-width: 125px;
padding: 9px; }
.bluetooth.off, .wifi.off {
background: #313244; }
.wifi {
margin-right: 10px; }
.wifiIcon, .bluetoothIcon {
margin-right: 6px; }
.Icon {
background: #313244;
border-radius: 50%;
margin-left: 5px;
min-height: 32px;
min-width: 32px; }
.dashboard {
font-weight: bold; }

View file

@ -0,0 +1,219 @@
*:not(selection):not(tooltip) {
all: unset; }
.clock {
background-color: #1e1e2e;
border-radius: 15px;
border: 3px solid #11111b;
color: #cdd6f4;
font-weight: bold;
padding: 1px 15px; }
.media {
background-color: #1e1e2e;
border-radius: 15px;
border: 3px solid #11111b;
color: #cdd6f4;
font-weight: bold;
padding: 1px 15px; }
.media:hover {
color: #f5c2e7;
border: 3px solid #f5c2e7; }
.barNotification {
background-color: #1e1e2e;
border-radius: 15px;
border: 3px solid #11111b;
color: #cdd6f4;
font-weight: bold;
margin-right: 10px;
padding: 1px 15px; }
@keyframes lowBlink {
0% {
color: #f5c2e7; }
50% {
color: #cdd6f4; }
100% {
color: #f5c2e7; } }
.sysinfo {
background-color: #1e1e2e;
border-radius: 15px;
border: 3px solid #11111b;
color: #cdd6f4;
font-weight: bold;
margin-right: 10px;
padding: 1px 15px; }
.sysinfo:hover {
color: #f5c2e7;
border: 3px solid #f5c2e7; }
.volume {
margin-left: 8px; }
.bluetoothindicator {
margin-left: 8px; }
.batIcon {
margin-left: 8px;
margin-right: 4px; }
.batIcon.low {
animation: lowBlink 2s infinite; }
.title {
background: #1e1e2e;
border-radius: 15px;
border: 3px solid #11111b;
color: #cdd6f4;
font-weight: bold;
margin-left: 10px;
padding: 1px 15px; }
.title:hover {
color: #f5c2e7;
border: 3px solid #f5c2e7; }
.tray {
background-color: #1e1e2e;
border-radius: 15px;
border: 3px solid #11111b;
color: #cdd6f4;
font-weight: bold;
margin-right: 10px;
padding: 1px 11px; }
.tray > * {
margin: 0 4px; }
menu menuitem {
background-color: #1e1e2e;
border-radius: 15px;
border: 3px solid #11111b;
color: #cdd6f4;
margin: 1px;
padding: 5px; }
menu menuitem:hover {
color: #f5c2e7;
border: 3px solid #f5c2e7; }
.workspaces_pill {
background: #1e1e2e;
border-radius: 15px;
border: 3px solid #11111b;
padding: 1px 15px; }
.workspaces {
margin: 3px 0; }
.workspaces button {
background: #cdd6f4;
border-radius: 24px;
margin: 0 3px;
min-height: 16px;
min-width: 16px;
transition: all 0.3s cubic-bezier(0.2, 0, 0, 1); }
.workspaces button:hover {
min-width: 24px; }
.workspaces button.focused {
background: #f5c2e7;
min-width: 32px; }
.bar {
font-family: JetBrains Mono Nerd Font; }
.Slider {
background: #1e1e2e;
border-radius: 15px;
border: 3px solid #11111b;
margin-bottom: 15px;
padding: 12px; }
.sldLabel {
margin-bottom: 6px; }
.sldIcon {
margin-right: 6px; }
.sldSlider {
min-width: 300px; }
.sldSlider slider {
background: none; }
.sldSlider trough {
background: #313244;
border-radius: 24px;
min-height: 16px; }
.sldSlider highlight {
background: #f5c2e7;
border-radius: 24px;
min-width: 16px; }
.calendar {
background-color: #1e1e2e;
border-radius: 16px;
border: 3px solid #11111b;
color: #cdd6f4;
padding: 10px; }
.calendarWidget {
padding: 3px; }
.calendarWidget:selected {
color: #74c7ec; }
.notificationList {
background-color: #1e1e2e;
border-radius: 15px;
border: 3px solid #11111b;
margin-bottom: 15px;
padding: 10px; }
.notificationEmpty {
color: #313244;
font-size: 80px; }
.notificationImage {
color: #cdd6f4;
font-size: 40px; }
.notification {
background-color: #313244;
border-radius: 15px;
padding: 10px; }
.notificationTitle {
color: #cdd6f4; }
.notificationDescription {
color: #bac2de; }
.quicktoggles {
background: #1e1e2e;
border-radius: 15px;
border: 3px solid #11111b;
margin-bottom: 15px;
min-width: 300px;
padding: 20px 20px; }
.buttons {
margin-top: 10px; }
.bluetooth, .wifi {
background: #f5c2e7;
border-radius: 24px;
min-width: 125px;
padding: 9px; }
.bluetooth.off, .wifi.off {
background: #313244; }
.wifi {
margin-right: 10px; }
.wifiIcon, .bluetoothIcon {
margin-right: 6px; }
.Icon {
background: #313244;
border-radius: 50%;
margin-left: 5px;
min-height: 32px;
min-width: 32px; }
.dashboard {
font-weight: bold; }

View file

@ -0,0 +1,52 @@
import { App, Widget, Utils } from "../imports.js";
const { Box, Revealer, Window } = Widget;
export default ({
onOpen = () => {},
onClose = () => {},
name,
child,
transition = "slide_up",
transitionDuration = 250,
...props
}) => {
const window = Window({
name,
visible: false,
...props,
child: Box({
css: `min-height: 2px;
min-width: 2px;`,
child: Revealer({
transition,
transitionDuration,
hexpand: true,
vexpand: true,
child: child || Box(),
setup: (self) => {
self.hook(App, (rev, currentName, isOpen) => {
if (currentName === name) {
rev.revealChild = isOpen;
if (isOpen) {
onOpen(window);
} else {
Utils.timeout(transitionDuration, () => {
onClose(window);
});
}
}
});
},
}),
}),
});
window.getChild = () => window.child.children[0].child;
window.setChild = (newChild) => {
window.child.children[0].child = newChild;
window.child.children[0].show_all(); };
return window;
};

View file

@ -0,0 +1,73 @@
{
options,
config,
lib,
inputs,
pkgs,
...
}:
with lib;
with lib.custom; let
cfg = config.apps.helpers.ags;
requiredDeps = with pkgs; [
config.wayland.windowManager.hyprland.package
bash
coreutils
gawk
sassc
imagemagick
procps
ripgrep
util-linux
gtksourceview
webkitgtk
brightnessctl
gvfs
accountsservice
swww
gnome.gnome-control-center
gnome.nautilus
gnome.totem
loupe
];
guiDeps = with pkgs; [
gnome.gnome-control-center
mission-center
overskride
wlogout
];
dependencies = requiredDeps ++ guiDeps;
in {
options.apps.helpers.ags = with types; {
enable = mkBoolOpt false "Enable AGS";
};
config = mkIf cfg.enable {
programs.ags = {
enable = true;
configDir = ./cfg;
extraPackages = dependencies;
};
systemd.user.services.ags = {
Unit = {
Description = "Aylur's Gtk Shell";
PartOf = [
"tray.target"
"graphical-session.target"
];
};
Service = {
Environment = "PATH=/run/wrappers/bin:${lib.makeBinPath dependencies}";
ExecStart = "${config.programs.ags.package}/bin/ags";
Restart = "on-failure";
};
Install.WantedBy = ["graphical-session.target"];
};
};
}

View file

@ -0,0 +1,113 @@
{
options,
config,
lib,
inputs,
pkgs,
...
}:
with lib;
with lib.custom; let
cfg = config.apps.helpers.anyrun;
in {
options.apps.helpers.anyrun = with types; {
enable = mkBoolOpt false "Enable Anyrun";
};
config = mkIf cfg.enable {
programs.anyrun = {
enable = true;
config = {
plugins = [
inputs.anyrun.packages.${pkgs.system}.applications
inputs.anyrun.packages.${pkgs.system}.shell
inputs.anyrun.packages.${pkgs.system}.websearch
inputs.anyrun.packages.${pkgs.system}.rink
inputs.anyrun.packages.${pkgs.system}.stdin
];
x = {fraction = 0.5;};
y = {absolute = 0;};
hideIcons = false;
ignoreExclusiveZones = false;
layer = "overlay";
hidePluginInfo = true;
closeOnClick = true;
showResultsImmediately = false;
maxEntries = null;
};
extraCss = ''
*{
all: unset;
color: #cdd6f4;
font-family: "JetBrainsMono Nerd Font";
font-weight: bold;
}
#window{
background-color: transparent;
}
#entry{
background-color: #1e1e2e;
border-radius: 15px;
border: 3px solid #11111b;
font-size: 16px;
margin-top: 10px;
padding: 1px 15px;
}
#match {
margin-bottom: 2px;
margin-top: 2px;
padding: 1px 15px;
}
#match-desc{
color: #bac2de;
font-size: 12px;
font-weight: normal;
}
#match:selected {
background: #313244;
border-radius: 15px;
}
#plugin{
background-color: #1e1e2e;
border-radius: 15px;
border: 3px solid #11111b;
margin-top:10px;
padding: 10px 1px;
}
#plugin > *{
all:unset;
}
'';
extraConfigFiles."applications.ron".text = ''
Config(
desktop_actions: false,
max_entries: 5,
terminal: Some("Kitty"),
)
'';
extraConfigFiles."shell.ron".text = ''
Config(
prefix: ">",
)
'';
extraConfigFiles."websearch.ron".text = ''
Config(
prefix: "",
// Options: Google, Ecosia, Bing, DuckDuckGo, Custom
//
// Custom engines can be defined as such:
// Custom(
// name: "Searx",
// url: "searx.be/?q={}",
// )
//
// NOTE: `{}` is replaced by the search query and `https://` is automatically added in front.
engines: [DuckDuckGo]
)
'';
};
};
}

View file

@ -0,0 +1,30 @@
{
options,
config,
lib,
...
}:
with lib;
with lib.custom; let
cfg = config.shells.zsh;
in {
options.apps.music.spotify = with types; {
enable = mkBoolOpt false "Enable Spotify";
};
config = mkIf cfg.enable {
home.packages = [pkgs.spotify];
programs.spicetify = {
enable = true;
theme = spicePkgs.themes.catppuccin;
colorScheme = "mocha";
enabledExtensions = with spicePkgs.extensions; [
fullAppDisplay
shuffle # shuffle+ (special characters are sanitized out of ext names)
hidePodcasts
];
};
};
}

View file

@ -0,0 +1,37 @@
{
options,
config,
lib,
...
}:
with lib;
with lib.custom; let
cfg = config.apps.term.kitty;
in {
options.apps.term.kitty = with types; {
enable = mkBoolOpt false "Enable Kitty Term";
};
config = mkIf cfg.enable {
programs.kitty = {
enable = true;
font = {
name = "Iosevka Term SemiBold";
size = 14;
};
extraConfig = ''
bold_font Iosevk Term Heavy
italic_font Iosevka Term SemiBold Italic
bold_italic_font Iosevka Term Heavy Italic
'';
catppuccin.enable = true;
settings = {
window_padding_width = 12;
background_opacity = "0.8";
};
};
};
}

View file

@ -0,0 +1,92 @@
{
options,
config,
lib,
pkgs,
...
}:
with lib;
with lib.custom; let
cfg = config.apps.tools.git;
in {
options.apps.tools.git = with types; {
enable = mkBoolOpt false "Enable Git Integration";
signByDefault = mkBoolOpt true "Sign by default";
signingKey = mkStringOpt "5B53E53A9A514DBA" "The KeyID of your GPG signingKey";
};
config = mkIf cfg.enable {
home.packages = with pkgs; [zsh-forgit gitflow];
programs.git = {
enable = true;
userName = "zack";
userEmail = "zackmyers@lavabit.com";
ignores = [
".cache/"
".DS_Store"
".idea/"
"*.swp"
"*.elc"
"auto-save-list"
".direnv/"
"node_modules"
"result"
"result-*"
];
signing = {
key = cfg.signingKey;
signByDefault = cfg.signByDefault;
};
extraConfig = {
init = {defaultBranch = "main";};
delta = {
options.map-styles = "bold purple => syntax #ca9ee6, bold cyan => syntax #8caaee";
line-numbers = true;
};
branch.autosetupmerge = "true";
push.default = "current";
merge.stat = "true";
core.whitespace = "fix,-indent-with-non-tab,trailing-space,cr-at-eol";
repack.usedeltabaseoffset = "true";
pull.ff = "only";
rebase = {
autoSquash = true;
autoStash = true;
};
rerere = {
autoupdate = true;
enabled = true;
};
};
lfs.enable = true;
delta.enable = true;
aliases = {
essa = "push --force";
co = "checkout";
fuck = "commit --amend -m";
c = "commit -m";
ca = "commit -am";
forgor = "commit --amend --no-edit";
graph = "log --all --decorate --graph --oneline";
oops = "checkout --";
l = "log";
r = "rebase";
s = "status --short";
ss = "status";
d = "diff";
ps = "!git push origin $(git rev-parse --abbrev-ref HEAD)";
pl = "!git pull origin $(git rev-parse --abbrev-ref HEAD)";
af = "!git add $(git ls-files -m -o --exclude-standard | sk -m)";
st = "status";
br = "branch";
df = "!git hist | peco | awk '{print $2}' | xargs -I {} git diff {}^ {}";
hist = ''
log --pretty=format:"%Cgreen%h %Creset%cd %Cblue[%cn] %Creset%s%C(yellow)%d%C(reset)" --graph --date=relative --decorate --all'';
llog = ''
log --graph --name-status --pretty=format:"%C(red)%h %C(reset)(%cd) %C(green)%an %Creset%s %C(yellow)%d%Creset" --date=relative'';
edit-unmerged = "!f() { git ls-files --unmerged | cut -f2 | sort -u ; }; hx `f`";
};
};
};
}

View file

@ -0,0 +1,26 @@
# nvimrc
**NOTE:** Neovim [nightly](https://github.com/neovim/neovim/releases/nightly) is required for inlay hint.
This repository contains my personal Neovim configuration, designed to be comprehensive and to provide a feature-rich IDE experience with a polished UI.
It's my daily driver for Rust, Lua and Web stuff. I also have a backup configuration for Vscode Neovim just in case I'll be forced to use Vscode.
![preview](https://github.com/luckasRanarison/nvimrc/assets/101930730/27e5b421-7869-4a77-b4d3-cf236b78d8b3)
## Structure
```shell
.
├── after
├── core
├── lsp
├── plugins
│   ├── editor
│   ├── lsp
│   ├── tools
│   ├── ui
│   └── utils
├── utils
└── vscode
```

View file

@ -0,0 +1,48 @@
local filetypes = require("core.filetypes")
local configurer = require("utils.configurer")
local opts = {}
if vim.g.vscode then
-- VSCode Neovim
opts.spec = "vscode.plugins"
opts.options = require("vscode.options")
opts.keymaps = require("vscode.keymaps")
else
-- Normal Neovim
opts.spec = "plugins"
opts.options = require("core.options")
opts.keymaps = require("core.keymaps")
opts.autocmd = require("core.autocmd")
opts.signs = require("core.signs")
end
configurer.setup(opts)
local handlers = require("lsp.handlers") -- Adjust the path as necessary
local function setup_all_servers()
for server, setup_fn in pairs(handlers) do
if type(setup_fn) == "function" then
-- Call the setup function for each server
setup_fn()
end
end
end
setup_all_servers()
vim.keymap.set("n", "<left>", '<cmd>echo "Use h to move!!"<CR>')
vim.keymap.set("n", "<right>", '<cmd>echo "Use l to move!!"<CR>')
vim.keymap.set("n", "<up>", '<cmd>echo "Use k to move!!"<CR>')
vim.keymap.set("n", "<down>", '<cmd>echo "Use j to move!!"<CR>')
vim.keymap.set("i", "<left>", '<cmd>echo "Use h to move!!"<CR>')
vim.keymap.set("i", "<right>", '<cmd>echo "Use l to move!!"<CR>')
vim.keymap.set("i", "<up>", '<cmd>echo "Use k to move!!"<CR>')
vim.keymap.set("i", "<down>", '<cmd>echo "Use j to move!!"<CR>')
-- Neovide config
vim.o.guifont = "Iosevka Nerd Font Mono:h14"
vim.g.neovide_transparency = 0.75
-- vim.lsp.log.set_level(vim.lsp.log_levels.INFO)
vim.filetype.add(filetypes)

View file

@ -0,0 +1 @@
vim.opt_local.shiftwidth = 4

View file

@ -0,0 +1,21 @@
return {
{
event = "LspAttach",
opts = {
callback = function(args)
local bufnr = args.buf
local client = vim.lsp.get_client_by_id(args.data.client_id)
local lsp = require("lsp.config")
lsp.set_keymaps(client, bufnr)
lsp.set_autocmd(client, bufnr)
end,
},
},
{
event = { "FileType" },
opts = {
pattern = { "help" },
callback = require("utils.win").open_help_float,
},
},
}

View file

@ -0,0 +1,10 @@
return {
extension = {
ic = "icelang",
rasi = "rasi",
ebnf = "ebnf",
},
pattern = {
[".*/hypr/.*%.conf"] = "hyprlang",
},
}

View file

@ -0,0 +1,285 @@
local map = require("utils.mappings")
local f = require("utils.functions")
local fmt = require("utils.icons").fmt
local fn = require("utils.functions")
local l, cmd, rcmd, lua = map.leader, map.cmd, map.rcmd, map.lua
local freeze, freeze_selection = fn.freeze, fn.freeze_selection
return {
i = {
["jj"] = { "<esc>", "Exit insert mode" },
},
n = {
-- utils
["vv"] = { "V", "Linewise visual" },
[l("w")] = { cmd("w"), fmt("Save", "Save file") },
[l("W")] = { cmd("w!"), fmt("Save", "Save file!") },
[l("q")] = { cmd("q"), fmt("Exit", "Exit window") },
[l("Q")] = { cmd("q!"), fmt("Exit", "Exit window!") },
[l("p")] = { '"_dP', fmt("Clipboard", "Paste from clipboard") },
[l("P")] = { '"+P', fmt("Clipboard", "Paste from clipboard") },
[l(":")] = { ":lua ", fmt("Lua", "Lua prompt") },
[l("%")] = { cmd("luafile %"), fmt("Lua", "Luafile") },
[l(";")] = { f.comment_line, fmt("Comment", "Comment line") },
[l(" ")] = { cmd("wincmd w"), fmt("Window", "Switch window") },
-- UI utils
[l("uw")] = { f.toggle_wrap, fmt("LineWrap", "Toggle wrap") },
[l("ug")] = { cmd("GuessIndent"), fmt("Indent", "Guess indent") },
[l("uf")] = { f.set_filetype, fmt("DefaultFile", "Set filetype") },
[l("ui")] = { f.set_indent, fmt("Indent", "Set indentation") },
[l("uI")] = { f.set_indent_type, fmt("Indent", "Set indentation type") },
[l("us")] = { cmd("nohlsearch"), fmt("Clear", "Clear search highlights") },
["<C-F12>"] = { cmd("OverseerRun"), "Overseer Run" },
["<C-S-F12>"] = { cmd("OverseerToggle"), "Overseer Toggle" },
-- Neotree
[l("e")] = { cmd("Neotree toggle"), fmt("FileTree", "Toggle Neotree") },
-- Neogit
[l("ng")] = { cmd("Neogit"), fmt("Git", "Open Neogit") },
-- Cloak
[l("ct")] = { cmd("CloakToggle"), "Cloak Toggle" },
-- Freeze
[l("sc")] = { freeze, "Take code screenshot" },
-- Rest
[l("rr")] = { cmd("Rest run"), "Run request in Rest" },
-- move.nvim
["<A-j>"] = { cmd("MoveLine(1)"), "Move line down" },
["<A-k>"] = { cmd("MoveLine(-1)"), "Move line up" },
["<A-h>"] = { cmd("MoveHChar(-1)"), "Move character left" },
["<A-l>"] = { cmd("MoveHChar(1)"), "Move character right" },
-- ccc
[l("cp")] = { cmd("CccPick"), fmt("ColorPicker", "Pick color") },
[l("cc")] = { cmd("CccConvert"), fmt("Swap", "Convert color") },
[l("ce")] = { cmd("CccHighlighterEnable"), fmt("ColorOn", "Enable highlights") },
[l("cd")] = { cmd("CccHighlighterDisable"), fmt("ColorOff", "Disable highlights") },
-- buffer utils
[l("bq")] = { cmd("BufDel"), fmt("Close", "Close current buffer") },
[l("bQ")] = { cmd("BufDel!"), fmt("Close", "close current buffer!") },
[l("bb")] = { cmd("BufferLinePick"), fmt("Open", "Pick to open buffer") },
[l("bd")] = { cmd("BufferLinePickClose"), fmt("Close", "Pick to close buffer") },
[l("bl")] = { cmd("BufferLineCloseLeft"), fmt("CloseMultiple", "Close buffers to the left") },
[l("br")] = { cmd("BufferLineCloseRight"), fmt("CloseMultiple", "Close buffers to the right") },
[l("bn")] = { cmd("BufferLineCycleNext"), fmt("NextBuffer", "Move to next buffer") },
[l("bp")] = { cmd("BufferLineCyclePrev"), fmt("PrevBuffer", "Move to previous buffer") },
[l("bi")] = { cmd("BufferLineTogglePin"), fmt("Pin", "Pin buffer") },
[l("bg")] = { f.first_buffer, fmt("PrevBuffer", "Move to first buffer") },
[l("bG")] = { f.last_buffer, fmt("NextBuffer", "Move to last buffer") },
[l("bv")] = { f.buf_vsplit, fmt("Vertical", "Vertical split") },
[l("bh")] = { f.buf_hsplit, fmt("Horizontal", "Horizontal split") },
-- gitsigns
[l("gb")] = { cmd("Gitsigns toggle_current_line_blame"), fmt("GitDiff", "Line blame") },
[l("gd")] = { cmd("Gitsigns diffthis"), fmt("GitDiff", "Show diff") },
[l("gD")] = { cmd("Gitsigns toggle_deleted"), fmt("DiffRemoved", "Toggle deleted") },
[l("gp")] = { cmd("Gitsigns preview_hunk"), fmt("Popup", "Preview hunk") },
[l("gP")] = { cmd("Gitsigns preview_hunk_inline"), fmt("Popup", "Preview hunk inline") },
[l("gn")] = { cmd("Gitsigns next_hunk"), fmt("Down", "Next hunk") },
[l("gN")] = { cmd("Gitsigns prev_hunk"), fmt("Up", "Previous hunk") },
[l("gr")] = { cmd("Gitsigns reset_hunk"), fmt("Restore", "Revert hunk") },
[l("gs")] = { cmd("Gitsigns stage_hunk"), fmt("Save", "Stage hunk") },
[l("gv")] = { cmd("Gitsigns select_hunk"), fmt("Visual", "Select hunk") },
[l("gw")] = { cmd("Gitsigns toggle_word_diff"), fmt("GitDiff", "Toggle word diff") },
[l("gg")] = { cmd("Telescope git_status"), fmt("Git", "Git status") },
-- toggleterm
[l("th")] = { cmd("ToggleTerm direction=horizontal"), fmt("Horizontal", "Horizontal terminal") },
[l("tv")] = {
cmd("ToggleTerm direction=vertical size=60"),
fmt("Vertical", "Vertical terminal"),
},
[l("tf")] = { cmd("ToggleTerm direction=float"), fmt("Window", "Floating terminal") },
[l("tl")] = { f.open_lazygit, fmt("GitBranch", "Lazygit terminal") },
[l("tg")] = { f.open_glow, fmt("Markdown", "Glow terminal") },
-- wincmd
["<C-h>"] = { cmd("wincmd h"), "Move right" },
["<C-j>"] = { cmd("wincmd j"), "Move down" },
["<C-k>"] = { cmd("wincmd k"), "Move up" },
["<C-l>"] = { cmd("wincmd l"), "Move left" },
-- telescope
[l("ff")] = { cmd("Telescope find_files"), fmt("FileSearch", "Find files") },
[l("fF")] = { cmd("Telescope find_files hidden=true"), fmt("FileSearch", "Find all files") },
[l("fg")] = { cmd("Telescope live_grep"), fmt("TextSearch", "Live grep") },
[l("fb")] = { cmd("Telescope buffers"), fmt("TabSearch", "Find buffer") },
[l("fh")] = { cmd("Telescope help_tags"), fmt("Help", "Find help") },
[l("fd")] = { cmd("Telescope diagnostics"), fmt("Warn", "Find diagnostic") },
[l("fs")] = { cmd("Telescope lsp_document_symbols"), fmt("Braces", "Document symbol") },
[l("fr")] = { cmd("Telescope resume"), fmt("Run", "Resume search") },
[l("fn")] = { cmd("Telescope notify"), fmt("Notification", "Show notifications") },
[l("fo")] = { cmd("Telescope vim_options"), fmt("Config", "Vim options") },
[l("f:")] = { cmd("Telescope command_history"), fmt("History", "Command history") },
[l("fm")] = { cmd("Telescope man_pages"), fmt("Info", "Search man") },
[l("fR")] = { cmd("Telescope reloader"), fmt("Restore", "Reload module") },
[l("fH")] = { cmd("Telescope highlights"), fmt("Color", "Highlight group") },
[l("ft")] = { cmd("Telescope treesitter"), fmt("Symbol", "Treesitter") },
[l("fz")] = { cmd("Telescope current_buffer_fuzzy_find"), fmt("Search", "Buffer fuzzy find") },
[l("fp")] = { cmd("Telescope registers"), fmt("Clipboard", "Registers") },
[l("fq")] = { cmd("Telescope quickfix"), fmt("Fix", "Quickfix") },
[l("gc")] = { cmd("Telescope git_bcommits"), fmt("GitCommit", "Find branch commit") },
[l("gC")] = { cmd("Telescope git_commits"), fmt("GitCommit", "Find commit") },
[l("gB")] = { cmd("Telescope git_branches"), fmt("GitBranch", "Find git branch") },
-- Lazy
[l("L")] = { cmd("Lazy"), fmt("Package", "Plugin manager") },
-- Mason
[l("M")] = { cmd("Mason"), fmt("Package", "Mason") },
-- DAP
[l("do")] = { f.open_dapui, fmt("Open", "Open debugger UI") },
[l("dq")] = { f.close_dapui, fmt("Close", "Close debugger UI") },
[l("dt")] = { f.toggle_dapui, fmt("Toggle", "Toggle debugger") },
[l("dc")] = { cmd("DapTerminate"), fmt("Stop", "Terminate session") },
[l("dr")] = { cmd("DapRestartFrame"), fmt("Restart", "Restart frame") },
[l("db")] = { cmd("DapToggleBreakpoint"), fmt("Toggle", "Toggle breakpoint") },
[l("dl")] = { cmd("DapShowLog"), fmt("DefaultFile", "Show logs") },
["<F5>"] = { cmd("DapContinue"), "Continue session" },
["<F9>"] = { cmd("DapToggleBreakpoint"), "Toggle breakpoint" },
["<F11>"] = { cmd("DapStepInto"), "Step into" },
["<F23>"] = { cmd("DapStepOut"), "Step out" },
["<F12>"] = { cmd("DapStepOver"), "Step over" },
-- telescope DAP
[l("dB")] = {
lua("require('telescope').extensions.dap.list_breakpoints()"),
fmt("Breakpoint", "List breakpoints"),
},
[l("dv")] = {
lua("require('telescope').extensions.dap.variables()"),
fmt("Variable", "List variables"),
},
[l("df")] = {
lua("require('telescope').extensions.dap.frames()"),
fmt("Stack", "List frames"),
},
[l("dF")] = {
lua("require('telescope').extensions.dap.configurations()"),
fmt("Config", "List configurations"),
},
[l("dC")] = {
lua("require('telescope').extensions.dap.commands()"),
fmt("Command", "List commands"),
},
-- session-manager
[l("Ss")] = { cmd("SessionManager save_current_session"), fmt("Save", "Save session") },
[l("Sl")] = { cmd("SessionManager load_session"), fmt("Restore", "Load session") },
[l("SL")] = { cmd("SessionManager load_last_session"), fmt("Restore", "Load last session") },
[l("Sd")] = { cmd("SessionManager delete_session"), fmt("Trash", "Delete session") },
[l("SD")] = {
cmd("SessionManager load_current_dir_session"),
fmt("FolderClock", "Load current directory session"),
},
-- notify
[l("nn")] = {
lua("require('notify').dismiss()"),
fmt("NotificationDismiss", "Dismiss notifications"),
},
-- lspconfig
[l("li")] = { cmd("LspInfo"), fmt("Info", "Server info") },
[l("lI")] = { cmd("LspLog"), fmt("DefaultFile", "Server logs") },
[l("lS")] = { ":LspStart ", fmt("Run", "Start server") },
[l("lq")] = { ":LspStop ", fmt("Stop", "Stop server") },
[l("lR")] = { cmd("LspRestart"), fmt("Restart", "Restart server") },
-- dropbar
[l("ok")] = { lua("require('dropbar.api').goto_context_start()"), fmt("Up", "Context start") },
[l("oo")] = { lua("require('dropbar.api').pick()"), fmt("Check", "Pick node") },
-- DbUI
[l("Dd")] = { cmd("DBUIToggle"), fmt("Toggle", "Toggle DbUI") },
[l("Da")] = { cmd("DBUIAddConnection"), fmt("Add", "Add connection") },
-- nvim-devdocs
[l("v ")] = { cmd("DevdocsToggle"), fmt("Window", "Toggle floating window") },
[l("vc")] = { cmd("DevdocsOpenCurrentFloat"), fmt("BookmarkSearch", "Open current file docs") },
[l("vv")] = { cmd("DevdocsOpenFloat"), fmt("BookmarkSearch", "Open in floating window") },
[l("vV")] = { cmd("DevdocsOpen"), fmt("BookmarkSearch", "Open in a normal buffer") },
[l("vf")] = { ":DevdocsOpenFloat ", fmt("BookmarkSearch", "Open documentation") },
[l("vi")] = { ":DevdocsInstall ", fmt("Install", "Install documentation") },
[l("vu")] = { ":DevdocsUninstall ", fmt("Trash", "Install documentation") },
-- crates
[l("Cv")] = {
lua("require('crates').show_versions_popup()"),
fmt("Info", "Show versions popup"),
},
[l("Cf")] = {
lua("require('crates').show_features_popup()"),
fmt("Stack", "Show features popup"),
},
[l("Cd")] = {
lua("require('crates').show_dependencies_popup()"),
fmt("Dependencies", "Show dependencies popup"),
},
[l("Cu")] = {
lua("require('crates').update_crate()"),
fmt("Update", "Update crate"),
},
[l("CU")] = {
lua("require('crates').update_all_crates()"),
fmt("Update", "Update all crates"),
},
[l("CD")] = {
lua("require('crates').open_documentation()"),
fmt("DefaultFile", "Open documentation"),
},
[l("Ch")] = {
lua("require('crates').open_homepage()"),
fmt("Web", "Open homepage"),
},
[l("Cc")] = {
lua("require('crates').open_crates_io()"),
fmt("Package", "Open crates.io"),
},
[l("Cr")] = {
lua("require('crates').open_repository()"),
fmt("Github", "Open repository"),
},
},
v = {
-- move.nvim
["<A-k>"] = { rcmd("MoveBlock(-1)"), "Move line up" },
["<A-j>"] = { rcmd("MoveBlock(1)"), "Move line down" },
["<A-h>"] = { rcmd("MoveHBlock(-1)"), "Move character left" },
["<A-l>"] = { rcmd("MoveHBlock(1)"), "Move character right" },
-- utils
["q"] = { "<esc>" },
[l("y")] = { '"+y', fmt("Clipboard", "yank to clipboard") },
[l("p")] = { '"+p', fmt("Clipboard", "Paste from clipboard") },
[l("P")] = { '"+P', fmt("Clipboard", "Paste from clipboard") },
[l(";")] = { f.comment_selection, fmt("Comment", "Comment selection") },
-- Freeze
[l("sc")] = { freeze_selection, "Take code screenshot" },
-- gitsigns
[l("gr")] = { cmd("Gitsigns reset_hunk"), fmt("Restore", "Revert hunk") },
-- crates
[l("Cu")] = { lua("require('crates').update_crates()"), fmt("Update", "Update crates") },
},
t = {
-- toggleterm
["<esc>"] = { [[<C-\><C-n>]] },
-- wincmd
["<C-h>"] = { cmd("wincmd h"), "Move right" },
["<C-j>"] = { cmd("wincmd j"), "Move down" },
["<C-k>"] = { cmd("wincmd k"), "Move up" },
["<C-l>"] = { cmd("wincmd l"), "Move left" },
},
}

View file

@ -0,0 +1,36 @@
return {
opt = {
fileencoding = "utf-8",
cmdheight = 0,
number = true,
relativenumber = true,
history = 100,
termguicolors = true,
filetype = "on",
cursorline = true,
foldenable = true,
foldlevel = 99,
foldlevelstart = 99,
ignorecase = true,
shiftwidth = 2,
showtabline = 0,
tabstop = 2,
expandtab = true,
wrap = false,
writebackup = false,
laststatus = 0,
updatetime = 200,
fillchars = "eob: ",
modeline = false,
conceallevel = 2,
mouse = "n",
clipboard = "unnamedplus",
scrolloff = 15,
},
g = {
mapleader = " ",
maplocalleader = "_",
highlighturl_enabled = true,
},
}

View file

@ -0,0 +1,9 @@
local icons = require("utils.icons").icons
return {
{ name = "DiagnosticSignError", text = icons.Error, texthl = "DiagnosticError" },
{ name = "DiagnosticSignHint", text = icons.Hint, texthl = "DiagnosticHint" },
{ name = "DiagnosticSignWarn", text = icons.Warn, texthl = "DiagnosticWarn" },
{ name = "DiagnosticSignInfo", text = icons.Info, texthl = "DiagnosticInfo" },
{ name = "DapBreakpoint", text = icons.Breakpoint, texthl = "Breakpoint" },
}

View file

@ -0,0 +1,18 @@
local lsp = require("lsp.functions")
return {
-- ["textDocument/codeLens"] = {
-- event = { "BufEnter", "InsertLeave" },
-- opts = {
-- group = vim.api.nvim_create_augroup("LspCodelens", {}),
-- callback = lsp.refresh_codelens,
-- },
-- },
["textDocument/formatting"] = {
event = "BufWritePost",
opts = {
group = vim.api.nvim_create_augroup("LspFormatting", {}),
callback = lsp.format,
},
},
}

View file

@ -0,0 +1,27 @@
local M = {}
M.set_autocmd = function(client, bufnr)
local capability_map = require("lsp.autocmd")
for capability, map in pairs(capability_map) do
if client.supports_method(capability) then
vim.api.nvim_clear_autocmds({ group = map.opts.group, buffer = bufnr })
map.opts.buffer = bufnr
vim.api.nvim_create_autocmd(map.event, map.opts)
end
end
end
M.set_keymaps = function(client, bufnr)
local capability_map = require("lsp.keymaps")
for capability, maps in pairs(capability_map) do
if client.supports_method(capability) then
for key, map in pairs(maps) do
vim.keymap.set("n", key, map[1], { desc = map[2], buffer = bufnr })
end
end
end
end
return M

View file

@ -0,0 +1,72 @@
local M = {}
M.definitions = function()
vim.cmd("Telescope lsp_definitions")
end
M.type_definition = function()
vim.lsp.buf.type_definition()
end
M.declarations = function()
vim.lsp.buf.declaration()
end
M.implementations = function()
vim.cmd("Telescope lsp_implementations")
end
M.references = function()
vim.cmd("Telescope lsp_references")
end
M.hover = function()
vim.lsp.buf.hover()
end
M.rename = function()
vim.lsp.buf.rename()
end
M.signature_help = function()
vim.lsp.buf.signature_help()
end
M.symbols = function()
vim.cmd("Telescope lsp_workspace_symbols")
end
M.refresh_codelens = function()
vim.lsp.codelens.refresh()
end
M.run_codelens = function()
vim.lsp.codelens.run()
end
M.toggle_inlay_hint = function()
vim.lsp.inlay_hint.enable(0, not vim.lsp.inlay_hint.is_enabled(0))
end
M.diagnostics = function()
local _, win = vim.diagnostic.open_float()
if win then
vim.api.nvim_win_set_config(win, { border = "rounded" })
vim.wo[win].signcolumn = "yes:1"
end
end
M.next_diagnostic = function()
vim.diagnostic.goto_next()
end
M.prev_diagnostic = function()
vim.diagnostic.goto_prev()
end
M.format = function()
vim.api.nvim_create_autocmd("TextChanged", {
group = vim.api.nvim_create_augroup("ApplyFormattingEdit", {}),
buffer = vim.api.nvim_get_current_buf(),
callback = function()
vim.cmd("silent noautocmd update")
vim.diagnostic.show()
vim.api.nvim_del_augroup_by_name("ApplyFormattingEdit")
end,
})
vim.lsp.buf.format({
async = true,
filter = function(client)
return client.name == "null-ls"
end,
})
end
return M

View file

@ -0,0 +1,64 @@
local M = {}
local make_config = function(name, config)
local capabilities = vim.lsp.protocol.make_client_capabilities()
capabilities.textDocument.completion.completionItem.snippetSupport = true
capabilities.textDocument.colorProvider = { dynamicRegistration = true }
local extended_config = vim.tbl_extend("error", { capabilities = capabilities }, config)
return function()
require("lspconfig")[name].setup(extended_config)
end
end
-- Default handler
-- M[1] = function(server_name)
-- make_config(server_name, {})()
-- end
M.lua_ls = make_config("lua_ls", {
settings = {
Lua = {
hint = {
enable = true,
},
diagnostics = {
globals = { "vim" },
},
},
},
})
M.nil_ls = make_config("nixd", {})
M.cssls = make_config("cssls", {
settings = {
css = {
validate = true,
lint = {
unknownAtRules = "ignore",
},
},
},
})
M.texlab = make_config("texlab", {})
M.astro = make_config("astro", {})
M.tailwindcss = make_config("tailwindcss", {
on_attach = function()
local bufnr = vim.api.nvim_get_current_buf()
require("document-color").buf_attach(bufnr)
end,
})
M.clangd = make_config("clangd", {
cmd = {
"clangd",
"--offset-encoding=utf-16",
},
})
M.tsserver = make_config("tsserver", {})
return M

View file

@ -0,0 +1,52 @@
local map = require("utils.mappings")
local lsp = require("lsp.functions")
local l, cmd = map.leader, map.cmd
local fmt = require("utils.icons").fmt
return {
["textDocument/formatting"] = {
[l("lf")] = { lsp.format, fmt("Format", "Format buffer") },
},
["textDocument/publishDiagnostics"] = {
[l("ld")] = { lsp.diagnostics, fmt("Warn", "Hover diagnostic") },
["<A-i>"] = { lsp.next_diagnostic, "Next diagnostic" },
["<A-o>"] = { lsp.prev_diagnostic, "Previous diagnostic" },
},
["textDocument/codeAction"] = {
[l("a ")] = { cmd("CodeActionToggleLabel"), fmt("Toggle", "Toggle label") },
},
["textDocument/definition"] = {
["gd"] = { lsp.definitions, "Go to definition" },
},
["textDocument/declaration"] = {
["gD"] = { lsp.declarations, "Go to declaration" },
},
["textDocument/hover"] = {
["K"] = { lsp.hover, "Hover info" },
},
["textDocument/implementation"] = {
["gI"] = { lsp.implementations, "Symbol implementation" },
},
["textDocument/references"] = {
["gr"] = { lsp.references, "Go to reference" },
},
["textDocument/rename"] = {
["<leader>lr"] = { lsp.rename, fmt("Edit", "Rename symbol") },
},
["textDocument/signatureHelp"] = {
["<leader>lH"] = { lsp.signature_help, fmt("Help", "Signature help") },
},
["textDocument/typeDefinition"] = {
["gT"] = { lsp.type_definition, "Go to type definition" },
},
-- ["textDocument/codeLens"] = {
-- ["<leader>ll"] = { lsp.run_codelens, fmt("Run", "Run codelens") },
-- ["<leader>lL"] = { lsp.refresh_codelens, fmt("Restart", "Refresh codelens") },
-- },
["workspace/symbol"] = {
["<leader>ls"] = { lsp.symbols, fmt("Symbol", "Workspace symbols") },
},
["workspace/inlayHint"] = {
["<leader>lh"] = { lsp.toggle_inlay_hint, fmt("Toggle", "Toggle inlay hint") },
},
}

View file

@ -0,0 +1,106 @@
local format = require("utils.icons").fmt
return {
{
"psliwka/vim-smoothie",
keys = { "<C-u>", "<C-d>", "zz" },
},
{
"numToStr/Comment.nvim",
dependencies = { "JoosepAlviste/nvim-ts-context-commentstring" },
keys = {
{ "gcc", mode = { "n" }, desc = "Comment line" },
{ "gc", mode = { "v" }, desc = "Comment selection" },
},
config = function()
local ft = require("Comment.ft")
ft.hypr = { "# %s" }
require("Comment").setup({
pre_hook = require("ts_context_commentstring.integrations.comment_nvim").create_pre_hook(),
})
end,
},
{
"NMAC427/guess-indent.nvim",
event = { "BufReadPost", "BufNewFile" },
opts = {
autocmd = true,
},
},
{
"ojroques/nvim-bufdel",
cmd = { "BufDel", "BufDelAll", "BufDelOthers" },
opts = { quit = false },
},
{
"fedepujol/move.nvim",
cmd = {
"MoveLine",
"MoveHChar",
"MoveBlock",
"MoveHBlock",
},
},
{
"windwp/nvim-autopairs",
event = "InsertEnter",
opts = {},
},
{
"kylechui/nvim-surround",
keys = {
{ "cs", mode = { "n" }, desc = "Change surrounding pair" },
{ "ds", mode = { "n" }, desc = "Delete surrounding pair" },
{ "ys", mode = { "n" }, desc = "Add surrounding pair" },
{ "S", mode = { "v" }, desc = "Add surrounding pair" },
},
config = function()
require("nvim-surround").setup()
end,
},
{
"kevinhwang91/nvim-ufo",
event = { "BufReadPost", "BufNewFile" },
dependencies = { "kevinhwang91/promise-async" },
opts = {
provider_selector = function()
return { "treesitter", "indent" }
end,
},
},
{
"RRethy/vim-illuminate",
event = { "BufReadPost", "BufNewFile" },
config = function()
require("illuminate").configure({
filetypes_denylist = {
"neo-tree",
"dropbar_menu",
"CodeAction",
},
})
end,
},
{
"Wansmer/treesj",
dependencies = { "nvim-treesitter/nvim-treesitter" },
keys = {
{ "<leader>j", mode = { "n" }, ":TSJSplit<CR>", desc = format("Down", "Split node") },
{ "<leader>J", mode = { "n" }, ":TSJJoin<CR>", desc = format("Up", "Join node") },
},
opts = {
use_default_keymaps = false,
},
},
}

View file

@ -0,0 +1,17 @@
return {
"lewis6991/gitsigns.nvim",
event = { "BufReadPre", "BufNewFile" },
opts = {
signs = {
add = { hl = "GitSignsAdd", text = "" },
change = { hl = "GitSignsChange", text = "" },
untracked = { hl = "GitSignsAdd", text = "" },
delete = { hl = "GitSignsDelete", text = "" },
topdelete = { hl = "GitSignsDelete", text = "" },
changedelete = { hl = "GitSignsChange", text = "" },
},
preview_config = {
border = "none",
},
},
}

View file

@ -0,0 +1,12 @@
return {
"NeogitOrg/neogit",
branch = "master",
dependencies = {
"nvim-lua/plenary.nvim", -- required
"sindrets/diffview.nvim", -- optional - Diff integration
-- Only one of these is needed, not both.
"nvim-telescope/telescope.nvim", -- optional
},
config = true,
}

View file

@ -0,0 +1,236 @@
return {
{
"L3MON4D3/LuaSnip",
dependencies = { "rafamadriz/friendly-snippets" },
event = "InsertEnter",
build = "make install_jsregexp",
config = function()
require("luasnip.loaders.from_vscode").lazy_load()
end,
},
{
"hrsh7th/nvim-cmp",
event = { "InsertEnter", "CmdlineEnter" },
dependencies = {
"neovim/nvim-lspconfig",
"hrsh7th/cmp-nvim-lsp",
"hrsh7th/cmp-buffer",
"hrsh7th/cmp-path",
"hrsh7th/cmp-cmdline",
"L3MON4D3/LuaSnip",
"saadparwaiz1/cmp_luasnip",
"onsails/lspkind-nvim",
"windwp/nvim-autopairs",
},
opts = function()
local cmp = require("cmp")
local cmp_autopairs = require("nvim-autopairs.completion.cmp")
cmp.event:on("confirm_done", cmp_autopairs.on_confirm_done())
local icons = {
branch = "",
bullet = "",
o_bullet = "",
check = "",
d_chev = "",
ellipses = "",
file = "",
hamburger = "",
lock = "",
r_chev = ">",
ballot_x = "",
up_tri = "",
info_i = "",
-- ballot_x = '✘',
-- up_tri = '▲',
-- info_i = '¡',
}
local function get_lsp_completion_context(completion, source)
local ok, source_name = pcall(function()
return source.source.client.config.name
end)
if not ok then
return nil
end
if source_name == "tsserver" then
return completion.detail
elseif source_name == "pyright" and completion.labelDetails ~= nil then
return completion.labelDetails.description
elseif source_name == "clang_d" then
local doc = completion.documentation
if doc == nil then
return
end
local import_str = doc.value
local i, j = string.find(import_str, '["<].*[">]')
if i == nil then
return
end
return string.sub(import_str, i, j)
end
end
cmp.setup.cmdline(":", {
mapping = cmp.mapping.preset.cmdline(),
sources = cmp.config.sources({
{ name = "path" },
}, {
{ name = "cmdline" },
}),
})
local snip_status_ok, luasnip = pcall(require, "luasnip")
if not snip_status_ok then
return
end
return {
snippet = {
expand = function(args)
luasnip.lsp_expand(args.body)
end,
},
window = {
completion = {
winhighlight = "Normal:Pmenu,FloatBorder:Pmenu,Search:None",
side_padding = 4,
},
documentation = {
winhighlight = "Normal:Pmenu,FloatBorder:Pmenu,Search:None",
side_padding = 4,
},
},
sources = cmp.config.sources({
{ name = "nvim_lsp", priority = 1000 },
{ name = "crates", priority = 1000 },
{ name = "luasnip", priority = 750 },
{ name = "buffer", priority = 500 },
{ name = "path", priority = 250 },
{ name = "neorg", priority = 250 },
}),
mapping = {
["<Up>"] = cmp.mapping.select_prev_item({ behavior = cmp.SelectBehavior.Select }),
["<Down>"] = cmp.mapping.select_next_item({ behavior = cmp.SelectBehavior.Select }),
["<C-p>"] = cmp.mapping.select_prev_item({ behavior = cmp.SelectBehavior.Insert }),
["<C-n>"] = cmp.mapping.select_next_item({ behavior = cmp.SelectBehavior.Insert }),
["<C-k>"] = cmp.mapping.select_prev_item({ behavior = cmp.SelectBehavior.Insert }),
["<C-j>"] = cmp.mapping.select_next_item({ behavior = cmp.SelectBehavior.Insert }),
["<C-u>"] = cmp.mapping(cmp.mapping.scroll_docs(-4), { "i", "c" }),
["<C-d>"] = cmp.mapping(cmp.mapping.scroll_docs(4), { "i", "c" }),
["<C-Space>"] = cmp.mapping(cmp.mapping.complete(), { "i", "c" }),
["<C-y>"] = cmp.config.disable,
["<C-e>"] = cmp.mapping({ i = cmp.mapping.abort(), c = cmp.mapping.close() }),
["<CR>"] = cmp.mapping.confirm({ select = false }),
["<Tab>"] = cmp.mapping(function(fallback)
if cmp.visible() then
cmp.select_next_item()
elseif luasnip.expand_or_jumpable() then
luasnip.expand_or_jump()
else
fallback()
end
end, { "i", "s" }),
["<S-Tab>"] = cmp.mapping(function(fallback)
if cmp.visible() then
cmp.select_prev_item()
elseif luasnip.jumpable(-1) then
luasnip.jump(-1)
else
fallback()
end
end, { "i", "s" }),
},
formatting = {
-- format = lspkind_status_ok and lspkind.cmp_format({
-- mode = "symbol",
-- maxwidth = 25,
-- ellipsis_char = "...",
-- before = function(entry, vim_item)
-- if vim_item.kind == "Color" and entry.completion_item.documentation then
-- local _, _, r, g, b =
-- string.find(entry.completion_item.documentation, "^rgb%((%d+), (%d+), (%d+)")
-- if r then
-- local color = string.format("%02x", r)
-- .. string.format("%02x", g)
-- .. string.format("%02x", b)
-- local group = "Tw_" .. color
-- if vim.fn.hlID(group) < 1 then
-- vim.api.nvim_set_hl(0, group, { fg = "#" .. color })
-- end
-- vim_item.kind_hl_group = group
-- return vim_item
-- end
-- end
-- return vim_item
-- end,
-- }),
format = function(entry, vim_item)
if not require("cmp.utils.api").is_cmdline_mode() then
local abbr_width_max = 25
local menu_width_max = 20
local choice = require("lspkind").cmp_format({
ellipsis_char = icons.ellipsis,
maxwidth = abbr_width_max,
mode = "symbol",
})(entry, vim_item)
choice.abbr = vim.trim(choice.abbr)
local abbr_width = string.len(choice.abbr)
if abbr_width < abbr_width_max then
local padding = string.rep(" ", abbr_width_max - abbr_width)
vim_item.abbr = choice.abbr .. padding
end
local cmp_ctx = get_lsp_completion_context(entry.completion_item, entry.source)
if cmp_ctx ~= nil and cmp_ctx ~= "" then
choice.menu = cmp_ctx
else
choice.menu = ""
end
local menu_width = string.len(choice.menu)
if menu_width > menu_width_max then
choice.menu = vim.fn.strcharpart(choice.menu, 0, menu_width_max - 1)
choice.menu = choice.menu .. icons.ellipses
else
local padding = string.rep(" ", menu_width_max - menu_width)
choice.menu = padding .. choice.menu
end
return choice
else
local abbr_width_min = 20
local abbr_width_max = 50
local choice = require("lspkind").cmp_format({
ellipsis_char = icons.ellipses,
maxwidth = abbr_width_max,
mode = "symbol",
})(entry, vim_item)
choice.abbr = vim.trim(choice.abbr)
local abbr_width = string.len(choice.abbr)
if abbr_width < abbr_width_min then
local padding = string.rep(" ", abbr_width_min - abbr_width)
vim_item.abbr = choice.abbr .. padding
end
return choice
end
end,
},
}
end,
},
}

View file

@ -0,0 +1,17 @@
return {
"mfussenegger/nvim-dap",
keys = {
{ "<leader>d", mode = { "n" } },
},
cmd = { "DapContinue", "DapToggleBreakpoint" },
dependencies = {
{ "rcarriga/nvim-dap-ui", opts = {} },
{ "nvim-neotest/nvim-nio" },
{
"theHamsta/nvim-dap-virtual-text",
opts = {
virt_text_pos = "eol",
},
},
},
}

View file

@ -0,0 +1,70 @@
return {
"nvim-treesitter/playground",
{
"nvim-treesitter/nvim-treesitter",
dependencies = { "windwp/nvim-ts-autotag" },
event = { "BufReadPost", "BufNewFile" },
cmd = {
"TSBufDisable",
"TSBufEnable",
"TSBufToggle",
"TSDisable",
"TSEnable",
"TSToggle",
"TSInstall",
"TSInstallInfo",
"TSInstallSync",
"TSModuleInfo",
"TSUninstall",
"TSUpdate",
"TSUpdateSync",
},
build = ":TSUpdate",
opts = {
highlight = {
enable = true,
disable = function(_, bufnr)
return vim.api.nvim_buf_line_count(bufnr) > 10000
end,
},
incremental_selection = { enable = true },
indent = { enable = true },
autotag = { enable = true },
context_commentstring = {
enable = true,
enable_autocmd = false,
},
ensure_installed = {
"bash",
"c",
"html",
"css",
"javascript",
"json",
"toml",
"lua",
"luadoc",
"luap",
"markdown",
"markdown_inline",
"python",
"rust",
"tsx",
"typescript",
"vim",
"vimdoc",
"yaml",
"sql",
"query",
"java",
"http",
"rasi",
"haskell",
"ebnf",
},
},
config = function(_, opts)
require("nvim-treesitter.configs").setup(opts)
end,
},
}

View file

@ -0,0 +1,14 @@
return {
"stevearc/overseer.nvim",
opts = {
task_list = {
direction = "bottom",
},
},
dependencies = {
{
"stevearc/dressing.nvim",
opts = {},
},
},
}

View file

@ -0,0 +1,10 @@
return {
"Shatur/neovim-session-manager",
cmd = { "SessionManager" },
config = function()
local config = require("session_manager.config")
require("session_manager").setup({
autoload_mode = config.AutoloadMode.Disabled,
})
end,
}

View file

@ -0,0 +1,25 @@
local format = require("utils.icons").fmt
return {
{
"nvim-telescope/telescope.nvim",
cmd = { "Telescope" },
dependencies = {
"nvim-lua/plenary.nvim",
"nvim-telescope/telescope-fzf-native.nvim",
"nvim-telescope/telescope-dap.nvim",
},
opts = {
defaults = {
border = true,
prompt_prefix = " ",
selection_caret = format("Right", ""),
},
extensions = {
fzf = {},
aerial = {},
dap = {},
},
},
},
}

View file

@ -0,0 +1,4 @@
return {
"christoomey/vim-tmux-navigator",
lazy = false,
}

View file

@ -0,0 +1,17 @@
return {
"akinsho/toggleterm.nvim",
cmd = { "ToggleTerm" },
opts = {
shade_terminals = false,
direction = "float",
float_opts = {
border = "rounded",
width = 80,
},
highlights = {
FloatBorder = {
link = "FloatBorder",
},
},
},
}

View file

@ -0,0 +1,6 @@
return {
{ import = "plugins.ui" },
{ import = "plugins.editor" },
{ import = "plugins.lsp" },
{ import = "plugins.tools" },
}

View file

@ -0,0 +1,26 @@
return {
"jose-elias-alvarez/null-ls.nvim",
event = { "BufReadPost", "BufNewFile" },
config = function()
local null_ls = require("null-ls")
null_ls.setup({
debug = false,
sources = {
null_ls.builtins.formatting.prettierd,
null_ls.builtins.formatting.alejandra,
null_ls.builtins.formatting.stylua,
null_ls.builtins.formatting.rustfmt.with({
extra_args = { "--edition=2021" },
}),
null_ls.builtins.formatting.shfmt.with({
filetypes = { "sh", "zsh" },
extra_args = { "--indent-type Spaces" },
}),
null_ls.builtins.formatting.clang_format.with({
extra_args = { "-style={IndentWidth: 4, AllowShortFunctionsOnASingleLine: Empty}" },
}),
},
})
end,
}

View file

@ -0,0 +1,23 @@
return {
{ "folke/neodev.nvim", ft = "lua", opts = {} },
{
"b0o/schemastore.nvim",
ft = "json",
config = function()
require("lspconfig").jsonls.setup({
capabilities = require("lsp.capabilities"),
settings = {
json = {
schemas = require("schemastore").json.schemas(),
validate = { enable = true },
},
},
})
end,
},
{
"mrcjkb/rustaceanvim",
version = "^4", -- Recommended
ft = { "rust" },
},
}

View file

@ -0,0 +1,6 @@
return {
"FabijanZulj/blame.nvim",
config = function()
require("blame").setup()
end,
}

View file

@ -0,0 +1,13 @@
return {
"uga-rosa/ccc.nvim",
cmd = {
"CccPick",
"CccConvert",
"CccHighlighterEnable",
"CccHighlighterDisable",
"CccHighlighterToggle",
},
opts = {
alpha_show = "show",
},
}

View file

@ -0,0 +1,44 @@
local format = require("utils.icons").fmt
return {
"luckasRanarison/clear-action.nvim",
event = "LspAttach",
opts = {
signs = {
show_count = false,
show_label = true,
combine = true,
},
popup = {
hide_cursor = true,
},
mappings = {
code_action = { "<leader>la", format("Fix", "Code action") },
apply_first = { "<leader>aa", format("Fix", "Apply") },
quickfix = { "<leader>aq", format("Fix", "Quickfix") },
quickfix_next = { "<leader>an", format("Fix", "Quickfix next") },
quickfix_prev = { "<leader>ap", format("Fix", "Quickfix prev") },
refactor = { "<leader>ar", format("Fix", "Refactor") },
refactor_inline = { "<leader>aR", format("Fix", "Refactor inline") },
actions = {
["rust_analyzer"] = {
["Import"] = { "<leader>ai", format("Fix", "Import") },
["Replace if"] = { "<leader>am", format("Fix", "Replace if with match") },
["Fill match"] = { "<leader>af", format("Fix", "Fill match arms") },
["Wrap"] = { "<leader>aw", format("Fix", "Wrap") },
["Insert `mod"] = { "<leader>aM", format("Fix", "Insert mod") },
["Insert `pub"] = { "<leader>aP", format("Fix", "Insert pub mod") },
["Add braces"] = { "<leader>ab", format("Fix", "Add braces") },
},
},
},
quickfix_filters = {
["rust_analyzer"] = {
["E0412"] = "Import",
["E0425"] = "Import",
["E0433"] = "Import",
["unused_imports"] = "remove",
},
},
},
}

View file

@ -0,0 +1,3 @@
return {
{ "laytan/cloak.nvim", lazy = false, opts = { cloak_length = 64 } },
}

View file

@ -0,0 +1,14 @@
return {
"saecki/crates.nvim",
dependencies = {
"nvim-lua/plenary.nvim",
"jose-elias-alvarez/null-ls.nvim",
},
event = { "BufRead Cargo.toml" },
opts = {
null_ls = {
enabled = true,
name = "Crates",
},
},
}

View file

@ -0,0 +1,5 @@
return {
"mrshmllow/document-color.nvim",
lazy = true,
opts = {},
}

View file

@ -0,0 +1,18 @@
local lua = require("utils.mappings").lua
return {
"folke/flash.nvim",
keys = {
{ "f", mode = { "n", "v" } },
{ "F", mode = { "n", "v" } },
{ "t", mode = { "n", "v" } },
{ "T", mode = { "n", "v" } },
{ "s", mode = { "n", "v" }, lua('require("flash").jump()') },
{ "ß", mode = "n", lua("require('flash').jump({ pattern = vim.fn.expand('<cword>') })") },
{ "S", mode = "n", lua("require('flash').treesitter()") },
{ "o", mode = "o", lua("require('flash').jump()"), desc = "Search jump" },
{ "O", mode = "o", lua("require('flash').treesitter()"), desc = "Tresitter jump" },
},
opts = {},
}

View file

@ -0,0 +1,14 @@
return {
"isabelroses/charm-freeze.nvim",
lazy = false,
config = function()
require("charm-freeze").setup({
command = "freeze",
output = function()
return "./" .. "._freeze.png"
end,
show_line_numbers = true,
theme = "catppuccin-mocha",
})
end,
}

View file

@ -0,0 +1,39 @@
return {
-- {
-- "nvim-neorg/neorg",
-- dependencies = { "luarocks.nvim" },
-- lazy = false,
-- version = "*",
-- config = function()
-- require("neorg").setup({
-- load = {
-- ["core.defaults"] = {},
-- ["core.concealer"] = {},
-- ["core.dirman"] = {
-- config = {
-- workspaces = {
-- dev = "~/notes",
-- },
-- default_workspace = "dev",
-- index = "index.norg",
-- },
-- },
-- ["core.completion"] = {
-- config = {
-- engine = "nvim-cmp",
-- },
-- },
-- ["core.keybinds"] = {},
-- ["core.ui.calendar"] = {},
-- ["core.export"] = {},
-- ["core.looking-glass"] = {},
-- ["core.qol.toc"] = {},
-- ["core.qol.todo_items"] = {},
-- ["core.esupports.hop"] = {},
-- ["core.esupports.indent"] = {},
-- ["core.summary"] = {},
-- },
-- })
-- end,
-- },
}

View file

@ -0,0 +1,52 @@
return {
-- "luckasRanarison/nvim-devdocs",
dir = "~/Projects/nvim-devdocs",
branch = "master",
dependencies = {
"nvim-lua/plenary.nvim",
"nvim-telescope/telescope.nvim",
"nvim-treesitter/nvim-treesitter",
},
cmd = {
"DevdocsFetch",
"DevdocsInstall",
"DevdocsUninstall",
"DevdocsOpen",
"DevdocsOpenFloat",
"DevdocsOpenCurrent",
"DevdocsOpenCurrentFloat",
"DevdocsUpdate",
"DevdocsUpdateAll",
"DevdocsBuild",
},
opts = {
format = "markdown",
filetypes = {
javascript = { "html", "javascript" },
},
-- use_node = false,
ensure_installed = {
-- "git",
-- "bash",
-- "rust",
-- "lua-5.4",
-- "html",
-- "css",
-- "javascript",
-- "typescript",
-- "react",
-- "web_extensions",
},
wrap = true,
previewer_cmd = "glow",
cmd_args = { "-s", "auto", "-w", "97" },
cmd_ignore = {},
picker_cmd = true,
picker_cmd_args = { "-s", "auto", "-w", "45" },
mappings = {
open_in_browser = "<leader>vb",
toggle_rendering = "<leader>vr",
},
log_level = "debug",
},
}

View file

@ -0,0 +1,10 @@
return {
{
"rest-nvim/rest.nvim",
ft = "http",
config = function()
require("rest-nvim").setup()
end,
},
}

View file

@ -0,0 +1,29 @@
return {
"kristijanhusak/vim-dadbod-ui",
dependencies = {
"tpope/vim-dadbod",
"kristijanhusak/vim-dadbod-completion",
},
cmd = {
"DBUI",
"DBUIAddConnection",
"DBUIClose",
"DBUIToggle",
"DBUIFindBuffer",
"DBUIRenameBuffer",
"DBUILastQueryInfo",
},
config = function()
vim.g.db_ui_notification_width = 1
vim.g.db_ui_debug = 1
local cmp = require("cmp")
cmp.setup.filetype({ "sql" }, {
sources = {
{ name = "vim-dadbod-completion" },
{ name = "buffer" },
},
})
end,
}

View file

@ -0,0 +1,31 @@
local format = require("utils.icons").fmt
return {
"goolord/alpha-nvim",
config = function()
local alpha = require("alpha")
local dashboard = require("alpha.themes.dashboard")
dashboard.section.header.val = {
[[ ]],
[[  ]],
[[ ████ ██████ █████ ██ ]],
[[ ███████████ █████  ]],
[[ █████████ ███████████████████ ███ ███████████ ]],
[[ █████████ ███ █████████████ █████ ██████████████ ]],
[[ █████████ ██████████ █████████ █████ █████ ████ █████ ]],
[[ ███████████ ███ ███ █████████ █████ █████ ████ █████ ]],
[[ ██████ █████████████████████ ████ █████ █████ ████ ██████ ]],
[[ ]],
}
dashboard.section.buttons.val = {
dashboard.button("n", format("NewFile", "New file", 2), ":ene <BAR> startinsert <CR>"),
dashboard.button("f", format("Search", "Find file", 2), ":Telescope find_files<CR>"),
dashboard.button("l", format("History", "Recents", 2), ":SessionManager load_session<CR>"),
dashboard.button("L", format("FolderOpened", "Last session", 2), ":SessionManager load_last_session<CR>"),
dashboard.button("q", format("Exit", "Quit", 2), ":qa<CR>"),
}
dashboard.config.layout[1].val = vim.fn.max({ 2, vim.fn.floor(vim.fn.winheight(0) * 0.2) })
dashboard.config.layout[3].val = 2
alpha.setup(dashboard.config)
end,
}

View file

@ -0,0 +1,58 @@
local format = require("utils.icons").fmt
return {
"akinsho/bufferline.nvim",
event = { "BufReadPost", "BufNewFile" },
dependencies = "nvim-tree/nvim-web-devicons",
after = "catppuccin",
opts = {
options = {
diagnostics = "nvim_lsp",
diagnostics_update_in_insert = true,
diagnostics_indicator = nil,
indicator = "none",
offsets = {
{
filetype = "neo-tree",
text = format("Folder", "NeoTree"),
text_align = "left",
separator = "",
},
{
filetype = "dapui_watches",
text = format("Debugger", "DapUI"),
text_align = "left",
separator = "",
},
{
filetype = "dbui",
text = format("Database", "DbUI"),
text_align = "left",
separator = "",
},
},
},
},
config = function(_, opts)
-- local colors = require("tokyonight.colors")
--
-- vim.opt.showtabline = 2
-- opts.highlights = {
-- background = { bg = colors.night.bg },
-- close_button = { bg = colors.night.bg },
-- separator = { fg = colors.night.bg, bg = colors.night.bg },
-- offset_separator = { bg = colors.night.bg },
-- pick = { bg = colors.night.bg },
-- }
local mocha = require("catppuccin.palettes").get_palette("mocha")
opts = {
highlights = require("catppuccin.groups.integrations.bufferline").get({
styles = { "italic", "bold" },
}),
}
require("bufferline").setup(opts)
end,
}

View file

@ -0,0 +1,48 @@
return {
"catppuccin/nvim",
name = "catppuccin",
init = function()
vim.cmd.colorscheme("catppuccin-mocha")
end,
opts = {
transparent_background = true,
custom_highlights = function(colors)
return {
Pmenu = { bg = colors.base },
}
end,
flavor = "mocha",
integrations = {
cmp = true,
noice = true,
treesitter = true,
neotree = true,
overseer = true,
notify = true,
telescope = {
enabled = true,
style = "nvchad",
},
which_key = true,
native_lsp = {
enabled = true,
virtual_text = {
errors = { "italic" },
hints = { "italic" },
warnings = { "italic" },
information = { "italic" },
},
underlines = {
errors = { "underline" },
hints = { "underline" },
warnings = { "underline" },
information = { "underline" },
},
inlay_hints = {
background = true,
},
},
},
},
priority = 1000,
}

View file

@ -0,0 +1,22 @@
return {
"stevearc/dressing.nvim",
event = "VeryLazy",
config = function()
local theme = require("telescope.themes").get_dropdown()
theme.layout_config = {
width = 60,
height = 17,
}
require("dressing").setup({
input = {
enabled = false,
},
select = {
backend = { "telescope" },
telescope = theme,
},
})
end,
}

View file

@ -0,0 +1,18 @@
return {
{
"Bekaboo/dropbar.nvim",
event = { "BufRead", "BufNewFile" },
opts = {
icons = {
enable = true,
kinds = {
use_devicons = false,
symbols = {
File = "",
Folder = "",
},
},
},
},
},
}

View file

@ -0,0 +1,10 @@
return {
"rachartier/tiny-devicons-auto-colors.nvim",
dependencies = {
"nvim-tree/nvim-web-devicons",
},
event = "VeryLazy",
config = function()
require("tiny-devicons-auto-colors").setup()
end,
}

View file

@ -0,0 +1,41 @@
return {
"lukas-reineke/indent-blankline.nvim",
event = { "BufReadPost", "BufNewFile" },
main = "ibl",
opts = {
exclude = {
buftypes = {
"nofile",
"terminal",
},
filetypes = {
"help",
"startify",
"aerial",
"alpha",
"dashboard",
"lazy",
"neogitstatus",
"neo-tree",
"Trouble",
"dbout",
"TelescopePrompt",
},
},
scope = {
show_start = false,
show_end = false,
highlight = { "@keyword" },
char = "",
include = {
node_type = {
lua = { "table_constructor" },
},
},
},
whitespace = {
remove_blankline_trail = true,
},
indent = { char = "" },
},
}

View file

@ -0,0 +1,34 @@
local sources = require("plugins.utils.lualine_sources")
return {
"nvim-lualine/lualine.nvim",
event = { "BufReadPost", "BufNewFile" },
dependencies = { "nvim-tree/nvim-web-devicons" },
config = function(_, opts)
-- local colors = require("tokyonight.colors")
-- local tokyonight = require("lualine.themes.catppuccin")
--
-- vim.opt.laststatus = 3
-- tokyonight.normal.c.bg = colors.night.bg
opts.options.theme = "catppuccin"
require("lualine").setup(opts)
end,
opts = {
options = {
component_separators = { left = "", right = "" },
section_separators = { left = "", right = "" },
},
sections = {
lualine_x = {
"rest",
},
-- lualine_a = { sources.mode },
-- lualine_b = { sources.branch, sources.diff },
-- lualine_c = { sources.filetype, sources.macro },
-- lualine_x = { sources.lsp, sources.diagnostics },
-- lualine_y = { sources.indentation, sources.encoding, sources.fileformat },
-- lualine_z = { sources.progress, sources.location },
},
},
}

View file

@ -0,0 +1,84 @@
local icons = require("utils.icons").icons
return {
{
"nvim-neo-tree/neo-tree.nvim",
dependencies = {
"nvim-lua/plenary.nvim",
"MunifTanjim/nui.nvim",
"nvim-tree/nvim-web-devicons",
"luckasRanarison/neo-rename.nvim",
},
cmd = "Neotree",
opts = {
enable_git_status = true,
close_if_last_window = true,
auto_clean_after_session_restore = true,
window = {
width = 30,
mappings = {
["<space>"] = false,
["s"] = false,
["l"] = "open",
["v"] = "open_vsplit",
["gA"] = "git_add_all",
["ga"] = "git_add_file",
["gu"] = "git_unstage_file",
["gr"] = "git_revert_file",
},
},
filesystem = {
follow_current_file = { enabled = true },
hijack_netrw_behavior = "open_current",
use_libuv_file_watcher = true,
},
default_component_configs = {
icon = {
folder_empty = icons.EmptyFolder,
default = icons.DefaultFile,
},
indent = {
padding = 0,
indent_size = 1,
},
modified = {
symbol = icons.SmallDot,
},
name = {
use_git_status_colors = true,
},
git_status = {
symbols = {
deleted = "D",
renamed = "R",
modified = "M",
added = "A",
untracked = "U",
ignored = "",
staged = "",
unstaged = "!",
conflict = "C",
},
},
diagnostics = {
symbols = {
hint = icons.Hint,
info = icons.Info,
warn = icons.Warn,
error = icons.Error,
},
highlights = {
hint = "DiagnosticSignHint",
info = "DiagnosticSignInfo",
warn = "DiagnosticSignWarn",
error = "DiagnosticSignError",
},
},
},
},
config = function(_, opts)
require("neo-tree").setup(opts)
require("neo-rename").setup()
end,
},
}

View file

@ -0,0 +1,34 @@
local icons = require("utils.icons").icons
return {
"folke/noice.nvim",
event = "VeryLazy",
dependencies = {
"MunifTanjim/nui.nvim",
{ "rcarriga/nvim-notify" },
},
opts = {
cmdline = {
format = {
cmdline = { pattern = "^:", icon = icons.Command, lang = "vim" },
},
},
lsp = {
override = {
["vim.lsp.util.convert_input_to_markdown_lines"] = true,
["vim.lsp.util.stylize_markdown"] = true,
["cmp.entry.get_documentation"] = true,
},
hover = {
silent = true,
},
},
presets = {
bottom_search = false,
command_palette = true,
long_message_to_split = true,
inc_rename = false,
lsp_doc_border = "rounded",
},
},
}

View file

@ -0,0 +1,37 @@
local format = require("utils.icons").fmt
return {
"folke/which-key.nvim",
event = "VeryLazy",
init = function()
require("which-key").register({
a = { name = format("Fix", "Actions") },
c = { name = format("Color", "Color") },
b = { name = format("Windows", "Buffers") },
u = { name = format("Window", "UI") },
g = { name = format("Git", "Git") },
t = { name = format("Terminal", "Terminal") },
f = { name = format("Search", "Telescope") },
l = { name = format("Braces", "LSP") },
d = { name = format("Debugger", "Debugger") },
n = { name = format("Notification", "Notification") },
S = { name = format("FolderClock", "Session") },
r = { name = format("Code", "SnipRun") },
o = { name = format("DropDown", "Dropbar") },
v = { name = format("Book", "DevDocs") },
C = { name = format("Package", "Crates") },
D = { name = format("Database", "DbUI") },
}, { prefix = "<leader>" })
end,
opts = {
key_labels = {
["<space>"] = " ",
},
icons = {
group = "",
},
window = {
border = "rounded",
},
},
}

View file

@ -0,0 +1,168 @@
local icons = require("utils.icons").icons
local fmt = require("utils.icons").fmt
local M = {}
M.mode = {
"mode",
fmt = function(name)
local map = {
NORMAL = icons.Normal,
INSERT = icons.Insert,
TERMINAL = icons.Terminal,
VISUAL = icons.Visual,
["V-LINE"] = icons.Visual,
["V-BLOCK"] = icons.Visual,
["O-PENDING"] = icons.Ellipsis,
COMMAND = icons.Command,
REPLACE = icons.Edit,
SELECT = icons.Visual,
}
local icon = map[name] and map[name] or icons.Vim
return icon .. " " .. name
end,
color = function()
local colors = require("tokyonight.colors")
local mode = vim.fn.mode()
local map = {
n = colors.default.blue,
i = colors.default.green,
c = colors.default.yellow,
t = colors.default.cyan,
R = colors.default.red,
v = colors.default.magenta,
V = colors.default.magenta,
s = colors.default.magenta,
S = colors.default.magenta,
}
return {
fg = map[mode] or colors.default.magenta,
bg = colors.night.bg,
}
end,
}
M.branch = {
"branch",
icon = icons.GitBranch,
color = function()
local colors = require("tokyonight.colors")
return { bg = colors.night.bg }
end,
}
M.diff = {
"diff",
symbols = {
added = fmt("Add", ""),
modified = fmt("Modified", ""),
removed = fmt("Removed", ""),
},
color = function()
local colors = require("tokyonight.colors")
return { bg = colors.night.bg }
end,
}
M.filetype = { "filetype" }
M.diagnostics = {
"diagnostics",
color = function()
local colors = require("tokyonight.colors")
return { bg = colors.night.bg }
end,
}
M.encoding = {
"encoding",
color = function()
local colors = require("tokyonight.colors")
return { fg = colors.default.blue, bg = colors.night.bg }
end,
}
M.fileformat = {
"fileformat",
color = function()
local colors = require("tokyonight.colors")
return { fg = colors.default.blue, bg = colors.night.bg }
end,
}
M.indentation = {
"indentation",
fmt = function()
local type = vim.bo[0].expandtab and "spaces" or "tabs"
local value = vim.bo[0].shiftwidth
return type .. ": " .. value
end,
color = function()
local colors = require("tokyonight.colors")
return { fg = colors.default.blue, bg = colors.night.bg }
end,
}
M.progress = {
"progress",
fmt = function(location)
return vim.trim(location)
end,
color = function()
local colors = require("tokyonight.colors")
return { fg = colors.default.purple, bg = colors.night.bg }
end,
}
M.location = {
"location",
fmt = function(location)
return vim.trim(location)
end,
color = function()
local colors = require("tokyonight.colors")
return { fg = colors.default.purple, bg = colors.night.bg }
end,
}
M.macro = {
function()
return vim.fn.reg_recording()
end,
icon = icons.Recording,
color = function()
local colors = require("tokyonight.colors")
return { fg = colors.default.red }
end,
}
M.lsp = {
function()
local bufnr = vim.api.nvim_get_current_buf()
local clients = vim.lsp.get_clients({ bufnr = bufnr })
if next(clients) == nil then
return ""
end
local attached_clients = vim.tbl_map(function(client)
return client.name
end, clients)
return table.concat(attached_clients, ", ")
end,
icon = icons.Braces,
color = function()
local colors = require("tokyonight.colors")
return { fg = colors.default.comment, bg = colors.night.bg }
end,
}
M.gap = {
function()
return " "
end,
color = function()
local colors = require("tokyonight.colors")
return { bg = colors.night.bg }
end,
padding = 0,
}
return M

View file

@ -0,0 +1,48 @@
local M = {}
local set_options = function(options)
for prop, variables in pairs(options) do
for key, value in pairs(variables) do
vim[prop][key] = value
end
end
end
local set_keymaps = function(keymaps)
for mode, maps in pairs(keymaps) do
for key, map in pairs(maps) do
vim.keymap.set(mode, key, map[1], { desc = map[2] })
end
end
end
local set_autocmd = function(autocmd)
for _, cmd in ipairs(autocmd) do
vim.api.nvim_create_autocmd(cmd.event, cmd.opts)
end
end
local set_signs = function(signs)
for _, sign in ipairs(signs) do
vim.fn.sign_define(sign.name, sign)
end
end
local init_lazy = function(spec)
local opts = {
ui = { border = "rounded" },
spec = { import = spec },
}
require("lazy").setup(opts)
end
M.setup = function(opts)
set_options(opts.options or {})
set_keymaps(opts.keymaps or {})
set_autocmd(opts.autocmd or {})
set_signs(opts.signs or {})
init_lazy(opts.spec)
end
return M

View file

@ -0,0 +1,170 @@
local M = {}
local input = function(prompt, callback)
local value = vim.fn.input(prompt)
if value:len() ~= 0 then
callback(value)
end
end
local select = function(prompt, callback)
vim.ui.select({ "tabs", "spaces" }, {
prompt = prompt,
}, function(choice)
if choice then
callback(choice)
end
end)
end
M.freeze = function()
local path = "./._freeze.png"
vim.cmd("Freeze")
-- Run the shell command 'wl-copy <path>' after 'Freeze' completes
vim.fn.system("wl-copy < " .. path)
vim.fn.system("rm " .. path)
end
M.freeze_selection = function()
local path = "./._freeze.png"
vim.api.nvim_feedkeys(vim.api.nvim_replace_termcodes("<Esc>", false, true, true), "nx", false)
-- Retrieve buffer ID for the current buffer
local buf = vim.api.nvim_get_current_buf()
-- Get positions of the start ('<') and end ('>') of the visual selection
local start_pos = vim.api.nvim_buf_get_mark(buf, "<")
local end_pos = vim.api.nvim_buf_get_mark(buf, ">")
-- Retrieve the line numbers from the positions
local start_line = start_pos[1]
local end_line = end_pos[1]
-- Execute the 'Freeze' command on the selected range
vim.cmd(start_line .. "," .. end_line .. "Freeze")
-- Run the shell command 'wl-copy <path>' after 'Freeze' completes
vim.fn.system("wl-copy < " .. path)
vim.fn.system("rm " .. path)
end
M.set_filetype = function()
input("Set filetype: ", function(value)
vim.bo[0].filetype = value
vim.notify("Filetype set to " .. value)
end)
end
M.set_indent = function()
input("Set indentation: ", function(value)
local type = vim.bo[0].expandtab and "spaces" or "tabs"
local parsed = tonumber(value)
if parsed then
vim.bo[0].shiftwidth = parsed
vim.notify("Indentation set to " .. value .. " " .. type)
else
vim.notify("Invalid value", vim.log.levels.ERROR)
end
end)
end
M.set_indent_type = function()
select("Indent using: ", function(choice)
if choice == "spaces" then
vim.o.expandtab = true
else
vim.o.expandtab = false
end
vim.notify("Indentation using " .. choice)
end)
end
M.toggle_wrap = function()
vim.wo.wrap = not vim.wo.wrap
vim.wo.linebreak = not vim.wo.linebreak
end
M.comment_line = function()
require("Comment.api").toggle.linewise.count(vim.v.count > 0 and vim.v.count or 1)
end
M.comment_selection = function()
vim.cmd("normal <esc>")
require("Comment.api").toggle.linewise(vim.fn.visualmode())
end
M.first_buffer = function()
require("bufferline").go_to(1)
end
M.last_buffer = function()
require("bufferline").go_to(-1)
end
M.buf_hsplit = function()
require("bufferline.pick").choose_then(function(id)
local name = vim.api.nvim_buf_get_name(id)
vim.cmd("sp" .. name)
vim.cmd("wincmd x")
vim.cmd("wincmd w")
end)
end
M.buf_vsplit = function()
require("bufferline.pick").choose_then(function(id)
local name = vim.api.nvim_buf_get_name(id)
vim.cmd("vsp" .. name)
vim.cmd("wincmd x")
vim.cmd("wincmd w")
end)
end
M.open_lazygit = function()
require("toggleterm.terminal").Terminal
:new({
cmd = "lazygit",
hidden = true,
float_opts = {
width = 100,
height = 25,
},
on_close = function()
if package.loaded["neo-tree"] then
require("neo-tree.events").fire_event("git_event")
end
end,
})
:open()
end
M.open_glow = function()
require("toggleterm.terminal").Terminal
:new({
cmd = "glow",
hidden = true,
float_opts = {
width = 100,
height = 25,
},
})
:open()
end
M.open_dapui = function()
require("neo-tree").close_all()
require("dapui").open()
end
M.close_dapui = function()
require("dapui").close()
end
M.toggle_dapui = function()
vim.cmd("NeoTreeShowToggle")
require("dapui").toggle()
end
return M

View file

@ -0,0 +1,113 @@
local M = {}
M.icons = {
Vim = "",
Config = "",
Normal = "󰡛",
Insert = "󰌌",
Terminal = "",
Visual = "󰉸",
Command = "",
Save = "󰳻",
NotSaved = "󱙃",
Restore = "",
Trash = "",
Fedora = "",
Lua = "",
Github = "",
Git = "󰊢",
GitDiff = "",
GitBranch = "",
GitCommit = "",
Add = "󰐕",
Modified = "󰜥",
Removed = "󰍴",
DiffRemoved = "",
Error = "󰅚",
Info = "󰋽",
Warn = "",
Hint = "",
Package = "󰏖",
FileTree = "󰙅",
Folder = "",
EmptyFolder = "",
FolderClock = "󰪻",
FolderOpened = "",
File = "",
NewFile = "",
DefaultFile = "󰈙",
Color = "",
ColorPicker = "󰴱",
ColorOn = "󰌁",
ColorOff = "󰹊",
Swap = "󰓡",
Minimap = "",
Window = "",
Windows = "",
Ellipsis = "",
Search = "",
TextSearch = "󱩾",
TabSearch = "󱦞",
FileSearch = "󰱼",
Clear = "",
Braces = "󰅩",
Exit = "",
Debugger = "",
Breakpoint = "",
History = "",
Check = "󰄵",
SmallDot = "󰧞",
Dots = "󰇘",
Install = "",
Help = "󰋖",
Clipboard = "󰅌",
Indent = "",
LineWrap = "󰖶",
Comment = "󱋄",
Close = "󰅘",
Open = "󰏋",
Toggle = "󰔡",
Stop = "",
Restart = "",
CloseMultiple = "󰱞",
NextBuffer = "󰮱,",
PrevBuffer = "󰮳",
FoldClose = "",
FoldOpen = "",
Popup = "󰕛",
Vertical = "",
Horizontal = "",
Markdown = "󰽛",
Up = "",
Down = "",
Left = "",
Right = "",
Variable = "",
Symbol = "",
Stack = "",
Format = "󰉣",
Edit = "󰤌",
Fix = "",
Run = "󰐍",
Twilight = "󰖚",
Recording = "󰑋",
Notification = "󰍢",
NotificationDismiss = "󱙍",
NotificationLog = "󰍩",
Code = "",
DropDown = "󰁊",
Web = "󰖟",
Dependencies = "",
Update = "󰚰",
Database = "",
Pin = "",
Book = "󰂽",
BookmarkSearch = "󰺄",
Download = "󰇚",
}
M.fmt = function(icon, text, space)
return M.icons[icon] .. string.rep(" ", space or 1) .. text
end
return M

Some files were not shown because too many files have changed in this diff Show more