1
0

Compare commits

...

13 Commits

Author SHA1 Message Date
2474ac0fd5 Added kanto config on Windows
Changed config location for starship on Windows
Updated dots.bat to include patch function
Use patch to strip hostname prefixes when installing
Style change for all caps in dots.bat
2025-10-01 02:25:38 +01:00
ce8e8fe6ec Added linux config for kanto
Updated dots script to correctly install across multiple systems
Simplified rofi configuration
Added sway config for kanto
Fixed swaylock colour missing a zero
Minor updates for specific font sizes, colours etc.
2025-09-29 17:44:50 +01:00
a184195a29 Made config vaguely work on Windows
Added dots.bat script for installing and pulling
Added clink config for cmd
Removed auto-split on start in nvim
Added guifont in nvim
Added workaround for shellpipe in nvim
2025-09-27 21:52:48 +01:00
eaf6d47bf8 Added foot terminal config
Added swaylock config
Updated installer script to pull/install correct files
2025-09-26 22:33:19 +01:00
21758f9cc5 Added config for rofi on tokyo
Added sway keybind to filter windows
Updated installer script to handle new files
2025-09-25 23:36:12 +01:00
ae69d852fe Added sway config for tokyo
Laptop sway configuration
Updated installer script to pull/push the new configuration files
2025-09-25 21:01:22 +01:00
42189f6687 Added bash config
Copied over old .bashrc and .bash_aliases because they didn't need
really need changing
Slightly changed .bash_profile for starting graphical setups
Added simple starship.toml setup
Updated install script to copy/pull new files
2025-09-25 18:08:46 +01:00
ffcf0f02c2 Added block commenting utility
Added assignment aligning
Added tabber function to re-tab/re-space files
Renamed install script to 'dots'
Renamed push action to 'install'
2025-09-25 16:30:14 +01:00
da251e7223 Custom syntax highlighting
For c and quickfix
Function to format the quickfix and location jump lists
Fixed issue with "help" window layouts accessing incorrect variable
2025-09-25 00:04:21 +01:00
ce611a0e14 Added building via shell in neovim
Display diagnostics inline to buffer
List compile errors/warnings in quickfix list
Added 'push' command to install script
Make sure install script executes from the correct directory
2025-09-24 23:03:16 +01:00
d0ba7f74b1 Added window handling functions
Added scratch buffer on startup
Attempt to wrangle windows so that at most only 3 are open via splitting
Project wide (file only) search
Properly layout "help" windows so they are at the bottom
2025-09-24 18:59:41 +01:00
3a2db931e0 Added some simple key mappings
Simple buffer-based "auto" complete
Auto-trim trailing whitespace on write
2025-09-24 17:05:32 +01:00
42b161fe21 Added old colour scheme
Enabled colour scheme
Enabled filetype indent
2025-09-24 16:49:47 +01:00
19 changed files with 1466 additions and 24 deletions

16
bash_aliases Normal file
View File

@@ -0,0 +1,16 @@
# Alias sudo to have a space at the end so it can be used with other aliases
alias sudo='sudo '
# Auto remove any packages that may be left over as dependencies
alias autorem='pacman -Rsn $(pacman -Qdtq)'
# Enable basic options for colour etc.
alias ls='ls -CFlvh --color=always --group-directories-first'
alias grep='grep --color=always'
alias less='less -R'
# Neovim instead of vim
alias vim='nvim'
# Out of habit
alias quit='exit'

34
bash_profile Normal file
View File

@@ -0,0 +1,34 @@
# Source .bashrc
[[ -f "$HOME/.bashrc" ]] && . "$HOME/.bashrc"
case $HOSTNAME in
# More can be added here in the future
kanto|tokyo)
HEADLESS=0
;;
*)
HEADLESS=1
;;
esac
if [[ $HEADLESS -eq 0 && -z $WAYLAND_DISPLAY && $XDG_VTNR -eq 1 ]];
then
export GTK_THEME=Adwaita:dark
export MOZ_ENABLE_WAYLAND=1
export QT_QPA_PLATFORM=wayland-egl
export QT_QPA_PLATFORMTHEME=qt5ct
export SDL_VIDEODRIVER=wayland
case $HOSTNAME in
kanto)
export WLR_NO_HARDWARE_CURSORS=1
# Desktop with nvidia gpu
exec sway --unsupported-gpu
;;
tokyo)
# Laptop with intel gpu
exec sway
;;
esac
fi

40
bashrc Normal file
View File

@@ -0,0 +1,40 @@
# Make sure we are running interactively
[[ $- != *i* ]] && return
# Source aliases
[[ -f "$HOME/.bash_aliases" ]] && . "$HOME/.bash_aliases"
# Source devkitPro env if available
[[ -f "/etc/profile.d/devkit-env.sh" ]] && . "/etc/profile.d/devkit-env.sh"
# Misc options
shopt -s checkwinsize
shopt -s globstar
# History options
HISTCONTROL=ignoreboth
HISTSIZE=1000
HISTFILESIZE=2000
shopt -s histappend
# Disable history file for less
export LESSHISTFILE="-"
# Use neovim as editor
export EDITOR=nvim
# Required for passphrase input with gpg
export GPG_TTY="$(tty)"
export SSH_AUTH_SOCK="$(gpgconf --list-dirs agent-ssh-socket)"
gpg-connect-agent updatestartuptty /bye > /dev/null
# Append / to the end of symlinked directories
bind 'set mark-symlinked-directories on'
# Make C-w only delete up to first / in path
stty werase undef
bind '\C-w:unix-filename-rubout'
# If available setup execute starship prompt, otherwise default to a basic PS1
export PS1="[\033[01;92m\u@\h\033[00m] :: \033[00;34m\w \033[01;36m> \033[0;0m"
[[ $(command -v "starship") ]] && eval "$(starship init bash)"

10
config/clink/inputrc Normal file
View File

@@ -0,0 +1,10 @@
$if clink
set mark-symlinked-directories on
set expand-tilde on
"\C-W": unix-filename-rubout
"\t": old-menu-complete
# Fix issue with Shift-Backspace not doing anything
"\e[27;2;8~": "\C-H"
$endif

