From 147a4d4edd1655d30e4e27384d5f5757c62f0dc3 Mon Sep 17 00:00:00 2001 From: Joao P Dubas Date: Tue, 13 Feb 2024 22:28:10 +0000 Subject: [PATCH 01/28] feat: upgrade os to ubuntu 23.10 Also, upgrade system dependencies: 1. `libodbc` 2. `libwxgtk` Finally, remove conflicting user. --- Dockerfile | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/Dockerfile b/Dockerfile index df0c1d6..a6f82eb 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,4 @@ -FROM ubuntu:22.04 +FROM ubuntu:23.10 # system deps ARG USER_UID=1000 @@ -39,7 +39,7 @@ RUN apt-get update \ libncurses-dev \ libncurses5-dev \ libncursesw5-dev \ - libodbc1 \ + libodbc2 \ libpcre2-dev \ libreadline-dev \ libsctp-dev \ @@ -47,8 +47,7 @@ RUN apt-get update \ libsqlite3-dev \ libssl-dev \ libtool \ - libwxgtk3.0-gtk3-0v5 \ - libwxgtk3.0-gtk3-dev \ + libwxgtk3.2-dev \ libxslt-dev \ libyaml-dev \ llvm \ @@ -74,6 +73,9 @@ RUN apt-get update \ zlib1g-dev \ && rm -rf /var/lib/apt/lists/* \ && locale-gen en_US.UTF-8 \ + && echo 'remove existing ubuntu user' \ + && groupdel --force ubuntu \ + && userdel --force ubuntu \ && echo 'setup unprivileged user' \ && groupadd --gid ${WHEEL_GID} wheel \ && groupadd --gid ${DOCKER_GID} docker \ -- 2.47.2 From 387a7dfef288dada220c6d53b4975903638d7b61 Mon Sep 17 00:00:00 2001 From: Joao P Dubas Date: Tue, 13 Feb 2024 22:30:06 +0000 Subject: [PATCH 02/28] feat(tmux): upgrade color setup --- config/tmux/tmux.conf | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/config/tmux/tmux.conf b/config/tmux/tmux.conf index f00ab3d..50989c3 100644 --- a/config/tmux/tmux.conf +++ b/config/tmux/tmux.conf @@ -55,7 +55,9 @@ unbind r bind r source-file ~/.config/tmux/tmux.conf\; display "Reloaded conf." # Full color for vim -set -g default-terminal "screen-256color" +# based on https://gist.github.com/andersevenrud/015e61af2fd264371032763d4ed965b6 +set -g default-terminal "tmux-256color" +set -sg terminal-overrides ",*:RGB" #### COLOUR (Solarized 256) -- 2.47.2 From ff6a67ab2f80191005d238be36f175acad0e7e52 Mon Sep 17 00:00:00 2001 From: Joao P Dubas Date: Tue, 13 Feb 2024 23:07:48 +0000 Subject: [PATCH 03/28] feat: improve git configuration Setup based on: * [tips and tricks in gitbutler][0] * [git mergetool with vim][1] [0]: https://blog.gitbutler.com/git-tips-and-tricks/ [1]: https://gist.github.com/karenyyng/f19ff75c60f18b4b8149 --- Dockerfile | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index a6f82eb..088f02e 100644 --- a/Dockerfile +++ b/Dockerfile @@ -194,7 +194,14 @@ ARG GIT_USER_EMAIL ARG GIT_USER_NAME RUN git config --global user.email "${GIT_USER_EMAIL}" \ && git config --global user.name "${GIT_USER_NAME}" \ - && git config --global core.editor nvim + && git config --global core.editor nvim \ + && git config --global diff.tool nvimdiff \ + && git config --global difftool.nvimdiff.layout "LOCAL,REMOTE" \ + && git config --global merge.tool nvimdiff \ + && git config --global mergetool.nvimdiff.layout "LOCAL,BASE,REMOTE / MERGED" \ + && git config --global includeIf."hasconfig:remote.*.url:gitea:*/**".path ${XDG_CONFIG_HOME}/git/personal_gitea \ + && git config --global includeIf."hasconfig:remote.*.url:github:joaodubas/**".path ${XDG_CONFIG_HOME}/git/personal_github \ + && git config --global includeIf."gitdir:/opt/work".path ${XDG_CONFIG_HOME}/git/work \ COPY ./scripts/docker-entrypoint.sh /usr/local/bin/docker-entrypoint COPY ./scripts/elixir-ls-setup.sh /usr/local/bin/elixir-ls-setup -- 2.47.2 From 97ba0852cd2e07d8c116c41fe2754bc39d60203f Mon Sep 17 00:00:00 2001 From: Joao P Dubas Date: Tue, 13 Feb 2024 23:19:34 +0000 Subject: [PATCH 04/28] chore: add script to validate tmux color --- scripts/24-bit-color.sh | 99 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 99 insertions(+) create mode 100755 scripts/24-bit-color.sh diff --git a/scripts/24-bit-color.sh b/scripts/24-bit-color.sh new file mode 100755 index 0000000..01236b4 --- /dev/null +++ b/scripts/24-bit-color.sh @@ -0,0 +1,99 @@ +#!/usr/bin/env bash +# +# This file echoes a bunch of 24-bit color codes +# to the terminal to demonstrate its functionality. +# The foreground escape sequence is ^[38;2;;;m +# The background escape sequence is ^[48;2;;;m +# range from 0 to 255 inclusive. +# The escape sequence ^[0m returns output to default + +setBackgroundColor() +{ + echo -en "\x1b[48;2;$1;$2;$3""m" +} + +resetOutput() +{ + echo -en "\x1b[0m\n" +} + +# Gives a color $1/255 % along HSV +# Who knows what happens when $1 is outside 0-255 +# Echoes "$red $green $blue" where +# $red $green and $blue are integers +# ranging between 0 and 255 inclusive +rainbowColor() +{ + let h=$1/43 + let f=$1-43*$h + let t=$f*255/43 + let q=255-t + + if [ $h -eq 0 ] + then + echo "255 $t 0" + elif [ $h -eq 1 ] + then + echo "$q 255 0" + elif [ $h -eq 2 ] + then + echo "0 255 $t" + elif [ $h -eq 3 ] + then + echo "0 $q 255" + elif [ $h -eq 4 ] + then + echo "$t 0 255" + elif [ $h -eq 5 ] + then + echo "255 0 $q" + else + # execution should never reach here + echo "0 0 0" + fi +} + +for i in `seq 0 127`; do + setBackgroundColor $i 0 0 + echo -en " " +done +resetOutput +for i in `seq 255 128`; do + setBackgroundColor $i 0 0 + echo -en " " +done +resetOutput + +for i in `seq 0 127`; do + setBackgroundColor 0 $i 0 + echo -n " " +done +resetOutput +for i in `seq 255 128`; do + setBackgroundColor 0 $i 0 + echo -n " " +done +resetOutput + +for i in `seq 0 127`; do + setBackgroundColor 0 0 $i + echo -n " " +done +resetOutput +for i in `seq 255 128`; do + setBackgroundColor 0 0 $i + echo -n " " +done +resetOutput + +for i in `seq 0 127`; do + setBackgroundColor `rainbowColor $i` + echo -n " " +done +resetOutput +for i in `seq 255 128`; do + setBackgroundColor `rainbowColor $i` + echo -n " " +done +resetOutput + -- 2.47.2 From e85dc95f51ab363093e80433261b4b57c03677c8 Mon Sep 17 00:00:00 2001 From: Joao P Dubas Date: Tue, 13 Feb 2024 23:22:02 +0000 Subject: [PATCH 05/28] fix: work git configuration --- Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index 088f02e..9da99d0 100644 --- a/Dockerfile +++ b/Dockerfile @@ -201,7 +201,7 @@ RUN git config --global user.email "${GIT_USER_EMAIL}" \ && git config --global mergetool.nvimdiff.layout "LOCAL,BASE,REMOTE / MERGED" \ && git config --global includeIf."hasconfig:remote.*.url:gitea:*/**".path ${XDG_CONFIG_HOME}/git/personal_gitea \ && git config --global includeIf."hasconfig:remote.*.url:github:joaodubas/**".path ${XDG_CONFIG_HOME}/git/personal_github \ - && git config --global includeIf."gitdir:/opt/work".path ${XDG_CONFIG_HOME}/git/work \ + && git config --global includeIf."gitdir:/opt/work/".path ${XDG_CONFIG_HOME}/git/work \ COPY ./scripts/docker-entrypoint.sh /usr/local/bin/docker-entrypoint COPY ./scripts/elixir-ls-setup.sh /usr/local/bin/elixir-ls-setup -- 2.47.2 From d3ecf776f779842ef0fc7cfb8ea6d23f2f7ca086 Mon Sep 17 00:00:00 2001 From: Joao P Dubas Date: Wed, 14 Feb 2024 11:50:19 -0300 Subject: [PATCH 06/28] chore: mount custom git config dir --- .gitignore | 1 + config/git/.exists | 0 docker-compose.yml | 3 ++- 3 files changed, 3 insertions(+), 1 deletion(-) create mode 100644 config/git/.exists diff --git a/.gitignore b/.gitignore index 3829375..3a85410 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,2 @@ config/tmux/plugins +config/git diff --git a/config/git/.exists b/config/git/.exists new file mode 100644 index 0000000..e69de29 diff --git a/docker-compose.yml b/docker-compose.yml index 11eda74..5d60144 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -9,8 +9,9 @@ services: entrypoint: sleep command: infinity volumes: - - './config/nvim/lua/custom:/home/coder/.config/nvim/lua/custom' + - './config/git:/home/coder/.config/git' - './config/mise:/home/coder/.config/mise' + - './config/nvim/lua/custom:/home/coder/.config/nvim/lua/custom' - './config/starship:/home/coder/.config/starship' - './config/tmux:/home/coder/.config/tmux' - './config/tmuxp:/home/coder/.config/tmuxp' -- 2.47.2 From 30ed6b41bab07f1d5ee9d87e133affd04d31a159 Mon Sep 17 00:00:00 2001 From: Joao P Dubas Date: Wed, 14 Feb 2024 15:47:11 +0000 Subject: [PATCH 07/28] fix: remove trailing backslash --- Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index 9da99d0..37d1df9 100644 --- a/Dockerfile +++ b/Dockerfile @@ -201,7 +201,7 @@ RUN git config --global user.email "${GIT_USER_EMAIL}" \ && git config --global mergetool.nvimdiff.layout "LOCAL,BASE,REMOTE / MERGED" \ && git config --global includeIf."hasconfig:remote.*.url:gitea:*/**".path ${XDG_CONFIG_HOME}/git/personal_gitea \ && git config --global includeIf."hasconfig:remote.*.url:github:joaodubas/**".path ${XDG_CONFIG_HOME}/git/personal_github \ - && git config --global includeIf."gitdir:/opt/work/".path ${XDG_CONFIG_HOME}/git/work \ + && git config --global includeIf."gitdir:/opt/work/".path ${XDG_CONFIG_HOME}/git/work COPY ./scripts/docker-entrypoint.sh /usr/local/bin/docker-entrypoint COPY ./scripts/elixir-ls-setup.sh /usr/local/bin/elixir-ls-setup -- 2.47.2 From 85533f3460d55a4f19955124daf6ea46e475904e Mon Sep 17 00:00:00 2001 From: Joao P Dubas Date: Sun, 25 Feb 2024 21:08:59 +0000 Subject: [PATCH 08/28] feat: add atuin to handle shell history --- Dockerfile | 1 + config/atuin/config.toml | 5 +++++ docker-compose.yml | 1 + 3 files changed, 7 insertions(+) create mode 100644 config/atuin/config.toml diff --git a/Dockerfile b/Dockerfile index 37d1df9..c61585d 100644 --- a/Dockerfile +++ b/Dockerfile @@ -97,6 +97,7 @@ ENV DO_URL https://download.docker.com/linux/static/stable/x86_64/docker-${DO_VE ENV DC_VERSION v2.23.3 ENV DC_URL https://github.com/docker/compose/releases/download/${DC_VERSION}/docker-compose-linux-x86_64 RUN curl -sS https://starship.rs/install.sh | sh -s -- --yes \ + && curl -sS https://setup.atuin.sh | bash \ && mkdir /tmp/download \ && curl -L ${DO_URL} | tar -zx -C /tmp/download \ && chgrp --recursive docker /tmp/download \ diff --git a/config/atuin/config.toml b/config/atuin/config.toml new file mode 100644 index 0000000..2ede0a7 --- /dev/null +++ b/config/atuin/config.toml @@ -0,0 +1,5 @@ +auto_sync = true +update_check = false +sync_address = "https://atuin.dubas.dev" +sync_frequency = "15m" +inline_height = 10 diff --git a/docker-compose.yml b/docker-compose.yml index 5d60144..2888639 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -9,6 +9,7 @@ services: entrypoint: sleep command: infinity volumes: + - './config/atuin:/home/coder/.config/atuin' - './config/git:/home/coder/.config/git' - './config/mise:/home/coder/.config/mise' - './config/nvim/lua/custom:/home/coder/.config/nvim/lua/custom' -- 2.47.2 From 31a0a931f2b8531a03e2859ecc2deab7d5c039fb Mon Sep 17 00:00:00 2001 From: Joao P Dubas Date: Mon, 26 Feb 2024 19:17:20 +0000 Subject: [PATCH 09/28] fix: eza alias after update --- Dockerfile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Dockerfile b/Dockerfile index c61585d..5d9b52b 100644 --- a/Dockerfile +++ b/Dockerfile @@ -152,8 +152,8 @@ RUN fish -c true \ && echo '{$LOCAL_BIN_HOME}/mise activate fish | source' >> ${XDG_CONFIG_HOME}/fish/config.fish \ && echo 'zoxide init fish | source' >> ${XDG_CONFIG_HOME}/fish/config.fish \ && echo 'alias cat="bat"' >> ${XDG_CONFIG_HOME}/fish/config.fish \ - && echo 'alias l="eza --time-style long-iso --color=auto -F"' >> ${XDG_CONFIG_HOME}/fish/config.fish \ - && echo 'alias ll="l -Fahl"' >> ${XDG_CONFIG_HOME}/fish/config.fish \ + && echo 'alias l="eza --time-style=long-iso --color=auto --classify=always"' >> ${XDG_CONFIG_HOME}/fish/config.fish \ + && echo 'alias ll="l -ahl"' >> ${XDG_CONFIG_HOME}/fish/config.fish \ && echo 'alias la="l -a"' >> ${XDG_CONFIG_HOME}/fish/config.fish # git configuration -- 2.47.2 From 4a79391f454d1d75a925155d5d5a45199fded62f Mon Sep 17 00:00:00 2001 From: Joao P Dubas Date: Mon, 26 Feb 2024 21:32:38 +0000 Subject: [PATCH 10/28] feat: upgrade mise runtime/cli * awscli from 2.15.6 to 2.15.23 * dagger from 0.9.5 to 0.9.11 * elixir from 1.16.0 to 1.16.1 * erlang from 26.2.1 to 26.2.2 * eza from 0.17.0 to 0.18.4 * fzf from 0.45.0 to 0.46.1 * go from 1.21.5 to 1.22.0 * helm from 3.13.3 to 3.14.2 * kubectl from 1.29.0 to 1.29.2 * lefthook from 1.5.5 to 1.6.2 * node from 21.5.0 to 21.6.2 * poetry from 1.7.1 to 1.8.1 * python from 3.12.1 to 3.12.12 * terraform from 1.6.6 to 1.7.4 * tilt from 0.33.10 to 0.33.11 * usql from 0.17.2 to 0.17.5 * zoxide from 0.9.2 to 0.9.4 Also added: * k9s * rust --- config/mise/config.toml | 36 +++++++++++++++++++----------------- 1 file changed, 19 insertions(+), 17 deletions(-) diff --git a/config/mise/config.toml b/config/mise/config.toml index abe906b..cfecc7f 100644 --- a/config/mise/config.toml +++ b/config/mise/config.toml @@ -1,28 +1,30 @@ [tools] -awscli = "2.15.6" +awscli = "2.15.23" bat = "0.24.0" -dagger = "0.9.5" -elixir = "1.16.0-otp-26" -erlang = "26.2.1" -eza = "0.17.0" -fzf = "0.45.0" -go = "1.21.5" -helm = "3.13.3" +dagger = "0.9.11" +elixir = "1.16.1-otp-26" +erlang = "26.2.2" +eza = "0.18.4" +fzf = "0.46.1" +go = "1.22.0" +helm = "3.14.2" k3d = "5.6.0" -kubectl = "1.29.0" +k9s = "0.31.9" +kubectl = "1.29.2" kubie = "0.23.0" -lefthook = "1.5.5" -node = "21.5.0" -poetry = "1.7.1" -python = "3.12.1" +lefthook = "1.6.2" +node = "21.6.2" +poetry = "1.8.1" +python = "3.12.2" ripgrep = "14.1.0" +rust = "1.76.0" starship = "1.17.1" -terraform = "1.6.6" -tilt = "0.33.10" +terraform = "1.7.4" +tilt = "0.33.11" tmux = "3.3" -usql = "0.17.2" +usql = "0.17.5" yarn = "1.22.19" -zoxide = "0.9.2" +zoxide = "0.9.4" [settings] experimental = true -- 2.47.2 From 40e3a17be8ecd42a392b61db9dd0e00608144358 Mon Sep 17 00:00:00 2001 From: Joao P Dubas Date: Sun, 3 Mar 2024 19:20:54 +0000 Subject: [PATCH 11/28] feat(mise): add k3sup tool Allow to easily provision kubernetes clusters --- config/mise/config.toml | 1 + 1 file changed, 1 insertion(+) diff --git a/config/mise/config.toml b/config/mise/config.toml index cfecc7f..16a87f0 100644 --- a/config/mise/config.toml +++ b/config/mise/config.toml @@ -9,6 +9,7 @@ fzf = "0.46.1" go = "1.22.0" helm = "3.14.2" k3d = "5.6.0" +k3sup = "0.13.5" k9s = "0.31.9" kubectl = "1.29.2" kubie = "0.23.0" -- 2.47.2 From 8652ec708d2b580d0f4bc521cc97283a97fd0b75 Mon Sep 17 00:00:00 2001 From: Joao P Dubas Date: Sun, 3 Mar 2024 19:21:25 +0000 Subject: [PATCH 12/28] chore(mise): always compile python This is needed to install poetry corretly. --- config/mise/config.toml | 1 + 1 file changed, 1 insertion(+) diff --git a/config/mise/config.toml b/config/mise/config.toml index 16a87f0..da83026 100644 --- a/config/mise/config.toml +++ b/config/mise/config.toml @@ -29,3 +29,4 @@ zoxide = "0.9.4" [settings] experimental = true +python_compile = true -- 2.47.2 From 6d1dd47d1f86477534a78c9dcec8438516911467 Mon Sep 17 00:00:00 2001 From: Joao P Dubas Date: Sun, 3 Mar 2024 22:47:36 +0000 Subject: [PATCH 13/28] feat: upgrade kickstart to latest commit --- Dockerfile | 2 +- config/nvim/lua/custom/plugins/init.lua | 113 ++++---- patch/kickstart.nvim/updates.patch | 343 +++++++++++++----------- 3 files changed, 249 insertions(+), 209 deletions(-) diff --git a/Dockerfile b/Dockerfile index 5d9b52b..b997eea 100644 --- a/Dockerfile +++ b/Dockerfile @@ -161,7 +161,7 @@ COPY ./patch/kickstart.nvim/updates.patch /tmp COPY ./config/nvim/lua/custom/plugins/init.lua /tmp RUN git clone https://github.com/nvim-lua/kickstart.nvim.git "${XDG_CONFIG_HOME}"/nvim \ && cd ${XDG_CONFIG_HOME}/nvim \ - && git reset --hard 7af594fd319fbae6b2aaa06337f3df8acbbb7f18 \ + && git reset --hard e6710a461ab08513af80c213929ff64e75b5e456 \ && git apply /tmp/updates.patch \ && cp /tmp/init.lua ${XDG_CONFIG_HOME}/nvim/lua/custom/plugins \ && nvim --headless "+Lazy! sync" +qa diff --git a/config/nvim/lua/custom/plugins/init.lua b/config/nvim/lua/custom/plugins/init.lua index ef22920..1279603 100644 --- a/config/nvim/lua/custom/plugins/init.lua +++ b/config/nvim/lua/custom/plugins/init.lua @@ -7,47 +7,50 @@ return { 'mgoral/vim-bw', url = 'https://git.goral.net.pl/mgoral/vim-bw.git', priority = 1000, - config = function () + config = function() vim.cmd.colorscheme 'bw-onedark' - end + end, }, + -- Git related plugins + 'tpope/vim-fugitive', + 'tpope/vim-rhubarb', { 'joaodubas/gitlinker.nvim', - config = function () - local actions = require('gitlinker.actions') - local hosts = require('gitlinker.hosts') - require('gitlinker').setup({ + config = function() + local actions = require 'gitlinker.actions' + local hosts = require 'gitlinker.hosts' + require('gitlinker').setup { opts = { - remote = "origin", + remote = 'origin', add_current_line_on_normal_mode = true, action_callback = actions.copy_to_clipboard, print_url = true, }, callbacks = { - ["github.com"] = hosts.get_github_type_url, - ["bitbucket.org"] = hosts.get_bitbucket_type_url, - ["gitea.dubas.dev"] = hosts.get_gitea_type_url, + ['github.com'] = hosts.get_github_type_url, + ['bitbucket.org'] = hosts.get_bitbucket_type_url, + ['gitea.dubas.dev'] = hosts.get_gitea_type_url, }, - mappings = "gy" - }) - end + mappings = 'gy', + } + end, }, 'nvim-treesitter/nvim-treesitter-context', { 'kevinhwang91/nvim-ufo', dependencies = { 'kevinhwang91/promise-async' }, event = 'BufRead', - keys = function () - local ufo = require('ufo') + keys = function() + local ufo = require 'ufo' return { - { 'zR', ufo.openAllFolds, { desc = "Open all folds" } }, - { 'zM', ufo.closeAllFolds, { desc = "Close all folds" } }, - { 'zr', ufo.openFoldsExceptKinds, { desc = "Open fold" } }, - { 'zm', ufo.closeFoldsWith, { desc = "Close fold" } }, + { 'zR', ufo.openAllFolds, { desc = 'Open all folds' } }, + { 'zM', ufo.closeAllFolds, { desc = 'Close all folds' } }, + { 'zr', ufo.openFoldsExceptKinds, { desc = 'Open fold' } }, + { 'zm', ufo.closeFoldsWith, { desc = 'Close fold' } }, } end, - opts = function () - local handler = function (virtText, lnum, endLnum, width, truncate) + opts = function() + local handler = function(virtText, lnum, endLnum, width, truncate) local newVirtText = {} local suffix = (' 󰁂 %d '):format(endLnum - lnum) local sufWidth = vim.fn.strdisplaywidth(suffix) @@ -61,11 +64,11 @@ return { else chunkText = truncate(chunkText, targetWidth - curWidth) local hlGroup = chunk[2] - table.insert(newVirtText, {chunkText, hlGroup}) + table.insert(newVirtText, { chunkText, hlGroup }) chunkWidth = vim.fn.strdisplaywidth(chunkText) -- str width returned from truncate() may less than 2nd argument, need padding if curWidth + chunkWidth < targetWidth then - suffix = suffix .. (' '):rep(targetWidth - curWidth - chunkWidth) + suffix = suffix .. (' '):rep(targetWidth - curWidth - chunkWidth) end break end @@ -77,17 +80,17 @@ return { return { fold_virt_text_handler = handler, - provider_selector = function (_, _, _) + provider_selector = function(_, _, _) return { 'treesitter', 'indent' } - end + end, } end, }, { 'stevearc/oil.nvim', - dependencies = { "nvim-tree/nvim-web-devicons" }, + dependencies = { 'nvim-tree/nvim-web-devicons' }, keys = { - { '-', 'Oil', desc = "Open parent directory" }, + { '-', 'Oil', desc = 'Open parent directory' }, }, opts = {}, }, @@ -96,7 +99,7 @@ return { dependencies = { 'nvim-lua/plenary.nvim' }, ft = { 'http', - 'rest' + 'rest', }, opts = { result_split_horizontal = false, @@ -105,7 +108,7 @@ return { encode_url = true, highlight = { enabled = true, - timeout = 15 + timeout = 15, }, result = { show_url = true, @@ -114,27 +117,27 @@ return { show_headers = true, formatters = { json = 'jq', - html = false + html = false, }, jump_to_request = true, env_file = '.env', - custom_dynamic_variables = { }, - yank_dry_run = true - } + custom_dynamic_variables = {}, + yank_dry_run = true, + }, }, - keys = function () + keys = function() local status_ok, which_key = pcall(require, 'which-key') if status_ok then - which_key.register({ - ['t'] = { name = 'Res[t]', _ = 'which_key_ignore' } - }) + which_key.register { + ['t'] = { name = 'Res[t]', _ = 'which_key_ignore' }, + } end return { { 'tr', 'RestNvim', desc = 'Run the request under cursor' }, { 'tp', 'RestNvimPreview', desc = 'Preview the curl command for the request under cursor' }, - { 'tl', 'RestNvimLast', desc = 'Re-run the last request' } + { 'tl', 'RestNvimLast', desc = 'Re-run the last request' }, } - end + end, }, { 'akinsho/toggleterm.nvim', @@ -142,22 +145,22 @@ return { size = vim.o.lines * 0.75, open_mapping = [[]], hide_numbers = true, - shade_filetypes = { }, + shade_filetypes = {}, shade_terminals = true, shading_factor = 2, direction = 'horizontal', shell = vim.o.shell, }, - keys = function () + keys = function() local status_ok, which_key = pcall(require, 'which-key') if status_ok then - which_key.register({ - ['m'] = { name = 'Toggle ter[m]inal', _ = 'which_key_ignore' } - }) + which_key.register { + ['m'] = { name = 'Toggle ter[m]inal', _ = 'which_key_ignore' }, + } end vim.api.nvim_create_autocmd('TermOpen', { group = vim.api.nvim_create_augroup('kickstart-custom-term-open-mapping', { clear = true }), - callback = function (args) + callback = function(args) local bufnr = args.buf local opts = { buffer = bufnr } vim.keymap.set('t', '', [[]], opts) @@ -167,13 +170,23 @@ return { vim.keymap.set('t', '', [[wincmd k]], opts) vim.keymap.set('t', '', [[wincmd l]], opts) vim.keymap.set('t', '', [[]], opts) - end + end, }) return { - { 'mh', 'ToggleTerm direction=horizontal size=' .. tostring(vim.o.lines * 0.75) .. '', desc = 'Open ter[m]inal [h]orizontally', noremap = true }, - { 'mv', 'ToggleTerm direction=vertical size=' .. tostring(vim.o.columns * 0.5) .. '', desc = 'Open ter[m]inal [v]ertically', noremap = true }, - { 'mc', 'ToggleTermSendCurrentLine', desc = 'Send [c]urrent line under the cursor', noremap = true } + { + 'mh', + 'ToggleTerm direction=horizontal size=' .. tostring(vim.o.lines * 0.75) .. '', + desc = 'Open ter[m]inal [h]orizontally', + noremap = true, + }, + { + 'mv', + 'ToggleTerm direction=vertical size=' .. tostring(vim.o.columns * 0.5) .. '', + desc = 'Open ter[m]inal [v]ertically', + noremap = true, + }, + { 'mc', 'ToggleTermSendCurrentLine', desc = 'Send [c]urrent line under the cursor', noremap = true }, } - end + end, }, } diff --git a/patch/kickstart.nvim/updates.patch b/patch/kickstart.nvim/updates.patch index fafed8c..312c2aa 100644 --- a/patch/kickstart.nvim/updates.patch +++ b/patch/kickstart.nvim/updates.patch @@ -1,175 +1,202 @@ diff --git a/init.lua b/init.lua -index fd4567d..236fb97 100644 +index 292ec07..19075db 100644 --- a/init.lua +++ b/init.lua -@@ -200,19 +200,19 @@ require('lazy').setup({ - }, - }, +@@ -101,8 +101,12 @@ vim.opt.number = true + -- Experiment for yourself to see if you like it! + -- vim.opt.relativenumber = true -- { -- -- Theme inspired by Atom -- 'navarasu/onedark.nvim', -- priority = 1000, -- lazy = false, -- config = function() -- require('onedark').setup { -- -- Set a style preset. 'dark' is default. -- style = 'dark', -- dark, darker, cool, deep, warm, warmer, light -- } -- require('onedark').load() -- end, -- }, -+ -- { -+ -- -- Theme inspired by Atom -+ -- 'navarasu/onedark.nvim', -+ -- priority = 1000, -+ -- lazy = false, -+ -- config = function() -+ -- require('onedark').setup { -+ -- -- Set a style preset. 'dark' is default. -+ -- style = 'dark', -- dark, darker, cool, deep, warm, warmer, light -+ -- } -+ -- require('onedark').load() -+ -- end, -+ -- }, - - { - -- Set lualine as statusline -@@ -282,7 +282,7 @@ require('lazy').setup({ - -- Uncomment the following line and add your plugins to `lua/custom/plugins/*.lua` to get going. - -- - -- For additional information see: https://github.com/folke/lazy.nvim#-structuring-your-plugins -- -- { import = 'custom.plugins' }, -+ { import = 'custom.plugins' }, - }, {}) - - -- [[ Setting options ]] -@@ -292,11 +292,12 @@ require('lazy').setup({ - -- Set highlight on search - vim.o.hlsearch = false - ---- Make line numbers default +-- Make relative line numbers default - vim.wo.number = true ++vim.wo.number = true +vim.wo.relativenumber = true ++ + -- Enable mouse mode, can be useful for resizing splits for example! +-vim.opt.mouse = 'a' ++vim.opt.mouse = '' ---- Enable mouse mode --vim.o.mouse = 'a' -+-- Disable mouse mode -+vim.o.mouse = '' - - -- Sync clipboard between OS and Neovim. - -- Remove this option if you want your OS clipboard to remain independent. -@@ -326,6 +327,14 @@ vim.o.completeopt = 'menuone,noselect' - -- NOTE: You should make sure your terminal supports this - vim.o.termguicolors = true + -- Don't show the mode, since it's already in status line + vim.opt.showmode = false +@@ -148,6 +152,14 @@ vim.opt.cursorline = true + -- Minimal number of screen lines to keep above and below the cursor. + vim.opt.scrolloff = 10 +-- Set foldmethod +-- See `:help foldmethod` -+vim.o.foldcolumn = '1' -+vim.o.foldlevel = 99 -+vim.o.foldlevelstart = 99 -+vim.o.foldenable = true -+vim.o.fillchars = [[eob: ,fold: ,foldopen:,foldsep: ,foldclose:]] ++vim.opt.foldcolumn = '1' ++vim.opt.foldlevel = 99 ++vim.opt.foldlevelstart = 99 ++vim.opt.foldenable = true ++vim.opt.fillchars = [[eob: ,fold: ,foldopen:,foldsep: ,foldclose:]] + -- [[ Basic Keymaps ]] + -- See `:help vim.keymap.set()` - -- Keymaps for better default experience -@@ -439,8 +448,31 @@ vim.keymap.set('n', 'sr', require('telescope.builtin').resume, { desc = - vim.defer_fn(function() - require('nvim-treesitter.configs').setup { - -- Add languages to be installed here that you want installed for treesitter -- ensure_installed = { 'c', 'cpp', 'go', 'lua', 'python', 'rust', 'tsx', 'javascript', 'typescript', 'vimdoc', 'vim', 'bash' }, -- -+ ensure_installed = { -+ 'css', -+ 'dockerfile', -+ 'eex', -+ 'elixir', -+ 'erlang', -+ 'gitcommit', -+ 'go', -+ 'heex', -+ 'html', -+ 'http', -+ 'javascript', -+ 'json', -+ 'lua', -+ 'markdown', -+ 'markdown_inline', -+ 'python', -+ 'sql', -+ 'toml', -+ 'tsx', -+ 'typescript', -+ 'vim', -+ 'vimdoc', -+ 'yaml' -+ }, - -- Autoinstall languages that are not installed. Defaults to false (but you can change for yourself!) - auto_install = false, - -- Install languages synchronously (only applied to `ensure_installed`) -@@ -586,13 +618,18 @@ require('mason-lspconfig').setup() - -- If you want to override the default filetypes that your language server will attach to you can - -- define the property 'filetypes' to the map in question. - local servers = { -- -- clangd = {}, -- -- gopls = {}, -- -- pyright = {}, -- -- rust_analyzer = {}, -- -- tsserver = {}, -- -- html = { filetypes = { 'html', 'twig', 'hbs'} }, -- -+ elixirls = { -+ elixirLS = { -+ dialyzerEnabled = true, -+ dialyzerFormat = "dialyxir_long", -+ fetchDeps = false, -+ mixEnv = "test" -+ } -+ }, -+ gopls = {}, -+ helm_ls = {}, -+ html = { filetypes = { 'html', 'twig', 'hbs'} }, -+ htmx = {}, - lua_ls = { - Lua = { - workspace = { checkThirdParty = false }, -@@ -601,6 +638,10 @@ local servers = { - -- diagnostics = { disable = { 'missing-fields' } }, +@@ -250,6 +262,66 @@ require('lazy').setup { + changedelete = { text = '~' }, + }, }, - }, -+ pyright = {}, -+ templ = {}, -+ terraformls = {}, -+ tsserver = {}, - } - - -- Setup neovim lua configuration -@@ -619,12 +660,25 @@ mason_lspconfig.setup { - - mason_lspconfig.setup_handlers { - function(server_name) -- require('lspconfig')[server_name].setup { -+ local opts = { - capabilities = capabilities, - on_attach = on_attach, - settings = servers[server_name], - filetypes = (servers[server_name] or {}).filetypes, - } -+ if server_name == 'elixirls' then -+ local version = vim.fn.system('mise current elixir') or '' -+ local elixir_servers = { -+ { version = '^1.11', path = '/elixir-ls/release/v0.12.0/language_server.sh' }, -+ { version = '^1.12', path = '/elixir-ls/release/v0.14.6/language_server.sh' }, -+ } -+ for _, server in ipairs(elixir_servers) do -+ if string.match(version, server.version) == nil then goto continue end -+ opts = vim.tbl_extend('keep', opts, { cmd = { vim.fn.expand('$LOCAL_SRC_HOME') .. server.path } }) -+ ::continue:: ++ on_attach = function(bufnr) ++ local gs = package.loaded.gitsigns ++ ++ local function map(mode, l, r, opts) ++ opts = opts or {} ++ opts.buffer = bufnr ++ vim.keymap.set(mode, l, r, opts) + end -+ end -+ require('lspconfig')[server_name].setup(opts) - end, ++ ++ -- Navigation ++ map({ 'n', 'v' }, ']c', function() ++ if vim.wo.diff then ++ return ']c' ++ end ++ vim.schedule(function() ++ gs.next_hunk() ++ end) ++ return '' ++ end, { expr = true, desc = 'Jump to next hunk' }) ++ ++ map({ 'n', 'v' }, '[c', function() ++ if vim.wo.diff then ++ return '[c' ++ end ++ vim.schedule(function() ++ gs.prev_hunk() ++ end) ++ return '' ++ end, { expr = true, desc = 'Jump to previous hunk' }) ++ ++ -- Actions ++ -- visual mode ++ map('v', 'hs', function() ++ gs.stage_hunk { vim.fn.line '.', vim.fn.line 'v' } ++ end, { desc = 'stage git hunk' }) ++ map('v', 'hr', function() ++ gs.reset_hunk { vim.fn.line '.', vim.fn.line 'v' } ++ end, { desc = 'reset git hunk' }) ++ -- normal mode ++ map('n', 'hs', gs.stage_hunk, { desc = 'git stage hunk' }) ++ map('n', 'hr', gs.reset_hunk, { desc = 'git reset hunk' }) ++ map('n', 'hS', gs.stage_buffer, { desc = 'git Stage buffer' }) ++ map('n', 'hu', gs.undo_stage_hunk, { desc = 'undo stage hunk' }) ++ map('n', 'hR', gs.reset_buffer, { desc = 'git Reset buffer' }) ++ map('n', 'hp', gs.preview_hunk, { desc = 'preview git hunk' }) ++ map('n', 'hb', function() ++ gs.blame_line { full = false } ++ end, { desc = 'git blame line' }) ++ map('n', 'hd', gs.diffthis, { desc = 'git diff against index' }) ++ map('n', 'hD', function() ++ gs.diffthis '~' ++ end, { desc = 'git diff against last commit' }) ++ ++ -- Toggles ++ map('n', 'tb', gs.toggle_current_line_blame, { desc = 'toggle git blame line' }) ++ map('n', 'td', gs.toggle_deleted, { desc = 'toggle git show deleted' }) ++ ++ -- Text object ++ map({ 'o', 'x' }, 'ih', ':Gitsigns select_hunk', { desc = 'select git hunk' }) ++ end, + }, + + -- NOTE: Plugins can also be configured to run lua code when they are loaded. +@@ -544,6 +616,18 @@ require('lazy').setup { + -- tsserver = {}, + -- + ++ elixirls = { ++ elixirLS = { ++ dialyzerEnabled = true, ++ dialyzerFormat = 'dialyxir_long', ++ fetchDeps = false, ++ mixEnv = 'test', ++ }, ++ }, ++ gopls = {}, ++ helm_ls = {}, ++ html = { filetypes = { 'html', 'twig', 'hbs' } }, ++ htmx = {}, + lua_ls = { + -- cmd = {...}, + -- filetypes { ...}, +@@ -570,6 +654,10 @@ require('lazy').setup { + }, + }, + }, ++ pyright = {}, ++ templ = {}, ++ terraformls = {}, ++ tsserver = {}, + } + + -- Ensure the servers and tools above are installed +@@ -596,6 +684,21 @@ require('lazy').setup { + -- by the server configuration above. Useful when disabling + -- certain features of an LSP (for example, turning off formatting for tsserver) + server.capabilities = vim.tbl_deep_extend('force', {}, capabilities, server.capabilities or {}) ++ -- overwrite elixirls for older versions of elixir ++ -- * elixir 1.11 use version 0.12.0 ++ -- * elixir 1.12 use verions 0.14.6 ++ if server_name == 'elixirls' then ++ local version = vim.fn.system('mise current elixir') or '' ++ local elixir_servers = { ++ { version = '^1.11', path = '/elixir-ls/release/v0.12.0/language_server.sh' }, ++ { version = '^1.12', path = '/elixir-ls/release/v0.14.6/language_server.sh' }, ++ } ++ for _, ex_server in ipairs(elixir_servers) do ++ if string.match(version, ex_server.version) == nil then goto continue end ++ server = vim.tbl_extend('keep', server, { cmd = { vim.fn.expand('$LOCAL_SRC_HOME') .. ex_server.path } }) ++ ::continue:: ++ end ++ end + require('lspconfig')[server_name].setup(server) + end, + }, +@@ -781,7 +884,31 @@ require('lazy').setup { + + ---@diagnostic disable-next-line: missing-fields + require('nvim-treesitter.configs').setup { +- ensure_installed = { 'bash', 'c', 'html', 'lua', 'markdown', 'vim', 'vimdoc' }, ++ ensure_installed = { ++ 'css', ++ 'dockerfile', ++ 'eex', ++ 'elixir', ++ 'erlang', ++ 'gitcommit', ++ 'go', ++ 'heex', ++ 'html', ++ 'http', ++ 'javascript', ++ 'json', ++ 'lua', ++ 'markdown', ++ 'markdown_inline', ++ 'python', ++ 'sql', ++ 'toml', ++ 'tsx', ++ 'typescript', ++ 'vim', ++ 'vimdoc', ++ 'yaml', ++ }, + -- Autoinstall languages that are not installed + auto_install = true, + highlight = { enable = true }, +@@ -807,14 +934,14 @@ require('lazy').setup { + -- Uncomment any of the lines below to enable them (you will need to restart nvim). + -- + -- require 'kickstart.plugins.debug', +- -- require 'kickstart.plugins.indent_line', ++ require 'kickstart.plugins.indent_line', + + -- NOTE: The import below can automatically add your own plugins, configuration, etc from `lua/custom/plugins/*.lua` + -- This is the easiest way to modularize your config. + -- + -- Uncomment the following line and add your plugins to `lua/custom/plugins/*.lua` to get going. + -- For additional information, see `:help lazy.nvim-lazy.nvim-structuring-your-plugins` +- -- { import = 'custom.plugins' }, ++ { import = 'custom.plugins' }, } + -- The line beneath this is called `modeline`. See `:help modeline` -- 2.47.2 From c8258d2087c0b8851e2e19da454e8f3b5f72d738 Mon Sep 17 00:00:00 2001 From: Joao P Dubas Date: Sun, 3 Mar 2024 22:59:31 +0000 Subject: [PATCH 14/28] chore(nvim): configure default lua style This is the same configuration applied in kickstart repo. --- .stylua.toml | 6 ++++++ 1 file changed, 6 insertions(+) create mode 100644 .stylua.toml diff --git a/.stylua.toml b/.stylua.toml new file mode 100644 index 0000000..139e939 --- /dev/null +++ b/.stylua.toml @@ -0,0 +1,6 @@ +column_width = 160 +line_endings = "Unix" +indent_type = "Spaces" +indent_width = 2 +quote_style = "AutoPreferSingle" +call_parentheses = "None" -- 2.47.2 From ed04d14a9a358e127ec6b7bbedd2b0cfe41a05cd Mon Sep 17 00:00:00 2001 From: Joao P Dubas Date: Sun, 3 Mar 2024 23:00:49 +0000 Subject: [PATCH 15/28] chore(nvim): format custom init.lua file --- config/nvim/lua/custom/plugins/init.lua | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/config/nvim/lua/custom/plugins/init.lua b/config/nvim/lua/custom/plugins/init.lua index 1279603..e09c6a5 100644 --- a/config/nvim/lua/custom/plugins/init.lua +++ b/config/nvim/lua/custom/plugins/init.lua @@ -134,7 +134,11 @@ return { end return { { 'tr', 'RestNvim', desc = 'Run the request under cursor' }, - { 'tp', 'RestNvimPreview', desc = 'Preview the curl command for the request under cursor' }, + { + 'tp', + 'RestNvimPreview', + desc = 'Preview the curl command for the request under cursor', + }, { 'tl', 'RestNvimLast', desc = 'Re-run the last request' }, } end, @@ -185,7 +189,12 @@ return { desc = 'Open ter[m]inal [v]ertically', noremap = true, }, - { 'mc', 'ToggleTermSendCurrentLine', desc = 'Send [c]urrent line under the cursor', noremap = true }, + { + 'mc', + 'ToggleTermSendCurrentLine', + desc = 'Send [c]urrent line under the cursor', + noremap = true, + }, } end, }, -- 2.47.2 From f9e86a4dac5a0d4428b94cf29f0be1ef2e56fa22 Mon Sep 17 00:00:00 2001 From: Joao P Dubas Date: Sun, 3 Mar 2024 23:25:15 +0000 Subject: [PATCH 16/28] fix(nvim): set gitsigns mappings in opts table --- patch/kickstart.nvim/updates.patch | 126 ++++++++++++++--------------- 1 file changed, 63 insertions(+), 63 deletions(-) diff --git a/patch/kickstart.nvim/updates.patch b/patch/kickstart.nvim/updates.patch index 312c2aa..1f5dfc0 100644 --- a/patch/kickstart.nvim/updates.patch +++ b/patch/kickstart.nvim/updates.patch @@ -1,5 +1,5 @@ diff --git a/init.lua b/init.lua -index 292ec07..19075db 100644 +index 292ec07..284e1dc 100644 --- a/init.lua +++ b/init.lua @@ -101,8 +101,12 @@ vim.opt.number = true @@ -31,73 +31,73 @@ index 292ec07..19075db 100644 -- [[ Basic Keymaps ]] -- See `:help vim.keymap.set()` -@@ -250,6 +262,66 @@ require('lazy').setup { +@@ -249,6 +261,66 @@ require('lazy').setup { + topdelete = { text = '‾' }, changedelete = { text = '~' }, }, ++ on_attach = function(bufnr) ++ local gs = package.loaded.gitsigns ++ ++ local function map(mode, l, r, opts) ++ opts = opts or {} ++ opts.buffer = bufnr ++ vim.keymap.set(mode, l, r, opts) ++ end ++ ++ -- Navigation ++ map({ 'n', 'v' }, ']c', function() ++ if vim.wo.diff then ++ return ']c' ++ end ++ vim.schedule(function() ++ gs.next_hunk() ++ end) ++ return '' ++ end, { expr = true, desc = 'Jump to next hunk' }) ++ ++ map({ 'n', 'v' }, '[c', function() ++ if vim.wo.diff then ++ return '[c' ++ end ++ vim.schedule(function() ++ gs.prev_hunk() ++ end) ++ return '' ++ end, { expr = true, desc = 'Jump to previous hunk' }) ++ ++ -- Actions ++ -- visual mode ++ map('v', 'hs', function() ++ gs.stage_hunk { vim.fn.line '.', vim.fn.line 'v' } ++ end, { desc = 'stage git hunk' }) ++ map('v', 'hr', function() ++ gs.reset_hunk { vim.fn.line '.', vim.fn.line 'v' } ++ end, { desc = 'reset git hunk' }) ++ -- normal mode ++ map('n', 'hs', gs.stage_hunk, { desc = 'git stage hunk' }) ++ map('n', 'hr', gs.reset_hunk, { desc = 'git reset hunk' }) ++ map('n', 'hS', gs.stage_buffer, { desc = 'git Stage buffer' }) ++ map('n', 'hu', gs.undo_stage_hunk, { desc = 'undo stage hunk' }) ++ map('n', 'hR', gs.reset_buffer, { desc = 'git Reset buffer' }) ++ map('n', 'hp', gs.preview_hunk, { desc = 'preview git hunk' }) ++ map('n', 'hb', function() ++ gs.blame_line { full = false } ++ end, { desc = 'git blame line' }) ++ map('n', 'hd', gs.diffthis, { desc = 'git diff against index' }) ++ map('n', 'hD', function() ++ gs.diffthis '~' ++ end, { desc = 'git diff against last commit' }) ++ ++ -- Toggles ++ map('n', 'tb', gs.toggle_current_line_blame, { desc = 'toggle git blame line' }) ++ map('n', 'td', gs.toggle_deleted, { desc = 'toggle git show deleted' }) ++ ++ -- Text object ++ map({ 'o', 'x' }, 'ih', ':Gitsigns select_hunk', { desc = 'select git hunk' }) ++ end, }, -+ on_attach = function(bufnr) -+ local gs = package.loaded.gitsigns -+ -+ local function map(mode, l, r, opts) -+ opts = opts or {} -+ opts.buffer = bufnr -+ vim.keymap.set(mode, l, r, opts) -+ end -+ -+ -- Navigation -+ map({ 'n', 'v' }, ']c', function() -+ if vim.wo.diff then -+ return ']c' -+ end -+ vim.schedule(function() -+ gs.next_hunk() -+ end) -+ return '' -+ end, { expr = true, desc = 'Jump to next hunk' }) -+ -+ map({ 'n', 'v' }, '[c', function() -+ if vim.wo.diff then -+ return '[c' -+ end -+ vim.schedule(function() -+ gs.prev_hunk() -+ end) -+ return '' -+ end, { expr = true, desc = 'Jump to previous hunk' }) -+ -+ -- Actions -+ -- visual mode -+ map('v', 'hs', function() -+ gs.stage_hunk { vim.fn.line '.', vim.fn.line 'v' } -+ end, { desc = 'stage git hunk' }) -+ map('v', 'hr', function() -+ gs.reset_hunk { vim.fn.line '.', vim.fn.line 'v' } -+ end, { desc = 'reset git hunk' }) -+ -- normal mode -+ map('n', 'hs', gs.stage_hunk, { desc = 'git stage hunk' }) -+ map('n', 'hr', gs.reset_hunk, { desc = 'git reset hunk' }) -+ map('n', 'hS', gs.stage_buffer, { desc = 'git Stage buffer' }) -+ map('n', 'hu', gs.undo_stage_hunk, { desc = 'undo stage hunk' }) -+ map('n', 'hR', gs.reset_buffer, { desc = 'git Reset buffer' }) -+ map('n', 'hp', gs.preview_hunk, { desc = 'preview git hunk' }) -+ map('n', 'hb', function() -+ gs.blame_line { full = false } -+ end, { desc = 'git blame line' }) -+ map('n', 'hd', gs.diffthis, { desc = 'git diff against index' }) -+ map('n', 'hD', function() -+ gs.diffthis '~' -+ end, { desc = 'git diff against last commit' }) -+ -+ -- Toggles -+ map('n', 'tb', gs.toggle_current_line_blame, { desc = 'toggle git blame line' }) -+ map('n', 'td', gs.toggle_deleted, { desc = 'toggle git show deleted' }) -+ -+ -- Text object -+ map({ 'o', 'x' }, 'ih', ':Gitsigns select_hunk', { desc = 'select git hunk' }) -+ end, }, - -- NOTE: Plugins can also be configured to run lua code when they are loaded. @@ -544,6 +616,18 @@ require('lazy').setup { -- tsserver = {}, -- -- 2.47.2 From 59489d6a952454a228735474276f61ae9eb56242 Mon Sep 17 00:00:00 2001 From: Joao P Dubas Date: Tue, 5 Mar 2024 17:03:47 +0000 Subject: [PATCH 17/28] fix: conflict between docker and systemd-journal groups --- Dockerfile | 3 +++ 1 file changed, 3 insertions(+) diff --git a/Dockerfile b/Dockerfile index b997eea..023e665 100644 --- a/Dockerfile +++ b/Dockerfile @@ -76,6 +76,9 @@ RUN apt-get update \ && echo 'remove existing ubuntu user' \ && groupdel --force ubuntu \ && userdel --force ubuntu \ + && echo 'update gid from systemd-journal group' \ + && groupmod -g 994 systemd-journal \ + && chgrp --recursive systemd-journal /var/log/journal \ && echo 'setup unprivileged user' \ && groupadd --gid ${WHEEL_GID} wheel \ && groupadd --gid ${DOCKER_GID} docker \ -- 2.47.2 From 8d490ff00de3c064360015619f16dcc0501f1abc Mon Sep 17 00:00:00 2001 From: Joao P Dubas Date: Tue, 5 Mar 2024 21:40:33 +0000 Subject: [PATCH 18/28] chore: init atuin for fish --- Dockerfile | 1 + 1 file changed, 1 insertion(+) diff --git a/Dockerfile b/Dockerfile index 023e665..e44b281 100644 --- a/Dockerfile +++ b/Dockerfile @@ -154,6 +154,7 @@ RUN fish -c true \ && echo 'starship init fish | source' >> ${XDG_CONFIG_HOME}/fish/config.fish \ && echo '{$LOCAL_BIN_HOME}/mise activate fish | source' >> ${XDG_CONFIG_HOME}/fish/config.fish \ && echo 'zoxide init fish | source' >> ${XDG_CONFIG_HOME}/fish/config.fish \ + && echo 'atuin init fish | source' >> ${XDG_CONFIG_HOME}/fish/config.fish \ && echo 'alias cat="bat"' >> ${XDG_CONFIG_HOME}/fish/config.fish \ && echo 'alias l="eza --time-style=long-iso --color=auto --classify=always"' >> ${XDG_CONFIG_HOME}/fish/config.fish \ && echo 'alias ll="l -ahl"' >> ${XDG_CONFIG_HOME}/fish/config.fish \ -- 2.47.2 From c6f9b2179cd67ffdba344534a11aa1c9083af8a8 Mon Sep 17 00:00:00 2001 From: Joao P Dubas Date: Tue, 5 Mar 2024 21:42:09 +0000 Subject: [PATCH 19/28] chore: remove monochromatic theme --- config/nvim/lua/custom/plugins/init.lua | 8 -------- 1 file changed, 8 deletions(-) diff --git a/config/nvim/lua/custom/plugins/init.lua b/config/nvim/lua/custom/plugins/init.lua index e09c6a5..3a59ff6 100644 --- a/config/nvim/lua/custom/plugins/init.lua +++ b/config/nvim/lua/custom/plugins/init.lua @@ -3,14 +3,6 @@ -- -- See the kickstart.nvim README for more information return { - { - 'mgoral/vim-bw', - url = 'https://git.goral.net.pl/mgoral/vim-bw.git', - priority = 1000, - config = function() - vim.cmd.colorscheme 'bw-onedark' - end, - }, -- Git related plugins 'tpope/vim-fugitive', 'tpope/vim-rhubarb', -- 2.47.2 From 8b0a5fa900000121aa9d85c5b0c0300fbf949913 Mon Sep 17 00:00:00 2001 From: Joao P Dubas Date: Mon, 11 Mar 2024 12:00:26 +0000 Subject: [PATCH 20/28] chore: add missing plugins for mise --- Dockerfile | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Dockerfile b/Dockerfile index e44b281..c600ba4 100644 --- a/Dockerfile +++ b/Dockerfile @@ -181,6 +181,8 @@ RUN ${LOCAL_BIN_HOME}/mise plugins install --force --yes \ fzf \ helm \ k3d \ + k3sup \ + k9s \ kubectl \ kubie \ lefthook \ -- 2.47.2 From d593550ec0e63b8cbd12697567754e83dbe0136f Mon Sep 17 00:00:00 2001 From: Joao P Dubas Date: Sun, 17 Mar 2024 19:23:59 +0000 Subject: [PATCH 21/28] chore: upgrade mise tools to latest versions * awscli from 2.15.23 to 2.15.30 * dagger from 0.10.2 to 0.9.11 * elixir from 1.16.1-otp-26 to 1.16.2-otp-26 * erlang from 26.2.2 to 26.2.3 * eza from 0.18.4 to 0.18.7 * fzf from 0.46.1 to 0.48.1 * go from 1.22.0 to 1.22.1 * helm from 3.14.2 to 3.14.3 * k9s from 0.31.9 to 0.32.3 * kubectl from 1.29.2 to 1.29.3 * lefthook from 1.6.2 to 1.6.7 * node from 21.6.2 to 21.7.1 * poetry from 1.8.1 to 1.8.2 * terraform from 1.7.4 to 1.7.5 * tmux from 3.3 to 3.4 --- config/mise/config.toml | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/config/mise/config.toml b/config/mise/config.toml index da83026..44442f0 100644 --- a/config/mise/config.toml +++ b/config/mise/config.toml @@ -1,28 +1,28 @@ [tools] -awscli = "2.15.23" +awscli = "2.15.30" bat = "0.24.0" -dagger = "0.9.11" -elixir = "1.16.1-otp-26" -erlang = "26.2.2" -eza = "0.18.4" -fzf = "0.46.1" -go = "1.22.0" -helm = "3.14.2" +dagger = "0.10.2" +elixir = "1.16.2-otp-26" +erlang = "26.2.3" +eza = "0.18.7" +fzf = "0.48.1" +go = "1.22.1" +helm = "3.14.3" k3d = "5.6.0" k3sup = "0.13.5" -k9s = "0.31.9" -kubectl = "1.29.2" +k9s = "0.32.3" +kubectl = "1.29.3" kubie = "0.23.0" -lefthook = "1.6.2" -node = "21.6.2" -poetry = "1.8.1" +lefthook = "1.6.7" +node = "21.7.1" +poetry = "1.8.2" python = "3.12.2" ripgrep = "14.1.0" rust = "1.76.0" starship = "1.17.1" -terraform = "1.7.4" +terraform = "1.7.5" tilt = "0.33.11" -tmux = "3.3" +tmux = "3.4" usql = "0.17.5" yarn = "1.22.19" zoxide = "0.9.4" -- 2.47.2 From abc17bfcc14753355b1737df890979b13d77e30a Mon Sep 17 00:00:00 2001 From: Joao P Dubas Date: Sun, 17 Mar 2024 19:28:20 +0000 Subject: [PATCH 22/28] chore: add buildx docker plugin --- Dockerfile | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Dockerfile b/Dockerfile index c600ba4..6411122 100644 --- a/Dockerfile +++ b/Dockerfile @@ -99,6 +99,8 @@ ENV DO_VERSION 24.0.7 ENV DO_URL https://download.docker.com/linux/static/stable/x86_64/docker-${DO_VERSION}.tgz ENV DC_VERSION v2.23.3 ENV DC_URL https://github.com/docker/compose/releases/download/${DC_VERSION}/docker-compose-linux-x86_64 +ENV BX_VERSION v0.13.1 +ENV BX_URL https://github.com/docker/buildx/releases/download/${BX_VERSION}/buildx-${BX_VERSION}.linux-amd64 RUN curl -sS https://starship.rs/install.sh | sh -s -- --yes \ && curl -sS https://setup.atuin.sh | bash \ && mkdir /tmp/download \ @@ -109,6 +111,8 @@ RUN curl -sS https://starship.rs/install.sh | sh -s -- --yes \ && mkdir -p /usr/local/lib/docker/cli-plugins \ && curl -L ${DC_URL} -o /usr/local/lib/docker/cli-plugins/docker-compose \ && chmod 750 /usr/local/lib/docker/cli-plugins/docker-compose \ + && curl -L ${BX_URL} -o /usr/local/lib/docker/cli-plugins/docker-buildx \ + && chmod 750 /usr/local/lib/docker/cli-plugins/docker-buildx \ && chgrp --recursive docker /usr/local/lib/docker USER coder -- 2.47.2 From 33abae2b6e1e658cb97cd7c532775fff770ede12 Mon Sep 17 00:00:00 2001 From: Joao P Dubas Date: Sun, 17 Mar 2024 20:30:34 +0000 Subject: [PATCH 23/28] feat: upgrade kickstart.nvim --- Dockerfile | 2 +- patch/kickstart.nvim/updates.patch | 119 ++++++++++++++++------------- 2 files changed, 69 insertions(+), 52 deletions(-) diff --git a/Dockerfile b/Dockerfile index 6411122..bdd8d76 100644 --- a/Dockerfile +++ b/Dockerfile @@ -169,7 +169,7 @@ COPY ./patch/kickstart.nvim/updates.patch /tmp COPY ./config/nvim/lua/custom/plugins/init.lua /tmp RUN git clone https://github.com/nvim-lua/kickstart.nvim.git "${XDG_CONFIG_HOME}"/nvim \ && cd ${XDG_CONFIG_HOME}/nvim \ - && git reset --hard e6710a461ab08513af80c213929ff64e75b5e456 \ + && git reset --hard ea4335f5af2fabbf063f8bf946f05583f215f904 \ && git apply /tmp/updates.patch \ && cp /tmp/init.lua ${XDG_CONFIG_HOME}/nvim/lua/custom/plugins \ && nvim --headless "+Lazy! sync" +qa diff --git a/patch/kickstart.nvim/updates.patch b/patch/kickstart.nvim/updates.patch index 1f5dfc0..c4bff39 100644 --- a/patch/kickstart.nvim/updates.patch +++ b/patch/kickstart.nvim/updates.patch @@ -1,22 +1,31 @@ diff --git a/init.lua b/init.lua -index 292ec07..284e1dc 100644 +index 506bbaf..b8d0561 100644 --- a/init.lua +++ b/init.lua -@@ -101,8 +101,12 @@ vim.opt.number = true - -- Experiment for yourself to see if you like it! - -- vim.opt.relativenumber = true +@@ -91,7 +91,7 @@ vim.g.mapleader = ' ' + vim.g.maplocalleader = ' ' -+-- Make relative line numbers default -+vim.wo.number = true -+vim.wo.relativenumber = true -+ - -- Enable mouse mode, can be useful for resizing splits for example! + -- Set to true if you have a Nerd Font installed +-vim.g.have_nerd_font = false ++vim.g.have_nerd_font = true + + -- [[ Setting options ]] + -- See `:help vim.opt` +@@ -102,10 +102,10 @@ vim.g.have_nerd_font = false + vim.opt.number = true + -- You can also add relative line numbers, for help with jumping. + -- Experiment for yourself to see if you like it! +--- vim.opt.relativenumber = true ++vim.opt.relativenumber = true + +--- Enable mouse mode, can be useful for resizing splits for example! -vim.opt.mouse = 'a' ++-- Disable mouse mode +vim.opt.mouse = '' -- Don't show the mode, since it's already in status line vim.opt.showmode = false -@@ -148,6 +152,14 @@ vim.opt.cursorline = true +@@ -154,6 +154,14 @@ vim.opt.cursorline = true -- Minimal number of screen lines to keep above and below the cursor. vim.opt.scrolloff = 10 @@ -31,7 +40,7 @@ index 292ec07..284e1dc 100644 -- [[ Basic Keymaps ]] -- See `:help vim.keymap.set()` -@@ -249,6 +261,66 @@ require('lazy').setup { +@@ -255,6 +263,66 @@ require('lazy').setup({ topdelete = { text = '‾' }, changedelete = { text = '~' }, }, @@ -98,7 +107,15 @@ index 292ec07..284e1dc 100644 }, }, -@@ -544,6 +616,18 @@ require('lazy').setup { +@@ -283,6 +351,7 @@ require('lazy').setup({ + require('which-key').register { + ['c'] = { name = '[C]ode', _ = 'which_key_ignore' }, + ['d'] = { name = '[D]ocument', _ = 'which_key_ignore' }, ++ ['h'] = { name = 'Git [h]unk', _ = 'which_key_ignore' }, + ['r'] = { name = '[R]ename', _ = 'which_key_ignore' }, + ['s'] = { name = '[S]earch', _ = 'which_key_ignore' }, + ['w'] = { name = '[W]orkspace', _ = 'which_key_ignore' }, +@@ -552,6 +621,18 @@ require('lazy').setup({ -- tsserver = {}, -- @@ -117,7 +134,7 @@ index 292ec07..284e1dc 100644 lua_ls = { -- cmd = {...}, -- filetypes { ...}, -@@ -570,6 +654,10 @@ require('lazy').setup { +@@ -566,6 +647,10 @@ require('lazy').setup({ }, }, }, @@ -128,7 +145,7 @@ index 292ec07..284e1dc 100644 } -- Ensure the servers and tools above are installed -@@ -596,6 +684,21 @@ require('lazy').setup { +@@ -592,6 +677,21 @@ require('lazy').setup({ -- by the server configuration above. Useful when disabling -- certain features of an LSP (for example, turning off formatting for tsserver) server.capabilities = vim.tbl_deep_extend('force', {}, capabilities, server.capabilities or {}) @@ -150,40 +167,40 @@ index 292ec07..284e1dc 100644 require('lspconfig')[server_name].setup(server) end, }, -@@ -781,7 +884,31 @@ require('lazy').setup { - - ---@diagnostic disable-next-line: missing-fields - require('nvim-treesitter.configs').setup { -- ensure_installed = { 'bash', 'c', 'html', 'lua', 'markdown', 'vim', 'vimdoc' }, -+ ensure_installed = { -+ 'css', -+ 'dockerfile', -+ 'eex', -+ 'elixir', -+ 'erlang', -+ 'gitcommit', -+ 'go', -+ 'heex', -+ 'html', -+ 'http', -+ 'javascript', -+ 'json', -+ 'lua', -+ 'markdown', -+ 'markdown_inline', -+ 'python', -+ 'sql', -+ 'toml', -+ 'tsx', -+ 'typescript', -+ 'vim', -+ 'vimdoc', -+ 'yaml', -+ }, - -- Autoinstall languages that are not installed - auto_install = true, - highlight = { enable = true }, -@@ -807,14 +934,14 @@ require('lazy').setup { +@@ -793,7 +893,31 @@ require('lazy').setup({ + 'nvim-treesitter/nvim-treesitter', + build = ':TSUpdate', + opts = { +- ensure_installed = { 'bash', 'c', 'html', 'lua', 'markdown', 'vim', 'vimdoc' }, ++ ensure_installed = { ++ 'css', ++ 'dockerfile', ++ 'eex', ++ 'elixir', ++ 'erlang', ++ 'gitcommit', ++ 'go', ++ 'heex', ++ 'html', ++ 'http', ++ 'javascript', ++ 'json', ++ 'lua', ++ 'markdown', ++ 'markdown_inline', ++ 'python', ++ 'sql', ++ 'toml', ++ 'tsx', ++ 'typescript', ++ 'vim', ++ 'vimdoc', ++ 'yaml', ++ }, + -- Autoinstall languages that are not installed + auto_install = true, + highlight = { +@@ -830,14 +954,14 @@ require('lazy').setup({ -- Uncomment any of the lines below to enable them (you will need to restart nvim). -- -- require 'kickstart.plugins.debug', @@ -197,6 +214,6 @@ index 292ec07..284e1dc 100644 -- For additional information, see `:help lazy.nvim-lazy.nvim-structuring-your-plugins` - -- { import = 'custom.plugins' }, + { import = 'custom.plugins' }, - } - - -- The line beneath this is called `modeline`. See `:help modeline` + }, { + ui = { + -- If you have a Nerd Font, set icons to an empty table which will use the -- 2.47.2 From 5269902be0eef671e1f8fd0ba0ff630fadc4b2f8 Mon Sep 17 00:00:00 2001 From: Joao P Dubas Date: Sun, 17 Mar 2024 21:38:04 +0000 Subject: [PATCH 24/28] chore: add custom python path to pyright lsp --- patch/kickstart.nvim/updates.patch | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/patch/kickstart.nvim/updates.patch b/patch/kickstart.nvim/updates.patch index c4bff39..30ef0ce 100644 --- a/patch/kickstart.nvim/updates.patch +++ b/patch/kickstart.nvim/updates.patch @@ -1,5 +1,5 @@ diff --git a/init.lua b/init.lua -index 506bbaf..b8d0561 100644 +index 506bbaf..d546b62 100644 --- a/init.lua +++ b/init.lua @@ -91,7 +91,7 @@ vim.g.mapleader = ' ' @@ -145,7 +145,7 @@ index 506bbaf..b8d0561 100644 } -- Ensure the servers and tools above are installed -@@ -592,6 +677,21 @@ require('lazy').setup({ +@@ -592,6 +677,33 @@ require('lazy').setup({ -- by the server configuration above. Useful when disabling -- certain features of an LSP (for example, turning off formatting for tsserver) server.capabilities = vim.tbl_deep_extend('force', {}, capabilities, server.capabilities or {}) @@ -163,11 +163,23 @@ index 506bbaf..b8d0561 100644 + server = vim.tbl_extend('keep', server, { cmd = { vim.fn.expand('$LOCAL_SRC_HOME') .. ex_server.path } }) + ::continue:: + end ++ elseif server_name == 'pyright' then ++ local python_paths = { ++ { name = 'poetry', cmd = { 'poetry', 'env', 'info', '--executable' }}, ++ { name = 'system', cmd = { 'which', 'python' }}, ++ } ++ for _, py_server in ipairs(python_paths) do ++ local cmd = vim.system(py_server.cmd, { text = true }):wait() ++ if (cmd.code > 0) then goto continue end ++ local python_path = string.gsub(cmd.stdout, '\n', '') ++ server = vim.tbl_extend('keep', server, { settings = { python = { pythonPath = python_path } } }) ++ ::continue:: ++ end + end require('lspconfig')[server_name].setup(server) end, }, -@@ -793,7 +893,31 @@ require('lazy').setup({ +@@ -793,7 +905,31 @@ require('lazy').setup({ 'nvim-treesitter/nvim-treesitter', build = ':TSUpdate', opts = { @@ -200,7 +212,7 @@ index 506bbaf..b8d0561 100644 -- Autoinstall languages that are not installed auto_install = true, highlight = { -@@ -830,14 +954,14 @@ require('lazy').setup({ +@@ -830,14 +966,14 @@ require('lazy').setup({ -- Uncomment any of the lines below to enable them (you will need to restart nvim). -- -- require 'kickstart.plugins.debug', -- 2.47.2 From 74cc47517c372901b38904c7597db7fa49180ee5 Mon Sep 17 00:00:00 2001 From: Joao P Dubas Date: Tue, 19 Mar 2024 12:08:24 +0000 Subject: [PATCH 25/28] chore(nvim): move custom gitsigns config With this, we reduce the volume of changes made in the base kickstart.nvim. --- config/nvim/lua/custom/plugins/init.lua | 65 ++++++++++++++++++++ patch/kickstart.nvim/updates.patch | 81 +++---------------------- 2 files changed, 72 insertions(+), 74 deletions(-) diff --git a/config/nvim/lua/custom/plugins/init.lua b/config/nvim/lua/custom/plugins/init.lua index 3a59ff6..f209539 100644 --- a/config/nvim/lua/custom/plugins/init.lua +++ b/config/nvim/lua/custom/plugins/init.lua @@ -6,6 +6,71 @@ return { -- Git related plugins 'tpope/vim-fugitive', 'tpope/vim-rhubarb', + { + 'lewis6991/gitsigns.nvim', + opts = { + on_attach = function(bufnr) + local gs = package.loaded.gitsigns + + local function map(mode, l, r, opts) + opts = opts or {} + opts.buffer = bufnr + vim.keymap.set(mode, l, r, opts) + end + + -- Navigation + map({ 'n', 'v' }, ']c', function() + if vim.wo.diff then + return ']c' + end + vim.schedule(function() + gs.next_hunk() + end) + return '' + end, { expr = true, desc = 'Jump to next hunk' }) + + map({ 'n', 'v' }, '[c', function() + if vim.wo.diff then + return '[c' + end + vim.schedule(function() + gs.prev_hunk() + end) + return '' + end, { expr = true, desc = 'Jump to previous hunk' }) + + -- Actions + -- visual mode + map('v', 'hs', function() + gs.stage_hunk { vim.fn.line '.', vim.fn.line 'v' } + end, { desc = 'stage git hunk' }) + map('v', 'hr', function() + gs.reset_hunk { vim.fn.line '.', vim.fn.line 'v' } + end, { desc = 'reset git hunk' }) + -- normal mode + map('n', 'hs', gs.stage_hunk, { desc = 'git stage hunk' }) + map('n', 'hr', gs.reset_hunk, { desc = 'git reset hunk' }) + map('n', 'hS', gs.stage_buffer, { desc = 'git Stage buffer' }) + map('n', 'hu', gs.undo_stage_hunk, { desc = 'undo stage hunk' }) + map('n', 'hR', gs.reset_buffer, { desc = 'git Reset buffer' }) + map('n', 'hp', gs.preview_hunk, { desc = 'preview git hunk' }) + map('n', 'hb', function() + gs.blame_line { full = false } + end, { desc = 'git blame line' }) + map('n', 'hd', gs.diffthis, { desc = 'git diff against index' }) + map('n', 'hD', function() + gs.diffthis '~' + end, { desc = 'git diff against last commit' }) + + -- Toggles + map('n', 'tb', gs.toggle_current_line_blame, { desc = 'toggle git blame line' }) + map('n', 'td', gs.toggle_deleted, { desc = 'toggle git show deleted' }) + + -- Text object + map({ 'o', 'x' }, 'ih', ':Gitsigns select_hunk', { desc = 'select git hunk' }) + end, + }, + }, { 'joaodubas/gitlinker.nvim', config = function() diff --git a/patch/kickstart.nvim/updates.patch b/patch/kickstart.nvim/updates.patch index 30ef0ce..59e9e07 100644 --- a/patch/kickstart.nvim/updates.patch +++ b/patch/kickstart.nvim/updates.patch @@ -1,5 +1,5 @@ diff --git a/init.lua b/init.lua -index 506bbaf..d546b62 100644 +index 506bbaf..33db6a3 100644 --- a/init.lua +++ b/init.lua @@ -91,7 +91,7 @@ vim.g.mapleader = ' ' @@ -40,74 +40,7 @@ index 506bbaf..d546b62 100644 -- [[ Basic Keymaps ]] -- See `:help vim.keymap.set()` -@@ -255,6 +263,66 @@ require('lazy').setup({ - topdelete = { text = '‾' }, - changedelete = { text = '~' }, - }, -+ on_attach = function(bufnr) -+ local gs = package.loaded.gitsigns -+ -+ local function map(mode, l, r, opts) -+ opts = opts or {} -+ opts.buffer = bufnr -+ vim.keymap.set(mode, l, r, opts) -+ end -+ -+ -- Navigation -+ map({ 'n', 'v' }, ']c', function() -+ if vim.wo.diff then -+ return ']c' -+ end -+ vim.schedule(function() -+ gs.next_hunk() -+ end) -+ return '' -+ end, { expr = true, desc = 'Jump to next hunk' }) -+ -+ map({ 'n', 'v' }, '[c', function() -+ if vim.wo.diff then -+ return '[c' -+ end -+ vim.schedule(function() -+ gs.prev_hunk() -+ end) -+ return '' -+ end, { expr = true, desc = 'Jump to previous hunk' }) -+ -+ -- Actions -+ -- visual mode -+ map('v', 'hs', function() -+ gs.stage_hunk { vim.fn.line '.', vim.fn.line 'v' } -+ end, { desc = 'stage git hunk' }) -+ map('v', 'hr', function() -+ gs.reset_hunk { vim.fn.line '.', vim.fn.line 'v' } -+ end, { desc = 'reset git hunk' }) -+ -- normal mode -+ map('n', 'hs', gs.stage_hunk, { desc = 'git stage hunk' }) -+ map('n', 'hr', gs.reset_hunk, { desc = 'git reset hunk' }) -+ map('n', 'hS', gs.stage_buffer, { desc = 'git Stage buffer' }) -+ map('n', 'hu', gs.undo_stage_hunk, { desc = 'undo stage hunk' }) -+ map('n', 'hR', gs.reset_buffer, { desc = 'git Reset buffer' }) -+ map('n', 'hp', gs.preview_hunk, { desc = 'preview git hunk' }) -+ map('n', 'hb', function() -+ gs.blame_line { full = false } -+ end, { desc = 'git blame line' }) -+ map('n', 'hd', gs.diffthis, { desc = 'git diff against index' }) -+ map('n', 'hD', function() -+ gs.diffthis '~' -+ end, { desc = 'git diff against last commit' }) -+ -+ -- Toggles -+ map('n', 'tb', gs.toggle_current_line_blame, { desc = 'toggle git blame line' }) -+ map('n', 'td', gs.toggle_deleted, { desc = 'toggle git show deleted' }) -+ -+ -- Text object -+ map({ 'o', 'x' }, 'ih', ':Gitsigns select_hunk', { desc = 'select git hunk' }) -+ end, - }, - }, - -@@ -283,6 +351,7 @@ require('lazy').setup({ +@@ -283,6 +291,7 @@ require('lazy').setup({ require('which-key').register { ['c'] = { name = '[C]ode', _ = 'which_key_ignore' }, ['d'] = { name = '[D]ocument', _ = 'which_key_ignore' }, @@ -115,7 +48,7 @@ index 506bbaf..d546b62 100644 ['r'] = { name = '[R]ename', _ = 'which_key_ignore' }, ['s'] = { name = '[S]earch', _ = 'which_key_ignore' }, ['w'] = { name = '[W]orkspace', _ = 'which_key_ignore' }, -@@ -552,6 +621,18 @@ require('lazy').setup({ +@@ -552,6 +561,18 @@ require('lazy').setup({ -- tsserver = {}, -- @@ -134,7 +67,7 @@ index 506bbaf..d546b62 100644 lua_ls = { -- cmd = {...}, -- filetypes { ...}, -@@ -566,6 +647,10 @@ require('lazy').setup({ +@@ -566,6 +587,10 @@ require('lazy').setup({ }, }, }, @@ -145,7 +78,7 @@ index 506bbaf..d546b62 100644 } -- Ensure the servers and tools above are installed -@@ -592,6 +677,33 @@ require('lazy').setup({ +@@ -592,6 +617,33 @@ require('lazy').setup({ -- by the server configuration above. Useful when disabling -- certain features of an LSP (for example, turning off formatting for tsserver) server.capabilities = vim.tbl_deep_extend('force', {}, capabilities, server.capabilities or {}) @@ -179,7 +112,7 @@ index 506bbaf..d546b62 100644 require('lspconfig')[server_name].setup(server) end, }, -@@ -793,7 +905,31 @@ require('lazy').setup({ +@@ -793,7 +845,31 @@ require('lazy').setup({ 'nvim-treesitter/nvim-treesitter', build = ':TSUpdate', opts = { @@ -212,7 +145,7 @@ index 506bbaf..d546b62 100644 -- Autoinstall languages that are not installed auto_install = true, highlight = { -@@ -830,14 +966,14 @@ require('lazy').setup({ +@@ -830,14 +906,14 @@ require('lazy').setup({ -- Uncomment any of the lines below to enable them (you will need to restart nvim). -- -- require 'kickstart.plugins.debug', -- 2.47.2 From 88d52075b06d44cd9c33ceb5c106442eacaa1170 Mon Sep 17 00:00:00 2001 From: Joao P Dubas Date: Tue, 19 Mar 2024 16:12:41 +0000 Subject: [PATCH 26/28] feat(nvim): upgrade kickstart to latest commit --- Dockerfile | 2 +- patch/kickstart.nvim/updates.patch | 23 ++++++++++++----------- 2 files changed, 13 insertions(+), 12 deletions(-) diff --git a/Dockerfile b/Dockerfile index bdd8d76..99fd7b7 100644 --- a/Dockerfile +++ b/Dockerfile @@ -169,7 +169,7 @@ COPY ./patch/kickstart.nvim/updates.patch /tmp COPY ./config/nvim/lua/custom/plugins/init.lua /tmp RUN git clone https://github.com/nvim-lua/kickstart.nvim.git "${XDG_CONFIG_HOME}"/nvim \ && cd ${XDG_CONFIG_HOME}/nvim \ - && git reset --hard ea4335f5af2fabbf063f8bf946f05583f215f904 \ + && git reset --hard 773e482d4b40cec4095e4b60fbd753cb69b3f51b \ && git apply /tmp/updates.patch \ && cp /tmp/init.lua ${XDG_CONFIG_HOME}/nvim/lua/custom/plugins \ && nvim --headless "+Lazy! sync" +qa diff --git a/patch/kickstart.nvim/updates.patch b/patch/kickstart.nvim/updates.patch index 59e9e07..2bbff1f 100644 --- a/patch/kickstart.nvim/updates.patch +++ b/patch/kickstart.nvim/updates.patch @@ -1,5 +1,5 @@ diff --git a/init.lua b/init.lua -index 506bbaf..33db6a3 100644 +index 013fcc2..ca98546 100644 --- a/init.lua +++ b/init.lua @@ -91,7 +91,7 @@ vim.g.mapleader = ' ' @@ -13,7 +13,7 @@ index 506bbaf..33db6a3 100644 -- See `:help vim.opt` @@ -102,10 +102,10 @@ vim.g.have_nerd_font = false vim.opt.number = true - -- You can also add relative line numbers, for help with jumping. + -- You can also add relative line numbers, to help with jumping. -- Experiment for yourself to see if you like it! --- vim.opt.relativenumber = true +vim.opt.relativenumber = true @@ -23,7 +23,7 @@ index 506bbaf..33db6a3 100644 +-- Disable mouse mode +vim.opt.mouse = '' - -- Don't show the mode, since it's already in status line + -- Don't show the mode, since it's already in the status line vim.opt.showmode = false @@ -154,6 +154,14 @@ vim.opt.cursorline = true -- Minimal number of screen lines to keep above and below the cursor. @@ -48,7 +48,7 @@ index 506bbaf..33db6a3 100644 ['r'] = { name = '[R]ename', _ = 'which_key_ignore' }, ['s'] = { name = '[S]earch', _ = 'which_key_ignore' }, ['w'] = { name = '[W]orkspace', _ = 'which_key_ignore' }, -@@ -552,6 +561,18 @@ require('lazy').setup({ +@@ -551,6 +560,18 @@ require('lazy').setup({ -- tsserver = {}, -- @@ -66,8 +66,8 @@ index 506bbaf..33db6a3 100644 + htmx = {}, lua_ls = { -- cmd = {...}, - -- filetypes { ...}, -@@ -566,6 +587,10 @@ require('lazy').setup({ + -- filetypes = { ...}, +@@ -565,6 +586,10 @@ require('lazy').setup({ }, }, }, @@ -78,7 +78,7 @@ index 506bbaf..33db6a3 100644 } -- Ensure the servers and tools above are installed -@@ -592,6 +617,33 @@ require('lazy').setup({ +@@ -591,6 +616,33 @@ require('lazy').setup({ -- by the server configuration above. Useful when disabling -- certain features of an LSP (for example, turning off formatting for tsserver) server.capabilities = vim.tbl_deep_extend('force', {}, capabilities, server.capabilities or {}) @@ -112,7 +112,7 @@ index 506bbaf..33db6a3 100644 require('lspconfig')[server_name].setup(server) end, }, -@@ -793,7 +845,31 @@ require('lazy').setup({ +@@ -791,7 +843,31 @@ require('lazy').setup({ 'nvim-treesitter/nvim-treesitter', build = ':TSUpdate', opts = { @@ -145,15 +145,16 @@ index 506bbaf..33db6a3 100644 -- Autoinstall languages that are not installed auto_install = true, highlight = { -@@ -830,14 +906,14 @@ require('lazy').setup({ +@@ -828,7 +904,7 @@ require('lazy').setup({ -- Uncomment any of the lines below to enable them (you will need to restart nvim). -- -- require 'kickstart.plugins.debug', - -- require 'kickstart.plugins.indent_line', + require 'kickstart.plugins.indent_line', + -- require 'kickstart.plugins.lint', -- NOTE: The import below can automatically add your own plugins, configuration, etc from `lua/custom/plugins/*.lua` - -- This is the easiest way to modularize your config. +@@ -836,7 +912,7 @@ require('lazy').setup({ -- -- Uncomment the following line and add your plugins to `lua/custom/plugins/*.lua` to get going. -- For additional information, see `:help lazy.nvim-lazy.nvim-structuring-your-plugins` @@ -161,4 +162,4 @@ index 506bbaf..33db6a3 100644 + { import = 'custom.plugins' }, }, { ui = { - -- If you have a Nerd Font, set icons to an empty table which will use the + -- If you are using a Nerd Font: set icons to an empty table which will use the -- 2.47.2 From cd84775ca72dd7ef02c7ff4bbfc79278a4b28562 Mon Sep 17 00:00:00 2001 From: Joao P Dubas Date: Thu, 28 Mar 2024 00:10:30 +0000 Subject: [PATCH 27/28] chore(nvim): move from vim-fugitive to neogit Will try Neogit for a second time. --- config/nvim/lua/custom/plugins/init.lua | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/config/nvim/lua/custom/plugins/init.lua b/config/nvim/lua/custom/plugins/init.lua index f209539..d696ed7 100644 --- a/config/nvim/lua/custom/plugins/init.lua +++ b/config/nvim/lua/custom/plugins/init.lua @@ -3,9 +3,6 @@ -- -- See the kickstart.nvim README for more information return { - -- Git related plugins - 'tpope/vim-fugitive', - 'tpope/vim-rhubarb', { 'lewis6991/gitsigns.nvim', opts = { @@ -92,6 +89,22 @@ return { } end, }, + { + 'NeogitOrg/neogit', + dependencies = { + 'nvim-lua/plenary.nvim', + 'sindrets/diffview.nvim', + 'nvim-telescope/telescope.nvim', + }, + opts = { + git_services = { + ['gitea.dubas.dev'] = 'https://gitea.dubas.dev/${owner}/${repository}/compare/${branch_name}', + }, + }, + keys = { + { 'gs', 'Neogit', desc = 'Git status' }, + }, + }, 'nvim-treesitter/nvim-treesitter-context', { 'kevinhwang91/nvim-ufo', -- 2.47.2 From 3a2d22e64badf5f062199ac07d10e55e1d0966da Mon Sep 17 00:00:00 2001 From: Joao P Dubas Date: Thu, 28 Mar 2024 00:12:00 +0000 Subject: [PATCH 28/28] chore(nvim): setup rest-nvim correctly On version 2.0.0 the installation and configuration were updated. --- config/nvim/lua/custom/plugins/init.lua | 72 ++++++++++++++++--------- 1 file changed, 46 insertions(+), 26 deletions(-) diff --git a/config/nvim/lua/custom/plugins/init.lua b/config/nvim/lua/custom/plugins/init.lua index d696ed7..d38d34e 100644 --- a/config/nvim/lua/custom/plugins/init.lua +++ b/config/nvim/lua/custom/plugins/init.lua @@ -164,37 +164,57 @@ return { }, opts = {}, }, + { + 'vhyrro/luarocks.nvim', + priority = 1000, + config = true, + }, { 'rest-nvim/rest.nvim', - dependencies = { 'nvim-lua/plenary.nvim' }, + dependencies = { 'luarocks.nvim' }, ft = { 'http', 'rest', }, - opts = { - result_split_horizontal = false, - result_split_in_place = false, - skip_ssl_verification = false, - encode_url = true, - highlight = { - enabled = true, - timeout = 15, - }, - result = { - show_url = true, - show_curl_command = true, - show_http_info = true, - show_headers = true, - formatters = { - json = 'jq', - html = false, - }, - jump_to_request = true, - env_file = '.env', + config = function() + require('rest-nvim').setup { + client = 'curl', custom_dynamic_variables = {}, - yank_dry_run = true, - }, - }, + encode_url = true, + env_file = '.env', + skip_ssl_verification = false, + highlight = { + enable = true, + timeout = 15, + }, + result = { + behavior = { + decode_url = true, + formatters = { + json = 'jq', + html = false, + }, + show_info = { + curl_command = true, + headers = true, + http_info = true, + url = true, + }, + statistics = { + enable = true, + stats = { + { 'total_time', title = 'Time taken:' }, + { 'size_download_t', title = 'Download size:' }, + }, + }, + }, + split = { + horizontal = false, + in_place = false, + }, + }, + } + end, keys = function() local status_ok, which_key = pcall(require, 'which-key') if status_ok then @@ -203,13 +223,13 @@ return { } end return { - { 'tr', 'RestNvim', desc = 'Run the request under cursor' }, + { 'tr', 'Rest run', desc = 'Run the request under cursor' }, { 'tp', 'RestNvimPreview', desc = 'Preview the curl command for the request under cursor', }, - { 'tl', 'RestNvimLast', desc = 'Re-run the last request' }, + { 'tl', 'Rest run last', desc = 'Re-run the last request' }, } end, }, -- 2.47.2