Vim vs Emacs

14 risposte [Ultimo contenuto]
User0
Offline
Iscritto: 09/20/2017

What is better and why?
why emacs is not pre-installed ?

calher

I am a member!

Offline
Iscritto: 06/19/2015

On Thu, 2017-11-30 at 17:49 +0100, name at domain wrote:
> What is better and why?

Emacs.

> why emacs is not pre-installed ?

I don't know, but many people prefer to build Emacs from source.

--
Caleb Herbert
OpenPGP public key: http://bluehome.net/csh/pubkey

quantumgravity
Offline
Iscritto: 04/22/2013

I never used emacs, but I LOVE vim.
And since there is nothing i'm missing, I won't make any switch.

calher

I am a member!

Offline
Iscritto: 06/19/2015

I moved FROM Vim TO Emacs.

That said, I still sometimes use Vim. Check out my vimrc:
https://notabug.org/csh/dotfiles/src/master/.vimrc

quantumgravity
Offline
Iscritto: 04/22/2013

Why did you make the change?
Are there any specific advantages?

calher

I am a member!

Offline
Iscritto: 06/19/2015

On Thu, 2017-11-30 at 22:11 +0100, name at domain wrote:
> Why did you make the change?

* vi keys on Dvorak are weird
* I wanted to explore Lisp
* I wanted a challenge
* I wanted to experience what Stallman uses all the time

> Are there any specific advantages?

