Martin Tourneboeuf
November 17, 2020
Sistema, Configuración, Nota
Readline, Bash, Zsh
Vim y Git
Tmux, Fsf, Rg
1 presentation.md 2 script.md X1 ---2 title: Arsenal de shell3 author: Tinmarino4 description: Quien quiere la paz, prepara ... la paz!Los patrones de código se aplican desde la más humildelinea.5 date: Novermber 14, 20206 make: pandoc -s --webtex -t slidy presentation.md -opresentation.html7 slidy-url: ../res/slidy8 header-includes: |9 <link rel="stylesheet" type="text/css" href="../res/asciinema-player.css" />10 <script src="../res/asciinema-player.js"></script>11 <link rel="stylesheet" type="text/css" href="../res/main-style.css" />12 ---1314 ### Tabla de contenidos [22] ---------------------------36 ### Entrenarse [12] ------------------------------------48 ### Afilar [7] -----------------------------------------55 ### No precipitarse [7] --------------------------------62 ### Notar [7] ------------------------------------------69 ### Evernote [7] ---------------------------------------76 ### Vimwiki [24] ---------------------------------------100 ### No repetir [7] -------------------------------------107 ### Readline [9] ---------------------------------------116 ### Bash [123] -----------------------------------------239 ### Vim [168] ------------------------------------------407 ### Vim Plugin [12] ------------------------------------419 ### Vim Vimspector [10] --------------------------------429 ### Git [8] --------------------------------------------437 ### Ahorar tu cerebro [7] ------------------------------444 ### Hacerlo de tu forma [11] ---------------------------455 ### Simplificar [7] ------------------------------------462 ### Tmux [10] ------------------------------------------472 ### Fzf [9] --------------------------------------------481 ### Rg<sup style="font-size:50%;"><a href="#foo… [34] --515 ### Mas [33] -------------------------------------------548 ### Enlace [56] ----------------------------------------
alias mgr='su - almamgr'
alias op='su - almaop'
¡No dejes tu prompt[1] definirte, define tu prompt!
¿Qué debe contener un PS1[2]?
[1] Prompt: Indicador de commando
[2] PS1: Prompt String One
Definir sus propios commands en ~/.local/bin
noremap s :update!<CR>
¿De que sirve el “s” (por defecto)?
¿Lo tienes mapeado?
¿Usas el “s” por defecto?
¿Porque no lo tienes mapeado?
let mapleader = ','
let maplocalleader = ','
¿Quién usa otro (delatenlo)?
" Foldlevel <- z
map z1 :set foldlevel=0<CR><Esc>
" ...
map z9 :set foldlevel=8<CR><Esc>
" Tab <- g (like gt and gT builtin: "Goto Tab")
noremap g1 :1tabnext<CR><Esc>
" ...
noremap g9 :9tabnext<CR><Esc>
¿Tienes ejemplos de uso de las teclas con cifras?
" Define: Lazy loader
function! TimerPack(timer) abort
packadd ale
packadd vimwiki
" Youcompleteme: is verbose at init if no python
try
python3 '42'
" Deletes the vim intro screen
packadd youcompleteme
catch | endtry
endfunction
" Call it
if has('timers')
call timer_start(0, 'TimerPack')
else
call TimerPack(42)
endif
¿Cómo manejas tus plugins?
noremap <leader>n :silent packadd devicons <CR>:silent packadd nerdtree <CR>:call NERDTreeToogle()<CR>
noremap <leader>u :silent packadd undotree <CR>:UndotreeToggle<CR>
¿Qué plugin cargas justo a tiempo?
filetype plugin indent on | syntax on
set encoding=utf-8 | scriptencoding uft-8
set mouse=a
if has('persistent_undo')
set undodir=$HOME/.vim/undo
set undofile
endif
¿Te gustaría que este instalado en almamgr?
w ! sudo tee %
windo diffthis
¿Qué hace eso?
Grep in parallel .. and in Rust
~/Test/ripgrep-0.7.1-------------------------------------$ rg fast README.md # Args: regex files*75: faster than both. (N.B. It is not, strictly speaking, a "drop-in" replacement119:### Is it really faster than everything else?124:Summarizing, `ripgrep` is fast because:129: optimizations to make searching very fast.~/Test/ripgrep-0.7.1-------------------------------------$ rg 'fn write\\(' # Recursive by defaultsrc/printer.rs469: fn write(&mut self, buf: &[u8]) {termcolor/src/lib.rs227: fn write(&mut self, b: &[u8]) -> io::Result<usize> {250: fn write(&mut self, b: &[u8]) -> io::Result<usize> {~/Test/ripgrep-0.7.1-------------------------------------$ rg clap -g '*.toml' # Glob for filenameCargo.toml35:clap = "2.26"51:clap = "2.26"~/Test/ripgrep-0.7.1-------------------------------------$ rg clap -g '!*.toml' # Also negative globbuild.rs2:extern crate clap;9:use clap::Shell;src/app.rs3:use clap::{App, AppSettings, Arg, ArgSettings};39:/// Build a clap application parameterized by usage strings.
~/Test/ripgrep-0.7.1-------------------------------------$ rg fast README.md -r NEW # Replace match (--replace)75: NEWer than both. (N.B. It is not, strictly speaking, a "drop-in" replacement88: color and full Unicode support. Unlike GNU grep, `ripgrep` stays NEW while119:### Is it really NEWer than everything else?124:Summarizing, `ripgrep` is NEW because:129: optimizations to make searching very NEW.~/Test/ripgrep-0.7.1-------------------------------------$ rg 'fast\s+(\w+)' README.md -r 'NEW-$1-'> `# Replace submatch` \> `# rg will never modify your files, but sed can:` \> `# rg 'fast\s+(\w+)' -l | xargs sed -i -E 's/fast\s+(\w+)/NEW-\1-/g'`> `# rg 'fast\s+(\w+)' -l | xargs sed -i -E 's/fast\s+(\w+)/NEW-\1-/g'`88: color and full Unicode support. Unlike GNU grep, `ripgrep` stays NEW-while-124:Summarizing, `ripgrep` is NEW-because-:~/Test/ripgrep-0.7.1-------------------------------------$ time find ~/wiki/ > /dev/null # Find time (no dot file)real 0m0.311suser 0m0.091ssys 0m0.218s~/Test/ripgrep-0.7.1-------------------------------------$ time rg --files ~/wiki/ > /dev/null # Rg timereal 0m0.170suser 0m0.926ssys 0m0.910s
[1] RG: RipGrep <= Rest In Peace “Global / Regular Expression / Print” (g/re/p)
Lista de lista: ➡️
RosetaCode: 📚
VimCast: 📺 Video tutorial
VimAwesome: 🔌 Lista de plugins
Vim: Wiki: 🤓 Hay paginas excelentes, otras pesimas
Vim plugins: NERDTree, Undotree, ALE, Fugitive, Fzf, Vimspector, Vimwiki
ProGit: 💪 El buen libro gratis
Git: Wiki: 📖
Para buscar configuraciones, dar vuelta en github
Tmux post (de Alexey Samoshin sobre portapapeles): 🇺🇦 Ver su Github tambien
Fzf: Introducción a la combinación difusa de cadenas de caracteres: 🏄♀️con referencia => buen lugar para empezar
Fzf: Source (de Junegunn): ⛲ pragatico, propaga un peso, leveinstein accelerado
man perlreref
: Refrencia rapida de “Perl Compatible Regular Expression”man ascii
: Tabla de “American Standard Code for Information Interchange”