From 2520573c1f3268132c4ebace845f23fde1163c2f Mon Sep 17 00:00:00 2001 From: Michael Housh Date: Sun, 12 Dec 2021 13:35:50 -0500 Subject: [PATCH 1/2] Merged develop --- .gitignore | 2 + .stow-local-ignore | 7 + Makefile | 35 +- README.md | 101 ++++++ git/{.gitconfig => .config/git/config} | 3 + git/.config/git/gitignore | 37 ++ macOS/.config/iterm/profile.json | 336 ++++++++++++++++++ macOS/.config/macOS/AppStore.Brewfile | 2 + macOS/.config/macOS/Brewfile | 29 ++ nvim/.config/nvim/init.lua | 3 +- nvim/.config/nvim/lua/config/cmp.lua | 112 ++++++ nvim/.config/nvim/lua/config/diffview.lua | 37 ++ .../.config/nvim/lua/config/lsp-installer.lua | 16 + nvim/.config/nvim/lua/config/lsp.lua | 198 +++++++++++ nvim/.config/nvim/lua/config/neogit.lua | 32 ++ nvim/.config/nvim/lua/config/nvim-tree.lua | 2 +- nvim/.config/nvim/lua/config/which.lua | 67 ++-- nvim/.config/nvim/lua/keymaps.lua | 28 -- nvim/.config/nvim/lua/mappings.lua | 33 ++ nvim/.config/nvim/lua/plugins.lua | 41 +++ nvim/.config/nvim/lua/theme.lua | 21 -- nvim/.config/nvim/plugin/packer_compiled.lua | 151 +++++++- zsh/.config/zsh/.zcompcache/brew_all_commands | 4 + zsh/.config/zsh/.zshrc | 2 + zsh/.config/zsh/banner | 10 + zsh/.config/zsh/zsh-aliases | 10 +- 26 files changed, 1213 insertions(+), 106 deletions(-) create mode 100644 .gitignore create mode 100644 .stow-local-ignore rename git/{.gitconfig => .config/git/config} (57%) create mode 100644 git/.config/git/gitignore create mode 100644 macOS/.config/iterm/profile.json create mode 100644 macOS/.config/macOS/AppStore.Brewfile create mode 100644 macOS/.config/macOS/Brewfile create mode 100644 nvim/.config/nvim/lua/config/cmp.lua create mode 100644 nvim/.config/nvim/lua/config/diffview.lua create mode 100644 nvim/.config/nvim/lua/config/lsp-installer.lua create mode 100644 nvim/.config/nvim/lua/config/lsp.lua create mode 100644 nvim/.config/nvim/lua/config/neogit.lua delete mode 100644 nvim/.config/nvim/lua/keymaps.lua create mode 100644 nvim/.config/nvim/lua/mappings.lua create mode 100644 zsh/.config/zsh/.zcompcache/brew_all_commands create mode 100644 zsh/.config/zsh/banner diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..a495476 --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ +**/.DS_Store +**/Brewfile.lock.json diff --git a/.stow-local-ignore b/.stow-local-ignore new file mode 100644 index 0000000..2662bff --- /dev/null +++ b/.stow-local-ignore @@ -0,0 +1,7 @@ +^/.DS_Store* +^/Brewfile* +^/README.* +^/LICENSE.* + +\.git +\.gitignore diff --git a/Makefile b/Makefile index 91fc598..da061c3 100644 --- a/Makefile +++ b/Makefile @@ -1,16 +1,33 @@ -install-brew: +bootstrap-homebrew: + xcode-select --install | true /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)" -install-brew-recipes: - @brew install stow \ - httpie \ - zsh +bootsrap-brews: + @brew bundle \ + --no-lock \ + --cleanup \ + --debug \ + --file "$(PWD)/macOS/.config/macOS/Brewfile" -install-brew-casks: - @brew install --cask docker \ - google-chrome +bootstrap-logitech: + @curl \ + --output ~/Downloads/logi-options.zip \ + https://download01.logi.com/web/ftp/pub/techsupport/options/options_installer.zip + +bootstrap-amazon-workdocs: + @curl \ + --output ~/Downloads/AmazonWorkDocsDrive.pkg \ + https://d3f2hupz96ggz3.cloudfront.net/mac/AmazonWorkDocsDrive.pkg + +bootstrap-app-store: + @brew bundle \ + --no-lock \ + --cleanup \ + --debug \ + --file "$(PWD)/macOS/.config/macOS/AppStore.Brewfile" stow: @stow --stow --verbose --target ~ */ -fresh-install: install-brew install-brew-recipes install-brew-casks stow +# Order matters, need to install home-brew first then formula +bootstrap: bootstrap-homebrew bootstrap-brews stow bootstrap-logitech bootstrap-amazon-workdocs bootstrap-app-store diff --git a/README.md b/README.md index 7498071..f49b2e0 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,104 @@ # My Dotfiles This is my repository for learning dotfiles. + +It currently will install homebrew and the following homebrew formula. + +``` +fd +git +mas +neovim +node +ripgrep +stow +swift-format +zsh + +``` + +It will also install the following homebrew casks in the `~/Applications` directory. + +``` +docker +google-chrome +iterm2 +microsoft-teams +obs +paw +sketchup-pro +``` + +And the following fonts. + +``` +font-inconsolata-nerd-font + +``` + +The following applications will be installed from the macOS app store. + +``` +pwSafe +Xcode +``` + +The following non-app-store applications will be downloaded for later installation / setup. These will be placed in `~/Downloads` + +``` +Logi Options # logitech mouse / keyboard settings +AmazonWorkDocsDrive +``` + +## Installation + +Clone the repository. + +```bash +git clone https://m-housh/dotfiles.git ~/.dotfiles && \ + cd ~/.dotfiles +``` + +The Makefile includes commands to install dependencies andlink the configuration using `gnu-stow`. + +On a fresh system run the following command from the dotfiles root. + +``` +make bootstrap +``` + +This start by installing homebrew, then install the required homebrew formulas and casks. Next it will use `gnu-stow` to symlink configuration files to the appropriate locations. And finally, it will download applications from the `App Store`. + +After everything has finished up, you will be able to open `iTerm2` and load the profile which should now be symlinked to `~/.config/macOS/iterm/profile.json` + +## Make commands + +It is also possible to not do the full bootstrapping. If you would only like to install homebrew (without any formula or casks) then you can run the following command. + +``` +make bootstrap-homebrew +``` + +Once homebrew is installed, if you'd like to install the homebrew formula and casks (located in `macOS/.config/macOS/Brewfile`) then you can run the following command. + +``` +make bootstrap-brews +``` + +To symlink the configuration files only then you can run. + +``` +make stow +``` + +To download the logitech options application and place in your `~/Downloads` folder, you can run. + +``` +make bootstrap-logitech +``` + +And finally to download the app store applications run. + +``` +make bootstrap-app-store +``` diff --git a/git/.gitconfig b/git/.config/git/config similarity index 57% rename from git/.gitconfig rename to git/.config/git/config index 0e2e7e5..c14a295 100644 --- a/git/.gitconfig +++ b/git/.config/git/config @@ -1,3 +1,6 @@ +[core] + excludesfile = ~/.config/git/gitignore + [user] name = Michael Housh email = mhoush@houshhomeenergy.com diff --git a/git/.config/git/gitignore b/git/.config/git/gitignore new file mode 100644 index 0000000..773bfd6 --- /dev/null +++ b/git/.config/git/gitignore @@ -0,0 +1,37 @@ +# Compiled source # +################### +*.com +*.class +*.dll +*.exe +*.o +*.so + +# Packages # +############ +# it's better to unpack these files and commit the raw source +# git has its own built in compression methods +*.7z +*.dmg +*.gz +*.iso +*.jar +*.rar +*.tar +*.zip + +# Logs and databases # +###################### +*.log +*.sql +*.sqlite + +# OS generated files # +###################### +.DS_Store +.DS_Store? +._* +.Spotlight-V100 +.Trashes +ehthumbs.db +Thumbs.db diff --git a/macOS/.config/iterm/profile.json b/macOS/.config/iterm/profile.json new file mode 100644 index 0000000..bfaf464 --- /dev/null +++ b/macOS/.config/iterm/profile.json @@ -0,0 +1,336 @@ +{ + "Ansi 7 Color" : { + "Green Component" : 0.73333334922790527, + "Red Component" : 0.73333334922790527, + "Blue Component" : 0.73333334922790527 + }, + "Tags" : [ + + ], + "Ansi 12 Color" : { + "Green Component" : 0.3333333432674408, + "Red Component" : 0.3333333432674408, + "Blue Component" : 1 + }, + "Ansi 8 Color" : { + "Green Component" : 0.3333333432674408, + "Red Component" : 0.3333333432674408, + "Blue Component" : 0.3333333432674408 + }, + "Ansi 9 Color" : { + "Green Component" : 0.3333333432674408, + "Red Component" : 1, + "Blue Component" : 0.3333333432674408 + }, + "Bold Color" : { + "Green Component" : 1, + "Red Component" : 1, + "Blue Component" : 1 + }, + "Ansi 5 Color" : { + "Green Component" : 0, + "Red Component" : 0.73333334922790527, + "Blue Component" : 0.73333334922790527 + }, + "Use Non-ASCII Font" : false, + "Rows" : 40, + "Default Bookmark" : "No", + "Non-ASCII Anti Aliased" : true, + "Use Bright Bold" : true, + "Ansi 10 Color" : { + "Green Component" : 1, + "Red Component" : 0.3333333432674408, + "Blue Component" : 0.3333333432674408 + }, + "Ambiguous Double Width" : false, + "Jobs to Ignore" : [ + "rlogin", + "ssh", + "slogin", + "telnet" + ], + "Ansi 15 Color" : { + "Green Component" : 1, + "Red Component" : 1, + "Blue Component" : 1 + }, + "Foreground Color" : { + "Green Component" : 0.73333334922790527, + "Red Component" : 0.73333334922790527, + "Blue Component" : 0.73333334922790527 + }, + "Bound Hosts" : [ + + ], + "Working Directory" : "\/Users\/michael", + "Blinking Cursor" : false, + "Disable Window Resizing" : true, + "Sync Title" : false, + "Prompt Before Closing 2" : false, + "BM Growl" : true, + "Command" : "", + "Description" : "Default", + "Mouse Reporting" : true, + "Screen" : -1, + "Selection Color" : { + "Green Component" : 0.8353000283241272, + "Red Component" : 0.70980000495910645, + "Blue Component" : 1 + }, + "Columns" : 120, + "Idle Code" : 0, + "Ansi 13 Color" : { + "Green Component" : 0.3333333432674408, + "Red Component" : 1, + "Blue Component" : 1 + }, + "Custom Command" : "No", + "ASCII Anti Aliased" : true, + "Non Ascii Font" : "icomoon 12", + "Vertical Spacing" : 1, + "Use Bold Font" : true, + "Option Key Sends" : 0, + "Selected Text Color" : { + "Green Component" : 0, + "Red Component" : 0, + "Blue Component" : 0 + }, + "Background Color" : { + "Green Component" : 0, + "Red Component" : 0, + "Blue Component" : 0 + }, + "Character Encoding" : 4, + "Ansi 11 Color" : { + "Green Component" : 1, + "Red Component" : 1, + "Blue Component" : 0.3333333432674408 + }, + "Use Italic Font" : true, + "Unlimited Scrollback" : false, + "Keyboard Map" : { + "0xf700-0x260000" : { + "Text" : "[1;6A", + "Action" : 10 + }, + "0x37-0x40000" : { + "Text" : "0x1f", + "Action" : 11 + }, + "0x32-0x40000" : { + "Text" : "0x00", + "Action" : 11 + }, + "0xf709-0x20000" : { + "Text" : "[17;2~", + "Action" : 10 + }, + "0xf70c-0x20000" : { + "Text" : "[20;2~", + "Action" : 10 + }, + "0xf729-0x20000" : { + "Text" : "[1;2H", + "Action" : 10 + }, + "0xf72b-0x40000" : { + "Text" : "[1;5F", + "Action" : 10 + }, + "0xf705-0x20000" : { + "Text" : "[1;2Q", + "Action" : 10 + }, + "0xf703-0x260000" : { + "Text" : "[1;6C", + "Action" : 10 + }, + "0xf700-0x220000" : { + "Text" : "[1;2A", + "Action" : 10 + }, + "0xf701-0x280000" : { + "Text" : "0x1b 0x1b 0x5b 0x42", + "Action" : 11 + }, + "0x38-0x40000" : { + "Text" : "0x7f", + "Action" : 11 + }, + "0x33-0x40000" : { + "Text" : "0x1b", + "Action" : 11 + }, + "0xf703-0x220000" : { + "Text" : "[1;2C", + "Action" : 10 + }, + "0xf701-0x240000" : { + "Text" : "[1;5B", + "Action" : 10 + }, + "0xf70d-0x20000" : { + "Text" : "[21;2~", + "Action" : 10 + }, + "0xf702-0x260000" : { + "Text" : "[1;6D", + "Action" : 10 + }, + "0xf729-0x40000" : { + "Text" : "[1;5H", + "Action" : 10 + }, + "0xf706-0x20000" : { + "Text" : "[1;2R", + "Action" : 10 + }, + "0x34-0x40000" : { + "Text" : "0x1c", + "Action" : 11 + }, + "0xf700-0x280000" : { + "Text" : "0x1b 0x1b 0x5b 0x41", + "Action" : 11 + }, + "0x2d-0x40000" : { + "Text" : "0x1f", + "Action" : 11 + }, + "0xf70e-0x20000" : { + "Text" : "[23;2~", + "Action" : 10 + }, + "0xf702-0x220000" : { + "Text" : "[1;2D", + "Action" : 10 + }, + "0xf703-0x280000" : { + "Text" : "0x1b 0x1b 0x5b 0x43", + "Action" : 11 + }, + "0xf700-0x240000" : { + "Text" : "[1;5A", + "Action" : 10 + }, + "0xf707-0x20000" : { + "Text" : "[1;2S", + "Action" : 10 + }, + "0xf70a-0x20000" : { + "Text" : "[18;2~", + "Action" : 10 + }, + "0x35-0x40000" : { + "Text" : "0x1d", + "Action" : 11 + }, + "0xf70f-0x20000" : { + "Text" : "[24;2~", + "Action" : 10 + }, + "0xf703-0x240000" : { + "Text" : "[1;5C", + "Action" : 10 + }, + "0xf701-0x260000" : { + "Text" : "[1;6B", + "Action" : 10 + }, + "0xf702-0x280000" : { + "Text" : "0x1b 0x1b 0x5b 0x44", + "Action" : 11 + }, + "0xf72b-0x20000" : { + "Text" : "[1;2F", + "Action" : 10 + }, + "0x36-0x40000" : { + "Text" : "0x1e", + "Action" : 11 + }, + "0xf708-0x20000" : { + "Text" : "[15;2~", + "Action" : 10 + }, + "0xf701-0x220000" : { + "Text" : "[1;2B", + "Action" : 10 + }, + "0xf70b-0x20000" : { + "Text" : "[19;2~", + "Action" : 10 + }, + "0xf702-0x240000" : { + "Text" : "[1;5D", + "Action" : 10 + }, + "0xf704-0x20000" : { + "Text" : "[1;2P", + "Action" : 10 + } + }, + "Window Type" : 0, + "Background Image Location" : "", + "Blur" : false, + "Scrollback Lines" : 1000, + "Send Code When Idle" : false, + "Close Sessions On End" : true, + "Terminal Type" : "xterm-256color", + "Visual Bell" : true, + "Flashing Bell" : false, + "Silence Bell" : false, + "Ansi 14 Color" : { + "Green Component" : 1, + "Red Component" : 0.3333333432674408, + "Blue Component" : 1 + }, + "Name" : "mhoush", + "Cursor Text Color" : { + "Green Component" : 1, + "Red Component" : 1, + "Blue Component" : 1 + }, + "Shortcut" : "", + "Cursor Color" : { + "Green Component" : 0.73333334922790527, + "Red Component" : 0.73333334922790527, + "Blue Component" : 0.73333334922790527 + }, + "Transparency" : 0.14805401741190161, + "Ansi 1 Color" : { + "Green Component" : 0, + "Red Component" : 0.73333334922790527, + "Blue Component" : 0 + }, + "Horizontal Spacing" : 1, + "Custom Directory" : "No", + "Ansi 4 Color" : { + "Green Component" : 0, + "Red Component" : 0, + "Blue Component" : 0.73333334922790527 + }, + "Ansi 0 Color" : { + "Green Component" : 0, + "Red Component" : 0, + "Blue Component" : 0 + }, + "Guid" : "3B878A03-0EF2-4A8C-B1FD-7DEF4A0ABF6F", + "Ansi 3 Color" : { + "Green Component" : 0.73333334922790527, + "Red Component" : 0.73333334922790527, + "Blue Component" : 0 + }, + "Normal Font" : "InconsolataNerdFontCompleteM-Regular 14", + "Ansi 2 Color" : { + "Green Component" : 0.73333334922790527, + "Red Component" : 0, + "Blue Component" : 0 + }, + "Right Option Key Sends" : 0, + "Ansi 6 Color" : { + "Green Component" : 0.73333334922790527, + "Red Component" : 0, + "Blue Component" : 0.73333334922790527 + } +} \ No newline at end of file diff --git a/macOS/.config/macOS/AppStore.Brewfile b/macOS/.config/macOS/AppStore.Brewfile new file mode 100644 index 0000000..cd3ab0b --- /dev/null +++ b/macOS/.config/macOS/AppStore.Brewfile @@ -0,0 +1,2 @@ +mas "pwSafe", id: "520993579" +mas "Xcode", id: "497799835" diff --git a/macOS/.config/macOS/Brewfile b/macOS/.config/macOS/Brewfile new file mode 100644 index 0000000..10d3ad9 --- /dev/null +++ b/macOS/.config/macOS/Brewfile @@ -0,0 +1,29 @@ +tap "homebrew/cask" +tap "homebrew/cask-fonts" + +# TODO: Make the application directory a global variable ?? +# set arguments for all 'brew install --cask' commands +cask_args appdir: "~/Applications", require_sha: true + +# formula +brew "fd" # required for some neovim plugins +brew "git" +brew "mas" +brew "neovim" +brew "node" # required for some LSP servers in neovim +brew "ripgrep" +brew "stow" +brew "swift-format" +brew "zsh" + +# casks +cask "docker" +cask "google-chrome" +cask "iterm2" +cask "obs" +cask "paw" +cask "sketchup-pro" +cask "microsoft-teams" + +# fonts +cask "font-inconsolata-nerd-font" diff --git a/nvim/.config/nvim/init.lua b/nvim/.config/nvim/init.lua index 1faf282..d626365 100644 --- a/nvim/.config/nvim/init.lua +++ b/nvim/.config/nvim/init.lua @@ -2,7 +2,7 @@ require('plugins') -- Key maps -require('keymaps') +require('mappings') -- Common settings require('settings') @@ -12,4 +12,3 @@ require('autocmd') -- Theme require('theme') - diff --git a/nvim/.config/nvim/lua/config/cmp.lua b/nvim/.config/nvim/lua/config/cmp.lua new file mode 100644 index 0000000..f333ce8 --- /dev/null +++ b/nvim/.config/nvim/lua/config/cmp.lua @@ -0,0 +1,112 @@ +-- Setup nvim-cmp. +local cmp = require "cmp" +local lspkind = require("lspkind") + +local has_words_before = function() + 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 feedkey = function(key, mode) + vim.api.nvim_feedkeys(vim.api.nvim_replace_termcodes(key, true, true, true), + mode, true) +end + +lspkind.init({ + symbol_map = { + Text = "", + Method = "", + Function = "", + Constructor = "", + Field = "ﰠ", + Variable = "", + Class = "ﴯ", + Interface = "", + Module = "", + Property = "ﰠ", + Unit = "塞", + Value = "", + Enum = "", + Keyword = "", + Snippet = "", + Color = "", + File = "", + Reference = "", + Folder = "", + EnumMember = "", + Constant = "", + Struct = "פּ", + Event = "", + Operator = "", + TypeParameter = "" + } +}) + +cmp.setup({ + formatting = { + format = lspkind.cmp_format { + with_text = false, + maxwidth = 50, + menu = { + buffer = "BUF", + nvim_lsp = "LSP", + path = "PATH", + vsnip = "SNIP", + calc = "CALC", + spell = "SPELL", + emoji = "EMOJI" + } + } + }, + experimental = {native_menu = false, ghost_text = false}, + snippet = { + expand = function(args) + vim.fn["vsnip#anonymous"](args.body) -- For `vsnip` users. + end + }, + mapping = { + [""] = cmp.mapping.select_prev_item(), + [""] = cmp.mapping.select_next_item(), + [""] = cmp.mapping.scroll_docs(-4), + [""] = cmp.mapping.scroll_docs(4), + [""] = cmp.mapping.complete(), + [""] = cmp.mapping.close(), + [""] = cmp.mapping.confirm { + behavior = cmp.ConfirmBehavior.Replace, + select = false + }, + [""] = cmp.mapping(function(fallback) + if cmp.visible() then + cmp.select_next_item() + elseif vim.fn["vsnip#available"](1) == 1 then + feedkey("(vsnip-expand-or-jump)", "") + elseif has_words_before() then + cmp.complete() + else + fallback() -- The fallback function sends a already mapped key. In this case, it's probably ``. + end + end, {"i", "s"}), + [""] = cmp.mapping(function() + if cmp.visible() then + cmp.select_prev_item() + elseif vim.fn["vsnip#jumpable"](-1) == 1 then + feedkey("(vsnip-jump-prev)", "") + end + end, {"i", "s"}) + }, + sources = { + {name = "nvim_lsp"}, {name = "buffer", keyword_length = 5}, + {name = "vsnip"}, {name = "calc"}, {name = "emoji"}, {name = "spell"}, + {name = "path"} + } +}) + +-- Use buffer source for `/`. +cmp.setup.cmdline("/", {sources = {{name = "buffer"}}}) + +-- Use cmdline & path source for ':'. +cmp.setup.cmdline(":", { + sources = cmp.config.sources({{name = "path"}}, {{name = "cmdline"}}) +}) diff --git a/nvim/.config/nvim/lua/config/diffview.lua b/nvim/.config/nvim/lua/config/diffview.lua new file mode 100644 index 0000000..6d01c08 --- /dev/null +++ b/nvim/.config/nvim/lua/config/diffview.lua @@ -0,0 +1,37 @@ +local cb = require'diffview.config'.diffview_callback + +require'diffview'.setup { + diff_binaries = false, -- Show diffs for binaries + use_icons = true, -- Requires nvim-web-devicons + file_panel = { + width = 35, + }, + key_bindings = { + disable_defaults = false, -- Disable the default key bindings + -- The `view` bindings are active in the diff buffers, only when the current + -- tabpage is a Diffview. + view = { + [""] = cb("select_next_entry"), -- Open the diff for the next file + [""] = cb("select_prev_entry"), -- Open the diff for the previous file + ["e"] = cb("focus_files"), -- Bring focus to the files panel + ["b"] = cb("toggle_files"), -- Toggle the files panel. + }, + file_panel = { + ["j"] = cb("next_entry"), -- Bring the cursor to the next file entry + [""] = cb("next_entry"), + ["k"] = cb("prev_entry"), -- Bring the cursor to the previous file entry. + [""] = cb("prev_entry"), + [""] = cb("select_entry"), -- Open the diff for the selected entry. + ["o"] = cb("select_entry"), + ["<2-LeftMouse>"] = cb("select_entry"), + ["-"] = cb("toggle_stage_entry"), -- Stage / unstage the selected entry. + ["S"] = cb("stage_all"), -- Stage all entries. + ["U"] = cb("unstage_all"), -- Unstage all entries. + ["R"] = cb("refresh_files"), -- Update stats and entries in the file list. + [""] = cb("select_next_entry"), + [""] = cb("select_prev_entry"), + ["e"] = cb("focus_files"), + ["b"] = cb("toggle_files"), + } + } +} diff --git a/nvim/.config/nvim/lua/config/lsp-installer.lua b/nvim/.config/nvim/lua/config/lsp-installer.lua new file mode 100644 index 0000000..43dccc9 --- /dev/null +++ b/nvim/.config/nvim/lua/config/lsp-installer.lua @@ -0,0 +1,16 @@ +local lsp_installer = require("nvim-lsp-installer") + +-- Register a handler that will be called for all installed servers. +-- Alternatively, you may also register handlers on specific server instances instead (see example below). +lsp_installer.on_server_ready(function(server) + local opts = {} + + -- (optional) Customize the options passed to the server + -- if server.name == "tsserver" then + -- opts.root_dir = function() ... end + -- end + + -- This setup() function is exactly the same as lspconfig's setup function. + -- Refer to https://github.com/neovim/nvim-lspconfig/blob/master/doc/server_configurations.md + server:setup(opts) +end) diff --git a/nvim/.config/nvim/lua/config/lsp.lua b/nvim/.config/nvim/lua/config/lsp.lua new file mode 100644 index 0000000..423c13e --- /dev/null +++ b/nvim/.config/nvim/lua/config/lsp.lua @@ -0,0 +1,198 @@ +local nvim_lsp = require("lspconfig") + +-- Use an on_attach function to only map the following keys +-- after the language server attaches to the current buffer +local on_attach = function(bufnr) + local function buf_set_keymap(...) + vim.api.nvim_buf_set_keymap(bufnr, ...) + end + + -- Mappings. + local opts = {noremap = true, silent = true} + + -- See `:help vim.lsp.*` for documentation on any of the below functions + buf_set_keymap("n", "gD", "lua vim.lsp.buf.declaration()", opts) + buf_set_keymap("n", "gd", "lua vim.lsp.buf.definition()", opts) + buf_set_keymap("n", "K", "lua vim.lsp.buf.hover()", opts) + buf_set_keymap("n", "gi", "lua vim.lsp.buf.implementation()", opts) + -- buf_set_keymap('n', '', 'lua vim.lsp.buf.signature_help()', opts) + buf_set_keymap("n", "wa", + "lua vim.lsp.buf.add_workspace_folder()", opts) + buf_set_keymap("n", "wr", + "lua vim.lsp.buf.remove_workspace_folder()", opts) + buf_set_keymap("n", "wl", + "lua print(vim.inspect(vim.lsp.buf.list_workspace_folders()))", + opts) + buf_set_keymap("n", "D", + "lua vim.lsp.buf.type_definition()", opts) + buf_set_keymap("n", "rn", "lua vim.lsp.buf.rename()", opts) + buf_set_keymap("n", "ca", "lua vim.lsp.buf.code_action()", + opts) + buf_set_keymap("n", "gr", "lua vim.lsp.buf.references()", opts) + buf_set_keymap("n", "e", + "lua vim.lsp.diagnostic.show_line_diagnostics()", + opts) + buf_set_keymap("n", "[d", "lua vim.lsp.diagnostic.goto_prev()", + opts) + buf_set_keymap("n", "]d", "lua vim.lsp.diagnostic.goto_next()", + opts) + buf_set_keymap("n", "q", + "lua vim.lsp.diagnostic.set_loclist()", opts) + buf_set_keymap("n", "f", "lua vim.lsp.buf.formatting()", + opts) + +end + +-- Use a loop to conveniently call 'setup' on multiple servers and +-- map buffer local keybindings when the language server attaches +local capabilities = vim.lsp.protocol.make_client_capabilities() +capabilities = require("cmp_nvim_lsp").update_capabilities(capabilities) + +local servers = { + "gopls", "bashls", "jedi_language_server", "dockerls", "terraformls", + "tsserver", "texlab", "yamlls", "jsonls" +} +for _, lsp in ipairs(servers) do + nvim_lsp[lsp].setup { + on_attach = on_attach, + capabilities = capabilities, + settings = { + gopls = {analyses = {unusedparams = false}, staticcheck = true}, + json = { + format = {enabled = false}, + schemas = { + { + description = "ESLint config", + fileMatch = {".eslintrc.json", ".eslintrc"}, + url = "http://json.schemastore.org/eslintrc" + }, { + description = "Package config", + fileMatch = {"package.json"}, + url = "https://json.schemastore.org/package" + }, { + description = "Packer config", + fileMatch = {"packer.json"}, + url = "https://json.schemastore.org/packer" + }, { + description = "Renovate config", + fileMatch = { + "renovate.json", "renovate.json5", + ".github/renovate.json", ".github/renovate.json5", + ".renovaterc", ".renovaterc.json" + }, + url = "https://docs.renovatebot.com/renovate-schema" + }, { + description = "OpenApi config", + fileMatch = {"*api*.json"}, + url = "https://raw.githubusercontent.com/OAI/OpenAPI-Specification/main/schemas/v3.1/schema.json" + } + } + }, + redhat = {telemetry = {enabled = false}}, + texlab = { + auxDirectory = ".", + bibtexFormatter = "texlab", + build = { + args = { + "--keep-intermediates", "--keep-logs", "--synctex", "%f" + }, + executable = "tectonic", + forwardSearchAfter = false, + onSave = false + }, + chktex = {onEdit = false, onOpenAndSave = false}, + diagnosticsDelay = 300, + formatterLineLength = 80, + forwardSearch = {args = {}}, + latexFormatter = "latexindent", + latexindent = {modifyLineBreaks = false} + }, + yaml = { + schemaStore = { + enable = true, + url = "https://www.schemastore.org/api/json/catalog.json" + }, + schemas = { + kubernetes = "/*.yaml", + ["http://json.schemastore.org/github-workflow"] = ".github/workflows/*.{yml,yaml}", + ["http://json.schemastore.org/github-action"] = ".github/action.{yml,yaml}", + ["http://json.schemastore.org/ansible-stable-2.9"] = "roles/tasks/*.{yml,yaml}", + ["http://json.schemastore.org/prettierrc"] = ".prettierrc.{yml,yaml}", + ["http://json.schemastore.org/kustomization"] = "kustomization.{yml,yaml}", + ["http://json.schemastore.org/ansible-playbook"] = "*play*.{yml,yaml}", + ["http://json.schemastore.org/chart"] = "Chart.{yml,yaml}", + ["https://json.schemastore.org/dependabot-v2"] = ".github/dependabot.{yml,yaml}", + ["https://json.schemastore.org/gitlab-ci"] = "*gitlab-ci*.{yml,yaml}", + ["https://raw.githubusercontent.com/OAI/OpenAPI-Specification/main/schemas/v3.1/schema.json"] = "*api*.{yml,yaml}", + ["https://raw.githubusercontent.com/compose-spec/compose-spec/master/schema/compose-spec.json"] = "docker-compose.{yml,yaml}", + ["https://raw.githubusercontent.com/argoproj/argo-workflows/master/api/jsonschema/schema.json"] = "*flow*.{yml,yaml}" + }, + format = {enabled = false}, + validate = false, -- TODO: conflicts between Kubernetes resources and kustomization.yaml + completion = true, + hover = true + } + }, + flags = {debounce_text_changes = 150} + } + require"lsp_signature".setup({ + bind = true, -- This is mandatory, otherwise border config won't get registered. + floating_window = true, -- show hint in a floating window, set to false for virtual text only mode + doc_lines = 2, -- Set to 0 for not showing doc + hint_prefix = "🐼 ", + -- use_lspsaga = false, -- set to true if you want to use lspsaga popup + handler_opts = { + border = "shadow" -- double, single, shadow, none + } + }) +end + +local sumneko_root_path = os.getenv("HOME") .. ".cache/lua-language-server" +local sumneko_binary = "/usr/bin/lua-language-server" +require"lspconfig".sumneko_lua.setup { + cmd = {sumneko_binary, "-E", sumneko_root_path .. "/main.lua"}, + capabilities = capabilities, + on_attach = on_attach, + settings = { + Lua = { + runtime = {version = "LuaJIT", path = vim.split(package.path, ";")}, + completion = {enable = true, callSnippet = "Both"}, + diagnostics = { + enable = true, + globals = {"vim", "describe"}, + disable = {"lowercase-global"} + }, + workspace = { + library = { + [vim.fn.expand("$VIMRUNTIME/lua")] = true, + [vim.fn.expand("$VIMRUNTIME/lua/vim/lsp")] = true, + [vim.fn.expand("/usr/share/awesome/lib")] = true + }, + -- adjust these two values if your performance is not optimal + maxPreload = 2000, + preloadFileSize = 1000 + }, + telemetry = {enable = false} + } + } +} +-- alternative to formatter but yamlfix is not working and I need this for respecting yamllint config +-- but yamlfix is messing up ansible files ... 😠 +-- require('lspconfig')['efm'].setup{ +-- filetypes = { 'json', 'yaml','lua' }, +-- init_options = {documentFormatting = true, codeAction = false}, +-- settings = { +-- rootMarkers = {".git/"}, +-- languages = { +-- lua = { +-- {formatCommand = "lua-format -i", formatStdin = true} +-- }, +-- yaml = { +-- {formatCommand = "yamlfix -", formatStdin = true} +-- }, +-- json = { +-- {formatCommand = "prettier", formatStdin = true} +-- } +-- } +-- } +-- } diff --git a/nvim/.config/nvim/lua/config/neogit.lua b/nvim/.config/nvim/lua/config/neogit.lua new file mode 100644 index 0000000..ff13f66 --- /dev/null +++ b/nvim/.config/nvim/lua/config/neogit.lua @@ -0,0 +1,32 @@ +local neogit = require('neogit') +--neogit.config.use_magit_keybindings() + +neogit.setup { +disable_signs = false, + disable_context_highlighting = false, + disable_commit_confirmation = true, + -- customize displayed signs + signs = { + -- { CLOSED, OPENED } + section = { ">", "v" }, + item = { ">", "v" }, + hunk = { "", "" }, + }, + integrations = { + diffview = true + }, + -- override/add mappings + mappings = { + -- modify status buffer mappings + status = { + -- Adds a mapping with "B" as key that does the "BranchPopup" command + ["B"] = "BranchPopup", + ["C"] = "CommitPopup", + -- ["P"] = "PullPopup", + ["S"] = "Stage", + -- ["D"] = "Discard", + -- Removes the default mapping of "s" + -- ["s"] = "", + } + } +} diff --git a/nvim/.config/nvim/lua/config/nvim-tree.lua b/nvim/.config/nvim/lua/config/nvim-tree.lua index 71ad51a..dbe34c4 100644 --- a/nvim/.config/nvim/lua/config/nvim-tree.lua +++ b/nvim/.config/nvim/lua/config/nvim-tree.lua @@ -88,7 +88,7 @@ require("nvim-tree").setup { -- side of the tree, can be one of 'left' | 'right' | 'top' | 'bottom' side = "left", -- if true the tree will resize itself after opening a file - auto_resize = false, + auto_resize = true, mappings = { -- custom only false will merge the list with the default mappings -- if true, it will only use your list to set the mappings diff --git a/nvim/.config/nvim/lua/config/which.lua b/nvim/.config/nvim/lua/config/which.lua index 35d0f21..a9b341e 100644 --- a/nvim/.config/nvim/lua/config/which.lua +++ b/nvim/.config/nvim/lua/config/which.lua @@ -1,4 +1,4 @@ --- disable v +--isable v -- local presets = require("which-key.plugins.presets") -- presets.operators["v"] = nil require("which-key").setup { @@ -63,8 +63,8 @@ require("which-key").setup { i = {"j", "k"}, v = {"j", "k"} } -} +} local wk = require("which-key") default_options = {noremap = true, silent = true} @@ -72,8 +72,17 @@ default_options = {noremap = true, silent = true} --wk.register({ga = {"(EasyAlign)", "Align", mode = "x"}}) -- Register all leader based mappings +local wk = require("which-key") +-- As an example, we will create the following mappings: +-- * ff find files +-- * fr show recent files +-- * fb Foobar +-- we'll document: +-- * fn new file +-- * fe edit file +-- and hide 1 wk.register({ - [""] = {"e#", "Switch to previously opened buffer"}, + [""] = { b = { name = "Buffers", b = { @@ -81,41 +90,21 @@ wk.register({ "Find buffer" } }, + g = { + name = "Git", + c = { "Neogit Commit", "Git Commit" }, + g = { "Neogit", "Open NeoGit" } + }, f = { - name = "Files", - s = {"w", "Save Buffer"}, - f = { - "lua require'telescope.builtin'.find_files({ find_command = {'fd', '--hidden', '--type', 'file', '--follow'}})", - "Find File" - }, - l = {"Lf", "Open LF"}, - p = {"NvimTreeToggle", "Toogle Tree"}, - r = {"Telescope oldfiles", "Open Recent File"}, - T = {"NvimTreeFindFile", "Find in Tree"} + name = "File", + f = { "Telescope find_files", "Find File" }, + r = { "Telescope oldfiles", "Open Recent File" }, + n = { "enew", "New File" }, }, - s = { - name = "Search", - c = {"Telescope colorscheme", "Colorscheme"}, - h = {"Telescope help_tags", "Find Help"}, - M = {"Telescope man_pages", "Man Pages"}, - R = {"Telescope registers", "Registers"}, - t = {"Telescope live_grep", "Text"}, - s = {"Telescope grep_string", "Text under cursor"}, - k = {"Telescope keymaps", "Keymaps"}, - C = {"Telescope commands", "Commands"}, - p = {"Telescope projects", "Projects"}, - P = { - "lua require('telescope.builtin.internal').colorscheme({enable_preview = true})", - "Colorscheme with Preview" - } - }, - w = { - name = "Window", - q = {":q", "Close"}, - s = {":split", "Horizontal Split"}, - t = {"t", "Move to new tab"}, - ["="] = {"=", "Equally size"}, - v = {":vsplit", "Verstical Split"}, - w = {"x", "Swap"} - }, -}, {prefix = "", mode = "n", default_options}) + }, + s = { + name = "Search", + c = {"Telescope colorscheme", "Colorscheme" } + } + +}) diff --git a/nvim/.config/nvim/lua/keymaps.lua b/nvim/.config/nvim/lua/keymaps.lua deleted file mode 100644 index 981dd4d..0000000 --- a/nvim/.config/nvim/lua/keymaps.lua +++ /dev/null @@ -1,28 +0,0 @@ -local keymap = vim.api.nvim_set_keymap -default_options = {noremap = true, silent = true} -expr_options = {noremap = true, expr = true, silent = true} - --- map the leader key ---keymap('n', '', '', default_options) -vim.g.mapleader = "," - --- easier escape key mapping -keymap('i', 'jk', '', default_options) - -keymap('n', '', ':w', default_options) -keymap('i', '', ':wa', default_options) - --- buffer focus -local opts = { noremap = true } -keymap('n', '', 'j', default_options) -keymap('n', '', 'h', default_options) -keymap('n', '', 'k', default_options) -keymap('n', '', 'l', default_options) - --- refresh config ---keymap('n', 'so', ':so $MYVIMRC', default_opts) - ---keymap('n', '', ':NvimTreeToggle', default_opts) --- find files ---keymap('n', 'f', ':Telescope find_files', default_opts) - diff --git a/nvim/.config/nvim/lua/mappings.lua b/nvim/.config/nvim/lua/mappings.lua new file mode 100644 index 0000000..0095fb6 --- /dev/null +++ b/nvim/.config/nvim/lua/mappings.lua @@ -0,0 +1,33 @@ +local keymap = vim.api.nvim_set_keymap +default_options = {noremap = true, silent = true} +expr_options = {noremap = true, expr = true, silent = true} + +-- map the leader key +keymap('n', '', '', default_options) +vim.g.mapleader = " " + +-- easier escape key mapping +keymap('i', 'jk', '', default_options) + +keymap('n', '', ':w', default_options) +keymap('i', '', ':wa', default_options) + +-- paste over currently selected text without yanking it +keymap("v", "p", "\"_dP", default_options) + +-- buffer focus +local opts = { noremap = true } +keymap('n', '', 'j', default_options) +keymap('n', '', 'h', default_options) +keymap('n', '', 'k', default_options) +keymap('n', '', 'l', default_options) + +-- Resizing panes +keymap("n", "", ":vertical resize +1", default_options) +keymap("n", "", ":vertical resize -1", default_options) +keymap("n", "", ":resize -1", default_options) +keymap("n", "", ":resize +1", default_options) + +-- Move selected line / block of text in visual mode +keymap("x", "K", ":move '<-2gv-gv", default_options) +keymap("x", "J", ":move '>+1gv-gv", default_options) diff --git a/nvim/.config/nvim/lua/plugins.lua b/nvim/.config/nvim/lua/plugins.lua index 25d468d..553326c 100644 --- a/nvim/.config/nvim/lua/plugins.lua +++ b/nvim/.config/nvim/lua/plugins.lua @@ -54,8 +54,49 @@ use { use "nvim-treesitter/nvim-treesitter-textobjects" +use { + "hrsh7th/nvim-cmp", + requires = { + {"hrsh7th/cmp-nvim-lsp"}, {"hrsh7th/cmp-buffer"}, {"hrsh7th/cmp-path"}, + {"hrsh7th/cmp-cmdline"}, {"hrsh7th/cmp-vsnip"}, + {"f3fora/cmp-spell", {"hrsh7th/cmp-calc"}, {"hrsh7th/cmp-emoji"}} + }, + config = get_config("cmp") +} + +use {"onsails/lspkind-nvim", requires = {{"famiu/bufdelete.nvim"}}} + +-- LSP +use {"ray-x/lsp_signature.nvim", requires = {{"neovim/nvim-lspconfig"}}} + +use { + "neovim/nvim-lspconfig", + config = get_config("lsp") +} +use { + "williamboman/nvim-lsp-installer", + config = get_config("lsp-installer") +} + use {"folke/which-key.nvim", event = "VimEnter", config = get_config("which")} +-- requirement for Neogit +use { + "sindrets/diffview.nvim", + cmd = { + "DiffviewOpen", "DiffviewClose", "DiffviewToggleFiles", + "DiffviewFocusFiles" + }, + config = get_config("diffview") +} + +use { + "TimUntersberger/neogit", + requires = {"nvim-lua/plenary.nvim"}, + cmd = "Neogit", + config = get_config("neogit") +} + -- Theme use { 'EdenEast/nightfox.nvim', diff --git a/nvim/.config/nvim/lua/theme.lua b/nvim/.config/nvim/lua/theme.lua index a5b3226..941a7bd 100644 --- a/nvim/.config/nvim/lua/theme.lua +++ b/nvim/.config/nvim/lua/theme.lua @@ -1,24 +1,3 @@ -- Nightfox require('nightfox').load('nordfox') --- Tokyo Night --- Example config in Lua ---vim.g.tokyonight_style = "storm" ---vim.g.tokyonight_italic_functions = true ---vim.g.tokyonight_sidebars = { "qf", "vista_kind", "terminal", "packer" } - --- Change the "hint" color to the "orange" color, and make the "error" color bright red ---vim.g.tokyonight_colors = { hint = "orange", error = "#ff0000" } - --- Load the colorscheme ---vim.cmd[[colorscheme tokyonight]] - --- Nord --- Example config in lua ---vim.g.nord_contrast = true ---vim.g.nord_borders = false ---vim.g.nord_disable_background = false ---vim.g.nord_italic = false - --- Load the colorscheme ---require('nord').set() diff --git a/nvim/.config/nvim/plugin/packer_compiled.lua b/nvim/.config/nvim/plugin/packer_compiled.lua index 991d62a..8514924 100644 --- a/nvim/.config/nvim/plugin/packer_compiled.lua +++ b/nvim/.config/nvim/plugin/packer_compiled.lua @@ -69,24 +69,126 @@ end time([[try_loadstring definition]], false) time([[Defining packer_plugins]], true) _G.packer_plugins = { + ["bufdelete.nvim"] = { + loaded = true, + path = "/Users/michael/.local/share/nvim/site/pack/packer/start/bufdelete.nvim", + url = "https://github.com/famiu/bufdelete.nvim" + }, + ["cmp-buffer"] = { + loaded = true, + path = "/Users/michael/.local/share/nvim/site/pack/packer/start/cmp-buffer", + url = "https://github.com/hrsh7th/cmp-buffer" + }, + ["cmp-calc"] = { + loaded = true, + path = "/Users/michael/.local/share/nvim/site/pack/packer/start/cmp-calc", + url = "https://github.com/hrsh7th/cmp-calc" + }, + ["cmp-cmdline"] = { + loaded = true, + path = "/Users/michael/.local/share/nvim/site/pack/packer/start/cmp-cmdline", + url = "https://github.com/hrsh7th/cmp-cmdline" + }, + ["cmp-emoji"] = { + loaded = true, + path = "/Users/michael/.local/share/nvim/site/pack/packer/start/cmp-emoji", + url = "https://github.com/hrsh7th/cmp-emoji" + }, + ["cmp-nvim-lsp"] = { + loaded = true, + path = "/Users/michael/.local/share/nvim/site/pack/packer/start/cmp-nvim-lsp", + url = "https://github.com/hrsh7th/cmp-nvim-lsp" + }, + ["cmp-path"] = { + loaded = true, + path = "/Users/michael/.local/share/nvim/site/pack/packer/start/cmp-path", + url = "https://github.com/hrsh7th/cmp-path" + }, + ["cmp-spell"] = { + loaded = true, + path = "/Users/michael/.local/share/nvim/site/pack/packer/start/cmp-spell", + url = "https://github.com/f3fora/cmp-spell" + }, + ["cmp-vsnip"] = { + loaded = true, + path = "/Users/michael/.local/share/nvim/site/pack/packer/start/cmp-vsnip", + url = "https://github.com/hrsh7th/cmp-vsnip" + }, + ["diffview.nvim"] = { + commands = { "DiffviewOpen", "DiffviewClose", "DiffviewToggleFiles", "DiffviewFocusFiles" }, + config = { 'require("config/diffview")' }, + loaded = false, + needs_bufread = false, + only_cond = false, + path = "/Users/michael/.local/share/nvim/site/pack/packer/opt/diffview.nvim", + url = "https://github.com/sindrets/diffview.nvim" + }, + ["lsp_signature.nvim"] = { + loaded = true, + path = "/Users/michael/.local/share/nvim/site/pack/packer/start/lsp_signature.nvim", + url = "https://github.com/ray-x/lsp_signature.nvim" + }, + ["lspkind-nvim"] = { + loaded = true, + path = "/Users/michael/.local/share/nvim/site/pack/packer/start/lspkind-nvim", + url = "https://github.com/onsails/lspkind-nvim" + }, ["lualine.nvim"] = { config = { 'require("config/lualine")' }, loaded = true, path = "/Users/michael/.local/share/nvim/site/pack/packer/start/lualine.nvim", url = "https://github.com/nvim-lualine/lualine.nvim" }, + neogit = { + commands = { "Neogit" }, + config = { 'require("config/neogit")' }, + loaded = false, + needs_bufread = true, + only_cond = false, + path = "/Users/michael/.local/share/nvim/site/pack/packer/opt/neogit", + url = "https://github.com/TimUntersberger/neogit" + }, ["nightfox.nvim"] = { config = { 'require("config/nightfox")' }, loaded = true, path = "/Users/michael/.local/share/nvim/site/pack/packer/start/nightfox.nvim", url = "https://github.com/EdenEast/nightfox.nvim" }, + ["nvim-cmp"] = { + config = { 'require("config/cmp")' }, + loaded = true, + path = "/Users/michael/.local/share/nvim/site/pack/packer/start/nvim-cmp", + url = "https://github.com/hrsh7th/nvim-cmp" + }, + ["nvim-lsp-installer"] = { + config = { 'require("config/lsp-installer")' }, + loaded = true, + path = "/Users/michael/.local/share/nvim/site/pack/packer/start/nvim-lsp-installer", + url = "https://github.com/williamboman/nvim-lsp-installer" + }, + ["nvim-lspconfig"] = { + config = { 'require("config/lsp")' }, + loaded = true, + path = "/Users/michael/.local/share/nvim/site/pack/packer/start/nvim-lspconfig", + url = "https://github.com/neovim/nvim-lspconfig" + }, ["nvim-tree.lua"] = { config = { 'require("config/nvim-tree")' }, loaded = true, path = "/Users/michael/.local/share/nvim/site/pack/packer/start/nvim-tree.lua", url = "https://github.com/kyazdani42/nvim-tree.lua" }, + ["nvim-treesitter"] = { + config = { 'require("config/treesitter")' }, + loaded = true, + path = "/Users/michael/.local/share/nvim/site/pack/packer/start/nvim-treesitter", + url = "https://github.com/nvim-treesitter/nvim-treesitter" + }, + ["nvim-treesitter-textobjects"] = { + loaded = true, + path = "/Users/michael/.local/share/nvim/site/pack/packer/start/nvim-treesitter-textobjects", + url = "https://github.com/nvim-treesitter/nvim-treesitter-textobjects" + }, ["nvim-web-devicons"] = { loaded = true, path = "/Users/michael/.local/share/nvim/site/pack/packer/start/nvim-web-devicons", @@ -107,26 +209,67 @@ _G.packer_plugins = { loaded = true, path = "/Users/michael/.local/share/nvim/site/pack/packer/start/telescope.nvim", url = "https://github.com/nvim-telescope/telescope.nvim" + }, + ["which-key.nvim"] = { + config = { 'require("config/which")' }, + loaded = false, + needs_bufread = false, + only_cond = false, + path = "/Users/michael/.local/share/nvim/site/pack/packer/opt/which-key.nvim", + url = "https://github.com/folke/which-key.nvim" } } time([[Defining packer_plugins]], false) --- Config for: nvim-tree.lua -time([[Config for nvim-tree.lua]], true) -require("config/nvim-tree") -time([[Config for nvim-tree.lua]], false) +-- Config for: nvim-lsp-installer +time([[Config for nvim-lsp-installer]], true) +require("config/lsp-installer") +time([[Config for nvim-lsp-installer]], false) +-- Config for: nvim-cmp +time([[Config for nvim-cmp]], true) +require("config/cmp") +time([[Config for nvim-cmp]], false) -- Config for: nightfox.nvim time([[Config for nightfox.nvim]], true) require("config/nightfox") time([[Config for nightfox.nvim]], false) +-- Config for: nvim-lspconfig +time([[Config for nvim-lspconfig]], true) +require("config/lsp") +time([[Config for nvim-lspconfig]], false) -- Config for: telescope.nvim time([[Config for telescope.nvim]], true) require("config/telescope") time([[Config for telescope.nvim]], false) +-- Config for: nvim-treesitter +time([[Config for nvim-treesitter]], true) +require("config/treesitter") +time([[Config for nvim-treesitter]], false) +-- Config for: nvim-tree.lua +time([[Config for nvim-tree.lua]], true) +require("config/nvim-tree") +time([[Config for nvim-tree.lua]], false) -- Config for: lualine.nvim time([[Config for lualine.nvim]], true) require("config/lualine") time([[Config for lualine.nvim]], false) + +-- Command lazy-loads +time([[Defining lazy-load commands]], true) +pcall(vim.cmd, [[command -nargs=* -range -bang -complete=file Neogit lua require("packer.load")({'neogit'}, { cmd = "Neogit", l1 = , l2 = , bang = , args = , mods = "" }, _G.packer_plugins)]]) +pcall(vim.cmd, [[command -nargs=* -range -bang -complete=file DiffviewOpen lua require("packer.load")({'diffview.nvim'}, { cmd = "DiffviewOpen", l1 = , l2 = , bang = , args = , mods = "" }, _G.packer_plugins)]]) +pcall(vim.cmd, [[command -nargs=* -range -bang -complete=file DiffviewClose lua require("packer.load")({'diffview.nvim'}, { cmd = "DiffviewClose", l1 = , l2 = , bang = , args = , mods = "" }, _G.packer_plugins)]]) +pcall(vim.cmd, [[command -nargs=* -range -bang -complete=file DiffviewToggleFiles lua require("packer.load")({'diffview.nvim'}, { cmd = "DiffviewToggleFiles", l1 = , l2 = , bang = , args = , mods = "" }, _G.packer_plugins)]]) +pcall(vim.cmd, [[command -nargs=* -range -bang -complete=file DiffviewFocusFiles lua require("packer.load")({'diffview.nvim'}, { cmd = "DiffviewFocusFiles", l1 = , l2 = , bang = , args = , mods = "" }, _G.packer_plugins)]]) +time([[Defining lazy-load commands]], false) + +vim.cmd [[augroup packer_load_aucmds]] +vim.cmd [[au!]] + -- Event lazy-loads +time([[Defining lazy-load event autocommands]], true) +vim.cmd [[au VimEnter * ++once lua require("packer.load")({'which-key.nvim'}, { event = "VimEnter *" }, _G.packer_plugins)]] +time([[Defining lazy-load event autocommands]], false) +vim.cmd("augroup END") if should_profile then save_profiles() end end) diff --git a/zsh/.config/zsh/.zcompcache/brew_all_commands b/zsh/.config/zsh/.zcompcache/brew_all_commands new file mode 100644 index 0000000..55e9b31 --- /dev/null +++ b/zsh/.config/zsh/.zcompcache/brew_all_commands @@ -0,0 +1,4 @@ +list=( ${(Q)"${(z)$(<<\EO:list +'aspell-dictionaries' 'determine-rebottle-runners' 'postgresql-upgrade-database' 'services' +EO:list +)}"} ) diff --git a/zsh/.config/zsh/.zshrc b/zsh/.config/zsh/.zshrc index a0a8651..476d80b 100644 --- a/zsh/.config/zsh/.zshrc +++ b/zsh/.config/zsh/.zshrc @@ -19,3 +19,5 @@ zsh_add_file "zsh-aliases" zsh_add_file "zsh-zinit" export EDITOR="nvim" + +cat < "$ZDOTDIR/banner" diff --git a/zsh/.config/zsh/banner b/zsh/.config/zsh/banner new file mode 100644 index 0000000..f4a0da5 --- /dev/null +++ b/zsh/.config/zsh/banner @@ -0,0 +1,10 @@ + + + _ _ + _ __ ___ | |__ ___ _ _ ___ | |__ +| '_ ` _ \ _____ | '_ \ / _ \ | | | |/ __|| '_ \ +| | | | | ||_____|| | | || (_) || |_| |\__ \| | | | +|_| |_| |_| |_| |_| \___/ \__,_||___/|_| |_| + + + diff --git a/zsh/.config/zsh/zsh-aliases b/zsh/.config/zsh/zsh-aliases index 23eb37d..d01b462 100644 --- a/zsh/.config/zsh/zsh-aliases +++ b/zsh/.config/zsh/zsh-aliases @@ -1,9 +1,15 @@ # configure aliases -#alias zshconfig="vim ~/.zshrc" -#alias reloadzsh="source ~/.zshrc" +#alias zshconfig="$ZDOTDIR" + alias mkcd() { mkdir $1 && cd $1 } alias l() { ls -lah "$@" } # editor alias vim() { nvim "$@" } +# git +alias g() { git "$@" } +alias ga() { git add . } +alias gma() { git add . && git commit -m "$1" } +alias gs() { git status } + From 27d87fa506d39ad7d4139196366a08898bd27328 Mon Sep 17 00:00:00 2001 From: Michael Housh Date: Sun, 12 Dec 2021 13:41:11 -0500 Subject: [PATCH 2/2] Added a few more zsh aliases --- zsh/.config/zsh/zsh-aliases | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/zsh/.config/zsh/zsh-aliases b/zsh/.config/zsh/zsh-aliases index d01b462..d076172 100644 --- a/zsh/.config/zsh/zsh-aliases +++ b/zsh/.config/zsh/zsh-aliases @@ -1,5 +1,7 @@ # configure aliases #alias zshconfig="$ZDOTDIR" +alias zdots() { nvim "$ZDOTDIR" } +alias dots() { nvim ~/.dotfiles } alias mkcd() { mkdir $1 && cd $1 } alias l() { ls -lah "$@" } @@ -10,6 +12,8 @@ alias vim() { nvim "$@" } # git alias g() { git "$@" } alias ga() { git add . } +alias gcb() { git checkout -b "$@" } +alias gco() { git checkout "$@" } alias gma() { git add . && git commit -m "$1" } alias gs() { git status }