Skip to content
This repository has been archived by the owner on Feb 6, 2024. It is now read-only.

Commit

Permalink
fixed conflict
Browse files Browse the repository at this point in the history
  • Loading branch information
yevagorbachev committed Apr 28, 2022
2 parents dcd2bd2 + f23348a commit eba80d1
Show file tree
Hide file tree
Showing 12 changed files with 253 additions and 101 deletions.
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@
1. `Enable-WindowsOptionalFeature -Online -FeatureName Microsoft-Windows-Subsystem-Linux`
2. `Enable-WindowsOptionalFeature -Online -FeatureName VirtualMachinePlatform`
3. Execute `program-setup/auxiliary-files/wsl_update_x64.msi`
4. Install Ubuntu 20.04 LTS from the Windows Store
4. Install Ubuntu 20.04 from the Windows Store

### Basic setup
1. Clone this repository to `~/` (HTTPS)
2. `sh ~/wsl-setup/init.sh`
4. `sh program-setup/ssh-setup.sh SEED GITHUB-EMAIL GITHUB-NAME`
2. `bash ~/wsl-setup/init.sh`
4. `bash program-setup/ssh-setup.sh SEED GITHUB-EMAIL GITHUB-NAME`
3. Vim `:PlugStats` and `:PlugInstall`
2 changes: 1 addition & 1 deletion auxiliary-files/afowler-custom.zsh-theme
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ if [ $UID -eq 0 ]; then CARETCOLOR="red"; else CARETCOLOR="blue"; fi

local return_code="%(?..%{$fg[red]%}%? ↵%{$reset_color%})"

PROMPT='\$ %{$reset_color%}%{${fg[green]}%}%~ $(git_prompt_info)%{${fg_bold[$CARETCOLOR]}%}»%{${reset_color}%} '
PROMPT='\$ %{$reset_color%}%{${fg[green]}%}%3~ $(git_prompt_info)%{${fg_bold[$CARETCOLOR]}%}»%{${reset_color}%} '

RPS1="${return_code}"

Expand Down
7 changes: 4 additions & 3 deletions auxiliary-files/maketex/std-cmd.tex
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
\documentclass{article}
\usepackage{siunitx, amsmath, amssymb, adjustbox, graphicx, float, hyperref}
\usepackage[utf8]{inputenc}
\usepackage[letterpaper, portrait, margin=1in]{geometry}
\usepackage{adjustbox}
\usepackage[shortlabels]{enumitem}
\usepackage{siunitx, amsmath, amssymb} % symbols and operators

\setlength{\parindent}{0pt}
\setlength{\parskip}{0.5em}
\setlength{\tabcolsep}{0.5em}
\renewcommand{\arraystretch}{1.5}

