Update scripts, nvim, etc.

This commit is contained in:
tosu 2024-02-01 00:22:43 +01:00
parent 15777f7160
commit 21ecd8c1d6
7 changed files with 50 additions and 14 deletions

44
.bashrc
View File

@ -95,7 +95,7 @@ alias aptclean='sudo apt -y update && sudo apt -y full-upgrade &&
alias pacman='pacman --color=auto' alias pacman='pacman --color=auto'
alias pcker='nvim "${HOME-}"/.config/nvim/lua/*' alias pcker='nvim "${HOME-}"/.config/nvim/lua/*'
alias after='nvim "${HOME-}"/.config/nvim/after/plugin' alias after='nvim "${HOME-}"/.config/nvim/after/plugin'
alias l='\ls --width="${COLUMNS:-80}" --sort=time --time=mtime --time-style=long-iso -bharZ1l' alias l='\ls --width="${COLUMNS:-80}" --sort=time --time=mtime --color=auto --time-style=long-iso -bharZ1l'
# alias l='lsd --timesort --color=auto -harZ1l' # alias l='lsd --timesort --color=auto -harZ1l'
alias ll='\ls --width="${COLUMNS:-80}" --sort=time --time=mtime --color=auto --fu -bharZ1l' alias ll='\ls --width="${COLUMNS:-80}" --sort=time --time=mtime --color=auto --fu -bharZ1l'
alias ls='\ls --width="${COLUMNS:-80}" --color=auto -bC' alias ls='\ls --width="${COLUMNS:-80}" --color=auto -bC'
@ -136,6 +136,8 @@ function cd () {
1>/dev/null command cd - || return 1 1>/dev/null command cd - || return 1
1>/dev/null pushd "${pwd}" || return 1 1>/dev/null pushd "${pwd}" || return 1
} }
CDPATH="${CDPATH}:${HOME}"
CDPATH="${CDPATH}:${HOME}/projects" CDPATH="${CDPATH}:${HOME}/projects"
CDPATH="${CDPATH}:${HOME}/projects/aoc" CDPATH="${CDPATH}:${HOME}/projects/aoc"
CDPATH="${CDPATH}:${HOME}/projects/aoc/2023" CDPATH="${CDPATH}:${HOME}/projects/aoc/2023"
@ -239,7 +241,7 @@ function norminette () {
local newst local newst
vers="$($(type -P norminette) -v | cut -d" " -f2)" vers="$($(type -P norminette) -v | cut -d" " -f2)"
newst='3.3.53' newst='3.3.55'
if [ ! "${vers-}" = "${newst-}" ] ; then if [ ! "${vers-}" = "${newst-}" ] ; then
printf "%s\n%b\n" "Norminette v${vers-} instead of v${newst-} detected."\ printf "%s\n%b\n" "Norminette v${vers-} instead of v${newst-} detected."\
'\033[31mPlease up-/downgrade\033[m' '\033[31mPlease up-/downgrade\033[m'
@ -494,29 +496,47 @@ aocload () {
command cat <<- TEMPLATE >> './solution.py' command cat <<- TEMPLATE >> './solution.py'
#!/usr/bin/env python3 #!/usr/bin/env python3
print()
import os
import re import re
import sys import sys
import math import math
import multiprocessing as mp
from copy import copy, deepcopy
from typing import Any
import numpy as np import numpy as np
import more_itertools as miter
from functools import cache, lru_cache, reduce from functools import cache, lru_cache, reduce
from collections import deque, defaultdict, Counter
from itertools import ( from itertools import (
repeat, cycle, combinations, combinations_with_replacement, repeat, cycle, combinations, combinations_with_replacement,
permutations, tee, pairwise, zip_longest, islice, takewhile, permutations, tee, pairwise, zip_longest, islice, takewhile,
filterfalse, starmap filterfalse, starmap
) )
from collections import deque, defaultdict, Counter
e=enumerate e=enumerate
def pairs(iterable, filler=None):
a, b = tee(iterable)
next(b, None)
return islice(zip(a, b), None, None, 2))
data = open(0).read().strip().splitlines()
R = len(data)
C = len(data[0])
def parse_grid(data: list[str]) -> Any:
for r in range(R):
for c in range(C):
pass
def parse_lines(data: list[str]) -> Any:
for line in data:
line = line.split()
def parse_line(data: list[str]) -> Any:
return data[0].split()
# data = parse_line(data)
# data = parse_lines(data)
data = parse_grid(data)
data = open(0).read().strip() t = 0
lines = data.splitlines() for line in data:
n = 0
for line in lines: t += n
line = line.split() print(t)
TEMPLATE TEMPLATE
fi fi

View File

@ -52,7 +52,7 @@ render_timer = false
TERM = "xterm-256color" TERM = "xterm-256color"
[font] [font]
size = 11.0 size = 12.0
[font.bold] [font.bold]
family = "IosevkaTerm Nerd Font" family = "IosevkaTerm Nerd Font"

View File

@ -4,3 +4,6 @@ vim.keymap.set('n', '<C-p>', builtin.git_files, {})
vim.keymap.set('n', '<leader>ps', function() vim.keymap.set('n', '<leader>ps', function()
builtin.grep_string({ search = vim.fn.input("Grep: ") }) builtin.grep_string({ search = vim.fn.input("Grep: ") })
end) end)
vim.keymap.set('n', '<leader>pw', function()
builtin.grep_string({ search = vim.fn.expand("<cword>") })
end)

View File

@ -21,4 +21,12 @@ require 'nvim-treesitter.configs'.setup {
-- Instead of true it can also be a list of languages -- Instead of true it can also be a list of languages
additional_vim_regex_highlighting = false, additional_vim_regex_highlighting = false,
}, },
incremental_selection = {
enable = true,
keymaps = {
node_incremental = "v",
node_decremental = "V",
},
},
} }

