From 4ee76734de1d426df88a2a4791391909cd1a8597 Mon Sep 17 00:00:00 2001 From: Hsieh Chin Fan Date: Sat, 14 Sep 2024 00:07:12 +0800 Subject: Update --- alias | 3 +- profile.sh | 3 +- snippets/html_leaflet | 9 ++++++ snippets/html_maplibre_cdn | 1 + snippets/javascript_promise | 3 ++ snippets/javascript_terrdraw | 32 ++++++++++++++++++++ tigrc | 12 ++++---- vim/init.vim | 2 ++ vim/init/config.vim | 4 ++- vim/init/keymaps.vim | 8 ++++- vim/mini.lua | 70 +++++++++++++++++++++++--------------------- 11 files changed, 104 insertions(+), 43 deletions(-) create mode 100644 snippets/html_leaflet create mode 100644 snippets/html_maplibre_cdn create mode 100644 snippets/javascript_promise create mode 100644 snippets/javascript_terrdraw diff --git a/alias b/alias index 5af2f78..1d9ff8d 100644 --- a/alias +++ b/alias @@ -207,7 +207,7 @@ date.reset() { alias clock.reset='hwclock --systohc' unalias gr &>/dev/null gr() { - grep -IR $1 . + grep -IR $@ . --exclude-dir=node_modules } alias findn='find . -iname' @@ -537,6 +537,7 @@ alias ffmpeg='ffmpeg -hide_banner' alias md='reveal' alias terminal.color='printf "\e[%dm%d dark\e[0m \e[%d;1m%d bold\e[0m\n" {30..37}{,,,}' alias gpg.bye='gpg-connect-agent reloadagent /bye' +alias npm='pnpm' # GIS TAIWAN_BBOX='118.1036,20.72799,122.9312,26.60305' diff --git a/profile.sh b/profile.sh index 9ebe755..3b32d55 100755 --- a/profile.sh +++ b/profile.sh @@ -73,6 +73,7 @@ fi [ -e $HOME/.config/nvm/nvm.sh ] && source "$HOME/.config/nvm/nvm.sh" # Working DIR -[[ `pwd` == $HOME ]] && test -d ~/Downloads && cd ~/Downloads +# [[ `pwd` == $HOME ]] && test -d ~/Downloads && cd ~/Downloads +cd ~/git/dumbymap true diff --git a/snippets/html_leaflet b/snippets/html_leaflet new file mode 100644 index 0000000..7b434c1 --- /dev/null +++ b/snippets/html_leaflet @@ -0,0 +1,9 @@ + + + + + diff --git a/snippets/html_maplibre_cdn b/snippets/html_maplibre_cdn new file mode 100644 index 0000000..4dc2b17 --- /dev/null +++ b/snippets/html_maplibre_cdn @@ -0,0 +1 @@ + diff --git a/snippets/javascript_promise b/snippets/javascript_promise new file mode 100644 index 0000000..12128a7 --- /dev/null +++ b/snippets/javascript_promise @@ -0,0 +1,3 @@ +new Promise((resolve, reject) => { + +}) diff --git a/snippets/javascript_terrdraw b/snippets/javascript_terrdraw new file mode 100644 index 0000000..17363b1 --- /dev/null +++ b/snippets/javascript_terrdraw @@ -0,0 +1,32 @@ +// Events +draw.on("finish", (id: string, context: { action: string, mode: string }) => { + if (action === 'draw') { + // Do something for draw finish event + } else if (action === 'dragFeature') { + // Do something for a drag finish event + } else if (action === 'dragCoordinate') { + // + }else if (action === 'dragCoordinateResize') { + // + } +}); + +draw.on("change", (ids: string[], type: string) => { + // Possible type values: + // 'create' + // 'update' + // 'delete' + // 'styling' + // Do something + //... +}); + +draw.on("select", (id: string) => { + // Do something + //... +}); + +draw.on("deselect", () => { + // Do something + //... +}); diff --git a/tigrc b/tigrc index 02330a6..8817f54 100644 --- a/tigrc +++ b/tigrc @@ -39,12 +39,12 @@ bind generic xB +sh -c "echo -n %(blob) | xsel -ib && echo Full Blob Clipped" ## Remote bind generic Uv +sh -c "git remote -v | grep %(remote)" bind generic UV >sh -c "git remote -vv | tig" -bind generic Ua @git remote add "%(prompt New Github remote name: )" git@github.com:"%(prompt User/Repo: )" -bind generic UA @git remote add "%(prompt New remote name: )" "%(prompt Remote url: )" +bind generic UA @git remote add "%(prompt New Github remote name: )" git@github.com:"%(prompt User/Repo: )" +bind generic Ua @git remote add "%(prompt New remote name: )" "%(prompt Remote url: )" bind generic Ur @git remote rename "%(prompt Rename which remote?: )" "%(prompt Enter new remote name: )" bind generic U! @git remote remove "%(prompt Remove which remote?: )" -bind generic Us @git remote set-url "%(prompt Set url for which remote?: )" git@github.com:"%(prompt User/Repo: )" -bind generic US @git remote set-url "%(prompt Set url for which remote?: )" "%(prompt New url: )" +bind generic US @git remote set-url "%(prompt Set url for which remote?: )" git@github.com:"%(prompt User/Repo: )" +bind generic Us @git remote set-url "%(prompt Set url for which remote?: )" "%(prompt New url: )" bind generic Uf ?git fetch "%(prompt Fetch from which remote?: )" bind generic UU ?git remote update --prune bind generic Ut ?sh -c "git pull %(remote) --tags --force" @@ -140,9 +140,9 @@ bind main gs ?@git merge %(branch) --squash bind main p none # override default pager binding bind main pp ?git push bind main pP ?git push -u %(remote) %(branch):%(branch) -bind main pr ?git push -u %(remote) %(branch):%(branch) +bind main pR ?git push -u %(remote) %(branch):%(branch) bind main pc ?git push -u %(remote) %(commit):%(branch) -bind main pR ?git push -u '%(prompt Which remote? )' %(branch):%(branch) +bind main pr ?git push -u '%(prompt Which remote? )' %(branch):%(branch) bind main pF ?git push --force bind main pd ?git push %(remote) :%(branch) bind generic pD ?git push '%(prompt Delete from which remote? )' :'%(prompt Which reference? )' diff --git a/vim/init.vim b/vim/init.vim index c1dee81..59be77e 100644 --- a/vim/init.vim +++ b/vim/init.vim @@ -30,3 +30,5 @@ else endif LoadScript init/highlight.vim + +source ~/.projects.vim diff --git a/vim/init/config.vim b/vim/init/config.vim index 74cbd39..4676942 100644 --- a/vim/init/config.vim +++ b/vim/init/config.vim @@ -188,11 +188,13 @@ augroup InitFileTypes endif " Fold for heading and the following contents - let hash_num = matchstr(getline(v:lnum), '^#\+') + let hash_num = matchstr(getline(v:lnum), '^\zs#\+\ze\s') if !empty(hash_num) let foldlevel = g:markdown_apply_heading_level ? len(hash_num) - 1 : 1 " HEADING return len(hash_num) == 1 ? 0 : '>'.foldlevel + elseif match(getline(v:lnum), '^----') != -1 + return "<" else " Contents return "=" diff --git a/vim/init/keymaps.vim b/vim/init/keymaps.vim index c0af8c8..bf3d7ab 100644 --- a/vim/init/keymaps.vim +++ b/vim/init/keymaps.vim @@ -92,6 +92,11 @@ nnoremap gF :e xnoremap iq i" xnoremap aq a" +nnoremap ze zszH + +nnoremap 0 ^ +nnoremap ^ 0 + " READLINE {{{ @@ -495,8 +500,9 @@ function! CloseBufferSafely() tabclose else " Switch to proper buffer - let next_buf = get(t:bufs, bufnr('#')) ? bufnr('#') : filter(t:bufs, 'v:val != '..bufnr)[0] + let next_buf = get(t:bufs, bufnr('#')) ? bufnr('#') : filter(t:bufs, 'v:val != '..bufnr)[-1] exe "b "..next_buf + " exe "buffer ".g:lastbuffer call filter(t:bufs, 'v:val != '..bufnr) endif diff --git a/vim/mini.lua b/vim/mini.lua index 92f9efe..0658d4d 100644 --- a/vim/mini.lua +++ b/vim/mini.lua @@ -1412,39 +1412,43 @@ require("lazy").setup({ }, -- }}} - -- -- lspsaga {{{ - -- { - -- 'nvimdev/lspsaga.nvim', - -- dependencies = { - -- 'nvim-treesitter/nvim-treesitter', -- optional - -- 'nvim-tree/nvim-web-devicons', -- optional - -- }, - -- config = function() - -- require('lspsaga').setup({ - -- autochdir = true, - -- }) - -- vim.api.nvim_create_autocmd("LspAttach", { - -- group = custom_autocommands, - -- pattern = "*", - -- callback = function(args) - -- local map = vim.api.nvim_buf_set_keymap - -- map(0, "n", "gd", "Lspsaga goto_definition", { silent = true, noremap = true }) - -- map(0, "n", "gR", "Lspsaga rename", { silent = true, noremap = true }) - -- map(0, "n", "gx", "Lspsaga code_action", { silent = true, noremap = true }) - -- map(0, "x", "gx", ":Lspsaga range_code_action", { silent = true, noremap = true }) - -- map(0, "n", "K", "Lspsaga hover_doc", { silent = true, noremap = true }) - -- map(0, "n", "go", "Lspsaga show_line_diagnostics", { silent = true, noremap = true }) - -- map(0, "n", "gj", "Lspsaga diagnostic_jump_next", { silent = true, noremap = true }) - -- map(0, "n", "gk", "Lspsaga diagnostic_jump_prev", { silent = true, noremap = true }) - -- - -- -- Don't know why... Everytime when modeline is set and insert a single char - -- -- while inside a fold, the fold closes. - -- vim.opt_local.modeline = false - -- end, - -- }) - -- end - -- }, - -- -- }}} + -- lspsaga {{{ + { + 'nvimdev/lspsaga.nvim', + dependencies = { + 'nvim-treesitter/nvim-treesitter', -- optional + 'nvim-tree/nvim-web-devicons', -- optional + }, + config = function() + require('lspsaga').setup({ + autochdir = true, + lightbulb = { + sign = false, + virtual_text = true, + }, + }) + vim.api.nvim_create_autocmd("LspAttach", { + group = custom_autocommands, + pattern = "*", + callback = function(args) + local map = vim.api.nvim_buf_set_keymap + map(0, "n", "gd", "Lspsaga goto_definition", { silent = true, noremap = true }) + map(0, "n", "gR", "Lspsaga rename", { silent = true, noremap = true }) + map(0, "n", "gx", "Lspsaga code_action", { silent = true, noremap = true }) + map(0, "x", "gx", ":Lspsaga range_code_action", { silent = true, noremap = true }) + map(0, "n", "K", "Lspsaga hover_doc", { silent = true, noremap = true }) + map(0, "n", "go", "Lspsaga show_line_diagnostics", { silent = true, noremap = true }) + map(0, "n", "gj", "Lspsaga diagnostic_jump_next", { silent = true, noremap = true }) + map(0, "n", "gk", "Lspsaga diagnostic_jump_prev", { silent = true, noremap = true }) + + -- Don't know why... Everytime when modeline is set and insert a single char + -- while inside a fold, the fold closes. + vim.opt_local.modeline = false + end, + }) + end + }, + -- }}} -- -- conform {{{ -- { -- "stevearc/conform.nvim", -- cgit v1.2.3-70-g09d2