Compare commits
2 commits
f783143034
...
5b3d7a4e35
Author | SHA1 | Date | |
---|---|---|---|
5b3d7a4e35 | |||
565eadc933 |
12 changed files with 700 additions and 35 deletions
|
@ -8,6 +8,7 @@ sh -c "$(curl -fsLS https://chezmoi.io/get)" -- init --apply git.dayl.in/daylin
|
||||||
```
|
```
|
||||||
|
|
||||||
From Mirror:
|
From Mirror:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
sh -c "$(curl -fsLS https://chezmoi.io/get)" -- init --apply daylinmorgan -S ~/.dotfiles --ssh
|
sh -c "$(curl -fsLS https://chezmoi.io/get)" -- init --apply daylinmorgan -S ~/.dotfiles --ssh
|
||||||
```
|
```
|
||||||
|
|
4
home/private_dot_config/nim/README.md
Normal file
4
home/private_dot_config/nim/README.md
Normal file
|
@ -0,0 +1,4 @@
|
||||||
|
# Nim Configuration
|
||||||
|
|
||||||
|
|
||||||
|
`config.nims` sourced from -> https://github.com/kaushalmodi/nim_config
|
476
home/private_dot_config/nim/config.nims
Normal file
476
home/private_dot_config/nim/config.nims
Normal file
|
@ -0,0 +1,476 @@
|
||||||
|
|
||||||
|
|
||||||
|
from macros import error
|
||||||
|
from strutils import `%`, endsWith, strip, replace
|
||||||
|
from sequtils import filterIt, concat
|
||||||
|
|
||||||
|
const
|
||||||
|
nimVersion = (major: NimMajor, minor: NimMinor, patch: NimPatch)
|
||||||
|
|
||||||
|
when nimVersion <= (0, 19, 9):
|
||||||
|
from ospaths import `/`, splitPath, splitFile
|
||||||
|
when not defined(projectDir):
|
||||||
|
let projectDir = getCurrentDir
|
||||||
|
echo "\nprojectDir() is not defined, fallback to getCurrentDir(), you must run it from the project directory (needs Nim devel).\n"
|
||||||
|
else:
|
||||||
|
when nimVersion < (1, 2, 0):
|
||||||
|
from os import `/`, splitPath, splitFile
|
||||||
|
import oswalkdir # This was deprecated in Nim 1.2.0; just use "import os" instead
|
||||||
|
else:
|
||||||
|
when nimVersion < (1, 3, 0):
|
||||||
|
from os import `/`, splitPath, splitFile, walkDirRec, pcFile, pcDir
|
||||||
|
else:
|
||||||
|
# nim devel
|
||||||
|
import std/[os]
|
||||||
|
|
||||||
|
when nimVersion >= (1, 7, 3):
|
||||||
|
import std/[assertions] # for doAssert
|
||||||
|
|
||||||
|
# Switches
|
||||||
|
hint("Processing", false) # Do not print the "Hint: .. [Processing]" messages when compiling
|
||||||
|
|
||||||
|
# Use Dragonbox by default - https://github.com/nim-lang/Nim/commit/25efb5386293540b0542833625d3fb6e22f3cfbc
|
||||||
|
switch("define", "nimFpRoundtrips")
|
||||||
|
|
||||||
|
when nimVersion >= (0, 20, 0):
|
||||||
|
when defined(strictMode):
|
||||||
|
switch("styleCheck", "error")
|
||||||
|
else:
|
||||||
|
switch("styleCheck", "hint")
|
||||||
|
|
||||||
|
## Constants
|
||||||
|
const
|
||||||
|
doOptimize = true
|
||||||
|
stripSwitches = @["--strip-all", "--remove-section=.comment", "--remove-section=.note.gnu.gold-version", "--remove-section=.note", "--remove-section=.note.gnu.build-id", "--remove-section=.note.ABI-tag"]
|
||||||
|
# upxSwitches = @["--best"] # fast
|
||||||
|
upxSwitches = @["--ultra-brute"] # slower
|
||||||
|
checksumsSwitches = @["--tag"]
|
||||||
|
gpgSignSwitches = @["--clear-sign", "--armor", "--detach-sign", "--digest-algo sha512"]
|
||||||
|
gpgEncryptSwitches = @["--armor", "--symmetric", "--s2k-digest-algo sha512", "--cipher-algo AES256", "-z 9"] # 9=Max, 0=Disabled
|
||||||
|
|
||||||
|
proc getGitRootMaybe(): string =
|
||||||
|
## Try to get the path to the current git root directory.
|
||||||
|
## Return ``projectDir()`` if a ``.git`` directory is not found.
|
||||||
|
const
|
||||||
|
maxAttempts = 10 # arbitrarily picked
|
||||||
|
var
|
||||||
|
path = projectDir() # projectDir() needs nim 0.20.0 (or nim devel as of Tue Oct 16 08:41:09 EDT 2018)
|
||||||
|
attempt = 0
|
||||||
|
while (attempt < maxAttempts) and (not dirExists(path / ".git")):
|
||||||
|
path = path / "../"
|
||||||
|
attempt += 1
|
||||||
|
if dirExists(path / ".git"):
|
||||||
|
result = path
|
||||||
|
else:
|
||||||
|
result = projectDir()
|
||||||
|
|
||||||
|
## Lets
|
||||||
|
let
|
||||||
|
root = getGitRootMaybe()
|
||||||
|
(_, pkgName) = root.splitPath()
|
||||||
|
srcFile = root / "src" / (pkgName & ".nim")
|
||||||
|
# pcre
|
||||||
|
pcreVersion = getEnv("PCREVER", "8.42")
|
||||||
|
pcreSourceDir = "pcre-" & pcreVersion
|
||||||
|
pcreArchiveFile = pcreSourceDir & ".tar.bz2"
|
||||||
|
pcreDownloadLink = "https://downloads.sourceforge.net/pcre/" & pcreArchiveFile
|
||||||
|
pcreInstallDir = (root / "pcre/") & pcreVersion
|
||||||
|
# http://www.linuxfromscratch.org/blfs/view/8.1/general/pcre.html
|
||||||
|
pcreConfigureCmd = ["./configure", "--prefix=" & pcreInstallDir, "--enable-pcre16", "--enable-pcre32", "--disable-shared"]
|
||||||
|
pcreLibDir = pcreInstallDir / "lib"
|
||||||
|
pcreLibFile = pcreLibDir / "libpcre.a"
|
||||||
|
# libressl
|
||||||
|
libreSslVersion = getEnv("LIBRESSLVER", "2.8.1")
|
||||||
|
libreSslSourceDir = "libressl-" & libreSslVersion
|
||||||
|
libreSslArchiveFile = libreSslSourceDir & ".tar.gz"
|
||||||
|
libreSslDownloadLink = "https://ftp.openbsd.org/pub/OpenBSD/LibreSSL/" & libreSslArchiveFile
|
||||||
|
libreSslInstallDir = (root / "libressl/") & libreSslVersion
|
||||||
|
libreSslConfigureCmd = ["./configure", "--disable-shared", "--prefix=" & libreSslInstallDir]
|
||||||
|
libreSslLibDir = libreSslInstallDir / "lib"
|
||||||
|
libreSslLibFile = libreSslLibDir / "libssl.a"
|
||||||
|
libreCryptoLibFile = libreSslLibDir / "libcrypto.a"
|
||||||
|
libreSslIncludeDir = libreSslInstallDir / "include/openssl"
|
||||||
|
# openssl
|
||||||
|
openSslSeedConfigOsCompiler = "linux-x86_64"
|
||||||
|
openSslVersion = getEnv("OPENSSLVER", "1.1.1")
|
||||||
|
openSslSourceDir = "openssl-" & openSslVersion
|
||||||
|
openSslArchiveFile = openSslSourceDir & ".tar.gz"
|
||||||
|
openSslDownloadLink = "https://www.openssl.org/source/" & openSslArchiveFile
|
||||||
|
openSslInstallDir = (root / "openssl/") & openSslVersion
|
||||||
|
# "no-async" is needed for openssl to compile using musl
|
||||||
|
# - https://gitter.im/nim-lang/Nim?at=5bbf75c3ae7be940163cc198
|
||||||
|
# - https://www.openwall.com/lists/musl/2016/02/04/5
|
||||||
|
# -DOPENSSL_NO_SECURE_MEMORY is needed to make openssl compile using musl.
|
||||||
|
# - https://github.com/openssl/openssl/issues/7207#issuecomment-420814524
|
||||||
|
openSslConfigureCmd = ["./Configure", openSslSeedConfigOsCompiler, "no-shared", "no-zlib", "no-async", "-fPIC", "-DOPENSSL_NO_SECURE_MEMORY", "--prefix=" & openSslInstallDir]
|
||||||
|
openSslLibDir = openSslInstallDir / "lib"
|
||||||
|
openSslLibFile = openSslLibDir / "libssl.a"
|
||||||
|
openCryptoLibFile = openSslLibDir / "libcrypto.a"
|
||||||
|
openSslIncludeDir = openSslInstallDir / "include/openssl"
|
||||||
|
# Custom Header file to force to link to GLibC 2.5, for old Linux (x86_64).
|
||||||
|
glibc25DownloadLink = "https://raw.githubusercontent.com/wheybags/glibc_version_header/master/version_headers/x64/force_link_glibc_2.5.h"
|
||||||
|
|
||||||
|
|
||||||
|
## Helper Procs
|
||||||
|
# https://github.com/kaushalmodi/elnim
|
||||||
|
proc dollar[T](s: T): string =
|
||||||
|
result = $s
|
||||||
|
proc mapconcat[T](s: openArray[T]; sep = " "; op: proc(x: T): string = dollar): string =
|
||||||
|
## Concatenate elements of ``s`` after applying ``op`` to each element.
|
||||||
|
## Separate each element using ``sep``.
|
||||||
|
for i, x in s:
|
||||||
|
result.add(op(x))
|
||||||
|
if i < s.len-1:
|
||||||
|
result.add(sep)
|
||||||
|
|
||||||
|
proc parseArgs(): tuple[switches: seq[string], nonSwitches: seq[string]] =
|
||||||
|
## Parse the args and return its components as
|
||||||
|
## ``(switches, nonSwitches)``.
|
||||||
|
let
|
||||||
|
numParams = paramCount() # count starts at 0
|
||||||
|
# So "nim musl foo.nim" will have a count of 2.
|
||||||
|
# param 0 will always be "nim"
|
||||||
|
doAssert numParams >= 1
|
||||||
|
# param 1 will always be the task name like "musl".
|
||||||
|
let
|
||||||
|
subCmd = paramStr(1)
|
||||||
|
|
||||||
|
if numParams < 2:
|
||||||
|
error("The '$1' sub-command needs at least one non-switch argument" % [subCmd])
|
||||||
|
|
||||||
|
for i in 2 .. numParams:
|
||||||
|
if paramStr(i)[0] == '-': # -d:foo or --define:foo
|
||||||
|
result.switches.add(paramStr(i))
|
||||||
|
else:
|
||||||
|
result.nonSwitches.add(paramStr(i))
|
||||||
|
|
||||||
|
proc runUtil(f, util: string; args: seq[string]) =
|
||||||
|
## Run ``util`` executable with ``args`` on ``f`` file.
|
||||||
|
doAssert findExe(util) != "",
|
||||||
|
"'$1' executable was not found" % [util]
|
||||||
|
let
|
||||||
|
cmd = concat(@[util], args, @[f]).mapconcat()
|
||||||
|
echo "Running '$1' .." % [cmd]
|
||||||
|
exec cmd
|
||||||
|
|
||||||
|
template preBuild(targetPlusSwitches: string) =
|
||||||
|
assert targetPlusSwitches.len > 0, "Build arguments must not be empty"
|
||||||
|
when defined(libressl) and defined(openssl):
|
||||||
|
error("Define only 'libressl' or 'openssl', not both.")
|
||||||
|
let (switches, nimFiles) = parseArgs()
|
||||||
|
assert nimFiles.len > 0, """
|
||||||
|
This nim sub-command accepts at least one Nim file name
|
||||||
|
Examples: nim <SUB COMMAND> FILE.nim
|
||||||
|
nim <SUB COMMAND> FILE1.nim FILE2.nim
|
||||||
|
nim <SUB COMMAND> -d:pcre FILE.nim
|
||||||
|
"""
|
||||||
|
var allBuildCmds {.inject.} = newSeqOfCap[tuple[nimArgs, binFile: string]](nimFiles.len)
|
||||||
|
for f in nimFiles:
|
||||||
|
let
|
||||||
|
extraSwitches = switches.mapconcat()
|
||||||
|
(dirName, baseName, tmpVar) = splitFile(f)
|
||||||
|
binFile = dirName / baseName # Save the binary in the same dir as the nim file
|
||||||
|
nimArgsArray = when doOptimize:
|
||||||
|
[targetPlusSwitches, "-d:musl", "-d:release", "--opt:size", "--passL:-s", "--listFullPaths:off", "--excessiveStackTrace:off", extraSwitches, " --out:" & binFile, f]
|
||||||
|
else:
|
||||||
|
[targetPlusSwitches, "-d:musl", extraSwitches, " --out:" & binFile, f]
|
||||||
|
nimArgs = nimArgsArray.mapconcat()
|
||||||
|
discard tmpVar # Avoid the "declared but not used" warning. Workaround for https://github.com/nim-lang/Nim/issues/12094
|
||||||
|
allBuildCmds.add((nimArgs: nimArgs, binFile: binFile))
|
||||||
|
|
||||||
|
|
||||||
|
## Tasks
|
||||||
|
task installPcre, "Install PCRE using musl-gcc":
|
||||||
|
if not fileExists(pcreLibFile):
|
||||||
|
if not dirExists(pcreSourceDir):
|
||||||
|
if not fileExists(pcreArchiveFile):
|
||||||
|
exec("curl -LO " & pcreDownloadLink)
|
||||||
|
exec("tar xf " & pcreArchiveFile)
|
||||||
|
else:
|
||||||
|
echo "PCRE lib source dir " & pcreSourceDir & " already exists"
|
||||||
|
withDir pcreSourceDir:
|
||||||
|
putEnv("CC", "musl-gcc -static")
|
||||||
|
exec(pcreConfigureCmd.mapconcat())
|
||||||
|
exec("make -j8")
|
||||||
|
exec("make install")
|
||||||
|
else:
|
||||||
|
echo pcreLibFile & " already exists"
|
||||||
|
setCommand("nop")
|
||||||
|
|
||||||
|
task installLibreSsl, "Install LIBRESSL using musl-gcc":
|
||||||
|
if (not fileExists(libreSslLibFile)) or (not fileExists(libreCryptoLibFile)):
|
||||||
|
if not dirExists(libreSslSourceDir):
|
||||||
|
if not fileExists(libreSslArchiveFile):
|
||||||
|
exec("curl -LO " & libreSslDownloadLink)
|
||||||
|
exec("tar xf " & libreSslArchiveFile)
|
||||||
|
else:
|
||||||
|
echo "LibreSSL lib source dir " & libreSslSourceDir & " already exists"
|
||||||
|
withDir libreSslSourceDir:
|
||||||
|
# -idirafter /usr/include/ # Needed for linux/sysctl.h
|
||||||
|
# -idirafter /usr/include/x86_64-linux-gnu/ # Needed for Travis/Ubuntu build to pass, for asm/types.h
|
||||||
|
putEnv("CC", "musl-gcc -static -idirafter /usr/include/ -idirafter /usr/include/x86_64-linux-gnu/")
|
||||||
|
putEnv("C_INCLUDE_PATH", libreSslIncludeDir)
|
||||||
|
exec(libreSslConfigureCmd.mapconcat())
|
||||||
|
exec("make -j8 -C crypto") # build just the "crypto" component
|
||||||
|
exec("make -j8 -C ssl") # build just the "ssl" component
|
||||||
|
exec("make -C crypto install")
|
||||||
|
exec("make -C ssl install")
|
||||||
|
else:
|
||||||
|
echo libreSslLibFile & " already exists"
|
||||||
|
setCommand("nop")
|
||||||
|
|
||||||
|
task installOpenSsl, "Install OPENSSL using musl-gcc":
|
||||||
|
if (not fileExists(openSslLibFile)) or (not fileExists(openCryptoLibFile)):
|
||||||
|
if not dirExists(openSslSourceDir):
|
||||||
|
if not fileExists(openSslArchiveFile):
|
||||||
|
exec("curl -LO " & openSslDownloadLink)
|
||||||
|
exec("tar xf " & openSslArchiveFile)
|
||||||
|
else:
|
||||||
|
echo "OpenSSL lib source dir " & openSslSourceDir & " already exists"
|
||||||
|
withDir openSslSourceDir:
|
||||||
|
# https://gcc.gnu.org/onlinedocs/gcc/Directory-Options.html
|
||||||
|
# -idirafter /usr/include/ # Needed for Travis/Ubuntu build to pass, for linux/version.h, etc.
|
||||||
|
# -idirafter /usr/include/x86_64-linux-gnu/ # Needed for Travis/Ubuntu build to pass, for asm/types.h
|
||||||
|
putEnv("CC", "musl-gcc -static -idirafter /usr/include/ -idirafter /usr/include/x86_64-linux-gnu/")
|
||||||
|
putEnv("C_INCLUDE_PATH", openSslIncludeDir)
|
||||||
|
exec(openSslConfigureCmd.mapconcat())
|
||||||
|
echo "The insecure switch -DOPENSSL_NO_SECURE_MEMORY is needed so that OpenSSL can be compiled using MUSL."
|
||||||
|
exec("make -j8 depend")
|
||||||
|
exec("make -j8")
|
||||||
|
exec("make install_sw")
|
||||||
|
else:
|
||||||
|
echo openSslLibFile & " already exists"
|
||||||
|
setCommand("nop")
|
||||||
|
|
||||||
|
task strip, "Optimize the binary size using 'strip' utility":
|
||||||
|
## Usage: nim strip <FILE1> <FILE2> ..
|
||||||
|
let
|
||||||
|
(_, binFiles) = parseArgs()
|
||||||
|
for f in binFiles:
|
||||||
|
f.runUtil("strip", stripSwitches)
|
||||||
|
setCommand("nop")
|
||||||
|
|
||||||
|
task upx, "Optimize the binary size using 'upx' utility":
|
||||||
|
## Usage: nim upx <FILE1> <FILE2> ..
|
||||||
|
let
|
||||||
|
(_, binFiles) = parseArgs()
|
||||||
|
for f in binFiles:
|
||||||
|
f.runUtil("upx", upxSwitches)
|
||||||
|
setCommand("nop")
|
||||||
|
|
||||||
|
task checksums, "Generate checksums of the binary using 'sha1sum' and 'md5sum'":
|
||||||
|
## Usage: nim checksums <FILE1> <FILE2> ..
|
||||||
|
let (_, binFiles) = parseArgs()
|
||||||
|
for f in binFiles:
|
||||||
|
f.runUtil("md5sum", checksumsSwitches)
|
||||||
|
f.runUtil("sha1sum", checksumsSwitches)
|
||||||
|
setCommand("nop")
|
||||||
|
|
||||||
|
task sign, "Sign the binary using 'gpg' (armored, ascii)":
|
||||||
|
## Usage: nim sign <FILE1> <FILE2> ..
|
||||||
|
let (_, binFiles) = parseArgs()
|
||||||
|
for f in binFiles:
|
||||||
|
f.runUtil("gpg", gpgSignSwitches)
|
||||||
|
setCommand("nop")
|
||||||
|
|
||||||
|
task encrypt, "Encrypt the binary using 'gpg' (compressed, symmetric, ascii)":
|
||||||
|
## Usage: nim encrypt <FILE1> <FILE2> ..
|
||||||
|
# Decrypt is just double click or 'gpg --decrypt' (Asks Password).
|
||||||
|
let (_, binFiles) = parseArgs()
|
||||||
|
for f in binFiles:
|
||||||
|
f.runUtil("gpg", gpgEncryptSwitches)
|
||||||
|
setCommand("nop")
|
||||||
|
|
||||||
|
task musl, "Build an optimized static binary using musl":
|
||||||
|
## Usage: nim musl [-d:pcre] [-d:libressl|-d:openssl] <FILE1> <FILE2> ..
|
||||||
|
preBuild("c")
|
||||||
|
for cmd in allBuildCmds:
|
||||||
|
# Build binary
|
||||||
|
echo "\nRunning 'nim " & cmd.nimArgs & "' .."
|
||||||
|
selfExec cmd.nimArgs
|
||||||
|
when doOptimize:
|
||||||
|
cmd.binFile.runUtil("strip", stripSwitches)
|
||||||
|
cmd.binFile.runUtil("upx", upxSwitches)
|
||||||
|
echo "Built: " & cmd.binFile
|
||||||
|
|
||||||
|
task glibc25, "Build C, dynamically linked to GLibC 2.5 (x86_64)":
|
||||||
|
## Usage: nim glibc25 file.nim
|
||||||
|
# See https://github.com/wheybags/glibc_version_header/pull/21.
|
||||||
|
let
|
||||||
|
header = getCurrentDir() / "force_link_glibc_2.5.h"
|
||||||
|
optns = ["-ffast-math", "-flto", "-include" & header] # Don't use -march here
|
||||||
|
if not fileExists(header):
|
||||||
|
exec("curl -LO " & glibc25DownloadLink)
|
||||||
|
var passCSwitches: string
|
||||||
|
for o in optns:
|
||||||
|
passCSwitches.add(" --passC:" & o)
|
||||||
|
preBuild("c -d:ssl" & passCSwitches)
|
||||||
|
for cmd in allBuildCmds:
|
||||||
|
echo "\nRunning 'nim " & cmd.nimArgs
|
||||||
|
# preBuild auto-adds "-d:musl", so remove that.
|
||||||
|
# FIXME: Make preBuild not always add that switch. -- Thu Jun 13 12:13:17 EDT 2019 - kmodi
|
||||||
|
selfExec cmd.nimArgs.replace("-d:musl", "")
|
||||||
|
when doOptimize:
|
||||||
|
cmd.binFile.runUtil("strip", stripSwitches)
|
||||||
|
# Version check -- Changes from GLIBC_2.15 to GLIBC_2.5
|
||||||
|
cmd.binFile.runUtil("ldd", @["-v"])
|
||||||
|
|
||||||
|
task js2asm, "Build JS, print Assembly from that JS (performance debug)":
|
||||||
|
## Usage: nim js2asm <FILE1> <FILE2> ..
|
||||||
|
# This debugs performance of JavaScript, the less ASM the better JS.
|
||||||
|
# This ASM is NOT usable as proper ASM, just for Debug performance.
|
||||||
|
preBuild("js")
|
||||||
|
for cmd in allBuildCmds:
|
||||||
|
echo "\nRunning 'nim " & cmd.nimArgs
|
||||||
|
selfExec cmd.nimArgs
|
||||||
|
cmd.binFile.runUtil("node", @["--print_code"])
|
||||||
|
|
||||||
|
task c2asm, "Build C, print Assembly from that C (performance debug)":
|
||||||
|
## Usage: nim c2asm <FILE1> <FILE2> ..
|
||||||
|
# This debugs performance of Nim, the less ASM the better your Nim.
|
||||||
|
const
|
||||||
|
optns = [ # This cleans up the produced ASM as much as possible.
|
||||||
|
"-ffast-math", "-march=native", "-fno-math-errno", "-fno-exceptions",
|
||||||
|
"-fno-asynchronous-unwind-tables", "-fno-inline-functions", "-std=c11",
|
||||||
|
"-fno-inline-functions-called-once", "-fno-inline-small-functions",
|
||||||
|
"-xc", "-s", "-S", "-O3", "-masm=intel", "-o-"]
|
||||||
|
var passCSwitches: string
|
||||||
|
for o in optns:
|
||||||
|
passCSwitches.add(" --passC:" & o)
|
||||||
|
preBuild("compileToC --compileOnly:on -d:danger -d:noSignalHandler" & passCSwitches)
|
||||||
|
for cmd in allBuildCmds:
|
||||||
|
echo "\nRunning 'nim " & cmd.nimArgs
|
||||||
|
selfExec cmd.nimArgs
|
||||||
|
let cSource = nimcacheDir() / cmd.binFile & ".nim.c"
|
||||||
|
cSource.runUtil("gcc", @optns)
|
||||||
|
|
||||||
|
task fmt, "Run nimpretty on all git-managed .nim files in the current repo":
|
||||||
|
## Usage: nim fmt
|
||||||
|
for file in walkDirRec(root, {pcFile, pcDir}):
|
||||||
|
if file.splitFile().ext == ".nim":
|
||||||
|
let
|
||||||
|
# https://github.com/nim-lang/Nim/issues/6262#issuecomment-454983572
|
||||||
|
# https://stackoverflow.com/a/2406813/1219634
|
||||||
|
fileIsGitManaged = gorgeEx("cd $1 && git ls-files --error-unmatch $2" % [getCurrentDir(), file]).exitCode == 0
|
||||||
|
# ^^^^^-- That "cd" is required.
|
||||||
|
if fileIsGitManaged:
|
||||||
|
let
|
||||||
|
cmd = "nimpretty $1" % [file]
|
||||||
|
echo "Running $1 .." % [cmd]
|
||||||
|
exec(cmd)
|
||||||
|
setCommand("nop")
|
||||||
|
|
||||||
|
task rmfiles, "Recursively remove all files with the specific extension(s) from the current directory":
|
||||||
|
## Usage: nim rmfiles pyc c o
|
||||||
|
for extToDelete in parseArgs().nonSwitches: # Invalid Patterns: "", " ", "\t"
|
||||||
|
assert extToDelete.strip.len > 0, "Specified extension must not be whitespace or empty string"
|
||||||
|
assert extToDelete[0] != '.', "Do not prefix the extensions with dot"
|
||||||
|
for file in walkDirRec(getCurrentDir(), {pcFile, pcDir}):
|
||||||
|
if file.splitFile().ext == "." & extToDelete:
|
||||||
|
# echo "file to delete: ", file
|
||||||
|
rmFile(file)
|
||||||
|
setCommand("nop")
|
||||||
|
|
||||||
|
task test, "Run tests via 'nim doc' (runnableExamples) and tests in tests/ dir":
|
||||||
|
let
|
||||||
|
testDir = root / "tests"
|
||||||
|
selfExec("doc " & srcFile)
|
||||||
|
if dirExists(testDir):
|
||||||
|
let
|
||||||
|
testFiles = listFiles(testDir).filterIt(it.len >= 5 and it.endsWith(".nim"))
|
||||||
|
for t in testFiles:
|
||||||
|
selfExec "c -r " & t
|
||||||
|
|
||||||
|
when nimVersion >= (1, 3, 5):
|
||||||
|
task docs, "Deploy doc html + search index to public/ directory":
|
||||||
|
let
|
||||||
|
deployDir = root / "public"
|
||||||
|
selfExec("doc --project --outdir:$1 $2" % [deployDir, srcFile]) # generates search index and theindex.html too.
|
||||||
|
withDir deployDir:
|
||||||
|
# Move PKGNAME.html to index.html so that we can access the
|
||||||
|
# documentation on a clean URL like https://foo.bar/ instead of
|
||||||
|
# https://foo.bar/PKGNAME.html.
|
||||||
|
mvFile(pkgName & ".html", "index.html")
|
||||||
|
# As we renamed the file, we need to rename that in hyperlinks
|
||||||
|
# and the search index too.
|
||||||
|
for file in walkDirRec(".", {pcFile}):
|
||||||
|
exec(r"sed -i -r 's|$1\.html|index.html|g' $2" % [pkgName, file])
|
||||||
|
else:
|
||||||
|
task docs, "Deploy doc html + search index to public/ directory":
|
||||||
|
let
|
||||||
|
deployDir = root / "public"
|
||||||
|
docOutBaseName = "index"
|
||||||
|
deployHtmlFile = deployDir / (docOutBaseName & ".html")
|
||||||
|
genDocCmd = "nim doc --out:$1 --index:on $2" % [deployHtmlFile, srcFile]
|
||||||
|
genTheIndexCmd = "nim buildIndex -o:$1/theindex.html $1" % [deployDir]
|
||||||
|
deployJsFile = deployDir / "dochack.js"
|
||||||
|
docHackJsSource = "https://nim-lang.github.io/Nim/dochack.js" # devel docs dochack.js
|
||||||
|
mkDir(deployDir)
|
||||||
|
exec(genDocCmd)
|
||||||
|
exec(genTheIndexCmd)
|
||||||
|
if not fileExists(deployJsFile):
|
||||||
|
withDir deployDir:
|
||||||
|
exec("curl -LO " & docHackJsSource)
|
||||||
|
|
||||||
|
# https://www.reddit.com/r/nim/comments/byzq7d/go_run_for_nim/
|
||||||
|
task runc, "Run equivalent of 'nim c -r ..'":
|
||||||
|
switch("run")
|
||||||
|
switch("verbosity", "0")
|
||||||
|
hint("Processing", false)
|
||||||
|
setCommand("c")
|
||||||
|
|
||||||
|
task runcpp, "Run equivalent of 'nim cpp -r ..'":
|
||||||
|
switch("run")
|
||||||
|
switch("verbosity", "0")
|
||||||
|
hint("Processing", false)
|
||||||
|
setCommand("cpp")
|
||||||
|
|
||||||
|
## Define Switch Parsing
|
||||||
|
# -d:musl
|
||||||
|
when defined(musl):
|
||||||
|
var
|
||||||
|
muslGccPath: string
|
||||||
|
echo " [-d:musl] Building a static binary using musl .."
|
||||||
|
muslGccPath = findExe("musl-gcc")
|
||||||
|
if muslGccPath == "":
|
||||||
|
error("'musl-gcc' binary was not found in PATH.")
|
||||||
|
switch("passL", "-static")
|
||||||
|
switch("gcc.exe", muslGccPath)
|
||||||
|
switch("gcc.linkerexe", muslGccPath)
|
||||||
|
# -d:pcre
|
||||||
|
when defined(pcre):
|
||||||
|
let
|
||||||
|
pcreIncludeDir = pcreInstallDir / "include"
|
||||||
|
if not fileExists(pcreLibFile):
|
||||||
|
selfExec "installPcre" # Install PCRE in current dir if pcreLibFile is not found
|
||||||
|
switch("passC", "-I" & pcreIncludeDir) # So that pcre.h is found when running the musl task
|
||||||
|
switch("define", "usePcreHeader")
|
||||||
|
switch("passL", pcreLibFile)
|
||||||
|
# -d:libressl or -d:openssl
|
||||||
|
when defined(libressl) or defined(openssl):
|
||||||
|
switch("define", "ssl") # Pass -d:ssl to nim
|
||||||
|
when defined(libressl):
|
||||||
|
let
|
||||||
|
sslLibFile = libreSslLibFile
|
||||||
|
cryptoLibFile = libreCryptoLibFile
|
||||||
|
sslIncludeDir = libreSslIncludeDir
|
||||||
|
sslLibDir = libreSslLibDir
|
||||||
|
when defined(openssl):
|
||||||
|
let
|
||||||
|
sslLibFile = openSslLibFile
|
||||||
|
cryptoLibFile = openCryptoLibFile
|
||||||
|
sslIncludeDir = openSslIncludeDir
|
||||||
|
sslLibDir = openSslLibDir
|
||||||
|
|
||||||
|
if (not fileExists(sslLibFile)) or (not fileExists(cryptoLibFile)):
|
||||||
|
# Install SSL in current dir if sslLibFile or cryptoLibFile is not found
|
||||||
|
when defined(libressl):
|
||||||
|
selfExec "installLibreSsl"
|
||||||
|
when defined(openssl):
|
||||||
|
selfExec "installOpenSsl"
|
||||||
|
switch("passC", "-I" & sslIncludeDir) # So that ssl.h is found when running the musl task
|
||||||
|
switch("passL", "-L" & sslLibDir)
|
||||||
|
switch("passL", "-lssl")
|
||||||
|
switch("passL", "-lcrypto") # This *has* to come *after* -lssl
|
||||||
|
switch("dynlibOverride", "libssl")
|
||||||
|
switch("dynlibOverride", "libcrypto")
|
|
@ -1,4 +1,10 @@
|
||||||
# 💤 LazyVim
|
# 💤 LazyVim based Neovim
|
||||||
|
|
||||||
A starter template for [LazyVim](https://github.com/LazyVim/LazyVim).
|
|
||||||
Refer to the [documentation](https://lazyvim.github.io/installation) to get started.
|
## Notes
|
||||||
|
|
||||||
|
Currently includes a custom `treesitter` query for markdown to prevent it from hiding code block fences, when conceal is enabled.
|
||||||
|
|
||||||
|
## TODO
|
||||||
|
|
||||||
|
- [ ] make flake8 use a sensible line-length.... -> 88
|
||||||
|
|
|
@ -1,53 +1,57 @@
|
||||||
{
|
{
|
||||||
"LazyVim": { "branch": "main", "commit": "24cb9a90e529279dd4da84e7262a6c434e733b72" },
|
"LazyVim": { "branch": "main", "commit": "2e18998c9ed7d2fa773b782f3aa3c0d5ac5cc21d" },
|
||||||
"LuaSnip": { "branch": "master", "commit": "9bff06b570df29434a88f9c6a9cea3b21ca17208" },
|
"LuaSnip": { "branch": "master", "commit": "58fbfc627a93281a77f7d161d4ff702e639677b1" },
|
||||||
"alpha-nvim": { "branch": "main", "commit": "0349fc0aa0c1d940ec3be395cb110483b416bc84" },
|
"alpha-nvim": { "branch": "main", "commit": "1c903fd40b1d51e7740b4d90e9f18e83f2916586" },
|
||||||
"bufferline.nvim": { "branch": "main", "commit": "c7492a76ce8218e3335f027af44930576b561013" },
|
"bufferline.nvim": { "branch": "main", "commit": "84b0822b2af478d0b4f7b0f9249ca218855331db" },
|
||||||
"catppuccin": { "branch": "main", "commit": "c5ed88194ae1d581d3083725a0dc7c90dd3446be" },
|
"catppuccin": { "branch": "main", "commit": "a5f3ed5d3b1d9ea21183718a8a89a6653bd6ea48" },
|
||||||
"cmp-buffer": { "branch": "main", "commit": "3022dbc9166796b644a841a02de8dd1cc1d311fa" },
|
"cmp-buffer": { "branch": "main", "commit": "3022dbc9166796b644a841a02de8dd1cc1d311fa" },
|
||||||
|
"cmp-emoji": { "branch": "main", "commit": "19075c36d5820253d32e2478b6aaf3734aeaafa0" },
|
||||||
"cmp-nvim-lsp": { "branch": "main", "commit": "0e6b2ed705ddcff9738ec4ea838141654f12eeef" },
|
"cmp-nvim-lsp": { "branch": "main", "commit": "0e6b2ed705ddcff9738ec4ea838141654f12eeef" },
|
||||||
"cmp-path": { "branch": "main", "commit": "91ff86cd9c29299a64f968ebb45846c485725f23" },
|
"cmp-path": { "branch": "main", "commit": "91ff86cd9c29299a64f968ebb45846c485725f23" },
|
||||||
"cmp_luasnip": { "branch": "master", "commit": "18095520391186d634a0045dacaa346291096566" },
|
"cmp_luasnip": { "branch": "master", "commit": "18095520391186d634a0045dacaa346291096566" },
|
||||||
"dressing.nvim": { "branch": "master", "commit": "db716a0f1279f79a886c0e0b6ab3c3d5ffdb42fe" },
|
"dressing.nvim": { "branch": "master", "commit": "db716a0f1279f79a886c0e0b6ab3c3d5ffdb42fe" },
|
||||||
"flit.nvim": { "branch": "main", "commit": "be110f9814a45788d10537fd59b3c76d956bb7ad" },
|
"flit.nvim": { "branch": "main", "commit": "980e80e8fe44caaeb9de501c8e97a559b17db2f4" },
|
||||||
"friendly-snippets": { "branch": "main", "commit": "80597f3ea824946c87fd29f82b5ed4f24ef473f3" },
|
"friendly-snippets": { "branch": "main", "commit": "1645e7cd98ed99e766c84ab3cf13a1612c77dcee" },
|
||||||
"gitsigns.nvim": { "branch": "main", "commit": "f29f0b22fd66c910b892aae3bc18a4872c002738" },
|
"gitsigns.nvim": { "branch": "main", "commit": "a5caac26768af80b7c57b919f77b3fed3d7424d0" },
|
||||||
"indent-blankline.nvim": { "branch": "master", "commit": "8299fe7703dfff4b1752aeed271c3b95281a952d" },
|
"indent-blankline.nvim": { "branch": "master", "commit": "8299fe7703dfff4b1752aeed271c3b95281a952d" },
|
||||||
"lazy.nvim": { "branch": "main", "commit": "d13fe9353594bce58a5b9fc6d7166d183e0fc035" },
|
"lazy.nvim": { "branch": "main", "commit": "c778b7aa04c484e1536ba219e71f2fd0f05302aa" },
|
||||||
"leap.nvim": { "branch": "main", "commit": "7140feed70a5911b8c8a7eb9c218d198772f69cf" },
|
"leap.nvim": { "branch": "main", "commit": "1367a095f336c6c7ccda8c6747b57048fc5e008d" },
|
||||||
"lualine.nvim": { "branch": "master", "commit": "0050b308552e45f7128f399886c86afefc3eb988" },
|
"lualine.nvim": { "branch": "master", "commit": "0050b308552e45f7128f399886c86afefc3eb988" },
|
||||||
"mason-lspconfig.nvim": { "branch": "main", "commit": "7a97a77eee486ae152d2c559a459eda7c8aa12aa" },
|
"mason-lspconfig.nvim": { "branch": "main", "commit": "e2b82cf4c68b453eeab5833d90c042ed4b49d0e1" },
|
||||||
"mason.nvim": { "branch": "main", "commit": "14ae1ca58440b158a0a35cf90773013caddf788a" },
|
"mason.nvim": { "branch": "main", "commit": "a35f3c44381c8ce37faefd427b474ea5ef72d37d" },
|
||||||
"mini.ai": { "branch": "main", "commit": "2188cb1be3e9133fb1fe52374705b94630492401" },
|
"mini.ai": { "branch": "main", "commit": "efeab91f9373d6d3c73314fda9e3366020d05157" },
|
||||||
"mini.bufremove": { "branch": "main", "commit": "5823104665ec3394c379c7cee790bd7b4798a94b" },
|
"mini.bufremove": { "branch": "main", "commit": "351d18d596f7eac4589b67b4b87ed1708c545dd3" },
|
||||||
"mini.comment": { "branch": "main", "commit": "de539cac52a8df702758c6a026b63323130be596" },
|
"mini.comment": { "branch": "main", "commit": "9fc3fe43129e8c2611bd21b8f50af8c0d0742533" },
|
||||||
"mini.indentscope": { "branch": "main", "commit": "cbabbf3be4a59c7f23725b74ed15e0fba951e328" },
|
"mini.indentscope": { "branch": "main", "commit": "f3bbd793fac80638bb5f4ef173eb514170aa22b3" },
|
||||||
"mini.pairs": { "branch": "main", "commit": "50f07af5e47a67e74ec1a9b25bfb2eec93783d44" },
|
"mini.pairs": { "branch": "main", "commit": "4ebc1ff8d77fe75e8f219432302800ca29e17614" },
|
||||||
"mini.surround": { "branch": "main", "commit": "4613a60d87fa2d5b718be44283387cfc0446051f" },
|
"mini.surround": { "branch": "main", "commit": "6a4f31e2a380439315729f561d7e7898bde1fd52" },
|
||||||
"neo-tree.nvim": { "branch": "v2.x", "commit": "8238865e1d9c61f1a260c290653f2c419503e0a9" },
|
"neo-tree.nvim": { "branch": "v2.x", "commit": "245cf1e68840defcc75a16297740f6203f5a045d" },
|
||||||
"neoconf.nvim": { "branch": "main", "commit": "f67013cf18d9db5cc6c3ce2d5a4051bad75fe628" },
|
"neoconf.nvim": { "branch": "main", "commit": "0e3f28834cc22ab1c01ce9263c8301d93cc22700" },
|
||||||
"neodev.nvim": { "branch": "main", "commit": "bb70e41640238b989bb6c2f94802851ff260f68d" },
|
"neodev.nvim": { "branch": "main", "commit": "fc9a4ccedcbae14454d66d5050bef077c40ab5e5" },
|
||||||
|
"nim.nvim": { "branch": "master", "commit": "87afde2ae995723e0338e1851c3b3c1cbd81d955" },
|
||||||
"noice.nvim": { "branch": "main", "commit": "d8a1f3056ad713b5d471048f8d029264828e22c0" },
|
"noice.nvim": { "branch": "main", "commit": "d8a1f3056ad713b5d471048f8d029264828e22c0" },
|
||||||
"nui.nvim": { "branch": "main", "commit": "d147222a1300901656f3ebd5b95f91732785a329" },
|
"nui.nvim": { "branch": "main", "commit": "d147222a1300901656f3ebd5b95f91732785a329" },
|
||||||
"null-ls.nvim": { "branch": "main", "commit": "60b4a7167c79c7d04d1ff48b55f2235bf58158a7" },
|
"null-ls.nvim": { "branch": "main", "commit": "9d811bb6ed44cf766f4bda8a47fd65fdfbdcaa7d" },
|
||||||
"nvim-cmp": { "branch": "main", "commit": "cfafe0a1ca8933f7b7968a287d39904156f2c57d" },
|
"nvim-cmp": { "branch": "main", "commit": "aae0c3e4e778ca4be6fabc52e388cbd5b844b7a5" },
|
||||||
"nvim-lspconfig": { "branch": "master", "commit": "b5bb6e3d7c775c241726d1ef564902263e93e2cd" },
|
"nvim-lspconfig": { "branch": "master", "commit": "1712672e4da3003a0dd9f771d30389600b360f42" },
|
||||||
"nvim-navic": { "branch": "master", "commit": "7e9d2b2b601149fecdccd11b516acb721e571fe6" },
|
"nvim-navic": { "branch": "master", "commit": "7e9d2b2b601149fecdccd11b516acb721e571fe6" },
|
||||||
"nvim-notify": { "branch": "master", "commit": "bdd647f61a05c9b8a57c83b78341a0690e9c29d7" },
|
"nvim-notify": { "branch": "master", "commit": "bdd647f61a05c9b8a57c83b78341a0690e9c29d7" },
|
||||||
"nvim-spectre": { "branch": "master", "commit": "1d8b7a40677fd87da7648d246c4675c3612a7582" },
|
"nvim-spectre": { "branch": "master", "commit": "1d8b7a40677fd87da7648d246c4675c3612a7582" },
|
||||||
"nvim-treesitter": { "branch": "master", "commit": "f6df07be122de665fb363476cc3680c90f5bdf05" },
|
"nvim-treesitter": { "branch": "master", "commit": "ad9ae9e7def54fee446c3e186ed0a0d44cca7b90" },
|
||||||
"nvim-treesitter-textobjects": { "branch": "master", "commit": "420cbfea10b93d6b38c72c5a6c8f9fee3dca80c9" },
|
"nvim-treesitter-textobjects": { "branch": "master", "commit": "37e3c7b32b653f24d7aa2fa087a9c5a67ef07786" },
|
||||||
"nvim-ts-context-commentstring": { "branch": "main", "commit": "a0f89563ba36b3bacd62cf967b46beb4c2c29e52" },
|
"nvim-ts-context-commentstring": { "branch": "main", "commit": "a0f89563ba36b3bacd62cf967b46beb4c2c29e52" },
|
||||||
"nvim-web-devicons": { "branch": "master", "commit": "ade34ca7d19543904b28b903e606be8930fb9ee3" },
|
"nvim-web-devicons": { "branch": "master", "commit": "bd7a222287c5828cd0607cd0a5605e52f0460074" },
|
||||||
"persistence.nvim": { "branch": "main", "commit": "d8a3eda0e19b4d5f3180fc832c25baab1709f2a1" },
|
"persistence.nvim": { "branch": "main", "commit": "d8a3eda0e19b4d5f3180fc832c25baab1709f2a1" },
|
||||||
"plenary.nvim": { "branch": "master", "commit": "9a0d3bf7b832818c042aaf30f692b081ddd58bd9" },
|
"plenary.nvim": { "branch": "master", "commit": "9a0d3bf7b832818c042aaf30f692b081ddd58bd9" },
|
||||||
"telescope-fzf-native.nvim": { "branch": "main", "commit": "580b6c48651cabb63455e97d7e131ed557b8c7e2" },
|
"telescope-fzf-native.nvim": { "branch": "main", "commit": "580b6c48651cabb63455e97d7e131ed557b8c7e2" },
|
||||||
"telescope.nvim": { "branch": "master", "commit": "203bf5609137600d73e8ed82703d6b0e320a5f36" },
|
"telescope.nvim": { "branch": "master", "commit": "203bf5609137600d73e8ed82703d6b0e320a5f36" },
|
||||||
"todo-comments.nvim": { "branch": "main", "commit": "74c7d28cb50b0713c881ef69bcb6cdd77d8907d1" },
|
"todo-comments.nvim": { "branch": "main", "commit": "74c7d28cb50b0713c881ef69bcb6cdd77d8907d1" },
|
||||||
"tokyonight.nvim": { "branch": "main", "commit": "a0abe53df53616d13da327636cb0bcac3ea7f5af" },
|
"tokyonight.nvim": { "branch": "main", "commit": "a0abe53df53616d13da327636cb0bcac3ea7f5af" },
|
||||||
"trouble.nvim": { "branch": "main", "commit": "fc003424b02109f1453af6b40dadff6019b97187" },
|
"trouble.nvim": { "branch": "main", "commit": "556ef3089709a6e253df1e500381fec5eb48e48a" },
|
||||||
"vim-illuminate": { "branch": "master", "commit": "49062ab1dd8fec91833a69f0a1344223dd59d643" },
|
"vim-illuminate": { "branch": "master", "commit": "49062ab1dd8fec91833a69f0a1344223dd59d643" },
|
||||||
|
"vim-nix": { "branch": "master", "commit": "7d23e97d13c40fcc6d603b291fe9b6e5f92516ee" },
|
||||||
"vim-repeat": { "branch": "master", "commit": "24afe922e6a05891756ecf331f39a1f6743d3d5a" },
|
"vim-repeat": { "branch": "master", "commit": "24afe922e6a05891756ecf331f39a1f6743d3d5a" },
|
||||||
"vim-startuptime": { "branch": "master", "commit": "6580cf539c33a212f4f5542068a3b4dd2b3ad834" },
|
"vim-startuptime": { "branch": "master", "commit": "6580cf539c33a212f4f5542068a3b4dd2b3ad834" },
|
||||||
"which-key.nvim": { "branch": "main", "commit": "684e96c5e8477f1ee9b3f2e9a12d802fd12c5531" }
|
"which-key.nvim": { "branch": "main", "commit": "5224c261825263f46f6771f1b644cae33cd06995" },
|
||||||
|
"zk-nvim": { "branch": "main", "commit": "0413c52500cd0133b0cd8e7e7d43084855ac1760" }
|
||||||
}
|
}
|
|
@ -1,3 +1,15 @@
|
||||||
-- Keymaps are automatically loaded on the VeryLazy event
|
-- Keymaps are automatically loaded on the VeryLazy event
|
||||||
-- Default keymaps that are always set: https://github.com/LazyVim/LazyVim/blob/main/lua/lazyvim/config/keymaps.lua
|
-- Default keymaps that are always set: https://github.com/LazyVim/LazyVim/blob/main/lua/lazyvim/config/keymaps.lua
|
||||||
-- Add any additional keymaps here
|
-- Add any additional keymaps here
|
||||||
|
local function map(mode, lhs, rhs, opts)
|
||||||
|
local keys = require("lazy.core.handler").handlers.keys
|
||||||
|
---@cast keys LazyKeysHandler
|
||||||
|
-- do not create the keymap if a lazy keys handler exists
|
||||||
|
if not keys.active[keys.parse({ lhs, mode = mode }).id] then
|
||||||
|
opts = opts or {}
|
||||||
|
opts.silent = opts.silent ~= false
|
||||||
|
vim.keymap.set(mode, lhs, rhs, opts)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
map("i", "jk", "<esc>")
|
||||||
|
|
|
@ -1,3 +1,8 @@
|
||||||
-- Options are automatically loaded before lazy.nvim startup
|
vim.opt.listchars = {
|
||||||
-- Default options that are always set: https://github.com/LazyVim/LazyVim/blob/main/lua/lazyvim/config/options.lua
|
tab = "│→",
|
||||||
-- Add any additional options here
|
extends = "⟩",
|
||||||
|
precedes = "⟨",
|
||||||
|
trail = "·",
|
||||||
|
nbsp = "␣",
|
||||||
|
}
|
||||||
|
vim.opt.foldenable = false
|
||||||
|
|
41
home/private_dot_config/nvim/lua/plugins/builtins.lua
Normal file
41
home/private_dot_config/nvim/lua/plugins/builtins.lua
Normal file
|
@ -0,0 +1,41 @@
|
||||||
|
return {
|
||||||
|
{ "folke/lazy.nvim", version = false },
|
||||||
|
{
|
||||||
|
"LazyVim/LazyVim",
|
||||||
|
version = false,
|
||||||
|
opts = {
|
||||||
|
colorscheme = "catppuccin",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"folke/noice.nvim",
|
||||||
|
opts = {
|
||||||
|
presets = {
|
||||||
|
command_palette = false,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
-- add emoji completion
|
||||||
|
{
|
||||||
|
"hrsh7th/nvim-cmp",
|
||||||
|
dependencies = { "hrsh7th/cmp-emoji" },
|
||||||
|
---@param opts cmp.ConfigSchema
|
||||||
|
opts = function(_, opts)
|
||||||
|
local cmp = require("cmp")
|
||||||
|
opts.sources = cmp.config.sources(vim.list_extend(opts.sources, { { name = "emoji" } }))
|
||||||
|
end,
|
||||||
|
},
|
||||||
|
|
||||||
|
-- add telescope-fzf-native
|
||||||
|
-- do I need this tho? maybe the native is faster?
|
||||||
|
{
|
||||||
|
"telescope.nvim",
|
||||||
|
dependencies = {
|
||||||
|
"nvim-telescope/telescope-fzf-native.nvim",
|
||||||
|
build = "make",
|
||||||
|
config = function()
|
||||||
|
require("telescope").load_extension("fzf")
|
||||||
|
end,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}
|
4
home/private_dot_config/nvim/lua/plugins/languages.lua
Normal file
4
home/private_dot_config/nvim/lua/plugins/languages.lua
Normal file
|
@ -0,0 +1,4 @@
|
||||||
|
return {
|
||||||
|
{ "LnL7/vim-nix" },
|
||||||
|
{ "alaviss/nim.nvim" },
|
||||||
|
}
|
3
home/private_dot_config/nvim/lua/plugins/tools.lua
Normal file
3
home/private_dot_config/nvim/lua/plugins/tools.lua
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
return {
|
||||||
|
{ "mickael-menu/zk-nvim" },
|
||||||
|
}
|
35
home/private_dot_config/nvim/lua/plugins/ui.lua
Normal file
35
home/private_dot_config/nvim/lua/plugins/ui.lua
Normal file
|
@ -0,0 +1,35 @@
|
||||||
|
return {
|
||||||
|
{
|
||||||
|
"goolord/alpha-nvim",
|
||||||
|
opts = function()
|
||||||
|
local dashboard = require("alpha.themes.dashboard")
|
||||||
|
local logo = [[
|
||||||
|
⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢀⣠⠴⠒⠚⠓⠒⠦⣄⡀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
|
||||||
|
⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⡴⠋⠀⠀⠀⠀⠀⠀⠀⠀⠙⢦⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
|
||||||
|
⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣼⠁⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠈⣧⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
|
||||||
|
⠀⠀⠀⠀⠀⠀⠀⠀⠀⣴⣦⠀⠀⣧⣤⣤⣤⣤⣤⣤⣤⣤⣤⣤⣤⣤⣼⠀⠀⣴⣦⠀⠀⠀⠀⠀⠀⠀⠀⠀
|
||||||
|
⠀⠀⠀⠀⠀⠀⠀⠀⢠⣿⣿⣧⠀⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⠀⣼⣿⣿⡄⠀⠀⠀⠀⠀⠀⠀⠀
|
||||||
|
⠀⠀⠀⠀⠀⠀⠀⠀⣾⡿⠘⣿⣧⠘⢿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⡿⠃⣼⣿⠃⢿⣷⠀⠀⠀⠀⠀⠀⠀⠀
|
||||||
|
⠀⠀⠀⠀⠀⠀⠀⢰⣿⠃⠀⠘⣿⣧⠈⠙⢿⣿⣿⣿⣿⣿⣿⡿⠛⠁⣼⣿⠃⠀⠘⣿⡆⠀⠀⠀⠀⠀⠀⠀
|
||||||
|
⠀⠀⠀⠀⠀⠀⠀⣿⡟⠀⠀⠀⠘⣿⣧⠀⠀⠀⠉⠉⠉⠉⠀⠀⠀⣼⣿⠃⠀⠀⠀⢻⣿⠀⠀⠀⠀⠀⠀⠀
|
||||||
|
⠀⠀⠀⠀⠀⠀⣸⣿⠁⠀⠀⠀⠀⠘⣿⣧⠀⠀⠀⠀⠀⠀⠀⠀⣼⣿⠃⠀⠀⠀⠀⠈⣿⣇⠀⠀⠀⠀⠀⠀
|
||||||
|
⠀⠀⠀⠀⠀⢀⣿⡏⠀⠀⠀⠀⠀⠀⠘⣿⣧⠀⠀⠀⠀⠀⠀⣼⣿⠃⠀⠀⠀⠀⠀⠀⢹⣿⡀⠀⠀⠀⠀⠀
|
||||||
|
⠀⠀⠀⠀⠀⢼⣿⣶⣶⣶⣶⣶⣶⣶⣦⠘⣿⣧⠀⠀⠀⠀⣼⣿⠃⣴⣶⣶⣶⣶⣶⣶⣶⣿⡧⠀⠀⠀⠀⠀
|
||||||
|
⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠘⣿⣧⠀⠀⣼⣿⠃⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
|
||||||
|
⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠘⣿⣧⣼⣿⠃⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
|
||||||
|
⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠘⣿⣿⠃⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀]]
|
||||||
|
|
||||||
|
dashboard.section.header.val = vim.split(logo, "\n")
|
||||||
|
math.randomseed(os.time())
|
||||||
|
|
||||||
|
local function pick_color()
|
||||||
|
local colors = { "String", "Identifier", "Keyword", "Number" }
|
||||||
|
return colors[math.random(#colors)]
|
||||||
|
end
|
||||||
|
|
||||||
|
dashboard.section.header.opts.hl = pick_color()
|
||||||
|
dashboard.opts.layout[1].val = 2
|
||||||
|
return dashboard
|
||||||
|
end,
|
||||||
|
},
|
||||||
|
}
|
74
home/private_dot_config/nvim/queries/markdown/highlights.scm
Normal file
74
home/private_dot_config/nvim/queries/markdown/highlights.scm
Normal file
|
@ -0,0 +1,74 @@
|
||||||
|
;From MDeiml/tree-sitter-markdown
|
||||||
|
(atx_heading (inline) @text.title)
|
||||||
|
(setext_heading (paragraph) @text.title)
|
||||||
|
|
||||||
|
[
|
||||||
|
(atx_h1_marker)
|
||||||
|
(atx_h2_marker)
|
||||||
|
(atx_h3_marker)
|
||||||
|
(atx_h4_marker)
|
||||||
|
(atx_h5_marker)
|
||||||
|
(atx_h6_marker)
|
||||||
|
(setext_h1_underline)
|
||||||
|
(setext_h2_underline)
|
||||||
|
] @punctuation.special
|
||||||
|
|
||||||
|
[
|
||||||
|
(link_title)
|
||||||
|
(indented_code_block)
|
||||||
|
(fenced_code_block)
|
||||||
|
] @text.literal
|
||||||
|
|
||||||
|
(pipe_table_header (pipe_table_cell) @text.title)
|
||||||
|
|
||||||
|
(pipe_table_header "|" @punctuation.special)
|
||||||
|
(pipe_table_row "|" @punctuation.special)
|
||||||
|
(pipe_table_delimiter_row "|" @punctuation.special)
|
||||||
|
(pipe_table_delimiter_cell) @punctuation.special
|
||||||
|
|
||||||
|
[
|
||||||
|
(fenced_code_block_delimiter)
|
||||||
|
] @punctuation.delimiter
|
||||||
|
|
||||||
|
(code_fence_content) @none
|
||||||
|
|
||||||
|
[
|
||||||
|
(link_destination)
|
||||||
|
] @text.uri
|
||||||
|
|
||||||
|
[
|
||||||
|
(link_label)
|
||||||
|
] @text.reference
|
||||||
|
|
||||||
|
[
|
||||||
|
(list_marker_plus)
|
||||||
|
(list_marker_minus)
|
||||||
|
(list_marker_star)
|
||||||
|
(list_marker_dot)
|
||||||
|
(list_marker_parenthesis)
|
||||||
|
(thematic_break)
|
||||||
|
] @punctuation.special
|
||||||
|
|
||||||
|
|
||||||
|
(task_list_marker_unchecked) @text.todo.unchecked
|
||||||
|
(task_list_marker_checked) @text.todo.checked
|
||||||
|
|
||||||
|
(block_quote) @text.quote
|
||||||
|
|
||||||
|
[
|
||||||
|
(block_continuation)
|
||||||
|
(block_quote_marker)
|
||||||
|
] @punctuation.special
|
||||||
|
|
||||||
|
[
|
||||||
|
(backslash_escape)
|
||||||
|
] @string.escape
|
||||||
|
|
||||||
|
; prevent block delimiters from being concealed
|
||||||
|
; ([
|
||||||
|
; (info_string)
|
||||||
|
; (fenced_code_block_delimiter)
|
||||||
|
; ] @conceal
|
||||||
|
; (#set! conceal ""))
|
||||||
|
|
||||||
|
(inline) @spell
|
Loading…
Reference in a new issue