This commit is contained in:
2025-08-19 13:49:51 -04:00
parent 1a80cccb90
commit 759665e0d6
4 changed files with 134 additions and 70 deletions

View File

@@ -1,25 +1,16 @@
vim.cmd.colorscheme("vim")
vim.api.nvim_set_hl(0, "NormalFloat", { bg = "#000000" })
vim.g.mapleader = " "
vim.keymap.set("n", "<C-h>", "<C-w><C-h>")
vim.keymap.set("n", "<C-j>", "<C-w><C-j>")
vim.keymap.set("n", "<C-k>", "<C-w><C-k>")
vim.keymap.set("n", "<C-l>", "<C-w><C-l>")
vim.keymap.set("n", "<C-d>", "<C-d>zz")
vim.keymap.set("n", "<C-u>", "<C-u>zz")
vim.keymap.set("n", "<Esc>", ":nohlsearch<CR>")
vim.keymap.set("n", "<leader>f", vim.lsp.buf.format)
vim.keymap.set("n", "<leader>o", ":Pick files<CR>")
vim.keymap.set('n', '<leader>s', ':e #<CR>')
vim.keymap.set('n', '<leader>S', ':sf #<CR>')
vim.keymap.set("v", "J", ":m '>+1<CR>gv=gv")
vim.keymap.set("v", "K", ":m '<-2<CR>gv=gv")
vim.keymap.set("n", "<leader>en", ":edit $HOME/.config/nvim/init.lua<CR>")
vim.keymap.set("n", "<leader>z", ":edit $HOME/.zshrc<CR>")
vim.o.number = true
vim.o.relativenumber = true
vim.o.swapfile = false
@@ -27,11 +18,56 @@ vim.o.wrap = false
vim.opt.wildoptions = {}
vim.opt.path:append("**")
-- TODO(vx-clutch): Make this detect git and put that information in there as "This file is part of REPO"
vim.keymap.set("i", "me::", function()
return vim.fn.strftime(
"Author: vx_clutch <https://vx-clutch.github.io/vxserver.dev/>\nDate: %B %d, %Y\nLicense: BSD-3-Clause")
end, { expr = true })
-- TODO(vx-clutch): fix the C behavior, // > /*
vim.api.nvim_create_user_command("Copyright", function()
local handle = io.popen("git rev-parse --show-toplevel 2>/dev/null")
local repo_path = handle and handle:read("*l") or nil
if handle then handle:close() end
local repo = repo_path and repo_path:match("([^/]+)$") or "unknown"
local header_lines = {
"Copyright (C) vx_clutch",
"",
"This file is part of " .. repo,
"",
"This project and file is licensed under the BSD-3-Clause license.",
"<https://opensource.org/license/bsd-3-clause>",
}
local cstr = vim.bo.commentstring
local commented = {}
if cstr ~= "" and cstr:find("%%s") then
local function comment(line)
if line == "" then
return ""
end
local res = cstr:gsub("%%s", line)
return res
end
for _, l in ipairs(header_lines) do
table.insert(commented, comment(l))
end
table.insert(commented, "")
else
table.insert(commented, "/*")
for _, l in ipairs(header_lines) do
if l == "" then
table.insert(commented, " *")
else
table.insert(commented, " * " .. l)
end
end
table.insert(commented, " */")
table.insert(commented, "")
end
vim.api.nvim_buf_set_lines(0, 0, 0, false, commented)
end, {})
local augroup = vim.api.nvim_create_augroup("vxclutch", {})
@@ -164,17 +200,14 @@ vim.keymap.set("t", "<Esc>", function()
end, { noremap = true, silent = true })
vim.pack.add({
{ src = "https://github.com/neovim/nvim-lspconfig" },
{ src = "https://github.com/echasnovski/mini.pick" },
{ src = "https://github.com/mason-org/mason.nvim" },
})
require "mini.pick".setup()
require "mason".setup()
local lspconfig = require("lspconfig")
local servers = { "lua_ls", "clangd" }
for _, server in ipairs(servers) do
lspconfig[server].setup({})
end
vim.lsp.enable({ "lua_ls", "clangd" })
vim.diagnostic.config({
virtual_text = true,
@@ -183,18 +216,18 @@ vim.diagnostic.config({
-- AP CSA JAVA UTILS
vim.api.nvim_create_user_command('AP', function()
local date = os.date("%Y-%m-%d")
local dir_name = vim.fn.fnamemodify(vim.fn.getcwd(), ":t")
local lines = {
"// Owen Westness, " .. date .. ", " .. dir_name,
"public class ",
"{",
" public static void main(String[] args) {",
" // Your code here",
" }",
"}"
}
vim.api.nvim_buf_set_lines(0, 0, -1, false, lines)
vim.api.nvim_win_set_cursor(0, {2, 15})
vim.cmd('startinsert')
local date = os.date("%Y-%m-%d")
local dir_name = vim.fn.fnamemodify(vim.fn.getcwd(), ":t")
local lines = {
"// Owen Westness, " .. date .. ", " .. dir_name,
"public class ",
"{",
" public static void main(String[] args) {",
" // Your code here",
" }",
"}"
}
vim.api.nvim_buf_set_lines(0, 0, -1, false, lines)
vim.api.nvim_win_set_cursor(0, { 2, 15 })
vim.cmd('startinsert')
end, {})

46
scripts/.scripts/g Executable file
View File

@@ -0,0 +1,46 @@
#!/bin/sh
# https://github.com/LukeSmithxyz/voidrice/blob/master/.local/bin/compiler
# This script will compile or run another finishing operation on a document. I
# have this script run via vim.
# Compiles .tex. groff (.mom, .ms), .rmd, .md, .org. Opens .sent files as sent
# presentations. Runs scripts based on extension or shebang.
file="${1}"
ext="${file##*.}"
dir=${file%/*}
base="${file%.*}"
cd "${dir}" || exit "1"
case "${ext}" in
[0-9]) preconv "${file}" | refer -PS -e | groff -mandoc -T pdf > "${base}.pdf" ;;
mom|ms) preconv "${file}" | refer -PS -e | groff -T pdf -m"${ext}" > "${base}.pdf" ;;
c) cc "${file}" -o "${base}" && "./${base}" ;;
cob) cobc -x -o "$base" "$file" && "$base" ;;
cpp) g++ "${file}" -o "${base}" && "./${base}" ;;
cs) mcs "${file}" && mono "${base}.exe" ;;
go) go run "${file}" ;;
h) sudo make install ;;
java) javac -d classes "${file}" && java -cp classes "${base}" ;;
m) octave "${file}" ;;
md) [ -x "$(command -v lowdown)" ] && \
lowdown --parse-no-intraemph "${file}" -Tms | groff -mpdfmark -ms -kept -T pdf > "${base}.pdf" || \
[ -x "$(command -v groffdown)" ] && \
groffdown -i "${file}" | groff -T pdf > "${base}.pdf" || \
pandoc -t ms --highlight-style="kate" -s -o "${base}.pdf" "${file}" ;;
org) emacs "${file}" --batch -u "${USER}" -f org-latex-export-to-pdf ;;
py) python "${file}" ;;
rink) rink -f "${file}" ;;
[rR]md) Rscript -e "rmarkdown::render('${file}', quiet=TRUE)" ;;
rs) cargo build ;;
sass) sassc -a "${file}" "${base}.css" ;;
scad) openscad -o "${base}.stl" "${file}" ;;
sent) setsid -f sent "${file}" 2> "/dev/null" ;;
tex) latexmk ;;
*) sed -n '/^#!/s/^#!//p; q' "${file}" | xargs -r -I % "${file}" ;;
esac

View File

@@ -1,34 +1,15 @@
set -s escape-time 0
set -g escape-time 0
set-option -sa terminal-features ',xterm-256color:RGB'
unbind C-b
set-option -g prefix C-s
bind-key C-s send-prefix
bind r source-file ~/.tmux.conf
bind -r k select-pane -U
bind -r j select-pane -D
bind -r h select-pane -L
bind -r l select-pane -R
bind -r ^ last-window
set -a terminal-features "tmux-256color:RGB"
set -g prefix C-s
set -g base-index 1
set -g renumber-windows on
set-window-option -g mode-keys vi
set -g renumber-windows on
set -g mode-keys vi
set -g status-position top
set -g status-justify centre
set -g status-style fg=colour8,bg=#000000
set -g status-left-length 120
set -g status-left-style fg=colour8,bg=#000000
set -g status-right-style fg=colour8,bg=#000000
set -g status-justify absolute-centre
set -g status-style "bg=default"
set -g window-status-current-style "fg=blue bold"
set -g status-right ""
set -g status-left "#S"
set -g status-left '#(echo "#{pane_current_path}" | sed "s|^/home/||")'
set -g status-right '%H:%M'
setw -g window-status-style fg=colour8,bg=#000000
setw -g window-status-format '#I:#W '
setw -g window-status-current-style fg=colour1,bg=#000000,bold
set -g status-right '%I:%M %p'
bind r source-file "~/.config/tmux/tmux.conf"
bind b set -g status
bind G neww -n "lazygit" lazygit

View File

@@ -6,11 +6,15 @@ export VISUAL=nvim
export TERM="xterm-256color"
export COLORTERM=truecolor
export PATH=$HOME/.scripts:$PATH
alias ls='ls --color=auto'
alias ll='ls -lah'
alias v='nvim'
take() {
mkdir $1 && cd $1
mkdir $1;
cd $1
}
[ -f "${XDG_DATA_HOME:-$HOME/.local/share}/zap/zap.zsh" ] && source "${XDG_DATA_HOME:-$HOME/.local/share}/zap/zap.zsh"