atom python3 环境配置

script 插件安装:

cmd + i 运行python

默认运行 Python 代码会用 python 命令,这会是系统自带的 python2,我想默认用 python3 运行代码,所以做了一点点 Hack,编辑文件:

Python
~/.atom/packages/script/lib/grammars.coffee
1
~ / . atom / packages / script / lib / grammars . coffee

 

搜索 Python,然后按下面代码修改:

Python
Python: "Selection Based": command: "python3" args: (context) -> ['-u', '-c', context.getCode()] "File Based": command: "python3" args: (context) -> ['-u', context.filepath]
1
2
3
4
5
6
7
   Python :
     "Selection Based" :
       command : "python3"
       args : ( context )    -> [ '-u' , '-c' , context . getCode ( ) ]
     "File Based" :
       command : "python3"
       args : ( context ) -> [ '-u' , context . filepath ]

 

command 原来是 python,这里我换成了 python3。这样再次运行 python 代码的时候就可以使用 python3 了,不过下回升级了 script 这个包以后应该会覆盖掉我的修改。或者也可以试一下其它的 packge,比如还有一个包叫 atom-runner。

 

hydrogen创建交互式的命令行

安装hydrogen

Python
apm install hydrogen pip3 install jupyter python3 -m ipykernel install --user
1
2
3
apm install hydrogen
pip3 install jupyter
python3 - m ipykernel install -- user

 

cmd+b 获取源码

cmd + 鼠标 获取源码

个人 自定义 配置:

CSS
/* * Your Stylesheet * * This stylesheet is loaded when Atom starts up and is reloaded automatically * when it is changed and saved. * * Add your own CSS or Less to fully customize Atom. * If you are unfamiliar with Less, you can read more about it here: * http://lesscss.org */ /* * Examples * (To see them, uncomment and save) */ // style the background color of the tree view .tree-view { // background-color: whitesmoke; } // style the background and foreground colors on the atom-text-editor-element itself atom-text-editor { // color: white; // background-color: hsl(180, 24%, 12%); } // style UI elements inside atom-text-editor atom-text-editor .cursor { // border-color: red; } .script-view .line { font-size: 14px; font-family: Monaco; line-height: 1.3; font-weight: lighter; }
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
/*
* Your Stylesheet
*
* This stylesheet is loaded when Atom starts up and is reloaded automatically
* when it is changed and saved.
*
* Add your own CSS or Less to fully customize Atom.
* If you are unfamiliar with Less, you can read more about it here:
* http://lesscss.org
*/
 
 
/*
* Examples
* (To see them, uncomment and save)
*/
 
// style the background color of the tree view
.tree-view {
   // background-color : whitesmoke ;
}
 
// style the background and foreground colors on the atom-text-editor-element itself
atom-text-editor {
   // color : white ;
   // background-color : hsl ( 180, 24%, 12% ) ;
}
 
// style UI elements inside atom-text-editor
atom-text-editor .cursor {
   // border-color : red ;
}
 
