Welcome to our community

Be a part of something great, join today!

LaTex-suite for vim: install and config problems

DeusAbscondus

Active member
Jun 30, 2012
176
Hi folkss, Just wondering if somone reading this might have been through the process of integrating vim and latex via the vim add-on: latex-suite.

Despite my having tried to follow the advice given by the maintainer at A (very) quick introduction to Latex-Suite

i am still struggling, after days, to get it running.

Any kind soul able to help me uncoil this thing!

Thanks
D'Abs
 

Sudharaka

Well-known member
MHB Math Helper
Feb 5, 2012
1,621
Hi folkss, Just wondering if somone reading this might have been through the process of integrating vim and latex via the vim add-on: latex-suite.

Despite my having tried to follow the advice given by the maintainer at A (very) quick introduction to Latex-Suite

i am still struggling, after days, to get it running.

Any kind soul able to help me uncoil this thing!

Thanks
D'Abs
Hi DeusAbscondus, :)

What exactly is your problem when running VIM-LaTeX? Did you follow the instructions >>here<< when installing it?
 

DeusAbscondus

Active member
Jun 30, 2012
176
Hi DeusAbscondus, :)

What exactly is your problem when running VIM-LaTeX? Did you follow the instructions >>here<< when installing it?
Thanks for the response Sudharaka.
I have tried to follow the documentation but I fear the files may have been placed in the wrong directories and the more I look it, the less clearly I see it.

But I have:
1. successfully downloaded the plugin and vim
2. created .vimrc and .vim files and then edited them according to the docs; I have all these files, plus the plugin plus the docs in a folder called $HOME .... /VIM
3. i have extracted the plugin to /VIM/.vim/ , which looks like this:
Code:
godfreysown .vim # dir
bibtex.vim	   envmacros.vim       outline.py	    texproject.vim
bibtools.py	   folding.vim	       packages		    texrc
brackets.vim	   ftplugin	       packages.vim	    texviewer.vim
compiler.vim	   macros	       projecttemplate.vim  version.vim
custommacros.vim   main.vim	       pytools.py	    wizardfuncs.vim
diacritics.vim	   mathmacros-utf.vim  smartspace.vim
dictionaries	   mathmacros.vim      templates.vim
elementmacros.vim  multicompile.vim    texmenuconf.vim
4. I have placed the dir /templates in /VIM/ftplugin/latex-suite

I don't know what else I've missed.
I hope this helps you help me, but I don't want to become a pest with this: I just hoped that you might be able to see something obvious that I have done wrong, not done at all etc.

Thanks again,
D'abs
 

Bacterius

Well-known member
MHB Math Helper
Jan 26, 2012
644
[JUSTIFY]I don't think you are supposed to literally create a folder called \$HOME. \$HOME refers to your home directory, which for linux is /home/username/ and for Windows is generally C:\Users\username\

Are you having issues running vim under Windows or having issues installing the LaTeX suite? For that matter, what is your OS?[/JUSTIFY]
 

DeusAbscondus

Active member
Jun 30, 2012
176
[JUSTIFY]I don't think you are supposed to literally create a folder called \$HOME. \$HOME refers to your home directory, which for linux is /home/username/ and for Windows is generally C:\Users\username\

Are you having issues running vim under Windows or having issues installing the LaTeX suite? For that matter, what is your OS?[/JUSTIFY]
O, the $/HOME is just short hand in linux for everything in the pathway before the bit you are referring to.

