From 1b68e260c47bbc1d727887d64221e076bf7dbdb6 Mon Sep 17 00:00:00 2001 From: Bryan Ramos Date: Sun, 28 May 2023 12:47:31 -0400 Subject: [PATCH] Trying again to update nvim --- homeConfig/dotfiles/alacritty/alacritty.yml | 29 -- homeConfig/dotfiles/nvim/init.lua | 74 +---- .../dotfiles/nvim/lua/config/autocmds.lua | 3 + .../dotfiles/nvim/lua/config/keymaps.lua | 3 + homeConfig/dotfiles/nvim/lua/config/lazy.lua | 46 +++ .../dotfiles/nvim/lua/config/options.lua | 3 + homeConfig/dotfiles/nvim/lua/plugins/core.lua | 16 ++ .../dotfiles/nvim/lua/plugins/example.lua | 266 ++++++++++++++++++ homeConfig/dotfiles/nvim/plugins.lua | 113 -------- homeConfig/home.nix | 21 +- 10 files changed, 353 insertions(+), 221 deletions(-) create mode 100644 homeConfig/dotfiles/nvim/lua/config/autocmds.lua create mode 100644 homeConfig/dotfiles/nvim/lua/config/keymaps.lua create mode 100644 homeConfig/dotfiles/nvim/lua/config/lazy.lua create mode 100644 homeConfig/dotfiles/nvim/lua/config/options.lua create mode 100644 homeConfig/dotfiles/nvim/lua/plugins/core.lua create mode 100644 homeConfig/dotfiles/nvim/lua/plugins/example.lua delete mode 100644 homeConfig/dotfiles/nvim/plugins.lua diff --git a/homeConfig/dotfiles/alacritty/alacritty.yml b/homeConfig/dotfiles/alacritty/alacritty.yml index e41f6f7..53e89e1 100644 --- a/homeConfig/dotfiles/alacritty/alacritty.yml +++ b/homeConfig/dotfiles/alacritty/alacritty.yml @@ -5,7 +5,6 @@ scrolling: window: opacity: 0.95 - # github Alacritty Colors colors: # Default colors @@ -39,34 +38,6 @@ colors: - { index: 16, color: '0xd18616' } - { index: 17, color: '0xffa198' } - #colors: - # primary: - # background: '0x0A0E14' - # foreground: '0xFFFFFF' - # - # text: '0x2e3440' - # cursor: '0xe5e9f0' - # - # normal: - # black: '0x01060E' - # red: '0xEA6C73' - # green: '0x91B362' - # yellow: '0xEBCB8B' - # blue: '0x81A1C1' - # magenta: '0xB48EAD' - # cyan: '0x88C0D0' - # white: '0xF5F5F5' - # - # bright: - # black: '0x686868' - # red: '0xF07178' - # green: '0xC2D94C' - # yellow: '0xEBCB8B' - # blue: '0x81A1C1' - # magenta: '0xB48EAD' - # cyan: '0x8FBCBB' - # white: '0xFFFFF2' - font: normal: family: TerminusWithNerdFont diff --git a/homeConfig/dotfiles/nvim/init.lua b/homeConfig/dotfiles/nvim/init.lua index 8cf55dc..2514f9e 100644 --- a/homeConfig/dotfiles/nvim/init.lua +++ b/homeConfig/dotfiles/nvim/init.lua @@ -1,72 +1,2 @@ --- Line Numbering -vim.o.relativenumber = true -vim.o.number = true -vim.cmd('highlight LineNr ctermfg=DarkGray') - --- Enable clipboard -vim.o.clipboard = "unnamedplus" - --- Keep Cursor -vim.o.guicursor = '' - --- Indentation -vim.opt.shiftwidth = 2 -vim.opt.softtabstop = 2 -vim.opt.expandtab = true -vim.opt.tabstop = 2 - --- Folding -vim.o.foldmethod = "indent" -vim.o.foldlevelstart = 99 - --- Init Snippets -vim.g.snipMate = { snippet_version = 1 } - --- Remaps -vim.api.nvim_set_keymap('n', '', 'zz', {noremap = true}) -vim.api.nvim_set_keymap('n', '', 'zz', {noremap = true}) -vim.api.nvim_set_keymap('n', '', 'zz', {noremap = true}) -vim.api.nvim_set_keymap('n', '', 'zz', {noremap = true}) - --- Load packer.nvim -local packer_install_path = vim.fn.stdpath('data') .. '/site/pack/packer/start/packer.nvim' - if vim.fn.empty(vim.fn.glob(packer_install_path)) > 0 then - vim.fn.execute('!git clone https://github.com/wbthomason/packer.nvim ' .. packer_install_path) - vim.cmd 'packadd packer.nvim' -end -dofile(vim.fn.stdpath('config') .. '/plugins.lua') - --- Treesitter Enable -require'nvim-treesitter.configs'.setup { - highlight = { - enable = true, - }, -} - --- Load LSP's -require('lazy-lsp').setup { - excluded_servers = { - "sqls", "ccls", "zk", "tsserver", "nil_ls", - }, - - default_config = { - on_attach = function(client, bufnr) - client.server_capabilities.document_formatting = false - require('lsp_signature').on_attach() - local function set_completeopt() - vim.api.nvim_buf_set_option(bufnr, 'completeopt', 'menuone,noselect') - end - set_completeopt() - end, - }, - - configs = { - lua_ls = { - settings = { Lua = { diagnostics = { globals = { "vim" }}}}, - }, - }, -} - - -- TODO: This is supposed to change the opacity for the LSP in-line error messages but it is not. -vim.cmd('highlight! link LspDiagnosticsVirtualTextError LspDiagnosticsVirtualTextErrorTransparent') -vim.cmd('highlight! LspDiagnosticsVirtualTextErrorTransparent guibg=none gui=none blend=50') +-- bootstrap lazy.nvim, LazyVim and your plugins +require("config.lazy") diff --git a/homeConfig/dotfiles/nvim/lua/config/autocmds.lua b/homeConfig/dotfiles/nvim/lua/config/autocmds.lua new file mode 100644 index 0000000..27e9e06 --- /dev/null +++ b/homeConfig/dotfiles/nvim/lua/config/autocmds.lua @@ -0,0 +1,3 @@ +-- Autocmds are automatically loaded on the VeryLazy event +-- Default autocmds that are always set: https://github.com/LazyVim/LazyVim/blob/main/lua/lazyvim/config/autocmds.lua +-- Add any additional autocmds here diff --git a/homeConfig/dotfiles/nvim/lua/config/keymaps.lua b/homeConfig/dotfiles/nvim/lua/config/keymaps.lua new file mode 100644 index 0000000..2c134f7 --- /dev/null +++ b/homeConfig/dotfiles/nvim/lua/config/keymaps.lua @@ -0,0 +1,3 @@ +-- Keymaps are automatically loaded on the VeryLazy event +-- Default keymaps that are always set: https://github.com/LazyVim/LazyVim/blob/main/lua/lazyvim/config/keymaps.lua +-- Add any additional keymaps here diff --git a/homeConfig/dotfiles/nvim/lua/config/lazy.lua b/homeConfig/dotfiles/nvim/lua/config/lazy.lua new file mode 100644 index 0000000..881987a --- /dev/null +++ b/homeConfig/dotfiles/nvim/lua/config/lazy.lua @@ -0,0 +1,46 @@ +local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim" +if not vim.loop.fs_stat(lazypath) then + -- bootstrap lazy.nvim + -- stylua: ignore + vim.fn.system({ "git", "clone", "--filter=blob:none", "https://github.com/folke/lazy.nvim.git", "--branch=stable", lazypath }) +end +vim.opt.rtp:prepend(vim.env.LAZY or lazypath) + +require("lazy").setup({ + spec = { + -- add LazyVim and import its plugins + { "LazyVim/LazyVim", import = "lazyvim.plugins" }, + -- import any extras modules here + { import = "lazyvim.plugins.extras.lang.typescript" }, + { import = "lazyvim.plugins.extras.lang.json" }, + { import = "lazyvim.plugins.extras.ui.mini-animate" }, + -- import/override with your plugins + { import = "plugins" }, + }, + defaults = { + -- By default, only LazyVim plugins will be lazy-loaded. Your custom plugins will load during startup. + -- If you know what you're doing, you can set this to `true` to have all your custom plugins lazy-loaded by default. + lazy = false, + -- It's recommended to leave version=false for now, since a lot the plugin that support versioning, + -- have outdated releases, which may break your Neovim install. + version = false, -- always use the latest git commit + -- version = "*", -- try installing the latest stable version for plugins that support semver + }, + install = { colorscheme = { "tokyonight", "habamax" } }, + checker = { enabled = true }, -- automatically check for plugin updates + performance = { + rtp = { + -- disable some rtp plugins + disabled_plugins = { + "gzip", + -- "matchit", + -- "matchparen", + -- "netrwPlugin", + "tarPlugin", + "tohtml", + "tutor", + "zipPlugin", + }, + }, + }, +}) diff --git a/homeConfig/dotfiles/nvim/lua/config/options.lua b/homeConfig/dotfiles/nvim/lua/config/options.lua new file mode 100644 index 0000000..3ea1454 --- /dev/null +++ b/homeConfig/dotfiles/nvim/lua/config/options.lua @@ -0,0 +1,3 @@ +-- Options are automatically loaded before lazy.nvim startup +-- Default options that are always set: https://github.com/LazyVim/LazyVim/blob/main/lua/lazyvim/config/options.lua +-- Add any additional options here diff --git a/homeConfig/dotfiles/nvim/lua/plugins/core.lua b/homeConfig/dotfiles/nvim/lua/plugins/core.lua new file mode 100644 index 0000000..8ae5c06 --- /dev/null +++ b/homeConfig/dotfiles/nvim/lua/plugins/core.lua @@ -0,0 +1,16 @@ +return { + { + 'projekt0n/github-nvim-theme', + lazy = false, -- make sure we load this during startup if it is your main colorscheme + priority = 1000, -- make sure to load this before all the other start plugins + config = function() + require('github-theme').setup({ + options = { + transparent = true; + } + }) + + vim.cmd('colorscheme github_dark_high_contrast') + end, + } +} diff --git a/homeConfig/dotfiles/nvim/lua/plugins/example.lua b/homeConfig/dotfiles/nvim/lua/plugins/example.lua new file mode 100644 index 0000000..5d2c1f8 --- /dev/null +++ b/homeConfig/dotfiles/nvim/lua/plugins/example.lua @@ -0,0 +1,266 @@ +-- since this is just an example spec, don't actually load anything here and return an empty spec +-- stylua: ignore +if true then return {} end + +-- every spec file under config.plugins will be loaded automatically by lazy.nvim +-- +-- In your plugin files, you can: +-- * add extra plugins +-- * disable/enabled LazyVim plugins +-- * override the configuration of LazyVim plugins +return { + -- add gruvbox + { "ellisonleao/gruvbox.nvim" }, + + -- Configure LazyVim to load gruvbox + { + "LazyVim/LazyVim", + opts = { + colorscheme = "gruvbox", + }, + }, + + -- change trouble config + { + "folke/trouble.nvim", + -- opts will be merged with the parent spec + opts = { use_diagnostic_signs = true }, + }, + + -- disable trouble + { "folke/trouble.nvim", enabled = false }, + + -- add symbols-outline + { + "simrat39/symbols-outline.nvim", + cmd = "SymbolsOutline", + keys = { { "cs", "SymbolsOutline", desc = "Symbols Outline" } }, + config = true, + }, + + -- override nvim-cmp and add cmp-emoji + { + "hrsh7th/nvim-cmp", + dependencies = { "hrsh7th/cmp-emoji" }, + ---@param opts cmp.ConfigSchema + opts = function(_, opts) + local cmp = require("cmp") + opts.sources = cmp.config.sources(vim.list_extend(opts.sources, { { name = "emoji" } })) + end, + }, + + -- change some telescope options and a keymap to browse plugin files + { + "nvim-telescope/telescope.nvim", + keys = { + -- add a keymap to browse plugin files + -- stylua: ignore + { + "fp", + function() require("telescope.builtin").find_files({ cwd = require("lazy.core.config").options.root }) end, + desc = "Find Plugin File", + }, + }, + -- change some options + opts = { + defaults = { + layout_strategy = "horizontal", + layout_config = { prompt_position = "top" }, + sorting_strategy = "ascending", + winblend = 0, + }, + }, + }, + + -- add telescope-fzf-native + { + "telescope.nvim", + dependencies = { + "nvim-telescope/telescope-fzf-native.nvim", + build = "make", + config = function() + require("telescope").load_extension("fzf") + end, + }, + }, + + -- add pyright to lspconfig + { + "neovim/nvim-lspconfig", + ---@class PluginLspOpts + opts = { + ---@type lspconfig.options + servers = { + -- pyright will be automatically installed with mason and loaded with lspconfig + pyright = {}, + }, + }, + }, + + -- add tsserver and setup with typescript.nvim instead of lspconfig + { + "neovim/nvim-lspconfig", + dependencies = { + "jose-elias-alvarez/typescript.nvim", + init = function() + require("lazyvim.util").on_attach(function(_, buffer) + -- stylua: ignore + vim.keymap.set( "n", "co", "TypescriptOrganizeImports", { buffer = buffer, desc = "Organize Imports" }) + vim.keymap.set("n", "cR", "TypescriptRenameFile", { desc = "Rename File", buffer = buffer }) + end) + end, + }, + ---@class PluginLspOpts + opts = { + ---@type lspconfig.options + servers = { + -- tsserver will be automatically installed with mason and loaded with lspconfig + tsserver = {}, + }, + -- you can do any additional lsp server setup here + -- return true if you don't want this server to be setup with lspconfig + ---@type table + setup = { + -- example to setup with typescript.nvim + tsserver = function(_, opts) + require("typescript").setup({ server = opts }) + return true + end, + -- Specify * to use this function as a fallback for any server + -- ["*"] = function(server, opts) end, + }, + }, + }, + + -- for typescript, LazyVim also includes extra specs to properly setup lspconfig, + -- treesitter, mason and typescript.nvim. So instead of the above, you can use: + { import = "lazyvim.plugins.extras.lang.typescript" }, + + -- add more treesitter parsers + { + "nvim-treesitter/nvim-treesitter", + opts = { + ensure_installed = { + "bash", + "html", + "javascript", + "json", + "lua", + "markdown", + "markdown_inline", + "python", + "query", + "regex", + "tsx", + "typescript", + "vim", + "yaml", + }, + }, + }, + + -- since `vim.tbl_deep_extend`, can only merge tables and not lists, the code above + -- would overwrite `ensure_installed` with the new value. + -- If you'd rather extend the default config, use the code below instead: + { + "nvim-treesitter/nvim-treesitter", + opts = function(_, opts) + -- add tsx and treesitter + vim.list_extend(opts.ensure_installed, { + "tsx", + "typescript", + }) + end, + }, + + -- the opts function can also be used to change the default opts: + { + "nvim-lualine/lualine.nvim", + event = "VeryLazy", + opts = function(_, opts) + table.insert(opts.sections.lualine_x, "😄") + end, + }, + + -- or you can return new options to override all the defaults + { + "nvim-lualine/lualine.nvim", + event = "VeryLazy", + opts = function() + return { + --[[add your custom lualine config here]] + } + end, + }, + + -- use mini.starter instead of alpha + { import = "lazyvim.plugins.extras.ui.mini-starter" }, + + -- add jsonls and schemastore ans setup treesitter for json, json5 and jsonc + { import = "lazyvim.plugins.extras.lang.json" }, + + -- add any tools you want to have installed below + { + "williamboman/mason.nvim", + opts = { + ensure_installed = { + "stylua", + "shellcheck", + "shfmt", + "flake8", + }, + }, + }, + + -- Use for completion and snippets (supertab) + -- first: disable default and behavior in LuaSnip + { + "L3MON4D3/LuaSnip", + keys = function() + return {} + end, + }, + -- then: setup supertab in cmp + { + "hrsh7th/nvim-cmp", + dependencies = { + "hrsh7th/cmp-emoji", + }, + ---@param opts cmp.ConfigSchema + opts = function(_, opts) + local has_words_before = function() + unpack = unpack or table.unpack + 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 luasnip = require("luasnip") + local cmp = require("cmp") + + opts.mapping = vim.tbl_extend("force", opts.mapping, { + [""] = cmp.mapping(function(fallback) + if cmp.visible() then + cmp.select_next_item() + -- You could replace the expand_or_jumpable() calls with expand_or_locally_jumpable() + -- this way you will only jump inside the snippet region + elseif luasnip.expand_or_jumpable() then + luasnip.expand_or_jump() + elseif has_words_before() then + cmp.complete() + else + fallback() + end + end, { "i", "s" }), + [""] = 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" }), + }) + end, + }, +} diff --git a/homeConfig/dotfiles/nvim/plugins.lua b/homeConfig/dotfiles/nvim/plugins.lua deleted file mode 100644 index 5542ce8..0000000 --- a/homeConfig/dotfiles/nvim/plugins.lua +++ /dev/null @@ -1,113 +0,0 @@ --- Load packer.nvim -local packer = require('packer') - --- Start defining plugins -return packer.startup(function(use) - -- Install packer.nvim - use 'wbthomason/packer.nvim' - - -- Github Theme - use ({ 'projekt0n/github-nvim-theme', tag = 'v0.0.7', - config = function() - require('github-theme').setup({ - theme_style = "dark_default", - }) - end - }) - - -- Indent-blankline - use {"lukas-reineke/indent-blankline.nvim", - config = function() - require("indent_blankline").setup { - } - end, - } - - -- Neo-Tree - use {"nvim-neo-tree/neo-tree.nvim", - branch = "v2.x", - requires = { - "nvim-lua/plenary.nvim", - "nvim-tree/nvim-web-devicons", - "MunifTanjim/nui.nvim", - } - } - - -- Vim Snippets - use { - 'garbas/vim-snipmate', - requires = { - 'MarcWeber/vim-addon-mw-utils', - 'tomtom/tlib_vim', - } - } - use 'honza/vim-snippets' - - -- Lualine - use {'nvim-lualine/lualine.nvim', - after = 'github-nvim-theme', - requires = { 'kyazdani42/nvim-web-devicons', opt = true }, - config = function() - require('lualine').setup { - options = { - theme = 'auto' - } - } - end - } - - -- Git Blame Line - use { - 'tveskag/nvim-blame-line', - requires = {'nvim-lua/plenary.nvim'}, - } - - -- Git Integration - use { 'TimUntersberger/neogit', - requires = 'nvim-lua/plenary.nvim' - } - - -- Autobracket - use {'windwp/nvim-autopairs', - config = function() - require('nvim-autopairs').setup() - end - } - - -- Color Preview - use { 'ap/vim-css-color', - ft = { - 'css', - 'sass', - 'scss', - 'rasi', - 'markdown' - } - } - - -- LSP Config - use 'neovim/nvim-lspconfig' - use { 'dundalek/lazy-lsp.nvim', - requires = { - 'neovim/nvim-lspconfig', - 'ray-x/lsp_signature.nvim' - } - } - require'lspconfig'.tailwindcss.setup{} - - use {'hrsh7th/nvim-compe', - config = function() - require('compe').setup({ - enabled = true, - source = { - path = true, - buffer = true, - nvim_lsp = true, - nvim_lua = true, - treesitter = true, - }, - }) - end, - } - -end) diff --git a/homeConfig/home.nix b/homeConfig/home.nix index f010f49..8917931 100644 --- a/homeConfig/home.nix +++ b/homeConfig/home.nix @@ -25,6 +25,7 @@ gimp android-studio + gh syncthing rsync @@ -44,19 +45,13 @@ mdbook bash-completion - nodePackages."@tailwindcss/language-server" pkg-config docker - python3 nix-init lazygit ripgrep fd - ghc - cabal-install - cabal2nix - trezor-suite trezorctl electrum @@ -65,6 +60,18 @@ neofetch evince wireguard-tools + +# Language Stuff + nodejs + gcc + + ghc + cabal-install + cabal2nix + + cargo + python3 + python311Packages.pip ]; # PROGRAM CONFIGS @@ -99,7 +106,7 @@ ".config/alacritty".source = ./dotfiles/alacritty; ".config/nvim/init.lua".source = ./dotfiles/nvim/init.lua; - ".config/nvim/plugins.lua".source = ./dotfiles/nvim/plugins.lua; + ".config/nvim/lua".source = ./dotfiles/nvim/lua; ".config/git/config".source = ./dotfiles/gitconfig; ".config/fontconfig/fonts.conf".source = ./dotfiles/fontconfig/fonts.conf;