Sublime Text remove python new property autocomplete - python

I love sublime text. I know that I can disable autocomplete altogether in the settings, however I just want to disable one of the autocomplete options.
When you type an #property decorator in python you get an autocomplete option called New Property which if selected generates a getter and setter for you. This ends up being more of a pain than a benefit for me. Any ideas about how to remove that autocomplete option?

Sublime Text 2
You can remove Packages/Python/New-Property.sublime-snippet. The Packages directory location depends on the system you are using:
Windows: %APPDATA%\Sublime Text 2\Packages
Linux: ~/.config/sublime-text-2/Packages
OS X: ~/Library/Application Support/Sublime Text 2/Packages
Sublime Text 3
The structure is a little different in Sublime Text 3. Personally I don't use it yet, but this might give you some idea about how to achieve the same result in ST3.
By the way, these solutions are not ideal. When you reinstall or upgrade Sublime Text the snippet will be back. But I'm not aware of any way to disable snippet via user config.

Related

Adding a plugin to Sublime Text 3

My ultimate goal is to be able to execute a single or few lines of code in sublime text 3. I found this partial solution:
Build just one line in Sublime Text 3 - python
The highest rated answer provides a plugin code, but does not explain how to configure a plugin in sublime text editor. I created the code in a plugin file, but not clear how to activate. It says "Hint, make sure python is available on the sublime Text process"- if that means anything.
Any help would be great. Thanks!

Sublime Editor 2: Key-bindings to send command to terminal

I'm very new to Sublime and advanced text editors to be honest and any help/straightening up would be appreciated.
I'd like to set up a key-binding in Sublime Editor 2 that executes a command in Terminal inserting the current file name.
Specifically, I'd like to execute an Rscript that will render the markdown I am working on, i.e. Execute the following file in Terminal (replacing FILE with the filename Sublime is focused on).
Rscript -e "library(rmarkdown);render(*FILE*, "pdf_document")"
I've found a subprocess call that should send a command like this to Terminal.app, but I don't know how to integrate it with Sublime
subprocess.call(['osascript', '-e', 'tell app "Terminal" to do script "Rscript -e "library(rmarkdown);render(*FILE*, "pdf_document")" in window 1'])
Any help or advice would me much appreciated! Thank you!
I'd highly recommend checking out the R-Box plugin from Package Control for working with R. Like many packages, most of the active development work is occurring on the Sublime Text 3 version, so unless there is a really compelling reason to stay with ST2 I strongly suggest you upgrade. There are quite a few reasons to upgrade, which I won't get into here, but suffice it to say that ST3 is fast, stable, and perfectly useable for anyone, and most of all for this particular situations, contains many behind-the-scenes enhancements allowing plugins to do more than ever before.

I need help recognizing files in komodo in order to run them in python