View File

@@ -0,0 +1,6 @@
-- Set config location to be in %APPDATA% rather than the default %USERPROFILE%\.config
local appdata = os.getenv("APPDATA")
os.setenv("STARSHIP_CONFIG", appdata .. "\\starship.toml")
-- Load starship
load(io.popen('starship init cmd'):read("*a"))()

54
config/foot/foot.ini Normal file
View File

@@ -0,0 +1,54 @@
# Basic
#
term=xterm-256color
#tokyo font=Ubuntu Mono:size=11.5
#kanto font=Ubuntu Mono:size=10
[colors]
alpha=1.0
background=181818
foreground=FFFFFF
# Normal
regular0=181818 # black
regular1=FF5866 # red
regular2=85FF85 # green
regular3=F9DC5C # yellow
regular4=3185FC # blue
regular5=FF85FF # magenta
regular6=85FFFF # cyan
regular7=FFFFFF # white
# Bright
bright0=252525 # bright black
bright1=FF99A1 # bright red
bright2=C2FFC2 # bright green
bright3=FCEEB0 # bright yellow
bright4=86B8FD # bright blue
bright5=FFC2FF # bright magenta
bright6=C2FFFF # bright cyan
bright7=FFFFFF # bright white
# Dim
dim0=000000 # dim black
dim1=F50014 # dim red
dim2=5CFF5C # dim green
dim3=F6CD13 # dim yellow
dim4=0567F1 # dim blue
dim5=FF5CFF # dim magenta
dim6=00F5F5 # dim cyan
dim7=C2C2C2 # dim white
# Misc
jump-labels=181818 FFFFFF
urls=FFFFFF
# @Todo: Could add more colours, supports the full 256 range and sixel
[csd]
preferred=server
[key-bindings]
show-urls-launch=Control+u
# vim: ft=dosini

View File

@@ -0,0 +1,32 @@
syn clear cTodo
syn clear cType
" Custom keywords
"
syn keyword cStorageClass function export internal global_var thread_var local_persist
syn keyword cOperator cast
" Type highlighting
"
" There are inconsistencies around this due to the horrific declaration syntax of C/C++ and
" trying to capture that inside a regexp statement is near impossible. These are made to mostly
" match the way I format my code.
"
syn match cType "\I\i*\ze\s\+\**\I\i*\s*[=;,\)\[]" " Regular declarations
syn match cType "\I\i*\ze\s\+\**\I\i*(" " Function return types
" Todo notes
"
syn match cTodo "@\I\i*\((\I\i*)\)\=:\?" contained
syn match cNote "\s:\I\i*" contained
" Functions
"
syn match cFunction "\I\i*\ze("
" Contain clusters
"
syn cluster cCommentGroup add=cNote
syn cluster cPreProcGroup add=cFunc,cType
hi def link cFunction Function

View File

@@ -0,0 +1,28 @@
syn clear
" I have completely overriden the formatting for the quickfix and location list buffers so this
" has to be changed to give proper highlighting of the new format
"
syn match qfSignError "\[!\]" contained
syn match qfSignWarn "\[#\]" contained
syn match qfSignSearch "\[\~\]" contained
syn match qfFileName "^[^:]*" contains=@qfSign nextgroup=qfSeparator1
syn match qfSeparator1 ":" contained nextgroup=qfLineNr
syn match qfLineNr "[^:|]*" contained nextgroup=qfSeparator2,qfSeparator3
syn match qfSeparator2 ":" contained nextgroup=qfColumnNr
syn match qfColumnNr "[^|]*" contained
syn match qfSeparator3 "|" contained
syn cluster qfSign contains=qfSignError,qfSignWarn,qfSignSearch
hi clear qfFileName
hi clear qfLineNr
hi def link qfSignError DiagnosticSignError
hi def link qfSignWarn DiagnosticSignWarn
hi def link qfSignSearch LineNr
hi def link qfFileName Function
hi def link qfLineNr Number
hi def link qfColumnNr Number
let b:current_syntax = "qf"

View File

@@ -0,0 +1,71 @@
set background=dark
hi clear
if exists("syntax_on")
syntax reset
endif
let g:colors_name = "scheme"
hi clear QuickFixLine
"
" hi Example guifg=NONE guibg=NONE gui=NONE ctermfg=NONE ctermbg=NONE cterm=NONE
"
hi Normal guifg=#FFFFFF guibg=#232323
hi NonText guifg=#444444
hi LineNr guifg=#FFFFFF guibg=#18171C
hi LineNrAbove guifg=#484848 guibg=#18171C
hi LineNrBelow guifg=#484848 guibg=#18171C
hi VertSplit guifg=#FFFFFF
hi CursorLineNr guifg=#FFFFFF guibg=#292931 cterm=NONE
hi CursorLine guibg=#18171C gui=NONE cterm=NONE
hi WildMenu guifg=#FFFFFF
hi WarningMsg guifg=#EE6C4D
hi ErrorMsg guifg=#E84855 guibg=#232323
hi Comment guifg=#F9DC5C
hi StatusLine guifg=#FFFFFF guibg=#18171C gui=BOLD
hi StatusLineNC guifg=#FFFFFF guibg=#4F5258 gui=BOLD
hi VertSplit guifg=#18171C guibg=#18171C gui=NONE
hi Todo guifg=#E84855 guibg=NONE
hi cNote guifg=#35FF77 guibg=NONE
hi PreProc guifg=#EE6C4D
hi Statement guifg=#FFE74C gui=BOLD cterm=BOLD
hi Operator guifg=#FFE74C gui=BOLD cterm=BOLD
hi Type guifg=#96BBBB gui=NONE cterm=NONE
hi Typedef guifg=#8D99AF
hi StorageClass guifg=#8D99AF
hi Function guifg=#FF5866
hi Identifier guifg=#96BBBB
hi Constant guifg=#7BB1FD
hi Boolean guifg=#7BB1FD
hi String guifg=#3185FC
hi Character guifg=#3185FC
hi SpecialChar guifg=#EE6C4D
hi Search guifg=#232323 guibg=#FFC7A2
hi QuickFixLine guibg=#18171C gui=NONE cterm=NONE
hi DiagnosticLineError guibg=#660008
hi DiagnosticSignError guifg=#FFC0B9
hi DiagnosticVirtualTextError guifg=#FFC0B9
hi DiagnosticLineWarn guibg=#685C27
hi DiagnosticSignWarn guifg=#FCEEB0
hi DiagnosticVirtualTextWarn guifg=#FCEEB0
hi DiagnosticOk guifg=#35FF77

