Vim your Python Python your Vim

Similar documents
ASCII Code - The extended ASCII table

OOstaExcel.ir. J. Abbasi Syooki. HTML Number. Device Control 1 (oft. XON) Device Control 3 (oft. Negative Acknowledgement

CMSC 313 Lecture 03 Multiple-byte data big-endian vs little-endian sign extension Multiplication and division Floating point formats Character Codes

CMSC 313 COMPUTER ORGANIZATION & ASSEMBLY LANGUAGE PROGRAMMING LECTURE 02, FALL 2012

2a. Codes and number systems (continued) How to get the binary representation of an integer: special case of application of the inverse Horner scheme

EXPERIMENT 8: Introduction to Universal Serial Asynchronous Receive Transmit (USART)

CMSC 313 COMPUTER ORGANIZATION & ASSEMBLY LANGUAGE PROGRAMMING LECTURE 02, SPRING 2013

EXPERIMENT 7: Introduction to Universal Serial Asynchronous Receive Transmit (USART)

Chemistry Hour Exam 2

1.1. INTRODUCTION 1.2. NUMBER SYSTEMS

Number Systems II MA1S1. Tristan McLoughlin. November 30, 2013

CMSC 313 COMPUTER ORGANIZATION & ASSEMBLY LANGUAGE PROGRAMMING LECTURE 02, FALL 2012

FD-011WU. 2D Barcode Reader User Guide V1.6CC

DATA REPRESENTATION. Data Types. Complements. Fixed Point Representations. Floating Point Representations. Other Binary Codes. Error Detection Codes

Chapter 3. Information Representation

MK D Imager Barcode Scanner Configuration Guide

S-Series Sensor ASCII Protocol v8.1.0

Orientalistic cuneiform

1. Character/String Data, Expressions & Intrinsic Functions. Numeric Representation of Non-numeric Values. (CHARACTER Data Type), Part 1

J2 LCM Customer Display. Manual

font faq HOW TO INSTALL YOUR FONT HOW TO INSERT SWASHES, ALTERNATES, AND ORNAMENTS

Version /10/2015. Type specimen. Bw STRETCH

BUCKLEY. User s Guide

font faq HOW TO INSTALL YOUR FONT HOW TO INSERT SWASHES, ALTERNATES, AND ORNAMENTS

HoneyBee User s Guide

font faq HOW TO INSTALL YOUR FONT HOW TO INSERT SWASHES, ALTERNATES, AND ORNAMENTS

Data Representation and Binary Arithmetic. Lecture 2

Adorn. Serif. Smooth. v22622x

BD-6500BT Bluetooth 2D Barcode Scanner Configuration Guide

Characters Lesson Outline

Fundamentals of Programming (C)

PlainDSP M2M Communication Experimental Details This document describes the machine-to-machine (M2M) communication experiments using PlainDSP.

n NOPn Unary no operation trap U aaa NOP Nonunary no operation trap i

Do not start the test until instructed to do so!

Adorn. Slab Serif Smooth R E G U LAR. v22622x

DENIC Domain Guidelines

Bold U S E R S G U I D E

Do not start the test until instructed to do so!

2D BARCODE SCANNER CA-SC-20200B

Lecture (09) x86 programming 8

For information on how to access the swashes and alternates, visit LauraWorthingtonType.com/faqs

Adorn. Serif. Smooth. v22622x. user s guide PART OF THE ADORN POMANDER SMOOTH COLLECTION

User s Manual. Xi3000 Scanner. Table of Contents

Gandhari keyboard layout

Myriad Pro Light. Lining proportional. Latin capitals. Alphabetic. Oldstyle tabular. Oldstyle proportional. Superscript ⁰ ¹ ² ³ ⁴ ⁵ ⁶ ⁷ ⁸ ⁹,.

Number System (Different Ways To Say How Many) Fall 2016

Experiment 3. TITLE Optional: Write here the Title of your program.model SMALL This directive defines the memory model used in the program.

Mounting Dimensions / Viewing 2 Mounting Options 3. Wiring Configuration 4. Quick Set up Procedure 5. Changing Intensity 6.

Coding Theory. Networks and Embedded Software. Digital Circuits. by Wolfgang Neff

CS/ECE 252: INTRODUCTION TO COMPUTER ENGINEERING UNIVERSITY OF WISCONSIN MADISON

Data Representa5on. CSC 2400: Computer Systems. What kinds of data do we need to represent?

{c,} c 00E7 ç &ccedil LATIN SMALL LETTER C WITH CEDILLA {'e} e 00E8 è &egrave LATIN SMALL LETTER E WITH GRAVE {e'} e 00E9 é &eacute LATIN SMALL

Data Representa5on. CSC 2400: Computer Systems. What kinds of data do we need to represent?

Ultimate Cool Characters

CS/ECE 252: INTRODUCTION TO COMPUTER ENGINEERING UNIVERSITY OF WISCONSIN MADISON

Binary Numbers. The Basics. Base 10 Number. What is a Number? = Binary Number Example. Binary Number Example

Appendix C. Numeric and Character Entity Reference

Zeichen-Referenztabelle (1-127)

Contrast. user s guide

Serial I/O. 4: Serial I/O. CET360 Microprocessor Engineering. J. Sumey

Fundamentals of Programming

If your CNC machine memory is full, the PocketDNC gives you more storage, enabling you to store and reload proven programs at a later date.

Chapter 2 Bits, Data Types, and Operations

Chapter 2 Bits, Data Types, and Operations

Configuration Manual PULSAR C CCD SCANNER. Table of Contents

Connecting UniOP to Datalogic Barcode Readers

font faq HOW TO INSTALL YOUR FONT HOW TO INSERT SWASHES, ALTERNATES, AND ORNAMENTS

AutoLISP Module 6 Competency Test No.1

Do not start the test until instructed to do so!

USB-ASC232. ASCII RS-232 Controlled USB Keyboard and Mouse Cable. User Manual

The following are the data types used in the C programming language:

Unit 3, Lesson 2 Data Types, Arithmetic,Variables, Input, Constants, & Library Functions. Mr. Dave Clausen La Cañada High School

Xi2000-BT Series Configuration Guide

2D Barcode Reader User Guide V 1.2.1

Personal Conference Manager (PCM)

Introduction to Decision Structures. Boolean & If Statements. Different Types of Decisions. Boolean Logic. Relational Operators

DLL2020. Software Configuration Manual

Bits and Bytes. Data Representation. A binary digit or bit has a value of either 0 or 1; these are the values we can store in hardware devices.

! " # $ % & ' ( ) * +, -. / : ; < =

Chapter 8. Characters and Strings

V Y. Fragment Pro. Fragment Pro. 1 Copyright 2013 Vít Šmejkal All rights reserved

PD1100 STAND-ALONE PROGRAMMING & USER S GUIDE. use the freedom

Visual KeyMaker. Programming Software Instructions. Contents A B

Microsoft Pocket PC 2003 Windows Mobile 5.0 Phone Edition

Banner 8 Using International Characters

EE 109 Unit 3. Analog vs. Digital. Analog vs. Digital. Binary Representation Systems ANALOG VS. DIGITAL

Getting round your Mac with Shortcut Keys

Fundamental Data Types

Chapter 2 Bits, Data Types, and Operations

BARCODE SCANNER. FUZZYSCAN FAMILY Quick Start Guide

Number Systems for Computers. Outline of Introduction. Binary, Octal and Hexadecimal numbers. Issues for Binary Representation of Numbers

PureScan - ML1. Configuration Guide. Wireless Linear Imager Wireless Laser scanner - 1 -

PJ-600 Series Printer ESC/P Command Reference

This is great when speed is important and relatively few words are necessary, but Max would be a terrible language for writing a text editor.

ASSIGNMENT 5 TIPS AND TRICKS

Quantum. Name: Quantum. Classification: Display Sans Serif. Designer: Hitesh Malaviya (Rocky) Designed in: Styles: 5.

User s Manual. Addendum to. Ranger Wedge Interface. Part No. 25-WEDGE-06A Ver. April 1999

Representing Things With Bits

Adorn. Serif. v x. user s gu ide

Kulturista. Case Sensitive Forms (case) Localized Forms (locl) Standard Ligatures (liga) Kulturista Introduction 1/5. Definition.

Transcription:

Vim your Python Python your Vim Miroslav Šedivý eumiro 1 / 67

2 / 67

en, sk á ä č ď é í ľ ĺ ň ó ô ŕ š ť ú ý ž 3 / 67

en, sk, de á ä č ď é í ľ ĺ ň ó ô ŕ š ť ú ý ž ö ü ß 4 / 67

en, sk, de, cs á ä č ď é í ľ ĺ ň ó ô ŕ š ť ú ý ž ö ü ß ě ř ů 5 / 67

en, sk, de, cs, fr á ä č ď é í ľ ĺ ň ó ô ŕ š ť ú ý ž ö ü ß ě ř ů à â æ ç è ë ê ï î œ ù û ÿ 6 / 67

en, sk, de, cs, fr, es á ä č ď é í ľ ĺ ň ó ô ŕ š ť ú ý ž ö ü ß ě ř ů à â æ ç è ë ê ï î œ ù û ÿ ñ 7 / 67

en, sk, de, cs, fr, es, pl á ä č ď é í ľ ĺ ň ó ô ŕ š ť ú ý ž ö ü ß ě ř ů à â æ ç è ë ê ï î œ ù û ÿ ñ ą ć ę ł ń ś ź ż 8 / 67

en, sk, de, cs, fr, es, pl, it á ä č ď é í ľ ĺ ň ó ô ŕ š ť ú ý ž ö ü ß ě ř ů à â æ ç è ë ê ï î œ ù û ÿ ñ ą ć ę ł ń ś ź ż ò 9 / 67

en, sk, de, cs, fr, es, pl, it, sv á ä č ď é í ľ ĺ ň ó ô ŕ š ť ú ý ž ö ü ß ě ř ů à â æ ç è ë ê ï î œ ù û ÿ ñ ą ć ę ł ń ś ź ż ò å 10 / 67

en, sk, de, cs, fr, es, pl, it, sv, hu á ä č ď é í ľ ĺ ň ó ô ŕ š ť ú ý ž ö ü ß ě ř ů à â æ ç è ë ê ï î œ ù û ÿ ñ ą ć ę ł ń ś ź ż ò å ő ű 11 / 67

en, sk, de, cs, fr, es, pl, it, sv, hu, eo á ä č ď é í ľ ĺ ň ó ô ŕ š ť ú ý ž ö ü ß ě ř ů à â æ ç è ë ê ï î œ ù û ÿ ñ ą ć ę ł ń ś ź ż ò å ő ű ĉ ĝ ĥ ĵ ŝ ŭ 12 / 67

en, sk, de, cs, fr, es, pl, it, sv, hu, eo, tr á ä č ď é í ľ ĺ ň ó ô ŕ š ť ú ý ž ö ü ß ě ř ů à â æ ç è ë ê ï î œ ù û ÿ ñ ą ć ę ł ń ś ź ż ò å ő ű ĉ ĝ ĥ ĵ ŝ ŭ ğ ı İ ş 13 / 67

en, sk, de, cs, fr, es, pl, it, sv, hu, eo, tr, á ä č ď é í ľ ĺ ň ó ô ŕ š ť ú ý ž ö ü ß ě ř ů à â æ ç è ë ê ï î œ ù û ÿ ñ ą ć ę ł ń ś ź ż ò å ő ű ĉ ĝ ĥ ĵ ŝ ŭ ğ ı İ ş þ ð fi fl ø ĸ ə µ ± 0 1 2 M i r o (¹+²) ³ ⁴ ª º ½ ⅓ ⅔ ¼ ¾ ⅕ ⅖ ⅙ ⅚ ⅛ 14 / 67

Character maps? 15 / 67

Compose Key 16 / 67

Compose Key Sequences " a ä a e æ.. " O Ö s s ß?? ' e é t h þ!! ` e è / l ł + - ± ^ u û o c % o = o ő o r / = u u ŭ / o ø 1 2 ½ ~ n ñ = e m u µ c s š - L o s, c ç c ^ 2 ². z ż m u µ : ) 17 / 67

/usr/share/x11/locale/en_us.utf-8/compose <Multi_key> <period> <period> : " " ellipsis # HORIZONTAL ELLIPSIS <Multi_key> <plus> <minus> : "±" plusminus # PLUS-MINUS SIGN <Multi_key> <apostrophe> <a> : "á" aacute # LATIN SMALL LETTER A WITH ACUTE <Multi_key> <s> <s> <Multi_key> <comma> <c> : "ß" ssharp : "ç" ccedilla # LATIN SMALL LETTER SHARP S # LATIN SMALL LETTER C WITH CEDILLA <Multi_key> <c> <S> : "Š" U0160 # LATIN CAPITAL LETTER S WITH CARON +6k more lines 18 / 67

/usr/share/x11/locale/en_us.utf-8/compose <Multi_key> <period> <period> : " " ellipsis # HORIZONTAL ELLIPSIS <Multi_key> <plus> <minus> : "±" plusminus # PLUS-MINUS SIGN <Multi_key> <apostrophe> <a> : "á" aacute # LATIN SMALL LETTER A WITH ACUTE <Multi_key> <s> <s> <Multi_key> <comma> <c> : "ß" ssharp : "ç" ccedilla # LATIN SMALL LETTER SHARP S # LATIN SMALL LETTER C WITH CEDILLA <Multi_key> <c> <S> : "Š" U0160 # LATIN CAPITAL LETTER S WITH CARON +6k more lines ~/.XCompose 19 / 67

/usr/share/x11/xkb/rules/base compose:ralt = +compose(ralt) compose:lwin = +compose(lwin) compose:lwin-altgr = +compose(lwin-altgr) compose:rwin = +compose(rwin) compose:rwin-altgr = +compose(rwin-altgr) compose:menu = +compose(menu) compose:menu-altgr = +compose(menu-altgr) compose:lctrl = +compose(lctrl) compose:lctrl-altgr = +compose(lctrl-altgr) compose:rctrl = +compose(rctrl) compose:rctrl-altgr = +compose(rctrl-altgr) compose:caps = +compose(caps) compose:caps-altgr = +compose(caps-altgr) compose:102 = +compose(102) compose:102-altgr = +compose(102-altgr) compose:paus = +compose(paus) compose:prsc = +compose(prsc) compose:sclk = +compose(sclk) 20 / 67

/usr/share/x11/xkb/rules/base compose:ralt = +compose(ralt) compose:lwin = +compose(lwin) compose:lwin-altgr = +compose(lwin-altgr) compose:rwin = +compose(rwin) compose:rwin-altgr = +compose(rwin-altgr) compose:menu = +compose(menu) compose:menu-altgr = +compose(menu-altgr) compose:lctrl = +compose(lctrl) compose:lctrl-altgr = +compose(lctrl-altgr) compose:rctrl = +compose(rctrl) compose:rctrl-altgr = +compose(rctrl-altgr) compose:caps = +compose(caps) compose:caps-altgr = +compose(caps-altgr) compose:102 = +compose(102) compose:102-altgr = +compose(102-altgr) compose:paus = +compose(paus) compose:prsc = +compose(prsc) compose:sclk = +compose(sclk) setxkbmap us -option 'compose:menu' 21 / 67

19:23:22 <C00LGUY> HELLO EVERYONE! WHAT S GOING ON? 19:23:58 <me> Please hit that large key to the left from A. 19:24:10 <C00LGUY> why? 19:25:11 <C00LGUY> COOL, I DON'T HAVE TO HOLD THE SHIFT KEY ANY MORE! 22 / 67

19:23:22 <C00LGUY> HELLO EVERYONE! WHAT S GOING ON? 19:23:58 <me> Please hit that large key to the left from A. 19:24:10 <C00LGUY> why? 19:25:11 <C00LGUY> COOL, I DON'T HAVE TO HOLD THE SHIFT KEY ANY MORE! yeah! who NEEDS "caps lock" ANYWAY? 23 / 67

/usr/share/x11/xkb/rules/base caps:ctrl_modifier = +capslock(ctrl_modifier) 24 / 67

/usr/share/x11/xkb/rules/base caps:ctrl_modifier = +capslock(ctrl_modifier) setxkbmap us -option 'compose:menu,caps:ctrl_modifier' 25 / 67

Why just another plain Ctrl key? if you can get two keys for the price of one CapsLock + [X] Ctrl + [X] CapsLock Esc 26 / 67

Why just another plain Ctrl key? if you can get two keys for the price of one CapsLock + [X] Ctrl + [X] CapsLock Esc github.com/alols/xcape xcape allows you to use a modifier key as another key when pressed and released on its own. [ ] If you don't understand why anybody would want this, I'm guessing that Vim is not your favourite text editor ;) xcape -e "Caps_Lock=Escape" 27 / 67