* best for editing Lisp code
* closest Synaptic-like GUI front-end to GNU Guix, so far
* best for editing Info manuals
* babel in Org Mode lets you edit code samples in your documents
as if they're their own files, with syntax highlighting
appropriate for the snippet's language.
* babel in Org Mode facilitates literate programming and immediate
documentation/reformatting of a program's results into, for
example, an Org Mode table, which can export to an HTML/LaTeX
table
* recursive grep in Emacs shell is VERY interactive, returning a
list of links that automatically open the file and place your
cursor on the exact point of the search result
* narrowing (Control-x n n) lets you focus on sections of a large
file without distractions
* Web Mode lets you have proper indentation and highlighting rules
for files that have a mix of languages - CSS, JavaScript and
HTML.
* If you need to type weird characters not supported by your
system's input method system, you can quickly whip up an Emacs
Quail input method with a simple list key-value pairs. I've
done it for Phoenecian and ancient Egyptian before. I've also
done it for the Wikipedia phonetic spelling system for English.
* You can use multiple cursors in the same buffer, allowing you to
reproduce a lot of work and make complex region selections
* Every time I save my HTML files, the timestamp is updated.
* Emacs has a command to convert CSV text to an org table, which
can be converted to HTML
* you can make it behave exactly like Vim, but with even more
features: https://www.youtube.com/watch?v=JWD1Fpdd4Pc
* ... (I'll stop here.)

--
Caleb Herbert
OpenPGP public key: http://bluehome.net/csh/pubkey

Time4Tea
Offline
Iscritto: 07/16/2017

I quite like nano. It seems simple and pretty much does what I want. Although I'd be willing to try something else, if someone can convince me of the error of my ways.

Which one is best for coding?

gnutastyc
Offline
Iscritto: 11/13/2017

Nano is wonderful for non-programmers or for editing small configuration txt files, but not for proper coding.

If you want to give something more advanced a try, Emacs has a nice tutorial that can be accessed from the main menu after installing, because it is a bit tricky to start using Emacs and Vim at the beginning.

Magic Banana

I am a member!

I am a translator!

Offline
Iscritto: 07/24/2010

When it comes to efficiently edit texts, both are excellent... once you know them. So, I would say, it makes little sense to learn both: one is enough. I argue in favor of Emacs for two main reasons:

  • Learning Emacs is easier than learning vim. You can actually type text after launching Emacs for the first time! Vim's modes are not natural. The "Emacs Tutorial", in the help menu (Emacs has menus where to find many new commands, not vim!), is good to get the basics...
  • ... but Emacs is not restricted to basic text editing (contrary to vim). You can almost do your whole computing inside Emacs (file management, email reading/writing, RSS, Web browsing, etc.) and the basic commands are always the same.
calher

I am a member!

Offline
Iscritto: 06/19/2015

Yes, you're right! DIRED is the best file manager ever. If I could use
it as my one and only file manager, I would. Unfortunately, when I plug
in a new flash drive, it doesn't open up an Emacs client with DIRED.

Emacs for email is quite useful as well, although I've only used the
Emacs mail programs directly on my mail server, because I don't know how
to configure it otherwise. I'd like to have Stallman's email setup; the
simplicity of C-x m and RMAIL is nice.

And M-x woman is the most attractive /usr/bin/man. Hyperlinks and
stuff.

--
Caleb Herbert
OpenPGP public key: http://bluehome.net/csh/pubkey

ADFENO
Offline
Iscritto: 12/31/2012

Personally, I prefer Emacs Gnus for sending and reading email.

There are somethings you have to be aware if configuring multiple
accounts, but that is minor issue, for such cases, in your .emacs file,
you can do something like this if you, like me, prefer to send email
using SMTP (with the `smtpmail' Emacs module/package):

--8<---------------cut here---------------start------------->8---
(defun temp-smtpmail-stream-type (fun &rest r)
(let ((smtpmail-stream-type
(cond
((string= smtpmail-smtp-server "mail.gandi.net") 'tls)
((string= smtpmail-smtp-server "mail.provider.tld") 'ssl)
(t smtpmail-stream-type))))
(apply fun r)))

(advice-add 'smtpmail-via-smtp :around #'temp-smtpmail-stream-type)
--8<---------------cut here---------------end--------------->8---

Basically the defined function (defun) `temp-smtpmail-stream-type' will
test to see which SMTP server you're trying to connect to, and based on
that, use your personal port/encryption/stream type, otherwise, it just
returns the previous (before the defun) value of `smtpmail-stream-type'.

The line with `advice-add' makes the default `smtpmail-via-smtp'
function respect our decision every time it's called, but with the added
benefit of not having to redefine `smtpmail-via-smtp'.

After this small .emacs change, now it's time to tell your Gnus how to
behave if you happen to have multiple receiving accounts configured in
Gnus, and want to compose a reply with all authentication details setup
correctly (because it's tedious to have to tell which SMTP server to
connect to), to do so automatically, make use of posting styles (see the
Gnus info page for more, here is mine:

--8<---------------cut here---------------start------------->8---
(setq gnus-posting-styles '((".*"
(name "Adonay Felipe Nogueira")
(address "name at domain")
(From "Adonay Felipe Nogueira <name at domain>")
("X-Message-SMTP-Method" "smtp mail.gandi.net 465 name at domain"))
((header "Delivered-To" "name at domain")
(address "name at domain")
("X-Message-SMTP-Method" "smtp mail.gandi.net 465 name at domain"))
((header "Delivered-To" "name at domain")
(name "Eva Luator")
(address "name at domain")
("X-Message-SMTP-Method" "smtp mail.provider.tld 465 name at domain"))))
--8<---------------cut here---------------end--------------->8---

The most important part is "X-Message-SMTP-Method", it has to match with
your preferred port/encryption/stream type.

Finally, put the relative information in your .authinfo file:

--8<---------------cut here---------------start------------->8---
machine mail.gandi.net port 465 login name at domain password [Password for SMTP.]
machine mail.provider.tld port 465 login name at domain password [Password for SMTP.]
--8<---------------cut here---------------end--------------->8---

... encrypt this file with something like `gpg --recipient "[Your GnuPG
identity.]" --output "[Path to .authinfo.].gpg" --encrypt "[Path to
.authinfo.]"'.

When, done delete ".authinfo" (and the backups, if Emacs happanes to
make them) and leave only ".authinfo.gpg".

Remember that this message/hint only covers multiple SMTP accounts, not
POP3 accounts because these (POP3) are easiler to set up in Gnus and in
your ".authinfo" file.

I hope this helps. ;)

