Skip to content

Commit 59f9e8c

Browse files
committed
🎨 Format code
LuaLS/lua-language-server#2343 Remove luaformatter pre-commit hook for lua-language-server Add cppcheck to coc-diagnostic Add some templates Update PKGBUILD template for cmake Add v2ex, disqus Remove the content about github codespace from README.md Fix the bug about missing lua Fix user.js template Rename/Add some templates Add /usr/src/linux/include to &path Add coc-tsserver, coc-eslint Update user.js template Add supertux2 config
1 parent 7e3bf0e commit 59f9e8c

File tree

29 files changed

+787
-76
lines changed

29 files changed

+787
-76
lines changed

.bash_profile

Lines changed: 34 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ elif [[ -f /run/current-system/nixos-version ]]; then
3838
PKG_CONFIG_PATH="$PKG_CONFIG_PATH${PKG_CONFIG_PATH+:}/run/current-system/sw/lib/pkgconfig:/run/current-system/sw/share/pkgconfig"
3939
export PKG_CONFIG_PATH
4040
else
41+
PATH="$PATH${PATH+:}/usr/src/linux/scripts/clang-tools:/usr/src/linux/scripts"
4142
PATH="$PATH${PATH+:}$HOME/.local/state/nix/profile/bin"
4243
PATH="$PATH${PATH+:}/opt/android-ndk/toolchains/llvm/prebuilt/$(uname -s | tr '[:upper:]' '[:lower:]')-$(uname -m)/bin"
4344
# https://aur.archlinux.org/packages/ccstudio#comment-906326
@@ -129,25 +130,37 @@ export REPO_URL=https://mirrors.bfsu.edu.cn/git/git-repo
129130
# direnv
130131
export DIRENV_LOG_FORMAT=
131132
# lua
132-
version="$(lua -v)"
133-
version=${version#* }
134-
version=${version%% *}
135-
version=${version%.*}
136-
case $OSTYPE in
137-
linux-*)
138-
ext=so
139-
;;
140-
darwin)
141-
ext=dynlib
142-
;;
143-
*)
144-
ext=dll
145-
;;
146-
esac
147-
export LUA_PATH="./share/lua/$version/?.lua;./?.lua;./?/init.lua;;$HOME/.local/share/lua/$version/?.lua;$HOME/.local/share/lua/$version/?/init.lua;$HOME/.local/state/nix/profile/share/lua/$version/?.lua;$HOME/.local/state/nix/profile/share/lua/$version/?/init.lua"
148-
export LUA_CPATH="./lib/lua/$version/?.$ext;./?.$ext;./lib/lua/$version/loadall.$ext;;$HOME/.local/lib/lua/$version/?.$ext;$HOME/.local/state/nix/profile/lib/lua/$version/?.$ext"
149-
if [[ -f /run/current-system/nixos-version ]]; then
150-
LUA_PATH="$LUA_PATH;/run/current-system/sw/share/lua/$version/?.lua;/run/current-system/sw/share/lua/$version/?/init.lua"
151-
LUA_CPATH="$LUA_CPATH;/run/current-system/sw/lib/lua/$version/?.$ext"
133+
has_cmd() {
134+
for opt in "$@"; do
135+
command -v "$opt" >/dev/null
136+
done
137+
}
138+
if has_cmd lua; then
139+
version="$(command lua -v)"
140+
version=${version#* }
141+
version=${version%% *}
142+
version=${version%.*}
143+
case $OSTYPE in
144+
linux-*)
145+
ext=so
146+
;;
147+
darwin)
148+
ext=dynlib
149+
;;
150+
*)
151+
ext=dll
152+
;;
153+
esac
154+
export LUA_PATH="./share/lua/$version/?.lua;./?.lua;./?/init.lua;;$HOME/.local/share/lua/$version/?.lua;$HOME/.local/share/lua/$version/?/init.lua;$HOME/.local/state/nix/profile/share/lua/$version/?.lua;$HOME/.local/state/nix/profile/share/lua/$version/?/init.lua"
155+
export LUA_CPATH="./lib/lua/$version/?.$ext;./?.$ext;./lib/lua/$version/loadall.$ext;;$HOME/.local/lib/lua/$version/?.$ext;$HOME/.local/state/nix/profile/lib/lua/$version/?.$ext"
156+
if [[ -f /run/current-system/nixos-version ]]; then
157+
LUA_PATH="$LUA_PATH;/run/current-system/sw/share/lua/$version/?.lua;/run/current-system/sw/share/lua/$version/?/init.lua"
158+
LUA_CPATH="$LUA_CPATH;/run/current-system/sw/lib/lua/$version/?.$ext"
159+
fi
160+
unset version ext
161+
fi
162+
if [ -n "$ZSH_VERSION" ]; then
163+
unfunction has_cmd
164+
else
165+
unset has_cmd
152166
fi
153-
unset version ext

