1
0

pre zsh-switch backup

This commit is contained in:
2024-12-13 17:13:32 +01:00
parent 6790f75c8a
commit d0db80b911
16 changed files with 423 additions and 105 deletions

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@@ -0,0 +1,248 @@
local M = {
interupt = false,
}
M.Keys = {
enter = '<CR>',
tab = '<Tab>',
backspace = '<BS>',
escape = '<Esc>',
-- if await_key().is_arrow
-- if key == Keys.left
left = { is_arrow = true, this = '<Left>' },
right = { is_arrow = true, this = '<Right>' },
up = { is_arrow = true, this = '<Up>' },
down = { is_arrow = true, this = '<Down>' },
}
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 == '<BS>')
-- 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('<BS>') then
return M.Keys.backspace
elseif is_key('<Left>') then
return M.Keys.left
elseif is_key('<Right>') then
return M.Keys.right
elseif is_key('<Up>') then
return M.Keys.up
elseif is_key('<Down>') then
return M.Keys.down
elseif key == '<Space>' then
return ' '
elseif key == '<Lt>' then
return '<'
elseif key == '<Gt>' 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 <C-c>)
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

View File

@@ -35,9 +35,10 @@ vim.keymap.set(
-- Help
vim.cmd.cnoreabbrev('h vert h')
vim.keymap.set('n', '<leader>h', ':h <C-r><C-w><CR>')
-- Windows
vim.keymap.set('n', '<leader>k', function()
vim.keymap.set('n', '<leader>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', '<leader>k', function()
end)
-- Comp mode
vim.keymap.set('n', '<leader>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', '<leader>c<CR>', ':Compile<CR>')
vim.keymap.set('n', '<leader>cs', ':CompileInterrupt<CR>')
vim.keymap.set('n', '<leader>E', ':NextError<CR>')
vim.keymap.set('n', '<leader>S', ':Recompile<CR>')

View File

@@ -38,3 +38,7 @@ vim.api.nvim_create_autocmd('FileType', {
pattern = 'help',
command = 'setlocal linebreak',
})
-- Search
vim.opt.hlsearch = false
vim.opt.incsearch = true

View File

@@ -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', <ESC>, <SPACE>
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) ~= '<BS>' 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) ~= '<Right>' 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', <ESC>, <SPACE>
-- 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) ~= '<BS>' 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) ~= '<Right>' 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

View File

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

View File

@@ -6,9 +6,7 @@ return {
':IncRename ',
} },
config = function()
require('inc_rename').setup({
input_buffer_type = 'dressing',
})
require('inc_rename').setup({})
end,
},
{

View File

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

View File

@@ -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 = {
-- {
-- '<Tab>',
-- function()
-- require('s-ido.commandline').complete()
-- end,
-- mode = 'c',
-- },
-- },
-- },
-- {
-- dir = '~/dev/s-nav',
-- name = 's-nav',
-- lazy = false,
-- dev = true,
-- opts = {},
-- },
}