⚡ refact and moves ~/bin to ~/.local/bin
This commit is contained in:
1
.bashrc
1
.bashrc
@@ -12,7 +12,6 @@ shopt -s expand_aliases
|
||||
[ -f $BASH_DOTFILES/.bash_sdkman ] && . $BASH_DOTFILES/.bash_sdkman
|
||||
[ -f $BASH_DOTFILES/.bash_nvm ] && . $BASH_DOTFILES/.bash_nvm
|
||||
export NODE_COMPILE_CACHE=~/.cache/nodejs-compile-cache # https://nolanlawson.com/2024/10/20/why-im-skeptical-of-rewriting-javascript-tools-in-faster-languages/
|
||||
export PATH="$HOME/.local/bin:$PATH"
|
||||
eval "$(/home/linuxbrew/.linuxbrew/bin/brew shellenv)"
|
||||
[ -f $BASH_DOTFILES/.bash_completions ] && . $BASH_DOTFILES/.bash_completions # for Vim
|
||||
|
||||
|
@@ -148,9 +148,9 @@
|
||||
"group": "ai",
|
||||
"file_name": "ollama",
|
||||
"exec": "yes",
|
||||
"last_update": "2025-08-25T18:04:05Z",
|
||||
"last_update": "2025-09-04T17:27:40Z",
|
||||
"downloads": "/home/jaandrle/bin/ollama",
|
||||
"version": "v0.11.7",
|
||||
"version": "v0.11.10",
|
||||
"glare": "linux-amd64"
|
||||
},
|
||||
{
|
||||
@@ -173,8 +173,8 @@
|
||||
"file_name": "vim",
|
||||
"exec": "yes",
|
||||
"downloads": "/home/jaandrle/bin/vim",
|
||||
"version": "v9.1.1696",
|
||||
"last_update": "2025-08-27T01:22:07Z",
|
||||
"version": "v9.1.1744",
|
||||
"last_update": "2025-09-09T01:22:24Z",
|
||||
"glare": "GVim.*x86_64.*.AppImage"
|
||||
},
|
||||
{
|
||||
@@ -184,9 +184,9 @@
|
||||
"group": "dev",
|
||||
"file_name": "escrcpy.appimage",
|
||||
"exec": "yes",
|
||||
"last_update": "2025-07-15T10:25:01Z",
|
||||
"last_update": "2025-09-08T03:15:03Z",
|
||||
"downloads": "/home/jaandrle/bin/escrcpy.appimage",
|
||||
"version": "v1.30.2",
|
||||
"version": "v1.32.0",
|
||||
"glare": ".*x86_64.*.AppImage"
|
||||
},
|
||||
{
|
||||
@@ -208,9 +208,9 @@
|
||||
"group": "ai",
|
||||
"file_name": "jan",
|
||||
"exec": "yes",
|
||||
"last_update": "2025-08-14T09:29:09Z",
|
||||
"last_update": "2025-08-28T10:22:10Z",
|
||||
"downloads": "/home/jaandrle/bin/jan",
|
||||
"version": "v0.6.8",
|
||||
"version": "v0.6.9",
|
||||
"glare": ".*x86_64.*.AppImage"
|
||||
},
|
||||
{
|
||||
|
@@ -2,7 +2,7 @@
|
||||
|
||||
## uu
|
||||
- [./uu](./uu)
|
||||
- [../.config/uurc](../.config/uurc)
|
||||
- [~/.config/uurc](../../.config/uurc)
|
||||
|
||||
## asciinema, asciinema-agg
|
||||
plays/records terminal commands (agg cast→gif)
|
3
.local/bin/kde6-workarounds.sh
Executable file
3
.local/bin/kde6-workarounds.sh
Executable file
@@ -0,0 +1,3 @@
|
||||
#!/usr/bin/env bash
|
||||
set -eou pipefail
|
||||
dbus-monitor "interface=org.kde.KWin.VirtualDesktopManager" "member=currentChanged" | xargs -e -I {} kde6-workarounds.mjs desktops-last-save {}
|
1
.local/bin/ra-aid
Symbolic link
1
.local/bin/ra-aid
Symbolic link
@@ -0,0 +1 @@
|
||||
/home/jaandrle/.local/share/pipx/venvs/ra-aid/bin/ra-aid
|
131
.local/bin/§pandoc.mjs
Executable file
131
.local/bin/§pandoc.mjs
Executable file
@@ -0,0 +1,131 @@
|
||||
#!/usr/bin/env nodejsscript
|
||||
/* jshint esversion: 11,-W097, -W040, module: true, node: true, expr: true, undef: true *//* global echo, $, pipe, s, fetch, cyclicLoop */
|
||||
if(!s.which("pandoc")) throw new Error("pandoc not found. Use your package manager to install it (e.g. `sudo apt install pandoc`).");
|
||||
const pdftk= "§pdftk-data.mjs";
|
||||
if(!s.which(pdftk)) throw new Error(`${pdftk} user script not found.`);
|
||||
|
||||
$.api()
|
||||
.version("2025-09-04")
|
||||
.describe([
|
||||
"Small wrapper around `pandoc` mainly to convert markdown to pdf.",
|
||||
"The reason is to use modern CSS than rely on cli implementation to converting to pdf."
|
||||
])
|
||||
.option("--debug", "Debug mode")
|
||||
.option("--force", "Overwrite output file.")
|
||||
|
||||
.command("to-html <name-input> [name-output]", "Convert markdown to html.")
|
||||
.alias("tohtml")
|
||||
.action(function tohtmlCMD(input, output, options){
|
||||
tohtml(input, output, options);
|
||||
$.exit(0);
|
||||
})
|
||||
|
||||
.command("to-pdf <name-input> [name-output]", "Convert markdown to pdf.")
|
||||
.alias("topdf")
|
||||
.action(async function topdfCMD(input, output, options){
|
||||
const { force: isForced, debug: isDebug }= options;
|
||||
testInput(input);
|
||||
output= normalizeOutput(input, ".pdf", output, isForced);
|
||||
const tempFile= tempFileGenerator(input);
|
||||
|
||||
echo("1. step: convert to html");
|
||||
const output_html= tempFile(".html");
|
||||
const input_data= tohtml(input, output_html, options);
|
||||
|
||||
echo("2. step: convert to pdf");
|
||||
echo(" …use print to pdf in your browser");
|
||||
s.run`open ${output_html}`;
|
||||
await s.read({ "-p": "Press enter to continue" }).catch(()=> echo("Aborted"));
|
||||
if(!isDebug) s.rm(output_html);
|
||||
if(!s.test("-f", output))
|
||||
$.error("Output file not found");
|
||||
|
||||
echo("3. step: update pdf metadata");
|
||||
const output_data_file= tempFile(".json");
|
||||
echo(` ${pdftk} extract \${pdf}`);
|
||||
s.run`${pdftk} extract ${output} ${output_data_file}`;
|
||||
const output_data= s.cat(output_data_file).xargs(JSON.parse);
|
||||
const { Creator }= output_data.Info;
|
||||
input_data.Creator= [
|
||||
s.$().run`pandoc --version`.head({ "-n": 1 }).trim(),
|
||||
"&",
|
||||
Creator,
|
||||
].join(" ");
|
||||
Object.assign(output_data.Info, input_data);
|
||||
s.echo(JSON.stringify(output_data, null, "\t")).to(output_data_file);
|
||||
echo(` ${pdftk} update \${pdf}`);
|
||||
s.run`${pdftk} update ${output} ${output_data_file}`;
|
||||
if(!isDebug) s.rm(output_data_file);
|
||||
|
||||
$.exit(0);
|
||||
})
|
||||
.parse();
|
||||
|
||||
/**
|
||||
* @param {string} input
|
||||
* @param {string} [output]
|
||||
* @param {object} options
|
||||
* @returns {Record<string, string>}
|
||||
* */
|
||||
function tohtml(
|
||||
input, output,
|
||||
{ force: isForced, debug: isDebug }
|
||||
){
|
||||
testInput(input);
|
||||
output= normalizeOutput(input, ".html", output, isForced);
|
||||
const tempFile= tempFileGenerator(input);
|
||||
|
||||
const { input_tmp, input_data }= prepareInput(input, tempFile);
|
||||
echo(" pandoc ${markdown} --standalone -o ${html}");
|
||||
s.run`pandoc ${input_tmp} --standalone -o ${output}`;
|
||||
if(!isDebug) s.rm(input_tmp);
|
||||
return input_data;
|
||||
}
|
||||
/** @param {string} orig */
|
||||
function tempFileGenerator(orig){
|
||||
const basepath= orig.includes("/") ? orig.slice(0, orig.lastIndexOf("/")+1) : "";
|
||||
const basename= orig.slice(basepath.length, orig.lastIndexOf("."));
|
||||
return ext=> basepath+"."+basename+"-"+nameHash()+ext;
|
||||
}
|
||||
/**
|
||||
* @param {string} input
|
||||
* @param {(ext: string)=> string} tempFile
|
||||
* @returns {{ input_tmp: string, input_data: Record<string, string> }}
|
||||
* */
|
||||
function prepareInput(input, tempFile){
|
||||
const input_tmp= tempFile(".md");
|
||||
const content= s.cat(input).trim();
|
||||
let input_data= {};
|
||||
echo(" extract input metadata and eval `~` to $HOME (CSS)");
|
||||
if(content.startsWith("---"))
|
||||
for(const line_raw of content.split("\n").slice(1)){
|
||||
const line= line_raw.trim();
|
||||
if(!line) continue;
|
||||
if(line==="---") break;
|
||||
const [key_raw, value]= line.split(/: */);
|
||||
let key= key_raw.replace(/^-+/, "");
|
||||
key= key[0].toUpperCase()+key.slice(1);
|
||||
input_data[key]= value;
|
||||
}
|
||||
s.echo(content.replaceAll("file:///~", "file:///"+process.env.HOME)).to(input_tmp);
|
||||
return { input_tmp, input_data };
|
||||
}
|
||||
/**
|
||||
* @param {string} input Input file
|
||||
* @param {string} ext Output file extension
|
||||
* @param {string} [output] Output file
|
||||
* @param {boolean} [isForced] Overwrite output file
|
||||
* @returns {string}
|
||||
* @throws {Error} When output file already exists (unless `--force`)
|
||||
* */
|
||||
function normalizeOutput(input, ext, output, isForced){
|
||||
if(!output) output= input.slice(0, input.lastIndexOf("."))+ext;
|
||||
if(s.test("-f", output)) {
|
||||
if(!isForced) $.error("Output file already exists, choose another name or `--force`");
|
||||
s.rm(output);
|
||||
}
|
||||
return output;
|
||||
}
|
||||
/** @param {string} input @throws {Error} If input file not found */
|
||||
function testInput(input){ if(!s.test("-f", input)) $.error("Input file not found"); }
|
||||
function nameHash(){ return Math.random().toString(36).slice(2); }
|
@@ -12,14 +12,11 @@ $.api()
|
||||
])
|
||||
.option("--debug", "Debug mode")
|
||||
.command("extract <file_pdf> [file_info]", "Extract data from PDF.")
|
||||
.action(function extract(file_pdf, file_info, { debug }){
|
||||
.action(function extractCMD(file_pdf, file_info, { debug }){
|
||||
if(!s.test("-f", file_pdf)) $.error("PDF File not found");
|
||||
if(!file_info) file_info= filename(file_pdf) + ".json";
|
||||
|
||||
const temp= `${tmp}${tmpname(file_pdf)}.info` ;
|
||||
s.run`pdftk ${file_pdf} dump_data_utf8 output ${temp}`;
|
||||
const info= infoToJSON(temp);
|
||||
if(!debug) s.rm(temp);
|
||||
const info= extract(file_pdf);
|
||||
s.echo(info).to(file_info);
|
||||
$.exit(0);
|
||||
})
|
||||
@@ -28,8 +25,10 @@ $.api()
|
||||
if(!s.test("-f", file_pdf)) $.error("PDF File not found");
|
||||
if(!file_info) file_info= filename(file_pdf) + ".json";
|
||||
if(!s.test("-f", file_info)) $.error("Info File not found");
|
||||
|
||||
const infoIsHtml= file_info.endsWith(".html");
|
||||
|
||||
const info= infoFromJSON(file_info);
|
||||
const info= infoIsHtml ? infoFromHTML(file_info, file_pdf, debug) : infoFromJSON(file_info);
|
||||
const temp= `${tmp}${tmpname(file_pdf)}.info`;
|
||||
s.echo(info).to(temp);
|
||||
const tmp_pdf= `${tmp}${tmpname(file_pdf)}.pdf`;
|
||||
@@ -51,13 +50,52 @@ $.api()
|
||||
})
|
||||
.parse();
|
||||
|
||||
function extract(file_pdf, debug){
|
||||
const temp= `${tmp}${tmpname(file_pdf)}.info` ;
|
||||
s.run`pdftk ${file_pdf} dump_data_utf8 output ${temp}`;
|
||||
const out= infoToJSON(temp);
|
||||
if(!debug) s.rm(temp);
|
||||
return out;
|
||||
}
|
||||
function filename(path){ return path.slice(path.lastIndexOf("/")+1, path.lastIndexOf(".")); }
|
||||
function tmpname(path){ return filename(path) + "-" + Date.now(); }
|
||||
function infoFromHTML(file_info, file_pdf, debug){
|
||||
const info_orig= JSON.parse(extract(file_pdf, debug));
|
||||
const info= s.cat(file_info).trim();
|
||||
let isInside= false;
|
||||
for(const line_raw of info.split("\n")){
|
||||
const line= line_raw.trim();
|
||||
if(line.startsWith("<head")){
|
||||
isInside= true;
|
||||
continue;
|
||||
}
|
||||
if(!line || !isInside) continue;
|
||||
if(line.startsWith("<title>")){
|
||||
const title= line.slice(7).replace("</title>", "").trim();
|
||||
info_orig.Info.Title= title;
|
||||
continue;
|
||||
}
|
||||
if(line.startsWith("<meta") && line.includes("name=")){
|
||||
const [,, key]= line.match(/name=("|')(.*?)(\1)/);
|
||||
const [,, value]= line.match(/content=("|')(.*?)(\1)/);
|
||||
info_orig.Info[key[0].toUpperCase()+key.slice(1)]= value;
|
||||
}
|
||||
if(line.startsWith("</head>")){
|
||||
break;
|
||||
}
|
||||
}
|
||||
const tmp_json= `${tmp}${tmpname(file_pdf)}.json`;
|
||||
s.echo(JSON.stringify(info_orig, null, "\t")).to(tmp_json);
|
||||
const out= infoFromJSON(tmp_json);
|
||||
if(!debug) s.rm(tmp_json);
|
||||
return out;
|
||||
}
|
||||
function infoFromJSON(file_info){
|
||||
const info= s.cat(file_info).xargs(JSON.parse);
|
||||
const output= [];
|
||||
info.Bookmark= Object.entries(info.Bookmark)
|
||||
.map(/** @param {[string, string]} _ */([PageNumber, Title])=> {
|
||||
PageNumber= Number.parseInt(PageNumber);
|
||||
const level= Title.search(/[^ ]/);
|
||||
return {
|
||||
PageNumber,
|
||||
@@ -134,7 +172,7 @@ function infoToJSON(file_info){
|
||||
output.set(key, value);
|
||||
}
|
||||
output.set("Bookmark", pipe(
|
||||
items=> items.map(({ PageNumber, Title, Level })=> ([PageNumber, " ".repeat(Number(Level)-1) + Title])),
|
||||
items=> items.map(({ PageNumber, Title, Level }, i)=> ([PageNumber+"-"+i, " ".repeat(Number(Level)-1) + Title])),
|
||||
Object.fromEntries,
|
||||
)(output.get("Bookmark") || []));
|
||||
return pipe(
|
2
.local/bin/§§centrum_mail
Executable file
2
.local/bin/§§centrum_mail
Executable file
@@ -0,0 +1,2 @@
|
||||
#!/bin/bash
|
||||
kioclient5 exec https://mail.centrum.cz/?fld=-666
|
@@ -1,10 +1,8 @@
|
||||
# Vim
|
||||
My cross-platform config file. Now primarly **Ubuntu**, in the past also Windows (I don't use them so much now → not tested!).
|
||||
|
||||
To navigate my secondary editor use [../vscode](../vscode).
|
||||
|
||||
## Related files
|
||||
- [../.vimrc](../.vimrc)
|
||||
- [./.vimrc](./.vimrc)
|
||||
- [../.config/coc/ultisnips](../.config/coc/ultisnips)
|
||||
- [./\*](./)
|
||||
|
||||
|
321
.vim/vimrc
Normal file
321
.vim/vimrc
Normal file
@@ -0,0 +1,321 @@
|
||||
""" VIM config file | Jan Andrle | 2025-08-28 (VIM >=9.1 AppImage)
|
||||
"" #region B – Base
|
||||
scriptencoding utf-8 | set encoding=utf-8
|
||||
set pythonthreedll=/lib/x86_64-linux-gnu/libpython3.12.so.1.0
|
||||
let $BASH_ENV = "~/.bashrc"
|
||||
set runtimepath^=~/.vim/bundle/*
|
||||
packadd! matchit
|
||||
packadd! cfilter
|
||||
let g:ft_man_folding_enable = 1
|
||||
runtime! ftplugin/man.vim
|
||||
" set hidden
|
||||
|
||||
source ~/.vim/rc-cat.vim
|
||||
|
||||
cabbrev <expr> %PWD% execute('pwd')
|
||||
cabbrev <expr> %CD% fnameescape(expand('%:p:h'))
|
||||
cabbrev <expr> %CS% mini_enhancement#selectedText()
|
||||
cabbrev <expr> %CW% echo '<c-r><c-w>'
|
||||
|
||||
let mapleader = "\\"
|
||||
" better for my keyboard, but maybe use `:help keymap`?
|
||||
nnoremap § @
|
||||
nnoremap §§ @@
|
||||
nnoremap ů ;
|
||||
nnoremap ; :
|
||||
nnoremap <leader>u U
|
||||
nnoremap U <c-r>
|
||||
nnoremap ž <c-]>
|
||||
nnoremap <c-up> <c-y>
|
||||
nnoremap <c-down> <c-e>
|
||||
" <c-bs>
|
||||
imap <c-w>
|
||||
cmap <c-w>
|
||||
|
||||
set diffopt+=algorithm:patience,indent-heuristic,inline:word
|
||||
augroup vimrc_help
|
||||
autocmd!
|
||||
autocmd BufEnter *.txt if &buftype == 'help' | wincmd L | vertical resize 90 | endif
|
||||
augroup END
|
||||
|
||||
""" #region BB – Build-in plugins
|
||||
" https://github.com/rbtnn/vim-gloaded/blob/master/plugin/gloaded.vim
|
||||
let g:loaded_vimballPlugin = 1 " :h pi_vimball … for plugin creators
|
||||
let g:vifm_replace_netrw= 1 | let g:loaded_netrw= 1 | let g:loaded_netrwPlugin= 1 " this line needs to be commented to let vim dowmload spelllangs!!! … see http://jdem.cz/fgyw25
|
||||
""" #endregion BB
|
||||
"" #endregion B
|
||||
"" #region H – Helpers
|
||||
command! -nargs=0
|
||||
\ ALTredrawSyntax edit | exec 'normal `"' | exec 'set ft='.&ft
|
||||
|
||||
let g:quickfix_len= 0
|
||||
function! QuickFixStatus() abort
|
||||
hi! link User1 StatusLine
|
||||
if !g:quickfix_len | return 'Ø' | endif
|
||||
if g:quickfix_len>0 | return g:quickfix_len | endif
|
||||
let type= &termguicolors ? 'gui' : 'cterm'
|
||||
execute 'hi! User1 '.type.'bg='.synIDattr(synIDtrans(hlID('StatusLine')), 'bg').
|
||||
\' '.type.'fg='.synIDattr(synIDtrans(hlID('WarningMsg')), 'fg')
|
||||
return -g:quickfix_len
|
||||
endfunction
|
||||
function! s:QuickFixCmdPost() abort
|
||||
let q_len= len(getqflist())
|
||||
let g:quickfix_len= q_len ? -q_len : len(getloclist(0))
|
||||
endfunction
|
||||
augroup quickfix
|
||||
autocmd!
|
||||
autocmd QuickFixCmdPost * call <sid>QuickFixCmdPost()
|
||||
augroup END
|
||||
"" #endregion H
|
||||
"" #region SLH – Status Line + Command Line + History (general) + Sessions + File Update, …
|
||||
set showcmd cmdheight=2 cmdwinheight=9 showmode
|
||||
set wildmenu wildoptions=pum,fuzzy wildmode=longest,full
|
||||
|
||||
cabbrev wbw w<bar>bw
|
||||
|
||||
set sessionoptions-=options
|
||||
|
||||
function! NumberOfBuffers()
|
||||
return len(filter(range(1, bufnr('$')), 'buflisted(v:val)'))
|
||||
endfunction
|
||||
set laststatus=2 " Show status line on startup
|
||||
set statusline+=··≡·%{QuickFixStatus()}%*··»·%{user_tips#current()}%*··%=
|
||||
set statusline+=(%{NumberOfBuffers()})··%<%f%R\%M··▶·%{&fileformat}·%{&fileencoding?&fileencoding:&encoding}·%{&filetype}
|
||||
set statusline+=··
|
||||
" set statusline+=··∷·%{mini_sessions#name('–')}··
|
||||
|
||||
set history=500 " How many lines of (cmd) history has to remember
|
||||
set nobackup nowritebackup noswapfile " …there is issue #649 (for servers) and I’m using git/system backups
|
||||
try
|
||||
set undodir=~/.vim/undodir undofile | catch | endtry
|
||||
command HELPundoClear echo 'undolevel='.&undolevels
|
||||
"" #endregion SLH
|
||||
"" #region LLW – Left Column + Line + Wrap + Scrolling
|
||||
set signcolumn=yes
|
||||
set cursorline cursorcolumn " Always show current position
|
||||
set number foldcolumn=2 " enable line numbers and add a bit extra margin to the left
|
||||
set textwidth=120 colorcolumn=81,+1
|
||||
command HELPtextwidth echo "textwidth=".&textwidth." colorcolumn=".&colorcolumn
|
||||
set nowrap " Don't wrap long lines by default
|
||||
set breakindent breakindentopt=shift:2 showbreak=↳
|
||||
set scrolloff=5 sidescrolloff=10 " offset for lines/columns when scrolling
|
||||
"" #endregion LLW
|
||||
"" #region CN – Clipboard + Navigation throught Buffers + Windows + … (CtrlP)
|
||||
set pastetoggle=<F2> | nnoremap <F2> :set invpaste paste?<CR>
|
||||
function! JaaCopyRegister()
|
||||
echo "Copy content of the register: "
|
||||
let sourceReg = nr2char(getchar())
|
||||
if sourceReg !~# '\v^[a-z0-9"*+]'
|
||||
echon sourceReg." – invalid register"
|
||||
return
|
||||
endif
|
||||
echon sourceReg."\ninto the register: "
|
||||
let destinationReg = nr2char(getchar())
|
||||
if destinationReg !~# '\v^[a-z0-9"*+]'
|
||||
echon destinationReg." – invalid register"
|
||||
return
|
||||
endif
|
||||
call setreg(destinationReg, getreg(sourceReg, 1))
|
||||
echon destinationReg
|
||||
endfunction
|
||||
nnoremap <silent> <leader>" :call JaaCopyRegister()<cr>
|
||||
|
||||
" CtrlP previously
|
||||
nmap <expr> š buffer_number("#")==-1 ? ":CocList --normal buffers\<cr>" : "\<c-^>"
|
||||
nmap ě :CocList
|
||||
nmap <leader>3 :buffers<cr>:b<space>
|
||||
nmap <leader>š :CocList buffers<cr> | :syntax on<cr>
|
||||
nmap č <leader>š
|
||||
"" #endregion CN
|
||||
"" #region FOS – File(s) + Openning + Saving
|
||||
set autowrite autoread | autocmd FocusGained,BufEnter *.* checktime
|
||||
set modeline
|
||||
command HELPmodeline
|
||||
\ echo "tabstop=".&tabstop." shiftwidth=".&shiftwidth." textwidth=".&textwidth." expandtab=".&expandtab
|
||||
set path+=src/**,app/**,build/** " File matching for `:find`
|
||||
for ignore in [ '.git', '.npm', 'node_modules' ]
|
||||
exec ':set wildignore+=**'.ignore.'**'
|
||||
exec ':set wildignore+=**/'.ignore.'/**'
|
||||
endfor
|
||||
set wildignore+=*.bmp,*.gif,*.ico,*.jpg,*.png,*.ico
|
||||
set wildignore+=*.pdf,*.psd
|
||||
|
||||
nmap <leader>e :Vifm<cr>
|
||||
nnoremap gx :silent exec "!xdg-open '".shellescape(substitute(expand('<cfile>'), '?', '\\?', ''), 1)."'" \| redraw!<cr>
|
||||
vnoremap gx :silent exec "!xdg-open '".shellescape(substitute(mini_enhancement#selectedText(), '?', '\\?', ''), 1)."'" \| redraw!<cr>
|
||||
"" #endregion FOS
|
||||
"" #region EN – Editor navigation + search
|
||||
set grepprg=LC_ALL=C\ grep\ -HRIns
|
||||
set hlsearch incsearch " highlight search, start when typing
|
||||
if maparg('<C-L>', 'n') ==# ''
|
||||
nnoremap <silent> <c-l> :nohlsearch<c-r>=has('diff')?'<bar>diffupdate':''<cr><cr><c-l> | endif " TODO? <bar>syntax sync fromstart
|
||||
|
||||
let g:markbar_persist_mark_names = v:false
|
||||
let g:markbar_cache_with_hidden_buffers = v:false " last buffers are reopened as hidden https://github.com/Yilin-Yang/vim-markbar/blob/9f5a948d44652074bf2b90d3da6a400d8a369ba5/doc/vim-markbar.txt#L136
|
||||
nmap <Leader>m <Plug>ToggleMarkbar
|
||||
"" #endregion EN
|
||||
"" #region EA – Editing adjustment + Syntax + White chars + Folds
|
||||
" use <c-v>§ for §
|
||||
inoremap § <esc>
|
||||
set nrformats-=octal
|
||||
|
||||
let g:htl_css_templates=1
|
||||
let g:markdown_fenced_languages= [ 'javascript', 'js=javascript', 'json', 'html', 'php', 'bash', 'vim', 'vimscript=javascript', 'sass', 'diff' ]
|
||||
augroup convenient
|
||||
autocmd!
|
||||
autocmd FileType markdown,json setlocal conceallevel=2
|
||||
autocmd FileType markdown,text setlocal keywordprg=dict
|
||||
autocmd FileType git,gitcommit setlocal foldmethod=syntax foldlevel=1
|
||||
augroup END
|
||||
" PARENTHESES plugin junegunn/rainbow_parentheses.vim
|
||||
let g:rainbow#pairs= [['(', ')'], ['[', ']'], [ '{', '}' ]]
|
||||
let g:rainbow#blacklist = [203,9]
|
||||
autocmd VimEnter * try
|
||||
\| call rainbow_parentheses#toggle() | catch | endtry
|
||||
" HIGHLIGHT&YANK plugins (buildin) hlyank & cwordhi.vim
|
||||
packadd hlyank
|
||||
let g:hlyank_duration= 250
|
||||
let g:cwordhi#autoload= 1
|
||||
set showmatch " Quick highlight oppening bracket/… for currently writted
|
||||
set timeoutlen=1000 ttimeoutlen=0 " Remove timeout when hitting escape TAB
|
||||
set formatoptions+=j " Delete comment character when joining commented lines
|
||||
set smarttab
|
||||
command! -nargs=1 SETtab let &shiftwidth=<q-args> | let &tabstop=<q-args> | let &softtabstop=<q-args>
|
||||
SETtab 4
|
||||
set backspace=indent,eol,start " Allow cursor keys in insert mode: http://vi.stackexchange.com/a/2163
|
||||
set shiftround autoindent " round diff shifts to the base of n*shiftwidth, https://stackoverflow.com/a/18415867
|
||||
filetype plugin indent on
|
||||
" SYNTAX&COLORS
|
||||
if ($TERM =~ '256' && has("termguicolors"))
|
||||
set termguicolors | endif
|
||||
if (&t_Co > 2 || has("gui_running")) && !exists("syntax_on")
|
||||
syntax enable | endif
|
||||
set list listchars=tab:»·,trail:·,extends:#,nbsp:~,space:· " Highlight spec. chars / Display extra whitespace
|
||||
set redrawtime=10000
|
||||
" augroup syntax_sync_min_lines
|
||||
" autocmd!
|
||||
" autocmd BufEnter * syntax sync fromstart "TODO DEL syn sync minlines=2000
|
||||
" augroup END
|
||||
let g:vim_vue_plugin_config = { 'foldexpr': 1, 'attribute': 1, 'keyword': 1 }
|
||||
" SPELL
|
||||
if !has("gui_running")
|
||||
hi clear SpellBad | hi SpellBad cterm=underline,italic | endif
|
||||
command HELPspell echo 'spelllang='.&spelllang.' spell='.&spell.' spellfile='.&spellfile
|
||||
" EDIT HEPERS
|
||||
nnoremap <leader>o o<space><bs><esc>
|
||||
nnoremap <leader>O O<space><bs><esc>
|
||||
nnoremap <s-k> a<cr><esc>
|
||||
for l in [ 'y', 'p', 'P', 'd' ] | for m in [ 'n', 'v' ]
|
||||
execute m.'map <leader>'.l.' "+'.l | endfor | endfor " no noremap ⇐ https://github.com/jasonccox/vim-wayland-clipboard?tab=readme-ov-file#non-recursive-mappings
|
||||
command HELPfold echo 'foldmethod='.&foldmethod.' foldlevel='.&foldlevel.' foldnestmax='.&foldnestmax
|
||||
set foldmarker=#region,#endregion
|
||||
" SAVE VIEW
|
||||
set viewoptions=cursor,folds
|
||||
augroup remember__view
|
||||
autocmd!
|
||||
autocmd BufWinLeave *.* if &buflisted | mkview | endif
|
||||
autocmd BufWinEnter *.* silent! loadview
|
||||
augroup END
|
||||
"" #endregion EA
|
||||
"" #region AI
|
||||
let g:codeium_disable_bindings = 1
|
||||
imap <script><silent><nowait><expr> <f3><f3> codeium#Accept()
|
||||
imap <script><silent><nowait><expr> <f3><w> codeium#AcceptNextWord()
|
||||
imap <script><silent><nowait><expr> <f3><j> codeium#AcceptLine()
|
||||
imap <f3>n <Cmd>call codeium#CycleCompletions(1)<CR>
|
||||
imap <f3>N <Cmd>call codeium#CycleCompletions(-1)<CR>
|
||||
imap <f3>d <Cmd>call codeium#Clear()<CR>
|
||||
imap <f3>! <Cmd>call codeium#Complete()<CR>
|
||||
"" #endregion AI
|
||||
"" #region COC – COC and so on, compilers, code/commands completions
|
||||
let g:coc_global_extensions= ['coc-css', 'coc-docthis', 'coc-emmet', 'coc-emoji', 'coc-git', 'coc-pretty-ts-errors', 'coc-eslint', 'coc-gitmoji', 'coc-html', 'coc-json', 'coc-lists', 'coc-marketplace', 'coc-phpls', 'coc-sh', 'coc-snippets', 'coc-styled-components', 'coc-svg', 'coc-tsserver']
|
||||
" https://github.com/antonk52/cssmodules-language-server
|
||||
call coc#config('languageserver.cssmodules', {
|
||||
\ "command": "cssmodules-language-server",
|
||||
\ "initializationOptions": {"camelCase": "dashes"},
|
||||
\ "filetypes": ["javascript", "javascriptreact", "typescript", "typescriptreact"],
|
||||
\ "requireRootPattern": 0,
|
||||
\ "settings": {}
|
||||
\ })
|
||||
autocmd FileType scss setl iskeyword+=@-@
|
||||
function! CustomKeyWord(word)
|
||||
if(a:word=="gulp_place")
|
||||
highlight link gulp_place ErrorMsg
|
||||
syntax match gulp_place "gulp_place"
|
||||
augroup gulp_place
|
||||
autocmd!
|
||||
autocmd BufEnter *.{js,html} syntax match gulp_place "gulp_place"
|
||||
augroup END
|
||||
return 0
|
||||
endif
|
||||
endfunction
|
||||
|
||||
set completeopt=menuone,longest,preview "longest vs ,noinsert,noselect
|
||||
inoremap <silent><expr> <F1> coc#pum#visible() ? coc#pum#confirm() : coc#refresh()
|
||||
set wildcharm=<f1>
|
||||
inoremap <silent><expr> <tab> coc#pum#visible() ? coc#pum#next(1) : <sid>check_back_space() ? "\<tab>" : coc#refresh()
|
||||
inoremap <silent><expr> <s-tab> coc#pum#visible() ? coc#pum#prev(1) : "\<c-h>"
|
||||
function! s:check_back_space() abort
|
||||
let col = col('.') - 1
|
||||
return !col || getline('.')[col - 1] =~# '\s'
|
||||
endfunction
|
||||
|
||||
nmap <silent><nowait> gd <Plug>(coc-definition)
|
||||
command! -nargs=* -complete=customlist,<sid>SCommandCocActionComplete CocAction call CocActionAsync(<f-args>)
|
||||
function s:SCommandCocActionComplete(argLead, cmdLine, cursorPos)
|
||||
return readfile(expand('~/.vim/pack/coc/start/coc.nvim/doc/tags'), 'r')
|
||||
\->filter('v:val =~ ''^CocAction''')
|
||||
\->map({ k, v -> strpart(v, 11, stridx(v, ')')-12) })
|
||||
\->filter({ k, v -> v =~ a:argLead && !v->empty() })
|
||||
endfunction
|
||||
" navigate diagnostics, use `:CocDiagnostics` to get all diagnostics of current buffer in location list.
|
||||
nnoremap <silent> gh :call <sid>show_documentation(expand("<cword>"))<cr>
|
||||
vnoremap <silent> gh :<c-u>call <sid>show_documentation(mini_enhancement#selectedText())<cr>
|
||||
nnoremap <leader>gf :CocList --interactive --normal --input='<c-r>=expand("<cword>")<cr>' files<cr>
|
||||
vnoremap <leader>gf :<c-u>CocList --interactive --normal --input='<c-r>=mini_enhancement#selectedText()<cr>' files<cr>
|
||||
""" #region COCP – Coc popups scroll (Remap <C-f> and <C-b> for scroll float windows/popups.)
|
||||
if has('nvim-0.4.0') || has('patch-8.2.0750')
|
||||
nnoremap <silent><nowait><expr> <C-f> coc#float#has_scroll() ? coc#float#scroll(1) : "\<C-f>"
|
||||
nnoremap <silent><nowait><expr> <C-b> coc#float#has_scroll() ? coc#float#scroll(0) : "\<C-b>"
|
||||
inoremap <silent><nowait><expr> <C-f> coc#float#has_scroll() ? "\<c-r>=coc#float#scroll(1)\<cr>" : "\<Right>"
|
||||
inoremap <silent><nowait><expr> <C-b> coc#float#has_scroll() ? "\<c-r>=coc#float#scroll(0)\<cr>" : "\<Left>"
|
||||
vnoremap <silent><nowait><expr> <C-f> coc#float#has_scroll() ? coc#float#scroll(1) : "\<C-f>"
|
||||
vnoremap <silent><nowait><expr> <C-b> coc#float#has_scroll() ? coc#float#scroll(0) : "\<C-b>"
|
||||
endif
|
||||
""" #endregion COCP
|
||||
|
||||
command! -nargs=? CLhelpMy if <q-args>!='' | exec 'map '.<q-args> | else | call popup_notification([
|
||||
\ 'Custom mappings starting: '.mapleader.',§, ů, ;, U, ž',
|
||||
\ 'Custom commands starting: CL, SET, ALT, Vifm, Coc',
|
||||
\ 'Helpful commands: CocAction, CocCommand, CocList',
|
||||
\], #{ line: &lines-3, pos: 'botleft', moved: 'any', close: 'button', time: 6000 }) | endif
|
||||
nnoremap <c-g> :CLwhereami<cr>
|
||||
command! CLwhereami :call popup_notification([
|
||||
\expand('%:t').( coc#status() != "" ? '/'.CocAction("getCurrentFunctionSymbol")."\t…\t".coc#status() : '' ),
|
||||
\"– – –",
|
||||
\"Line:\t".line('.').' / '.line('$'),
|
||||
\"Column:\t".col('.').' / '.col('$'),
|
||||
\"Path:\t".expand('%:p:h')
|
||||
\], #{ line: &lines-3, pos: 'botleft', moved: 'any', close: 'button', time: 6000 })
|
||||
command! CLhelpCocPlug call feedkeys(':<c-u>help <Plug>(coc ', 'tn')
|
||||
command! CLhelpCocAction call feedkeys(':<c-u>help CocAction('' ', 'tn')
|
||||
command! CLrepeatLastChange call feedkeys('/\V<C-r>"<CR>cgn<C-a><Esc>', 'tn')
|
||||
|
||||
command! -nargs=?
|
||||
\ CLcheat call cheat_copilot#open(<q-args>==''?&filetype:<q-args>)
|
||||
|
||||
function! s:show_documentation(word)
|
||||
if (!CocAction('hasProvider', 'hover'))
|
||||
if &filetype=='man' | call dist#man#PreGetPage(0) | return 0 | endif
|
||||
return feedkeys('K', 'in')
|
||||
endif
|
||||
if &filetype=='html' && coc#source#custom_elements#hover(a:word)!=0
|
||||
return 0
|
||||
endif
|
||||
|
||||
return CocActionAsync('doHover')
|
||||
endfunction
|
||||
"" #endregion COC
|
||||
|
||||
" vim: set textwidth=250 :
|
||||
" vim>60: set foldmethod=marker foldmarker=#region,#endregion :
|
@@ -21,7 +21,7 @@ see for example [How to Store Dotfiles - A Bare Git Repository \| Atlassian Git
|
||||
- [git](./.config/git/config), [gh](./.config/gh/config.yml)
|
||||
- [KDE Neon](#kde-neon)
|
||||
- [Mozilla Firefox](./.mozilla/firefox/README.md)
|
||||
- [Bin – scripts and executables](./bin/README.md)
|
||||
- [Bin – scripts and executables](./.local/bin/README.md)
|
||||
|
||||
## On a new machine
|
||||
1. install git
|
||||
|
Reference in New Issue
Block a user