Warning: this is an htmlized version!
The original is here, and the conversion rules are here. |
####### # # E-scripts on vi, its descendants, and vi emulation in Emacs. # # Note 1: use the eev command (defined in eev.el) and the # ee alias (in my .zshrc) to execute parts of this file. # Executing this file as a whole makes no sense. # An introduction to eev can be found here: # # (find-eev-quick-intro) # http://angg.twu.net/eev-intros/find-eev-quick-intro.html # # Note 2: be VERY careful and make sure you understand what # you're doing. # # Note 3: If you use a shell other than zsh things like |& # and the for loops may not work. # # Note 4: I always run as root. # # Note 5: some parts are too old and don't work anymore. Some # never worked. # # Note 6: the definitions for the find-xxxfile commands are on my # .emacs. # # Note 7: if you see a strange command check my .zshrc -- it may # be defined there as a function or an alias. # # Note 8: the sections without dates are always older than the # sections with dates. # # This file is at <http://angg.twu.net/e/vi.e> # or at <http://angg.twu.net/e/vi.e.html>. # See also <http://angg.twu.net/emacs.html>, # <http://angg.twu.net/.emacs[.html]>, # <http://angg.twu.net/.zshrc[.html]>, # <http://angg.twu.net/escripts.html>, # and <http://angg.twu.net/>. # ####### # «.vim» (to "vim") # «.viper» (to "viper") # «.viblock_1» (to "viblock_1") # «.viblock_2» (to "viblock_2") # «.vim-emacs-bridge» (to "vim-emacs-bridge") # «.f9» (to "f9") # «.f9-setup» (to "f9-setup") # «.f9-test» (to "f9-test") # «.f9-test2» (to "f9-test2") # «.f9-test3» (to "f9-test3") # «.f9-def-in-vim» (to "f9-def-in-vim") # «.vis» (to "vis") ##### # # vim # 2019sep18 # ##### # «vim» (to ".vim") # (find-status "vim") # (find-vldifile "vim.list") # (find-udfile "vim/") # (find-status "vim-runtime") # (find-vldifile "vim-runtime.list") # (find-udfile "vim-runtime/") # (find-status "vim-doc") # (find-vldifile "vim-doc.list") # (find-udfile "vim-doc/") # (find-fline "/usr/share/vim/vim80/") # (find-fline "/usr/share/vim/vim80/tutor/tutor") vimtutor ##### # # viper # 2001aug06 # ##### # «viper» (to ".viper") # (code-c-d "viper" "/usr/share/emacs/20.7/lisp/emulation/" "viper-e20") # (find-vipernode "Commands") # (find-vipernode "Groundwork") # (find-vipernode "Move Commands") # (find-vipernode "Appending Text") # (find-vipernode "Editing in Insert State") # (find-vipernode "Deleting Text") # (find-vipernode "Changing Text") # (find-vipernode "Search and Replace") # (find-vipernode "Yanking") # (find-vipernode "Undoing") # (find-vipernode "Display") # (find-vipernode "File and Buffer Handling") # (find-vipernode "Shell Commands") # (find-vipernode "Options") # (find-vipernode "Emacs Related Commands") # (find-vipernode "Rudimentary Changes" "`viper-vi-style-in-minibuffer t'") # (find-vipernode "Viper Specials" "`M-x viper-go-away'") # (find-vipernode "Vi Macros") # (find-vipernode "Mapping") # (find-vipernode "Groundwork" "textmarkers") # (find-vipernode "Marking") # (find-vipernode "Shell Commands") ##### # # saving a block in vi, version 1 (thxs to \Igor\ from #debian) # 2001sep09 # ##### # «viblock_1» (to ".viblock_1") #* cd /tmp/ cat > 1 <<'---' one two three four five --- cat > $EEG <<'---' Tcl: set tcl_prefix "" proc kstr {str} { append_action [list sendstr $str] } k down right m a k down down kstr { :'a,.w!2} ks ret kstr { :q!} k ret --- eeg3 vi 1 cat 2 #* ##### # # saving a block in vi, version 2 (thxs to \Igor\ from #debian) # 2001sep09 # ##### # «viblock_2» (to ".viblock_2") #* cd /tmp/ cat > 1 <<'---' one two three four five --- echo bla bla > 2 cat > $EEG <<'---' Tcl: set tcl_prefix "" proc kstr {str} { append_action [list sendstr $str] } proc kcmd {str} { kstr $str; k ret } k down right m a k down down kcmd ":'a,.y t" kcmd ":w" kcmd ":e 2" kcmd {:1,$d} kstr {"tP} kcmd ":w" kcmd ":q!" --- eeg3 vi 1 cat 2 #* # (find-fline "~/EXPECT/eeg3") :`a,.y t :w :e <new file> "tP :w CTRL-O <\Igor\> edrx: i should annotate that, | separates different commands and : means it's an ex command <\Igor\> edrx, :`a,.y t|:w|:e <new file>|"tP|:w|CTRL-O ##### # # vim script # 2004jul24 # ##### # (find-status "vim") # (find-vldifile "vim.list") # (find-fline "/usr/doc/vim/") # (find-fline "/usr/share/doc/vim/macros/maze/") # (find-fline "/usr/share/vim/vim61/tutor/") # (find-eetcfile "viperCard.tex") #* cd /tmp/ cp -v /usr/share/emacs/20.7/etc/viperCard.tex . tex viperCard.tex #* xdvi /tmp/viperCard.dvi & #* # (find-viperfile "") # (find-viperfile "viper-keym.el") <edrx> xp: I friend who's a vi'er once tried to teach me how to mark regions in vim, but my notes about that look like line noise to me now :( <sachac> edrx: V, then use arrow keys. Works in vim. ##### # # a vim<->emacs bridge (joint work with Thomas Adam) # 2007apr01 # ##### # «vim-emacs-bridge» (to ".vim-emacs-bridge") # http://starshine.org/xteddy/thomas/ # (find-fline "~/LOGS/2007apr01.eev") # (find-status "vim") # (find-vldifile "vim.list") # (find-udfile "vim/") # (find-status "vim-tcl") # (find-vldifile "vim-tcl.list") # (find-udfile "vim-tcl/") # (find-udfile "vim-tcl/FAQ.gz") * (eechannel-xterm "A") vim --servername FOO ia * (eechannel-xterm "B") vim --servername FOO --remote-expr 1+2 * (eechannel-xterm "A") :q! --remote-expr :2+1 <thomas_adam> Ah, OK. Like vim --remote-expr then. <edrx> the middle line should be "3" <thomas_adam> Hehe. <edrx> hm, how does --remote-expr work? <thomas_adam> [n6tadam@workstation ~]% vim --servername GVIM --remote-expr 1+2 <thomas_adam> 3 <thomas_adam> So you tell it to connect to an already running client, tell it something, and see the results. I don't know how it works internally. <edrx> ok <edrx> how do you start a vim telling it to answer requests to the vim server FOO? <thomas_adam> You'd have to ensure that the named session had started first. <thomas_adam> gvim --servername FOO <edrx> ok <thomas_adam> gvim --servername FOO --remote-expr :2+1 <thomas_adam> Ehem, s/:// <edrx> I'm trying... <edrx> if you have good pointers to sections of the vim docs I'll be ##### # # f9 # 2021may15 # ##### # «f9» (to ".f9") # (find-fline "~/eev-current/" "eegchannel") # (find-fline "~/eev-current/eegchannel") # (find-channels-intro) # (find-channels-intro "2.2. Test eegchannel") # (find-fline "/tmp/" "f9") # (find-fline "/tmp/f9.eegchannel") # (find-fline "/tmp/f9.sh") # (find-es "bash" "test") # «f9-setup» (to ".f9-setup") * (eepitch-shell) * (eepitch-kill) * (eepitch-shell) rm -fv /tmp/f9.eegchannel wget -O /tmp/f9.eegchannel http://angg.twu.net/eev-current/eegchannel chmod 755 /tmp/f9.eegchannel cat > /tmp/f9.sh <<'%%%' #!/bin/sh if [ "$1" = "start" ]; then shift 1 echo Starting: $* export EEVTMPDIR=/tmp /tmp/f9.eegchannel f9 $* elif [ "$1" = "cleanup" ]; then echo Cleaning up... rm -fv /tmp/eeg.f9.pid rm -fv /tmp/eeg.f9.str else cp /tmp/f9.line /tmp/eeg.f9.str kill -USR1 $(cat /tmp/eeg.f9.pid) fi %%% chmod 755 /tmp/f9.sh # «f9-test» (to ".f9-test") * (find-3EE '(eepitch-shell) '(eepitch-shell2)) * (find-3ee '(eepitch-shell) '(eepitch-shell2)) * (eepitch-shell) * (eepitch-shell2) /tmp/f9.sh cleanup /tmp/f9.sh start python3 * (eepitch-shell) echo 'print(1+2)' > /tmp/f9.line /tmp/f9.sh echo 'exit()' > /tmp/f9.line /tmp/f9.sh # «f9-test2» (to ".f9-test2") * (toggle-frame-fullscreen) * (size 208 28) * * (find-3EE '(eepitch-shell) '(eepitch-shell2)) * (find-3ee '(eepitch-shell) '(eepitch-shell2)) * (eepitch-shell) * (eepitch-shell2) /tmp/f9.sh cleanup xterm -T xterm-f9 -e /tmp/f9.sh start python3 * (eepitch-shell) echo 'print(1+2)' > /tmp/f9.line /tmp/f9.sh echo 'exit()' > /tmp/f9.line /tmp/f9.sh * (toggle-frame-fullscreen) # «f9-test3» (to ".f9-test3") * (toggle-frame-fullscreen) * (size 208 28) * (eepitch-shell) * (eepitch-kill) * (eepitch-shell) /tmp/f9.sh cleanup xterm -T xterm-f9 -e /tmp/f9.sh start python3 & echo 'print(1+2)' > /tmp/f9.line /tmp/f9.sh echo 'exit()' > /tmp/f9.line /tmp/f9.sh * (toggle-frame-fullscreen) ##### # # Defining <f9> in vim - Igor's solution # 2021may15 # ##### # «f9-def-in-vim» (to ".f9-def-in-vim") # (find-eev "eev-channels.el" "eechannel") # (find-eev "eev-channels.el" "eechannel" "eechannel-this-line") # (find-channels-intro "4. The protocol, in diagrams") # Hey! # Would it be easy for you to make <f9> do this in vim? # 1) save the contents of the current line in /tmp/f9.line # 2) run /tmp/f9.sh (that will not produce any output) # 3) move down to the next line? # Solution by Igor Morgado, 2021may15 # https://vim.fandom.com/wiki/Mapping_keys_in_Vim_-_Tutorial_(Part_1) # https://stackoverflow.com/questions/3776117/what-is-the-difference-between-the-remap-noremap-nnoremap-and-vnoremap-mapping # (find-status "vim-doc") # (find-vldifile "vim-doc.list") # (find-udfile "vim-doc/") # file:///usr/share/doc/vim/html/map.html nnoremap <f9> V:'<,'>w! /tmp/f9.line <bar> :silent! execute "!/tmp/f9.sh" <bar> :redraw! <bar> normal j<cr> " Or: function Effnine() '<,'>w! /tmp/f9.line silent! execute "!sync" silent! execute "!/tmp/f9.sh" redraw! normal j endfunction nnoremap <f9> V:call Effnine()<cr> ##### # # vis # 2021may19 # ##### # «vis» (to ".vis") # https://github.com/martanne/vis # (find-status "vis") # (find-vldifile "vis.list") # (find-udfile "vis/") http://www.troubleshooters.com/lpm/200310/200310.htm executable lines Vim and a piano keyboard are similar in that both have a terrible user interface that makes you insanely powerful if you dedicate your life to it, so everyone is sort of stuck with its horrors. https://medium.com/swlh/8-vim-tricks-that-will-take-you-from-beginner-to-expert-817ff4870245 https://medium.com/free-code-camp/how-not-to-be-afraid-of-vim-anymore-ec0b7264b0ae https://invisible-island.net/ https://invisible-island.net/vile/vile.html https://github.com/ThomasDickey/vile-snapshots/blob/master/CHANGES http://vigor.sourceforge.net/ https://en.wikipedia.org/wiki/Vigor_(software) https://www.reddit.com/r/ProgrammerHumor/comments/1b7pcz/vigor_clippy_for_vim/ https://vimawesome.com/plugin/vim-clippy https://github.com/jpalardy/vim-slime https://www.murilopereira.com/the-values-of-emacs-the-neovim-revolution-and-the-vscode-gorilla/ * https://debxp.org/teclas-e-comandos-essenciais-do-vim/ https://www.reddit.com/r/emacs/comments/rcxoxk/is_the_bang_bang_available_on_emacs_like_on_vim/ https://news.ycombinator.com/item?id=29469345 Why, oh why, do those nutheads use vi? (2007) (viemu.com) https://evrone.com/bram-moolenaar-interview https://news.ycombinator.com/item?id=30684232 Vim Reference Guide (learnbyexample.github.io) https://stackoverflow.com/questions/7894330/preserve-last-editing-position-in-vim https://github.com/dalanicolai/dala-emacs-lisp#vim-helpel https://scripter.co/straight-and-curved-quotes-in-emacs-lisp/?utm_source=atom_feed https://news.ycombinator.com/item?id=34162312 Actually using Ed (2012) (sanctum.geek.nz) - ed's greatest utility is in scripts ;; <kissingcs> ;; https://mike.puddingtime.org/img/Joy04.pdf ;; https://mike.puddingtime.org/posts/2023-04-03-daily-notes-for-2023-04-03/#vimari-and-my-emacs-origin-story (code-pdf-page "kissingcs" "$S/https/mike.puddingtime.org/img/Joy04.pdf") (code-pdf-text "kissingcs" "$S/https/mike.puddingtime.org/img/Joy04.pdf" -86) ;; (find-kissingcspage) ;; (find-kissingcstext) ;; (find-kissingcspage (+ -86 99) "consider vi users troglodytes") ;; (find-kissingcstext (+ -86 99) "consider vi users troglodytes") https://home.octetfont.com/blog/review-editors.html https://pikuma.com/blog/origins-of-vim-text-editor # Local Variables: # coding: utf-8-unix # End: