Advertisement

Basic text editor?

Started by January 24, 2013 12:39 PM
10 comments, last by LorenzoGatti 12 years, 1 month ago

I'd like to ask if you know some free, good, basic, raw text editor(no ide, I already have one for coding and dont want to switch), as there are thousands to try and often they have features to help you which silently change something in a file. I just need it sometimes to edit some config or data file, so it doesnt need any fancy features. Thank you.

requirements:

- If I load any file into it and save it, it should be byte for byte identical to the original, if I change 1 thing it should not change anything else, even if there are misplaced spaces, tabs, "wrong" lineendings, fancy characters, illegal character encodings or whatever else inside the file.

- It should detect which line endings are used(+show which type and if its mixed up) and if I add some more it should use the same as already there.

- It shows something for anything inside the file(no hiding of unknown characters).

- There should be no problems to make git call it, so I never again have to see the most obscure editor ever(vim).

nice to haves:

- It lets me choose to convert all line endings to a choosen type.

- It can detect and show different character encodings (latin1,all unicode encodings, windows encoding) and lets me choose to let it interpret it as any other and maybe convert to any other.

http://notepad-plus-plus.org/

I use Notepad++ it's meant for coding but it's not an IDE and works great for what you're talking about too.
Advertisement

All of the following should support the features you desire (in order of my preference):

  • Sublime (not free, but more than worth the $60)
  • TextWrangler (free, Mac only)
  • GVIM/MacVim (free, per-platform distributions, all the power of vim + a friendly GUI)
  • Notepad++ (free, Windows only)

Tristam MacDonald. Ex-BigTech Software Engineer. Future farmer. [https://trist.am]

Programmer's Notepad 2 I think also supports those features, but I haven't used it for over a year.

- It should detect which line endings are used(+show which type and if its mixed up) and if I add some more it should use the same as already there.

Stupid question, does any editor actually not attempt to fix mixed newlines? Given when saving they just rewrite the entire file and most likely they use an internal representation completely different from the raw blob that's the original file (e.g. storing individual lines instead of a continuous block of text).

Don't pay much attention to "the hedgehog" in my nick, it's just because "Sik" was already taken =/ By the way, Sik is pronounced like seek, not like sick.

Stupid question, does any editor actually not attempt to fix mixed newlines?

Most editors offer the option to "preserve line endings". On some editors that means normalising it based on the first/most-common line ending in the file, but in others it literally means to leave each existing line ending as it is.

I'm honestly not sure what good a mixed-line-ending text file is, but I guess someone needed it once upon a time...

Tristam MacDonald. Ex-BigTech Software Engineer. Future farmer. [https://trist.am]

Advertisement

Hex editors would preserve the differing line-endings. wink.png

I'm honestly not sure what good a mixed-line-ending text file is, but I guess someone needed it once upon a time...

And I have now answered my own question: source patches.

If you have people on multiple platforms committing to the same git repository, chances are they have accidentally introduced multiple line endings. When you go to create a patch, you don't want your editor to change potentially thousands of line endings, or your resulting patch will be ridiculous.

(this is however a good argument for enforcing consistent line endings at the repository level)

Tristam MacDonald. Ex-BigTech Software Engineer. Future farmer. [https://trist.am]

Fortunately there are hooks to do that kind of thing for many if not most source control systems now. Ex: with git you can enable CRLF conversion with git config --global core.autocrlf true and/or check in a .gitattributes file. github has article dealing with line endings.

I use an ancient version of http://www.ultraedit.com (version 8.20a) which does everything you've listed. Unfortunately I can't recommend more modern versions because I have not had a good track record with them. There always seemed to be some show-stopper bug that made them unusable for me. However, I haven't found anything more comfortable for me than 8.20a. I did try both Notepad++ and Sublime for a month each but neither of them stuck.

This topic is closed to new replies.

Advertisement