Compare commits

...

9 Commits

Author SHA1 Message Date
hedy accdb8ebdf
Update helix config 2023-12-30 18:05:44 +08:00
hedy e53edef376
misc (kitty & snippets for nvim) 2023-12-27 13:39:40 +08:00
hedy ca4788b866
Add helix 🎉 2023-12-27 13:39:14 +08:00
hedy 5d56e2f372
nvim: Update outline config 2023-11-24 16:10:56 +08:00
hedy f3544eccdf
Merge branch 'master' of git.sr.ht:~hedy/dotfiles 2023-11-23 16:29:08 +08:00
hedy 790bc93c37
Update readme 2023-11-23 16:28:26 +08:00
hedy 5bb380395d
nvim: Update outline.nvim config 2023-11-19 21:14:40 +08:00
hedy 6826b263b2
Shell(paths): Ensure local/bin has higher priority than local paths 2023-11-18 09:56:50 +08:00
hedy 8d670556c0
vim: Set number 2023-11-17 22:27:44 +08:00
13 changed files with 198 additions and 22 deletions

View File

@ -1,4 +1,3 @@
local/bin
.local/bin
.doomemacs/bin
local/src/pyenv/bin

77
.config/helix/config.toml Normal file
View File

@ -0,0 +1,77 @@
theme = "catppuccin_macchiato"
[editor]
line-number = "relative"
bufferline = "multiple"
color-modes = true
#auto-completion = false
completion-trigger-len = 1
insert-final-newline = false
scroll-lines = 1
scrolloff = 0
idle-timeout = 1000
soft-wrap.enable = true
# Features
[editor.file-picker]
hidden = false
# UI
[editor.cursor-shape]
insert = "bar"
normal = "block"
[editor.whitespace.render]
tab = "all"
nbsp = "all"
[editor.whitespace.characters]
space = "·"
nbsp = "⍽"
tab = "→"
tabpad = " "
[editor.indent-guides]
render = true
[editor.statusline]
left = ["mode", "spinner", "file-name", "read-only-indicator", "file-modification-indicator"]
center = ["register"]
right = ["diagnostics", "selections", "position-percentage", "file-encoding", "file-line-ending"]
mode.normal = "N"
mode.insert = "I"
mode.select = "S"
# KEYBINDINGS
[keys.normal]
G = [ "goto_last_line", "goto_line_end" ]
"\\" = "shell_keep_pipe"
"$" = [ "select_mode", "goto_line_end", "normal_mode" ]
"0" = [ "select_mode", "goto_line_start", "normal_mode" ]
"C" = [ "select_mode", "goto_line_end", "normal_mode", "change_selection" ]
"C-/" = "toggle_comments"
"C-c" = "copy_selection_on_next_line"
"D" = [ "select_mode", "goto_line_end", "normal_mode", "delete_selection" ]
"A-`" = "switch_case"
"~" = "switch_to_uppercase" # shift-`
[keys.normal.space]
w = ":write"
q = ":quit-all"
x = ":write-quit-all"
[keys.select]
o = "flip_selections"
# Emacs
[keys.insert]
"C-a" = [ "goto_line_start" ]
"C-e" = [ "goto_line_end", "move_char_right" ]
"C-p" = "move_visual_line_up"
"C-n" = "move_visual_line_down"
"C-b" = "move_char_left"
"C-f" = "move_char_right"

View File

@ -0,0 +1,13 @@
[language-server.ccls]
command = "ccls"
args = []
config = {}
environment = {}
[language-server.clangd]
command = "/opt/homebrew/opt/llvm@16/bin/clangd"
[[language]]
name = "cpp"
#language-servers = [ "ccls" ]
formatter = { command = "clang-format", args = ["--fallback-style=Google"] }

View File

@ -0,0 +1,4 @@
inherits = "github_dark_high_contrast"
[palette]
"fg.muted" = "#9ea1a3"

View File

@ -31,3 +31,8 @@ map ctrl+shift+r no_op
# Source this last so it can override any settings above
include local.conf
# windows (not the os)
map cmd+shift+down resize_window taller 3
map cmd+shift+up resize_window shorter 3
map f5 launch --location=hsplit --cwd=current

View File

@ -1,4 +1,4 @@
font_size 16.5
font_size 15
font_family Fira Code Retina
# Use Symbols Only from Nerd Font releases page

View File

@ -5,7 +5,7 @@ vim.api.nvim_create_autocmd(
command = "setl signcolumn=no" }
)
function CPConfig()
function _G.CPConfig()
-- Allows opening of terminal in directory of current file (to avoid
-- submitting code to the wrong problem!)
-- This has since been moved to global config
@ -20,7 +20,7 @@ end
vim.api.nvim_create_autocmd(
{ "BufRead" },
{ pattern = "*/projects/cp/*",
callback = CPConfig }
callback = _G.CPConfig }
)
local function get_pieces(task)
@ -45,6 +45,9 @@ local function get_pieces(task)
if edu ~= nil then
round = "edu"..round -- edu000
end
if not div then
div = ""
end
div = "div"..div -- div3
end
problem = task.name -- A. Name of Task

