diff options
l--------- | config/hypr/hyprland.conf | 1 | ||||
-rw-r--r-- | config/nvim/init.lua | 14 | ||||
-rw-r--r-- | config/nvim/init.vim | 71 | ||||
-rw-r--r-- | config/nvim/lua/lsp.lua | 145 | ||||
-rw-r--r-- | config/nvim/lua/settings.lua | 34 | ||||
-rw-r--r-- | config/nvim/plugins.lua | 57 | ||||
-rw-r--r-- | config/waybar/config | 2 | ||||
-rw-r--r-- | hosts/jontop/default.nix | 7 | ||||
-rw-r--r-- | modules/desktop/apps/editors/neovim.nix | 41 | ||||
-rw-r--r-- | modules/desktop/apps/tmux.nix | 55 |
10 files changed, 277 insertions, 150 deletions
diff --git a/config/hypr/hyprland.conf b/config/hypr/hyprland.conf new file mode 120000 index 0000000..2cd79a9 --- /dev/null +++ b/config/hypr/hyprland.conf @@ -0,0 +1 @@ +/nix/store/kb2ii1nq7qfbs480iz2a1flb6n3kh1l8-home-manager-files/.config/hypr/hyprland.conf
\ No newline at end of file diff --git a/config/nvim/init.lua b/config/nvim/init.lua deleted file mode 100644 index 4a80830..0000000 --- a/config/nvim/init.lua +++ /dev/null @@ -1,14 +0,0 @@ -local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim" -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", - lazypath - }) -end -vim.opt.rtp:prepend(lazypath) - -require("lazy").setup("plugins") diff --git a/config/nvim/init.vim b/config/nvim/init.vim deleted file mode 100644 index 993ea88..0000000 --- a/config/nvim/init.vim +++ /dev/null @@ -1,71 +0,0 @@ -set termguicolors - -filetype plugin indent on -set tabstop=4 softtabstop=4 shiftwidth=4 -set expandtab smarttab -set autoindent -set incsearch ignorecase smartcase hlsearch -set encoding=utf-8 -set textwidth=0 -set number - -set hidden -set title -set noshowmode -set noruler -set noshowcmd - -set nobackup -set nowritebackup - -set updatetime=300 -set signcolumn=yes - -let mapleader = "\<Space>" - -" Tab-trigger completion -inoremap <silent><expr> <Tab> - \ coc#pum#visible() ? coc#pum#next(1) : - \ CheckBackspace() ? "\<Tab>" : - \ coc#refresh() -inoremap <expr><S-Tab> coc#pum#visible() ? coc#pum#prev(1) : "\<C-h>" - -inoremap <silent><expr> <CR> coc#pum#visible() ? coc#pum#confirm() : - \ "\<C-g>u\<CR>\<c-r>=coc#on_enter()\<CR>" - -function! CheckBackspace() abort - let col = col('.') - 1 - return !col || getline('.')[col - 1] =~# '\s' -endfunction - -inoremap <silent><expr> <c-space> coc#refresh() - -nmap <silent> [g <Plug>(coc-diagnostic-prev) -nmap <silent> ]g <Plug>(coc-diagnostic-next) - -nmap <silent> gd <Plug>(coc-definition) -nmap <silent> gy <Plug>(coc-type-definition) -nmap <silent> gi <Plug>(coc-implementation) -nmap <silent> gr <Plug>(coc-references) - -nnoremap <silent> K :call ShowDocumentation()<CR> - -function! ShowDocumentation() - if CocAction('hasProvider', 'hover') - call CocActionAsync('doHover') - else - call feedkeys('K', 'in') - endif -endfunction - -autocmd CursorHold * silent call CocActionAsync('highlight') - -" Telescope -nnoremap <leader>ff <cmd>Telescope find_files<cr> -nnoremap <leader>fg <cmd>Telescope live_grep<cr> -nnoremap <leader>fb <cmd>Telescope buffers<cr> -nnoremap <leader>fh help_tags<cr> - -lua require('init') - -color catppuccin diff --git a/config/nvim/lua/lsp.lua b/config/nvim/lua/lsp.lua new file mode 100644 index 0000000..1056431 --- /dev/null +++ b/config/nvim/lua/lsp.lua @@ -0,0 +1,145 @@ +local cmp = require("cmp") +local nvim_lsp = require("lspconfig") +local cmp_window = require("cmp.utils.window") + +vim.o.completeopt = "menuone,noselect" +vim.o.shortmess = vim.o.shortmess .. "c" + +local function on_attach(client, bufn) + local function map(...) + vim.api.nvim_buf_set_keymap(bufn, ...) + end + + local function buf_set_option(...) + vim.api.nvim_buf_set_option(bufn, ...) + end + + local opts = { noremap = true, silent = true } + map("n", "gD", "<Cmd>lua vim.lsp.buf.declaration()<CR>", opts) + map("n", "gd", "<Cmd>lua vim.lsp.buf.definition()<CR>", opts) + map("n", "K", "<Cmd>lua vim.lsp.buf.hover()<CR>", opts) + map("n", "gi", "<Cmd>lua vim.lsp.buf.implementation()<CR>", opts) + map("n", "<C-k>", "<Cmd>lua vim.lsp.buf.signature_help()<CR>", opts) + map("n", "<leader>D", "<Cmd>lua vim.lsp.buf.type_definition()<CR>", opts) + map("n", "gr", "<Cmd>lua vim.lsp.buf.references()<CR>", opts) + map("n", "<leader>e", "<cmd>lua vim.lsp.diagnostic.show_line_diagnostics()<CR>", opts) + map("n", "[d", "<Cmd>lua vim.lsp.diagnostic.goto_prev()<CR>", opts) + map("n", "]d", "<Cmd>lua vim.lsp.diagnostic.goto_next()<CR>", opts) + map("n", "<leader>q", "<Cmd>lua vim.lsp.diagnostic.set_loclist()<CR>", opts) + map("n", "ga", "<Cmd>lua vim.lsp.buf.code_action()<CR>", opts) +end + +local function has_words_before() + local line, col = unpack(vim.api.nvim_win_get_cursor(0)) + return col ~= 0 and vim.api.nvim_buf_get_lines(0, line - 1, line, true)[1]:sub(col, col):match("%s") == nil +end + +local function feedkey(key, mode) + vim.api.nvim_feedkeys(vim.api.nvim_replace_termcodes(key, true, true, true), mode, true) +end + +local function border(hl_name) + return { + { "╭", hl_name }, + { "─", hl_name }, + { "╮", hl_name }, + { "│", hl_name }, + { "╯", hl_name }, + { "─", hl_name }, + { "╰", hl_name }, + { "│", hl_name }, + } +end + +cmp_window.info_ = cmp_window.info +cmp_window.info = function(self) + local info = self:info_() + info.scrollable = false + return info +end + +cmp.setup({ + window = { + completion = { + border = border "CmpBorder", + winhighlight = "Normal:CmpPmenu,CursorLine:PmenuSel,Search:None", + }, + documentation = { + border = border "CmpDocBorder" + }, + }, + snippet = { + expand = function(args) + vim.fn["vsnip#anonymous"](args.body) + end, + }, + mapping = cmp.mapping.preset.insert({ + ['<C-b>'] = cmp.mapping.scroll_docs(-4), + ['<C-f>'] = cmp.mapping.scroll_docs(4), + ['<C-Space>'] = cmp.mapping.complete(), + ['<C-e>'] = cmp.mapping.abort(), + ['<CR>'] = cmp.mapping.confirm({select = true}), + ["<Tab>"] = cmp.mapping(function(fallback) + if cmp.visible() then + cmp.select_next_item() + elseif vim.fn["vsnip#available"](1) == 1 then + feedkey("<Plug>(vsnip-expand-or-jump)", "") + elseif has_words_before() then + cmp.complete() + else + fallback() + end + end, {"i", "s"}), + + ["<S-Tab"] = cmp.mapping(function() + if cmp.visible() then + cmp.select_prev_item() + elseif vim.fn["vsnip#jumpable"](-1) == 1 then + feedkey("<Plug>(vsnip-jump-prev)", "") + end + end, {"i", "s"}), + }), + sources = cmp.config.sources({ + { name = "nvim_lsp" }, + { name = "vsnip" }, + { name = "treesitter" }, + { name = "path", option = { trailing_slash = true }}, + { name = "buffer" } + }), +}) + +cmp.setup.cmdline(":", { + mapping = cmp.mapping.preset.cmdline(), + sources = cmp.config.sources({ + { name = "path" }, + }, { + { name = "cmdline" }, + }), +}) + +vim.lsp.handlers["textDocument/publishDiagnostics"] = vim.lsp.with( + vim.lsp.diagnostic.on_publish_diagnostics, { + virtual_text = true, + signs = true, + update_in_insert = true + } +) + +local capabilities = require("cmp_nvim_lsp").default_capabilities(vim.lsp.protocol.make_client_capabilities()) + +local servers = { "ccls", "bashls", "rnix", "texlab", "lua_ls" } + +for _, lang in pairs(servers) do + nvim_lsp[lang].setup({ + root_dir = vim.loop.cwd, + on_attach = on_attach, + capabilities = capabilities + }) +end + +require("nvim-treesitter.configs").setup({ + highlight = { enable = true, }, +}) + +require("gitsigns").setup({}) + diff --git a/config/nvim/lua/settings.lua b/config/nvim/lua/settings.lua new file mode 100644 index 0000000..6f440bb --- /dev/null +++ b/config/nvim/lua/settings.lua @@ -0,0 +1,34 @@ +vim.g.mapleader = " " + +vim.g.loaded_netrw = 1 +vim.g.loaded_netrwPlugin = 1 + +--Decorative +vim.opt.termguicolors = true +vim.opt.cursorline = true +vim.opt.number = true +vim.opt.signcolumn = "yes" +vim.opt.cmdheight = 1 +vim.cmd.colorscheme "catppuccin" + +--Undo +vim.opt.undofile = true + +--Indents +vim.opt.smartindent = true +vim.opt.autoindent = true +vim.opt.tabstop = 4 +vim.opt.shiftwidth = 4 +vim.opt.softtabstop = 4 +vim.opt.expandtab = true + +--Clipboard +vim.opt.clipboard = "unnamedplus" + +--Misc +vim.opt.hidden = true +vim.opt.smartcase = true +vim.opt.splitbelow = true +vim.opt.splitright = true +vim.opt.colorcolumn = "80" +vim.opt.updatetime = 250 diff --git a/config/nvim/plugins.lua b/config/nvim/plugins.lua deleted file mode 100644 index 83c74ad..0000000 --- a/config/nvim/plugins.lua +++ /dev/null @@ -1,57 +0,0 @@ -return -{ - { "neovim/nvim-lspconfig" }, - { "MordechaiHadad/nvim-lspmanager", - dependencies = { "neovim/nvim-lspconfig" }, - config = function() - require('lspmanager').setup({ - ensure_installed = { - "clangd" - } - }) - end - }, - { "nvim-treesitter/nvim-treesitter", - build = ":TSUpdate", - config = function() - require('nvim-treesitter.configs').setup{ - ensure_installed = { "c", "cpp" }, - auto_install = true, - highlight = { - enable = true - } - } - end - }, - { "neoclide/coc.nvim", branch="release" }, - { "nvim-lua/plenary.nvim" }, - { "nvim-telescope/telescope.nvim", tag = '0.1.3', - dependencies = { 'nvim-lua/plenary.nvim' } - }, - { "nvim-tree/nvim-web-devicons" }, - { "lewis6991/gitsigns.nvim", - config = function() - require('gitsigns').setup() - end - }, - { "tpope/vim-surround" }, - { "catppuccin/nvim", name="catppuccin", priority=1000 }, - { "feline-nvim/feline.nvim", - config = function() - local ctp_feline = require('catppuccin.groups.integrations.feline') - require('feline').setup({ - - }) - end - }, - { "romgrk/barbar.nvim", - dependencies = { - 'lewis6991/gitsigns.nvim', - 'nvim-tree/nvim-web-devicons' - }, - init = function() vim.g.barbar_auto_setup = false end, - config = function() - require('barbar').setup() - end - } -} diff --git a/config/waybar/config b/config/waybar/config index c9ad192..c747733 100644 --- a/config/waybar/config +++ b/config/waybar/config @@ -1,6 +1,6 @@ { "layer": "top", // Waybar at top layer - "width": 1900, // Waybar width + "width": 1300, // Waybar width "spacing": 4, // Gaps between modules (4px) // Choose the order of the modules "modules-left": ["hyprland/workspaces"], diff --git a/hosts/jontop/default.nix b/hosts/jontop/default.nix index cebdb90..b90038b 100644 --- a/hosts/jontop/default.nix +++ b/hosts/jontop/default.nix @@ -8,7 +8,6 @@ fileSystems."/" = { device = "/dev/disk/by-uuid/72e455f9-4b10-4cb2-a8e4-cfe39c4a8d1f"; fsType = "btrfs"; - options = [ "compress=zstd" "subvol=@" ]; }; fileSystems."/boot" = @@ -33,6 +32,12 @@ (nerdfonts.override { fonts = [ "FiraCode" ]; } ) ]; + environment.systemPackages = [ + pkgs.man-pages + pkgs.man-pages-posix + ]; + documentation.dev.enable = true; + modules = { device = { cpu = "intel"; diff --git a/modules/desktop/apps/editors/neovim.nix b/modules/desktop/apps/editors/neovim.nix index 77857a2..ee6424b 100644 --- a/modules/desktop/apps/editors/neovim.nix +++ b/modules/desktop/apps/editors/neovim.nix @@ -16,11 +16,6 @@ in { }; config = lib.mkIf (nvimConf.enable) { - - home.manager.xdg.configFile."nvim/init.vim".source = "${configDir}/nvim/init.vim"; - home.manager.xdg.configFile."nvim/lua/init.lua".source = "${configDir}/nvim/init.lua"; - home.manager.xdg.configFile."nvim/lua/plugins.lua".source = "${configDir}/nvim/plugins.lua"; - modules.desktop.defaultApplications.apps.editor = rec { package = pkgs.neovim; install = false; @@ -29,7 +24,11 @@ in { }; home.packages = [ - + pkgs.rnix-lsp + pkgs.ccls + pkgs.nodePackages.bash-language-server + pkgs.texlab + pkgs.sumneko-lua-language-server ]; home.manager.programs.neovim = { @@ -37,6 +36,36 @@ in { viAlias = true; vimAlias = true; withNodeJs = true; + + extraConfig = '' + luafile /etc/nixos/config/nvim/lua/settings.lua + luafile /etc/nixos/config/nvim/lua/lsp.lua + ''; + + plugins = with pkgs.vimPlugins; [ + nvim-web-devicons + gitsigns-nvim + nvim-tree-lua + catppuccin-nvim + + nvim-lspconfig + nvim-cmp + cmp-cmdline + cmp-nvim-lsp + cmp-buffer + cmp-path + cmp-vsnip + cmp-treesitter + + vim-nix + vim-vsnip + nvim-treesitter.withAllGrammars + neoformat + + bufferline-nvim + lualine-nvim + alpha-nvim + ]; }; }; } diff --git a/modules/desktop/apps/tmux.nix b/modules/desktop/apps/tmux.nix new file mode 100644 index 0000000..6b58d8d --- /dev/null +++ b/modules/desktop/apps/tmux.nix @@ -0,0 +1,55 @@ +{ + config, + options, + lib, + pkgs, + ... +}: let + tmuxConf = config.modules.desktop.apps.tmux; +in { + options.modules.desktop.apps.tmux = { + enable = lib.mkOption { + type = lib.types.bool; + default = true; + }; + }; + + config = lib.mkIf (tmuxConf.enable) { + home.manager.programs.tmux = { + enable = true; + terminal = "tmux-256color"; + historyLimit = 10000; + plugins = with pkgs.tmuxPlugins; + [ + catppuccin + vim-tmux-navigator + sensible + yank + ]; + shell = "${pkgs.zsh}/bin/zsh"; + extraConfig = '' +set-option -sa terminal-overrides ",xterm*:Tc" +set -g mouse on + +unbind C-b +set -g prefix C-Space +bind C-Space send-prefix + +bind -n M-H previous-window +bind -n M-L next-window + +set -g base-index 1 +set -g pane-base-index 1 +set-window-option -g pane-base-index 1 +set-option -g renumber-windows on + +bind-key -T copy-mode-vi v send-keys -X begin-selection +bind-key -T copy-mode-vi C-v send-keys -X rectangle-toggle +bind-key -T copy-mode-vi y send-keys -X copy-selection-and-cancel + +bind '"' split-window -v -c ''${pane_current_path}" +bind % split-window -h -c ''${pane_current_path}" + ''; + }; + }; +} |