Help Topic: Getting Started with Emacs Spring 2020 Michael Benjamin, [email protected] Department of Mechanical Engineering, CSAIL MIT, Cambridge MA 02139

Total Page:16

File Type:pdf, Size:1020Kb

Help Topic: Getting Started with Emacs Spring 2020 Michael Benjamin, Mikerb@Mit.Edu Department of Mechanical Engineering, CSAIL MIT, Cambridge MA 02139 Help Topic: Getting Started with Emacs Spring 2020 Michael Benjamin, [email protected] Department of Mechanical Engineering, CSAIL MIT, Cambridge MA 02139 Getting Started with Emacs If you are using your own Linux machine, or your own Mac in 2.680, chances are you already are familiar with Emacs or a suitably equivalent text editor. This page is written with the new Mac user in mind who has never used Emacs. It may be useful for others as well. The pre-installed emacs Most likely your machine already has a version of emacs installed, with the full path name of /usr/bin/emacs. Verify this: $ which emacs /usr/bin/emacs If this is not the case, install it. On the Mac: $ sudo port install emacs In Linux: $ sudo apt-get install emacs The absolute minimal emacs There are many things you can do in emacs. Here we describe how to (1) open a file, (2) save a few changes, and (3) quit. This at least allows us to do a few things in emacs before learning further. 1. Open a file in emacs: $ /usr/bin/emacs testfile We use the full emacs pathname in the off chance that /usr/bin/ may not be in your shell path. You can try it without the /usr/bin/. You should be able to just type text, and use the arrow keys, backspace, delete etc., to just compose a sample for yourself. 1 2. Save a file in emacs: To save a file, type the following two commands: Ctrl-x, then Ctrl-s. You should see a line at the very bottom of your emacs window like: Wrote /Users/myname/testfile If not, type Ctrl-g in the emacs window (a useful way of resetting any weird state you may have gotten yourself into), and try the save again. 3. Quitting emacs: To quit emacs, type the following two commands: Ctrl-x, then Ctrl-c. Getting a more graphical Emacs The emacs in /usr/bin/emacs is fine for editing a text file right in the Terminal window, but normally you will want to edit files in a more graphical version of Emacs. We recommend also installing the emacs found at: www.emacsformacosx.com. After installation you will need to add the following to your shell path: /Applications/Emacs.app/Contents/MacOS Resources for Learning Emacs • Learning GNU Emacs, Debra Cameron, James Elliot, Marc Loy, Eric Raymond, and Bill Rosenblatt, 3rd Edition, 2005. • MIT E Library • Emacs Cheat Sheet (Bob Rogers), here. • Emacs Cheat Sheet (Hains/Princeton) here. • "Emacs vs. vi", Editor War 2.
Recommended publications
  • Vim for Humans Release 1.0
    Vim for humans Release 1.0 Vincent Jousse August 12, 2015 CONTENTS 1 Preamble 1 1.1 Disclaimer .................... ..................... 1 1.2 Paid book but free price .................... ..................... 1 1.3 Free license .................... ..................... 1 1.4 Thanks .................... ..................... 1 2 Introduction 3 2.1 For who? .................... ..................... 4 2.2 What you will be learning .................... .................... 4 2.3 What you will not be learning .................... .................. 4 2.4 The hardest part is to get started .................... ................. 5 3 Having a usable Vim 7 3.1 Essential preamble: the insert mode .................... ............... 8 3.2 Modes: the powerful Vim secrets .................... 10 3.3 The lifesaver default configuration .................... 12 3.4 And now, the color! .................... ..................... 13 3.5 Ourfirst plugin: thefile explorer .................... 17 3.6 Here we go .................... ..................... 19 4 The text editor you’ve always dreamed of 23 4.1 Learning how to move: the copy/paste use case ..................... 23 4.2 Forgetting the directional keys .................... 26 4.3 Doing without the Esc key .................... .................... 29 4.4 Combining keys and moves .................... ................... 29 4.5 Search / Move quickly .................... ..................... 30 4.6 Visual mode .................... ..................... 31 4.7 It’s your turn! .................... ....................
    [Show full text]
  • The Oldest Rivalry in Computing Forget Apple Vs
    Follow us on Twitter for more great Slate stories! Follow @slate BITWISE DECODING THE TECH WORLD. MAY 9 2014 9:57 AM The Oldest Rivalry in Computing Forget Apple vs. Google. Emacs and Vi have been battling for text-editor supremacy among programmers for 40 years. By David Auerbach An early Emacs manual cover from 1981. Courtesy of GNU Emacs n a world where both software and hardware frequently become obsolete right I on release, two rival programs can stake a claim to being among the longest-lived applications of all time. Both programs are about to enter their fifth decades. Both programs are text editors, for inputting and editing code, data files, raw HTML Web pages, and anything else. And they are mortal enemies. Their names are Emacs and Vi (styled by programmers as “vi”). These editors are legendary and ancient, no exaggeration. Both date back to at least 1976, making them older than the vast majority of people currently using them. Both programs are text editors, which means they are not WYSIWYG (what you see is what you get)—unlike, say, word processors like Microsoft Word, they do not format your words onscreen. Programming is very different from word processing, and the basic goal of Emacs and Vi—fast editing of source code (and any other text files)—has yet to become obsolete. Both have been in ongoing development for almost 40 years. These two wizened programs are as close to equally matched enemies as any two programs have ever been. If you know a programmer who uses one of them, there’s a good chance that she hates the other.
    [Show full text]
  • Mac Text Editor for Coding
    Mac Text Editor For Coding Sometimes Pomeranian Mikey probed her cartography allegorically, but idiomorphic Patrik depolymerizes despotically or stains ethnocentrically. Cereal Morten sick-out advisably while Bartel always overglazing his anticholinergic crunches pregnantly, he equilibrating so eath. Substantiated Tore usually exuviated some Greenwich or bumbles pedagogically. TextEdit The Built-in Text Editor of Mac OS X CityMac. 4 great editors for macOS for editing plain lazy and for coding. Brackets enables you! Many features that allows you could wish to become almost everything from an awesome nintendo switch to. Top 11 Code Editors for Software Developers Bit Blog. We know what you have specific id, so fast feedback on rails without even allow users. Even convert any one. Spaces and broad range of alternatives than simply putting your code after it! It was very good things for example. Great joy to. What may find in pakistan providing payment gateway security news, as close to any query or. How does Start Coding Programming for Beginners Learn Coding. It was significantly as either running on every developer you buy, as well from your html tools for writing for free to add or handling is. Code is free pattern available rate your favorite platform Linux Mac OSX and Windows Categories in power with TextEdit Text Editor Compare. How do I steer to code? Have to inflict pain on this plot drawn so depending on your writing source code. Text but it does not suitable for adjusting multiple computers users. The wheat free if paid text editors for the Mac iMore. After logging in free with google translate into full member of useful is a file in a comment is ideal environment, where their personal taste.
    [Show full text]
  • Text Editors for Programmers
    Text Editors for Programmers Dr. Prasad Kulkarni Michael Jantz Jamie Robinson 1 Real Programmers 2 vim • Based on vi – vi written in 1976 and has become standard on Unix machines • Basic design principles: – Retains each permutation of typed keys to resolve commands – Smaller and faster editor ± but with less capacity for customization – Uses distinct editing ªmodesº 3 Using Vim on a Simple Example • You should have received two source files (simple.c and simple.h), a Makefile, and a dot_vimrc file from the lab website. – Save dot_vimrc as .vimrc in your home directory – Use mv to rename the file • mv dot_vimrc ~/.vimrc • “dot_vimrc” – A collection of vim commands run each time you start vim – Used to set mappings / options that are not otherwise set by default. 4 Using Vim to Create & Edit a File • Start a session – vim simple.c • Press 'i' to enter insert mode – Now type any text you want • 'Esc' to enter command mode – ':wq' to write changes and exit the session 5 Vim – Modes of Operation • Command Mode • Input Mode • Visual Mode V, v, ctrl - v Command Visual Escape Escape I, i, A, a, O, o, R, r Input 6 Essential Commands • :e file – Edit file in a new buffer • :w – Save any modifications to the current buffer. • :q – Quit Vim. If you have modifications you do not want to save, use :q! • u, <c-r> – Undo, redo 7 Command Mode: Navigation • Reopen simple.c – Use j, k, l, and h to navigate around the file as shown. This may take awhile get used to, but is very nice once you have it down.
    [Show full text]
  • Research and Technical Resource Guide
    Research and Technical Resources Princeton Astrophysics This guide is meant to provide an overview of essential tools used in astronomy and astrophysics research. They are primarily aimed at the undergraduates beginning to learn the ins and outs of research. 1 General Information about the Department Here are some general things to be aware of as students in Peyton Hall. • The undergraduate portion of the website: www.princeton.edu/astro/undergraduate. This is the best place to look for requirements. • Peyton Hall documentation wiki: www.astro.princeton.edu/docs/Main Page. Lots of information on technical matters, ranging from ssh-ing into workstations to setting up printers on your computer. • See www.astro.princeton.edu/docs/Requesting assistance for the email to contact for any IT assistance you need. • Spring colloquium series: During the Spring semester, we host a speaker every Tuesday afternoon (at 4:30), followed by a reception. Speakers are invited at least partially based on their ability to give good talks. The schedule can be found at www.princeton.edu/astro/news-events/public-events. • Wunch (Wednesday Lunch): www.astro.princeton.edu/∼wunch. Slightly less formal talks are given throughout the academic year, Wednesdays, 12:30. The speakers are often postdocs or grad students. Feel free to bring (or order|see the website) lunch. • Institute for Advanced Study colloquium: www.sns.ias.edu/∼seminar/colloquia.shtml. Though not often frequented by undergrads, you are welcome to attend the Tuesday morning (11:00) talks they host. These are often given by well-known and established astrophysicists, so if one comes up on a topic you are interested in, you should check it out.
    [Show full text]
  • What Is Vi ? Vi History Characteristics of Vi
    Arvind Maskara 2/15/16 What is vi ? The visual editor initially developed on Unix. The vi editor (“vee eye”) Before vi the primary editor used on Unix was the line editor n User was able to see/edit only one line of the text NOTE: You will not be examined at a time The vi editor is a text editor, not a text on the detailed usage of vi, but formatter (like MS Word) you should know the basics n You cannot set margins… n Center headings… n Set text as bold… Adapted by Dr. Andrew Vardy from www.wildbill.org/rose/Fall09/ch03.ppt supercomputingchallenge.org/98-99/stts-99/vi.ppt Vi History Characteristics of vi Originally written by Bill Joy in 1976. The vi editor is: Who is Bill Joy? n Very powerful n He co-founded Sun Microsystems in 1982 and served as chief scientist until 2003. n …But cryptic Joy's prowess as a computer The best way to learn vi commands is programmer is legendary, with an oft- to use them told anecdote that he wrote the vi editor So practice… in a weekend. Joy denies this assertion. vi editor 1 Arvind Maskara 2/15/16 Vim equals Vi Starting vi Most installations of vi actually use a First, see what version of vi is installed different program called vim on your system through “man vi” n Vi Improved Type vi <filename> at the shell prompt n http://www.vim.org After pressing enter the command n Charityware – donations accepted to help prompt disappears and you see tilde(~) children in Uganda through the ICCF characters on all the lines n Main author is Bram Moolenaar These tilde characters indicate that the line is blank vi Window Display Vi is a Modal Editor There are (at least) three modes in vi Line one n Command mode (a.k.a.
    [Show full text]
  • Technical Workflows and Tools for Experimental Publishing
    COPIM • Books Contain Multitudes: Exploring Experimental Publishing Part 3: Technical Workows and Tools for Experimental Publishing Marcell Mars, Tobias Steiner, Janneke Adema Published on: Jan 29, 2021 DOI: 10.21428/785a6451.174760b2 License: Creative Commons Attribution 4.0 International License (CC-BY 4.0) COPIM • Books Contain Multitudes: Exploring Experimental Publishing Part 3: Technical Workows and Tools for Experimental Publishing For this third part of the scoping report, we will be looking at the technical developments around experimental book publishing. We will be doing so in a three-fold manner in the next three sections. First, instead of conducting a landscape study ourselves, we will be reviewing a number of studies and resources that have recently been released and that have tried to categorise, analyse, and map the open source publishing tools and platforms currently available to support open access (book) publishing. Our focus in this analysis will predominantly be on those tools and technologies that can support the kinds of experimental publications that we have identified in the first two parts of this scoping report. Secondly, in section 2, we will outline a proposed methodology to analyse and categorise the currently available tools and technologies to support the creation of an online resource for publishers and authors in year 3 of the COPIM project. This online resource will include the technological support and workflows available to enable more experimental forms of book publishing, whilst showcasing examples and best practices for different levels of technical know-how. Thirdly, in section 3, we will make an initial attempt at categorising a selection of tools following this proposed methodology, where we will be focusing on collaborative writing tools and on annotation tools —and the software, platforms, and workflows that support these—in first instance.
    [Show full text]
  • Ebook Download Learning the Vi and Vim Editors
    LEARNING THE VI AND VIM EDITORS PDF, EPUB, EBOOK Arnold Robbins,Elbert Hannah,Linda Lamb | 494 pages | 29 Jul 2008 | O'Reilly Media, Inc, USA | 9780596529833 | English | Sebastopol, United States Learning the vi and Vim Editors PDF Book Help us improve. Jul 27, James rated it it was amazing Shelves: reference , general-science-math-technology , computers. Understanding few simple, yet highly unintuitive, commands can make you functional when reading and manipulate files like INIs, Logs, etc. View Product. It's the shell that unlocks the real potential of Unix. The appendices are exceptionally helpful. Want to Read saving…. He loves connecting Unix to anything and once wrote a stream editor program to automate JCL edits for mainframe monthly configurations by streaming mainframeJCL to a stream editor on an RJE connected Unix box. Aug 23, Eric rated it really liked it. Takes you through several editors vi, ex, Darrell, other clones. This is probably the most complete VIM book on the market, which can be used both as cover-to-cover read or as a reference. No trivia or quizzes yet. I'm just saying. Author Recent Posts. Vim, however, is not a text formatting program; rather, it is a sophisticated text editor primarily used to write code, short notes, and input to a text formatting system. Latest posts by Sagar Khillar see all. Accessible to vim newbies and easy to navigate. Because I was reading on an ebook, the other egregious problem was a huge chunk of the book devoted to vile, kyle, elvis, and other weird vi-clones, none of which r Definitely showing its age; the first third of the book exclusively discusses vi not vim , to the extent that a lot of it becomes superceded by the rest of the book.
    [Show full text]
  • Think Unix Associate Publisher Tracy Dunkelberger Jon Lasser Acquisitions Editor Copyright © 2000 by Que Corporation Katie Purdum All Rights Reserved
    00 2376 FM 11.30.00 9:21 AM Page i PERMISSIONS AND OWNERSHIP • USERS AND GROUPS HARD LINKS • SOFT LINKS • REDIRECTION AND PIPES REDIRECTING STDERR • NAME LOOKUP • ROUTING READING MAIL VIA POP3 • VI AND REGULAR EXPRESSIONS FILENAME GLOBBING VERSUS REGEXPS • INTERACTIVE COMMAND-LINE EDITING • HISTORY SUBSTITUTION • JOB CONTROL • VARIABLES AND QUOTING • CONDITIONAL EXECUTION • WHILE AND UNTIL LOOPS • ALIASES AND FUNCTIONS • THE X WINDOW CLIENT/SERVER MODEL WIDGETS AND TOOLKITS • CONFIGURING X • PERMISSIONS AND OWNERSHIP • USERS AND GROUPS • HARD LINKS • SOFT LINKS • REDIRECTION AND PIPES • REDIRECTING STDERR NAME LOOKUP • ROUTING READING MAIL VIA POP3 • VI AND REGULAR EXPRESSIONS FILENAME GLOBBING VERSUS REGEXPS • INTERACTIVE COMMAND-LINE EDITING • HISTORY SUBSTITUTION • JOB CONTROL • VARIABLES AND QUOTING CONDITIONAL EXECUTION • WHILE AND UNTIL LOOPS • ALIASES AND FUNCTIONS • THE X WINDOW CLIENT/SERVER MODEL WIDGETS AND TOOLKITS • CONFIGURING X • PERMISSIONS AND OWNERSHIP • USERS AND GROUPS HARD LINKS • SOFT LINKS • REDIRECTION AND PIPES • REDIRECTING STDERR • NAME LOOKUP • ROUTING READING MAIL VIA POP3 • VI AND REGULAR EXPRESSIONS • FILENAME GLOBBING VERSUS REGEXPS • INTERACTIVE COMMAND-LINE EDITING • HISTORY THINKSUBSTITUTION • JOB CONTROL • VARIABLES AND QUOTINGUnix READING MAN PAGES • ABSOLUTE AND RELATIVE P PERMISSIONS AND OWNERSHIP • USERS AND GRO HARD LINKS • SOFT LINKS • REDIRECTION AND PIPE JON LASSER REDIRECTING STDERR • NAME LOOKUP • ROUTING READING MAIL VIA POP3 • VI AND REGULAR EXPRE FILENAME GLOBBING VERSUS REGEXPS • INTERACT
    [Show full text]
  • Editor War - Wikipedia, the Free Encyclopedia Editor War from Wikipedia, the Free Encyclopedia
    11/20/13 Editor war - Wikipedia, the free encyclopedia Editor war From Wikipedia, the free encyclopedia Editor war is the common name for the rivalry between users of the vi and Emacs text editors. The rivalry has become a lasting part of hacker culture and the free software community. Many flame wars have been fought between groups insisting that their editor of choice is the paragon of editing perfection, and insulting the others. Unlike the related battles over operating systems, programming languages, and even source code indent style, choice of editor usually only affects oneself. Contents 1 Differences between vi and Emacs 1.1 Benefits of vi-like editors 1.2 Benefits of Emacs 2 Humor 3 Current state of the editor war 4 See also 5 Notes 6 References 7 External links Differences between vi and Emacs The most important differences between vi and Emacs are presented in the following table: en.wikipedia.org/wiki/Editor_war 1/6 11/20/13 Editor war - Wikipedia, the free encyclopedia vi Emacs Emacs commands are key combinations for which modifier keys vi editing retains each permutation of typed keys. are held down while other keys are Keystroke This creates a path in the decision tree which pressed; a command gets executed execution unambiguously identifies any command. once completely typed. This still forms a decision tree of commands, but not one of individual keystrokes. Historically, vi is a smaller and faster program, but Emacs takes longer to start up (even with less capacity for customization. The vim compared to vim) and requires more version of vi has evolved to provide significantly memory.
    [Show full text]
  • Download Vim Tutorial (PDF Version)
    Vim About the Tutorial Vi IMproved (henceforth referred to as Vim) editor is one of the popular text editors. It is clone of Vi editor and written by Bram Moolenaar. It is cross platform editor and available on most popular platforms like Windows, Linux, Mac and other UNIX variants. It is command-centric editor, so beginners might find it difficult to work with it. But once you master it, you can solve many complex text-related tasks with few Vim commands. After completing this tutorial, readers should be able to use Vim fluently. Audience This tutorial is targeted for both beginners and intermediate users. After completing this tutorial, beginners will be able to use Vim effectively whereas intermediate users will take their knowledge to the next level. Prerequisites This tutorial assumes that reader has basic knowledge of computer system. Additionally, reader should be able to install, uninstall and configure software packages on given system. Conventions Following conventions are followed in entire tutorial: $ command execute this command in terminal as a non-root user 10j execute this command in Vim’s command mode :set nu execute this command in Vim’s command line mode Copyright & Disclaimer Copyright 2018 by Tutorials Point (I) Pvt. Ltd. All the content and graphics published in this e-book are the property of Tutorials Point (I) Pvt. Ltd. The user of this e-book is prohibited to reuse, retain, copy, distribute or republish any contents or a part of contents of this e-book in any manner without written consent of the publisher. We strive to update the contents of our website and tutorials as timely and as precisely as possible, however, the contents may contain inaccuracies or errors.
    [Show full text]
  • Getting Started with Linux the Extremely Illustrated Version
    Lab 1: Getting Started with Linux The Extremely Illustrated Version Graham Northup Objectives ● Be familiar with the use of the terminal on Linux systems. ● Know what Linux resources on campus are available for your use. ● Understand how to submit assignments for this course. Getting a Terminal Getting a Terminal Getting a Terminal Getting a Terminal Seeing Stuff Making Files Moving Around Moving Back Editing Files ● Linux systems are usually replete with a number of text editors. ● Various users tend to have their own preferences (Google “editor war”) ● I will be teaching Vim, the vi-improved editor, but you are free to edit your assignments with whatever you feel comfortable with, including, e.g., CodeBlocks, Notepad++, etc. Starting Vim Vim Entering “Insert Mode” Typing Text Exiting “Insert Mode” Exiting Vim Back to the Terminal Displaying File Contents Copying Files Moving Files Removing Files Where you are ● For now, you have been working on the local host, which is probably one of the ITL machines. ● Work saved on these machines is accessible by anyone else who might sit there! ● For assignments, the University has dedicated servers which also provide a Linux environment, one of which is Odin. Accessing Servers Your Clarkson Full name of the server username Accessing Servers Accessing Servers Accessing Servers Where you are Servers Local host (e.g., ITL machine) Network / Internet Accessing Servers Done on server Exiting Servers Exiting Servers Done on server Done on local host Copying Files to Servers Your Server’s full name Location to Clarkson copy to username Copying Files to Servers Copying Files to Servers Copying Files to Servers Accessing Servers in Windows putty www.putty.org Copying Files to Servers in Windows WinSCP winscp.net Task 1 Create three files in your home directory (~) on Odin (odin.cslabs.clarkson.edu): ● touch one file; ● Create one file by editing it (e.g., with vim); ● Copy one file with scp.
    [Show full text]