This commit is contained in:
jay 2023-06-13 13:59:47 +08:00
parent 4c7a3c1a95
commit d15b486a6f
6 changed files with 55 additions and 36 deletions

View File

@ -3,12 +3,11 @@
PATH="$HOME/apps/go/bin:$HOME/apps/node/bin:$PATH" PATH="$HOME/apps/go/bin:$HOME/apps/node/bin:$PATH"
if command -v npm > /dev/null; then if command -v npm > /dev/null; then
npm i -g typescript typescript-language-server jsctags dockerfile-language-server-nodejs npm i -g typescript typescript-language-server dockerfile-language-server-nodejs
fi fi
if command -v go > /dev/null; then if command -v go > /dev/null; then
go install github.com/sourcegraph/go-langserver@latest go install github.com/sourcegraph/go-langserver@latest
go install github.com/jstemmer/gotags@latest
go install github.com/cweill/gotests/gotests@latest go install github.com/cweill/gotests/gotests@latest
fi fi

View File

@ -41,9 +41,6 @@ Plug 'easymotion/vim-easymotion'
Plug 'mattn/emmet-vim' Plug 'mattn/emmet-vim'
Plug 'fatih/vim-go', { 'do': ':GoUpdateBinaries' } Plug 'fatih/vim-go', { 'do': ':GoUpdateBinaries' }
Plug 'pangloss/vim-javascript' Plug 'pangloss/vim-javascript'
" tagbar
" golang install go get -u github.com/jstemmer/gotags
Plug 'majutsushi/tagbar'
Plug 'w0rp/ale' Plug 'w0rp/ale'
Plug 'godlygeek/tabular' Plug 'godlygeek/tabular'
Plug 'plasticboy/vim-markdown' Plug 'plasticboy/vim-markdown'
@ -79,6 +76,9 @@ Plug 'folke/tokyonight.nvim', { 'branch': 'main' }
Plug 'norcalli/nvim-colorizer.lua' Plug 'norcalli/nvim-colorizer.lua'
" code outline
Plug 'stevearc/aerial.nvim'
" temp plugin " temp plugin
Plug 'tpope/vim-surround' Plug 'tpope/vim-surround'
Plug 'buoto/gotests-vim' Plug 'buoto/gotests-vim'
@ -185,7 +185,6 @@ command! -bang Tabcloseright call TabCloseRight('<bang>')
command! -bang Tabcloseleft call TabCloseLeft('<bang>') command! -bang Tabcloseleft call TabCloseLeft('<bang>')
" tagbar " tagbar
nmap <F8> :TagbarToggle<CR>
nmap <F9> :%!jq .<CR> nmap <F9> :%!jq .<CR>
" NeoComplete " NeoComplete
@ -208,10 +207,14 @@ nmap <Leader>w <Plug>(easymotion-overwin-w)
" lint " lint
let g:ale_linters = { let g:ale_linters = {
\ 'javascript': ["{{ if .nvim.js_linter }}{{- .nvim.js_linter }}{{ else }}standard{{ end }}"], \ 'javascript': ["{{ if .nvim.js_linter }}{{- .nvim.js_linter }}{{ else }}standard{{ end }}"],
\ 'typescript': ["{{ if .nvim.js_linter }}{{- .nvim.js_linter }}{{ else }}standard{{ end }}"],
\ 'go': ['gopls'], \ 'go': ['gopls'],
\ 'rust': ['analyzer'], \ 'rust': ['analyzer'],
\} \}
let g:ale_fixers = {'javascript': ["{{ if .nvim.js_fixer }}{{- .nvim.js_fixer }}{{ else }}standard{{ end }}"]} let g:ale_fixers = {
\'javascript': ["{{ if .nvim.js_fixer }}{{- .nvim.js_fixer }}{{ else }}standard{{ end }}"],
\'typescript': ["{{ if .nvim.js_fixer }}{{- .nvim.js_fixer }}{{ else }}standard{{ end }}"],
\}
let g:ale_linters_explicit = 1 let g:ale_linters_explicit = 1
let g:ale_lint_on_save = 1 let g:ale_lint_on_save = 1
let g:ale_fix_on_save = 1 let g:ale_fix_on_save = 1
@ -221,33 +224,6 @@ nmap <leader>= <Plug>(ale_fix)
let g:NERDSpaceDelims=1 let g:NERDSpaceDelims=1
let g:NERDDefaultAlign='left' let g:NERDDefaultAlign='left'
let g:tagbar_type_go = {
\ 'ctagstype' : 'go',
\ 'kinds' : [
\ 'p:package',
\ 'i:imports:1',
\ 'c:constants',
\ 'v:variables',
\ 't:types',
\ 'n:interfaces',
\ 'w:fields',
\ 'e:embedded',
\ 'm:methods',
\ 'r:constructor',
\ 'f:functions'
\ ],
\ 'sro' : '.',
\ 'kind2scope' : {
\ 't' : 'ctype',
\ 'n' : 'ntype'
\ },
\ 'scope2kind' : {
\ 'ctype' : 't',
\ 'ntype' : 'n'
\ },
\ 'ctagsbin' : 'gotags',
\ 'ctagsargs' : '-sort -silent'
\ }
" copilot setup " copilot setup
imap <silent><script><expr> <C-J> copilot#Accept("\<CR>") imap <silent><script><expr> <C-J> copilot#Accept("\<CR>")
@ -615,4 +591,26 @@ require'nvim-tree'.setup {
}, },
} }
require('aerial').setup({
-- optionally use on_attach to set keymaps when aerial has attached to a buffer
on_attach = function(bufnr)
-- Jump forwards/backwards with '{' and '}'
vim.keymap.set('n', '{', '<cmd>AerialPrev<CR>', {buffer = bufnr})
vim.keymap.set('n', '}', '<cmd>AerialNext<CR>', {buffer = bufnr})
end,
filter_kind = {
"Class",
"Constructor",
"Enum",
"Function",
"Interface",
"Module",
"Method",
"Struct",
},
close_on_select = false
})
-- You probably also want to set a keymap to toggle aerial
vim.keymap.set('n', '<F8>', '<cmd>AerialToggle!<CR>')
EOF EOF