READY TO ROCK^H^H^H^HVIM! setxkbmap us -option 'compose:menu,caps:ctrl_modifier' xcape -e "Caps_Lock=Escape" 28 / 67

vi, vim, neovim 29 / 67

Ritchie, Thompson, PDP-11 and ASR-33 (1970) Source: Peter Hamer / Wikipedia, CC BY-SA 2.0 30 / 67

ed(1) $ ed a Hello world and everyone at PyParis. 2p and everyone at PyParis a How are you today?. %n 1 Hello world 2 and everyone at PyParis 3 How are you today? 1s/world/PyParis/ 2d %n 1 Hello PyParis 2 How are you today? w test.txt 45 q $ 31 / 67

ADM-3A Terminal Source: Rama / Wikimedia Commons, CC BY-SA 2.0 32 / 67

ADM-3A Terminal Source: StuartBrady / Wikipedia, CC BY-SA 3.0 33 / 67

Where do h/j/k/l arrows come from? 0 ^@ NUL Null character 1 ^A SOH Start of Header 16 ^P DLE Data link escape 17 ^Q DCL Xon (transmit on) 2 ^B STX Start of Text 18 ^R DC2 Device control 2 3 ^C ETX End of Text 19 ^S DC3 Xoff (transmit off) 4 ^D EOT End of Transmission 20 ^T DC4 Device control 4 5 ^E ENQ Enquiry 21 ^U NAK Negative acknowledge 6 ^F ACK Acknowledge 22 ^V SYN Synchronous idle 7 ^G BEL Bell 23 ^W ETB End of transmission 8 ^H BS Backspace 24 ^X CAN Cancel 9 ^I HT Horizontal tab 10 ^J LF Line feed 25 ^Y EM End of medium 26 ^Z SUB Substitute 11 ^K VT Vertical tab 27 ^[ ESC Escape 12 ^L FF Form feed 28 ^\ FS File separator 13 ^M CR Carriage return 29 ^] GS Group separator 14 ^N SO Shift out 30 ^^ RS Record separator 15 ^O SI Shift in 31 ^_ US Unit separator 34 / 67

