diff --git a/.config/nvim/after/plugin/colors.lua b/.config/nvim/after/plugin/colors.lua new file mode 100755 index 0000000..38d7083 --- /dev/null +++ b/.config/nvim/after/plugin/colors.lua @@ -0,0 +1,9 @@ +function Colors(color) + color = color or "rose-pine" + vim.cmd.colorscheme(color) + + vim.api.nvim_set_hl(0, "Normal", { bg = "none" }) + vim.api.nvim_set_hl(0, "NormalFloat", { bg = "none" }) +end + +Colors() diff --git a/.config/nvim/init.lua b/.config/nvim/init.lua new file mode 100755 index 0000000..861dc9b --- /dev/null +++ b/.config/nvim/init.lua @@ -0,0 +1 @@ +require("rocketcamel") diff --git a/.config/nvim/lazy-lock.json b/.config/nvim/lazy-lock.json new file mode 100644 index 0000000..4253875 --- /dev/null +++ b/.config/nvim/lazy-lock.json @@ -0,0 +1,20 @@ +{ + "LuaSnip": { "branch": "master", "commit": "c9b9a22904c97d0eb69ccb9bab76037838326817" }, + "autoclose.nvim": { "branch": "main", "commit": "b2077aa2c83df7ebc19b2a20a3a0654b24ae9c8f" }, + "cmp-nvim-lsp": { "branch": "main", "commit": "99290b3ec1322070bcfb9e846450a46f6efa50f0" }, + "cmp-nvim-lsp-signature-help": { "branch": "main", "commit": "031e6ba70b0ad5eee49fd2120ff7a2e325b17fa7" }, + "cmp_luasnip": { "branch": "master", "commit": "98d9cb5c2c38532bd9bdb481067b20fea8f32e90" }, + "conform.nvim": { "branch": "master", "commit": "bf94626f32fbc3c9987ce2f4aab60d96866587df" }, + "fidget.nvim": { "branch": "main", "commit": "a0abbf18084b77d28bc70e24752e4f4fd54aea17" }, + "harpoon": { "branch": "harpoon2", "commit": "a84ab829eaf3678b586609888ef52f7779102263" }, + "lazy.nvim": { "branch": "main", "commit": "d8f26efd456190241afd1b0f5235fe6fdba13d4a" }, + "mason-lspconfig.nvim": { "branch": "main", "commit": "e942edf5c85b6a2ab74059ea566cac5b3e1514a4" }, + "mason.nvim": { "branch": "main", "commit": "e2f7f9044ec30067bc11800a9e266664b88cda22" }, + "neovim": { "branch": "main", "commit": "42f0724e0bca9f57f0bcfa688787c37b8d4befe8" }, + "nvim-cmp": { "branch": "main", "commit": "8c82d0bd31299dbff7f8e780f5e06d2283de9678" }, + "nvim-lspconfig": { "branch": "master", "commit": "513f4f0bde469ecb3abe2e1b606f63cf142e751e" }, + "nvim-treesitter": { "branch": "master", "commit": "4862ab0aca21e92771b72e2d7e70424b250f0dd4" }, + "nvim-ts-autotag": { "branch": "main", "commit": "1cca23c9da708047922d3895a71032bc0449c52d" }, + "plenary.nvim": { "branch": "master", "commit": "3707cdb1e43f5cea73afb6037e6494e7ce847a66" }, + "telescope.nvim": { "branch": "master", "commit": "415af52339215926d705cccc08145f3782c4d132" } +} diff --git a/.config/nvim/lua/rocketcamel/config/lazy.lua b/.config/nvim/lua/rocketcamel/config/lazy.lua new file mode 100755 index 0000000..7c852d5 --- /dev/null +++ b/.config/nvim/lua/rocketcamel/config/lazy.lua @@ -0,0 +1,33 @@ +-- Bootstrap lazy.nvim +local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim" +if not (vim.uv or vim.loop).fs_stat(lazypath) then + local lazyrepo = "https://github.com/folke/lazy.nvim.git" + local out = vim.fn.system({ "git", "clone", "--filter=blob:none", "--branch=stable", lazyrepo, lazypath }) + if vim.v.shell_error ~= 0 then + vim.api.nvim_echo({ + { "Failed to clone lazy.nvim:\n", "ErrorMsg" }, + { out, "WarningMsg" }, + { "\nPress any key to exit..." }, + }, true, {}) + vim.fn.getchar() + os.exit(1) + end +end +vim.opt.rtp:prepend(lazypath) + +-- Make sure to setup `mapleader` and `maplocalleader` before +-- loading lazy.nvim so that mappings are correct. +-- This is also a good place to setup other settings (vim.opt) +vim.g.mapleader = " " + +-- Setup lazy.nvim +require("lazy").setup({ + spec = { + { import = "rocketcamel.plugins" } + }, + -- Configure any other settings here. See the documentation for more details. + -- colorscheme that will be used when installing plugins. + install = { colorscheme = { "habamax" } }, + -- automatically check for plugin updates + checker = { enabled = true }, +}) diff --git a/.config/nvim/lua/rocketcamel/init.lua b/.config/nvim/lua/rocketcamel/init.lua new file mode 100755 index 0000000..5e183d7 --- /dev/null +++ b/.config/nvim/lua/rocketcamel/init.lua @@ -0,0 +1,3 @@ +require("rocketcamel.remap") +require("rocketcamel.config.lazy") +require("rocketcamel.set") diff --git a/.config/nvim/lua/rocketcamel/plugins/init.lua b/.config/nvim/lua/rocketcamel/plugins/init.lua new file mode 100755 index 0000000..e919829 --- /dev/null +++ b/.config/nvim/lua/rocketcamel/plugins/init.lua @@ -0,0 +1,193 @@ +return { + { + "nvim-telescope/telescope.nvim", + config = function() + local builtin = require("telescope.builtin") + vim.keymap.set("n", "pf", builtin.find_files, {}) + vim.keymap.set("n", "", builtin.git_files, {}) + vim.keymap.set("n", "ps", function() + builtin.grep_string({ search = vim.fn.input("Grep > ") }) + end) + end, + }, + { + "nvim-treesitter/nvim-treesitter", + opts = { + ensure_installed = { + "c", + "lua", + "vim", + "vimdoc", + "query", + "markdown", + "markdown_inline", + "javascript", + "typescript", + "tsx", + "rust", + "zig", + }, + sync_install = true, + auto_install = true, + highlight = { + enable = true, + additional_vim_regex_highlighting = false, + }, + indent = { + enable = true, + }, + }, + }, + { + "neovim/nvim-lspconfig", + dependencies = { + "williamboman/mason.nvim", + "williamboman/mason-lspconfig.nvim", + "hrsh7th/cmp-nvim-lsp", + "hrsh7th/nvim-cmp", + "j-hui/fidget.nvim", + "L3MON4D3/LuaSnip", + "saadparwaiz1/cmp_luasnip", + "hrsh7th/cmp-nvim-lsp-signature-help", + }, + config = function() + require("fidget").setup({}) + require("mason").setup() + local capabilities = require("cmp_nvim_lsp").default_capabilities() + require("mason-lspconfig").setup({ + ensure_installed = { + "ts_ls", + "lua_ls", + "rust_analyzer", + }, + handlers = { + function(server) + require("lspconfig")[server].setup({ capabilities = capabilities }) + end, + }, + }) + + local cmp = require("cmp") + + cmp.setup({ + preselect = "item", + completion = { + completeopt = "menu,menuone,noinsert" + }, + snippet = { + -- REQUIRED - you must specify a snippet engine + expand = function(args) + require("luasnip").lsp_expand(args.body) -- For `luasnip` users. + end, + }, + + mapping = cmp.mapping.preset.insert({ + -- Simple tab complete + [""] = cmp.mapping(function(fallback) + local col = vim.fn.col(".") - 1 + + if cmp.visible() then + cmp.select_next_item({ behavior = "select" }) + elseif col == 0 or vim.fn.getline("."):sub(col, col):match("%s") then + fallback() + else + cmp.complete() + end + end, { "i", "s" }), + + -- Go to previous item + [""] = cmp.mapping.select_prev_item({ behavior = "select" }), + [""] = cmp.mapping.confirm({ select = false }), + }), + + sources = cmp.config.sources({ + { name = "nvim_lsp" }, + { name = "nvim_lsp_signature_help" }, + }, { + { name = "buffer" }, + }), + }) + end, + }, + { + "stevearc/conform.nvim", + opts = { + formatters_by_ft = { + lua = { "stylua" }, + rust = { "rustfmt", lsp_format = "fallback" }, + javascript = { "prettier" }, + typescript = { "prettier" }, + json = { "prettier" }, + tsx = { "prettier" }, + }, + format_on_save = { + -- These options will be passed to conform.format() + timeout_ms = 500, + lsp_format = "fallback", + }, + }, + }, + { + "ThePrimeagen/harpoon", + branch = "harpoon2", + dependencies = { "nvim-lua/plenary.nvim" }, + config = function() + local harpoon = require("harpoon") + harpoon:setup() + vim.keymap.set("n", "a", function() + harpoon:list():add() + end) + vim.keymap.set("n", "", function() + harpoon.ui:toggle_quick_menu(harpoon:list()) + end) + + vim.keymap.set("n", "", function() + harpoon:list():select(1) + end) + vim.keymap.set("n", "", function() + harpoon:list():select(2) + end) + vim.keymap.set("n", "", function() + harpoon:list():select(3) + end) + vim.keymap.set("n", "", function() + harpoon:list():select(4) + end) + + -- Toggle previous & next buffers stored within Harpoon list + vim.keymap.set("n", "", function() + harpoon:list():prev() + end) + vim.keymap.set("n", "", function() + harpoon:list():next() + end) + end, + }, + { + "m4xshen/autoclose.nvim", + opts = { + keys = { + ["("] = { escape = false, close = true, pair = "()" }, + ["["] = { escape = false, close = true, pair = "[]" }, + ["{"] = { escape = false, close = true, pair = "{}" }, + + [">"] = { escape = true, close = false, pair = "<>" }, + [")"] = { escape = true, close = false, pair = "()" }, + ["]"] = { escape = true, close = false, pair = "[]" }, + ["}"] = { escape = true, close = false, pair = "{}" }, + + ['"'] = { escape = true, close = true, pair = '""' }, + ["'"] = { escape = true, close = true, pair = "''" }, + ["`"] = { escape = true, close = true, pair = "``" }, + }, + options = { + disabled_filetypes = { "text", "TelescopePrompt" }, + disable_when_touch = false, + touch_regex = "[%w(%[{]", + pair_spaces = false, + auto_indent = true, + disable_command_mode = false, + }, + }, + }, +} diff --git a/.config/nvim/lua/rocketcamel/plugins/nvim-ts-autotag.lua b/.config/nvim/lua/rocketcamel/plugins/nvim-ts-autotag.lua new file mode 100755 index 0000000..08527ab --- /dev/null +++ b/.config/nvim/lua/rocketcamel/plugins/nvim-ts-autotag.lua @@ -0,0 +1,22 @@ +return { + "windwp/nvim-ts-autotag", + lazy = false, + config = function() + require("nvim-ts-autotag").setup({ + opts = { + enable_close = true, + enable_rename = true, + enable_close_on_slash = false + } + }) + end + -- opts = { + -- per_filetype = { + -- "html", + -- "javascript", + -- "javascriptreact", + -- "typescript", + -- "typescriptreact", + -- } + --} +} diff --git a/.config/nvim/lua/rocketcamel/plugins/rose-pine.lua b/.config/nvim/lua/rocketcamel/plugins/rose-pine.lua new file mode 100755 index 0000000..09f203e --- /dev/null +++ b/.config/nvim/lua/rocketcamel/plugins/rose-pine.lua @@ -0,0 +1,6 @@ +return { + "rose-pine/neovim", + config = function() + vim.cmd("colorscheme rose-pine") + end, +} diff --git a/.config/nvim/lua/rocketcamel/remap.lua b/.config/nvim/lua/rocketcamel/remap.lua new file mode 100755 index 0000000..7ed2e32 --- /dev/null +++ b/.config/nvim/lua/rocketcamel/remap.lua @@ -0,0 +1,6 @@ +vim.g.mapleader = " " +vim.keymap.set("n", "pv", vim.cmd.Ex) +vim.keymap.set("n", "x", vim.cmd.q) +vim.keymap.set("i", "", "", { noremap = true, silent = true }) +vim.keymap.set("i", "", "", { noremap = true, silent = false }) +vim.keymap.set("i", "", "", { noremap = true, silent = true }) diff --git a/.config/nvim/lua/rocketcamel/set.lua b/.config/nvim/lua/rocketcamel/set.lua new file mode 100755 index 0000000..7e81b40 --- /dev/null +++ b/.config/nvim/lua/rocketcamel/set.lua @@ -0,0 +1,11 @@ +vim.opt.guicursor = "n-v-i-c:block-Cursor" +vim.opt.nu = true +vim.opt.relativenumber = true + +vim.opt.tabstop = 2 +vim.opt.softtabstop = 2 +vim.opt.shiftwidth = 2 +vim.opt.expandtab = true + +vim.opt.hlsearch = false +vim.opt.incsearch = true diff --git a/nix/users/luca/helix.nix b/nix/users/luca/helix.nix deleted file mode 100755 index da12719..0000000 --- a/nix/users/luca/helix.nix +++ /dev/null @@ -1,53 +0,0 @@ -{ pkgs, ... }: - -{ - enable = true; - languages.language = [ - { - name = "nix"; - auto-format = true; - formatter.command = "${pkgs.nixfmt}/bin/nixfmt"; - } - { - name = "typescript"; - auto-format = true; - formatter = { - command = "${pkgs.nodePackages_latest.prettier}/bin/prettier"; - args = [ "--parser" "typescript" ]; - }; - } - { - name = "tsx"; - auto-format = true; - formatter = { - command = "${pkgs.nodePackages_latest.prettier}/bin/prettier"; - args = [ "--parser" "typescript" ]; - }; - } - ]; - settings = { - theme = "rose_pine"; - editor = { - true-color = true; - line-number = "relative"; - lsp.display-messages = true; - cursor-shape = { - insert = "block"; - normal = "block"; - }; - }; - keys.normal = { - space.q = ":q"; - w = [ "move_next_word_start" "move_char_right" "collapse_selection" ]; - b = [ "move_prev_word_start" "collapse_selection" ]; - i = [ "insert_mode" "collapse_selection" ]; - a = [ "append_mode" "collapse_selection" ]; - }; - }; - themes = { - rose_pine = { - inherits = "rose_pine"; - "ui.background" = "transparent"; - }; - }; -} diff --git a/nix/users/luca/home.nix b/nix/users/luca/home.nix index 6f6890b..c806281 100755 --- a/nix/users/luca/home.nix +++ b/nix/users/luca/home.nix @@ -8,11 +8,9 @@ git = import ./git.nix; zsh = import ./zsh.nix; tmux = import ./tmux.nix { inherit pkgs; }; - helix = import ./helix.nix { inherit pkgs; }; }; home.packages = with pkgs; [ - nodePackages_latest.typescript-language-server nodejs_22 pnpm gh