% Symbols
\newcommand{\N}{\mathbb{N}}
Expand All @@ -27,7 +28,7 @@
\newcommand{\Angle}[1]{\left<#1\right>}
\newcommand{\bra}[1]{\langle#1}
\newcommand{\ket}[1]{|#1\rangle}
\newcommand{\Si}[1]{\,\si{#1}\,}
\newcommand{\Si}[1]{\,\si{#1}}

\renewcommand{\vec}[1]{\mathbf{#1}}
\newcommand{\dv}[3][]{\frac{\dd ^{#1} #2}{\dd #3 ^{#1}}}
Expand Down
12 changes: 0 additions & 12 deletions configs/.vim/.netrwhist

This file was deleted.

127 changes: 74 additions & 53 deletions configs/.vim/UltiSnips/tex.snippets
Original file line number Diff line number Diff line change
Expand Up @@ -10,86 +10,103 @@ def env(name):
return x != '0' and x != '0'
endglobal

# [[[ TEXT FORMATTING
# [[[ ENVIRONMENTS

snippet '\\begin{(\w+)}' "begin/end" r
snippet '\\begin{(\w+\*?)}' "begin/end" r
\begin{`!p snip.rv = match.group(1)`}
$0
\end{`!p snip.rv = match.group(1)`}
endsnippet

snippet 'ENUM(\d+)?' "enumerate" r
\begin{enumerate}[$1]
`!p snip.rv = (int(match.group(1)) if match.group(1) else 1) * '\item '`
\end{enumerate}$0
snippet FIG "figure"
\begin{figure}
\centering
${3:body}
\caption{$1}
\label{fig:$2}
\end{figure}
$0
endsnippet

snippet 'TAB(\d+)?' "tabular" r
\begin{tabular}{|`!p snip.rv = (int(match.group(1)) if match.group(1) else 1) * 'c|'`}
snippet SUB "subfigure"
\begin{subfigure}{${1:0.45\textwidth}}
% requires \usepackage{subcaption}
\includegraphics[${2:dimension}]{${3:path}}
\caption{$4}
\label{fig:$5}
\end{subfigure}
$0
endsnippet

snippet TAB "table"
\begin{table}
\centering
${3:body}
\caption{$1}
\label{tbl:$2}
\end{table}$0
endsnippet

snippet ULAR "tabular"
\begin{tabular}{${1:colspec}}
\hline $2 \\\\
\hline
`!p snip.rv = (int(match.group(1)) - 1 if match.group(1) else 1) * '& '` \\\\
\end{tabular}
\end{tabular}$0
endsnippet

# [[[ MATH FORMATTING

# captures single chars or commands into a hat
context "math()"
priority 2
snippet '(\\\w+|\w)(dot|vec|hat)' "suffixes basic" wr
`!p snip.rv = f"\\{match.group(2)}{{{match.group(1)}}}"`$0
endsnippet

# captures commands with arguments (other hats) into a hat
context "math()"
snippet '^(.*)(dot|ddot|vec|hat)' "suffixes advanced" wr
priority 1
snippet '^(.+)(dot|vec|hat)$' "suffixes advanced" wr
`!p
depth = 0
seek = len(match.group(1)) - 1
arg = 0
line = match.group(1)
ischar = lambda c: re.match('[a-zA-Z]', c)
isopen = lambda c: c in '([{'
isclos = lambda c: c in ')]}'
if isclos(line[seek]):
depth -= 1
while depth and seek:
seek -= 1
if isopen(line[seek]):
depth += 1
elif isclos(line[seek]):
depth -= 1
save = -1
while seek:
seek -= 1
if ischar(line[seek]):
if not save:
save = seek
else:
if line[seek] == '\\':
save = seek
first = match.group(1)
i = len(first) - 1
while i: # match delimeter groups
if first[i] in "}])":
depth += 1
elif first[i] in "{[(":
depth -= 1
if depth <= 0:
break
snip.rv = line[:save] + '\\' + match.group(2) + '{' + line[save:] + '}'
`
i -= 1
# i now is at the position of the matched open delimeter closest to the end
arg_re = re.compile(r"^(.*?)(\\\w+)") # match "(stuff)\(command)"
sm = arg_re.match(first[:i])
if not sm: # the string doesn't exactly match "\command{arguments}", do nothing.
snip.rv = match.string # do nothing, just to be safe
else:
snip.rv = f"{sm.group(1)}\\{match.group(2)}{{{sm.group(2)}{first[i:]}}}"
`$0
endsnippet

# automatic super or subscript
context "math()"
snippet '(\^|_)(\\?[\-a-zA-Z0-9])' "Script" wirA
`!p snip.rv = match.group(1)`{`!p snip.rv = match.group(2)`$1}$0
endsnippet


# uses \9 because it's slightly faster and less accident-prone due to A
snippet \9 "Inline equation" iA
\($1\)$0
endsnippet

snippet '\\\[ ' "Aligned unlabeled equation" rA
snippet \[ "Aligned unlabeled equation" i
\[$1\]$0
endsnippet

snippet eqn "equation" A
\begin{equation}\label{$1}
$2
\end{equation}
endsnippet

# [[[ OPERATIONS

# automatically creates fraction numerator, obeys delim groups
context "math()"
snippet '(^.*)//' "Fraction" wrA
`!p
Expand All @@ -101,29 +118,33 @@ while i:
depth += 1
elif argument[i] in "{[(":
depth -= 1
if depth < 0 or (depth == 0 and argument[i] in ' +-='):
if depth < 0 or (depth == 0 and argument[i] in ' =\t'):
break
i -= 1
snip.rv = argument[:i+1] + '\\frac{%s}{' % argument[i+1:]`$1}$0
snip.rv = argument[:i+1] + '\\frac{' + argument[i+1:]`$1}{$2}$0
endsnippet

# shortcut for integral
context "math()"
snippet int "Integral" i
\int_{$1}$2\dd{$3}$0
endsnippet

# shortcut for differentor operators
context "math()"
snippet '\\(p?dt)' "solo diff" ir
snippet '\\(p?dt)' "diff operator" ir
\\`!p snip.rv = match.group(1)`{$1}$0
endsnippet

# shortcut for derivatives
context "math()"
snippet '\\(p?dv)' "diff in numerator" ir
snippet '\\(p?dv)' "derivative" ir
\\`!p snip.rv = match.group(1)`{$1}{$2}$0
endsnippet

# shortcut for second partial derivatives
context "math()"
snippet \pddv "second diff" i
snippet \pddv "second derivative" i
\pddv{$1}{$2}{$3}$0
endsnippet
63 changes: 63 additions & 0 deletions configs/.vim/after/syntax/c.vim
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
" We define our own handling for if, while and for, so remove them from
" the simple keyword matching used by default
syn clear cConditional
syn clear cRepeat

syn keyword cConditional switch else
syn keyword cRepeat do

" Matches for types in function parameters
syn match cJCParamVoid "\<void\>" contained
syn match cJCParamType "\<\(\(const\|restrict\|volatile\|signed\|unsigned\|struct\|enum\)[ \t*]\+\)*\I\i*[ \t*]\+\I"he=e-1 contained containedin=cJCFor

" Matchs for types in variables and function declarations
syn match cJCTypeInDecl "^\s*\(\(inline\|const\|restrict\|extern\|GLOBAL\|static\|register\|auto\|volatile\|virtual\|signed\|unsigned\|struct\)[ \t*]\+\)*\I\i*\([ \t*]\+\(const\|restrict\|volatile\)\)*[ \t*]*" contained
syn match cJCDecl "^\s*\(inline\s\+\)\=\(\I\i*[ \t*]\+\)\+\s*\I" contains=cJCTypeInDecl

" Matches function declarations and definitions
syn region cJCFunc start="^\(\(inline\|const\|extern\|GLOBAL\|static\|register\|auto\|volatile\|virtual\|signed\|unsigned\|struct\)[ \t*]\+\)*\I\i*\s\+\**\s*\I[[:ident:]:]*\s*(" end=")" contains=CJCParamVoid,cJCParamType,cJCTypeInDecl,cComment
syn region cJCFunc start="^\I\i*\s*(" end=")" contains=CJCParamVoid,cJCParamType

" Matches type casts
syn match cJCTypeCast "(\@<=\s*\(\(const\|restrict\|volatile\|signed\|unsigned\|struct\|enum\)[ \t*]\+\)*\I\i*\s*\**\s*\(restrict\)\?\s*)\s*[^) \t;,{]"me=e-2
"syn match cJCTypeCast "[[:space:],(]*(\I\i*\s*\**\s*)\s*"me=e-1,ms=s+1


" Matchs function calls and if/else/while, so they are not
" accidentally matched by things above.
syn match cJCFctCall "\i\s*(\s*\(\(const\|restrict\|volatile\|signed\|unsigned\|struct\|enum\)[ \t*]\+\)*\I\i*\s*\**\s*)"
syn region cJCIfParent matchgroup=cStatement start="(" end=")" contained contains=ALLBUT,@cParenGroup,cJCTypeInDecl
syn region cJCIf matchgroup=cConditional start="\(\s*\(\<else\s\+\)\=\<if\|\s*\<while\)\s*("rs=e-1 matchgroup=NONE end="." contains=cJCIfParent
syn region cJCFor matchgroup=cConditional start="\<for\s*(" end=")" contains=ALLBUT,@cParenGroup,cJCTypeInDecl,cErrInBracket

" Put our custom matching things in clusters that are used in ALLBUT places
" in vim standard C highlighting, because we don't want them to match there.
syn cluster cParenGroup add=cJCTypeInDecl,cJCParamType
syn cluster cPreProcGroup add=cJCParamType,cJCTypeCast

" Override some standard C things because cJCDecl matches a bit too easily
syn match cStatement "^\s*return\>."me=e-1
syn match cStatement "^\s*goto\s\+\I"me=e-1
syn match cConditional "^\s*case\>."me=e-1
syn match cConditional ":\s*$"


" Delete the keyword-based cType matching, it just gets in the way
syn clear cType

" And finally the thing we wanted to do: highlight all the types using cType
" highlight, not just the ones matching C keywords.
hi link cJCType cType
hi link cJCParamType cType
hi link cJCTypeInDecl cType
hi link cJCTypeCast cType

" Uncomment these for debug mode: very visible highlight of what we match
"hi cJCTypeCast guibg=#ff0000
"hi cJCDecl guibg=#d08080
"hi cJCType guibg=#FFFF00
"hi cJCTypeInDecl guibg=#FF00FF
"hi cJCFunc guibg=#00FF00
"hi cJCParamType guibg=#0000FF
"hi cJCIf guibg=#00FFFF
"hi cJCFor guibg=#00FF80
50 changes: 50 additions & 0 deletions configs/.vim/after/syntax/cpp.vim
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
" Delete the keyword-based cType matching, it just gets in the way
syn clear cppType

" Redefine cppStatement so that "new" is not a keyword, so the below can match
" it
syn clear cppStatement

syn keyword cJCNewStatement new contained
hi def link cJCNewStatement cppStatement

syn keyword cppStatement delete this friend using
if !exists("cpp_no_cpp20")
syn keyword cppStatement co_await co_return co_yield requires
endif

" Detect type in "new" expressions
syn match cJCNew "new \I[[:ident:]:]*" contains=cJCNewStatement

" Match various well known things from the STL that are known to contain types
" in their template arguments
syn match cJCCppCast "\(static_cast\|dynamic_cast\|reinterpret_cast\|const_cast\|time_point_cast\|make_unique\|make_shared\|make_optional\)<\zs\I[[:ident:]:&*]*>"me=e-1

" Redefine several things from the C syntax to handle templates and references
" in addition to the other things
syn clear cJCTypeInDecl
syn clear cJCDecl
syn clear cJCFunc
syn clear cJCParamType

syn match cJCTypeInDecl "^\s*\(\(inline\|const\|restrict\|extern\|GLOBAL\|static\|register\|auto\|volatile\|virtual\|signed\|unsigned\|struct\)[ \t*]\+\)*\I[[:ident:]:<>]*&\?\([ \t*]\+\(const\|restrict\|volatile\)\)*[ \t*]*" contained
syn match cJCDecl "^\s*\(inline\s\+\)\=\(\I[[:ident:]:<>]*&\?[ \t*]\+\)\+\s*\I" contains=cJCTypeInDecl

syn region cJCFunc start="^\t*\(\(inline\|const\|extern\|GLOBAL\|static\|register\|auto\|volatile\|virtual\|signed\|unsigned\|struct\)[ \t*]\+\)*\I[[:ident:]:<>]*\s\+\**\s*\I[[:ident:]:]*\s*(" end=")" contains=CJCParamVoid,cJCParamType,cJCTypeInDecl,cComment

" This matches constructors, but only if they are in the first column for now
" (no identation). Otherwise it also matches all function calls, and that
" breaks a lot of things.
syn region cJCFunc start="^\I[[:ident:]:<>]*\s*(" end=")" contains=CJCParamVoid,cJCParamType

syn match cJCParamType "\<\(\(const\|restrict\|volatile\|signed\|unsigned\|struct\|enum\)[ \t*]\+\)*\I[[:ident:]:<>]*&\?[ \t*]\+\I"he=e-1 contained containedin=cJCFor

hi link cJCNew cType

hi link cJCCppCast cType
hi link cJCTypeInDecl cType
hi link cJCParamType cType

" Uncomment these for debug mode: very visible highlight of what we match
"hi cJCCppCast guibg=#00FF80
"hi cJCFunc guibg=#00FF00
3 changes: 2 additions & 1 deletion configs/.vimrc
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@ highlight LineNr ctermfg=grey
set tabstop=4
set shiftwidth=4
set regexpengine=1

set textwidth=80
set tags=~/repos/NIGEL-Flight-Computer/tags
let g:tex_flavor = "latex"

call plug#begin('~/.vim/plugged')
Expand Down
Loading

0 comments on commit eba80d1

Please sign in to comment.