Using a mouse is like pointing and grunting to get your point across. Vim lets you speak in full sentences. @Dean, superuser.com/questions/599150/why-arrow-keys-are-not-recommended-in-vim 35 / 67

Vim Keyboard Source: ViEmu.com, Esc key moved by MŠ 36 / 67

37 / 67

vim-like software vim-like = hjkl movement, /? search, modes bash, zsh i3*, tmux qutebrowser, vimperator, vimium mutt, newsbeuter less, vifm, zathura feh, ViPaint and more: xaizek.github.io/2016-08-13/big-list-of-vim-like-software/ plenty of text editors and IDEs in vi-mode * 38 / 67

Is it worth the time? xkcd.com/1205 39 / 67

40 / 67

41 / 67

If you use a (software) tool more than 1 hour a day: read at least one book on it. stevenvanbael.com/read-about-the-software-you-use 42 / 67

Drew Neil vimcasts.org 43 / 67

Vim 8 / Neovim Neovim is a fork of Vim 7.4 asynchronous (lint, tests) :terminal modern defaults, runs on modern systems XDG directories: ~/.config/nvim/init.vim instead of ~/.vimrc python-neovim, npm: neovim 44 / 67

Vim your Python syntax highlighting indenting auto-completion asynchronous linting (ale) git (live diff with gitgutter, manipulation with fugitive) searching ag/fzf snippets (neosnippet) folding interaction with terminal spellchecking 45 / 67