View File

@ -48,3 +48,6 @@ vim.keymap.set("n", "<leader>c", "mz:s/\\(^\\s*\\)\\(.*$\\)/\\1\\/* \\2 *\\//g<C
vim.keymap.set("n", "<leader>C", "mz:s/\\/\\* \\(.*\\) \\*\\//\\1/g<CR>:noh<CR>`z") vim.keymap.set("n", "<leader>C", "mz:s/\\/\\* \\(.*\\) \\*\\//\\1/g<CR>:noh<CR>`z")
vim.keymap.set("v", "<leader>c", "mz:s/\\(^\\s*\\)\\(.*$\\)/\\1\\/* \\2 *\\//g<CR>:noh<CR>`z") vim.keymap.set("v", "<leader>c", "mz:s/\\(^\\s*\\)\\(.*$\\)/\\1\\/* \\2 *\\//g<CR>:noh<CR>`z")
vim.keymap.set("v", "<leader>C", "mz:s/\\/\\* \\(.*\\) \\*\\//\\1/g<CR>:noh<CR>`z") vim.keymap.set("v", "<leader>C", "mz:s/\\/\\* \\(.*\\) \\*\\//\\1/g<CR>:noh<CR>`z")
vim.fn.setreg("t", "m5`1v`2y`3v`4p`1v`2p`5")
vim.keymap.set("n", "<C-t>", "m3yiwi<CR> <C-w><ESC>m2`1bviwp`2viwp`2i<BS><ESC>`3")

View File

@ -27,7 +27,8 @@ vim.opt.incsearch = true
vim.opt.termguicolors = true vim.opt.termguicolors = true
vim.opt.scrolloff = 5 -- vim.opt.scrolloff = 5
vim.opt.scrolloff = 0
vim.opt.signcolumn = 'yes' vim.opt.signcolumn = 'yes'
vim.opt.isfname:append('@-@') vim.opt.isfname:append('@-@')

View File

@ -15,6 +15,7 @@
conflictsstyle = diff3 conflictsstyle = diff3
[core] [core]
autocrlf = input autocrlf = input
editor = nvim
[alias] [alias]
l = log l = log
s = status s = status