.config/gdb/gdbinit.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
"/usr/local",
1313
"/run/current-system/sw",
1414
"/data/data/com.termux/files/usr",
15-
"~/.local/state/nix/profile"
15+
"~/.local/state/nix/profile",
1616
]
1717

1818
for path in paths:

.config/luarocks/config.lua

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
---luarocks config.
2-
-- luacheck: ignore 111
3-
-- LuaFormatter off
42

5-
-- LuaFormatter on
3+
-- luacheck: ignore 111 113
64
---@diagnostic disable: lowercase-global
75
home = home or ""
86
rocks_trees = {
@@ -11,7 +9,8 @@ rocks_trees = {
119
rocks_servers = {
1210
"https://luarocks.cn"
1311
}
14-
os_getenv = os_getenv or function(_) end
12+
os_getenv = os_getenv or function(_)
13+
end
1514
if os_getenv("NIXPKGS_CONFIG") == "/etc/nix/nixpkgs-config.nix" then
1615
external_deps_dirs = { "/run/current-system/sw", home .. "/.local/state/nix/profile" }
1716
else

.config/nvim/autoload/init/init/c.vim

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ function! init#init#c#main() abort
1111
setlocal path-=/usr/include
1212
let &l:path .= ',' . init#init#c#nix()
1313
else
14-
setlocal path+=/usr/local/include
14+
setlocal path+=/usr/local/include,/usr/src/linux/include
1515
endif
1616

1717
nnoremap <silent><buffer> <LocalLeader>o :set paste<CR>i<C-R>=protodef#ReturnSkeletonsFromPrototypesForCurrentBuffer({})<CR><Esc>='[:set nopaste<CR>

.config/nvim/autoload/init/init/install.vim

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,8 @@ let g:init#init#install#coc = [
2828
\ 'coc-texlab', 'coc-bibtex', 'coc-cmake',
2929
\ 'coc-json', 'coc-yaml', 'coc-toml',
3030
\ 'coc-xml', 'coc-svg', 'coc-html', 'coc-css',
31-
\ 'coc-docker',
32-
\ 'coc-sql', 'coc-sh', 'coc-vimlsp', 'coc-perl',
31+
\ 'coc-docker', 'coc-sql',
32+
\ 'coc-sh', 'coc-vimlsp', 'coc-perl', 'coc-tsserver', 'coc-eslint',
3333
\ 'coc-jedi', 'coc-pyright', 'coc-lua', 'coc-solargraph', 'coc-clangd',
3434
\ ]
3535
" don't support android

.config/nvim/autoload/init/smartinput.vim

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -590,9 +590,6 @@ function! init#smartinput#post_source() abort
590590
\ 'at': '[^ ?]\%#',
591591
\ 'char': '=',
592592
\ 'input': ' = ',
593-
\ 'filetype': ['pandoc', 'c', 'cpp', 'vim', 'perl', 'make', 'ninja',
594-
\ 'lua', 'dosini', 'muttrc', 'neomuttrc', 'nix', 'automake', 'toml',
595-
\ 'verilog', 'dts', 'bitbake', 'octave', 'matlab', 'gdb'],
596593
\ })
597594
call smartinput#define_rule({
598595
\ 'at': '\%#',

