Brief intro to emacs
Welcome folks today I decided to talk about emacs breifly.
Well I use 5 percent of emacs power.
If you imagine that emacs is a violin, then the Masters of Emacs use it like a violin perfectionists. And I use emacs like a stupid.
Because of this I decided to get Master’s advice.
First of all this is a famous website emacswiki.org . There many people share their lisp scripts. You can read this website and find many good advice and tricks.
- how to add new shotcuts?
- work with projects?
- get email within emacs?
- Powerful editing (like vertical column selection)?
This is very helpful! I always use it. The most important thing about emacs is its NOT just a text editor. its a unified interface, But its Text editing skill is a good feature.
Two religions exist in emacs. The first emacs religion is “don’t touch anything“. All must be by default. The second emacs religion is the customistion.
What’s the best start?
The best start is the sequential reading of manual. You can know new things just by reading it. Every time when I read this manual I talk to my self:
‘Oh! Wow! I can do it this way!’ ‘Impossible!’ ‘Wow!’ ‘I say!’ I’ve found the book about emacs.
I like books! Some people like internet surfing. I would like to read the manual in .pdf format. I feel more comfortable when I see contents of the book. This is information for beginners.
Emacs Shortcuts Review
Emacs has a very interesting modifier key. When I learned emacs I could not find ‘M’ key. I thought this is big ‘m’ letter, but it’s wrong! This is ‘Meta’, it means ‘Alt’ on most keyboards.
When you see for example “M-x”, it means you have to hold down ‘Alt’ and press x.
I like emacs opportunity when you can mark files which you want to delete. ‘d’ – mark files Then ‘x’.
Emacs ask you: ‘Do you want to delete them?‘. Print ‘yes‘ and emacs delete marking files.
Simple commands (‘C’ means Ctrl key):
- ‘C-k’ – cut string
- ‘C-y’ – yank (paste) string
- ‘C-/’ – undo
If you need to select text and then paste it somewhere then you have to select the text, after you have to run command ‘M-x’ and go to needed line and run ‘C-y’.
- ‘M-u’ – upper case
- ‘M-l’ – lower case
- ‘C-t’ – for letters
- ‘M-t’ – for words
- ‘C-x, C-t’ – for strings
I use them when I wrote something wrong. For example I mixed up function name and object name. This advice is for beginners. When you select text and then press ‘delete’, you expect removal of this text. But It doesn’t occur. I see deselect only. You have to turn on delete-selection-mode for success removal. It will work!
Next useful command is ‘M-;‘.
It adds comment to the end of row or comments block of code.
Two commands split screen into two parts.
- ‘C-x-2’ is horizontal splitting
- ‘C-x-3’ is vertical spliting
Vertical block selection is incredible mode. You have to turn on CUA-mode for selection by columns. CUA – Common User Access. It’s standard for user interfaces.
‘M-x’, – turns on ‘cua-mode’ mode. In this mode you can now select, copy and paste the block of codes.
- Are you still here?
- Does your stack overflow?
- Can you think more?
My favorite command is ‘M-x’, ‘query-replace-regexp’.
For example, now I am incrementing the index of the array Regular expressions really help to make big changes in file. Emacs has built-in grep.
The command for searching ‘canvas’ word is ‘M-x’, ‘rgep’ canvas. You will see the result in right part of screen. If you press on green name of file then you move to the string which contain of searching word.
This is a small review of my commands. But emacs has powerful instruments for work with the projects. When you start a new job. Your first days working are learning all project, setting of your work environment. Some tricks make you more productive. TAGS helps you. Emacs can look for classes by TAGS. You can jump to class definition or class declaration very fast. First of all, you have to create TAGS. Then you have to stand in the name of class and put command ‘M-.’
That’s it ! see ya !
Check out Breif intro to Go lang