* your (Neo)Vim? C# C++ Clojure Common Lisp Elixir Go Haskell Java Julia Lua Node.js Perl Python R Racket Ruby Rust Swift 46 / 67

Python your (Neo)vim $ pacman -S neovim python-neovim $ conda install -c conda-forge neovim 47 / 67

Python your (Neo)vim $ pacman -S neovim python-neovim $ conda install -c conda-forge neovim from neovim import attach 48 / 67

Python your (Neo)vim $ pacman -S neovim python-neovim $ conda install -c conda-forge neovim from neovim import attach NVIM_LISTEN_ADDRESS=/tmp/nvim nvim nvim = attach('socket', path='/tmp/nvim') nvim = attach('child', argv=["/bin/env", "nvim", "--embed"]) 49 / 67

Python your (Neo)vim $ pacman -S neovim python-neovim $ conda install -c conda-forge neovim from neovim import attach NVIM_LISTEN_ADDRESS=/tmp/nvim nvim nvim = attach('socket', path='/tmp/nvim') nvim = attach('child', argv=["/bin/env", "nvim", "--embed"]) nvim.current.buffer[0] # first line nvim.command('vsplit') # :vsplit 50 / 67

~/.con g/nvim/rplugin/python3/hello.py import email from email.parser import Parser import neovim @neovim.plugin class HelloPlugin: def init (self, nvim): self.nvim = nvim @neovim.autocmd('bufenter', pattern='mutt-pad-*', sync=true) def on_bufenter(self): msg = Parser().parsestr('\n'.join(self.nvim.current.buffer)) addresses = email.utils.getaddresses(msg.get_all('to')) hello_line = black_magic(addresses) first_empty = next((i for i, line in enumerate(self.nvim.current.buffer) if not line), -1) self.nvim.current.buffer.append(['', hello_line], first_empty) :UpdateRemotePlugins 51 / 67

