diff --git a/.config/i3/config b/.config/i3/config index 7b4e999..0fa5741 100644 --- a/.config/i3/config +++ b/.config/i3/config @@ -46,7 +46,8 @@ bindsym XF86AudioMicMute exec --no-startup-id pactl set-source-mute @DEFAULT_SOU # set $left j # set $right semicolon -# Use winkey +# Use caps +exec setxkbmap -option caps:super set $mod Mod4 # use Mouse+Mod1 to drag floating windows to their wanted position @@ -66,7 +67,7 @@ bindsym $mod+n exec kitty -- fzf-launcher && exit bindsym $mod+q kill # Enable compose key with caps lock -exec setxkbmap -option compose:caps +# exec setxkbmap -option compose:caps # start dmenu (a program launcher) # bindsym $mod+d exec --no-startup-id dmenu_run @@ -100,6 +101,10 @@ bindsym $mod+Shift+Down move down bindsym $mod+Shift+Up move up bindsym $mod+Shift+Right move right +# move workspace +bindsym $mod+Ctrl+Right move workspace to output right +bindsym $mod+Ctrl+Left move workspace to output left + # split in horizontal orientation bindsym $mod+h split h @@ -213,6 +218,15 @@ bar { status_command i3status } +# Wallpaper +# exec --no-startup-id feh --bg-scale /home/anton/bg.png +# exec --no-startup-id mpv wallpaper.mp4 --loop --no-audio --no-media-controls +# exec --no-startup-id xinwrap -g 1920x1080 -ni -s -nf -b -fs -- mpv -wid WID wallpaper.mp4 --loop --no-audio --no-media-controls +exec --no-startup-id xwinwrap -g 1920x1080 -s -b -fdt -ni -sp -ov -- mpv wallpaper.mp4 -wid WID --loop --no-audio --gpu-api=vulkan +exec --no-startup-id xwinwrap -g 1920x1080+1920 -s -b -fdt -ni -sp -ov -- mpv wallpaper.mp4 -wid WID --loop --no-audio --gpu-api=vulkan + +exec --no-startup-id ~/.config/i3/startup.sh + ####################################################################### # automatically start i3-config-wizard to offer the user to create a # keysym-based config which used their favorite modifier (alt or windows) @@ -223,4 +237,4 @@ bar { # # Please remove the following exec line: ####################################################################### -exec i3-config-wizard +# exec i3-config-wizard diff --git a/.config/kitty/current-theme.conf b/.config/kitty/current-theme.conf index b93d4a8..d55fbb6 100644 --- a/.config/kitty/current-theme.conf +++ b/.config/kitty/current-theme.conf @@ -1,32 +1,24 @@ -## name: Gruvbox Dark -## author: Pavel Pertsev -## license: MIT/X11 -## upstream: https://raw.githubusercontent.com/gruvbox-community/gruvbox-contrib/master/kitty/gruvbox-dark.conf -selection_foreground #ebdbb2 -selection_background #d65d0e +background #161718 +foreground #b7bcb9 -background #282828 -foreground #ebdbb2 +cursor #b7bcb9 +selection_background #1e1f22 +color0 #2a2e33 +color8 #1d1e21 +color1 #b74d50 +color9 #8c2d32 +color2 #b3be5a +color10 #788331 +color3 #e3b55e +color11 #e5894f +color4 #6d90b0 +color12 #4b6b88 +color5 #a07eab +color13 #6e4f79 +color6 #7fbeb3 +color14 #4d7b73 +color7 #b5b8b6 +color15 #5a6169 -color0 #3c3836 -color1 #cc241d -color2 #98971a -color3 #d79921 -color4 #458588 -color5 #b16286 -color6 #689d6a -color7 #a89984 -color8 #928374 -color9 #fb4934 -color10 #b8bb26 -color11 #fabd2f -color12 #83a598 -color13 #d3869b -color14 #8ec07c -color15 #fbf1c7 - -cursor #bdae93 -cursor_text_color #665c54 - -url_color #458588 +selection_foreground #161718 \ No newline at end of file diff --git a/.config/kitty/kitty.conf b/.config/kitty/kitty.conf index 16fd757..3fc6864 100644 --- a/.config/kitty/kitty.conf +++ b/.config/kitty/kitty.conf @@ -24,7 +24,7 @@ bold_italic_font JetBrains Mono Bold Italic #: italic_font Operator Mono Book Italic #: bold_italic_font Operator Mono Medium Italic -font_size 12 +font_size 18 #: Font size (in pts). @@ -296,7 +296,7 @@ disable_ligatures never #: The thickness of the underline cursor (in pts). -cursor_blink_interval 0.5 +cursor_blink_interval 0.5 ease-in-out #: The interval to blink the cursor (in seconds). Set to zero to #: disable blinking. Negative values mean use system default. Note diff --git a/.config/nvim/init.lua b/.config/nvim/init.lua index 9f75e1d..4dd42f1 100644 --- a/.config/nvim/init.lua +++ b/.config/nvim/init.lua @@ -18,7 +18,6 @@ vim.opt.rtp:prepend(lazypath) require('BluePlum.set') require('BluePlum.keymap') require('BluePlum.neovide') -require('BluePlum.utility') require('lazy').setup({ -- Plugins @@ -30,3 +29,4 @@ require('lazy').setup({ }) require('lsp') +require('BluePlum.input') diff --git a/.config/nvim/lazy-lock.json b/.config/nvim/lazy-lock.json index 8a8d90b..2897c1c 100644 --- a/.config/nvim/lazy-lock.json +++ b/.config/nvim/lazy-lock.json @@ -16,6 +16,7 @@ "markview.nvim": { "branch": "main", "commit": "67b69cdaf9055bebac3682a070d7e5c8eecba29c" }, "mason-lspconfig.nvim": { "branch": "main", "commit": "25c11854aa25558ee6c03432edfa0df0217324be" }, "mason.nvim": { "branch": "main", "commit": "e2f7f9044ec30067bc11800a9e266664b88cda22" }, + "neoscroll.nvim": { "branch": "master", "commit": "81c47f9d111c00d13111b65bfd13cc81b7b347a1" }, "nvim-cmp": { "branch": "main", "commit": "ae644feb7b67bf1ce4260c231d1d4300b19c6f30" }, "nvim-colorizer.lua": { "branch": "master", "commit": "a065833f35a3a7cc3ef137ac88b5381da2ba302e" }, "nvim-lspconfig": { "branch": "master", "commit": "ff69ecca55d83ffc70657f260a799f79a5637831" }, @@ -26,6 +27,7 @@ "plenary.nvim": { "branch": "master", "commit": "2d9b06177a975543726ce5c73fca176cedbffe9d" }, "promise-async": { "branch": "main", "commit": "119e8961014c9bfaf1487bf3c2a393d254f337e2" }, "rustaceanvim": { "branch": "master", "commit": "d1f56672638508a7bc971cde31a29df4018579a9" }, + "smear-cursor.nvim": { "branch": "main", "commit": "78c42170f9326fb70d09aff2184c81189eddf144" }, "telescope.nvim": { "branch": "master", "commit": "df534c3042572fb958586facd02841e10186707c" }, "todo-comments.nvim": { "branch": "main", "commit": "ae0a2afb47cf7395dc400e5dc4e05274bf4fb9e0" } } diff --git a/.config/nvim/lua/BluePlum/input.lua b/.config/nvim/lua/BluePlum/input.lua new file mode 100644 index 0000000..055f186 --- /dev/null +++ b/.config/nvim/lua/BluePlum/input.lua @@ -0,0 +1,248 @@ +local M = { + interupt = false, +} + +M.Keys = { + enter = '', + tab = '', + backspace = '', + escape = '', + + -- if await_key().is_arrow + -- if key == Keys.left + left = { is_arrow = true, this = '' }, + right = { is_arrow = true, this = '' }, + up = { is_arrow = true, this = '' }, + down = { is_arrow = true, this = '' }, +} + +function M.await_key() + -- local char = vim.fn.getchar() + local char = vim.fn.getchar() + local num = vim.fn.nr2char(char) + local key = vim.fn.keytrans(num) + -- vim.print(char, num, key, key == '') + + -- Some special keys work weird.. + local is_key = function(key) + return pcall(function(char) + if vim.fn.keytrans(char) ~= key then + error() + end + end, char) + end + + if is_key('') then + return M.Keys.backspace + elseif is_key('') then + return M.Keys.left + elseif is_key('') then + return M.Keys.right + elseif is_key('') then + return M.Keys.up + elseif is_key('') then + return M.Keys.down + elseif key == '' then + return ' ' + elseif key == '' then + return '<' + elseif key == '' then + return '>' + end + + return key +end + +-- vim.print(vim.fn.getcompletion('ech', 'command')) +-- vim.fn.getchar() + +local function refresh_completions(pattern, kind) + local completions = vim.fn.getcompletion(pattern, kind) + + if #completions > 25 then + local new = {} + for i = 1, 25 do + new[i] = completions[i] + end + new[#new + 1] = '...' -- Append truncation indicator + return new + end + + return completions +end + +local function format_completions(completions) + local formatted = { { '{', 'Normal' } } + for i = 1, #completions do + table.insert(formatted, { completions[i], i == 1 and 'CursorLineNr' or 'Normal' }) + if i ~= #completions then + table.insert(formatted, { ', ', 'Normal' }) + end + end + table.insert(formatted, { '}', 'Normal' }) + return formatted +end + +local function input(prompt, default, completion) + vim.validate({ + prompt = { prompt, 'table' }, + default = { default, { 'string', 'nil' } }, + completion = { completion, { 'string', 'nil' } }, + }) + local using_default = default ~= nil + local typed = default or '' + + local completions = {} + + local cursor = 0 + + while true do + if completion ~= nil then + completions = refresh_completions(typed, completion) + end + + vim.cmd('echo | redraw') + vim.api.nvim_echo({ + unpack(prompt), + { string.sub(typed, 0, cursor), using_default and 'Visual' or 'Normal' }, + cursor == #typed and { '█', 'CursorLineNr' } or { string.sub(typed, cursor + 1, cursor + 1), 'Search' }, + { string.sub(typed, cursor + 2), 'Normal' }, + unpack(#completions > 0 and format_completions(completions) or {}), + }, false, {}) + local input = M.await_key() + + if input == M.Keys.enter or input == M.Keys.escape then + vim.cmd('echo | redraw') + return input == M.Keys.enter, typed + elseif input == M.Keys.backspace then + if cursor <= 0 then + goto continue + end + typed = string.sub(typed, 0, cursor - 1) .. string.sub(typed, cursor + 1) + cursor = cursor - 1 + goto continue + elseif input.is_arrow then + if input == M.Keys.left then + if cursor > 0 then + cursor = cursor - 1 + end + elseif input == M.Keys.right then + if cursor < #typed then + cursor = cursor + 1 + end + end + -- vim.api.nvim_win_set_cursor(0, { 1, 10 }) + goto continue + elseif input == M.Keys.tab then + if #completions == 0 then + goto continue + end + cursor = #typed + + local insert = completions[1] + local offset = #typed + + -- Find the largest overlapping slice + while offset > 0 and not vim.startswith(insert, string.sub(typed, -offset)) do + offset = offset - 1 + end + + -- Replace `typed` with the completion + typed = string.sub(typed, 1, #typed - offset) .. insert .. ' ' + cursor = #typed + goto continue + end + + typed = string.sub(typed, 0, cursor) .. input .. string.sub(typed, cursor + 1) + cursor = cursor + 1 + + ::continue:: + end +end + +-- Safe wrapper for hiding the cursor (also captures ) +function M.input(prompt, default, completion) + local hl = vim.api.nvim_get_hl(0, { name = 'Cursor' }) + + hl.blend = 100 + vim.api.nvim_set_hl(0, 'Cursor', hl) + + -- local result, success, typed = pcall(input, prompt, defaut, completion) + local success, typed = input(prompt, default, completion) + vim.cmd('echo | redraw') + + hl.blend = 0 + vim.api.nvim_set_hl(0, 'Cursor', hl) + + return success, typed, not result +end + +---@param opts? table +---@param on_confirm function +vim.ui.input = function(opts, on_confirm) + vim.validate({ + opts = { opts, 'table' }, + on_confirm = { on_confirm, 'function' }, + }) + + opts = opts or {} + on_confirm = on_confirm or function() end + + vim.validate({ + -- Also supports list of HlGroup tuples + prompt = { opts.prompt, { 'table', 'string', 'nil' } }, + + default = { opts.default, { 'string', 'nil' } }, + completion = { opts.completion, { 'string', 'nil' } }, + + highlight = { + opts.highlight, + function(it) + return it == nil + end, + 'nil (not supported)', + }, + }) + + local prompt = opts.prompt or { { 'Enter input > ', 'Question' } } + if type(prompt) == 'string' then + -- Strip invalid characters + prompt = vim.trim(prompt) + + local is_alpha = function(char) + local num = vim.fn.char2nr(char) + return (num >= 65 and num <= 90) or (num >= 97 and num <= 122) + end + + local last = string.sub(prompt, #prompt) + while not is_alpha(last) do + prompt = string.sub(prompt, 0, #prompt - 1) + prompt = vim.trim(prompt) + last = string.sub(prompt, #prompt) + end + + prompt = { { prompt .. ' > ', 'Question' } } + end + + local finished, typed, interrupted = M.input(prompt, opts.default, opts.completion) + if interrupted then + return + end + on_confirm(finished and typed or nil) +end + +-- vim.ui.input({ completion = 'cmdline' }, function(a) +-- vim.print(a) +-- end) + +-- vim.keymap.set('n', ';', function() +-- vim.ui.input({ prompt = { { ':', 'Normal' } }, completion = 'cmdline' }, function(command) +-- vim.print(command) +-- if command then +-- vim.cmd(command) +-- end +-- end) +-- end) +-- add cmdheight to the input function + +return M diff --git a/.config/nvim/lua/BluePlum/keymap.lua b/.config/nvim/lua/BluePlum/keymap.lua index f7e0602..f3119b4 100644 --- a/.config/nvim/lua/BluePlum/keymap.lua +++ b/.config/nvim/lua/BluePlum/keymap.lua @@ -35,9 +35,10 @@ vim.keymap.set( -- Help vim.cmd.cnoreabbrev('h vert h') +vim.keymap.set('n', 'h', ':h ') -- Windows -vim.keymap.set('n', 'k', function() +vim.keymap.set('n', 'q', function() if vim.bo.modified then if Confirm('Buffer has unsaved changes; write?') then vim.cmd.write() @@ -51,13 +52,7 @@ vim.keymap.set('n', 'k', function() end) -- Comp mode -vim.keymap.set('n', 's', function() -- s: start - local command = Input('Enter compilation command > ', vim.g.last_compile_command) - if command then - vim.g.last_compile_command = command - vim.cmd.Compile(command) - end -end) +vim.keymap.set('n', 'c', ':Compile') +vim.keymap.set('n', 'cs', ':CompileInterrupt') vim.keymap.set('n', 'E', ':NextError') -vim.keymap.set('n', 'S', ':Recompile') diff --git a/.config/nvim/lua/BluePlum/set.lua b/.config/nvim/lua/BluePlum/set.lua index 99ce8d2..0a2410b 100644 --- a/.config/nvim/lua/BluePlum/set.lua +++ b/.config/nvim/lua/BluePlum/set.lua @@ -38,3 +38,7 @@ vim.api.nvim_create_autocmd('FileType', { pattern = 'help', command = 'setlocal linebreak', }) + +-- Search +vim.opt.hlsearch = false +vim.opt.incsearch = true diff --git a/.config/nvim/lua/BluePlum/utility.lua b/.config/nvim/lua/BluePlum/utility.lua index a9fc9ed..9dea39d 100644 --- a/.config/nvim/lua/BluePlum/utility.lua +++ b/.config/nvim/lua/BluePlum/utility.lua @@ -1,53 +1,69 @@ -function Ask(msg) - vim.cmd.echohl('Question') - vim.cmd.echo('"' .. msg .. '"') - vim.cmd.echohl() -end +local M = {} -function Confirm(msg) - Ask(msg .. ' [Y/n] ') +return M - local answer = vim.fn.getchar() - return answer ~= 110 and answer ~= 27 and answer ~= 37 -- 'n', , -end - -function Input(prompt, last) - local buffer = '' - while true do - vim.cmd('redraw | echo') - vim.api.nvim_echo({ - { prompt, 'Question' }, - last and { last, 'Visual' } or { buffer, 'Normal' }, - }, false, {}) - - local character = vim.fn.getchar() - if pcall(function(char) - if vim.fn.keytrans(char) ~= '' then - error() - end - end, character) then - last = nil - buffer = vim.fn.slice(buffer, 0, -1) - elseif character == 27 then - vim.cmd('redraw | echo') - return nil - elseif character == 13 then - return last or buffer - elseif - (character == 32 or pcall(function(char) - if vim.fn.keytrans(char) ~= '' then - error() - end - end, character)) and last - then - buffer = last - if character == 32 then - buffer = buffer .. ' ' - end - last = nil - else - last = nil - buffer = buffer .. vim.fn.nr2char(character) - end - end -end +-- function Ask(msg) +-- vim.cmd.echohl('Question') +-- vim.cmd.echo('"' .. msg .. '"') +-- vim.cmd.echohl() +-- end +-- +-- function Confirm(msg) +-- Ask(msg .. ' [Y/n] ') +-- +-- local answer = vim.fn.getchar() +-- return answer ~= 110 and answer ~= 27 and answer ~= 37 -- 'n', , +-- end +-- +-- function Input(prompt, last) +-- local buffer = '' +-- while true do +-- vim.cmd('redraw | echo') +-- vim.api.nvim_echo({ +-- { prompt, 'Question' }, +-- last and { last, 'Visual' } or { buffer, 'Normal' }, +-- }, false, {}) +-- +-- local character = vim.fn.getchar() +-- if pcall(function(char) +-- if vim.fn.keytrans(char) ~= '' then +-- error() +-- end +-- end, character) then +-- last = nil +-- buffer = vim.fn.slice(buffer, 0, -1) +-- elseif character == 27 then +-- vim.cmd('redraw | echo') +-- return nil +-- elseif character == 13 then +-- return last or buffer +-- elseif +-- (character == 32 or pcall(function(char) +-- if vim.fn.keytrans(char) ~= '' then +-- error() +-- end +-- end, character)) and last +-- then +-- buffer = last +-- if character == 32 then +-- buffer = buffer .. ' ' +-- end +-- last = nil +-- else +-- last = nil +-- buffer = buffer .. vim.fn.nr2char(character) +-- end +-- end +-- end +-- +-- vim.ui.input = function(opts, after) +-- local prompt = (opts.prompt or 'Enter input') .. ' > ' +-- if prompt == 'Compile command: ' then +-- prompt = 'Enter command' +-- end +-- local last = opts.default or '' +-- +-- return (after or function(x) +-- print('Unhandled data: ' .. x) +-- end)(Input(prompt, last)) +-- end diff --git a/.config/nvim/lua/lsp.lua b/.config/nvim/lua/lsp.lua index 417866f..dc13f97 100644 --- a/.config/nvim/lua/lsp.lua +++ b/.config/nvim/lua/lsp.lua @@ -1,5 +1,3 @@ -vim = vim - local required = { 'mason', 'mason-lspconfig', 'lspconfig', 'lsp-zero', 'cmp' } local ready = true @@ -24,8 +22,21 @@ vim.cmd.echohl('None') local zero = require('lsp-zero') zero.preset('recommended') - require('mason').setup({}) + +local settings = { + ['lua_ls'] = { + Lua = { + runtime = { + version = 'LuaJIT', + }, + workspace = { + library = { vim.env.VIMRUNTIME }, + }, + }, + }, +} + require('mason-lspconfig').setup({ ensure_installed = { 'lua_ls', @@ -34,6 +45,7 @@ require('mason-lspconfig').setup({ -- zero.default_setup, function(name) require('lspconfig')[name].setup({ + settings = settings[name] or {}, capabilities = require('cmp_nvim_lsp').default_capabilities(), }) end, diff --git a/.config/nvim/lua/plugins/additions.lua b/.config/nvim/lua/plugins/additions.lua index 8a640e8..8050417 100644 --- a/.config/nvim/lua/plugins/additions.lua +++ b/.config/nvim/lua/plugins/additions.lua @@ -6,9 +6,7 @@ return { ':IncRename ', } }, config = function() - require('inc_rename').setup({ - input_buffer_type = 'dressing', - }) + require('inc_rename').setup({}) end, }, { diff --git a/.config/nvim/lua/plugins/deco.lua b/.config/nvim/lua/plugins/deco.lua index fd74b9d..cc38852 100644 --- a/.config/nvim/lua/plugins/deco.lua +++ b/.config/nvim/lua/plugins/deco.lua @@ -18,4 +18,10 @@ return { vim.api.nvim_set_hl(0, 'MarkviewLayer', { fg = '#2a2a2a', bg = '#373737' }) end, }, + { + 'sphamba/smear-cursor.nvim', + opts = { + time_interval = 10, + }, + }, } diff --git a/.config/nvim/lua/plugins/comp-mode.lua b/.config/nvim/lua/plugins/emacs.lua similarity index 64% rename from .config/nvim/lua/plugins/comp-mode.lua rename to .config/nvim/lua/plugins/emacs.lua index 7ac8664..b623e83 100644 --- a/.config/nvim/lua/plugins/comp-mode.lua +++ b/.config/nvim/lua/plugins/emacs.lua @@ -16,8 +16,31 @@ return { vim.api.nvim_set_hl(0, 'CompileModeMessageCol', { link = 'CursorLineNr' }) vim.g.compile_mode = { - baleria_setup = true, + baleia_setup = true, } end, }, + -- { + -- dir = '~/dev/s-ido', + -- name = 's-ido', + -- lazy = false, + -- dev = true, + -- opts = {}, + -- keys = { + -- { + -- '', + -- function() + -- require('s-ido.commandline').complete() + -- end, + -- mode = 'c', + -- }, + -- }, + -- }, + -- { + -- dir = '~/dev/s-nav', + -- name = 's-nav', + -- lazy = false, + -- dev = true, + -- opts = {}, + -- }, } diff --git a/.zshenv b/.zshenv new file mode 100644 index 0000000..f9cbcee --- /dev/null +++ b/.zshenv @@ -0,0 +1,6 @@ +[ -f ~/zsh/aliases.sh ] && source ~/zsh/aliases.sh +[ -f ~/zsh/functions.sh ] && source ~/zsh/functions.sh + +# Path +PATH+=":/home/anton/Rider/bin" +PATH+=":/home/anton/.cargo/bin" diff --git a/.zshrc b/.zshrc index cb4a1c6..6374d20 100644 --- a/.zshrc +++ b/.zshrc @@ -31,14 +31,15 @@ source <(fzf --zsh) zinit snippet OMZ::lib/git.zsh -[ -f ~/zsh/aliases.sh ] && source ~/zsh/aliases.sh -[ -f ~/zsh/functions.sh ] && source ~/zsh/functions.sh [ -f ~/zsh/prompt.sh ] && source ~/zsh/prompt.sh [ -f ~/zsh/completion.sh ] && source ~/zsh/completion.sh +# [ -f ~/zsh/aliases.sh ] && source ~/zsh/aliases.sh +# [ -f ~/zsh/functions.sh ] && source ~/zsh/functions.sh # Path -PATH+=":/home/anton/Rider/bin" +# PATH+=":/home/anton/Rider/bin" +# PATH+=":/home/anton/.cargo/bin" zinit ice wait'!0' @@ -49,3 +50,4 @@ zinit ice wait'!0' # Created by `pipx` on 2024-08-28 16:28:46 export PATH="$PATH:/home/anton/.local/bin" +. "/home/anton/.deno/env" diff --git a/wallpaper.mp4 b/wallpaper.mp4 new file mode 100644 index 0000000..94a8992 Binary files /dev/null and b/wallpaper.mp4 differ