I am just learning python as my first programming language, and I just installed python 3.3, 64 bit on my windows 7 OS.
I installed komodo edit 8.0, and I am trying to print ('Hello world'). I set up the correct path so that I can access python through my command prompt.
From komodo, I saved my helloworld.py file to my desktop.
When I try to run the command prompt, I search for the file, and it says file not found, or file does not exist. I can open the folder from komodo, but it appears that it is empty. When I open the folder directly from my desktop, I see the file is in there, so it seems that komodo is not recognizing it.
How can I get Komodo to recognize my saved file and run it in python? I am very new so please go step by step if you can.
Thank you!
Many of the comments you've received recommend avoiding Komodo IDE. But you're not using Komodo IDE! You are using Komodo Edit, so the comments about IDEs just don't apply.
Sure, you could use Notepad++ or even plain old Notepad, but neither of those offers any real benefit over Komodo Edit. In fact, you would be losing a valuable feature of Komodo (both IDE and Edit version): realtime syntax checking.
I use Komodo IDE and like it quite a lot. If you want to run Python programs inside Komodo and debug them right there, Komodo IDE is a great choice.
One problem may be simply that you're expecting Komodo Edit to offer the same features as Komodo IDE. It doesn't. It's just a very nice editor. You need to run your Python code outside Komodo using the command line or other means. Just open a command prompt, cd to your directory, and type python yourfilename.py.
But you say you already tried that? It must be simply a matter of being in the wrong directory.
If you have your .py file open in Komodo, do a Ctrl+O right there, and the Open File dialog will show you the file's path at the top of the dialog. You can use Alt+D to select the path, and from there you can copy it and paste it into the command line if you need to cd to that directory.
If you'd like to use an interactive debugger (an excellent idea!) without paying for Komodo IDE, you can use PythonWin.
Install Mark Hammond's Python for Windows extensions. Included in this package is PythonWin. You can open your .py file in PythonWin and select File/Debug/Step In to start debugging your code. Then you can use the other commands on the File/Debug menu to step through it. Take note of the F10/F11/etc. keyboard shortcuts which give quicker access to these commands.
Whichever way you do it, I highly recommend using an interactive debugger like this when learning a new language. Being able to stop the code and look at your variables right then and there is a huge improvement over being limited to print statements for debugging.
So I disagree quite strongly with the recommendations against using an IDE like Komodo. The very first thing I look for when I learn a new programming language is an interactive visual debugger. I don't care too much whether that debugger comes packaged as part of an "IDE" or is a standalone debugger, as long as it shows the source code, makes it easy to single step, and shows the variables whenever it's paused.
Ok heres what I personally do.
Open run, type in cmd
Navigate to whatever directory my mypythonfile.py file is
Open whatever text editor you feel like ( personally i use notepad++ because it is NOT an IDE like kodomo, but just a pretty text editor.)
Type python mypythonfile.py and hit enter. This will run the program.
Open mypythonfile.py in text editor program.
Make changes to the python file.
Go back to the cmd window and press arrow up ( to go to the last typed command) and then press enter again, to run the program again.
Repeat steps 6-7 until your program is perfect.
It seems like you are having trouble with the Kodomo IDE instead of the actual learning python process. IDEs are complicated tools with lots of buttons that are scary. Learn the language first, then once you are comfortable there, then maybe you will use an IDE? Or maybe you will just keep using a text editor instead. Thats up to you.

Sublime Editor Plugin Create GUI

I am trying to create a plugin for sublime, with it's own GUI. Whatever I try, it seems Tkinter is not getting what it needs to run. Seems it needs some system variables to be set, which are unset when running a Sublime Text Plugin.
File "/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/lib-tk/Tkinter.py", line 1638, in __init__
baseName = os.path.basename(sys.argv[0])
AttributeError: 'module' object has no attribute 'argv'
Is it possible to pick up the required settings from somewhere?
Is there another approach?
As far as I can see sublimetext has its own python interpreter. And it seems to have overridden some of the default functionality. Argv ( The list of shell variables ) is not one of properties available. However are you sure you should be using Tkinter. I am on linux and I don't think Tkinter is available as a library. Not sure but does sublime build over Tkinter . I have not seen a plugin use it. I think you should look at this question.
How to include third party Python packages in Sublime Text 2 plugins

Vim :colorscheme on Python

I'm using Mac OSX Lion 10.7.2, Terminal.app supports 256 (output of :echo &t_Co).
In my vimrc I have (PATH/TO/vim/vimrc)
syntax on
filetype plugin indent on
set nobackup
When I "vim blah.py" and :colorscheme torte, syntax colors are not loading. For example python keyword doesn't have a proper colors (They have regular text color). That works for .c files but not python.
I updated my syntax/python.vim but still no luck.
Can someone tell me why?
markfw
Your answer is very good but let me just add one thing to it. In your .vimrc instead of adding just
let python_highlight_all=1
you should add it this way
autocmd BufRead,BufNewFile *.py let python_highlight_all=1
This way it only applies to Python file(s).
Hope this help.
if it works in c but not on py, the filetype file and/or syntax file is not at the right location for python.
vim manual should help you, but I also would try :scr command. This lists all the vim script loaded. So you start vim in two different way
vim your.c
vim your.py
and then in each vim session, type :scr. see how the syntax file for C is loaded (it is like chain reaction), and why it doesnt work that way for python may give you clue.
The way that I made it to work (I'm using Terminal) is to have let python_highlight_all = 1
in my ~/.vimrc file and now everything works fine and all objects such as list, tuple, ... are colored.
For more information please look at the syntax/python.vim.
Try to add the following lines to your ~/.vimrc:
set nocompatible
filetype on
syntax enabled
Quit and relaunch Vim or execute :so ~/.vimrc to reload the settings.
nocompatible remove compatibility with the original vi, this is recommended to get a fully functional Vim.
filetype on activate automatic file type detection, this is the option you want for your Python code to be colored.
syntax enabled activate code coloring, but i'm not sure if this is mandatory here.
You can get some more help by typing :help filetype in Vim.

Categories

Resources