aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--X11/openbox/rc.xml2
-rw-r--r--alias3
-rw-r--r--snippets/css_html_showcase32
-rw-r--r--snippets/css_html_structure85
-rw-r--r--snippets/css_transition_common21
-rw-r--r--snippets/html_mapclay8
-rw-r--r--snippets/javascript_mutationoberserver12
-rw-r--r--snippets/js_maplibre_terrain27
-rw-r--r--snippets/sh_shebang1
-rw-r--r--tigrc8
-rw-r--r--vim/init/basic.vim6
-rw-r--r--vim/init/config.vim38
-rw-r--r--vim/init/keymaps.vim3
-rw-r--r--vim/mini.lua67
-rw-r--r--vim/spell/en.utf-8.add16
-rw-r--r--vim/spell/en.utf-8.add.splbin0 -> 307 bytes
16 files changed, 294 insertions, 35 deletions
diff --git a/X11/openbox/rc.xml b/X11/openbox/rc.xml
index 652c003..2626285 100644
--- a/X11/openbox/rc.xml
+++ b/X11/openbox/rc.xml
@@ -541,7 +541,7 @@
541 <keybind key="W-e"> 541 <keybind key="W-e">
542 <action name="Execute"> 542 <action name="Execute">
543 <command> 543 <command>
544 alacritty -e nvim -c 'r !xsel -ob' -c 'nmap &lt;C-c&gt; :w !xsel -ib&lt;CR&gt;:qa!&lt;CR&gt;' 544 alacritty -e nvim -c 'r !xsel -ob' -c 'normal A' -c 'startinsert' -c 'nmap &lt;C-c&gt; :w !xsel -ib&lt;CR&gt;:qa!&lt;CR&gt;'
545 </command> 545 </command>
546 </action> 546 </action>
547 </keybind> 547 </keybind>
diff --git a/alias b/alias
index e40ef38..5d9fad9 100644
--- a/alias
+++ b/alias
@@ -208,7 +208,7 @@ date.reset() {
208alias clock.reset='hwclock --systohc' 208alias clock.reset='hwclock --systohc'
209unalias gr &>/dev/null 209unalias gr &>/dev/null
210gr() { 210gr() {
211 grep -IR $@ . --exclude-dir=node_modules 211 grep -IR $@ . | sed '/^.\{2048\}./d'
212} 212}
213alias findn='find . -iname' 213alias findn='find . -iname'
214 214
@@ -478,7 +478,6 @@ alias curl.wifi='curl -I google.com | grep -E "^Location:" | cut -d" " -f2 | xse
478# misc 478# misc
479alias foo='echo bar > foo && echo File foo is created && ls -lh foo' 479alias foo='echo bar > foo && echo File foo is created && ls -lh foo'
480alias bar='echo foo > bar && echo File bar is created && ls -lh bar' 480alias bar='echo foo > bar && echo File bar is created && ls -lh bar'
481unalias gr &>/dev/null
482alias wcl='wc -l' 481alias wcl='wc -l'
483alias x='xdg-open' 482alias x='xdg-open'
484alias yl='youtube-dl' 483alias yl='youtube-dl'
diff --git a/snippets/css_html_showcase b/snippets/css_html_showcase
new file mode 100644
index 0000000..2941cc1
--- /dev/null
+++ b/snippets/css_html_showcase
@@ -0,0 +1,32 @@
1<div style="display: flex; align-items: center; flex-direction: row !important;">
2<pre>
3{
4 use: mapX
5 width: 300px
6 height: 400px
7 center: Taiwan
8}
9</pre>
10<pre>
11 =>
12</pre>
13
14```map
15use: Maplibre
16width: 300px
17height: 400px
18center: [121,24]
19zoom: 6
20```
21
22
23
24</div>
25
26<style>
27 pre {
28 font-size: 2rem;
29 font-weight: 700;
30 line-height: 1.9;
31 }
32</style>
diff --git a/snippets/css_html_structure b/snippets/css_html_structure
new file mode 100644
index 0000000..e96d9f8
--- /dev/null
+++ b/snippets/css_html_structure
@@ -0,0 +1,85 @@
1<style>
2 ._dumby {
3 &::before {
4 content: 'class="Dumby"';
5 }
6 &, & * {
7 display: flex;
8 position: relative;
9 padding-top:2rem;
10 margin: 0.5rem;
11 &::before {
12 position: absolute;
13 top: 0.3rem;
14 left: 1rem;
15 }
16 }
17
18 border: 5px solid red;
19 width: 100%;
20 background: rgba(255, 0, 0, 20%);
21 }
22 ._SemanticHtml {
23 flex: 80%;
24 display: block;
25 border: 3px solid blue;
26 background: skyblue;
27 &::before {
28 content: 'class="SemanticHtml"';
29 }
30 }
31 ._dumby-block {
32 border: 3px solid gray;
33 background: lightgray;
34 &::before {
35 content: 'class="dumby-block"';
36 }
37 }
38 ._target {
39 border: 3px solid chocolate;
40 background: wheat;
41 width: 100%;
42 height: 300px;
43 display: flex;
44 padding-top: 3rem;
45 &::before {
46 content: 'CUSTOM SELECTOR, by default:\Apre:has(.language-map)';
47 white-space: pre;
48 }
49 }
50 ._map-container {
51 flex: 50%;
52 border: 3px solid steelblue;
53 background: lightCyan;
54 padding: 0.5rem;
55 &::before {
56 transform: rotate(0.13turn) translate(0.7rem, 2.5rem);
57 content: 'class=\A"map-container"';
58 white-space: pre;
59 }
60 }
61 ._Showcase {
62 flex: 30%;
63 border: 3px solid green;
64 background: lightgreen;
65 &::before {
66 content: 'class="Showcase"';
67 }
68 }
69</style>
70
71<div class="_dumby">
72 <div class="_SemanticHtml">
73 <div class="_dumby-block">
74 <div class="_target">
75 <div class="_map-container"></div>
76 <div class="_map-container"></div>
77 <div class="_map-container"></div>
78 </div>
79 </div>
80 <div class="_dumby-block"></div>
81 <div class="_dumby-block"></div>
82 </div>
83 <div class="_Showcase">
84 </div>
85</div>
diff --git a/snippets/css_transition_common b/snippets/css_transition_common
new file mode 100644
index 0000000..4884c90
--- /dev/null
+++ b/snippets/css_transition_common
@@ -0,0 +1,21 @@
1@media (prefers-reduced-motion: no-preference) {
2 transition:
3 opacity .5s ease-in,
4 scale .5s ease-in,
5 display .5s ease-in;
6 height .5s ease-in;
7 transition-behavior: allow-discrete;
8}
9
10@starting-style {
11 opacity: 0;
12 scale: 1.1;
13}
14
15&[hidden] {
16 opacity: 0;
17 scale: .9;
18 display: none !important;
19 transition-duration: .4s;
20 transition-timing-function: ease-out;
21}
diff --git a/snippets/html_mapclay b/snippets/html_mapclay
new file mode 100644
index 0000000..a89867b
--- /dev/null
+++ b/snippets/html_mapclay
@@ -0,0 +1,8 @@
1<pre>
2use: Leaflet
3XYZ: https://tile.openstreetmap.jp/styles/osm-bright/512/{z}/{x}/{y}.png
4draw: true
5control:
6 scale: true
7</pre>
8<script data-target="pre" src='http://localhost:8080/mapclay/dist/mapclay.js'></script>
diff --git a/snippets/javascript_mutationoberserver b/snippets/javascript_mutationoberserver
new file mode 100644
index 0000000..48f17af
--- /dev/null
+++ b/snippets/javascript_mutationoberserver
@@ -0,0 +1,12 @@
1 new window.MutationObserver((ms) => {
2 for (const m of ms) {
3 console.log(m)
4 console.log('m', m.target.innerHTML)
5 console.log('m', m.target.classList)
6 }
7 }).observe(item, {
8 attributes: true,
9 attributeFilter: ['class'],
10 attributeOldValue: true,
11 characterDataOldValue: true
12 })
diff --git a/snippets/js_maplibre_terrain b/snippets/js_maplibre_terrain
new file mode 100644
index 0000000..a6466db
--- /dev/null
+++ b/snippets/js_maplibre_terrain
@@ -0,0 +1,27 @@
1map.addSource('hillshading', {
2 "type": "raster-dem",
3 "tiles": [
4 "https://osmhacktw.github.io/terrain-rgb/tiles/{z}/{x}/{y}.png"
5 ],
6 "tileSize": 256,
7 "maxzoom": 12
8});
9map.setTerrain({ 'source': 'hillshading', 'exaggeration': 1.5 });
10
11map.addLayer({
12 "id": "hillshading",
13 "type": "hillshade",
14 "source": "hillshading",
15 "minzoom": 6
16});
17
18map.on('load', function () {
19 document.getElementById('slider').addEventListener('input', function (e) {
20 console.log(e.target.value);
21 map.setPaintProperty(
22 'hillshading',
23 'hillshade-illumination-direction',
24 parseInt(e.target.value)
25 );
26 });
27});
diff --git a/snippets/sh_shebang b/snippets/sh_shebang
new file mode 100644
index 0000000..36ac368
--- /dev/null
+++ b/snippets/sh_shebang
@@ -0,0 +1 @@
#! /bin/bash
diff --git a/tigrc b/tigrc
index 8817f54..c7b6589 100644
--- a/tigrc
+++ b/tigrc
@@ -140,9 +140,10 @@ bind main gs ?@git merge %(branch) --squash
140bind main p none # override default pager binding 140bind main p none # override default pager binding
141bind main pp ?git push 141bind main pp ?git push
142bind main pP ?git push -u %(remote) %(branch):%(branch) 142bind main pP ?git push -u %(remote) %(branch):%(branch)
143bind main pR ?git push -u %(remote) %(branch):%(branch)
144bind main pc ?git push -u %(remote) %(commit):%(branch)
145bind main pr ?git push -u '%(prompt Which remote? )' %(branch):%(branch) 143bind main pr ?git push -u '%(prompt Which remote? )' %(branch):%(branch)
144bind main pfr ?git push -u '%(prompt Force push to which remote? )' %(branch):%(branch) -f
145bind main pR ?git push -u %(remote) %(branch):%(branch)
146bind main pc ?git push -u '%(prompt Which remote? )' %(commit):%(branch)
146bind main pF ?git push --force 147bind main pF ?git push --force
147bind main pd ?git push %(remote) :%(branch) 148bind main pd ?git push %(remote) :%(branch)
148bind generic pD ?git push '%(prompt Delete from which remote? )' :'%(prompt Which reference? )' 149bind generic pD ?git push '%(prompt Delete from which remote? )' :'%(prompt Which reference? )'
@@ -151,8 +152,7 @@ bind generic pD ?git push '%(prompt Delete from which remote? )' :'%(prompt Whic
151bind main <C-F> ?git fetch %(remote) 152bind main <C-F> ?git fetch %(remote)
152bind main gf ?git fetch '%(prompt Which remote? )' # Go to Fetch a specific remote 153bind main gf ?git fetch '%(prompt Which remote? )' # Go to Fetch a specific remote
153bind main gF ?git fetch '%(prompt Which remote? )' '%(prompt Which branch? )' 154bind main gF ?git fetch '%(prompt Which remote? )' '%(prompt Which branch? )'
154bind main pu !git pull %(remote) %(branch) 155bind main pu !git pull '%(prompt Pull from witch remote? )' %(branch)
155bind main pf !git pull '%(prompt Pull from witch remote? )' %(branch)
156bind main pU ?git pull --rebase 156bind main pU ?git pull --rebase
157 157
158# reset/rebase/revert 158# reset/rebase/revert
diff --git a/vim/init/basic.vim b/vim/init/basic.vim
index 50a0ec9..c4c62e7 100644
--- a/vim/init/basic.vim
+++ b/vim/init/basic.vim
@@ -86,6 +86,12 @@ set display=lastline
86set lazyredraw 86set lazyredraw
87set whichwrap=b,s 87set whichwrap=b,s
88 88
89" linebreak, ref: https://stackoverflow.com/questions/1204149/smart-wrap-in-vim
90set breakindent
91" ident by an additional 2 characters on wrapped lines, when line >= 40 characters, put 'showbreak' at start of line
92set breakindentopt=shift:4,min:40,sbr
93set showbreak=>>
94
89" Tab 95" Tab
90set showtabline=2 96set showtabline=2
91 97
diff --git a/vim/init/config.vim b/vim/init/config.vim
index 4676942..5c53728 100644
--- a/vim/init/config.vim
+++ b/vim/init/config.vim
@@ -216,6 +216,34 @@ augroup InitFileTypes
216 endfunc 216 endfunc
217 217
218 " }}} 218 " }}}
219 " Javascript {{{
220
221 au FileType javascript call InitJavascriptFile()
222 function! InitJavascriptFile()
223 setlocal wrap sw=2 ts=2
224
225 setlocal foldexpr=JsdocLevel() foldmethod=expr
226
227 let l:jsdocPrefix = "JSDOC: "
228 setlocal foldtext=JSdocFoldText()
229 endfunc
230
231 function! JsdocLevel()
232 let jsdoc = matchstr(getline(v:lnum), '^\zs\s*\/\*\*\ze')
233 if !empty(jsdoc)
234 let foldlevel = len(matchstr(jsdoc, '^\zs\s*\ze')) + 1
235 return '>'.foldlevel
236 else
237 " Contents
238 return "="
239 endif
240 endfunc
241
242 function! JSdocFoldText()
243 return "JSDOC: ".matchstr(getline(v:foldstart + 1), '^[\* ]*\zs.*\ze')
244 endfunc
245
246 " }}}
219 " HTML {{{ 247 " HTML {{{
220 248
221 " Usage: <leader>cl(ass) or <leader>id to edit html tag attribute 249 " Usage: <leader>cl(ass) or <leader>id to edit html tag attribute
@@ -235,8 +263,11 @@ augroup InitFileTypes
235 startinsert 263 startinsert
236 endif 264 endif
237 endfunc 265 endfunc
238 autocmd FileType html,markdown nnoremap <buffer> <leader>cl :call <SID>ChangeAttr("class")<CR> 266 autocmd FileType html,markdown,javascript nnoremap <buffer> <leader>cl :call <SID>ChangeAttr("class")<CR>
239 autocmd FileType html,markdown nnoremap <buffer> <leader>id :call <SID>ChangeAttr("id")<CR> 267 autocmd FileType html,markdown,javascript nnoremap <buffer> <leader>id :call <SID>ChangeAttr("id")<CR>
268 autocmd FileType css,javascript nnoremap <buffer> <F9> :let LINE=line(".")<CR>:silent! %!npx standard --stdin --fix 2>/dev/null<CR>:exe LINE<CR>
269 autocmd FileType css,javascript nmap <buffer> <F8> cdg:let LINE=line(".")<CR>:%!stylelint --fix --stdin 2>/dev/null<CR>:exe LINE<CR>
270 autocmd FileType css,javascript set formatprg=prettier
240 271
241 " Reload preview server 272 " Reload preview server
242 autocmd BufWrite *.html,*.js,*.css call ReloadServer() 273 autocmd BufWrite *.html,*.js,*.css call ReloadServer()
@@ -279,4 +310,5 @@ augroup InitFileTypes
279 310
280augroup END 311augroup END
281 312
282" }}} 313let g:ale_lint_on_save = 1
314let g:ale_fix_on_save = 1
diff --git a/vim/init/keymaps.vim b/vim/init/keymaps.vim
index 2d58fe9..07be9b3 100644
--- a/vim/init/keymaps.vim
+++ b/vim/init/keymaps.vim
@@ -476,6 +476,7 @@ let g:quitVimWhenPressingCtrlC = 1
476function! ToggleQuit() 476function! ToggleQuit()
477 let g:quitVimWhenPressingCtrlC = !g:quitVimWhenPressingCtrlC 477 let g:quitVimWhenPressingCtrlC = !g:quitVimWhenPressingCtrlC
478 let message = g:quitVimWhenPressingCtrlC ? "Unlock" : "Lock" 478 let message = g:quitVimWhenPressingCtrlC ? "Unlock" : "Lock"
479 nnoremap ZZ <C-c>
479 echo message 480 echo message
480endfunction 481endfunction
481nnoremap \q :call ToggleQuit()<CR> 482nnoremap \q :call ToggleQuit()<CR>
@@ -502,7 +503,7 @@ function! CloseBufferSafely()
502 tabclose 503 tabclose
503 else 504 else
504 " Switch to proper buffer 505 " Switch to proper buffer
505 let next_buf = get(t:bufs, bufnr('#')) ? bufnr('#') : filter(t:bufs, 'v:val != '..bufnr)[-1] 506 let next_buf = filter(t:bufs, 'v:val != '..bufnr)[-1]
506 exe "b "..next_buf 507 exe "b "..next_buf
507 " exe "buffer ".g:lastbuffer 508 " exe "buffer ".g:lastbuffer
508 call filter(t:bufs, 'v:val != '..bufnr) 509 call filter(t:bufs, 'v:val != '..bufnr)
diff --git a/vim/mini.lua b/vim/mini.lua
index 177d80a..7451258 100644
--- a/vim/mini.lua
+++ b/vim/mini.lua
@@ -564,11 +564,14 @@ require("lazy").setup({
564 require("telescope").setup({ 564 require("telescope").setup({
565 defaults = { 565 defaults = {
566 preview = { 566 preview = {
567 filesize_limit = 0.5,
567 filesize_hook = function(filepath, bufnr, opts) 568 filesize_hook = function(filepath, bufnr, opts)
568 local max_bytes = 100000 569 local max_bytes = 10000
569 local cmd = { "head", "-c", max_bytes, filepath } 570 local cmd = { "head", "-c", max_bytes, filepath }
570 require('telescope.previewers.utils').job_maker(cmd, bufnr, opts) 571 require('telescope.previewers.utils').job_maker(cmd, bufnr, opts)
571 end 572 end,
573 timeout = 50,
574 highlight_limit = 1,
572 }, 575 },
573 mappings = { 576 mappings = {
574 i = { 577 i = {
@@ -644,10 +647,10 @@ require("lazy").setup({
644 "<leader>sF", 647 "<leader>sF",
645 function() 648 function()
646 require("telescope.builtin").find_files({ 649 require("telescope.builtin").find_files({
647 follow = ture, 650 follow = ture,
648 no_ignore = true, 651 no_ignore = true,
649 hidden = true, 652 hidden = true,
650 file_ignore_patterns = {}, 653 file_ignore_patterns = {},
651 }) 654 })
652 end, 655 end,
653 { desc = "telescope find all files" } 656 { desc = "telescope find all files" }
@@ -826,24 +829,22 @@ require("lazy").setup({
826 lazy = false, 829 lazy = false,
827 config = function() 830 config = function()
828 require("which-key").setup({ 831 require("which-key").setup({
829 defaults = { 832 win = {
830 win = { 833 -- don't allow the popup to overlap with the cursor
831 -- don't allow the popup to overlap with the cursor 834 no_overlap = false,
832 no_overlap = false, 835 -- width = 1,
833 -- width = 1, 836 height = { min = 10, max = 25 },
834 height = { min = 10, max = 25 }, 837 -- col = 0,
835 -- col = 0, 838 -- row = math.huge,
836 -- row = math.huge, 839 -- border = "none",
837 -- border = "none", 840 padding = { 1, 2 }, -- extra window padding [top/bottom, right/left]
838 padding = { 1, 2 }, -- extra window padding [top/bottom, right/left] 841 title = false,
839 title = true, 842 title_pos = "center",
840 title_pos = "center", 843 zindex = 1000,
841 zindex = 1000, 844 -- Additional vim.wo and vim.bo options
842 -- Additional vim.wo and vim.bo options 845 bo = {},
843 bo = {}, 846 wo = {
844 wo = { 847 -- winblend = 10, -- value between 0-100 0 for fully opaque and 100 for fully transparent
845 -- winblend = 10, -- value between 0-100 0 for fully opaque and 100 for fully transparent
846 },
847 }, 848 },
848 }, 849 },
849 }) 850 })
@@ -1477,6 +1478,24 @@ require("lazy").setup({
1477 -- end, 1478 -- end,
1478 -- }, 1479 -- },
1479 -- -- }}} 1480 -- -- }}}
1481 -- ALE {{{
1482 {
1483 'dense-analysis/ale',
1484 config = function()
1485 -- Configuration goes here.
1486 local g = vim.g
1487
1488 g.ale_ruby_rubocop_auto_correct_all = 1
1489
1490 g.ale_linters = {
1491 ruby = { 'javascript', 'standard' },
1492 lua = { 'lua_language_server' }
1493 }
1494
1495 vim.keymap.set("n", "\a", vim.cmd("ALEDisable"))
1496 end
1497 },
1498 -- }}}
1480}) 1499})
1481 1500
1482-- KEYMAPS {{{ 1501-- KEYMAPS {{{
diff --git a/vim/spell/en.utf-8.add b/vim/spell/en.utf-8.add
new file mode 100644
index 0000000..d4297c4
--- /dev/null
+++ b/vim/spell/en.utf-8.add
@@ -0,0 +1,16 @@
1#eoLink/!
2GeoLink/!
3GeoLink
4GeoLink
5geo
6dumbymap
7Dumbymap
8mapclay
9EasyMDE
10js
11CDN
12unpkg
13mjs
14DocLink
15StoryMapJS
16afterMapRendered
diff --git a/vim/spell/en.utf-8.add.spl b/vim/spell/en.utf-8.add.spl
new file mode 100644
index 0000000..a9f1927
--- /dev/null
+++ b/vim/spell/en.utf-8.add.spl
Binary files differ