2017-12-01T07:44:33-0600 Caleb Herbert wrote:
> Yes, you're right! DIRED is the best file manager ever. If I could use
> it as my one and only file manager, I would. Unfortunately, when I plug
> in a new flash drive, it doesn't open up an Emacs client with DIRED.
>
> Emacs for email is quite useful as well, although I've only used the
> Emacs mail programs directly on my mail server, because I don't know how
> to configure it otherwise. I'd like to have Stallman's email setup; the
> simplicity of C-x m and RMAIL is nice.
>
> And M-x woman is the most attractive /usr/bin/man. Hyperlinks and
> stuff.

--
- https://libreplanet.org/wiki/User:Adfeno
- Palestrante e consultor sobre /software/ livre (não confundir com
gratis).
- "WhatsApp"? Ele não é livre. Por favor, veja formas de se comunicar
instantaneamente comigo no endereço abaixo.
- Contato: https://libreplanet.org/wiki/User:Adfeno#vCard
- Arquivos comuns aceitos (apenas sem DRM): Corel Draw, Microsoft
Office, MP3, MP4, WMA, WMV.
- Arquivos comuns aceitos e enviados: CSV, GNU Dia, GNU Emacs Org, GNU
GIMP, Inkscape SVG, JPG, LibreOffice (padrão ODF), OGG, OPUS, PDF
(apenas sem DRM), PNG, TXT, WEBM.

ADFENO
Offline
Iscritto: 12/31/2012

Also, the "Eva Luator" and the "mail.provider.tld" are just examples, I
don't have anything to do with them and I don't know if they exist.

I know that "Eva Luator" is sometimes used as an example name in the
field of programming. ;)

calher

I am a member!

Offline
Iscritto: 06/19/2015
ADFENO
Offline
Iscritto: 12/31/2012

It's indeed strange, I also experienced it when I first tried, all I had
to do was:

1. Install `smtpmail-async' Emacs module/package.

2. Require it in the ".emacs" file, with something like:

--8<---------------cut here---------------start------------->8---
(require 'smtpmail-async nil t)
--8<---------------cut here---------------end--------------->8---

3. In the ".gnus" file, do something like:

--8<---------------cut here---------------start------------->8---
(setq send-mail-function 'async-smtpmail-send-it
message-send-mail-function 'async-smtpmail-send-it)
--8<---------------cut here---------------end--------------->8---

You can also apply all this things live in order to test them. Here are
two ways of doing so (after installing `smtpmail-async'):

For each of the ways described here, the following commands can be used:

--8<---------------cut here---------------start------------->8---
(require 'smtpmail-async nil t)
(setq send-mail-function 'async-smtpmail-send-it
message-send-mail-function 'async-smtpmail-send-it)
--8<---------------cut here---------------end--------------->8---

a) using the "*scratch*" buffer, in this case, you would have to press
C-j --- Ctrl + J --- for every new line in order for it to be
applied. For example: type "(require 'smtpmail-async nil t)", then
C-j, then continue;

b) using the Inferior Emacs Lisp Mode (IELM), by doing M-x ielm RET ---
which means Alt + x (or ESC then X) and typing "ielm" then pressing
Return/Enter. Every line given in the example above will be applied
immediately when it's possible to find a new line which comes after a
closing parenthesis sufficient to finish the outer command. For
example, by trying to type:

--8<---------------cut here---------------start------------->8---
(cond ((string= "a" "b")
(print "a"))
(t (print "b")))
--8<---------------cut here---------------end--------------->8---

The first new line (after '(cond ((string= "a" "b")') won't evaluate
yet, because you have to close the parenthesis of '(cond', which will be
done in the last/third line.

Finally, another thing that helps is to use POP3 account. IMAP is OK,
but I also found that IMAP takes a lot of time to load, not only in
Gnus, but in other email clients.

2017-12-01T10:11:02-0600 Caleb Herbert wrote:
> Gnus locks up my environment. Why do you like it?
>

calher

I am a member!

Offline
Iscritto: 06/19/2015

Please refrain from top-posting. http://www.palmyanoff.com/trimpost.htm

Thanks for providing a work-around. I'll try using it if I switch from
Evolution to Gnus.