Settings

Theme

Ask HN: What is a good scriptable text editor

8 points by luchadorvader 10 years ago · 17 comments · 1 min read


I'm looking for a good text editor that has a simple and quick scripting capability. I work a lot with text sometimes so I'll write some one off scripts sometimes to edit big files, but other files I'll use Sublime Text to do some manipulations. The problem is that it's API is somewhat restrictive, like if I want a custom input without going in the command prompt then I lose access to the region that I selected. I also have been using Visual Studio Code, but it looks to be a big effort to actually write a small plugin needing stuff like NPM and non-trivial config files. If anyone has any suggestions I would love to hear them.

For context I use Linux.

im_down_w_otp 10 years ago

Emacs. The whole thing is a bunch of running scripts, and you can manipulate all of it almost an way that you like. Add your own, muck with the ones that are there, even screw with things that are actively running.

  • maybeok 10 years ago

    Emacs is nice way to discover live-action coding against a running process. Design time, dev-time, compile-time, and run-time all mesh into one.

    Everybody needs to give a live-action language like Smalltalk or lisp a try at least once.

075 10 years ago

Maybe emacs? I know it's not ass popular as vim, but emacs is made for being extended by elisp.

such_a_casual 10 years ago

> I'm looking for a good text editor that has a simple and quick scripting capability.

Vim and Emacs have neither of these things. They both pose a long and difficult barrier to entry.

However it sounds like you aren't looking for simple and quick. If you are running into limitations on your current editor, then it's time to swallow the pill and dive into one of the behemoths.

I don't know of any text editor that is guaranteed to have less limitations than Sublime Text, but also has a "simple and quick scripting capability".

I would recommend Vim as it's main focus is as a text editor. Emacs tries to do everything, Vim just tries to edit text. Emacs also has a mode that enables Vim key bindings, so if you choose Emacs later, you won't have to start from scratch.

Lastly, Emacs uses a dialect of Lisp for customization. Vim has it's own made up language. So this may be a reason to choose Emacs over Vim.

brudgers 10 years ago

Sed and Awk are the traditional old school tools for scripting edits of large text files. Perl is a more recent option. And there's nothing wrong with using Python or Ruby or whatever.

On the Emacs versus Vim, Emacs is fatter with features by design. Vim is designed to be lighter weight so it can ship on memory constrained systems by default. The Emacs community tends to have a more substantial interest in scripting and customization and one of its features is built in tooling for writing scripts, e.g. the eLisp REPL.

Good luck.

z3t4 10 years ago

Can you explain what you mean with "scripting capability"?

I'm currently developing a native editor in JavaScript (using chromium) where it's very easy to write a "plug-in" in JavaScript.

volaski 10 years ago

vim?

  • nanis 10 years ago

    Compile vim and/or gvim with Perl support, use Vim::X < https://metacpan.org/pod/Vim::X >, and enjoy.

  • perugolate 10 years ago

    +1 especially neovim

    • luchadorvaderOP 10 years ago

      I was hoping for something with GUI because I'm lazy, but I really should stop putting off learning vim :|

      • NetStrikeForce 10 years ago

        Vim is perfect for lazy people. Trust me, I know about laziness :)

        Just picture this: You want to delete one line in your file. With Vim you just press 'dd' (that's 'd' two times). Not impressive, right? But what if you wanted to delete 27 lines? Are you going to select them with your mouse while counting? You might prefer to type '27' and then 'dd'. Done.

        Do you want to jump to line 2135? type :2135 and press enter. What if I want to find a string? /string. Oh, and then I could just press 'n' for the next occurrence.

        I needed years to only grasp a few Vim tricks, but every single one of them is almost mind blowing. I've only find Sublime Text to be a rival, for other reasons (multiple cursors are ideal to trim log files 100x faster while troubleshooting).

      • volaski 10 years ago

        I can understand your reasoning, but once you learn it you'll realize how this is exactly what you've been looking for. For starters, the main concept of Vim is its "Command mode", which is used exactly for the scripting you're talking about.

      • runjake 10 years ago

        Then, gvim?

        • mod 10 years ago

          I doubt that's the kind of gui he wants. Probably file navigation and the like.

_RPM 10 years ago

Vim.

hex13 10 years ago

maybe Atom?

  • _RPM 10 years ago

    Atom runs great if you have an i7 and at least 6 GB of RAM in my experience. However, VIM is the most lightweight amazing editor I've ever used in my time.

Keyboard Shortcuts

j
Next item
k
Previous item
o / Enter
Open selected item
?
Show this help
Esc
Close modal / clear selection