From b49db78ed5e0fd34f3720d38fd179f12d939699d Mon Sep 17 00:00:00 2001 From: xeovalyte Date: Mon, 15 Apr 2024 15:06:07 +0200 Subject: [PATCH] Updated Rofi and Neovim config --- modules/home/desktop/hyprland/default.nix | 2 +- modules/home/desktop/hyprland/rofi.nix | 116 ++++++++++++++++++ modules/home/programs/neovim/autocmd.lua | 7 ++ modules/home/programs/neovim/default.nix | 9 +- modules/home/programs/neovim/options.lua | 2 +- .../home/programs/neovim/plugins/harpoon.lua | 10 ++ modules/home/programs/neovim/plugins/lsp.lua | 5 +- .../home/programs/neovim/plugins/lualine.lua | 40 ++++++ 8 files changed, 184 insertions(+), 7 deletions(-) create mode 100644 modules/home/desktop/hyprland/rofi.nix create mode 100644 modules/home/programs/neovim/plugins/harpoon.lua create mode 100644 modules/home/programs/neovim/plugins/lualine.lua diff --git a/modules/home/desktop/hyprland/default.nix b/modules/home/desktop/hyprland/default.nix index 8cf8c0c..a990c4b 100644 --- a/modules/home/desktop/hyprland/default.nix +++ b/modules/home/desktop/hyprland/default.nix @@ -8,10 +8,10 @@ ./fixes.nix ./hypridle.nix ./dunst.nix + ./rofi.nix ]; home.packages = with pkgs; [ - rofi kitty wev brightnessctl diff --git a/modules/home/desktop/hyprland/rofi.nix b/modules/home/desktop/hyprland/rofi.nix new file mode 100644 index 0000000..36d1d0d --- /dev/null +++ b/modules/home/desktop/hyprland/rofi.nix @@ -0,0 +1,116 @@ +{ config, ... }: +{ + programs.rofi = { + enable = true; + theme = let + inherit (config.lib.formats.rasi) mkLiteral; + in { + "*" = { + background-color = mkLiteral "#${config.colorScheme.palette.base00}"; + foreground-color = mkLiteral "#${config.colorScheme.palette.base05}"; + text-color = mkLiteral "#${config.colorScheme.palette.base07}"; + border-color = mkLiteral "#${config.colorScheme.palette.base04}"; + }; + # Holds the entire window + "#window" = { + transparency = "real"; + background-color = mkLiteral "#${config.colorScheme.palette.base00}"; + text-color = mkLiteral "#${config.colorScheme.palette.base07}"; + border = mkLiteral "0px"; + border-color = mkLiteral "#${config.colorScheme.palette.base04}"; + border-radius = mkLiteral "4px"; + width = mkLiteral "850px"; + padding = mkLiteral "8px"; + }; + + # Wrapper around bar and results + "#mainbox" = { + background-color = mkLiteral "#${config.colorScheme.palette.base00}"; + border = mkLiteral "0px"; + border-radius = mkLiteral "0px"; + border-color = mkLiteral "#${config.colorScheme.palette.base04}"; + children = map mkLiteral [ "inputbar" "message" "listview" ]; + spacing = mkLiteral "10px"; + padding = mkLiteral "10px"; + }; + + # Unknown + "#textbox-prompt-colon" = { + expand = false; + str = ":"; + margin = mkLiteral "0px 0.3em 0em 0em"; + text-color = mkLiteral "#${config.colorScheme.palette.base07}"; + }; + + # Command prompt left of the input + "#prompt" = { enabled = false; }; + + # Actual text box + "#entry" = { + placeholder-color = mkLiteral "#${config.colorScheme.palette.base03}"; + expand = true; + horizontal-align = "0"; + placeholder = ""; + padding = mkLiteral "0px 0px 0px 5px"; + blink = true; + }; + + # Top bar + "#inputbar" = { + children = map mkLiteral [ "prompt" "entry" ]; + border = mkLiteral "1px"; + border-radius = mkLiteral "4px"; + padding = mkLiteral "6px"; + }; + + # Results + "#listview" = { + background-color = mkLiteral "#${config.colorScheme.palette.base00}"; + padding = mkLiteral "0px"; + columns = 1; + lines = 12; + spacing = "5px"; + cycle = true; + dynamic = true; + layout = "vertical"; + }; + + # Each result + "#element" = { + orientation = "vertical"; + border-radius = mkLiteral "0px"; + padding = mkLiteral "5px 0px 5px 5px"; + }; + "#element.selected" = { + border = mkLiteral "1px"; + border-radius = mkLiteral "4px"; + border-color = mkLiteral "#${config.colorScheme.palette.base07}"; + background-color = mkLiteral "#${config.colorScheme.palette.base04}"; + text-color = mkLiteral "#${config.colorScheme.palette.base00}"; + }; + + "#element-text" = { + expand = true; + # horizontal-align = mkLiteral "0.5"; + vertical-align = mkLiteral "0.5"; + margin = mkLiteral "0px 2.5px 0px 2.5px"; + }; + "#element-text.selected" = { + background-color = mkLiteral "#${config.colorScheme.palette.base04}"; + text-color = mkLiteral "#${config.colorScheme.palette.base00}"; + }; + + # Not sure how to get icons + "#element-icon" = { + size = mkLiteral "18px"; + border = mkLiteral "0px"; + padding = mkLiteral "2px 5px 2px 2px"; + background-color = mkLiteral "#${config.colorScheme.palette.base00}"; + }; + "#element-icon.selected" = { + background-color = mkLiteral "#${config.colorScheme.palette.base04}"; + text-color = mkLiteral "#${config.colorScheme.palette.base00}"; + }; + }; + }; +} diff --git a/modules/home/programs/neovim/autocmd.lua b/modules/home/programs/neovim/autocmd.lua index 8f53ff7..4cbef5b 100644 --- a/modules/home/programs/neovim/autocmd.lua +++ b/modules/home/programs/neovim/autocmd.lua @@ -15,3 +15,10 @@ api.nvim_create_autocmd({ }, { pattern = "*.mcfunction", command = "set filetype=mcfunction" } ) + +api.nvim_create_autocmd({ + + "VimEnter" + }, + { callback = require('lualine').setup } +) diff --git a/modules/home/programs/neovim/default.nix b/modules/home/programs/neovim/default.nix index d12b937..ef1e840 100644 --- a/modules/home/programs/neovim/default.nix +++ b/modules/home/programs/neovim/default.nix @@ -119,8 +119,13 @@ } { - plugin = bufferline-nvim; - config = toLuaFile ./plugins/bufferline.lua; + plugin = lualine-nvim; + config = toLuaFile ./plugins/lualine.lua; + } + + { + plugin =harpoon; + config = toLuaFile ./plugins/harpoon.lua; } ]; }; diff --git a/modules/home/programs/neovim/options.lua b/modules/home/programs/neovim/options.lua index 7aaad15..d605f76 100644 --- a/modules/home/programs/neovim/options.lua +++ b/modules/home/programs/neovim/options.lua @@ -27,7 +27,7 @@ opt.sessionoptions = { "buffers", "curdir", "tabpages", "winsize" } opt.shiftround = true -- Round indent opt.shiftwidth = 2 -- Size of an indent opt.shortmess:append({ W = true, I = true, c = true }) -opt.showmode = false -- Dont show mode since we have a statusline +opt.showmode = true -- Dont show mode since we have a statusline opt.sidescrolloff = 8 -- Columns of context opt.signcolumn = "yes" -- Always show the signcolumn, otherwise it would shift the text each time opt.smartcase = true -- Don't ignore case with capitals diff --git a/modules/home/programs/neovim/plugins/harpoon.lua b/modules/home/programs/neovim/plugins/harpoon.lua new file mode 100644 index 0000000..d24130e --- /dev/null +++ b/modules/home/programs/neovim/plugins/harpoon.lua @@ -0,0 +1,10 @@ +local mark = require('harpoon.mark') +local ui = require('harpoon.ui') + +vim.keymap.set("n", "q", mark.add_file) +vim.keymap.set("n", "", ui.toggle_quick_menu) + +vim.keymap.set("n", "", function() ui.nav_file(1) end) +vim.keymap.set("n", "", function() ui.nav_file(2) end) +vim.keymap.set("n", "", function() ui.nav_file(3) end) +vim.keymap.set("n", "", function() ui.nav_file(4) end) diff --git a/modules/home/programs/neovim/plugins/lsp.lua b/modules/home/programs/neovim/plugins/lsp.lua index d9a9d9a..b1f6ec7 100644 --- a/modules/home/programs/neovim/plugins/lsp.lua +++ b/modules/home/programs/neovim/plugins/lsp.lua @@ -3,13 +3,11 @@ require("mason").setup{ } require("mason-lspconfig").setup() require('neodev').setup() +require('lsp-inlayhints').setup() local lspconfig = require('lspconfig') vim.g.rustaceanvim = { - inlay_hints = { - highlight = "NonText", - }, tools = { hover_actions = { auto_focus = true, @@ -18,6 +16,7 @@ vim.g.rustaceanvim = { server = { on_attach = function(client, bufnr) require("lsp-inlayhints").on_attach(client, bufnr) + require("lsp-inlayhints").show() end, default_settings = { ['rust-analyzer'] = { diff --git a/modules/home/programs/neovim/plugins/lualine.lua b/modules/home/programs/neovim/plugins/lualine.lua new file mode 100644 index 0000000..75ec32a --- /dev/null +++ b/modules/home/programs/neovim/plugins/lualine.lua @@ -0,0 +1,40 @@ +require('lualine').setup { + options = { + icons_enabled = true, + theme = 'auto', + component_separators = { left = '', right = ''}, + section_separators = { left = '', right = ''}, + disabled_filetypes = { + statusline = {}, + winbar = {}, + }, + ignore_focus = {}, + always_divide_middle = true, + globalstatus = true, + refresh = { + statusline = 1000, + tabline = 1000, + winbar = 1000, + } + }, + sections = { + lualine_a = {'mode'}, + lualine_b = {'branch', 'diff', 'diagnostics'}, + lualine_c = {'filename'}, + lualine_x = {'encoding', 'fileformat', 'filetype'}, + lualine_y = {'progress'}, + lualine_z = {'location'} + }, + inactive_sections = { + lualine_a = {}, + lualine_b = {}, + lualine_c = {'filename'}, + lualine_x = {'location'}, + lualine_y = {}, + lualine_z = {} + }, + tabline = {}, + winbar = {}, + inactive_winbar = {}, + extensions = {} +}