Customized (Neo)vim? master Vim without customization 52 / 67

Customized (Neo)vim? master Vim without customization customize your own Vim deactivate arrow keys remap keys shorten commands appearance behaviour plugins 53 / 67

Customized (Neo)vim? master Vim without customization customize your own Vim deactivate arrow keys remap keys shorten commands appearance behaviour plugins Don't put any lines in your vimrc that you don't understand. 54 / 67

.dot les are your tech CV 55 / 67

.dot les are your tech CV alias config='/usr/bin/git --git-dir=$home/.dotfiles/ --work-tree=$home' 56 / 67

.dot les are your tech CV alias config='/usr/bin/git --git-dir=$home/.dotfiles/ --work-tree=$home' git init --bare $HOME/.dotfiles config config --local status.showuntrackedfiles no # git remote add X Y (github, gitlab, uberspace, ) 57 / 67

.dot les are your tech CV alias config='/usr/bin/git --git-dir=$home/.dotfiles/ --work-tree=$home' git init --bare $HOME/.dotfiles config config --local status.showuntrackedfiles no # git remote add X Y (github, gitlab, uberspace, ) config add.config/nvim/init.vim # commit, branch,... 58 / 67

One Brain, One Keyboard, One Editor? 59 / 67

One Brain, One Keyboard, One Editor? use your muscle memory 60 / 67

