![]() If you’d like to open tag list on right, add this line to ~/.vimrc: let Tlist_Use_Right_Window = 1 For a full list of tag list key bindings, check out this blog. Pressing on a function name in the tag list shows the function signature. Use to switch between windows, to jump to tag when the cursor is over a word, and to go back. In MacVim, type :TlistToggle to open the tag list. nnoremap :! /opt/local/bin/ctags -R -python-kinds=-i *.py In ~/.vimrc, bind F8 to ctags command so we can re-generate tags on the fly. To see what else can be skipped, type: $ ctags -list-kinds=python The following command has ctags skip indexing python import statements. This is not within the scope of this blog but you can find more details here.Ĭtags can be configured to skip indexing certain types of code. You can either rename your “tags” directory to something else, or change the location where the tags file will be generated. Please notice: if you already have a directory with a exact same name as “tags” under “my_django_project”, you will get a “ctags: Failure on attempt to read file : Is a directory” error message. For example, here we generate a tags file for all python source code in the “my_django_project” directory and its sub-directories. Run ctags on your project folder to generate a tags file which contains locations of classes, members, and functions in your project. Copy taglist.vim to ~/.vim/pluginĪdd these two lines in ~/.vimrc to turn on file type detection. Wmin_note: tried successful with brew install crags, also follow the second articleĭownload here. ![]() If $tabs & ] thenĮxec "$binary" -g $opts -remote-tab-silent $ĬTags and Tag list give you an outline of classes, members, and functions in a left-side panel. tabs= trueĪnd replace the if structure at the bottom of the file with the following: # Last step: fire up vim. You might want to put the newly the opened file in a new tab.Īdd the following line at the top of the file below the comments. Here are some other settings for tab, indent, search, and line numbers: set tabstop=4īy default, “vi a_new_file” in terminal will open a new MacVim window. For some people, if macvim cannot find mustang, you might need to rename Mustang.vim to mustang.vim.)Īs for font, I prefer Monaco in size 12. (Mustang2 is another great color scheme with dark background. You can switch among dark, light, and blue themes by typing :LuciusLight, :LuciusDark, and :LuciusBlue individually in MacVim. vimrc to turn on syntax highlighting and set color scheme: $ mv lucius.vim ~/.vim /colors This color scheme also supports light and blue themes. The Lucius color scheme with dark background is amazingly beautiful. Download the *.vim file, and put it to the ~/.vim/colors directory. Then, go here for a list of color schemes. To install a color scheme, first, create a directory: $ mkdir ~/.vim /colors Light background could put a strain on my eyes after staring at screen more than one hour. I found dark background is easier for my eyes. The default MacVim color scheme isn’t that appealing. ![]() To test if MacVim has python integrated, type :python print "Hello, world!" To install MacVim, type: $ open MacVim /build/ReleaseĪnd drag the MacVim icon into your /Applications folder.Īdd the following to ~/.profile or ~/.bash_profile. configure - enable -pythoninterp -with-macsdk=10.6 Option 2: “Make” your own $ git clone git: //github. $ sudo port install macvim +cscope +python26 MacVim as Python IDE Install MacVim with PythonĮither of the following two options can be used to install MacVim. I’d try my best to give credit back to the authors by adding links to their original sources.) (Disclaimer: In order to put together information from all different sources, I shamelessly copied/pasted content from other blogs. This blog is to record what steps I took to set up my own MacVim with Python. I’ve been going through these excellent articles this weekend. There are already tons of blogs about setting up vim for Python programming.
0 Comments
Leave a Reply. |