.config/nvim/coc-settings.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@
99
"dash-complete.shortcut": "-",
1010
"diagnostic-languageserver.filetypes": {
1111
"bbcode": ["write-good", "alex-text"],
12+
"c": ["cppcheck"],
13+
"cpp": ["cppcheck"],
1214
"cmake": ["cmake-lint", "cmakelint"],
1315
"elixir": ["mix_credo", "mix_credo_compile"],
1416
"expect": ["nagelfar"],

.config/nvim/ftdetect/filetype.vim

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,13 @@ augroup init_filetype
99

1010
" Data_Describe {{{1 "
1111
autocmd BufNewFile,BufRead .{docker,rg,fd,}ignore setfiletype gitignore
12-
autocmd BufNewFile,BufRead */.config/{lxqt,screengrab,pcmanfm-qt}/*.conf,mimeapps.list,setup.cfg,.coveragerc setfiletype dosini
12+
autocmd BufNewFile,BufRead */.config/{lxqt,screengrab,pcmanfm-qt}/*.conf,mimeapps.list,setup.cfg,.coveragerc,bootstraprc,psprint.conf,sofficerc setfiletype dosini
1313
autocmd BufNewFile,BufRead */pacman.d/mirrorlist{,.*},MANIFEST.SKIP setfiletype conf
1414
autocmd BufNewFile,BufRead .SRCINFO setfiletype jproperties
1515
autocmd BufNewFile,BufRead *.{jupyterlab-settings,sublime-{project,settings},vsconfig,jscsrc,jshintrc,plan,ccls,sublime-workspace,css.map,xci} setfiletype json
1616
" https://github.com/McSinyx/vim-octave/issues/4
1717
autocmd BufNewFile,BufRead */.bundle/config,*.mplstyle,.clangd,.git,DESCRIPTION setfiletype yaml
18-
autocmd BufNewFile,BufRead *.{{x,l}pr,{x,s}pfm},fonts.conf,*/{dbus-1,conf.d}/*.conf setfiletype xml
18+
autocmd BufNewFile,BufRead *.{{x,l}pr,{x,s}pfm},fonts.conf,*/{dbus-1,conf.d}/*.conf,*.xcu setfiletype xml
1919
" 1}}} Data_Describe "
2020

2121
" Template {{{1 "
@@ -31,6 +31,7 @@ augroup init_filetype
3131
" 1}}} Mark_Up "
3232

3333
" Script {{{1 "
34+
autocmd BufNewFile,BufRead *{.stsg,/.local/share/supertux2/config} setfiletype lisp
3435
autocmd BufNewFile,BufRead *.qsf setfiletype tcl
3536
autocmd BufNewFile,BufRead */ldscripts/*,*.{map,cmd} setfiletype ld
3637
autocmd BufNewFile,BufRead .bash_history setfiletype sh

.config/nvim/ftplugin/gdb.vim

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
scriptencoding utf-8
2+
" FIXME: send email to maintainer Michaël Peeters <[email protected]>
13
setlocal include=^\s*source
24

35
let b:match_words = '\<if\|while\|define\>:\<else\>:\<end\>'

.config/nvim/lua/treesitter.lua

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@ require "nvim-treesitter.configs".setup {
66
textobjects = { enable = true }
77
}
88

9+
-- luacheck: ignore 111 112 113
10+
---@diagnostic disable: lowercase-global
911
vim = vim or {}
1012
if vim.treesitter.language.register then
1113
vim.treesitter.language.register("mail", "text")

.config/nvim/templates/%.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#if 0
2-
gcc "$0" -oa && exec a "$@"
2+
gcc "$0" -oa && exec ./a "$@"
33
#endif
44
#include <stdio.h>
55
#include <stdlib.h>

.config/nvim/templates/%.cc

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
#if 0
2+
g++ "$0" -oa && exec ./a "$@"
3+
#endif
4+
#include <iostream>
5+
#include <cstdlib>
6+
int main(int argc, char *argv[]) {
7+
{% here %}
8+
return EXIT_SUCCESS;
9+
}

.config/nvim/templates/%.cpp

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
#if 0
2+
exec cpp -P "$0"
3+
#endif
4+
#include <sys/cdefs.h>
5+
#define CONCAT(x, y) __CONCAT(x, y)
6+
#define STRING(x) __STRING(x)
7+
8+
{% here %}

.config/nvim/templates/%.user.js

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,17 @@
11
// ==UserScript==
2-
// @name {{ expand('%:t:r') }}
2+
// @description {{ substitute(expand('%:t:r:r'), '-', ' ') }}
3+
// @match *://*/*
4+
// @name {{ substitute(expand('%:t:r:r'), '-', ' ') }}
35
// @namespace {{ g:snips_github }}
6+
// @author {{ g:snips_author }}
47
// @version 0.0.1
8+
// @copyright {{ strftime('%Y') }}, {{ g:snips_author }}
59
// @license GPL-3.0-or-later; https://www.gnu.org/licenses/gpl-3.0.txt
6-
// @author {{ g:snips_author }}
7-
// @match {% here %}
8-
// @grant none
10+
// @homepageURL {{ g:snips_github }}/{{ expand('%:t:r:r') }}
11+
// @supportURL {{ g:snips_github }}/{{ expand('%:t:r:r') }}/issues
12+
// @contributionURL {{ g:snips_github }}/{{ expand('%:t:r:r') }}
913
// ==/UserScript==
14+
15+
(function () {
16+
"use strict";
17+
})()

.config/nvim/templates/build.lua

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,15 @@
11
---l3build config.
2-
-- luacheck: ignore 111
3-
-- LuaFormatter off
42

5-
-- LuaFormatter on
3+
-- luacheck: ignore 111
64
---@diagnostic disable: lowercase-global
75
module = "{{ expand('%:p:h:t') }}" -- luacheck: ignore 121
8-
cleanfiles = {"*.curlopt"}
9-
demofiles = {"latexmkrc", "Makefile"}
10-
docfiles = {"*.md", "*.cfg"}
11-
tagfiles = {"*.dtx", "build.lua"}
6+
cleanfiles = { "*.curlopt" }
7+
demofiles = { "latexmkrc", "Makefile" }
8+
docfiles = { "*.md", "*.cfg" }
9+
tagfiles = { "*.dtx", "build.lua" }
1210
typesetexe = "xelatex"
1311
typesetopts =
14-
"-shell-escape -file-line-error -8bit -halt-on-error -interaction=nonstopmode"
12+
"-shell-escape -file-line-error -8bit -halt-on-error -interaction=nonstopmode"
1513

1614
local repository = "{{ g:snips_github }}/" .. module
1715
uploadconfig = {
@@ -24,7 +22,6 @@ uploadconfig = {
2422
summary = [[]],
2523
uploader = "{{ g:snips_author }}",
2624
version = "{{ strftime('%Y/%m/%d') }} v0.0.1",
27-
2825
bugtracker = repository .. "/issues",
2926
description = [[]],
3027
development = repository,
@@ -46,7 +43,7 @@ function update_tag(file, content, tagname, tagdate) -- luacheck: ignore 212
4643
if tagname then
4744
tagdate = string.gsub(tagdate, "-", "/")
4845
content = string.gsub(content, "%d%d%d%d/%d%d/%d%d v[0-9.]+",
49-
tagdate .. " v" .. tagname)
46+
tagdate .. " v" .. tagname)
5047
end
5148
return content
5249
end
File renamed without changes.

.config/nvim/templates/defaults.yaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
---
2+
to: beamer
3+
pdf-engine: xelatex

.config/nvim/templates/mingw-w64-%/PKGBUILD

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,15 +8,15 @@ pkgdesc=""
88
arch=(any)
99
mingw_arch=(mingw32 mingw64 ucrt64 clang64 clang32 clangarm64)
1010
url={{ g:snips_github }}/$_realname
11-
makedepends=(cmake)
11+
makedepends=(cmake ninja)
1212
license=(GPL3)
1313
source=("$url/archive/$pkgver.tar.gz")
1414
sha256sums=(SKIP)
1515

1616
build() {
1717
cd "$_realname-$pkgver" || return 1
1818

19-
cmake -Bbuild -DCMAKE_INSTALL_PREFIX=$MINGW_PACKAGE_PREFIX
19+
cmake -Bbuild -GNinja -DCMAKE_INSTALL_PREFIX=$MINGW_PACKAGE_PREFIX
2020
cmake --build build
2121
}
2222

.config/nvim/templates/src/Makefile

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
#!/usr/bin/env -S make -f
2+
ifneq ($(KERNELRELEASE),)
3+
obj-m := main.o
4+
else
5+
ifeq ($(shell test -d /usr/src/linux || echo 0),)
6+
KDIR = /usr/src/linux
7+
else
8+
# https://nixos.wiki/wiki/Linux_kernel#Developing_out-of-tree_kernel_modules
9+
KDIR = $(shell ./main.nix | jq -r .)/lib/modules/$(shell uname -r)/build
10+
endif
11+
.PHONY: all clean
12+
all:
13+
$(MAKE) -C$(KDIR) M=$(PWD) modules
14+
clean:
15+
$(RM) *.ko *.o *.mod *.mod.o *.mod.c *.symvers .*.cmd *.order
16+
endif

.config/nvim/templates/src/main.nix

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
#!/usr/bin/env -S nix eval --json -f
2+
(import <nixpkgs> {}).linuxPackages_latest.kernel.dev

.config/wezterm/wezterm.lua

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -23,14 +23,14 @@ return {
2323
window_background_opacity = 0.75,
2424
hide_tab_bar_if_only_one_tab = true,
2525
font_size = font_size,
26-
window_padding = {left = 0, right = 0, top = 0, bottom = 0},
26+
window_padding = { left = 0, right = 0, top = 0, bottom = 0 },
2727
keys = {
28-
{key = 'Enter', mods = 'ALT', action = 'DisableDefaultAssignment'},
29-
{key = '-', mods = 'CTRL', action = 'DisableDefaultAssignment'},
30-
{key = '=', mods = 'CTRL', action = 'DisableDefaultAssignment'},
31-
{key = '0', mods = 'CTRL', action = 'DisableDefaultAssignment'},
32-
{key = 'Backspace', mods = 'SHIFT|CTRL', action = act.ToggleFullScreen},
33-
{key = 'Enter', mods = 'SHIFT', action = act.SendString '\x1b[13;2u'},
34-
{key = 'Enter', mods = 'CTRL', action = act.SendString '\x1b[13;5u'}
28+
{ key = 'Enter', mods = 'ALT', action = 'DisableDefaultAssignment' },
29+
{ key = '-', mods = 'CTRL', action = 'DisableDefaultAssignment' },
30+
{ key = '=', mods = 'CTRL', action = 'DisableDefaultAssignment' },
31+
{ key = '0', mods = 'CTRL', action = 'DisableDefaultAssignment' },
32+
{ key = 'Backspace', mods = 'SHIFT|CTRL', action = act.ToggleFullScreen },
33+
{ key = 'Enter', mods = 'SHIFT', action = act.SendString '\x1b[13;2u' },
34+
{ key = 'Enter', mods = 'CTRL', action = act.SendString '\x1b[13;5u' }
3535
}
3636
}

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -320,6 +320,8 @@
320320
!/.local/share/jupyter/lab/
321321
/.local/share/jupyter/lab/*
322322
!/.local/share/jupyter/lab/user-settings/
323+
!/.local/share/supertux2/
324+
/.local/share/supertux2/addons/
323325

324326
# $XDG_STATE_HOME
325327
!/.local/state/

.local/bin/neomutt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
#!/usr/bin/env bash
2+
# shellcheck disable=SC2068
23
# https://github.com/neomutt/neomutt/issues/3554
3-
PATH=$(echo $PATH | tr ':' '\n' | grep -v "$(dirname "$(realpath "$0")")" | tr '\n' ':')
4+
PATH=$(echo "$PATH" | tr ':' '\n' | grep -v "$(dirname "$(realpath "$0")")" | tr '\n' ':')
45
neomutt ${@//-i/}

0 commit comments

Comments
 (0)