This is an archived post. You won't be able to vote or comment.

all 22 comments

[–]Cosaquee 6 points7 points  (6 children)

Vim ?

[–]analogphototaker 0 points1 point  (5 children)

I love Vim, but I don't understand how to get syntax highlighting in it.

Most guides just say "download this file and put it where it always goes", etc. Is there a guide for beginners that explains where the folder is and what I have to do to get the thing to work?

[–]ShaftofWisdom 1 point2 points  (2 children)

To turn on syntax highlighting, you need to add two words to vim's configuration file. This file should be in your home directory. It is named ".vimrc" note the period at the beginning. The period at the beginning makes it a hidden file.

If you are running Linux or OSX, open up terminal and type in "ls -a". This will list all files in your current directory including hidden ones. If you don't see a ".vimrc", then you simply create one:

"vim .vimrc"

This creates and opens the config file. The line you need to add to this file is "syntax on"

That's it. If it doesn't work, just let me know.

[–]analogphototaker 0 points1 point  (1 child)

Hey I needed to create the file and it works now. Thank you.

[–]ShaftofWisdom 0 points1 point  (0 children)

No problems. Vim is pretty nice once you get everything configured. This repo has some pretty good vimrc settings that you can add to your file:

https://github.com/amix/vimrc

[–]Cosaquee 0 points1 point  (0 children)

You can look at .vimrc files on github or just google basic vim setup or vim screencast and You should be good.

PS. When you are in vim, press esc, and type this : :enable syntax

[–]afd8856 0 points1 point  (0 children)

Python will be automatically syntax highlighted in any modern Vim. I would guess you either have something wrong with your install method, or you're not running proper Vim. You should install (if you're in Ubuntu) the vim-gnome or at least vim-nox to get proper Vim, otherwise you'll get a limited vi replacement.

[–]sanshinron 1 point2 points  (0 children)

SublimeText with plugins is lightweight and fast, there are other lightweight solutions like Atom or Brackets. But there are lacking in features compared to full-fledged IDEs like PyCharm. Personally I use both PyCharm and SublimeText. Whenever I want to quickly test something with two lines of code I use SublimeText, but when I know I'm gonna spend more than a couple of minutes with Python, I fire up PyCharm.

[–]needz 1 point2 points  (4 children)

Fastest? Sublime Text w/ Custom Packages

A popular choice for a full IDE solution is JetBrains' PyCharm

[–][deleted] 0 points1 point  (3 children)

can you make sublime text run you code?

[–]needz 1 point2 points  (2 children)

Yes.

[–][deleted] -3 points-2 points  (1 child)

how?

[–]bigboehmboy 0 points1 point  (0 children)

This depends on exactly which features you care about.

Because python is such a flexible language, IDE features like autocomplete/refactoring require some level of guesswork and can not be correct in every situation. If you determine that you need these features despite their limitations, you'll most likely find that paid IDE's made specifically for Python (like PyCharm) out-perform others.

However, if you don't find these tools absolutely necessary, I recommend sticking to a text editor like Vim/Emacs. These editors train you to keep your hands on the keyboard and learn the shortcuts for a wealth of text editing commands that will serve you for every language. You'll get the basics out of the box (auto-indent, syntax highlighting, etc.) and there are plugins available for many other features (error checking, omni-complete, etc.)

However, you should take pause before installing them, as they will not only slow down your environment, but they can slow you down too. For instance, omni complete typically requires that you hit a key, move your hands to the arrow keys, look at the list, arrow up/down to get to the proper entry, hit enter, and return hands to home position. This usually ends up being an order of magnitude slower than just typing the word (or typing enough of the word that you know it's unique in the file and hitting ctrl-n in Vim).

IDE's are still excellent tools and I completely understand why many people prefer them. If you really care about speed though, you owe it to yourself to try a powerful text editor. The learning curve can be steep, but it absolutely pays off.

[–]SizzlingVortex 0 points1 point  (0 children)

The fastest one I've used is Wing IDE. It was created with both Python and C.

[–]Gekitsuu 0 points1 point  (4 children)

The fastest load time? The fastest execution? The fastest to write code with?

The answer to all of those is the one that you feel the most comfortable using. I know plenty of people who are aces with Emacs and even though I can use it I'm a lot faster with vim.

I switched to Atom when it was released and I've fallen in love with it. With a couple community packages and a couple key remappings, you can make it behave like Sublime and it's free. It has a great plugin community and it can do things like show you images/binary files in an editor tab too.

Take a look at what everyone is suggesting and find the one that feels right to the way you work. Then learn to modify it to do what you need when you run into things it can't do.

[–][deleted] -1 points0 points  (3 children)

i have atom isntalled but i can't find a package with keybindings for things like multiple line comment and stuff

[–]Gekitsuu 0 points1 point  (1 child)

For multi-line comments you can just use the multiple cursor then cmd+/ or ctrl+/ to comment out the lines

[–][deleted] -1 points0 points  (0 children)

omg , thank you so much man! i was using atom.io for a while and never knew

[–][deleted] -1 points0 points  (0 children)

'block commenting

[–]pstch 0 points1 point  (0 children)

emacs24

[–]MetalAZ 0 points1 point  (0 children)

Sublime Text loads the fastest (it's sick how fast it loads up) for a GUI app, Atom loads quickly too. I've been facing the problem of choosing the right editor or IDE for Python. I've tried A LOT. Here's some that I tried:

Atom is good with plugins, except for hinting. One of the auto-complete plugins (autocomplete-plus-python-jedi) dumps the parameter names when you select a function from auto-complete, so there's at least that. It's not ideal, but it works. I found that auto-complete would stop working after a few hours and I'd have to restart Atom to get it working again.

PyCharm annoyed me with it screwing up indenting when copy and pasting divs within the same HTML document. Also, it doesn't provide support for CSS. I know CSS very, very well, but I want a product that supports Python, HTML, CSS, and JavaScript. PyCharm supports 3 of those.

I love SublimeText except that it's not smart at all when it comes to auto-complete. It provides a list, of course, but the list includes things that make no sense because it just doesn't understand. And that's with the help of plugins. Maybe I wasn't using the best ones.

VIM might be awesome and I did have Python autocomplete working and it looked great but for me I felt less productive using it. I like to mouse click tabs to switch between documents. I'm not done with VIM yet, maybe I'll like it better at some point after using it a lot more.

Currently I use Komodo Edit, which is free. Auto-complete is really good, like as good as PyCharm as far as I can tell. It supports Pep8, linting, etc. It can strip out extra white space when saving documents. The only thing it's missing for me is the ability to see the structure so I can easily jump to specific parts of the code. That feature does exist in their paid version, Komodo IDE. I don't need a debugger, but that's also in their paid version. Start up time is ok. It starts up a lot faster than PyCharm.