.script-view .line {
   font-size : 14px ;
   font-family : Monaco ;
   line-height : 1.3 ;
   font-weight : lighter ;
}
Python
# Your keymap # # Atom keymaps work similarly to style sheets. Just as style sheets use # selectors to apply styles to elements, Atom keymaps use selectors to associate # keystrokes with events in specific contexts. Unlike style sheets however, # each selector can only be declared once. # # You can create a new keybinding in this file by typing "key" and then hitting # tab. # # Here's an example taken from Atom's built-in keymap: # # 'atom-text-editor': # 'enter': 'editor:newline' # # 'atom-workspace': # 'cmd-shift-p': 'core:move-up' # 'cmd-p': 'core:move-down' # # You can find more information about keymaps in these guides: # * http://flight-manual.atom.io/using-atom/ps/basic-customization/#customizing-keybindings # * http://flight-manual.atom.io/behind-atom/ps/keymaps-in-depth/ # # If you're having trouble with your keybindings not working, try the # Keybinding Resolver: `Cmd+.` on macOS and `Ctrl+.` on other platforms. See the # Debugging Guide for more information: # * http://flight-manual.atom.io/hacking-atom/ps/debugging/#check-the-keybindings # # This file uses CoffeeScript Object Notation (CSON). # If you are unfamiliar with CSON, you can read more about it in the # Atom Flight Manual: # http://flight-manual.atom.io/using-atom/ps/basic-customization/#configuring-with-cson '.platform-win32, .platform-linux': 'alt-f1': 'tree-view:reveal-active-file' '.platform-linux, .platform-linux .command-palette atom-text-editor': 'cmd-shift-a': 'command-palette:toggle' '.platform-linux': 'cmd-shift-n': 'fuzzy-finder:toggle-file-finder' '.platform-linux atom-text-editor': 'cmd-alt-shift-n': 'symbols-view:toggle-file-symbols' 'body': 'cmd-f4': 'core:close' 'body .native-key-bindings': 'alt-j': 'native!' '.platform-win32 atom-text-editor, .platform-linux atom-text-editor': 'alt-j': 'find-and-replace:select-next' 'atom-workspace atom-text-editor:not([mini])': 'cmd-d': 'editor:duplicate-lines' 'atom-text-editor:not([mini])': 'cmd-y': 'editor:delete-line' 'atom-text-editor': 'cmd-w': 'editor:select-to-end-of-word' '.platform-darwin atom-text-editor[data-grammar~=python]:not(.mini)': 'cmd-b': 'autocomplete-python:go-to-definition'
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
# Your keymap
#
# Atom keymaps work similarly to style sheets. Just as style sheets use
# selectors to apply styles to elements, Atom keymaps use selectors to associate
# keystrokes with events in specific contexts. Unlike style sheets however,
# each selector can only be declared once.
#
# You can create a new keybinding in this file by typing "key" and then hitting
# tab.
#
# Here's an example taken from Atom's built-in keymap:
#
# 'atom-text-editor':
#   'enter': 'editor:newline'
 
#
# 'atom-workspace':
#   'cmd-shift-p': 'core:move-up'
#   'cmd-p': 'core:move-down'
#
# You can find more information about keymaps in these guides:
# * http://flight-manual.atom.io/using-atom/ps/basic-customization/#customizing-keybindings
# * http://flight-manual.atom.io/behind-atom/ps/keymaps-in-depth/
#
# If you're having trouble with your keybindings not working, try the
# Keybinding Resolver: `Cmd+.` on macOS and `Ctrl+.` on other platforms. See the
# Debugging Guide for more information:
# * http://flight-manual.atom.io/hacking-atom/ps/debugging/#check-the-keybindings
#
# This file uses CoffeeScript Object Notation (CSON).
# If you are unfamiliar with CSON, you can read more about it in the
# Atom Flight Manual:
# http://flight-manual.atom.io/using-atom/ps/basic-customization/#configuring-with-cson
'.platform-win32, .platform-linux' :
   'alt-f1' : 'tree-view:reveal-active-file'
 
'.platform-linux, .platform-linux .command-palette atom-text-editor' :
   'cmd-shift-a' : 'command-palette:toggle'
 
'.platform-linux' :
   'cmd-shift-n' : 'fuzzy-finder:toggle-file-finder'
 
'.platform-linux atom-text-editor' :
   'cmd-alt-shift-n' : 'symbols-view:toggle-file-symbols'
 
'body' :
   'cmd-f4' : 'core:close'
 
'body .native-key-bindings' :
   'alt-j' : 'native!'
 
'.platform-win32 atom-text-editor, .platform-linux atom-text-editor' :
   'alt-j' : 'find-and-replace:select-next'
 
'atom-workspace atom-text-editor:not([mini])' :
   'cmd-d' : 'editor:duplicate-lines'
 
'atom-text-editor:not([mini])' :
   'cmd-y' : 'editor:delete-line'
 
'atom-text-editor' :
   'cmd-w' : 'editor:select-to-end-of-word'
 
 
'.platform-darwin atom-text-editor[data-grammar~=python]:not(.mini)' :
     'cmd-b' : 'autocomplete-python:go-to-definition'

 

 

 

 




你可能感兴趣的:(atom python3 环境配置)