diff --git a/.gitmodules b/.gitmodules index 86b7f1084..63c8b695b 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,21 +1,21 @@ [submodule "nvim/pack/bundle/start/nvim-treesitter"] - path = nvim/pack/bundle/start/nvim-treesitter + path = nvim.bak/pack/bundle/start/nvim-treesitter url = https://github.com/nvim-treesitter/nvim-treesitter [submodule "nvim/pack/bundle/start/nvim-lspconfig"] - path = nvim/pack/bundle/start/nvim-lspconfig + path = nvim.bak/pack/bundle/start/nvim-lspconfig url = https://github.com/neovim/nvim-lspconfig [submodule "nvim/pack/bundle/start/projectionist"] - path = nvim/pack/bundle/start/projectionist + path = nvim.bak/pack/bundle/start/projectionist url = https://tpope.io/vim/projectionist.git [submodule "nvim/pack/bundle/start/dispatch"] - path = nvim/pack/bundle/start/dispatch + path = nvim.bak/pack/bundle/start/dispatch url = https://tpope.io/vim/dispatch.git [submodule "nvim/pack/bundle/start/copilot.vim"] - path = nvim/pack/bundle/start/copilot.vim + path = nvim.bak/pack/bundle/start/copilot.vim url = https://github.com/github/copilot.vim.git [submodule "nvim/pack/bundle/start/conform.nvim"] - path = nvim/pack/bundle/start/conform.nvim + path = nvim.bak/pack/bundle/start/conform.nvim url = https://github.com/stevearc/conform.nvim.git [submodule "nvim/pack/bundle/start/nvim-lint"] - path = nvim/pack/bundle/start/nvim-lint + path = nvim.bak/pack/bundle/start/nvim-lint url = https://github.com/mfussenegger/nvim-lint.git diff --git a/Makefile b/Makefile index 99aab756e..e5d35086d 100644 --- a/Makefile +++ b/Makefile @@ -9,7 +9,6 @@ install-git \ install-sh \ install-tmux \ - install-vim \ install-work \ lint \ lint-bash \ @@ -38,6 +37,11 @@ check-lua: check-prettier: npm run format:check +clean: clean-nvim + +clean-nvim: + rm -r -- $(XDG_CONFIG_HOME)/nvim + format: format-bash \ format-lua \ format-prettier \ @@ -68,13 +72,12 @@ dump-brew: install: install-bash \ install-bin \ - install-espanso \ install-git \ + install-ghostty \ install-mise \ install-npm \ install-nvim \ - install-tmux \ - install-vim + install-tmux install-bash: lint-bash install-sh cp -p -- bash/bash_profile $(HOME)/.bash_profile @@ -96,6 +99,10 @@ install-git: git/config cp -p -- git/config $(XDG_CONFIG_HOME)/git/config cp -p -- git/ignore $(XDG_CONFIG_HOME)/git/ignore +install-ghostty: + mkdir -p -- $(XDG_CONFIG_HOME)/ghostty + cp -p -- ghostty/config $(XDG_CONFIG_HOME)/ghostty/config + install-mise: install-bash cp -p -- mise/bashrc.d/* $(HOME)/.bashrc.d/ diff --git a/ghostty/config b/ghostty/config new file mode 100644 index 000000000..0f9093484 --- /dev/null +++ b/ghostty/config @@ -0,0 +1,3 @@ +font-family = JetBrainsMono Nerd Font Mono +theme = light:catppuccin-latte,dark:catppuccin-mocha +window-theme = auto diff --git a/homebrew/work.Brewfile b/homebrew/work.Brewfile index 4cf1971f2..f53147b87 100644 --- a/homebrew/work.Brewfile +++ b/homebrew/work.Brewfile @@ -3,6 +3,16 @@ tap "espanso/espanso" tap "homebrew/bundle" tap "homebrew/cask-fonts" tap "reainternal/stable", "git@git.realestate.com.au:cowbell/homebrew-stuff" +# Macro processing language +brew "m4", link: true +# Automatic configure script builder +brew "autoconf" +# Cryptography and SSL/TLS Toolkit +brew "openssl@3" +# YAML Parser +brew "libyaml" +# Library for command-line editing +brew "readline" # CLI tool to build, test, debug, and deploy Serverless applications using AWS SAM brew "aws-sam-cli" # Official Amazon AWS command-line interface @@ -11,16 +21,34 @@ brew "awscli" brew "bash" # Programmable completion for Bash 4.2+ brew "bash-completion@2" +# Clone of cat(1) with syntax highlighting and Git integration +brew "bat" +# Versatile and fast Unicode/ASCII/ANSI graphics renderer +brew "chafa" # Create and view interactive cheat sheets for *nix commands brew "cheat" # Statistics utility to count lines of code brew "cloc" +# Diff that understands syntax +brew "difftastic" # Docker Credential Helper for Amazon ECR brew "docker-credential-helper-ecr" +# Pluggable and configurable code formatting platform written in Rust +brew "dprint" +# Simple, fast and user-friendly alternative to find +brew "fd" +# Command-line fuzzy finder written in Go +brew "fzf" # GitHub command-line tool brew "gh" # Distributed revision control system brew "git" +# Syntax-highlighting pager for git and diff output +brew "git-delta" +# GNU multiple precision arithmetic library +brew "gmp" +# GNU Pretty Good Privacy (PGP) package +brew "gnupg" # Smarter Dockerfile linter to validate best practices brew "hadolint" # Post-modern modal text editor @@ -31,14 +59,16 @@ brew "htop" brew "hyperfine" # Lightweight and flexible command-line JSON processor brew "jq" +# Simple terminal UI for git commands +brew "lazygit" # Postgres C API library brew "libpq", link: true # Language Server for the Lua language brew "lua-language-server" # Tool for linting and static analysis of Lua code brew "luacheck" -# Macro processing language -brew "m4", link: true +# Package manager for the Lua programming language +brew "luarocks" # Mac App Store command-line interface brew "mas" # Polyglot runtime manager (asdf rust clone) @@ -47,6 +77,8 @@ brew "mise" brew "neovim", args: ["HEAD"] # Search tool like grep and The Silver Searcher brew "ripgrep" +# Safe, concurrent, practical language +brew "rust" # Static analysis and lint tool, for (ba)sh scripts brew "shellcheck" # Autoformat shell script source code @@ -61,6 +93,8 @@ brew "tldr" brew "tmux" # Display directories as trees (with optional color/HTML output) brew "tree" +# Syntax-aware linter for prose +brew "vale" # Vi 'workalike' with many additional features brew "vim" # Vim script Language Lint @@ -69,8 +103,6 @@ brew "vint" brew "yt-dlp" # Login to REA AWS console by switching roles brew "reainternal/stable/aws-switch" -# Authenticate to REA AWS accounts -brew "reainternal/stable/rea-as" # Password manager that keeps all passwords secure behind one password cask "1password" # Professional graphic design software @@ -79,6 +111,8 @@ cask "affinity-designer" cask "affinity-photo" # Professional desktop publishing software cask "affinity-publisher" +# GPU-accelerated terminal emulator +cask "alacritty" # Application launcher and productivity software cask "alfred" # Application uninstaller @@ -93,18 +127,18 @@ cask "bbedit" cask "betterdisplay" # Record and process your ideas cask "bike" +# Opensource IDE for exploring and testing api's +cask "bruno" # Free and open-source web browser cask "chromium" # Screen capturing tool cask "cleanshot" -# The Ultimate Homebrew Companion +# GUI companion app for Homebrew cask "cork" # API documentation browser and code snippet manager cask "dash" # App to build and share containerised applications and microservices cask "docker" -# Cross-platform Text Expander written in Rust -cask "espanso" # Web browser cask "firefox" cask "font-fira-mono" @@ -114,11 +148,14 @@ cask "font-ibm-plex-mono" cask "font-input" cask "font-intel-one-mono" cask "font-jetbrains-mono" +cask "font-jetbrains-mono-nerd-font" cask "font-monaspace" cask "font-roboto-mono" cask "font-source-code-pro" # GIT client cask "fork" +# Terminal emulator that uses platform-native UI and GPU acceleration +cask "ghostty" # Web browser cask "google-chrome" # Create presentation slides from a Markdown document @@ -127,20 +164,30 @@ cask "ia-presenter" cask "iina" # Tool to optimise images to a smaller size cask "imageoptim" +# System monitoring app +cask "istat-menus" +# Terminal emulator as alternative to Apple's Terminal app +cask "iterm2" # JetBrains tools manager cask "jetbrains-toolbox" # Menu bar manager cask "jordanbaird-ice" +# Spot and merge differences in text and image files or folders +cask "kaleidoscope@2" # Automation software cask "keyboard-maestro" +# GPU-based terminal emulator +cask "kitty" # Software for Logitech devices -cask "logi-options-plus" +cask "logi-options+" # Optimise your webcam, headset, and Logi Dock for video meetings cask "logitune" -# Web browser +# Multi-platform web browser cask "microsoft-edge" # Tool to create text-based art cask "monodraw" +# Utility to move and zoom windows—on one display +cask "moom" # Native code editor cask "nova" # WebKit based web browser @@ -153,31 +200,53 @@ cask "postico" cask "rapidapi" # Move and resize windows using keyboard shortcuts or snap areas cask "rectangle" +# Drag-and-drop Git history editor +cask "retcon" # Sound and audio controller cask "soundsource" +# Window and tab manager +cask "tabtab" +# Tool to automate the insertion of frequently used text and graphics +cask "typinator" # Open-source code editor cask "visual-studio-code" +# GPU-accelerated cross-platform terminal emulator and multiplexer +cask "wezterm" +# REST, GraphQL and gRPC client +cask "yaak" # Application for configuring any YubiKey cask "yubico-yubikey-manager" # Multiplayer code editor cask "zed" mas "1Password for Safari", id: 1569813296 +mas "Actions", id: 1586435171 +mas "Aiko", id: 1672085276 mas "Bear", id: 1091189122 mas "Boop", id: 1518425043 -mas "com.kagimacOS.Kagi-Search", id: 1622835804 +mas "Color Picker", id: 1545870783 mas "Dato", id: 1470584107 +mas "GoodLinks", id: 1474335294 +mas "Hand Mirror", id: 1502839586 +mas "HEIC Converter", id: 1294126402 mas "Hush", id: 1544743900 mas "iA Writer", id: 775737590 +mas "Kagi for Safari", id: 1622835804 mas "Microsoft To Do", id: 1274495053 mas "NepTunes", id: 1006739057 +mas "NotePlan", id: 1505432629 +mas "One Thing", id: 1604176982 +mas "Online Check", id: 6504709660 mas "Pixelmator Pro", id: 1289583905 mas "Play", id: 1596506190 -mas "Save to Reader", id: 1640236961 +mas "Shareful", id: 1522267256 +mas "Shortery", id: 1594183810 +mas "Sofa", id: 1276554886 +mas "Speediness", id: 1596706466 mas "TestFlight", id: 899247664 mas "Things", id: 904280696 mas "Trello", id: 1278508951 mas "Velja", id: 1607635845 -mas "Wipr", id: 1320666476 +mas "Wipr", id: 1662217862 mas "Xcode", id: 497799835 vscode "github.copilot" vscode "github.copilot-chat" diff --git a/nvim.bak/.DS_Store b/nvim.bak/.DS_Store new file mode 100644 index 000000000..d1ca0806a Binary files /dev/null and b/nvim.bak/.DS_Store differ diff --git a/nvim/after/ftplugin/javascript.vim b/nvim.bak/after/ftplugin/javascript.vim similarity index 100% rename from nvim/after/ftplugin/javascript.vim rename to nvim.bak/after/ftplugin/javascript.vim diff --git a/nvim/after/ftplugin/json.vim b/nvim.bak/after/ftplugin/json.vim similarity index 100% rename from nvim/after/ftplugin/json.vim rename to nvim.bak/after/ftplugin/json.vim diff --git a/nvim.bak/after/ftplugin/lua.lua b/nvim.bak/after/ftplugin/lua.lua new file mode 100644 index 000000000..79afbfdf0 --- /dev/null +++ b/nvim.bak/after/ftplugin/lua.lua @@ -0,0 +1,5 @@ +-- Tabs should have 4 space width. +vim.opt_local.tabstop = 4 + +-- Use luacheck as compiler for sh files. +vim.cmd([[compiler luacheck]]) diff --git a/nvim/after/ftplugin/markdown.lua b/nvim.bak/after/ftplugin/markdown.lua similarity index 100% rename from nvim/after/ftplugin/markdown.lua rename to nvim.bak/after/ftplugin/markdown.lua diff --git a/nvim/after/ftplugin/markdown.vim b/nvim.bak/after/ftplugin/markdown.vim similarity index 100% rename from nvim/after/ftplugin/markdown.vim rename to nvim.bak/after/ftplugin/markdown.vim diff --git a/nvim/after/ftplugin/sh.lua b/nvim.bak/after/ftplugin/sh.lua similarity index 100% rename from nvim/after/ftplugin/sh.lua rename to nvim.bak/after/ftplugin/sh.lua diff --git a/nvim/after/ftplugin/sh.vim b/nvim.bak/after/ftplugin/sh.vim similarity index 100% rename from nvim/after/ftplugin/sh.vim rename to nvim.bak/after/ftplugin/sh.vim diff --git a/nvim/after/ftplugin/txt.vim b/nvim.bak/after/ftplugin/txt.vim similarity index 100% rename from nvim/after/ftplugin/txt.vim rename to nvim.bak/after/ftplugin/txt.vim diff --git a/nvim/after/ftplugin/typescript.vim b/nvim.bak/after/ftplugin/typescript.vim similarity index 100% rename from nvim/after/ftplugin/typescript.vim rename to nvim.bak/after/ftplugin/typescript.vim diff --git a/nvim/after/ftplugin/vim.vim b/nvim.bak/after/ftplugin/vim.vim similarity index 100% rename from nvim/after/ftplugin/vim.vim rename to nvim.bak/after/ftplugin/vim.vim diff --git a/nvim/after/indent/dockerfile.vim b/nvim.bak/after/indent/dockerfile.vim similarity index 100% rename from nvim/after/indent/dockerfile.vim rename to nvim.bak/after/indent/dockerfile.vim diff --git a/nvim/after/indent/javascript.vim b/nvim.bak/after/indent/javascript.vim similarity index 100% rename from nvim/after/indent/javascript.vim rename to nvim.bak/after/indent/javascript.vim diff --git a/nvim/after/indent/json.vim b/nvim.bak/after/indent/json.vim similarity index 100% rename from nvim/after/indent/json.vim rename to nvim.bak/after/indent/json.vim diff --git a/nvim/after/indent/markdown.vim b/nvim.bak/after/indent/markdown.vim similarity index 100% rename from nvim/after/indent/markdown.vim rename to nvim.bak/after/indent/markdown.vim diff --git a/nvim/after/indent/sh.vim b/nvim.bak/after/indent/sh.vim similarity index 100% rename from nvim/after/indent/sh.vim rename to nvim.bak/after/indent/sh.vim diff --git a/nvim/after/indent/typescript.vim b/nvim.bak/after/indent/typescript.vim similarity index 100% rename from nvim/after/indent/typescript.vim rename to nvim.bak/after/indent/typescript.vim diff --git a/nvim/after/indent/vim.vim b/nvim.bak/after/indent/vim.vim similarity index 100% rename from nvim/after/indent/vim.vim rename to nvim.bak/after/indent/vim.vim diff --git a/nvim/after/indent/yaml.vim b/nvim.bak/after/indent/yaml.vim similarity index 100% rename from nvim/after/indent/yaml.vim rename to nvim.bak/after/indent/yaml.vim diff --git a/nvim/after/plugin/conform.lua b/nvim.bak/after/plugin/conform.lua similarity index 100% rename from nvim/after/plugin/conform.lua rename to nvim.bak/after/plugin/conform.lua diff --git a/nvim/after/plugin/lint.lua b/nvim.bak/after/plugin/lint.lua similarity index 100% rename from nvim/after/plugin/lint.lua rename to nvim.bak/after/plugin/lint.lua diff --git a/nvim/after/plugin/lsp.lua b/nvim.bak/after/plugin/lsp.lua similarity index 100% rename from nvim/after/plugin/lsp.lua rename to nvim.bak/after/plugin/lsp.lua diff --git a/nvim/after/plugin/treesitter.lua b/nvim.bak/after/plugin/treesitter.lua similarity index 100% rename from nvim/after/plugin/treesitter.lua rename to nvim.bak/after/plugin/treesitter.lua diff --git a/nvim/autoload/indent.vim b/nvim.bak/autoload/indent.vim similarity index 100% rename from nvim/autoload/indent.vim rename to nvim.bak/autoload/indent.vim diff --git a/nvim/compiler/eslint.vim b/nvim.bak/compiler/eslint.vim similarity index 100% rename from nvim/compiler/eslint.vim rename to nvim.bak/compiler/eslint.vim diff --git a/nvim/compiler/luacheck.vim b/nvim.bak/compiler/luacheck.vim similarity index 100% rename from nvim/compiler/luacheck.vim rename to nvim.bak/compiler/luacheck.vim diff --git a/nvim/compiler/rubocop.vim b/nvim.bak/compiler/rubocop.vim similarity index 100% rename from nvim/compiler/rubocop.vim rename to nvim.bak/compiler/rubocop.vim diff --git a/nvim/compiler/vint.vim b/nvim.bak/compiler/vint.vim similarity index 100% rename from nvim/compiler/vint.vim rename to nvim.bak/compiler/vint.vim diff --git a/nvim/ftdetect/brewfile.vim b/nvim.bak/ftdetect/brewfile.vim similarity index 100% rename from nvim/ftdetect/brewfile.vim rename to nvim.bak/ftdetect/brewfile.vim diff --git a/nvim/ftdetect/git-config.vim b/nvim.bak/ftdetect/git-config.vim similarity index 100% rename from nvim/ftdetect/git-config.vim rename to nvim.bak/ftdetect/git-config.vim diff --git a/nvim/ftplugin/markdown.vim b/nvim.bak/ftplugin/markdown.vim similarity index 100% rename from nvim/ftplugin/markdown.vim rename to nvim.bak/ftplugin/markdown.vim diff --git a/nvim.bak/init.lua b/nvim.bak/init.lua new file mode 100644 index 000000000..bd53ecb1f --- /dev/null +++ b/nvim.bak/init.lua @@ -0,0 +1,12 @@ +-- This is my personal Neovim config. +-- +-- It is intentionally very bare bones and using the features of Neovim that +-- are missing from Vim, i.e. LSP and treesitter. + +-- Enable experimental lua-loader to byte-compile and cache lua files. +vim.loader.enable() + +-- The configuration is located in the dcp module (located in the lua +-- directory). It is then split up based on the type of configuration to make +-- small files rather than a single large file (vimrc). +require("dcp") diff --git a/nvim.bak/lua/dcp/init.lua b/nvim.bak/lua/dcp/init.lua new file mode 100644 index 000000000..c09a59625 --- /dev/null +++ b/nvim.bak/lua/dcp/init.lua @@ -0,0 +1,6 @@ +-- The majority of my custom configuration lies within this module. The order +-- that these modules are loaded is important. + +require("dcp.set-background") +require("dcp.keymaps") +require("dcp.options") diff --git a/nvim/lua/dcp/keymaps.lua b/nvim.bak/lua/dcp/keymaps.lua similarity index 100% rename from nvim/lua/dcp/keymaps.lua rename to nvim.bak/lua/dcp/keymaps.lua diff --git a/nvim.bak/lua/dcp/options.lua b/nvim.bak/lua/dcp/options.lua new file mode 100644 index 000000000..12a71c4b3 --- /dev/null +++ b/nvim.bak/lua/dcp/options.lua @@ -0,0 +1,111 @@ +-- This file contains all of the options that are set using vim.opt.* expressions. The options in this file are sorted +-- alphabetically. +-- + +-- Enable automatic backups before overwriting a file and leave it around after the file has been written. These files +-- are kept in a cache directory by defualt in Neovim. +-- +vim.opt.backup = true + +-- By default Neovim will look to save backup files in the same directory as the file. It has a fallback to a cache +-- directory so removing the first option will use that instead. +-- +vim.opt.backupdir:remove({ "." }) + +-- When wrapping a line, if that line is indented then the wrapped line is also indented the same amount. +-- +vim.opt.breakindent = true + +-- Neovim includes defaults for comments that date back to its history as a mainly C development environment. Removing +-- these values allows us to use filetype plugins to set them as needed. +-- +vim.opt.comments = "" + +-- Use two spaces to end a sentence. This helps improve readability using monospaced fonts. This also helps vim work +-- with sentence objects for the purpose of the 's' text objects, the '(' and ')' sentence motions, and formatting with +-- the 'gq' command must now be separated by two spaces. +-- +-- See https://stevelosh.com/blog/2012/10/why-i-two-space/ +-- +vim.opt.cpoptions:append("J") + +-- Neovim's defaults for macro definitions, which are used for include-search, defaults that also date back to its +-- history as a mainly C development environment. Removing these values allows ut to use filetype plugins to set them as +-- needed. +-- +vim.opt.define = "" +-- +-- Automatic text wrapping options using flags in the 'formatoptions' option begin here. + +-- Don't break a line after a one-letter word like "I" or "a". +-- +vim.opt.formatoptions:append({ 1 }) + +-- Because we are using two spaces for ending sentences. Vim can determine if the space after an abbreviation such as +-- "Mr. Pinn" is the end of the sentence or not and then determine if it should be split on it. The 'p' flag makes this +-- possible. +-- +vim.opt.formatoptions:append({ "p" }) + +-- Ignore case when searching. +-- +vim.opt.ignorecase = true + +-- Neovim's defaults for finding include commands, defaults that also date back to its history as a mainly C development +-- environment. Removing these values allows ut to use filetype plugins to set them as needed. +-- +vim.opt.include = "" +-- +-- When soft-wraps are enabled with 'wrap' option, then break the line between words, rather than within them. +-- +vim.opt.linebreak = true + +-- Neovim includes defaults for path that date back to its history as a mainly C development environment. Removing +-- these values allows us to use filetype plugins to set them as needed. +-- +vim.opt.path:remove({ "/usr/include" }) + +-- When wrapping a line using soft-wraps, highlight that it has been wrapped by inserting a leading string - "> ". +-- +vim.opt.showbreak = "> " + +-- Becuase we are ignoring case when searching, if the search contains upper-case characters then use that rather than +-- ignoring it. +-- +vim.opt.smartcase = true + +-- Use basic statusline, using this rather than an external plugin to do this as this currently fits my needs and +-- doesn't add extra complexity. +-- +-- Taken from https://www.vi-improved.org/recommendations/ +-- +vim.opt.statusline = "%F%m%r%h%w[%L][%{&ff}]%y[%p%%][%04l,%04v]" +-- | | | | | | | | | | | +-- | | | | | | | | | | +-- current column +-- | | | | | | | | | +-- current line +-- | | | | | | | | +-- current % into file +-- | | | | | | | +-- current syntax +-- | | | | | | +-- current fileformat +-- | | | | | +-- number of lines +-- | | | | +-- preview flag in square brackets +-- | | | +-- help flag in square brackets +-- | | +-- readonly flag in square brackets +-- | +-- rodified flag in square brackets +-- +-- full path to file in the buffer + +-- Keep track of undo history for files between sessions. This ensures that undo and redo are available between Vim +-- invocations. These files are kept in a cache directory. +-- +vim.opt.undofile = true + +-- Configure the wildmenu to ignore a list of patterns for file and directory command line completion. Files and +-- directories matching any of these patterns won't be presented as candidates for tab completion on the command line. +-- +-- The list combines a mixture of binary files that would not contain text and therefore would not want to edit, and +-- directories that contain generated files that won't want to be edited either. +-- +vim.opt.wildignore:append({ "*/node_modules/*" }) -- ignore dependency directories. + +-- Configure wildmenu to show the full list of matches while also completing the first full match. +-- +vim.opt.wildmode = "list:full" diff --git a/nvim.bak/lua/dcp/set-background.lua b/nvim.bak/lua/dcp/set-background.lua new file mode 100644 index 000000000..c5abdbccd --- /dev/null +++ b/nvim.bak/lua/dcp/set-background.lua @@ -0,0 +1,9 @@ +-- Set 'background' option based on on $TERMCS. + +local termcs = os.getenv("TERMCS") or "dark" +local function set_bg() + vim.opt.background = termcs +end + +vim.api.nvim_create_user_command("SetBG", set_bg, {}) +vim.cmd.SetBG() diff --git a/nvim/pack/bundle/start/conform.nvim b/nvim.bak/pack/bundle/start/conform.nvim similarity index 100% rename from nvim/pack/bundle/start/conform.nvim rename to nvim.bak/pack/bundle/start/conform.nvim diff --git a/nvim/pack/bundle/start/copilot.vim b/nvim.bak/pack/bundle/start/copilot.vim similarity index 100% rename from nvim/pack/bundle/start/copilot.vim rename to nvim.bak/pack/bundle/start/copilot.vim diff --git a/nvim/pack/bundle/start/dispatch b/nvim.bak/pack/bundle/start/dispatch similarity index 100% rename from nvim/pack/bundle/start/dispatch rename to nvim.bak/pack/bundle/start/dispatch diff --git a/nvim/pack/bundle/start/nvim-lint b/nvim.bak/pack/bundle/start/nvim-lint similarity index 100% rename from nvim/pack/bundle/start/nvim-lint rename to nvim.bak/pack/bundle/start/nvim-lint diff --git a/nvim/pack/bundle/start/nvim-lspconfig b/nvim.bak/pack/bundle/start/nvim-lspconfig similarity index 100% rename from nvim/pack/bundle/start/nvim-lspconfig rename to nvim.bak/pack/bundle/start/nvim-lspconfig diff --git a/nvim/pack/bundle/start/nvim-treesitter b/nvim.bak/pack/bundle/start/nvim-treesitter similarity index 100% rename from nvim/pack/bundle/start/nvim-treesitter rename to nvim.bak/pack/bundle/start/nvim-treesitter diff --git a/nvim/pack/bundle/start/projectionist b/nvim.bak/pack/bundle/start/projectionist similarity index 100% rename from nvim/pack/bundle/start/projectionist rename to nvim.bak/pack/bundle/start/projectionist diff --git a/nvim/plugin/disable-builtin-plugins.vim b/nvim.bak/plugin/disable-builtin-plugins.vim similarity index 100% rename from nvim/plugin/disable-builtin-plugins.vim rename to nvim.bak/plugin/disable-builtin-plugins.vim diff --git a/nvim/plugin/matchit.vim b/nvim.bak/plugin/matchit.vim similarity index 100% rename from nvim/plugin/matchit.vim rename to nvim.bak/plugin/matchit.vim diff --git a/nvim/after/ftplugin/lua.lua b/nvim/after/ftplugin/lua.lua index 79afbfdf0..685efe16d 100644 --- a/nvim/after/ftplugin/lua.lua +++ b/nvim/after/ftplugin/lua.lua @@ -1,5 +1,2 @@ -- Tabs should have 4 space width. vim.opt_local.tabstop = 4 - --- Use luacheck as compiler for sh files. -vim.cmd([[compiler luacheck]]) diff --git a/nvim/init.lua b/nvim/init.lua index bd53ecb1f..b9b81f601 100644 --- a/nvim/init.lua +++ b/nvim/init.lua @@ -1,12 +1,8 @@ --- This is my personal Neovim config. --- --- It is intentionally very bare bones and using the features of Neovim that --- are missing from Vim, i.e. LSP and treesitter. +-- 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 = " " +vim.g.maplocalleader = "\\" --- Enable experimental lua-loader to byte-compile and cache lua files. -vim.loader.enable() - --- The configuration is located in the dcp module (located in the lua --- directory). It is then split up based on the type of configuration to make --- small files rather than a single large file (vimrc). +require("config.lazy") require("dcp") diff --git a/nvim/lua/config/lazy.lua b/nvim/lua/config/lazy.lua new file mode 100644 index 000000000..0750c56bc --- /dev/null +++ b/nvim/lua/config/lazy.lua @@ -0,0 +1,29 @@ +-- 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) + +-- Setup lazy.nvim +require("lazy").setup({ + spec = { + -- import your plugins + { import = "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/nvim/lua/dcp/init.lua b/nvim/lua/dcp/init.lua index c09a59625..1eea5c002 100644 --- a/nvim/lua/dcp/init.lua +++ b/nvim/lua/dcp/init.lua @@ -1,6 +1,2 @@ --- The majority of my custom configuration lies within this module. The order --- that these modules are loaded is important. - -require("dcp.set-background") -require("dcp.keymaps") require("dcp.options") +require("dcp.set-background") diff --git a/nvim/lua/dcp/set-background.lua b/nvim/lua/dcp/set-background.lua index c5abdbccd..595d00109 100644 --- a/nvim/lua/dcp/set-background.lua +++ b/nvim/lua/dcp/set-background.lua @@ -2,7 +2,13 @@ local termcs = os.getenv("TERMCS") or "dark" local function set_bg() - vim.opt.background = termcs + if termcs == "dark" then + vim.api.nvim_set_option_value("background", "dark", {}) + vim.cmd("colorscheme catppuccin-mocha") + else + vim.api.nvim_set_option_value("background", "light", {}) + vim.cmd("colorscheme catppuccin-latte") + end end vim.api.nvim_create_user_command("SetBG", set_bg, {}) diff --git a/nvim/lua/plugins/blink.lua b/nvim/lua/plugins/blink.lua new file mode 100644 index 000000000..7b2d58f59 --- /dev/null +++ b/nvim/lua/plugins/blink.lua @@ -0,0 +1,70 @@ +return { + { + "saghen/blink.cmp", + -- optional: provides snippets for the snippet source + dependencies = "rafamadriz/friendly-snippets", + + -- use a release tag to download pre-built binaries + version = "*", + + ---@module 'blink.cmp' + ---@type blink.cmp.Config + opts = { + -- 'default' for mappings similar to built-in completion + -- 'super-tab' for mappings similar to vscode (tab to accept, arrow keys to navigate) + -- 'enter' for mappings similar to 'super-tab' but with 'enter' to accept + -- See the full "keymap" documentation for information on defining your own keymap. + keymap = { + preset = "default", + cmdline = { + preset = "enter", + }, + }, + + appearance = { + -- Sets the fallback highlight groups to nvim-cmp's highlight groups + -- Useful for when your theme doesn't support blink.cmp + -- Will be removed in a future release + use_nvim_cmp_as_default = true, + -- Set to 'mono' for 'Nerd Font Mono' or 'normal' for 'Nerd Font' + -- Adjusts spacing to ensure icons are aligned + nerd_font_variant = "mono", + }, + + -- Default list of enabled providers defined so that you can extend it + -- elsewhere in your config, without redefining it, due to `opts_extend` + sources = { + default = { "lazydev", "lsp", "path", "snippets", "buffer" }, + cmdline = function() + -- local type = vim.fn.getcmdtype() + -- -- Search forward and backward. + -- if type == "/" or type == "?" then + -- return { "buffer" } + -- end + -- -- Commands + -- if type == ":" then + -- return { "cmdline" } + -- end + return {} + end, + providers = { + lazydev = { + name = "LazyDev", + module = "lazydev.integrations.blink", + -- make lazydev completions top priority (see `:h blink.cmp`) + score_offset = 100, + }, + }, + }, + -- completion = { + -- menu = { + -- auto_show = function(ctx) + -- return ctx.mode ~= "cmdline" or not vim.tbl_contains({ "/", "?" }, vim.fn.getcmdtype()) + -- end, + -- }, + -- }, + signature = { enabled = true }, + }, + opts_extend = { "sources.default" }, + }, +} diff --git a/nvim/lua/plugins/catppuccin.lua b/nvim/lua/plugins/catppuccin.lua new file mode 100644 index 000000000..e9ca90f4a --- /dev/null +++ b/nvim/lua/plugins/catppuccin.lua @@ -0,0 +1,12 @@ +return { + { + "catppuccin/nvim", + name = "catppuccin", + 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() + -- load the colorscheme here + vim.cmd([[colorscheme catppuccin-latte]]) + end, + }, +} diff --git a/nvim/lua/plugins/conform.lua b/nvim/lua/plugins/conform.lua new file mode 100644 index 000000000..7cbdc5f3b --- /dev/null +++ b/nvim/lua/plugins/conform.lua @@ -0,0 +1,19 @@ +return { + { + "stevearc/conform.nvim", + init = function() + vim.o.formatexpr = "v:lua.require'conform'.formatexpr()" + end, + opts = { + formatters_by_ft = { + lua = { "stylua" }, + typescript = { { "prettierd", "prettier" }, "eslint_d" }, + }, + format_on_save = { + -- These options will be passed to conform.format() + timeout_ms = 500, + lsp_format = "fallback", + }, + }, + }, +} diff --git a/nvim/lua/plugins/fzf.lua b/nvim/lua/plugins/fzf.lua new file mode 100644 index 000000000..ffcd8fb4e --- /dev/null +++ b/nvim/lua/plugins/fzf.lua @@ -0,0 +1,31 @@ +return { + { + "ibhagwan/fzf-lua", + cmd = "FzfLua", -- lazy load when invoked. + -- optional for icon support + dependencies = { "nvim-tree/nvim-web-devicons", "MeanderingProgrammer/render-markdown.nvim" }, + config = function() + -- calling `setup` is optional for customization + require("fzf-lua").setup({}) + end, + keys = { + { "", "FzfLua files" }, -- find or fd on a path. + { "/", "FzfLua live_grep" }, -- live grep current project. + { ":", "FzfLua command_history" }, -- command history. + { "b", "FzfLua buffers" }, -- open buffers. + { "", "FzfLua helptags" }, -- help tags. + + { "", "FzfLua buffers" }, -- open buffers. + { "", "FzfLua builtin" }, -- fzf-lua builtin commands + { "", "FzfLua files" }, -- find or fd on a path. + { "", "FzfLua live_grep_glob" }, -- live_grep with rg --glob support. + { "", "FzfLua grep_project" }, -- search all project files. + -- vim.api.nvim_set_keymap("n", "", [[lua require"fzf-lua".buffers()]], {}) + -- vim.api.nvim_set_keymap("n", "", [[lua require"fzf-lua".builtin()]], {}) + -- vim.api.nvim_set_keymap("n", "", [[lua require"fzf-lua".files()]], {}) + -- vim.api.nvim_set_keymap("n", "", [[lua require"fzf-lua".live_grep_glob()]], {}) + -- vim.api.nvim_set_keymap("n", "", [[lua require"fzf-lua".grep_project()]], {}) + -- vim.api.nvim_set_keymap("n", "", [[lua require"fzf-lua".help_tags()]], {}) + }, + }, +} diff --git a/nvim/lua/plugins/lint.lua b/nvim/lua/plugins/lint.lua new file mode 100644 index 000000000..7549cab4a --- /dev/null +++ b/nvim/lua/plugins/lint.lua @@ -0,0 +1,18 @@ +return { + { + "mfussenegger/nvim-lint", + init = function() + vim.api.nvim_create_autocmd({ "BufWritePost" }, { + callback = function() + require("lint").try_lint() + end, + }) + end, + config = function() + require("lint").linters_by_ft = { + lua = { "luacheck" }, + typescript = { "eslint" }, + } + end, + }, +} diff --git a/nvim/lua/plugins/lsp.lua b/nvim/lua/plugins/lsp.lua new file mode 100644 index 000000000..206bbfe3f --- /dev/null +++ b/nvim/lua/plugins/lsp.lua @@ -0,0 +1,110 @@ +return { + -- lspconfig + { + "neovim/nvim-lspconfig", + dependencies = { + { + "folke/lazydev.nvim", + ft = "lua", -- only load on lua files + cmd = "LazyDev", + opts = { + library = { + -- See the configuration section for more details + -- Load luvit types when the `vim.uv` word is found + { path = "${3rd}/luv/library", words = { "vim%.uv" } }, + }, + }, + }, + }, + init = function() + -- Global mappings. + -- See `:help vim.diagnostic.*` for documentation on any of the below functions + -- vim.keymap.set("n", "e", vim.diagnostic.open_float) + -- vim.keymap.set("n", "[d", vim.diagnostic.goto_prev) + -- vim.keymap.set("n", "]d", vim.diagnostic.goto_next) + vim.keymap.set("n", "q", vim.diagnostic.setloclist) + + -- Use LspAttach autocommand to only map the following keys + -- after the language server attaches to the current buffer + vim.api.nvim_create_autocmd("LspAttach", { + group = vim.api.nvim_create_augroup("UserLspConfig", {}), + callback = function(ev) + -- Enable completion triggered by + -- vim.bo[ev.buf].omnifunc = "v:lua.vim.lsp.omnifunc" + + -- Buffer local mappings. + -- See `:help vim.lsp.*` for documentation on any of the below functions + local opts = { buffer = ev.buf } + vim.keymap.set("n", "gD", vim.lsp.buf.declaration, opts) + vim.keymap.set("n", "gd", vim.lsp.buf.definition, opts) + -- vim.keymap.set("n", "K", vim.lsp.buf.hover, opts) + vim.keymap.set("n", "gi", vim.lsp.buf.implementation, opts) + vim.keymap.set("n", "", vim.lsp.buf.signature_help, opts) + vim.keymap.set("n", "wa", vim.lsp.buf.add_workspace_folder, opts) + vim.keymap.set("n", "wr", vim.lsp.buf.remove_workspace_folder, opts) + vim.keymap.set("n", "wl", function() + print(vim.inspect(vim.lsp.buf.list_workspace_folders())) + end, opts) + vim.keymap.set("n", "D", vim.lsp.buf.type_definition, opts) + vim.keymap.set("n", "rn", vim.lsp.buf.rename, opts) + vim.keymap.set({ "n", "v" }, "ca", vim.lsp.buf.code_action, opts) + vim.keymap.set("n", "gr", vim.lsp.buf.references, opts) + end, + }) + end, + config = function() + local lspconfig = require("lspconfig") + local capabilities = require("blink.cmp").get_lsp_capabilities() + + lspconfig.lua_ls.setup({ + on_init = function(client) + if client.workspace_folders then + 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 + end + + client.config.settings.Lua = vim.tbl_deep_extend("force", client.config.settings.Lua, { + runtime = { + version = "LuaJIT", + }, + -- Make the server aware of Neovim runtime files + workspace = { + checkThirdParty = false, + library = { + vim.env.VIMRUNTIME, + }, + }, + }) + end, + settings = { + Lua = { + codeLens = { + enable = true, + }, + completion = { + callSnippet = "Replace", + }, + doc = { + privateName = { "^_" }, + }, + hint = { + enable = true, + setType = false, + paramType = true, + paramName = "Disable", + semicolon = "Disable", + arrayIndex = "Disable", + }, + }, + }, + capabilities = capabilities, + }) + + lspconfig.ts_ls.setup({ + capabilities = capabilities, + }) + end, + }, +} diff --git a/nvim/lua/plugins/tokyonight.lua b/nvim/lua/plugins/tokyonight.lua new file mode 100644 index 000000000..fdf48736a --- /dev/null +++ b/nvim/lua/plugins/tokyonight.lua @@ -0,0 +1,12 @@ +return { + { + "folke/tokyonight.nvim", + 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() + -- load the colorscheme here + vim.cmd([[colorscheme tokyonight-night]]) + end, + enable = false, + }, +} diff --git a/nvim/lua/plugins/treesitter.lua b/nvim/lua/plugins/treesitter.lua new file mode 100644 index 000000000..f17d77f8d --- /dev/null +++ b/nvim/lua/plugins/treesitter.lua @@ -0,0 +1,28 @@ +return { + { + "nvim-treesitter/nvim-treesitter", + version = false, -- last release is way too old and doesn't work on Windows + build = ":TSUpdate", + opts = { + -- A list of parser names, or "all" + ensure_installed = { "lua" }, + + -- Install parsers synchronously (only applied to `ensure_installed`) + sync_install = false, + + -- Automatically install missing parsers when entering buffer + -- Recommendation: set to false if you don't have `tree-sitter` CLI installed locally + auto_install = true, + + highlight = { + enable = true, + + -- Setting this to true will run `:h syntax` and tree-sitter at the same time. + -- Set this to `true` if you depend on 'syntax' being enabled (like for indentation). + -- Using this option may slow down your editor, and you may see some duplicate highlights. + -- Instead of true it can also be a list of languages + additional_vim_regex_highlighting = false, + }, + }, + }, +} diff --git a/sh/profile.d/visual.sh b/sh/profile.d/visual.sh index a6bb6d331..c25796185 100644 --- a/sh/profile.d/visual.sh +++ b/sh/profile.d/visual.sh @@ -1,5 +1,5 @@ # shellcheck shell=sh # Use vi as basic visual editor that should be installed most systems. -VISUAL="vi" +VISUAL="nvim" export VISUAL diff --git a/vim/after/ftplugin/javascript.vim b/vim.bak/after/ftplugin/javascript.vim similarity index 100% rename from vim/after/ftplugin/javascript.vim rename to vim.bak/after/ftplugin/javascript.vim diff --git a/vim/after/ftplugin/json.vim b/vim.bak/after/ftplugin/json.vim similarity index 100% rename from vim/after/ftplugin/json.vim rename to vim.bak/after/ftplugin/json.vim diff --git a/vim/after/ftplugin/markdown.vim b/vim.bak/after/ftplugin/markdown.vim similarity index 100% rename from vim/after/ftplugin/markdown.vim rename to vim.bak/after/ftplugin/markdown.vim diff --git a/vim/after/ftplugin/sh.vim b/vim.bak/after/ftplugin/sh.vim similarity index 100% rename from vim/after/ftplugin/sh.vim rename to vim.bak/after/ftplugin/sh.vim diff --git a/vim/after/ftplugin/txt.vim b/vim.bak/after/ftplugin/txt.vim similarity index 100% rename from vim/after/ftplugin/txt.vim rename to vim.bak/after/ftplugin/txt.vim diff --git a/vim/after/ftplugin/typescript.vim b/vim.bak/after/ftplugin/typescript.vim similarity index 100% rename from vim/after/ftplugin/typescript.vim rename to vim.bak/after/ftplugin/typescript.vim diff --git a/vim/after/ftplugin/vim.vim b/vim.bak/after/ftplugin/vim.vim similarity index 100% rename from vim/after/ftplugin/vim.vim rename to vim.bak/after/ftplugin/vim.vim diff --git a/vim/after/indent/javascript.vim b/vim.bak/after/indent/javascript.vim similarity index 100% rename from vim/after/indent/javascript.vim rename to vim.bak/after/indent/javascript.vim diff --git a/vim/after/indent/json.vim b/vim.bak/after/indent/json.vim similarity index 100% rename from vim/after/indent/json.vim rename to vim.bak/after/indent/json.vim diff --git a/vim/after/indent/markdown.vim b/vim.bak/after/indent/markdown.vim similarity index 100% rename from vim/after/indent/markdown.vim rename to vim.bak/after/indent/markdown.vim diff --git a/vim/after/indent/sh.vim b/vim.bak/after/indent/sh.vim similarity index 100% rename from vim/after/indent/sh.vim rename to vim.bak/after/indent/sh.vim diff --git a/vim/after/indent/typescript.vim b/vim.bak/after/indent/typescript.vim similarity index 100% rename from vim/after/indent/typescript.vim rename to vim.bak/after/indent/typescript.vim diff --git a/vim/after/indent/vim.vim b/vim.bak/after/indent/vim.vim similarity index 100% rename from vim/after/indent/vim.vim rename to vim.bak/after/indent/vim.vim diff --git a/vim/after/indent/yaml.vim b/vim.bak/after/indent/yaml.vim similarity index 100% rename from vim/after/indent/yaml.vim rename to vim.bak/after/indent/yaml.vim diff --git a/vim/autoload/indent.vim b/vim.bak/autoload/indent.vim similarity index 100% rename from vim/autoload/indent.vim rename to vim.bak/autoload/indent.vim diff --git a/vim/compiler/eslint.vim b/vim.bak/compiler/eslint.vim similarity index 100% rename from vim/compiler/eslint.vim rename to vim.bak/compiler/eslint.vim diff --git a/vim/compiler/rubocop.vim b/vim.bak/compiler/rubocop.vim similarity index 100% rename from vim/compiler/rubocop.vim rename to vim.bak/compiler/rubocop.vim diff --git a/vim/compiler/vint.vim b/vim.bak/compiler/vint.vim similarity index 100% rename from vim/compiler/vint.vim rename to vim.bak/compiler/vint.vim diff --git a/vim/ftdetect/brewfile.vim b/vim.bak/ftdetect/brewfile.vim similarity index 100% rename from vim/ftdetect/brewfile.vim rename to vim.bak/ftdetect/brewfile.vim diff --git a/vim/ftdetect/git-config.vim b/vim.bak/ftdetect/git-config.vim similarity index 100% rename from vim/ftdetect/git-config.vim rename to vim.bak/ftdetect/git-config.vim diff --git a/vim/ftdetect/shell-config.vim b/vim.bak/ftdetect/shell-config.vim similarity index 100% rename from vim/ftdetect/shell-config.vim rename to vim.bak/ftdetect/shell-config.vim diff --git a/vim/plugin/disable-builtin-plugins.vim b/vim.bak/plugin/disable-builtin-plugins.vim similarity index 100% rename from vim/plugin/disable-builtin-plugins.vim rename to vim.bak/plugin/disable-builtin-plugins.vim diff --git a/vim/plugin/editorconfig.vim b/vim.bak/plugin/editorconfig.vim similarity index 100% rename from vim/plugin/editorconfig.vim rename to vim.bak/plugin/editorconfig.vim diff --git a/vim/plugin/git-grep.vim b/vim.bak/plugin/git-grep.vim similarity index 100% rename from vim/plugin/git-grep.vim rename to vim.bak/plugin/git-grep.vim diff --git a/vim/plugin/matchit.vim b/vim.bak/plugin/matchit.vim similarity index 100% rename from vim/plugin/matchit.vim rename to vim.bak/plugin/matchit.vim diff --git a/vim/plugin/statusline.vim b/vim.bak/plugin/statusline.vim similarity index 100% rename from vim/plugin/statusline.vim rename to vim.bak/plugin/statusline.vim diff --git a/vim/vimrc b/vim.bak/vimrc similarity index 100% rename from vim/vimrc rename to vim.bak/vimrc