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/.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" diff --git a/Dockerfile b/Dockerfile index df0c1d6..99fd7b7 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,12 @@ 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 '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 \ @@ -94,7 +99,10 @@ 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 \ && curl -L ${DO_URL} | tar -zx -C /tmp/download \ && chgrp --recursive docker /tmp/download \ @@ -103,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 @@ -148,9 +158,10 @@ 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 -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 @@ -158,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 7af594fd319fbae6b2aaa06337f3df8acbbb7f18 \ + && 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 @@ -174,6 +185,8 @@ RUN ${LOCAL_BIN_HOME}/mise plugins install --force --yes \ fzf \ helm \ k3d \ + k3sup \ + k9s \ kubectl \ kubie \ lefthook \ @@ -192,7 +205,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 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/config/git/.exists b/config/git/.exists new file mode 100644 index 0000000..e69de29 diff --git a/config/mise/config.toml b/config/mise/config.toml index abe906b..44442f0 100644 --- a/config/mise/config.toml +++ b/config/mise/config.toml @@ -1,28 +1,32 @@ [tools] -awscli = "2.15.6" +awscli = "2.15.30" 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.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" -kubectl = "1.29.0" +k3sup = "0.13.5" +k9s = "0.32.3" +kubectl = "1.29.3" kubie = "0.23.0" -lefthook = "1.5.5" -node = "21.5.0" -poetry = "1.7.1" -python = "3.12.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.6.6" -tilt = "0.33.10" -tmux = "3.3" -usql = "0.17.2" +terraform = "1.7.5" +tilt = "0.33.11" +tmux = "3.4" +usql = "0.17.5" yarn = "1.22.19" -zoxide = "0.9.2" +zoxide = "0.9.4" [settings] experimental = true +python_compile = true diff --git a/config/nvim/lua/custom/plugins/init.lua b/config/nvim/lua/custom/plugins/init.lua index ef22920..d38d34e 100644 --- a/config/nvim/lua/custom/plugins/init.lua +++ b/config/nvim/lua/custom/plugins/init.lua @@ -4,50 +4,123 @@ -- 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 + '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 () - 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, + }, + { + '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', 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 +134,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,64 +150,88 @@ 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 = {}, }, + { + 'vhyrro/luarocks.nvim', + priority = 1000, + config = true, + }, { 'rest-nvim/rest.nvim', - dependencies = { 'nvim-lua/plenary.nvim' }, + dependencies = { 'luarocks.nvim' }, ft = { 'http', - 'rest' + '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, + config = function() + require('rest-nvim').setup { + client = 'curl', + custom_dynamic_variables = {}, + encode_url = true, env_file = '.env', - custom_dynamic_variables = { }, - yank_dry_run = true + 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, + }, + }, } - }, - keys = function () + end, + 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' } + { 'tr', 'Rest run', desc = 'Run the request under cursor' }, + { + 'tp', + 'RestNvimPreview', + desc = 'Preview the curl command for the request under cursor', + }, + { 'tl', 'Rest run last', desc = 'Re-run the last request' }, } - end + end, }, { 'akinsho/toggleterm.nvim', @@ -142,22 +239,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 +264,28 @@ 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/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) diff --git a/docker-compose.yml b/docker-compose.yml index 11eda74..2888639 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -9,8 +9,10 @@ services: entrypoint: sleep command: infinity volumes: - - './config/nvim/lua/custom:/home/coder/.config/nvim/lua/custom' + - './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' - './config/starship:/home/coder/.config/starship' - './config/tmux:/home/coder/.config/tmux' - './config/tmuxp:/home/coder/.config/tmuxp' diff --git a/patch/kickstart.nvim/updates.patch b/patch/kickstart.nvim/updates.patch index fafed8c..2bbff1f 100644 --- a/patch/kickstart.nvim/updates.patch +++ b/patch/kickstart.nvim/updates.patch @@ -1,175 +1,165 @@ diff --git a/init.lua b/init.lua -index fd4567d..236fb97 100644 +index 013fcc2..ca98546 100644 --- a/init.lua +++ b/init.lua -@@ -200,19 +200,19 @@ require('lazy').setup({ - }, - }, +@@ -91,7 +91,7 @@ vim.g.mapleader = ' ' + vim.g.maplocalleader = ' ' -- { -- -- 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' }, - }, {}) + -- Set to true if you have a Nerd Font installed +-vim.g.have_nerd_font = false ++vim.g.have_nerd_font = true -- [[ Setting options ]] -@@ -292,11 +292,12 @@ require('lazy').setup({ - -- Set highlight on search - vim.o.hlsearch = false + -- 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, to help with jumping. + -- Experiment for yourself to see if you like it! +--- vim.opt.relativenumber = true ++vim.opt.relativenumber = true ---- Make line numbers default -+-- Make relative line numbers default - vim.wo.number = true -+vim.wo.relativenumber = true - ---- Enable mouse mode --vim.o.mouse = 'a' +--- Enable mouse mode, can be useful for resizing splits for example! +-vim.opt.mouse = 'a' +-- Disable mouse mode -+vim.o.mouse = '' ++vim.opt.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 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. + 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' } }, - }, - }, -+ pyright = {}, -+ templ = {}, -+ terraformls = {}, -+ tsserver = {}, - } +@@ -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' }, ++ ['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' }, +@@ -551,6 +560,18 @@ require('lazy').setup({ + -- tsserver = {}, + -- - -- Setup neovim lua configuration -@@ -619,12 +660,25 @@ mason_lspconfig.setup { ++ elixirls = { ++ elixirLS = { ++ dialyzerEnabled = true, ++ dialyzerFormat = 'dialyxir_long', ++ fetchDeps = false, ++ mixEnv = 'test', ++ }, ++ }, ++ gopls = {}, ++ helm_ls = {}, ++ html = { filetypes = { 'html', 'twig', 'hbs' } }, ++ htmx = {}, + lua_ls = { + -- cmd = {...}, + -- filetypes = { ...}, +@@ -565,6 +586,10 @@ require('lazy').setup({ + }, + }, + }, ++ pyright = {}, ++ templ = {}, ++ terraformls = {}, ++ tsserver = {}, + } - 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:: -+ end -+ end -+ require('lspconfig')[server_name].setup(opts) - end, - } + -- Ensure the servers and tools above are installed +@@ -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 {}) ++ -- 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 ++ 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, + }, +@@ -791,7 +843,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 = { +@@ -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` +@@ -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` +- -- { import = 'custom.plugins' }, ++ { import = 'custom.plugins' }, + }, { + ui = { + -- If you are using a Nerd Font: set icons to an empty table which will use the 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 +