View File

@@ -1,3 +1,21 @@
local MAP = vim.keymap.set
local AUTOCMD = vim.api.nvim_create_autocmd
local NEWCMD = vim.api.nvim_create_user_command
vim.cmd("colorscheme scheme")
vim.cmd("filetype indent on")
-- Language people you have more important things to do than police the code style, if people
-- want consistent styling it should be done at a project level using a linter or .editorconfig
vim.g.rust_recommended_style = false
vim.g.python_recommended_style = false
vim.g.go_recommended_style = false
vim.g.zig_recommended_style = false
vim.g.markdown_recommended_style = false
vim.g.arduino_recommended_style = false
vim.g.gdscript_recommended_style = false
vim.g.yaml_recommended_style = false
-- Basic options
vim.o.tabstop = 2
vim.o.shiftwidth = 0
@@ -26,6 +44,12 @@ vim.o.completeopt = "preview"
vim.o.wildmode = "full"
vim.o.cinoptions = "l1,b-s"
vim.o.statusline = "%#LineNr# [%n] %#Default# %f%m%r %= %#StatusLineNC# %w[%{&ft == '' ? 'None' : ''}%Y] %#LineNr# Line: %l Column: %c "
vim.o.guifont = "Ubuntu Mono:h11"
if vim.loop.os_uname().sysname == "Windows_NT" then
-- Workaround for https://github.com/neovim/neovim/issues/32504
vim.o.shellpipe = ">%s 2>&1"
end
vim.opt.errorformat = {
"%f:%l:%c: fatal %trror: %m", -- gcc/clang fatal error
@@ -38,4 +62,435 @@ vim.opt.formatoptions:append("/")
vim.opt.cinkeys:append("0=break")
vim.opt.listchars:append({ lead = "." })
--------------------------------------------------------------------------------
-- Functions
--------------------------------------------------------------------------------
-- Building & Errors
-- Diagnostics configuration
vim.diagnostic.config({
signs = {
text = {
[vim.diagnostic.severity.ERROR] = "",
[vim.diagnostic.severity.WARN] = ""
},
linehl = {
[vim.diagnostic.severity.ERROR] = "DiagnosticLineError",
[vim.diagnostic.severity.WARN] = "DiagnosticLineWarn"
},
},
virtual_text = {
virt_text_pos = "eol_right_align",
prefix =
function(d, i, total)
return d.severity == vim.diagnostic.severity.ERROR and "!" or "#"
end
},
underline = false,
severity_sort = true
})
local _last_build = ""
local _quickfix = {}
local _namespace = vim.api.nvim_create_namespace("__qf.buffer.errors")
local function LoadDiagnostics(args)
local bufnr = args.buf
if _quickfix[bufnr] then
vim.diagnostic.set(_namespace, bufnr, _quickfix[bufnr])
end
end
local function ExecuteBuild()
vim.cmd("silent make")
-- Reset currently displayed diagnostics
_quickfix = {}
vim.diagnostic.reset()
local entries = vim.fn.getqflist()
if #entries ~= 0 then
-- Group diagnostics by buffer number
local diagnostics = vim.diagnostic.fromqflist(entries)
for _, d in ipairs(diagnostics) do
if not _quickfix[d.bufnr] then
_quickfix[d.bufnr] = {}
end
table.insert(_quickfix[d.bufnr], d)
end
-- Display the new diagnostics
for it, v in pairs(_quickfix) do
vim.diagnostic.set(_namespace, it, v)
end
end
end
local function PromptBuild()
vim.ui.input(
{
prompt = "Compile: ",
completion = "shellcmdline",
default = _last_build
},
function(input)
if input ~= nil then
local makeprg = vim.o.makeprg
vim.o.makeprg = input
ExecuteBuild()
_last_build = input
vim.o.makeprg = makeprg
end
end
)
end
local function FormatJumpList()
local qf = vim.fn.getqflist( { winid = true, qfbufnr = true })
local loc = vim.fn.getloclist(0, { winid = true, qfbufnr = true })
if qf.winid ~= 0 then
-- This means the quickfix list is open and needs formatting
local ns = vim.api.nvim_create_namespace("__qf.format")
local bufnr = qf.qfbufnr
local entries = vim.fn.getqflist()
local text = {}
local max = { 0, 0, 0 }
vim.api.nvim_buf_clear_namespace(bufnr, ns, 0, -1)
vim.api.nvim_buf_set_option(bufnr, "modifiable", true)
for _, it in ipairs(entries) do
max[1] = math.max(max[1], #tostring(it.lnum))
max[2] = math.max(max[2], #tostring(it.col))
max[3] = math.max(max[3], #vim.fn.bufname(it.bufnr))
end
-- +2 for the extra colons we put between the filename, line number and column number
local extformat = string.format("[%%s] %%-%ds | %%s", max[1] + max[2] + max[3] + 2)
for _, it in ipairs(entries) do
local sign = it.type:lower() == "e" and "!" or "#"
local fname = string.format("%s:%d:%d" , vim.fn.bufname(it.bufnr), it.lnum, it.col)
table.insert(text, extformat:format(sign, fname, it.text))
end
vim.api.nvim_buf_set_lines(bufnr, 0, -1, true, text)
vim.api.nvim_buf_set_option(bufnr, "modifiable", false)
vim.api.nvim_buf_set_option(bufnr, "modified", false)
end
if loc.winid ~= 0 then
-- This means the location list is open and needs formatting
local ns = vim.api.nvim_create_namespace("__loc.format")
local bufnr = loc.qfbufnr
local entries = vim.fn.getloclist(0)
local text = {}
local max = { 0, 0 }
vim.api.nvim_buf_clear_namespace(bufnr, ns, 0, -1)
vim.api.nvim_buf_set_option(bufnr, "modifiable", true)
for _, it in ipairs(entries) do
max[1] = math.max(max[1], #vim.fn.bufname(it.bufnr))
max[2] = math.max(max[2], #tostring(it.lnum))
end
-- +1 for the extra colon we put between the filename and the line number
local extformat = string.format("[~] %%-%ds | %%s", max[1] + max[2] + 1)
for _, it in ipairs(entries) do
local fname = string.format("%s:%d", vim.fn.bufname(it.bufnr), it.lnum)
table.insert(text, extformat:format(fname, it.text))
end
vim.api.nvim_buf_set_lines(bufnr, 0, -1, true, text)
vim.api.nvim_buf_set_option(bufnr, "modifiable", false)
vim.api.nvim_buf_set_option(bufnr, "modified", false)
end
end
-- Buffers
local function BufferComplete()
local pos = vim.api.nvim_win_get_cursor(0)
local line = vim.fn.getline('.')
local ident = line:sub(1, pos[2]):match("[^ \t]*$")
return #ident ~= 0 and "<C-P>" or "<Tab>"
end
local function TrimBuffer()
local view = vim.fn.winsaveview()
vim.cmd("%s/\\s\\+$//e")
vim.fn.winrestview(view)
end
local function MakeScratch()
local bufnr = vim.api.nvim_create_buf(true, true)
vim.api.nvim_buf_set_option(bufnr, "buftype", "nofile")
vim.api.nvim_buf_set_option(bufnr, "bufhidden", "hide")
vim.api.nvim_buf_set_option(bufnr, "swapfile", false)
vim.api.nvim_buf_set_option(bufnr, "modified", false)
vim.api.nvim_buf_set_name(bufnr, "scratch")
vim.api.nvim_buf_set_text(bufnr, 0, 0, 0, -1, { "-*- Scratch Buffer -*-" })
end
local function AlignEq()
if vim.fn.mode():lower() == "v" then
-- Feed an escape to leave visual mode, this updates the '< and '> marks
local keys = vim.api.nvim_replace_termcodes('<Esc>', true, false, true)
vim.api.nvim_feedkeys(keys, 'x', true)
end
local st = vim.fn.getpos("'<")[2] - 1
local ed = vim.fn.getpos("'>")[2]
local max = 0
local lines = vim.api.nvim_buf_get_lines(0, st, ed, true)
local aligned = {}
for _, line in ipairs(lines) do
local pos = line:find('=', 1, true)
if pos then
local trimmed = line:sub(1, pos - 1):gsub("%s+$", "")
max = math.max(#trimmed, max)
end
end
for _, line in ipairs(lines) do
local text = line
local pos = line:find('=', 1, true)
if pos then
local before = line:sub(1, pos - 1):gsub("%s+$", "")
local after = line:sub(pos + 1):gsub("^%s+", "")
text = before .. string.rep(" ", max - #before + 1) .. "= " .. after
end
table.insert(aligned, text)
end
vim.api.nvim_buf_set_lines(0, st, ed, true, aligned)
end
local _comment_leaders = {
lua = '--',
vim = '"',
sh = "#",
python = "#",
conf = "#",
yaml = "#",
gdscript = "#",
make = "#"
}
local function BlockComment()
local leader = _comment_leaders[vim.o.filetype] or '//'
local st = vim.api.nvim_win_get_cursor(0)[1] - 1
local ed = st + 1
if vim.fn.mode():lower() == "v" then
-- Feed keys to leave visual mode, this updates the '< and '> marks
local keys = vim.api.nvim_replace_termcodes('<Esc>', true, false, true)
vim.api.nvim_feedkeys(keys, 'x', true)
st = vim.fn.getpos("'<")[2] - 1
ed = vim.fn.getpos("'>")[2]
end
local lines = vim.api.nvim_buf_get_lines(0, st, ed, true)
local comment = false
for _, line in ipairs(lines) do
local pos = line:find("%S")
if #line > 0 and line:byte(pos) ~= leader:byte(1) then
comment = true
break
end
end
local adjusted = {}
for _, line in ipairs(lines) do
local text = ""
if #line > 0 then
if comment then
text = leader .. " " .. line
else
local s, e = line:find(leader, 1, true)
if line:byte(e + 1) == 0x20 then e = e + 1 end
text = line:sub(1, s - 1) .. line:sub(e + 1)
end
end
table.insert(adjusted, text)
end
vim.api.nvim_buf_set_lines(0, st, ed, true, adjusted)
end
-- Windowing
local _is_help = { help = true, man = true, qf = true }
function ManageSplit()
local windows = vim.api.nvim_tabpage_list_wins(0)
local bufnr = vim.api.nvim_win_get_buf(windows[#windows])
local filetype = vim.bo[bufnr].filetype
local target_count = _is_help[filetype] and 3 or 2
if #windows == target_count then
-- We already have the target number of windows open so we should close our split window,
-- always close 2 because that is the right-most split. The third window if it exists is
-- the bottom most window and is a "help" window
vim.api.nvim_win_close(windows[2], false)
else
-- We have less than the required windows open so split the first window, we open the
-- "scratch" buffer in this new window, if it is still open. Otherwise the same buffer in
-- the first window is opened.
local scratch = vim.fn.bufnr("scratch")
local first = vim.api.nvim_win_get_buf(windows[1])
bufnr = vim.api.nvim_buf_is_loaded(scratch) and scratch or first
vim.api.nvim_open_win(bufnr, true, { split = "right", win = windows[1] })
end
end
local function ProjectSearch()
local input = vim.fn.input("Search: ")
if input and input ~= "" then
vim.cmd("silent lgrep! \"" .. input .. "\" **")
vim.cmd("lopen | lfirst | wincmd p")
end
end
local function ExpandHelp(a)
local winid = vim.api.nvim_get_current_win()
local filetype = vim.bo[vim.api.nvim_win_get_buf(winid)].filetype
local height = a.event == "WinEnter" and math.floor(0.8 * vim.o.lines) or 5
if _is_help[filetype] then
vim.api.nvim_win_set_height(winid, height)
end
end
local function LayoutHelp(a)
if _is_help[vim.bo.filetype] then
local winid = vim.api.nvim_get_current_win()
local windows = vim.api.nvim_tabpage_list_wins(0)
-- We need to close other "help" windows that may be open so search through the open
-- windows. There *should* only ever be 3 windows open if my window handling is working
-- correctly
for _, w in ipairs(windows) do
if w ~= winid then
local bufnr = vim.api.nvim_win_get_buf(w)
if _is_help[vim.bo[bufnr].filetype] then
vim.api.nvim_win_close(w, true)
end
end
end
-- Force the new window to the bottom and expand it to be 80% of the height
vim.cmd("wincmd J")
vim.cmd(string.format("resize %d", math.floor(0.8 * vim.o.lines)))
end
end
--------------------------------------------------------------------------------
-- Input mappings
--------------------------------------------------------------------------------
vim.g.mapleader = " "
MAP("n", "<A-j>", "mz:m+<CR>")
MAP("n", "<A-k>", "mz:m-2<CR>")
MAP("n", "<Esc>", ":nohl<CR>")
MAP("n", "<Leader>n", ":cnext<CR>")
MAP("n", "<Leader>N", ":cprev<CR>")
MAP("n", "J", "}")
MAP("v", "J", "}")
MAP("n", "K", "{")
MAP("v", "K", "{")
MAP("n", "<Leader>k", ":Man<CR>")
MAP("i", "<S-Tab>", "<C-o><<")
MAP("i", "<Tab>", BufferComplete, { expr = true })
MAP("n", "<Leader>s", ManageSplit)
MAP("n", "<Leader>f", ProjectSearch)
MAP("n", "<Leader>m", PromptBuild)
MAP("v", "<Leader>/", BlockComment)
MAP("n", "<Leader>/", BlockComment)
MAP("v", "<Leader>=", AlignEq)
--------------------------------------------------------------------------------
-- Autocommands
--------------------------------------------------------------------------------
AUTOCMD('BufEnter', { command = "let b:man_default_sects=\"2,3\"", pattern = "*.c" })
AUTOCMD('BufReadPost', { command = "setlocal nornu", pattern = "quickfix" })
AUTOCMD('BufReadPost', { callback = FormatJumpList, pattern = "quickfix" })
AUTOCMD('BufWritePre', { callback = TrimBuffer, pattern = "*" })
AUTOCMD('VimEnter', { callback = MakeScratch, pattern = "*" })
AUTOCMD('BufWinEnter', { callback = LayoutHelp, pattern = "*" })
AUTOCMD('WinEnter', { callback = ExpandHelp, pattern = "*" })
AUTOCMD('WinLeave', { callback = ExpandHelp, pattern = "*" })
AUTOCMD('BufRead', { callback = LoadDiagnostics, pattern = "*" })
--------------------------------------------------------------------------------
-- Custom commands
--------------------------------------------------------------------------------
local function Tabber(a)
local count = tonumber(a.fargs[1])
if count == nil then
vim.notify("[Error] :: Expected number", vim.log.levels.ERROR)
else
local opts = { ts = vim.o.tabstop, et = vim.o.expandtab }
vim.o.tabstop = count
if a.bang then
vim.o.expandtab = true
vim.cmd("silent retab")
else
local pos = {
view = vim.fn.winsaveview(),
vstart = vim.fn.getpos("'<"),
vend = vim.fn.getpos("'>")
}
-- gg=G doesn't work in some niche cases so we do a full buffer select, indent and then
-- unindent. With expandtab disabled converts leading spaces to tabs
vim.o.expandtab = false
vim.cmd("silent normal! ggVG>VG<")
vim.fn.winrestview(pos.view)
vim.fn.setpos("'<", pos.vstart)
vim.fn.setpos("'>", pos.vend)
end
vim.o.tabstop = opts.ts
vim.o.expandtab = opts.et
end
end
NEWCMD('Tabber', Tabber, { nargs = 1, bang = true })

40
config/rofi/config.rasi Normal file
View File

@@ -0,0 +1,40 @@
configuration {
modi: "drun,window";
terminal: "footclient";
show-icons: true;
icon-theme: "Tela-circle";
fixed-num-lines: false;
location: 3;
drun-match-fields: "name,exec";
drun-display-format: "{name}";
display-drun: "Launch";
display-window: "Window";
threads: 2;
// Select items in the listview with 'Alt+n'
kb-select-1: "Alt+1";
kb-select-2: "Alt+2";
kb-select-3: "Alt+3";
kb-select-4: "Alt+4";
kb-select-5: "Alt+5";
kb-select-6: "Alt+6";
kb-select-7: "Alt+7";
kb-select-8: "Alt+8";
kb-select-9: "Alt+9";
kb-select-10: "Alt+0";
// We have to bind these otherwise rofi complains with an error saying 'Alt+n' is already
// bound, even though they are just using the defaults which I don't care about
kb-custom-1: "Super+1";
kb-custom-2: "Super+2";
kb-custom-3: "Super+3";
kb-custom-4: "Super+4";
kb-custom-5: "Super+5";
kb-custom-6: "Super+6";
kb-custom-7: "Super+7";
kb-custom-8: "Super+8";
kb-custom-9: "Super+9";
kb-custom-10: "Super+0";
}
@theme "theme"

160
config/rofi/theme.rasi Normal file
View File

@@ -0,0 +1,160 @@
* {
font: "Noto Sans CJK JP 11";
bg: #181818;
fg: #FFFFFF;
/*tokyo
selected: #3185FC;
urgent: #0567F1;
active: #86B8FD;
tokyo*/
/*kanto
selected: #85FF85;
urgent: #5CFF5C;
active: #C2FFC2;
kanto*/
background-color: transparent;
text-color: @fg;
padding: 0px;
spacing: 0px;
}
element {
cursor: pointer;
border: 0;
padding: 1px;
spacing: 5px;
}
element normal.normal {
background-color: @bg;
text-color: @fg;
}
element normal.urgent {
background-color: @urgent;
text-color: @bg;
}
element normal.active {
background-color: @active;
text-color: @bg;
}
element selected.normal {
background-color: @selected;
text-color: @bg;
border-radius: 4px;
border: 2px;
}
element selected.urgent {
background-color: @urgent;
text-color: @bg;
}
element selected.active {
background-color: @active;
text-color: @bg;
}
element-text {
background-color: transparent;
text-color: inherit;
cursor: inherit;
highlight: inherit;
padding: 1px;
}
element-icon {
background-color: rgba(0, 0, 0, 0%);
size: 1.0000em;
cursor: inherit;
text-color: inherit;
}
window {
background-color: @bg;
border-color: @selected;
padding: 4px;
border: 1px 1px 1px 1px;
border-radius: 0px;
width: 30%;
x-offset: -5px;
y-offset: 5px;
}
mainbox {
padding: 0px;
border: 0px;
}
message {
padding: 1px;
border-color: @fg;
border: 2px dash 0px 0px;
}
textbox {
text-color: @fg;
}
listview {
scrollbar: false;
border-color: @fg;
spacing: 0px;
padding: 2px;
fixed-height: false;
lines: 10;
require-input: true;
border: 1px dash 0px 0px;
anchor: west;
position: north;
}
button {
cursor: pointer;
spacing: 0;
text-color: @fg;
}
button selected {
background-color: @selected;
text-color: @bg;
}
inputbar {
padding: 1px;
spacing: 0;
text-color: @fg;
children: [ prompt,textbox-prompt-colon,entry,case-indicator ];
}
entry {
text-color: @fg;
cursor: text;
spacing: 0;
padding: 0px 0px 2px 0px;
placeholder-color: #C2C2C2;
placeholder: "Filter";
}
prompt {
spacing: 0;
text-color: @fg;
}
textbox-prompt-colon {
margin: 0px 0.3000em 0.0000em 0.0000em;
expand: false;
str: ":";
text-color: inherit;
}
/* vim:ft=css

35
config/starship.toml Normal file
View File

@@ -0,0 +1,35 @@
add_newline = false
scan_timeout = 10
format = "\\[$username$hostname\\] :: $directory $cmd_duration$character"
[line_break]
disabled = true
[hostname]
ssh_only = false
format = "[@$hostname]($style)"
#tokyo style = "bright-blue bold"
#kanto style = "bright-green bold"
[username]
show_always = true
format = "[$user]($style)"
style_root = "bright-red bold"
#tokyo style_user = "bright-blue bold"
#kanto style_user = "bright-green bold"
[directory]
truncation_length = 3
truncate_to_repo = true
style = "blue"
read_only = "!"
read_only_style = "red"
format = "[$path]($style)[$read_only]($read_only_style)"
[cmd_duration]
style = "bold yellow"
format = "[+$duration]($style) "
[character]
success_symbol = "[>](cyan bold)"
error_symbol = "[>](red bold)"

143
config/sway/kanto.sway Normal file
View File

@@ -0,0 +1,143 @@
#
# variables
#
set $LOCK 'swaylock'
set $MOD Mod4
set $WS0 0一
set $WS1 1二
set $WS2 2三
set $WS3 3四
set $WS4 4五
set $WS5 5六
set $WS6 6七
set $WS7 7八
set $WS8 8九
set $WS9 9十
set $DPYL DP-3
set $DPYR DP-1
#
# Input & keybinds
#
input "type:keyboard" {
xkb_layout gb
}
floating_modifier $MOD normal
bindsym $MOD+return exec footclient
bindsym $MOD+shift+q kill
bindsym $MOD+d exec 'rofi -show drun'
bindsym $MOD+w exec 'rofi -show window'
bindsym $MOD+shift+r reload
bindsym $MOD+shift+e exec 'swaynag -t error -m "Hard Restart" -b "Yes" "swaymsg exit" -s "No" --button-gap 0'
bindsym $MOD+shift+x exec $LOCK
bindsym $MOD+shift+s exec 'grimshot copy area'
bindsym $MOD+shift+space floating toggle
bindsym $MOD+f fullscreen
bindsym $MOD+s split toggle
bindsym $MOD+k focus up
bindsym $MOD+j focus down
bindsym $MOD+h focus left
bindsym $MOD+l focus right
bindsym $MOD+shift+k move up
bindsym $MOD+shift+j move down
bindsym $MOD+shift+h move left
bindsym $MOD+shift+l move right
bindsym $MOD+1 workspace $WS0
bindsym $MOD+2 workspace $WS1
bindsym $MOD+3 workspace $WS2
bindsym $MOD+4 workspace $WS3
bindsym $MOD+5 workspace $WS4
bindsym $MOD+6 workspace $WS5
bindsym $MOD+7 workspace $WS6
bindsym $MOD+8 workspace $WS7
bindsym $MOD+9 workspace $WS8
bindsym $MOD+0 workspace $WS9
bindsym $MOD+shift+1 move container to workspace $WS0
bindsym $MOD+shift+2 move container to workspace $WS1
bindsym $MOD+shift+3 move container to workspace $WS2
bindsym $MOD+shift+4 move container to workspace $WS3
bindsym $MOD+shift+5 move container to workspace $WS4
bindsym $MOD+shift+6 move container to workspace $WS5
bindsym $MOD+shift+7 move container to workspace $WS6
bindsym $MOD+shift+8 move container to workspace $WS7
bindsym $MOD+shift+9 move container to workspace $WS8
bindsym $MOD+shift+0 move container to workspace $WS9
#
# Visuals
#
output $DPYL position 0 0 mode 3840x2160@60Hz scale 2
output $DPYR position 1920 0 mode 1920x1080@144Hz
output * background "background" fill #232323
# Gaps and outline
#
gaps inner 5
default_border pixel 2
# Window colours
#
client.focused #85FF85 #181818 #FFFFFF #85FF85 #85FF85
client.focused_inactive #C2FFC2 #181818 #FFFFFF #C2FFC2 #C2FFC2
client.unfocused #252525 #181818 #FFFFFF #252525 #252525
font pango:Noto Sans CJK JP 10
# swaybar
#
bar {
id 1
position top
gaps 5
workspace_min_width 25
strip_workspace_numbers yes
separator_symbol '|'
status_edge_padding 10
font pango:Noto Sans CJK JP 10
# @Todo: Make better or switch to waybar or something but I really can't be bothered using
# css to configure my desktop applications. I've already had to do it for rofi. They've
# already taken my icons from me
#
status_command while date +'時間:%a %d %b, %H:%M'; do sleep 10; done
colors {
background #181818
statusline #FFFFFF
separator #FFFFFF
active_workspace #C2FFC2 #C2FFC2 #181818
inactive_workspace #181818 #181818 #FFFFFF
focused_workspace #85FF85 #85FF85 #181818
}
}
# Startup applications
#
exec $LOCK
exec foot --server
exec swayidle -w \
timeout 900 'swaymsg "output * dpms off"' \
timeout 1800 $LOCK \
resume 'swaymsg "output * dpms on"' \
before-sleep $LOCK
# Import any system level configuration changes
#
include /etc/sway/config.d/*

142
config/sway/tokyo.sway Normal file
View File

@@ -0,0 +1,142 @@
#
# Variables
#
set $LOCK 'swaylock'
set $MOD Mod4
set $WS0 0一
set $WS1 1二
set $WS2 2三
set $WS3 3四
set $WS4 4五
set $WS5 5六
set $WS6 6七
set $WS7 7八
set $WS8 8九
set $WS9 9十
set $DPY eDP-1
#
# Input & keybinds
#
input "type:keyboard" {
xkb_layout gb
xkb_options caps:swapescape
}
floating_modifier $MOD normal
bindsym $MOD+return exec footclient
bindsym $MOD+shift+q kill
bindsym $MOD+d exec 'rofi -show drun'
bindsym $MOD+w exec 'rofi -show window'
bindsym $MOD+shift+r reload
bindsym $MOD+shift+e exec 'swaynag -t error -m "Hard Restart" -b "Yes" "swaymsg exit" -s "No" --button-gap 0'
bindsym $MOD+shift+x exec $LOCK
bindsym $MOD+shift+s exec 'grimshot copy area'
bindsym $MOD+shift+space floating toggle
bindsym $MOD+f fullscreen
bindsym $MOD+s split toggle
bindsym $MOD+k focus up
bindsym $MOD+j focus down
bindsym $MOD+h focus left
bindsym $MOD+l focus right
bindsym $MOD+shift+k move up
bindsym $MOD+shift+j move down
bindsym $MOD+shift+h move left
bindsym $MOD+shift+l move right
bindsym $MOD+1 workspace $WS0
bindsym $MOD+2 workspace $WS1
bindsym $MOD+3 workspace $WS2
bindsym $MOD+4 workspace $WS3
bindsym $MOD+5 workspace $WS4
bindsym $MOD+6 workspace $WS5
bindsym $MOD+7 workspace $WS6
bindsym $MOD+8 workspace $WS7
bindsym $MOD+9 workspace $WS8
bindsym $MOD+0 workspace $WS9
bindsym $MOD+shift+1 move container to workspace $WS0
bindsym $MOD+shift+2 move container to workspace $WS1
bindsym $MOD+shift+3 move container to workspace $WS2
bindsym $MOD+shift+4 move container to workspace $WS3
bindsym $MOD+shift+5 move container to workspace $WS4
bindsym $MOD+shift+6 move container to workspace $WS5
bindsym $MOD+shift+7 move container to workspace $WS6
bindsym $MOD+shift+8 move container to workspace $WS7
bindsym $MOD+shift+9 move container to workspace $WS8
bindsym $MOD+shift+0 move container to workspace $WS9
#
# Visuals
#
output $DPY position 0 0 mode 1920x1080@60Hz
output * background "background" fill #232323
# Gaps and outline
#
gaps inner 5
default_border pixel 2
# Window colours
#
client.focused #3185FC #181818 #FFFFFF #3185FC #3185FC
client.focused_inactive #86B8FD #181818 #FFFFFF #86B8FD #86B8FD
client.unfocused #252525 #181818 #FFFFFF #252525 #252525
font pango:Noto Sans CJK JP 11
# swaybar
#
bar {
id 1
position top
gaps 5
workspace_min_width 25
strip_workspace_numbers yes
separator_symbol '|'
status_edge_padding 10
font pango:Noto Sans CJK JP 11
# @Todo: Make better or switch to waybar or something but I really can't be bothered using
# css to configure my desktop applications. I've already had to do it for rofi. They've
# already taken my icons from me
#
status_command while date +'時間:%a %d %b, %H:%M'; do sleep 10; done
colors {
background #181818
statusline #FFFFFF
separator #FFFFFF
active_workspace #86B8FD #86B8FD #181818
inactive_workspace #181818 #181818 #FFFFFF
focused_workspace #3185FC #3185FC #181818
}
}
# Startup applications
#
exec $LOCK
exec foot --server
exec swayidle -w \
timeout 300 'swaymsg "output * dpms off"' \
timeout 600 $LOCK \
resume 'swaymsg "output * dpms on"' \
before-sleep $LOCK
# Import any system level configuration changes
#
include /etc/sway/config.d/*

57
config/swaylock/config Normal file
View File

@@ -0,0 +1,57 @@
# Background colour
#
color=000000
# Basic options
#
font=Noto Sans CJK JP
font-size=35
ignore-empty-password
daemonize
indicator-idle-visible
indicator-caps-lock
indicator-radius=120
indicator-thickness=10
# Segment colours
#
key-hl-color=FFFFFF
bs-hl-color=C2C2C2
caps-lock-key-hl-color=3185FC
caps-lock-bs-hl-color=86B8FD
separator-color=252525
line-uses-inside
# Normal
#
inside-color=252525
ring-color=676767
text-color=FFFFFF
# Cleared input
#
inside-clear-color=252525
ring-clear-color=FFFFFF
text-clear-color=FFFFFF
# Caps lock enabled
#
inside-caps-lock-color=252525
ring-caps-lock-color=FF99A1
text-caps-lock-color=FFFFFF
# Verifying password
#
inside-ver-color=252525
ring-ver-color=F6CD13
text-ver-color=FFFFFF
# Incorrect password
#
inside-wrong-color=252525
ring-wrong-color=F50014
text-wrong-color=FFFFFF

85
dots Executable file
View File

@@ -0,0 +1,85 @@
#!/bin/sh
set -e
pushd "$(dirname $0)" > /dev/null
Install() {
# Installs current dotfiles onto the system
#
echo "[Info] :: Installing dotfiles into $1"
[[ ! -d "$1" ]] && mkdir -p "$1"
cp "bashrc" "$1/.bashrc"
cp "bash_profile" "$1/.bash_profile"
cp "bash_aliases" "$1/.bash_aliases"
mkdir -p "$1/.config"
cp -r "config/nvim" "$1/.config"
cp "config/starship.toml" "$1/.config"
sed -i "s/#$HOSTNAME //" "$1/.config/starship.toml"
# Graphical setups
#
case $HOSTNAME in
kanto|tokyo)
mkdir -p "$1/.config/sway"
mkdir -p "$1/.config/swaylock"
mkdir -p "$1/.config/foot"
cp "config/sway/$HOSTNAME.sway" "$1/.config/sway/config"
cp "config/swaylock/config" "$1/.config/swaylock"
cp "config/foot/foot.ini" "$1/.config/foot/foot.ini"
cp -r "config/rofi" "$1/.config"
sed -i "s/#$HOSTNAME //" "$1/.config/foot/foot.ini"
sed -i "s/\\/\\*$HOSTNAME//" "$1/.config/rofi/theme.rasi"
sed -i "s/$HOSTNAME\\*\\///" "$1/.config/rofi/theme.rasi"
;;
esac
}
Pull() {
# Allows system changes to be pulled into the repository to be committed
#
echo "[Info] :: Pulling dotfile changes from $1"
cp "$1/.bashrc" "bashrc"
cp "$1/.bash_profile" "bash_profile"
cp "$1/.bash_aliases" "bash_aliases"
cp -r "$1/.config/nvim" "config/"
cp "$1/.config/starship.toml" "config/starship.toml"
case $HOSTNAME in
kanto|tokyo)
cp "$1/.config/sway/config" "config/sway/$HOSTNAME.sway"
cp "$1/.config/rofi/config.rasi" "config/rofi/$HOSTNAME.rofi"
cp "$1/.config/rofi/$HOSTNAME.rasi" "config/rofi/$HOSTNAME.theme"
cp "$1/.config/swaylock/config" "config/swaylock"
cp "$1/.config/foot/foot.ini" "config/foot/foot.ini"
;;
esac
}
INSTALL_DIR=${2:-$HOME}
ACTION=$1
[[ -z $INSTALL_DIR ]] && echo "[Error] :: Installation directory not set" && exit 1
case $ACTION in
install)
Install $INSTALL_DIR
;;
pull)
Pull $INSTALL_DIR
;;
*)
echo "usage: $0 <install|pull|diff> [dir]"
;;
esac
popd > /dev/null

58
dots.bat Normal file
View File

@@ -0,0 +1,58 @@
@ECHO OFF
SETLOCAL DISABLEDELAYEDEXPANSION
IF "%1" == "install" (
CALL :Install
) ELSE (
IF "%1" == "pull" (
CALL :Pull
) ELSE (
ECHO usage: %0 ^<install^|pull^|diff^>
)
)
GOTO :EOF
:Install
ECHO [Info] :: Installing dotfiles
XCOPY /E /I /Y /Q "config\nvim" "%LOCALAPPDATA%\nvim" > NUL
COPY /Y "config\starship.toml" "%APPDATA%\" > NUL
COPY /Y "config\clink\inputrc" "%LOCALAPPDATA%\.inputrc" > NUL
CALL :Patch %APPDATA%\starship.toml
WHERE /q "starship"
IF %ERRORLEVEL% equ 0 (
IF NOT EXIST "%LOCALAPPDATA%\clink" ( MKDIR "%LOCALAPPDATA%\clink" )
COPY "config\clink\starship.lua" "%LOCALAPPDATA%\clink\" > NUL
)
GOTO :EOF
:Pull
ECHO [Info] :: Pulling dotfile changes
XCOPY /E /I /Y "%LOCALAPPDATA%\nvim" "config\nvim"
COPY /Y "%LOCALAPPDATA%\.inputrc" "config\clink\inputrc"
GOTO :EOF
:Patch
SET "PREFIX=#%COMPUTERNAME% "
SET "REPLACEMENT="
SET "TEMPFILE=%TEMP%\tmpdots%RANDOM%"
FOR /f "DELIMS=" %%A in ('FINDSTR /N "^" "%1"') DO (
SET "LINE=%%A"
SETLOCAL ENABLEDELAYEDEXPANSION
SET "LINE=!LINE:%PREFIX%=%REPLACEMENT%!"
SET "LINE=!LINE:*:=!"
ECHO:!LINE!>> %TEMPFILE%
ENDLOCAL
)
MOVE /Y %TEMPFILE% %1 > NUL
GOTO :EOF

24
install
View File

@@ -1,24 +0,0 @@
#!/bin/sh
set -e
Pull() {
# Allows system changes to be pulled into the repository to be committed
#
echo "[Info] :: Pulling dotfile changes from $1"
cp -r "$1/.config/nvim" "config/"
}
INSTALL_DIR=${2:-$HOME}
ACTION=${1:-push}
[[ -z $INSTALL_DIR ]] && echo "[Error] :: Installation directory not set" && exit 1
case $ACTION in
pull)
Pull $INSTALL_DIR
;;
*)
echo "usage: $0 <push|pull|diff> [dir]"
;;
esac