Giter VIP home page Giter VIP logo

pdee's Introduction

Put the following into your initialization file:

  (setq py-install-directory "PATH/TO/PYTHON-MODE/")
  (add-to-list 'load-path py-install-directory)
  (require 'python-mode)

;;;;;;;;;

Customize default Python shell as `py-shell-name'

`py-shell-name' might be an installed executable as
shell command `type' would display, but also a
PATH/TO/(I)PYTHON, of a virtualenv for example

To change the Python default shell see also INSTALL

Most python-mode.el commands start with prefix `py-'

`M-x py- TAB'
displays a list of them in completion-buffer.
See also commands list delivered in directory doc.

List virtualenv related `M-x virtualenv- TAB'
resp. Pymacs commands `M-x pymacs-'

Commands related to a specific shell start with
it's name as `ipython-complete'.
Open an installed shell by

M-x SHELL

With prefix C-u user is prompted to specify a PATH-TO-LOCAL-SHELL
Also evaluating

(py-shell nil DEDICATED PATH-TO-LOCAL-SHELL)

if DEDICATED is set to `t', shell will get an unique name.

Install a local shell by evaluating

(defun MY-LOCAL-SHELL ()
  (interactive)
  (py-shell nil DEDICATED PATH-TO-LOCAL-SHELL))

;;;;;;;;;

When code is executed from current buffer, either

- python-mode-v5-behavior, a quite simple and effective way.
  Setting `python-mode-v5-behavior-p' to `t' makes it the default.

- if a buffer-file exists and buffer is unchanged, it's file is executed as is.

- in all other cases a temporary file is created.
  Setback: in case of error, returned error code points
  here, i.e. indicated error-line-numbers are not that of
  orginal buffer.

;;;;;;;;;
To enable code auto-completion:

  (setq py-load-pymacs-p t)

To use auto-complete, just prepend the following lines:

  (require 'auto-complete-config)
  (ac-config-default)

or for company:

  (autoload 'company-mode "company" nil t)

If you do not use one of those visual completion interfaces, key bindings exist:
  - C-tab complete symbol
  - f1    show help
  - S-f1  show signature
  - f2    go to

If `py-complete-function' is set, it takes precedence

;;;;;;;;;

smart-operator minor mode

for example with key "+"
inserts " + "

smart-operator extended by augmented-assigments
C-u +
inserts " += "

customizable boolean `py-smart-operator-mode-p'

;;;;;;;;;

Beside common moves like `defun', `statement' specific Python-mode edits are delivered:

`py-expression' and `py-partial-expression'. 

Statement below is considered composed of two `py-expression' 

a = ['spam', 'eggs', 100, 1234]
|_| |_________________________|

Assigment operator and all inside comments is ignored.

`py-partial-expression' would match six sections

 a = ['spam', 'eggs', 100, 1234]
|_|   |_____|  |____| |__| |__|
     |_________________________|

When traversing code, `py-partial-expression' climbs down and up
all levels encountered, i.e. at opening `[' `py-expression' would return ['spam', 'eggs', 100, 1234], while one char behind at `''
it yields `'spam','

- py-sexp-function, 
  When set, it's value is called instead of `forward-sexp', `backward-sexp
  Choices are py-partial-expression, py-expression, default nil

;;;;;;;;;

Moving, copying, deleting

When moving over or mark code, commands with suffix
"-bol" take the correspond beginning of line as start
resp. end. Commands without that suffix take the
indentation at the beginning resp. the last printable
character the end - see in menu PyEdit whats implemented.

While commands "py-beginning..." resp. "py-end..." compute the context, 
selecting the corresponding beginning or end
new "py-up...", "py-down..." jump regexp-based to the 
next element in buffer.
Listed in PyMenu. 

;;;;;;;;;

Customize boolean `py-set-fill-column-p'

If `t', enables use Python specific `fill-column' according to

`py-docstring-fill-column', default is 72

and `py-comment-fill-column, default is 79

Comment- and docstring settings might be disabled by
any non-integer value, which means: do not use a
different value of `fill-column' than emacs-wide





pdee's People

Contributors

andreas-roehler avatar gabrielelanaro avatar davidmiller avatar paradoxxxzero avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.