View File

@ -5,8 +5,10 @@
-- https://github.com/hedyhli/outline.nvim
return {
{
dir = "~/projects/outline.nvim",
enabled = vim.fn.has("nvim-0.7") == 1,
lazy = false,
cmd = { "Outline", "OutlineOpen" },
keys = {
{ "<leader>tt", "<cmd>Outline<CR>", desc = "Toggle outline window" },
@ -21,7 +23,10 @@ return {
symbol_folding = {
-- Auto fold all but current hover
autofold_depth = 1,
auto_unfold_hover = true,
auto_unfold = {
hovered = true,
only = 2,
},
},
guides = {
-- Keep only guides that indicate siblings that might span multiple lines (vertical)
@ -30,26 +35,44 @@ return {
bottom = ' ',
}
},
keymaps = {
close = 'q',
unfold_all = {},
fold_all = {},
fold_toggle = {'<tab>', '<space>'},
},
outline_window = {
show_cursorline = true,
position = 'left',
show_cursorline = 'focus_in_outline',
-- Beautiful, but not very good in indicating window focus (I don't use a
-- statusline), plus at the time of writing preview window breaks this
-- feature... But still beautiful nonetheless!
hide_cursor = true,
winhl = "OutlineDetails:LineNr,OutlineLineno:LineNr,OutlineGuides:Comment",
},
outline_items = {
auto_set_cursor = false,
},
providers = {
lsp = { blacklist_clients = {'marksman'} },
},
symbols = {
icon_fetcher = function(k)
local buf = vim.api.nvim_win_get_buf(require('outline').state.code_win)
local ft = vim.api.nvim_buf_get_option(buf, "ft")
-- There can only be kind String in markdown so... let's not have the
-- eye candy here
if ft == 'markdown' and k == 'String' then
return ""
end
return false
end,
filter = {
lua = { 'String', 'Package', 'Constant', exclude = true },
},
-- icon_fetcher = function(k)
-- local ft = vim.api.nvim_buf_get_option(require('outline').current.code.buf, "ft")
-- -- There can only be kind String in markdown so... let's not have the
-- -- eye candy here
-- if ft == 'markdown' and k == 'String' then
-- return ""
-- end
-- return false
-- end,
icon_source = "lspkind",
},
},
},
-- For testing when users from this repo reports issues.
{ "simrat39/symbols-outline.nvim", config=true },
}

View File

@ -0,0 +1,49 @@
snippet for
for(int ${1:i}=0; ${1:i}<${2:n}; ++${1:i}) {
${0:$VISUAL}
}
snippet read2
int ${1:n}, ${2:m}; cin >> ${1:n} >> ${2:m};
snippet readvec
Vi ${1:A};
for(int i=0; i<${2:n}; ++i) {
int x; cin >> x;
A.push_back(x);
}
snippet FR
${1:A}.begin(), ${1:A}.end()
snippet pb
push_back
snippet cout
cout << ${0:$VISUAL};
snippet print
cout << ${0:$VISUAL};
snippet coute
cout << ${0:$VISUAL} << endl;
snippet println
cout << ${0:$VISUAL} << endl;
snippet println2
cout << ${1} << ${2} << endl;
snippet func
${1:int} ${2:solve}(Vi &${3:A}) {
${0:$VISUAL}
}
snippet init
#include <bits/stdc++.h>
using namespace std;
int main() {
${0:$VISUAL}
}

1
.vimrc
View File

@ -94,6 +94,7 @@ endif
" So I gave up exercising muscle memory for different leaders across neovim,
" vim, emacs evil mode...
let mapleader=" "
set number
set relativenumber
syntax on
set mouse=a " allow mouse for all

View File

@ -72,13 +72,13 @@ Configs in order of frequency of update / stability:
1. Kitty
1. Shell (fish)
Configs that are not well maintained
Configs that are not well maintained:
1. irbrc
1. vimrc
Configs that involve open source tools/packages I maintain:
1. gelim (itself)
1. Neovim (plugins)
1. Neovim (a few plugins)
## Overview

View File

@ -12,14 +12,16 @@ EOF
exit
fi
prog="$1"
shift
rootdir="$(pwd)"
while [[ "$rootdir" != "" && ! -x "$rootdir/bin/$1" ]]; do
while [[ "$rootdir" != "" && ! -x "$rootdir/bin/$prog" ]]; do
rootdir=${rootdir%/*}
done
if [[ ! -x "$rootdir/bin/$1" ]]; then
if [[ ! -x "$rootdir/bin/$prog" ]]; then
echo "No executable found in bin of parent directories."
exit 1
fi
"$rootdir/bin/$1"
"$rootdir/bin/$prog" "$@"

View File

@ -20,5 +20,5 @@ paths="$(getpaths $file)"
if [ -f "${file}_local" ]; then
paths="$(getpaths ${file}_local) $paths"
fi
paths="$HOME/bin $paths"
paths="$HOME/bin $HOME/local/bin $paths"
echo "$paths"