From 04d7e79f51676c4132b39391bbd15ac2c872e247 Mon Sep 17 00:00:00 2001 From: hexlocation Date: Wed, 17 Jul 2024 15:57:24 +0000 Subject: [PATCH] [manual] add dotfiles + install script --- .config/ags/config.js | 209 +++++++++++++++++++++++++++++ .config/ags/search.svg | 6 + .config/ags/style.css | 99 ++++++++++++++ .config/dots/install.sh | 85 ++++++++++++ .config/fontconfig/fonts.conf | 11 ++ .config/foot/foot.ini | 56 ++++++++ .config/gtk-3.0/settings.ini | 3 + .config/hypr/hyprland.conf | 186 ++++++++++++++++++++++++++ .config/hypr/hyprpaper.conf | 2 + .config/hypr/monitor.sh | 13 ++ .config/nvim/init.lua | 240 ++++++++++++++++++++++++++++++++++ .config/nvim/lazy-lock.json | 19 +++ .zshrc | 25 ++++ install | 1 + 14 files changed, 955 insertions(+) create mode 100644 .config/ags/config.js create mode 100644 .config/ags/search.svg create mode 100644 .config/ags/style.css create mode 100755 .config/dots/install.sh create mode 100644 .config/fontconfig/fonts.conf create mode 100644 .config/foot/foot.ini create mode 100644 .config/gtk-3.0/settings.ini create mode 100644 .config/hypr/hyprland.conf create mode 100644 .config/hypr/hyprpaper.conf create mode 100755 .config/hypr/monitor.sh create mode 100644 .config/nvim/init.lua create mode 100644 .config/nvim/lazy-lock.json create mode 100644 .zshrc create mode 120000 install diff --git a/.config/ags/config.js b/.config/ags/config.js new file mode 100644 index 0000000..ad7b172 --- /dev/null +++ b/.config/ags/config.js @@ -0,0 +1,209 @@ +/* Imports */ +const { query } = await Service.import("applications") +const hyprland = await Service.import('hyprland') + +/* Icons */ +const search_icon = Widget.Icon({ + size : 30, + className : 'search-icon', + icon : '/home/hex/.config/ags/search.svg' +}) + +/* Polls/Variables */ +const date_poller = Variable("", { + poll : [ 1000, 'date "+%H:%M:%S %b %e."' ], +}) + +/* Array storing all application results */ +let apps = [] + +let Application = (app) => { + return Widget.Button({ + child: Widget.Box({ + children: [ + Widget.Icon({ + icon: app.icon_name || "", + size: 16, + className: "app-icon", + }), + Widget.Label({ + className: "app-name", + label: app.name, + xalign: 0, + justification: 'left', + truncate: 'end', + wrap: true, + }) + ] + }), + className: 'app', + onClicked: () => { + App.closeWindow("search-window"); + app.launch() + }, + }) +} + +let app_container = Widget.Box({ + classNames: ['app-container'], + vertical: true, + visible: false, +}) + +const search_entry = Widget.Entry({ + placeholder_text : 'Search for an application...', + visibility : true, + className : 'search-entry', + onChange : ({text}) => { + apps = query(text).map(Application); + + /* Add first 10 results to container */ + app_container.children = apps.slice(0, 10); + }, + onAccept : () => { + apps[0].launch() + App.closeWindow('search-window'); + }, +}) + +// labels +const date_label = () => Widget.Label({ + hpack : 'end', + 'justification' : 'right', + className : 'bar-date', + label : date_poller.bind() +}) + +// utils +const dispatch = ws => hyprland.messageAsync(`dispatch workspace ${ws}`); + +let workspace_buttons = () => Array.from({ length: 10 }, (_, i) => i + 1).map(i => Widget.Button({ + className: 'wp-btn', + attribute: i, + label: `${i}`, + onClicked: () => dispatch(i), +})) + +const Workspaces = () => Widget.EventBox({ + onScrollUp: () => dispatch('+1'), + onScrollDown: () => dispatch('-1'), + child: Widget.Box({ + children: workspace_buttons(), + + // remove this setup hook if you want fixed number of buttons + setup: self => self.hook(hyprland, () => self.children.forEach(btn => { + btn.visible = hyprland.workspaces.some(ws => ws.id === btn.attribute); + let active_wp = hyprland.active.workspace.id + if(btn.attribute == active_wp) { + btn.toggleClassName('wp-btn-focused', true) + btn.toggleClassName('wp-btn-normal', false) + } else { + btn.toggleClassName('wp-btn-focused', false) + btn.toggleClassName('wp-btn-normal', true) + } + })) + }), +}) + +const right_bar_box = () => Widget.Box({ + className : 'bar-rightbox', + children : [ date_label() ], + hpack : "end", + spacing : 8, +}) + +const center_bar_box = () => Widget.Box({ + children : [], + className: 'center-container' +}) + +const left_bar_box = () => Widget.Box({ + className : 'bar-leftbox', + hpack : "start", + children: [Workspaces(), Widget.Box({ + className: 'title-box', + vertical: true, + children: [ + Widget.Label({ + xalign: '0', + className: 't-class' + }), + Widget.Label({ + className: 't-title' + }) + ], + setup: self => self.hook(hyprland.active.client, self => { + let client = hyprland.active.client; + self.children[0].label = `${client.class}` + self.children[1].label = client.title + }) + + })], + spacing : 8, +}) + +const searchBox = Widget.Box({ + className : 'search-box', + children : [ search_icon, search_entry ], +}) +/* +const itemBox = Widget.Box({ + className: 'item-box', + vertical: true, +}) +*/ +const mainAppBox = Widget.Box({ + vpack: 'start', + className : 'main-app-box', + vertical: true, + children : [ searchBox, app_container ], +}) + +// Gtk Windows + +const search = Widget.Window({ + vexpand: true, + vpack: 'end', + name : 'search-window', + className : 'search-window', + child : mainAppBox, + keymode : "exclusive", +}) + +search.on("key-press-event", (self, event) => { + if(event.get_keyval()[1] == 65307){ + App.closeWindow('search-window'); + } +}) + +let commonMargin = 10 + +const bar = (monitors = 2) => { + let bars = []; + for (let i = 0; i < monitors; i++) { + bars.push(Widget.Window({ + exclusivity : 'exclusive', + name : `bar-window-${i}`, + className : 'bar-window', + margins: [commonMargin,commonMargin,commonMargin,commonMargin], + anchor : [ 'top', 'left', 'right' ], + monitor: i, + child : Widget.CenterBox({ + className : 'bar-mainbox', + start_widget : left_bar_box(), + center_widget : center_bar_box(), + end_widget : right_bar_box(), + }), + })) + } + return bars; +} + +// main Gtk App +App.config({ + style : '/home/hex/.config/ags/style.css', + windows : [ search, ...bar(1) ], +}) + +// close search window by default +App.closeWindow('search-window'); diff --git a/.config/ags/search.svg b/.config/ags/search.svg new file mode 100644 index 0000000..85ad6b7 --- /dev/null +++ b/.config/ags/search.svg @@ -0,0 +1,6 @@ + + + + + + diff --git a/.config/ags/style.css b/.config/ags/style.css new file mode 100644 index 0000000..0a08f8a --- /dev/null +++ b/.config/ags/style.css @@ -0,0 +1,99 @@ +.search-entry { + min-width: 600px; + min-height: 60px; + font-family: 'Jetbrains Mono'; + font-weight: 300; + font-size: 20px; + color:white; + background: none; + border-radius: 20px; + padding-right: 15px; +} + +.search-icon { + padding-left: 15px; + padding-right: 15px; +} + +entry { + all: unset; + border-color: black; +} + +.search-window, .search-box { + background-color: rgba(10,10,10, 1); + border-top-left-radius: 20px; + border-top-right-radius: 20px; + border-radius: 20px; +} + +.app-icon { + padding-right: 5px; +} + +.bar-date { + padding-right: 8px; +} +.bar-mainbox { + min-height: 25px; +} +.app:focus { + font-weight: bold; + border: none; + outline: none; + background-color: rgba(12,62,117, 1); +} + +window { + font-family: 'Jetbrains Mono'; +} + +.t-class { + font-size: 12px; + margin: 0; + padding-left: 5px; +} +.t-title { + font-size: 10px; + margin: 0; + opacity: 0.5; + padding-left: 5px; +} + +.app-container { + font-family: 'Jetbrains Mono'; + padding: 10px; + border-bottom-right-radius: 20px; + border-bottom-left-radius: 20px; +} + +.app { + outline: none; + border-radius: 5px; + transition: none; + border: none; + background: none; +} + +.bar-window { + background-color: rgba(46,52,64,1); + border-radius: 3px; + color: white; + font-family: 'Jetbrains Mono'; + /*background-color: rgba(0,0,0,0.9);*/ +} + +.wp-btn { + background: none; + outline: none; + color: white; + border: none; +} + +.wp-btn-normal { + opacity: 0.2; +} + +.wp-btn-focused { + opacity: 1; +} diff --git a/.config/dots/install.sh b/.config/dots/install.sh new file mode 100755 index 0000000..a794f29 --- /dev/null +++ b/.config/dots/install.sh @@ -0,0 +1,85 @@ +#!/bin/bash + +# for killing process while in func scope +trap "exit 1" TERM +export SCRIPT_PID=$$ + +export DEPS=("Hyprland" "foot" "hyprpaper" "ags" "nvim" "zsh" "udevadm") + +# for doas users +export AS_ROOT="sudo" + +check_omz() { + if [ -e "~/.oh-my-zsh" ]; then + exit 1 + fi +} + +check_deps() { + notify "checking dependencies..." + arr_elem=$(echo "${#DEPS[@]}-1" | bc) + for i in $(seq 0 $arr_elem) + do + DEP=${DEPS[i]} + if ! type "$DEP" > /dev/null; then + err "dependency $DEP not found." + fi + done + check_omz || err "dependency oh-my-zsh not found." + notify "all dependencies have been met." +} + +install_backlight_rule() { + if [[ -e "/etc/udev/rules.d/backlight.rules" ]]; then + warn "backlight rules have already been installed, skipping..." + return + fi + notify "installing backlight rule..." + RULE='ACTION=="add", SUBSYSTEM=="backlight", RUN+="/bin/chgrp video $sys$devpath/brightness",RUN+="/bin/chmod g+w $sys$devpath/brightness"' + $AS_ROOT usermod -a -G video $USER || err "failed to add user to video group" + echo $RULE | sudo tee /etc/udev/rules.d/backlight.rules >> /dev/null || err "failed to write udev rule" + notify "installed backlight rule." +} + +kill_err(){ + kill -s TERM $SCRIPT_PID +} + +notify() { + echo -e "[note] $1" +} + +err() { + echo -e "[fail] $1" + kill_err +} + +warn() { + echo -e "[warn] $1" +} + +set_machine_type () { + if [[ -e "$HOME/.config/dots/laptop" ]] || [[ -e "$HOME/.config/dots/desktop" ]]; then + warn "machine type has already been set, skipping..." + return + fi + + notify "are you on a laptop or a desktop? (laptop/desktop) " + read MACHINE_TYPE + + if [[ "$MACHINE_TYPE" != "laptop" && "$MACHINE_TYPE" != "desktop" ]]; then + err "invalid machine type." + fi + + touch ~/.config/dots/$MACHINE_TYPE +} + +main() { + notify "hello there!" + check_deps + set_machine_type + install_backlight_rule + notify "everything has been installed successfully, enjoy!" +} + +main diff --git a/.config/fontconfig/fonts.conf b/.config/fontconfig/fonts.conf new file mode 100644 index 0000000..ce812d2 --- /dev/null +++ b/.config/fontconfig/fonts.conf @@ -0,0 +1,11 @@ + + + + + terminal-font + + JetBrains Mono + Noto Color Emoji + + + diff --git a/.config/foot/foot.ini b/.config/foot/foot.ini new file mode 100644 index 0000000..44b0f96 --- /dev/null +++ b/.config/foot/foot.ini @@ -0,0 +1,56 @@ +font=JetBrainsMono Nerd Font:size=10 +pad = 0x0 + +[cursor] +style=beam + +#[colors] +#alpha=0.5 +#background=000000 + +# NORD THEME +# -*- conf -*- +# theme: Nord +# author: Arctic Ice Studio , Sven Greb +# description: „Nord“ — An arctic, north-bluish color palette +# +# this specific foot theme is based on nord-alacritty: +# https://github.com/arcticicestudio/nord-alacritty/blob/develop/src/nord.yml + +[cursor] +color = 2e3440 d8dee9 +[colors] +alpha=0.7 +foreground = d8dee9 +background = 2e3440 + +# selection-foreground = d8dee9 +# selection-background = 4c566a + +regular0 = 3b4252 +regular1 = bf616a +regular2 = a3be8c +regular3 = ebcb8b +regular4 = 81a1c1 +regular5 = b48ead +regular6 = 88c0d0 +regular7 = e5e9f0 + +bright0 = 4c566a +bright1 = bf616a +bright2 = a3be8c +bright3 = ebcb8b +bright4 = 81a1c1 +bright5 = b48ead +bright6 = 8fbcbb +bright7 = eceff4 + +dim0 = 373e4d +dim1 = 94545d +dim2 = 809575 +dim3 = b29e75 +dim4 = 68809a +dim5 = 8c738c +dim6 = 6d96a5 +dim7 = aeb3bb + diff --git a/.config/gtk-3.0/settings.ini b/.config/gtk-3.0/settings.ini new file mode 100644 index 0000000..39fcef8 --- /dev/null +++ b/.config/gtk-3.0/settings.ini @@ -0,0 +1,3 @@ +[Settings] +gtk-application-prefer-dark-theme = true +gtk-key-theme-name = "Adwaita-dark" diff --git a/.config/hypr/hyprland.conf b/.config/hypr/hyprland.conf new file mode 100644 index 0000000..259cb06 --- /dev/null +++ b/.config/hypr/hyprland.conf @@ -0,0 +1,186 @@ +# Based on the default config + +# Start AGS daemon +exec="killall ags;ags" + +# Start hyprpaper +exec-once=hyprpaper + +# Start Pipewire daemon +exec-once=gentoo-pipewire-launcher + +# Terminal Daemon +exec-once=foot --server + +# Monitor Setup +exec=~/.config/hypr/monitor.sh +#monitor=eDP-1,1920x1080@59.94100,0x0,1 +#monitor=HDMI-A-3,1680x1050@59.88300,1920x0,1 + +# Set programs that you use +$terminal = footclient +$fileManager = dolphin +$menu = ags -t 'search-window' + +# Some default env vars. +env = XCURSOR_SIZE,24 +env = QT_QPA_PLATFORMTHEME,qt5ct # change to qt6ct if you have that + +# For all categories, see https://wiki.hyprland.org/Configuring/Variables/ +input { + kb_layout = us + kb_variant = + kb_model = + kb_options = + kb_rules = + + follow_mouse = 1 + + touchpad { + natural_scroll = no + } + + sensitivity = 0 # -1.0 to 1.0, 0 means no modification. +} + +general { + # See https://wiki.hyprland.org/Configuring/Variables/ for more + + gaps_in = 5 + gaps_out = 0,10,20,10 + border_size = 1 + col.active_border = rgb(81a1c1) + col.inactive_border = rgb(595959) + + layout = dwindle + + # Please see https://wiki.hyprland.org/Configuring/Tearing/ before you turn this on + allow_tearing = false +} + +decoration { + # See https://wiki.hyprland.org/Configuring/Variables/ for more + + rounding = 5 + + blur { + enabled = true + size = 3 + passes = 1 + } + + drop_shadow = yes + shadow_range = 2 + shadow_render_power = 10 + col.shadow = rgba(1a1a1aee) +} + +animations { + enabled = yes + + # Some default animations, see https://wiki.hyprland.org/Configuring/Animations/ for more + + bezier = myBezier, 0.05, 0.9, 0.1, 1.05 + + animation = windows, 1, 7, myBezier + animation = windowsOut, 1, 7, default, popin 80% + animation = border, 1, 10, default + animation = borderangle, 1, 8, default + animation = fade, 1, 7, default + animation = workspaces, 1, 6, default +} + +dwindle { + # See https://wiki.hyprland.org/Configuring/Dwindle-Layout/ for more + pseudotile = yes # master switch for pseudotiling. Enabling is bound to mainMod + P in the keybinds section below + preserve_split = yes # you probably want this +} + +master { + # See https://wiki.hyprland.org/Configuring/Master-Layout/ for more +} + +gestures { + # See https://wiki.hyprland.org/Configuring/Variables/ for more + workspace_swipe = off +} + +misc { + # See https://wiki.hyprland.org/Configuring/Variables/ for more + force_default_wallpaper = 0 # Set to 0 or 1 to disable the anime mascot wallpapers +} + +# Example windowrule v1 +# windowrule = float, ^(kitty)$ +# Example windowrule v2 +# windowrulev2 = float,class:^(kitty)$,title:^(kitty)$ +# See https://wiki.hyprland.org/Configuring/Window-Rules/ for more +#windowrulev2 = suppressevent maximize, class:.* # You'll probably like this. +windowrulev2 = float,class:^(footclient)$ + +# See https://wiki.hyprland.org/Configuring/Keywords/ for more +$mainMod = SUPER + +# Example binds, see https://wiki.hyprland.org/Configuring/Binds/ for more +bind = $mainMod, Return, exec, $terminal +bind = $mainMod, Q, killactive, +bind = $mainMod_SHIFT, E, exit, +bind = $mainMod, E, exec, $fileManager +bind = $mainMod, Space, togglefloating, +bind = $mainMod, D, exec, $menu +bind = $mainMod, P, pseudo, # dwindle +bind = $mainMod, J, togglesplit, # dwindle +bind = $mainMod, Print, exec, hyprshot -m output --clipboard-only + +# Move focus with mainMod + arrow keys +bind = $mainMod, left, movefocus, l +bind = $mainMod, right, movefocus, r +bind = $mainMod, up, movefocus, u +bind = $mainMod, down, movefocus, d + +# Switch workspaces with mainMod + [0-9] +bind = $mainMod, 1, workspace, 1 +bind = $mainMod, 2, workspace, 2 +bind = $mainMod, 3, workspace, 3 +bind = $mainMod, 4, workspace, 4 +bind = $mainMod, 5, workspace, 5 +bind = $mainMod, 6, workspace, 6 +bind = $mainMod, 7, workspace, 7 +bind = $mainMod, 8, workspace, 8 +bind = $mainMod, 9, workspace, 9 +bind = $mainMod, 0, workspace, 10 + +# Move active window to a workspace with mainMod + SHIFT + [0-9] +bind = $mainMod SHIFT, 1, movetoworkspace, 1 +bind = $mainMod SHIFT, 2, movetoworkspace, 2 +bind = $mainMod SHIFT, 3, movetoworkspace, 3 +bind = $mainMod SHIFT, 4, movetoworkspace, 4 +bind = $mainMod SHIFT, 5, movetoworkspace, 5 +bind = $mainMod SHIFT, 6, movetoworkspace, 6 +bind = $mainMod SHIFT, 7, movetoworkspace, 7 +bind = $mainMod SHIFT, 8, movetoworkspace, 8 +bind = $mainMod SHIFT, 9, movetoworkspace, 9 +bind = $mainMod SHIFT, 0, movetoworkspace, 10 + +# Example special workspace (scratchpad) +bind = $mainMod, S, togglespecialworkspace, magic +bind = $mainMod SHIFT, S, movetoworkspace, special:magic + +# App Launcher Anim Fix +layerrule = noanim, search-window + +# Force Wayland +env = QT_QPA_PLATFORM,wayland + +# Scroll through existing workspaces with mainMod + scroll +bind = $mainMod, mouse_down, workspace, e+1 +bind = $mainMod, mouse_up, workspace, e-1 + +# Move/resize windows with mainMod + LMB/RMB and dragging +bindm = $mainMod, mouse:272, movewindow +bindm = $mainMod, mouse:273, resizewindow + +bind = CTRL, ALT_L, submap, passthrough + submap = passthrough +bind = CTRL, ALT_L, submap, reset + submap = reset diff --git a/.config/hypr/hyprpaper.conf b/.config/hypr/hyprpaper.conf new file mode 100644 index 0000000..17d4c28 --- /dev/null +++ b/.config/hypr/hyprpaper.conf @@ -0,0 +1,2 @@ +preload = /home/hex/wallpaper.jpg +wallpaper = eDP-1,/home/hex/wallpaper.jpg diff --git a/.config/hypr/monitor.sh b/.config/hypr/monitor.sh new file mode 100755 index 0000000..646ba73 --- /dev/null +++ b/.config/hypr/monitor.sh @@ -0,0 +1,13 @@ +#!/bin/bash + +# Laptop configuration +LAPTOP=~/.config/dots/laptop +if [ -e "$LAPTOP" ]; then + #hyprctl keyword monitor eDP-1,1920x1080@59.94100,0x0,1 + hyprctl keyword monitor eDP-1,highrr,0x0,1,vrr,1 + exit 0 +fi + +# Desktop configuration +hyprctl keyword monitor DVI-D-0,1920x1080@60,0x0,1 +hyprctl keyword monitor HDMI-A-3,1680x1050@59.88300,1920x0,1 diff --git a/.config/nvim/init.lua b/.config/nvim/init.lua new file mode 100644 index 0000000..224e390 --- /dev/null +++ b/.config/nvim/init.lua @@ -0,0 +1,240 @@ +-- path to lazyvim dir +local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim" + +-- install lazynvim +if not vim.loop.fs_stat(lazypath) then + vim.fn.system({ + "git", + "clone", + "--filter=blob:none", + "https://github.com/folke/lazy.nvim.git", + "--branch=stable", -- latest stable release + lazypath, + }) +end + +-- formatting +vim.opt.tabstop = 2 +vim.opt.shiftwidth = 2 +vim.opt.expandtab = true +vim.bo.softtabstop = 2 +vim.opt.termguicolors = true + +-- stuff +vim.g.loaded_netrw = 1 +vim.g.loaded_netrwPlugin = 1 + +-- add lazypath +vim.opt.rtp:prepend(lazypath) + +-- redirects +local keymap = vim.keymap.set + +-- tree toggle +local tree_open = false +function treetoggle() + local c = vim.cmd + if (tree_open) + then + c('NvimTreeClose') + else + c('NvimTreeOpen') + end + tree_open = not tree_open +end + +function open_diag() + vim.diagnostic.open_float(nil, { focus = false, scope = "cursor"}) +end + +keymap("n", "", open_diag, {silent=true,noremap=true}) +keymap("n", "", treetoggle, {silent=true,noremap=true}) +--keymap("n", "", require('fzf-lua').files(), {noremap=true}) +require('lazy').setup({ + { "bluz71/vim-moonfly-colors", name = "moonfly", lazy = false, priority = 1000 }, + {'ojroques/vim-oscyank'}, + + --{'rebelot/kanagawa.nvim'}, + { "hinell/duplicate.nvim" }, + { + 'VonHeikemen/lsp-zero.nvim', + branch = 'v3.x', + lazy = true, + config = false, + }, + { + 'neovim/nvim-lspconfig', + dependencies = { + {'hrsh7th/cmp-nvim-lsp'}, + } + }, + { + 'hrsh7th/nvim-cmp', + dependencies = { + {'L3MON4D3/LuaSnip'}, + {'hrsh7th/cmp-buffer'}, + {'hrsh7th/cmp-path'}, + {'hrsh7th/cmp-emoji'}, + }, + }, + {"neovim/nvim-lspconfig"}, + { + "nvim-tree/nvim-tree.lua", + version = "*", + lazy = false, + dependencies = { + "nvim-tree/nvim-web-devicons", + }, + config = function() + require("nvim-tree").setup ({}) + end, + }, +{ + "ibhagwan/fzf-lua", + -- optional for icon support + dependencies = { "nvim-tree/nvim-web-devicons" }, + config = function() + -- calling `setup` is optional for customization + require("fzf-lua").setup({}) + end +}, + --[[ + { + 'olivercederborg/poimandres.nvim', + lazy = false, + priority = 1000, + config = function() + require('poimandres').setup { + -- leave this setup function empty for default config + -- or refer to the configuration section + -- for configuration options + bold_vert_split = true, + dim_nc_background = true, + disable_background = false, + } + end, + + -- optionally set the colorscheme within lazy config + init = function() + vim.cmd("colorscheme poimandres") + end + }, + ]]-- + { + 'nvim-lualine/lualine.nvim', + dependencies = { 'nvim-tree/nvim-web-devicons' } + }, + {"shaunsingh/nord.nvim"} +}) +keymap("n", "", require('fzf-lua').files, {noremap=true}) +require('lualine').setup() + +-- theme shenanigans +vim.cmd("colorscheme nord") + +-- nvim-tree default thing +require("nvim-tree").setup({ + sort = { + sorter = "case_sensitive", + }, + view = { + width = 30, + }, + renderer = { + group_empty = true, + }, + filters = { + dotfiles = true, + }, +}) + +vim.opt.termguicolors = true + +local lsp_zero = require('lsp-zero') + +lsp_zero.on_attach(function(client, bufnr) + lsp_zero.default_keymaps({buffer = bufnr}) +end) + +require('lspconfig').tsserver.setup({}) +require('lspconfig').cssmodules_ls.setup({}) + +vim.wo.number = true + +local cmp = require('cmp') + +cmp.setup({ + snippet = { + expand = function(args) + require('luasnip').lsp_expand(args.body) + end, + }, + window = { + completion = cmp.config.window.bordered(), + }, + mapping = cmp.mapping.preset.insert({ + [''] = cmp.mapping.scroll_docs(-4), + [''] = cmp.mapping.scroll_docs(4), + [''] = cmp.mapping.complete(), + [''] = cmp.mapping.abort(), + [''] = cmp.mapping.confirm({ select = true }), + }), + sources = cmp.config.sources({ + { name = 'nvim_lsp' }, + { name = 'luasnip' }, -- For luasnip users. + -- { name = 'ultisnips' }, -- For ultisnips users. + -- { name = 'snippy' }, -- For snippy users. + }, + { + { name = 'buffer' }, + }) +}) + +require'lspconfig'.lua_ls.setup { + on_init = function(client) + local path = client.workspace_folders[1].name + if vim.loop.fs_stat(path..'/.luarc.json') or vim.loop.fs_stat(path..'/.luarc.jsonc') then + return + end + + client.config.settings.Lua = vim.tbl_deep_extend('force', client.config.settings.Lua, { + runtime = { + -- Tell the language server which version of Lua you're using + -- (most likely LuaJIT in the case of Neovim) + version = 'LuaJIT' + }, + -- Make the server aware of Neovim runtime files + workspace = { + checkThirdParty = false, + library = { + vim.env.VIMRUNTIME + -- Depending on the usage, you might want to add additional paths here. + -- "${3rd}/luv/library" + -- "${3rd}/busted/library", + } + -- or pull in all of 'runtimepath'. NOTE: this is a lot slower + -- library = vim.api.nvim_get_runtime_file("", true) + } + }) + end, + settings = { + Lua = {} + } +} +local capabilities = require('cmp_nvim_lsp').default_capabilities() + +capabilities.textDocument.completion.completionItem.snippetSupport = true + +require('lspconfig').html.setup( { + capabilities = capabilities, +}) +require('lspconfig').gopls.setup({ + capabilities = capabilities, +}) +-- require('lspconfig').tailwindcss.setup({}) +require('lspconfig').rust_analyzer.setup({ + capabilities = capabilities, +}) + +vim.keymap.set({ "n" }, "" ,"LineDuplicate -1") +vim.keymap.set({ "n" }, "" ,"LineDuplicate +1") diff --git a/.config/nvim/lazy-lock.json b/.config/nvim/lazy-lock.json new file mode 100644 index 0000000..83d19ef --- /dev/null +++ b/.config/nvim/lazy-lock.json @@ -0,0 +1,19 @@ +{ + "LuaSnip": { "branch": "master", "commit": "50fcf17db7c75af80e6b6109acfbfb4504768780" }, + "cmp-buffer": { "branch": "main", "commit": "3022dbc9166796b644a841a02de8dd1cc1d311fa" }, + "cmp-emoji": { "branch": "main", "commit": "e8398e2adf512a03bb4e1728ca017ffeac670a9f" }, + "cmp-nvim-lsp": { "branch": "main", "commit": "39e2eda76828d88b773cc27a3f61d2ad782c922d" }, + "cmp-path": { "branch": "main", "commit": "91ff86cd9c29299a64f968ebb45846c485725f23" }, + "duplicate.nvim": { "branch": "main", "commit": "ab057af7872c44e6fbd48df9b03983c8e67c50a7" }, + "fzf-lua": { "branch": "main", "commit": "eb63a4bbfd203942737f76d4cf5424f6fb016a9d" }, + "lazy.nvim": { "branch": "main", "commit": "b02c9eae6a250f98908c146d1dc1a891f5019f0a" }, + "lsp-zero.nvim": { "branch": "v3.x", "commit": "16de3b18c5f7b6230d89b8e64ce9a4801b6f8d08" }, + "lualine.nvim": { "branch": "master", "commit": "6a40b530539d2209f7dc0492f3681c8c126647ad" }, + "moonfly": { "branch": "master", "commit": "31f65a1bbddd7de9a639d8d0e32b8066c0de1da1" }, + "nord.nvim": { "branch": "master", "commit": "80c1e5321505aeb22b7a9f23eb82f1e193c12470" }, + "nvim-cmp": { "branch": "main", "commit": "a110e12d0b58eefcf5b771f533fc2cf3050680ac" }, + "nvim-lspconfig": { "branch": "master", "commit": "92166b89ab4b3d60f24e58170cac53b7141fd032" }, + "nvim-tree.lua": { "branch": "master", "commit": "2bc725a3ebc23f0172fb0ab4d1134b81bcc13812" }, + "nvim-web-devicons": { "branch": "master", "commit": "b4b302d6ae229f67df7a87ef69fa79473fe788a9" }, + "vim-oscyank": { "branch": "main", "commit": "c37c9d98e8a0aed749624fa14a7ece7913cf34de" } +} diff --git a/.zshrc b/.zshrc new file mode 100644 index 0000000..851a1e8 --- /dev/null +++ b/.zshrc @@ -0,0 +1,25 @@ +export ZSH="$HOME/.oh-my-zsh" +source $ZSH/oh-my-zsh.sh + +# omz theme +ZSH_THEME="amuse" + +# for laptop backlight +# alias bl="echo $1 | sudo tee /sys/class/backlight/intel_backlight/brightness" +export BL_DEVICE=/sys/class/backlight/intel_backlight +backlight() { + echo $1 > $BL_DEVICE/brightness +} +plugins=( + zsh-autosuggestions + git +) + +source $ZSH/oh-my-zsh.sh + +export NODE_PATH=/usr/lib/node_modules +# flyscrape +export PATH="/home/hex/.flyscrape:/home/hex/.cargo/bin:$PATH:$HOME/go/bin" + +# Created by `pipx` on 2024-07-17 11:05:58 +export PATH="$PATH:/home/hex/.local/bin" diff --git a/install b/install new file mode 120000 index 0000000..9a7b6c7 --- /dev/null +++ b/install @@ -0,0 +1 @@ +./.config/dots/install.sh \ No newline at end of file