diff --git a/nvim/.config/nvim/init.lua b/nvim/.config/nvim/init.lua index ff653a2..d722de6 100644 --- a/nvim/.config/nvim/init.lua +++ b/nvim/.config/nvim/init.lua @@ -1,25 +1,16 @@ vim.cmd.colorscheme("vim") - +vim.api.nvim_set_hl(0, "NormalFloat", { bg = "#000000" }) vim.g.mapleader = " " -vim.keymap.set("n", "", "") -vim.keymap.set("n", "", "") -vim.keymap.set("n", "", "") -vim.keymap.set("n", "", "") - -vim.keymap.set("n", "", "zz") -vim.keymap.set("n", "", "zz") vim.keymap.set("n", "", ":nohlsearch") - vim.keymap.set("n", "f", vim.lsp.buf.format) vim.keymap.set("n", "o", ":Pick files") - -vim.keymap.set('n', 's', ':e #') -vim.keymap.set('n', 'S', ':sf #') - vim.keymap.set("v", "J", ":m '>+1gv=gv") vim.keymap.set("v", "K", ":m '<-2gv=gv") +vim.keymap.set("n", "en", ":edit $HOME/.config/nvim/init.lua") +vim.keymap.set("n", "z", ":edit $HOME/.zshrc") + 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 \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.", + "", + } + + 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", "", 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, {}) diff --git a/scripts/.scripts/g b/scripts/.scripts/g new file mode 100755 index 0000000..8ba2034 --- /dev/null +++ b/scripts/.scripts/g @@ -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 diff --git a/tmux/.tmux.conf b/tmux/.tmux.conf index f8d64c2..e0b67c3 100644 --- a/tmux/.tmux.conf +++ b/tmux/.tmux.conf @@ -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 diff --git a/zsh/.zshrc b/zsh/.zshrc index 386818f..0551d9d 100644 --- a/zsh/.zshrc +++ b/zsh/.zshrc @@ -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"