I'm running Linux Mint
Trying to jump into vim but would love to be using latex to "do some sums" while cutting my teeth with vim (and linux command line computing for that matter, at which I'm a total newb)
 

Ackbach

Indicium Physicus
Staff member
Jan 26, 2012
4,192
[JUSTIFY]I don't think you are supposed to literally create a folder called \$HOME. \$HOME refers to your home directory, which for linux is /home/username/ and for Windows is generally C:\Users\username\

Are you having issues running vim under Windows or having issues installing the LaTeX suite? For that matter, what is your OS?[/JUSTIFY]
O, the $/HOME is just short hand in linux for everything in the pathway before the bit you are referring to.

I'm running Linux Mint
Trying to jump into vim but would love to be using latex to "do some sums" while cutting my teeth with vim (and linux command line computing for that matter, at which I'm a total newb)
Hmm. I've always heard what Bacterius said; your comment about $HOME, DeusAbscondus, doesn't sound right to me. And if you put things in the wrong directory, that would certainly explain things not working.
 

DeusAbscondus

Active member
Jun 30, 2012
176
Hmm. I've always heard what Bacterius said; your comment about $HOME, DeusAbscondus, doesn't sound right to me. And if you put things in the wrong directory, that would certainly explain things not working.
I mispoke: you are both right.
What I meant to say is that I have created a dircectory:
~/home/my_homedirectory/VIM/

I am new to Linux and thought I had seen
$HOME used as shorthand for ~/home/home_dircectory/...
 

Evgeny.Makarov

Well-known member
MHB Math Scholar
Jan 30, 2012
2,492
What I meant to say is that I have created a dircectory:
~/home/my_homedirectory/VIM/

I am new to Linux and thought I had seen
$HOME used as shorthand for ~/home/home_dircectory/...
I can't help you with vim, but ~/home/my_homedirectory/VIM/ does not sound right either. The tilde ~ is a synonym for $HOME. I have

Code:
$ echo ~
/home/emakarov
$ echo $HOME
/home/emakarov
So the directory should be ~/VIM or $HOME/VIM.

I know some people here like vim, and I myself used it (or vi) 25 years ago or so. I know it has efficient and flexible commands such as "delete everything up to the next `.'". But having separate command and text entry modes... I can't understand this. We could as well go back to ed and imagine the current line and the cursor position in our heads instead of seeing it on the screen.

I personally use Emacs because, even though it has weird shortcuts, it is immensely and easily customizable and is easy to turn into a completely standard text editor. It has an excellent LaTeX support through AUCTeX, where formulas can even be shown as pictures right in the editor. I got stuck with Emacs for many years now, but there may be equally good and more recent alternatives, such as Eclipse.

Edit: There is an anecdote about a user of a vim-like editor who opened a file and, having forgotten that he was in the command mode, typed "edit". It was interpreted in the following way. The letter "e" selected everything, "d" deleted the selection, "i" entered the insertion mode and "t" inserted "t". The user ended up with a single "t" instead of the original file content.
 
Last edited:

Bacterius

Well-known member
MHB Math Helper
Jan 26, 2012
644
[JUSTIFY]TexMaker is also pretty decent as a GUI LaTeX editor. But this is a bit off-topic.

On Linux Mint my vim files are in /home/ray/.vim/ (aka ~/.vim/). That said I've only ever put syntax files there, nothing more complicated.[/JUSTIFY]
 

DeusAbscondus

Active member
Jun 30, 2012
176
[JUSTIFY]TexMaker is also pretty decent as a GUI LaTeX editor. But this is a bit off-topic.

On Linux Mint my vim files are in /home/ray/.vim/ (aka ~/.vim/). That said I've only ever put syntax files there, nothing more complicated.[/JUSTIFY]
Thanks yeah, I like texmaker too, but I am on a mission to learn either Emacs (which I'm considering after reading Evgeny's post) or Vim, so I want to spend as much time as possible in a good editor doing my maths, so that i work on both maths and editing and latex skills all at once.

- - - Updated - - -

I can't help you with vim, but ~/home/my_homedirectory/VIM/ does not sound right either. The tilde ~ is a synonym for $HOME. I have

Code:
$ echo ~
/home/emakarov
$ echo $HOME
/home/emakarov
So the directory should be ~/VIM or $HOME/VIM.

I know some people here like vim, and I myself used it (or vi) 25 years ago or so. I know it has efficient and flexible commands such as "delete everything up to the next `.'". But having separate command and text entry modes... I can't understand this. We could as well go back to ed and imagine the current line and the cursor position in our heads instead of seeing it on the screen.

I personally use Emacs because, even though it has weird shortcuts, it is immensely and easily customizable and is easy to turn into a completely standard text editor. It has an excellent LaTeX support through AUCTeX, where formulas can even be shown as pictures right in the editor. I got stuck with Emacs for many years now, but there may be equally good and more recent alternatives, such as Eclipse.

Edit: There is an anecdote about a user of a vim-like editor who opened a file and, having forgotten that he was in the command mode, typed "edit". It was interpreted in the following way. The letter "e" selected everything, "d" deleted the selection, "i" entered the insertion mode and "t" inserted "t". The user ended up with a single "t" instead of the original file content.
Yeah, I like that! Vim is entirely new to me, as is serious text editing of any kind (beyond the experience I have had as a teacher with windows progs like Word and such like) so, I am happy to get all the input on this that others have to offer.

I just downloaded and installed puppy linux, which doesn't seem to have Vim in its repos (not that it would be a problem to find it elsewhere) but Emacs is there, so I might give it a go.

The strongest argument for switching? you mentioned the latex support! which is what I wanted most.

Thanks for the suggestions,
D'abs
 

DeusAbscondus

Active member
Jun 30, 2012
176
[JUSTIFY]I don't think you are supposed to literally create a folder called \$HOME. \$HOME refers to your home directory, which for linux is /home/username/ and for Windows is generally C:\Users\username\

Are you having issues running vim under Windows or having issues installing the LaTeX suite? For that matter, what is your OS?[/JUSTIFY]
LInux MInt 14 (Nadia)
On Dual Core 1.37
4GB memory
 

dwsmith

Well-known member
Feb 1, 2012
1,673
Post your ~/.vimrc setup
 

DeusAbscondus

Active member
Jun 30, 2012
176
Thanks David, sorry about missing this response of yours.
Vim is working like a charm for me, in command line.
But do you think I can find the 'rc" file!!!!

It just doesn't seem to be there.

I did, however, find this and thought I would try your patience by sending it in case it provoked any other helpful suggestions on your part.

Thanks,
D'abs
PS: I'm a noob to CLI in Linux and am on a rather steep learning curve;
but I am improving; so there is hope there that I will soon look back and see these current problems in perspecitve: ie: as piffling

Cheers

Code:
^[[?1050h^[[?1h^[=^[[1;24r^[[?12;25h^[[?12l^[[?25h^[[27m^[[m^[[H^[[2J^[[?25l^[[24;1H".viminfo" 712L, 9554C^[[1;1H^[[34m# This viminfo file was generated by Vim 7.3.
# You may edit it if you are careful!

# Value of 'encoding' when this file was written^[[m
*encoding=utf-8


^[[34m# hlsearch on (H) or off (h):^[[m
^[[33m~h^[[m
^[[34m# Last Search Pattern:^[[m
^[[33m~Msle0~/^[[m\<so\>

^[[34m# Last Substitute String:^[[m
^[[33m$^[[m

^[[34m# Command Line History (newest to oldest):^[[m
^[[33m:^[[mq!
^[[33m:^[[mwq
^[[33m:^[[mq
^[[33m:^[[mhelp hotkeys
^[[33m:^[[mhelp alias
^[[33m:^[[mhelp()
^[[33m:^[[mwq!^[[24;63H1,1^[[11CTop^[[1;1H^[[?12l^[[?25h^[[?25l^[[24;1HType  :quit<Enter>  to exit Vim^[[24;63H^[[K^G^[[24;63H1,1^[[11CTop^[[1;1H^[[?12l^[[?25h^[[?25l^[[1;23r^[[1;1H^[[11M^[[1;24r^[[13;1H^[[33m:^[[m::
^[[33m:^[[m:
^[[33m:^[[ms
^[[33m:^[[m`
^[[33m:^[[mhelp readonly
^[[33m:^[[mw
^[[33m:^[[msave
^[[33m:^[[mhelp help
^[[33m:^[[mchapter
^[[33m:^[[mhead
^[[33m:^[[mheading^[[24;1H^[[K^[[24;63H12,0-1^[[9C1%^[[1;1H^[[?12l^[[?25h^[[?25l^[[24;1HType  :quit<Enter>  to exit Vim^[[24;63H^[[K^G^[[24;63H12,0-1^[[9C1%^[[1;1H^[[?12l^[[?25h^[[?25l^[[24;64H3,1  ^[[2;1H^[[?12l^[[?25h^[[24;1H^[[?1l^[>^[[?1049lVim: Caught deadly signal HUP
Vim: Finished.
^[[24;1H
~                                                                                                                 
~                                                                                                                 
~                                                                                                                 
                                                                                                11,13-14      All
 

Bacterius

Well-known member
MHB Math Helper
Jan 26, 2012
644
Files beginning with a dot are hidden by default in Linux. Try typing this in the command-line:

cat ~/.vimrc

Do you see anything? If so there should be an option to display hidden files in your file explorer.

If not, I'm not sure but I think some vim installations do not come with a .vimrc, and you have to create it yourself (and you can add your customizations in there). Otherwise, it might be in a slightly different location e.g. ~/.vim/.vimrc, etc.. under Mint though it should be under ~/ as I have the same OS as you.
 

DeusAbscondus

Active member
Jun 30, 2012
176
You are dead right: I did some research elsewhere and discovered that mint vim doesn't install a .vimrc (curious, huh?)
Anyway, I will file this away in a little folder I have reserved for same, and when it comes time to have another shot at building latex for vim, it'll be there to offer guidance.

(Right now I'm concentrating on maths with pen and paper to try to save my butt in this course you were helping me with earlier concerning taylor series)



Files beginning with a dot are hidden by default in Linux. Try typing this in the command-line:

cat ~/.vimrc

Do you see anything? If so there should be an option to display hidden files in your file explorer.

If not, I'm not sure but I think some vim installations do not come with a .vimrc, and you have to create it yourself (and you can add your customizations in there). Otherwise, it might be in a slightly different location e.g. ~/.vim/.vimrc, etc.. under Mint though it should be under ~/ as I have the same OS as you.
 

dwsmith

Well-known member
Feb 1, 2012
1,673
I am not david if you were referring to me and that isn't your vimrc.

In linux, gksudo leafpad(gedit) ~/.vimrc.

I would also recommend using latexmk.

You now need to setup your vimrc for latex.

Code:
set nocompatible 
filetype plugin on 
set grepprg=grep\ -nH\ $* 
filetype indent on 
let g:tex_flavor='latex'  
let g:Tex_DefaultTargetFormat = 'pdf' 
let g:Tex_CompileRule_pdf = 'latexmk -pdf -f $*' 
set iskeyword+=:
The above will compile your file with latexmk.

Then you need to set your .latexmkrc

Now do gksudo leafpad(gedit) ~/.latexmkrc

Code:
$pdf_mode = 1;
$pdflatex = 'pdflatex -interaction=nonstopmode -file-line-error -synctex=1';
Now \ll should compile your file with latexmkrc. I no longer use Vim so you may need to edit something to get it to work but this is the general idea.

The reason you should use latexmk though is because it runs latex as many times as needed to get the references and citations right.

Note:

synctex allows forward and inverse searching if your pdf viewer is compatible (so get one that is). You can hold shift and left click the pdf and you will jump to that spot in the tex file. This is great when you are writing pdfs that have a lot of pages.

Also, depending on what you do you may need to add --shell-escape or --enable-write18 to this line let g:Tex_CompileRule_pdf = 'latexmk -pdf -f $*'
 
Last edited:

dwsmith

Well-known member
Feb 1, 2012
1,673
If you decide on emacs, your .emacs file should like this:
here is mine You will see I have load paths of ~/.emacs.d/elpa and ~/.emacs.d/plugins You have to put the dot el in there and byte compile for the plugins and elpa is done through package list packages
Code:
;; Copy and paste between Emac instances                                            
(setq x-select-enable-clipboard t)
(setq interprogram-paste-function 'x-cut-buffer-or-selection-value)
;; Disabling autosave                                                               
(setq auto-save-default nil)
;; ========== Enable Line Numbering ==========                                      
(setq line-number-mode t)
(setq column-number-mode t)
;; ========== Set the fill column ==========                                        
(setq default-fill-column 80)
;; ===== Turn on Auto Fill mode automatically in all modes =====                    
;; Auto-fill-mode the the automatic wrapping of lines and insertion of              
;; newlines when the cursor goes over the column limit.                             
;; This should actually turn on auto-fill-mode by default in all major              
;; modes. The other way to do this is to turn on the fill for specific modes        
;; via hooks.                                                                       
(setq auto-fill-mode 1)
;;  Smart line wrapping--wraps word instead of splitting                            
(autoload 'longlines-mode "longlines.el" "Minor mode for editing long lines." t)
(add-hook 'text-mode-hook 'longlines-mode)
;;NOT sure if this line is necessary!                                               
;;  Turn on visual line mode                                                        
(setq line-move-visual t)
;; ========== Prevent Emacs from making backup files ==========             
(setq make-backup-files nil)
;; Adaptive wrap                                                                    
(add-to-list 'load-path "~/.emacs.d/elpa")
(require 'adaptive-wrap)
(when (fboundp 'adaptive-wrap-prefix-mode)
  (defun my-activate-adaptive-wrap-prefix-mode ()
    "Toggle `visual-line-mode' and `adaptive-wrap-prefix-mode' simultaneously."
    (if visual-line-mode
        (adaptive-wrap-prefix-mode 1)
      (adaptive-wrap-prefix-mode -1)))
  (add-hook 'visual-line-mode-hook 'my-activate-adaptive-wrap-prefix-mode))
;; Paren checking                                                                   
(load "paren")
(add-to-list 'load-path "~/.emacs.d/elpa/rainbow-delimiters-20130307.340")
(require 'rainbow-delimiters)
(global-rainbow-delimiters-mode)
(add-hook 'prog-mode-hook 'rainbow-delimiters-mode)
;; ============ AucTex ===========                                                  
(require 'tex-site)
(add-hook 'LaTeX-mode-hook 'turn-on-reftex)
(setq reftex-plug-into-AUCTex t)
(global-font-lock-mode t)
(setq font-lock-maximum-decoration t)
;; ============ Latexmk setup ==============                                     
(defun run-latexmk ()
  (interactive)
  (let ((TeX-save-query nil)
        (TeX-process-asynchronous nil)
        (master-file (TeX-master-file)))
    (TeX-save-document "")
    (TeX-run-TeX "latexmk"
                (TeX-command-expand "latexmk -pdflatex='pdflatex -file-line-error  
                                  -synctex=1' -pdf %O %S" 'TeX-master-file)
                 master-file))
    (if (plist-get TeX-error-report-switches (intern master-file))
        (TeX-next-error t)
      (progn
        (demolish-tex-help)
        (minibuffer-message "latexmk: done."))))

(add-hook 'LaTeX-mode-hook (lambda ()
    (push
     '("Latexmk" "latexmk -pdf %S" TeX-run-TeX nil t
       :help "Run Latexmk on file")
     TeX-command-list)))

;; Set XeTeX mode in TeX/LaTeX                                                      
(add-hook 'LaTeX-mode-hook (lambda()
  (add-to-list 'TeX-command-list '("XeLaTeX" "%`xelatex%(mode)%' %t"
                                   TeX-run-TeX nil t))
  (setq TeX-save-query nil)
  (setq TeX-show-compilation t)))

;; Set okular to open with C-c C-v view option                                      
(defun Okular-make-url () (concat
     "file://"
     (expand-file-name (funcall file (TeX-output-extension) t)
                       (file-name-directory (TeX-master-file))
                       "#src:"
                       (TeX-current-line)
                       (expand-file-name (TeX-master-directory))
                       "./"
                       (TeX-current-file-name-master-relative))))

(add-hook 'LaTeX-mode-hook '(lambda ()
        (add-to-list 'TeX-expand-list
                     '("%u" Okular-make-url))))
(setq TeX-view-program-list
      '(("Okular" "okular --unique %u")))
(setq TeX-view-program-selection '((output-pdf "Okular")))

(custom-set-variables
 ;; custom-set-variables was added by Custom.                                       
 ;; If you edit it by hand, you could mess it up, so be careful.                    
 ;; Your init file should contain only one such instance.                           
 ;; If there is more than one, they won't work right.                               
 '(TeX-PDF-mode t)
 '(TeX-command-list (quote (("Latexmk" "latexmk -pdf %s" TeX-run-TeX nil t
                             :help "Run Latexmk on file")
                            ("XeLaTeX" "%`xelatex%(mode)%' %t"
                             TeX-run-TeX nil t)
                            ("TeX" "%(PDF)%(tex) %`%S%(PDFout)%(mode)%' %t"
                             TeX-run-TeX nil
                             (plain-tex-mode texinfo-mode ams-tex-mode)
                             :help "Run plain TeX")
                            ("LaTeX" "%`%l --jobname=%s %(mode)%' %t"
                             TeX-run-TeX nil (latex-mode doctex-mode) :
                             help "Run LaTeX")
                            ("Makeinfo" "makeinfo %t"
                             TeX-run-compile nil (texinfo-mode)
                             :help "Run Makeinfo with Info output")
                            ("Makeinfo HTML" "makeinfo --html %t"
                             TeX-run-compile nil (texinfo-mode)
                             :help "Run Makeinfo with HTML output")
                            ("AmSTeX" "%(PDF)amstex %`%S%(PDFout)%(mode)%' %t"
                             TeX-run-TeX nil (ams-tex-mode)
                             :help "Run AMSTeX")
                            ("ConTeXt" "texexec --once --texutil %(execopts)%t"
                             TeX-run-TeX nil (context-mode)
                             :help "Run ConTeXt once")
                            ("ConTeXt Full" "texexec %(execopts)%t"
                             TeX-run-TeX nil (context-mode)
                             :help "Run ConTeXt until completion")
                            ("BibTeX" "bibtex %s" TeX-run-BibTeX nil t
                             :help "Run BibTeX")
                            ("View" "%V" TeX-run-discard-or-function t t
                             :help "Run Viewer")
                            ("Print" "%p" TeX-run-command t t
                             :help "Print the file")
                            ("Queue" "%q" TeX-run-background nil t
                             :help "View the printer queue" :visible
                             TeX-queue-command) ("File" "%(o?)dvips %d -o %f "
                                                 TeX-run-command t t
                                                 :help "Generate PostScript file")
                             ("Index" "makeindex %s" TeX-run-command nil t
                              :help "Create index file")
                             ("Check" "lacheck %s"
                              TeX-run-compile nil (latex-mode)
                              :help "Check LaTeX file for correctness")
                             ("Spell" "(TeX-ispell-document \"\")"
                              TeX-run-function nil t
                              :help "Spell-check the document")
                             ("Clean" "TeX-clean" TeX-run-function nil t
                              :help "Delete generated intermediate files")
                             ("Clean All" "(TeX-clean t)"
                              TeX-run-function nil t
                              :help
                              "Delete generated intermediate and output files")
                             ("Other" "" TeX-run-command t t
                              :help "Run an arbitrary command"))))
 '(TeX-newline-function (quote newline-and-indent))
 '(TeX-source-correlate-method (quote synctex))
 '(TeX-source-correlate-mode t)
 '(TeX-source-correlate-start-server t)
 '(TeX-view-program-list (quote (("Okular" "okular -unique %o#src:%n%b"))))
 '(TeX-view-program-selection (quote ((output-pdf "Okular"))))
 '(compilation-auto-jump-to-first-error t)
 '(custom-enabled-themes (quote (deeper-blue)))
 '(inhibit-startup-screen t)
 '(ispell-lazy-highlight nil)
 '(py-shebang-startstring "#!/usr/bin/env ipython")
 '(py-smart-indentation t)
 '(py-split-windows-on-execute-p t)
 '(py-start-run-ipython-shell t)
 '(py-switch-buffers-on-execute-p t)
 '(py-trailing-whitespace-smart-delete-p t)
 '(show-paren-mode t))
(custom-set-faces
 ;; custom-set-faces was added by Custom.                                           
 ;; If you edit it by hand, you could mess it up, so be careful.                    
 ;; Your init file should contain only one such instance.                           
 ;; If there is more than one, they won't work right.                               
 )

;; package list M-x package-list-packages                                           
(require 'package)
(add-to-list 'package-archives '("elpa" . "http://tromey.com/elpa/"))
(add-to-list 'package-archives
             '("marmelade" . "http://marmalade-repo.org/packages/"))
(add-to-list 'package-archives
             '("melpa" . "http://melpa.milkbox.net/packages/"))
 

dwsmith

Well-known member
Feb 1, 2012
1,673
The rest of the .emacs file

Code:
;;  adjust load-path after updating                                                 
(defun package-update-load-path ()
  "Update the load path for newly installed packages."
  (interactive)
  (let ((package-dir (expand-file-name package-user-dir)))
    (mapc (lambda (pkg)
            (let ((stem (symbol-name (car pkg)))
                  (version "")
                  (first t)
                  path)
              (mapc (lambda (num)
                      (if first
                          (setq first nil)
                        (setq version (format "%s." version)))
                      (setq version (format "%s%s" version num)))
                    (aref (cdr pkg) 0))
              (setq path (format "%s/%s-%s" package-dir stem version))
              (add-to-list 'load-path path)))
          package-alist)))


;; ============ Python mode ==========                                              
(add-to-list 'load-path "~/.emacs.d/plugins")
(setq py-install-directory "~/.emacs.d/plugins")
(require 'python-mode)
(global-set-key [f8]      'flymake-mode)


;; Set Ipython as interpreter                                                       
(setq
 python-shell-interpreter "ipython --pylab=qt"
 python-shell-interpreter-args ""
 python-shell-prompt-regexp "In \\[[0-9]+\\]: "
 python-shell-prompt-output-regexp "Out\\[[0-9]+\\]: "
 python-shell-completion-setup-code
 "from IPython.core.completerlib import module_completion"
 python-shell-completion-module-string-code
 "';'.join(module_completion('''%s'''))\n"
 python-shell-completion-string-code
 "';'.join(get_ipython().Completer.all_completions('''%s'''))\n")

;; Flyspell                                                                         
(add-hook 'python-mode-hook 'flyspell-prog-mode)

;; code checking via flymake                                                        
;; set code checker here from "epylint", "pyflakes"                                 
(setq pycodechecker "pyflakes")
(when (load "flymake" t)
  (defun flymake-pycodecheck-init ()
    (let* ((temp-file (flymake-init-create-temp-buffer-copy
                       'flymake-create-temp-inplace))
           (local-file (file-relative-name
                        temp-file
                        (file-name-directory buffer-file-name))))
      (list pycodechecker (list local-file))))
  (add-to-list 'flymake-allowed-file-name-masks
               '("\\.py\\'" flymake-pycodecheck-init)))
 

dwsmith

Well-known member
Feb 1, 2012
1,673
One more useful hint for vim and emacs.

You need to set server mode. For vim, I don't remember but you set it in the ~/.bashrc

At the bottom for emacs, you add:

If you program in python, the following other two alias will be a blessing. I write from the terminal so I use alternate editor. Don't use that if you like the gui.

Code:
# emacs terminal alias                                                              
alias emacs='emacsclient -t --alternate-editor='

# alias ipython                                                                     
alias ipython='ipython --pylab=qt'

# python ipython alias                                                              
alias python='ipython'