Upgrade OS version and setup #30

Merged
joao.dubas merged 28 commits from jpd-upgrade-os into main 2024-03-28 00:18:20 +00:00
11 changed files with 500 additions and 259 deletions

1
.gitignore vendored
View File

@ -1 +1,2 @@
config/tmux/plugins 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 # system deps
ARG USER_UID=1000 ARG USER_UID=1000
@ -39,7 +39,7 @@ RUN apt-get update \
libncurses-dev \ libncurses-dev \
libncurses5-dev \ libncurses5-dev \
libncursesw5-dev \ libncursesw5-dev \
libodbc1 \ libodbc2 \
libpcre2-dev \ libpcre2-dev \
libreadline-dev \ libreadline-dev \
libsctp-dev \ libsctp-dev \
@ -47,8 +47,7 @@ RUN apt-get update \
libsqlite3-dev \ libsqlite3-dev \
libssl-dev \ libssl-dev \
libtool \ libtool \
libwxgtk3.0-gtk3-0v5 \ libwxgtk3.2-dev \
libwxgtk3.0-gtk3-dev \
libxslt-dev \ libxslt-dev \
libyaml-dev \ libyaml-dev \
llvm \ llvm \
@ -74,6 +73,12 @@ RUN apt-get update \
zlib1g-dev \ zlib1g-dev \
&& rm -rf /var/lib/apt/lists/* \ && rm -rf /var/lib/apt/lists/* \
&& locale-gen en_US.UTF-8 \ && 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' \ && echo 'setup unprivileged user' \
&& groupadd --gid ${WHEEL_GID} wheel \ && groupadd --gid ${WHEEL_GID} wheel \
&& groupadd --gid ${DOCKER_GID} docker \ && 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 DO_URL https://download.docker.com/linux/static/stable/x86_64/docker-${DO_VERSION}.tgz
ENV DC_VERSION v2.23.3 ENV DC_VERSION v2.23.3
ENV DC_URL https://github.com/docker/compose/releases/download/${DC_VERSION}/docker-compose-linux-x86_64 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 \ RUN curl -sS https://starship.rs/install.sh | sh -s -- --yes \
&& curl -sS https://setup.atuin.sh | bash \
&& mkdir /tmp/download \ && mkdir /tmp/download \
&& curl -L ${DO_URL} | tar -zx -C /tmp/download \ && curl -L ${DO_URL} | tar -zx -C /tmp/download \
&& chgrp --recursive docker /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 \ && mkdir -p /usr/local/lib/docker/cli-plugins \
&& curl -L ${DC_URL} -o /usr/local/lib/docker/cli-plugins/docker-compose \ && curl -L ${DC_URL} -o /usr/local/lib/docker/cli-plugins/docker-compose \
&& chmod 750 /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 && chgrp --recursive docker /usr/local/lib/docker
USER coder USER coder
@ -148,9 +158,10 @@ RUN fish -c true \
&& echo 'starship init fish | source' >> ${XDG_CONFIG_HOME}/fish/config.fish \ && 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 '{$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 '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 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 l="eza --time-style=long-iso --color=auto --classify=always"' >> ${XDG_CONFIG_HOME}/fish/config.fish \
&& echo 'alias ll="l -Fahl"' >> ${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 && echo 'alias la="l -a"' >> ${XDG_CONFIG_HOME}/fish/config.fish
# git configuration # git configuration
@ -158,7 +169,7 @@ COPY ./patch/kickstart.nvim/updates.patch /tmp
COPY ./config/nvim/lua/custom/plugins/init.lua /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 \ RUN git clone https://github.com/nvim-lua/kickstart.nvim.git "${XDG_CONFIG_HOME}"/nvim \
&& cd ${XDG_CONFIG_HOME}/nvim \ && cd ${XDG_CONFIG_HOME}/nvim \
&& git reset --hard 7af594fd319fbae6b2aaa06337f3df8acbbb7f18 \ && git reset --hard 773e482d4b40cec4095e4b60fbd753cb69b3f51b \
&& git apply /tmp/updates.patch \ && git apply /tmp/updates.patch \
&& cp /tmp/init.lua ${XDG_CONFIG_HOME}/nvim/lua/custom/plugins \ && cp /tmp/init.lua ${XDG_CONFIG_HOME}/nvim/lua/custom/plugins \
&& nvim --headless "+Lazy! sync" +qa && nvim --headless "+Lazy! sync" +qa
@ -174,6 +185,8 @@ RUN ${LOCAL_BIN_HOME}/mise plugins install --force --yes \
fzf \ fzf \
helm \ helm \
k3d \ k3d \
k3sup \
k9s \
kubectl \ kubectl \
kubie \ kubie \
lefthook \ lefthook \
@ -192,7 +205,14 @@ ARG GIT_USER_EMAIL
ARG GIT_USER_NAME ARG GIT_USER_NAME
RUN git config --global user.email "${GIT_USER_EMAIL}" \ RUN git config --global user.email "${GIT_USER_EMAIL}" \
&& git config --global user.name "${GIT_USER_NAME}" \ && 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/docker-entrypoint.sh /usr/local/bin/docker-entrypoint
COPY ./scripts/elixir-ls-setup.sh /usr/local/bin/elixir-ls-setup 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] [tools]
awscli = "2.15.6" awscli = "2.15.30"
bat = "0.24.0" bat = "0.24.0"
dagger = "0.9.5" dagger = "0.10.2"
elixir = "1.16.0-otp-26" elixir = "1.16.2-otp-26"
erlang = "26.2.1" erlang = "26.2.3"
eza = "0.17.0" eza = "0.18.7"
fzf = "0.45.0" fzf = "0.48.1"
go = "1.21.5" go = "1.22.1"
helm = "3.13.3" helm = "3.14.3"
k3d = "5.6.0" k3d = "5.6.0"
kubectl = "1.29.0" k3sup = "0.13.5"
k9s = "0.32.3"
kubectl = "1.29.3"
kubie = "0.23.0" kubie = "0.23.0"
lefthook = "1.5.5" lefthook = "1.6.7"
node = "21.5.0" node = "21.7.1"
poetry = "1.7.1" poetry = "1.8.2"
python = "3.12.1" python = "3.12.2"
ripgrep = "14.1.0" ripgrep = "14.1.0"
rust = "1.76.0"
starship = "1.17.1" starship = "1.17.1"
terraform = "1.6.6" terraform = "1.7.5"
tilt = "0.33.10" tilt = "0.33.11"
tmux = "3.3" tmux = "3.4"
usql = "0.17.2" usql = "0.17.5"
yarn = "1.22.19" yarn = "1.22.19"
zoxide = "0.9.2" zoxide = "0.9.4"
[settings] [settings]
experimental = true experimental = true
python_compile = true

View File

@ -4,50 +4,123 @@
-- See the kickstart.nvim README for more information -- See the kickstart.nvim README for more information
return { return {
{ {
'mgoral/vim-bw', 'lewis6991/gitsigns.nvim',
url = 'https://git.goral.net.pl/mgoral/vim-bw.git', opts = {
priority = 1000, on_attach = function(bufnr)
config = function () local gs = package.loaded.gitsigns
vim.cmd.colorscheme 'bw-onedark'
end 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', 'joaodubas/gitlinker.nvim',
config = function () config = function()
local actions = require('gitlinker.actions') local actions = require 'gitlinker.actions'
local hosts = require('gitlinker.hosts') local hosts = require 'gitlinker.hosts'
require('gitlinker').setup({ require('gitlinker').setup {
opts = { opts = {
remote = "origin", remote = 'origin',
add_current_line_on_normal_mode = true, add_current_line_on_normal_mode = true,
action_callback = actions.copy_to_clipboard, action_callback = actions.copy_to_clipboard,
print_url = true, print_url = true,
}, },
callbacks = { callbacks = {
["github.com"] = hosts.get_github_type_url, ['github.com'] = hosts.get_github_type_url,
["bitbucket.org"] = hosts.get_bitbucket_type_url, ['bitbucket.org'] = hosts.get_bitbucket_type_url,
["gitea.dubas.dev"] = hosts.get_gitea_type_url, ['gitea.dubas.dev'] = hosts.get_gitea_type_url,
}, },
mappings = "<leader>gy" mappings = '<leader>gy',
}) }
end 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' },
},
}, },
'nvim-treesitter/nvim-treesitter-context', 'nvim-treesitter/nvim-treesitter-context',
{ {
'kevinhwang91/nvim-ufo', 'kevinhwang91/nvim-ufo',
dependencies = { 'kevinhwang91/promise-async' }, dependencies = { 'kevinhwang91/promise-async' },
event = 'BufRead', event = 'BufRead',
keys = function () keys = function()
local ufo = require('ufo') local ufo = require 'ufo'
return { return {
{ 'zR', ufo.openAllFolds, { desc = "Open all folds" } }, { 'zR', ufo.openAllFolds, { desc = 'Open all folds' } },
{ 'zM', ufo.closeAllFolds, { desc = "Close all folds" } }, { 'zM', ufo.closeAllFolds, { desc = 'Close all folds' } },
{ 'zr', ufo.openFoldsExceptKinds, { desc = "Open fold" } }, { 'zr', ufo.openFoldsExceptKinds, { desc = 'Open fold' } },
{ 'zm', ufo.closeFoldsWith, { desc = "Close fold" } }, { 'zm', ufo.closeFoldsWith, { desc = 'Close fold' } },
} }
end, end,
opts = function () opts = function()
local handler = function (virtText, lnum, endLnum, width, truncate) local handler = function(virtText, lnum, endLnum, width, truncate)
local newVirtText = {} local newVirtText = {}
local suffix = (' 󰁂 %d '):format(endLnum - lnum) local suffix = (' 󰁂 %d '):format(endLnum - lnum)
local sufWidth = vim.fn.strdisplaywidth(suffix) local sufWidth = vim.fn.strdisplaywidth(suffix)
@ -61,11 +134,11 @@ return {
else else
chunkText = truncate(chunkText, targetWidth - curWidth) chunkText = truncate(chunkText, targetWidth - curWidth)
local hlGroup = chunk[2] local hlGroup = chunk[2]
table.insert(newVirtText, {chunkText, hlGroup}) table.insert(newVirtText, { chunkText, hlGroup })
chunkWidth = vim.fn.strdisplaywidth(chunkText) chunkWidth = vim.fn.strdisplaywidth(chunkText)
-- str width returned from truncate() may less than 2nd argument, need padding -- str width returned from truncate() may less than 2nd argument, need padding
if curWidth + chunkWidth < targetWidth then if curWidth + chunkWidth < targetWidth then
suffix = suffix .. (' '):rep(targetWidth - curWidth - chunkWidth) suffix = suffix .. (' '):rep(targetWidth - curWidth - chunkWidth)
end end
break break
end end
@ -77,64 +150,88 @@ return {
return { return {
fold_virt_text_handler = handler, fold_virt_text_handler = handler,
provider_selector = function (_, _, _) provider_selector = function(_, _, _)
return { 'treesitter', 'indent' } return { 'treesitter', 'indent' }
end end,
} }
end, end,
}, },
{ {
'stevearc/oil.nvim', 'stevearc/oil.nvim',
dependencies = { "nvim-tree/nvim-web-devicons" }, dependencies = { 'nvim-tree/nvim-web-devicons' },
keys = { keys = {
{ '-', '<cmd>Oil<cr>', desc = "Open parent directory" }, { '-', '<cmd>Oil<cr>', desc = 'Open parent directory' },
}, },
opts = {}, opts = {},
}, },
{
'vhyrro/luarocks.nvim',
priority = 1000,
config = true,
},
{ {
'rest-nvim/rest.nvim', 'rest-nvim/rest.nvim',
dependencies = { 'nvim-lua/plenary.nvim' }, dependencies = { 'luarocks.nvim' },
ft = { ft = {
'http', 'http',
'rest' 'rest',
}, },
opts = { config = function()
result_split_horizontal = false, require('rest-nvim').setup {
result_split_in_place = false, client = 'curl',
skip_ssl_verification = false, custom_dynamic_variables = {},
encode_url = true, 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', env_file = '.env',
custom_dynamic_variables = { }, skip_ssl_verification = false,
yank_dry_run = true 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 () keys = function()
local status_ok, which_key = pcall(require, 'which-key') local status_ok, which_key = pcall(require, 'which-key')
if status_ok then if status_ok then
which_key.register({ which_key.register {
['<leader>t'] = { name = 'Res[t]', _ = 'which_key_ignore' } ['<leader>t'] = { name = 'Res[t]', _ = 'which_key_ignore' },
}) }
end end
return { return {
{ '<leader>tr', '<Plug>RestNvim', desc = 'Run the request under cursor' }, { '<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', '<Plug>RestNvimLast', desc = 'Re-run the last request' } '<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 end,
}, },
{ {
'akinsho/toggleterm.nvim', 'akinsho/toggleterm.nvim',
@ -142,22 +239,22 @@ return {
size = vim.o.lines * 0.75, size = vim.o.lines * 0.75,
open_mapping = [[<c-\>]], open_mapping = [[<c-\>]],
hide_numbers = true, hide_numbers = true,
shade_filetypes = { }, shade_filetypes = {},
shade_terminals = true, shade_terminals = true,
shading_factor = 2, shading_factor = 2,
direction = 'horizontal', direction = 'horizontal',
shell = vim.o.shell, shell = vim.o.shell,
}, },
keys = function () keys = function()
local status_ok, which_key = pcall(require, 'which-key') local status_ok, which_key = pcall(require, 'which-key')
if status_ok then if status_ok then
which_key.register({ which_key.register {
['<leader>m'] = { name = 'Toggle ter[m]inal', _ = 'which_key_ignore' } ['<leader>m'] = { name = 'Toggle ter[m]inal', _ = 'which_key_ignore' },
}) }
end end
vim.api.nvim_create_autocmd('TermOpen', { vim.api.nvim_create_autocmd('TermOpen', {
group = vim.api.nvim_create_augroup('kickstart-custom-term-open-mapping', { clear = true }), group = vim.api.nvim_create_augroup('kickstart-custom-term-open-mapping', { clear = true }),
callback = function (args) callback = function(args)
local bufnr = args.buf local bufnr = args.buf
local opts = { buffer = bufnr } local opts = { buffer = bufnr }
vim.keymap.set('t', '<esc>', [[<C-\><C-n>]], opts) vim.keymap.set('t', '<esc>', [[<C-\><C-n>]], opts)
@ -167,13 +264,28 @@ return {
vim.keymap.set('t', '<C-k>', [[<cmd>wincmd k<cr>]], opts) 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-l>', [[<cmd>wincmd l<cr>]], opts)
vim.keymap.set('t', '<C-w>', [[<C-\><C-n><C-w>]], opts) vim.keymap.set('t', '<C-w>', [[<C-\><C-n><C-w>]], opts)
end end,
}) })
return { 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>mh',
{ '<leader>mc', '<cmd>ToggleTermSendCurrentLine<cr>', desc = 'Send [c]urrent line under the cursor', noremap = true } '<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 end,
}, },
} }

View File

@ -55,7 +55,9 @@ unbind r
bind r source-file ~/.config/tmux/tmux.conf\; display "Reloaded conf." bind r source-file ~/.config/tmux/tmux.conf\; display "Reloaded conf."
# Full color for vim # 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) #### COLOUR (Solarized 256)

View File

@ -9,8 +9,10 @@ services:
entrypoint: sleep entrypoint: sleep
command: infinity command: infinity
volumes: 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/mise:/home/coder/.config/mise'
- './config/nvim/lua/custom:/home/coder/.config/nvim/lua/custom'
- './config/starship:/home/coder/.config/starship' - './config/starship:/home/coder/.config/starship'
- './config/tmux:/home/coder/.config/tmux' - './config/tmux:/home/coder/.config/tmux'
- './config/tmuxp:/home/coder/.config/tmuxp' - './config/tmuxp:/home/coder/.config/tmuxp'

View File

@ -1,175 +1,165 @@
diff --git a/init.lua b/init.lua diff --git a/init.lua b/init.lua
index fd4567d..236fb97 100644 index 013fcc2..ca98546 100644
--- a/init.lua --- a/init.lua
+++ b/init.lua +++ b/init.lua
@@ -200,19 +200,19 @@ require('lazy').setup({ @@ -91,7 +91,7 @@ vim.g.mapleader = ' '
}, vim.g.maplocalleader = ' '
},
- { -- Set to true if you have a Nerd Font installed
- -- Theme inspired by Atom -vim.g.have_nerd_font = false
- 'navarasu/onedark.nvim', +vim.g.have_nerd_font = true
- 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 ]] -- [[ Setting options ]]
@@ -292,11 +292,12 @@ require('lazy').setup({ -- See `:help vim.opt`
-- Set highlight on search @@ -102,10 +102,10 @@ vim.g.have_nerd_font = false
vim.o.hlsearch = 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 --- Enable mouse mode, can be useful for resizing splits for example!
+-- Make relative line numbers default -vim.opt.mouse = 'a'
vim.wo.number = true
+vim.wo.relativenumber = true
--- Enable mouse mode
-vim.o.mouse = 'a'
+-- Disable mouse mode +-- Disable mouse mode
+vim.o.mouse = '' +vim.opt.mouse = ''
-- Sync clipboard between OS and Neovim. -- Don't show the mode, since it's already in the status line
-- Remove this option if you want your OS clipboard to remain independent. vim.opt.showmode = false
@@ -326,6 +327,14 @@ vim.o.completeopt = 'menuone,noselect' @@ -154,6 +154,14 @@ vim.opt.cursorline = true
-- NOTE: You should make sure your terminal supports this -- Minimal number of screen lines to keep above and below the cursor.
vim.o.termguicolors = true vim.opt.scrolloff = 10
+-- Set foldmethod +-- Set foldmethod
+-- See `:help foldmethod` +-- See `:help foldmethod`
+vim.o.foldcolumn = '1' +vim.opt.foldcolumn = '1'
+vim.o.foldlevel = 99 +vim.opt.foldlevel = 99
+vim.o.foldlevelstart = 99 +vim.opt.foldlevelstart = 99
+vim.o.foldenable = true +vim.opt.foldenable = true
+vim.o.fillchars = [[eob: ,fold: ,foldopen:,foldsep: ,foldclose:]] +vim.opt.fillchars = [[eob: ,fold: ,foldopen:,foldsep: ,foldclose:]]
+ +
-- [[ Basic Keymaps ]] -- [[ Basic Keymaps ]]
-- See `:help vim.keymap.set()`
-- Keymaps for better default experience @@ -283,6 +291,7 @@ require('lazy').setup({
@@ -439,8 +448,31 @@ vim.keymap.set('n', '<leader>sr', require('telescope.builtin').resume, { desc = require('which-key').register {
vim.defer_fn(function() ['<leader>c'] = { name = '[C]ode', _ = 'which_key_ignore' },
require('nvim-treesitter.configs').setup { ['<leader>d'] = { name = '[D]ocument', _ = 'which_key_ignore' },
-- Add languages to be installed here that you want installed for treesitter + ['<leader>h'] = { name = 'Git [h]unk', _ = 'which_key_ignore' },
- ensure_installed = { 'c', 'cpp', 'go', 'lua', 'python', 'rust', 'tsx', 'javascript', 'typescript', 'vimdoc', 'vim', 'bash' }, ['<leader>r'] = { name = '[R]ename', _ = 'which_key_ignore' },
- ['<leader>s'] = { name = '[S]earch', _ = 'which_key_ignore' },
+ ensure_installed = { ['<leader>w'] = { name = '[W]orkspace', _ = 'which_key_ignore' },
+ 'css', @@ -551,6 +560,18 @@ require('lazy').setup({
+ 'dockerfile', -- tsserver = {},
+ '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 = {},
}
-- Setup neovim lua configuration + elixirls = {
@@ -619,12 +660,25 @@ mason_lspconfig.setup { + 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 { -- Ensure the servers and tools above are installed
function(server_name) @@ -591,6 +616,33 @@ require('lazy').setup({
- require('lspconfig')[server_name].setup { -- by the server configuration above. Useful when disabling
+ local opts = { -- certain features of an LSP (for example, turning off formatting for tsserver)
capabilities = capabilities, server.capabilities = vim.tbl_deep_extend('force', {}, capabilities, server.capabilities or {})
on_attach = on_attach, + -- overwrite elixirls for older versions of elixir
settings = servers[server_name], + -- * elixir 1.11 use version 0.12.0
filetypes = (servers[server_name] or {}).filetypes, + -- * elixir 1.12 use verions 0.14.6
} + if server_name == 'elixirls' then
+ if server_name == 'elixirls' then + local version = vim.fn.system('mise current elixir') or ''
+ local version = vim.fn.system('mise current elixir') or '' + local elixir_servers = {
+ local elixir_servers = { + { version = '^1.11', path = '/elixir-ls/release/v0.12.0/language_server.sh' },
+ { 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' },
+ { version = '^1.12', path = '/elixir-ls/release/v0.14.6/language_server.sh' }, + }
+ } + for _, ex_server in ipairs(elixir_servers) do
+ for _, server in ipairs(elixir_servers) do + if string.match(version, ex_server.version) == nil then goto continue end
+ if string.match(version, server.version) == nil then goto continue end + server = vim.tbl_extend('keep', server, { cmd = { vim.fn.expand('$LOCAL_SRC_HOME') .. ex_server.path } })
+ opts = vim.tbl_extend('keep', opts, { cmd = { vim.fn.expand('$LOCAL_SRC_HOME') .. server.path } }) + ::continue::
+ ::continue:: + end
+ end + elseif server_name == 'pyright' then
+ end + local python_paths = {
+ require('lspconfig')[server_name].setup(opts) + { name = 'poetry', cmd = { 'poetry', 'env', 'info', '--executable' }},
end, + { 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

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