One Brain, One Keyboard, One Editor? use your muscle memory one keyboard layout (US QWERTY with Compose) 61 / 67

One Brain, One Keyboard, One Editor? use your muscle memory one keyboard layout (US QWERTY with Compose) one editor (the powerful one) 62 / 67

One Brain, One Keyboard, One Editor? use your muscle memory one keyboard layout (US QWERTY with Compose) one editor (the powerful one) your programming language of choice 63 / 67

One Brain, One Keyboard, One Editor? use your muscle memory one keyboard layout (US QWERTY with Compose) one editor (the powerful one) your programming language of choice take your dotfiles with you 64 / 67

One Brain, One Keyboard, One Editor? use your muscle memory one keyboard layout (US QWERTY with Compose) one editor (the powerful one) your programming language of choice take your dotfiles with you don't put any lines in your dotfiles that you don't understand 65 / 67

One Brain, One Keyboard, One Editor? use your muscle memory one keyboard layout (US QWERTY with Compose) one editor (the powerful one) your programming language of choice take your dotfiles with you don't put any lines in your dotfiles that you don't understand back to the roots 66 / 67

The enjoyment of one's tools is an essential ingredient of successful work. Donald E. Knuth Miroslav Šedivý [ˈmɪrɔslaʋ ˈʃɛɟɪviː] eumiro eumiro šedivý 67 / 67