Using Vim as a Python IDE?

I am only just trying to learn Python. Presently using IDLE, but I prefer to edit with Vim. There is a lot of info around on using Vim with Python, but basically all I want to do at the moment is write a bit of test code and then run it through the Python interpreter and get back into Vim after seeing the error messages (;-)) ...I have just been doing a ":!/usr/bin/python %" for that.
Can anyone suggest a more useful Vim addon IDE that is not too convoluted or complicated?

what I used to do was to have a python session running inside screen and mapped some keys to send a selected region to the interpreter. (I took it from some web page, can't remember where.)
I have something like this in my .vimrc:
function Send_to_Screen(text)
if !exists("g:screen_sessionname") || !exists("g:screen_windowname")
call Screen_Vars()
end
echo system("screen -S " . g:screen_sessionname . " -p " . g:screen_windowname . " -X s\
tuff '" . substitute(a:text, "'", "'\\\\''", 'g') . "'")
endfunction
function Screen_Session_Names(A,L,P)
return system("screen -ls | awk '/Attached/ {print $1}'")
endfunction
function Screen_Vars()
if !exists("g:screen_sessionname") || !exists("g:screen_windowname")
let g:screen_sessionname = ""
let g:screen_windowname = "0"
end
let g:screen_sessionname = input("session name: ", "", "custom,Screen_Session_Names")
let g:screen_windowname = input("window name: ", g:screen_windowname)
endfunction
"common send to screen functions
vmap <C-c><C-c> "ry :call Send_to_Screen(@r)<CR>
nmap <C-c>v :call Screen_Vars()<CR>
"python : insert tags and send fns
nmap <C-i><C-p> i#{<CR>#}
nmap <C-c><C-p> ml?#{<CR>jv/#}<CR>k<C-c><C-c>`l
as you can see <C-i><C-p> would insert a couple of tags #{ #} then you write the code in between and, then doing <C-c><C-p> would send everything between the #{ ... #} to python. Very useful when you want to test just some pieces of code, instead if the whole file.

Similar Messages

  • Edit the trackers from a torrent file using vim.

    Hi.
    I constantly need to edit torrent files to change their trackers. So I wrote a vim plugin to handle this.
    The plugin is at http://fma.if.usp.br/~kazuo/torrent.vba
    You need hunnyb (in aur) OR bittorent (the original one, is in extra/bittorent) and a vim compiled with python.
    To use simple install the vba and open a torrent file, in the buffer you see a list of trackers from the torrent file, edit it, one tracker per line with a leading space, and save it, its automatic regenerate the torrent file. (Dont touch the other lines in the buffer)
    This is the first version, please try it and report back.
    The buffer is somewhat more complicated than needed because I like to add other infos to be edited, so I'm using ConfigParser.
    I hope its is useful to someone!
    EDIT:
    New version 0.5.5: Support for tiers. Now its do the correct with tiers, to separate a tier from other use a line containing a '.' (dot) with leading spaces, for example
    [torrent]
    trackers =
    http://tracker.publicbt.com:80/announce
    udp://tracker.publicbt.com:80/announce
    http://tracker.thepiratebay.org/announce
    udp://tracker.thepiratebay.org:80/announce
    http://tracker.openbittorrent.com/announce
    udp://tracker.openbittorrent.com:80/announce
    0.5.6: Tiers now can be separated by empty lines (like utorrent tracker list)
    Last edited by kazuo (2010-05-30 10:06:58)

    I don't think you can because a Photoshop file (PSD) with layers will be flattened when you open up in Photoshop Touch.
    I prepared a Photoshop file with one layer of image, one layer of text over a background using Photoshop CS6 on my Mac Pro and upload the PSD file onto Creative Cloud. I then open this file in Photoshop Touch (on iPad) but it comes out as a single flat layer merging all three layers. Hope this helps.
    Below: 3 layers in Photoshop CS6 (with one layer of text)
    Below: Flattened into one layer in Photoshop Touch..

  • I have an 8 year old eMac G3. It will not start up. I need to erase it before putting it in recycling. Apple refuses to open the case and warns me that I will be shocked if I even try. They say no way to erase hard drive. They say use a hammer. Any ideas?

    I have an 8 year old eMac G3. It will not start up. I need to erase it before putting it in recycling. Apple refuses to open the case and warns me that I will be shocked if I even try. They say no way to erase hard drive. They say use a hammer. Any ideas?

    Hi, no eMacs had G3s, only G4s. Is it maybe an iMac G3?
    If you don't know the model, find the Serial# & use it on one of these sites, but don't post the Serial# here...
    http://www.chipmunk.nl/klantenservice/applemodel.html
    http://www.appleserialnumberinfo.com/Desktop/index.php
    How to find the serial number of your Apple hardware product...
    http://support.apple.com/kb/HT1349
    http://www.ifixit.com/Device/eMac

  • Using export slide show from iphoto, I am trying to create a DVD of photos and vid clips in large format. The vid clips do not work using burn software. Any idea?

    Using export slide show from iphoto, I am trying to create a DVD of photos and vid clips in large format. The vid clips do not work using burn software. Any idea?

    Have used large format, but using the 'burn' software, I am not getting seamless video quality on DVD even though I am burning at 2* speed. Any ideas? Do I need better software? Or is there a problem with the SuperDrive?

  • For the last week or so I have been unable to stream anything using Safari on my Mac. Using Firefox I can; any ideas? ThanksDave

    For the last week or so I have been unable to stream anything using Safari on my Mac. Using Firefox I can; any ideas? Thanks Dave

    Hi RMH1405,
    I apologize, I'm a bit unclear on exactly what kind of streaming you are talking about or what you are seeing when you try to do so in Safari. If the sites in question are Flash-based, you may need to make sure that Flash Player is up to date in Safari, as noted in this article:
    Adobe Flash Player updates available for OS X on December 12, 2014 - Apple Support
    Regards,
    - Brenden

  • Been using iTunes for about 2 years on the same MacBook Pro, just opened it and found everthing's gone. It's as if I'd never used it before. Any ideas, please?

    Been using iTunes for about 2 years on the same MacBook Pro, just opened it and found everthing's gone. It's as if I'd never used it before. Any ideas, please?

    Simply restore from your backup.
    You do have Time Machine running, yes?
    Or you use some other backup program?

  • Using VIM

    I've recently been using VIM via with the GTK gui(gvim) and I fell in love with the editor, but I'd also like to use it in console mode instead of nano. The issues I am having is I do not know the keybindings in order to save ect. I'm use to M$ style keybindings . It's something like Ctrl+X+S? Something like that xD. Odd keybindings. Thanks for my very newbish question

    Gullible Jones wrote:
    test1000 wrote:ofc, unless you learn vim _well_ there is no reason you should use it when there are other, better editors for you out there.
    What better editors?
    i meant better as in 'better if you are used to windows keycombination and typical notepad-like interface and don't want to spend the time learning vim good enough so as to obliverate the necessity for previously mentioned like text-editor'
    then better would be: scite kwrite kate ...
    basically every editor except vim, emacs and nano _almost_ i must make clear.
    but i thought this was obvious. ach. i shall now construct everything i say so as to not leave a shred of possible misunderstanding in the air.

  • I can't get my gmail app to send alerts after doing update. I'm using iphone 5.  Any ideas?

    I can't get my gmail app to send alerts after doing update. I'm using iphone 5.  Any ideas?

    Try the following steps, check whether things are working after each step where appropriate, before trying the next.
        1.    Check AirPlay is turned on on the Apple TV (turn it off and on if it already is)
        2.    Check that both devices are on the same network (Settings > Wifi, on the mobile device and Settings > General > Network, on the Apple TV).
        3.    Restart the Apple TV (Settings > General > Restart).
        4.    Restart the Apple TV by removing ALL the cables for 30 seconds.
        5.    Restart your router. (Also try removing it’s power cord for at least 30 seconds)
        6.    Restart your mobile device.

  • Long time to search in 6 GB file using vim editor

    We have RHEL 5.x in our production setup. There is a 6 GB file which I want to inspect to find a certain string but it is not able to find the string as the vim seems to be hanging for more than 1 hr. Please advice how this searching of a string in a big file can be done. I copied the file into a windows system but Microsoft Wordpad or Microsoft Word is failing to open the file. Or, if there is a tool to open large files in Windows as an alternate would also help.
    I hope my query is clear that how to search a string in a big file using vim editor.
    Please revert with the reply to my query.
    Regards

    Much goes on behind the curtain in VIM.  Loading a huge file can be slow because VIM is watching line numbers, doing syntax highlighting, and making a copy of the file for a backup.  Fortunately, this can be turned off; there is even a VIM plugin:
        performance - does vim read the whole file into memory - Stack Overflow
    But using VIM to search large files does not make sense; that is not what the tool was designed to do.  You may as well complain that VIM makes a very poor toothpick.  It is just the wrong tool for the job.  I would use sed(1) or grep(1) to search for the content.  If you need to see some surrounding lines, you can convince grep(1) to do that.  If you need to edit the file content, sed(1) can do that.
    But my real question is: what in the name of sanity produces one gigantic file that needs editing anyway? 

  • TS4006 i am having problems connecting to wifi at home , i want to do a master reset but cant save to icloud without using wifi ?? any ideas ??

    i am having problems connecting to wifi at home , i want to do a master reset but cant save to icloud without using wifi ?? any ideas ??

    If you can't perform an iCloud backup (which requires wifi), back up to your computer with iTunes.  Connect your phone to your computer, open iTunes, click on the name of your phone in iTunes, go to the Summary tab of your iTunes sync settings and click Back Up Now.
    To troubleshoot your wifi, try unplugging your wireless router for 15 seconds, the plug it back in.  Then go to Settings>General>Reset and tap Reset Network Settings (note: this erases passwords for previously joined networks).  Then rejoin your wifi and see if it works properly now.

  • Using the advanced telemetry Python script (unrecognized signature)

    I am trying to profile an AIR for Mobile project (using AIR 3.5) in Scout. I (apparently) cannot compile the project in Flash Builder because it utilizies CameraRoll. I'm trying to add advanced telemetry using the Python script at https://github.com/adamcath/telemetry-utils
    First, AFAICT that script has typos in it, where tabs and spaces were mixed for indentation. After fixing those (I think), I always get the error:
    "add-opt-in.py", line 158, in <module>
        raise Exception("Bad SWF: Unrecognized signature: %s" % signature)
    Exception: Bad SWF: Unrecognized signature: b'CWS'

    Hi,
       I have converted all space based indentations to tabs in the attached script and it works fine for all the SWFs that I tried.
       Could you please give this a try with your SWFs and let us know if it works ?
       Dowload link - https://docs.google.com/open?id=0B_py8ocVzd4edG51cEN3MkhPbWM
       If it still does not work, can you send us below details and a sample SWF if possible.
           1. OS : Win / Mac version
           2. Version of Python
            3. Compiler / IDE / SDK used to generate the SWF
    Thanks
    Srinivas

  • I Need Python Ideas

    I am learning Python and I want to practice by writing programs, but I can't think of anything to create on that would be useful to anyone else.  Any ideas?
    Last edited by Wintervenom (2008-12-22 16:07:27)

    http://projecteuler.net/
    http://www.pythonchallenge.com/
    First one is more math based and second is similar to notpron.
    But the best thing is to write scripts for automating jobs you do regularly.
    Backup script or something like that..

  • My i phone 4s will let me download free apps but when i try to buy an app it asks for my billing imformation and tells me that the. Imformation i typed in does not mach my bank records. Ive also tried using my wifes. Any ideas

    When i try to buy an app from the app store it ask for my billing imformation and when i type everything in it tells me the imformation does not match my bank records. Ive also tried using my wifes card to buy apps and it says the same thing. Any ideas?

    The Apple Support Communities are an international user to user technical support forum. As a man from Mexico my first language is Spanish. I do not speak English, however I do write in English with the aid of the Mac OS X spelling and grammar checks. I also live in a culture perhaps very very different from your own. When offering advice in the ASC, my comments are not meant to be anything more than helpful and certainly not to be taken as insults.
    Are you putting in the address where the bank sends the monthly statement?
    Apple's servers are very picky about the format of the address. If you live in the USA, then the server is expecting the style that the US Postal Service uses. One way to do this is to use the USPS ZIP Code lookup service;
    https://tools.usps.com/go/ZipLookupAction!input.action
    Enter the address to look up the ZIP code and then copy the exact USPS output into your iTunes account information.

  • Storage values under about this mac displaying incorrectly, but amount of space used IS correct. Any ideas?

    I noticed recently that the "storage" under "about this mac" is displaying incorrectly. It doesn't show the correct values for my photos, videos, and audio files. It classifies this data under "other". I have been searching all over the internet, I went to the Apple genius bar yesterday and they recommended I re-install OSX. I did and it still shows up incorrectly. They were baffled, said they never really came across this issue. I have tried re-indexing spotlight, that didn't seem to help.
    The amount of storage used IS correct. It just doesn't show up under the correct categories in storage, under about this mac. Also, the computer seems to work fine. No real issues. It's a mid 2012 MBP. 500gb hard drive. Most recent OSX is installed.
    I DO NOT think it is local snapshots, cause my backups category is small and the amount of space used and free is correct. I have downloaded omnidisk sweeper to confirm this.
    I have seen a few posts on here and around the web referring to this, but no real answers. I have also reviewed Pondini's info on this to no avail.
    Does anyone have any ideas?!?!

    Also,
    I had installed a version of parallels with windows 7, but deleted it. Would parallels be causing my computer to index incorrectly? I I used appcleaner to delete all the parallels files so I do not have it anymore.

  • My Iphone5 power button seems to be permanently pressed. It will think that it is being held down even though I am not touching it and also turn the screen on when I am not touching it. Very hard to use the phone. Any ideas?

    There is no rhyme or reason to when it does this. Sometimes, it will be fine for a few hours. Sometimes, I can't use the phone as it exists out of apps automatically and consistently comes up with the "slide to power off" screen. It's draining the battery. Apple replaced my screen a few months ago and the problems have only occured since then but they have got progressivly worse. Any ideas before I take it to the genuis bar and get told it's going to cost me an obsence amount of money to fix a problem I haven't caused? No water damage or droppage on the device either and I have a thick case on it. Case doesn't affect/help the problem as well.

    Hi jemerrifield,
    Thank you for using Apple Support Communities.
    From your post I understand that your external display being used with your Mac Pro is flickering along the top of the screen.  I completely understand how this can be frustrating, especially for being a new computer.  I would however like you to follow some troubleshooting steps that will also help determine if the issue is with the display you are using, cables, or the Mac Pro.
    Apple computers: Troubleshooting issues with video on internal or external displays
    Take care,
    Alex H.

Maybe you are looking for

  • How to restore Address Book and then add working iCloud Account?

    OK i'm going insane trying to resolve this one.... all started with a shed load of Duplicates! 3 devices:  MacBook Pro, iMac, iPhone 4S I finally upgraded the MBP to 10.7.2, the iMac already was and the iPhone was already 5.0.1 I've held off moving t

  • Could not complete the paste command because there is not enough memory (RAM)

    Hi, Anybody can help me please? i am getting this message again and again. i tried to restart system and re install Photoshop no luck. "could not complete the paste command because there is not enough memory (RAM)" will be great if i get reply asap.

  • My iMac Screen has become completely pixilated and flashing

    Went to use my computer this morning and after about 5 minutes the screen became completely pixilated.  Shut the computer down and tried to restart and got this. Called apple care but my protection plan has expired, representative was very nice and a

  • WRT110 Admin Set Up Won't Save Settings

    So I go to 192.168.1.1 - I change the router name and set the security settings, I click save settings (on each tab separately).  Once I wait the 15 seconds for it to refresh automatically, it goes back to the page and the settings I put in haven't s

  • Custom Safari Toolbar Buttons Question

    In the resources folder of Safari are the tif files for the Safari toolbar. But even if I replace them with one of my own, specifically the debug one, it still remains the same button and doesn't use the one I replaced it with. I suppose it is cachin