feat: upgrade ubuntu to 23.10 (#30)

In addition to upgrading ubuntu to 23.10, the following changes were made:

1. Use the latest commit from [kickstart.nvim][0]
2. Setup [atuin][1] to share `shell` history
3. Conditionally configure `git`, based on [`gitbutler` blog post][2]
4. Improve `tmux` colorscheme configuration, based on [tmux vim truecolor git by andersevenrud][3]
5. Update cli's installed by `mise`:
   * awscli to 2.15.30
   * dagger to 0.10.2
   * elixir to 1.16.2
   * erlang to 26.2.3
   * eza to 0.18.7
   * fzf to 0.48.1
   * go to 1.22.1
   * helm to 3.14.3
   * kubectl to 1.29.3
   * lefthook to 1.6.7
   * node to 21.7.1
   * poetry to 1.8.2
   * python to 3.12.2
   * terraform to 1.7.5
   * tilt to 0.33.11
   * usql to 0.17.5
   * zoxide to 0.9.4
6. Added the cli's:
   * k3sup
   * k9s
   * rust

[0]: https://github.com/nvim-lua/kickstart.nvim
[1]: https://github.com/atuinsh/atuin
[2]: https://blog.gitbutler.com/git-tips-1-theres-a-git-config-for-that/#conditional-configs
[3]: https://gist.github.com/andersevenrud/015e61af2fd264371032763d4ed965b6

Reviewed-on: #30
Co-authored-by: Joao P Dubas <joao.dubas+gitea@gmail.com>
Co-committed-by: Joao P Dubas <joao.dubas+gitea@gmail.com>
This commit is contained in:
João Paulo Dubas 2024-03-28 00:18:20 +00:00 committed by João Paulo Dubas
parent d8aa29893e
commit d9a33dc515
11 changed files with 500 additions and 259 deletions

1
.gitignore vendored
View File

@ -1 +1,2 @@
config/tmux/plugins
config/git

6
.stylua.toml Normal file
View File

@ -0,0 +1,6 @@
column_width = 160
line_endings = "Unix"
indent_type = "Spaces"
indent_width = 2
quote_style = "AutoPreferSingle"
call_parentheses = "None"

View File

@ -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

5
config/atuin/config.toml Normal file
View File

@ -0,0 +1,5 @@
auto_sync = true
update_check = false
sync_address = "https://atuin.dubas.dev"
sync_frequency = "15m"
inline_height = 10

0
config/git/.exists Normal file
View File

View File

@ -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

View File

@ -4,33 +4,106 @@
-- 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'
'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 '<Ignore>'
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 '<Ignore>'
end, { expr = true, desc = 'Jump to previous hunk' })
-- Actions
-- visual mode
map('v', '<leader>hs', function()
gs.stage_hunk { vim.fn.line '.', vim.fn.line 'v' }
end, { desc = 'stage git hunk' })
map('v', '<leader>hr', function()
gs.reset_hunk { vim.fn.line '.', vim.fn.line 'v' }
end, { desc = 'reset git hunk' })
-- normal mode
map('n', '<leader>hs', gs.stage_hunk, { desc = 'git stage hunk' })
map('n', '<leader>hr', gs.reset_hunk, { desc = 'git reset hunk' })
map('n', '<leader>hS', gs.stage_buffer, { desc = 'git Stage buffer' })
map('n', '<leader>hu', gs.undo_stage_hunk, { desc = 'undo stage hunk' })
map('n', '<leader>hR', gs.reset_buffer, { desc = 'git Reset buffer' })
map('n', '<leader>hp', gs.preview_hunk, { desc = 'preview git hunk' })
map('n', '<leader>hb', function()
gs.blame_line { full = false }
end, { desc = 'git blame line' })
map('n', '<leader>hd', gs.diffthis, { desc = 'git diff against index' })
map('n', '<leader>hD', function()
gs.diffthis '~'
end, { desc = 'git diff against last commit' })
-- Toggles
map('n', '<leader>tb', gs.toggle_current_line_blame, { desc = 'toggle git blame line' })
map('n', '<leader>td', gs.toggle_deleted, { desc = 'toggle git show deleted' })
-- Text object
map({ 'o', 'x' }, 'ih', ':<C-U>Gitsigns select_hunk<CR>', { desc = 'select git hunk' })
end,
},
},
{
'joaodubas/gitlinker.nvim',
config = function()
local actions = require('gitlinker.actions')
local hosts = require('gitlinker.hosts')
require('gitlinker').setup({
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 = '<leader>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 = {
{ '<leader>gs', '<cmd>Neogit<cr>', desc = 'Git status' },
},
mappings = "<leader>gy"
})
end
},
'nvim-treesitter/nvim-treesitter-context',
{
@ -38,12 +111,12 @@ return {
dependencies = { 'kevinhwang91/promise-async' },
event = 'BufRead',
keys = function()
local ufo = require('ufo')
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()
@ -79,62 +152,86 @@ return {
fold_virt_text_handler = handler,
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 = {
{ '-', '<cmd>Oil<cr>', desc = "Open parent directory" },
{ '-', '<cmd>Oil<cr>', 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,
config = function()
require('rest-nvim').setup {
client = 'curl',
custom_dynamic_variables = {},
encode_url = true,
env_file = '.env',
skip_ssl_verification = false,
highlight = {
enabled = true,
timeout = 15
enable = true,
timeout = 15,
},
result = {
show_url = true,
show_curl_command = true,
show_http_info = true,
show_headers = true,
behavior = {
decode_url = true,
formatters = {
json = 'jq',
html = false
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,
},
},
jump_to_request = true,
env_file = '.env',
custom_dynamic_variables = { },
yank_dry_run = true
}
},
end,
keys = function()
local status_ok, which_key = pcall(require, 'which-key')
if status_ok then
which_key.register({
['<leader>t'] = { name = 'Res[t]', _ = 'which_key_ignore' }
})
end
return {
{ '<leader>tr', '<Plug>RestNvim', desc = 'Run the request under cursor' },
{ '<leader>tp', '<Plug>RestNvimPreview', desc = 'Preview the curl command for the request under cursor' },
{ '<leader>tl', '<Plug>RestNvimLast', desc = 'Re-run the last request' }
which_key.register {
['<leader>t'] = { name = 'Res[t]', _ = 'which_key_ignore' },
}
end
return {
{ '<leader>tr', '<cmd>Rest run<cr>', desc = 'Run the request under cursor' },
{
'<leader>tp',
'<Plug>RestNvimPreview',
desc = 'Preview the curl command for the request under cursor',
},
{ '<leader>tl', '<cmd>Rest run last<cr>', desc = 'Re-run the last request' },
}
end,
},
{
'akinsho/toggleterm.nvim',
@ -151,9 +248,9 @@ return {
keys = function()
local status_ok, which_key = pcall(require, 'which-key')
if status_ok then
which_key.register({
['<leader>m'] = { name = 'Toggle ter[m]inal', _ = 'which_key_ignore' }
})
which_key.register {
['<leader>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 }),
@ -167,13 +264,28 @@ return {
vim.keymap.set('t', '<C-k>', [[<cmd>wincmd k<cr>]], opts)
vim.keymap.set('t', '<C-l>', [[<cmd>wincmd l<cr>]], opts)
vim.keymap.set('t', '<C-w>', [[<C-\><C-n><C-w>]], opts)
end
end,
})
return {
{ '<leader>mh', '<cmd>ToggleTerm direction=horizontal size=' .. tostring(vim.o.lines * 0.75) .. '<cr>', desc = 'Open ter[m]inal [h]orizontally', noremap = true },
{ '<leader>mv', '<cmd>ToggleTerm direction=vertical size=' .. tostring(vim.o.columns * 0.5) .. '<cr>', desc = 'Open ter[m]inal [v]ertically', noremap = true },
{ '<leader>mc', '<cmd>ToggleTermSendCurrentLine<cr>', desc = 'Send [c]urrent line under the cursor', noremap = true }
}
end
{
'<leader>mh',
'<cmd>ToggleTerm direction=horizontal size=' .. tostring(vim.o.lines * 0.75) .. '<cr>',
desc = 'Open ter[m]inal [h]orizontally',
noremap = true,
},
{
'<leader>mv',
'<cmd>ToggleTerm direction=vertical size=' .. tostring(vim.o.columns * 0.5) .. '<cr>',
desc = 'Open ter[m]inal [v]ertically',
noremap = true,
},
{
'<leader>mc',
'<cmd>ToggleTermSendCurrentLine<cr>',
desc = 'Send [c]urrent line under the cursor',
noremap = true,
},
}
end,
},
}

View File

@ -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)

View File

@ -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'

View File

@ -1,86 +1,122 @@
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', '<leader>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' },
-
@@ -283,6 +291,7 @@ require('lazy').setup({
require('which-key').register {
['<leader>c'] = { name = '[C]ode', _ = 'which_key_ignore' },
['<leader>d'] = { name = '[D]ocument', _ = 'which_key_ignore' },
+ ['<leader>h'] = { name = 'Git [h]unk', _ = 'which_key_ignore' },
['<leader>r'] = { name = '[R]ename', _ = 'which_key_ignore' },
['<leader>s'] = { name = '[S]earch', _ = 'which_key_ignore' },
['<leader>w'] = { name = '[W]orkspace', _ = 'which_key_ignore' },
@@ -551,6 +560,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 = { ...},
@@ -565,6 +586,10 @@ require('lazy').setup({
},
},
},
+ pyright = {},
+ templ = {},
+ terraformls = {},
+ tsserver = {},
}
-- 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',
@ -104,72 +140,26 @@ index fd4567d..236fb97 100644
+ 'typescript',
+ 'vim',
+ 'vimdoc',
+ 'yaml'
+ '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 = {},
}
-- 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::
+ end
+ end
+ require('lspconfig')[server_name].setup(opts)
end,
}
-- 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

99
scripts/24-bit-color.sh Executable file
View File

@ -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;<r>;<g>;<b>m
# The background escape sequence is ^[48;2;<r>;<g>;<b>m
# <r> <g> <b> 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