View File

@ -40,7 +40,7 @@ output * bg /home/jay/.config/sway/bg.png fill
# exec_always xdg-desktop-portal-wlr # exec_always xdg-desktop-portal-wlr
exec ~/bin/wayland-env.sh exec ~/bin/wayland-env.sh
exec --no-startup-id dbus-update-activation-environment --all exec --no-startup-id dbus-update-activation-environment --all
exec "gentoo-pipewire-launcher &; pkill -RTMIN+8 waybar" exec gentoo-pipewire-launcher &
exec_always kanshi exec_always kanshi
exec dex -a -e sway exec dex -a -e sway
exec mako exec mako

View File

@ -39,7 +39,7 @@
}, },
"custom/pipewire": { "custom/pipewire": {
"exec": "/home/jay/bin/get-volume.sh", "exec": "/home/jay/bin/get-volume.sh",
"interval": "once", "interval": 60,
"return-type": "json", "return-type": "json",
"signal": 8, "signal": 8,
"format": "{icon} {percentage}%", "format": "{icon} {percentage}%",

View File

@ -14,6 +14,7 @@
--regex-javascript=/^[ \t]*export[ \t]\{1,\}let[ \t]\{1,\}\([A-Za-z0-9_$]\{1,\}\)/\1/E,Export,Exports/b --regex-javascript=/^[ \t]*export[ \t]\{1,\}let[ \t]\{1,\}\([A-Za-z0-9_$]\{1,\}\)/\1/E,Export,Exports/b
--regex-javascript=/^[ \t]*export[ \t]\{1,\}const[ \t]\{1,\}\([A-Za-z0-9_$]\{1,\}\)/\1/E,Export,Exports/b --regex-javascript=/^[ \t]*export[ \t]\{1,\}const[ \t]\{1,\}\([A-Za-z0-9_$]\{1,\}\)/\1/E,Export,Exports/b
--regex-javascript=/^[ \t]*export[ \t]\{1,\}function[ \t]\{1,\}\([A-Za-z0-9_$]\{1,\}\)/\1/E,Export,Exports/b --regex-javascript=/^[ \t]*export[ \t]\{1,\}function[ \t]\{1,\}\([A-Za-z0-9_$]\{1,\}\)/\1/E,Export,Exports/b
--regex-javascript=/^[ \t]*export[ \t]\{1,\}async[ \t]\{1,\}function[ \t]\{1,\}\([A-Za-z0-9_$]\{1,\}\)/\1/E,Export,Exports/b
--regex-javascript=/^[ \t]*export[ \t]\{1,\}var[ \t]\{1,\}\([A-Za-z0-9_$]\{1,\}\)[ \t]*[^,]\{1,\},[ \t]*\([A-Za-z0-9_$]\{1,\}\)/\2/E,Export,Exports/b --regex-javascript=/^[ \t]*export[ \t]\{1,\}var[ \t]\{1,\}\([A-Za-z0-9_$]\{1,\}\)[ \t]*[^,]\{1,\},[ \t]*\([A-Za-z0-9_$]\{1,\}\)/\2/E,Export,Exports/b
--regex-javascript=/^[ \t]*export[ \t]\{1,\}let[ \t]\{1,\}\([A-Za-z0-9_$]\{1,\}\)[ \t]*[^,]\{1,\},[ \t]*\([A-Za-z0-9_$]\{1,\}\)/\2/E,Export,Exports/b --regex-javascript=/^[ \t]*export[ \t]\{1,\}let[ \t]\{1,\}\([A-Za-z0-9_$]\{1,\}\)[ \t]*[^,]\{1,\},[ \t]*\([A-Za-z0-9_$]\{1,\}\)/\2/E,Export,Exports/b
--regex-javascript=/^[ \t]*export[ \t]\{1,\}const[ \t]\{1,\}\([A-Za-z0-9_$]\{1,\}\)[ \t]*[^,]\{1,\},[ \t]*\([A-Za-z0-9_$]\{1,\}\)/\2/E,Export,Exports/b --regex-javascript=/^[ \t]*export[ \t]\{1,\}const[ \t]\{1,\}\([A-Za-z0-9_$]\{1,\}\)[ \t]*[^,]\{1,\},[ \t]*\([A-Za-z0-9_$]\{1,\}\)/\2/E,Export,Exports/b
@ -143,3 +144,15 @@
--regex-javascript=/^[ \t]\{1,\}\([A-Za-z0-9_$]\{1,\}\),$/\1/V,Variable,Variables/b --regex-javascript=/^[ \t]\{1,\}\([A-Za-z0-9_$]\{1,\}\),$/\1/V,Variable,Variables/b
--regex-javascript=/^[ \t]\{1,\}\([A-Za-z0-9_$]\{1,\}\)$/\1/V,Variable,Variables/b --regex-javascript=/^[ \t]\{1,\}\([A-Za-z0-9_$]\{1,\}\)$/\1/V,Variable,Variables/b
--langmap=typescript:.ts.tsx
--regex-typescript=/^[ \t]*(export[ \t]+([a-z]+[ \t]+)?)?class[ \t]+([a-zA-Z0-9_$]+)/\3/c,classes/
--regex-typescript=/^[ \t]*(declare[ \t]+)?namespace[ \t]+([a-zA-Z0-9_$]+)/\2/c,modules/
--regex-typescript=/^[ \t]*(export[ \t]+)?module[ \t]+([a-zA-Z0-9_$]+)/\2/n,modules/
--regex-typescript=/^[ \t]*(export[ \t]+)?(default[ \t]+)?(async[ \t]+)?function(\*)?[ \t]+([a-zA-Z0-9_$]+)/\5/f,functions/
--regex-typescript=/^[ \t]*export[ \t]+(var|let|const)[ \t]+([a-zA-Z0-9_$]+)/\2/v,variables/
--regex-typescript=/^[ \t]*(var|let|const)[ \t]+([a-zA-Z0-9_$]+)[ \t]*=[ \t]*function[ \t]*[*]?[ \t]*\(\)/\2/v,varlambdas/
--regex-typescript=/^[ \t]*(export[ \t]+)?(public|protected|private)?[ \t]*(static[ \t]+)?(abstract[ \t]+)?(((get|set|readonly)[ \t]+)|(async[ \t]+[*]*[ \t]*))?(#?[a-zA-Z1-9_$]+)[ \t]*[:(]/\9/m,members/
--regex-typescript=/^[ \t]*(export[ \t]+)?interface[ \t]+([a-zA-Z0-9_$]+)/\2/i,interfaces/
--regex-typescript=/^[ \t]*(export[ \t]+)?type[ \t]+([a-zA-Z0-9_$]+)/\2/t,types/
--regex-typescript=/^[ \t]*(export[ \t]+)?enum[ \t]+([a-zA-Z0-9_$]+)/\2/e,enums/
--regex-typescript=/^[ \t]*import[ \t]+([a-zA-Z0-9_$]+)/\1/I,imports/

View File

@ -74,6 +74,15 @@ function ln-save-image {
docker-save --rm -p -o . -i registry.lawsnote.com/$1 docker-save --rm -p -o . -i registry.lawsnote.com/$1
} }
function save-image {
if [ -z "$1" ]; then
echo "usage: save-image <image-name>"
exit 1
fi
tag=$(ln-image-tags "$1" | jq -c -r 'del(.tags[] | select(. == "latest")) | .tags | sort | last') || exit 1
ln-save-image "$1:$tag"
}
function minio-size { function minio-size {
if [ -z "$1" ]; then if [ -z "$1" ]; then
echo "usage: minio-size <alias or alias/bucket-path>" echo "usage: minio-size <alias or alias/bucket-path>"