大家觉得写python,很多符号如果放在键盘按键的下面,写起来会不会轻松很多?

2012-03-28 14:07:38 +08:00
 thedevil7
ps.我用 vim 作为编辑器.
首先,经常用到的符号基本上都要用shift. 例如 " ( ) #
其次,很多 vim 的操作也需要用到shift. 例如 $ ^ shift+>(增加缩进) G
4553 次点击
所在节点    Python
17 条回复
est
2012-03-28 14:42:55 +08:00
LZ的想法很不错。正如 Lisp 速写大牛都配备了印制有 ( 和 ) 的脚踏输入设备。
dofine
2012-03-28 15:06:56 +08:00
脚。。脚踏输入设备??
thedevil7
2012-03-28 15:26:03 +08:00
@est 这个...真的有必要麻...lisp 好像见过, 确实一堆一堆的()
G_virus
2012-03-28 15:38:31 +08:00
我就是被scheme逼得给vim装了surround插件……
thedevil7
2012-03-28 15:54:31 +08:00
@G_virus
我想过用快捷键 ( 对应输入 () 并且光标置于中间.
我尝试了一下: imap ( ()<ESC>i
这样可以成对输入, 但是不能回到 插入模式, 我就不知道为什么了.
thedevil7
2012-03-28 15:55:27 +08:00
@G_virus 因为其实大部分() [] 输入是在 编程的时候
G_virus
2012-03-28 18:04:06 +08:00
@thedevil7 imap会递归定义的吧,我用inoremap试了一下似乎没有问题。
thedevil7
2012-03-28 20:16:59 +08:00
@dofine
我用 vim 的 inoremap 搞定了!
比如, 你要 9 输出 (*) -- inoremap 9 ()i -- * 是当前位置
如果要( 输出 9 -- inoremap ( 9
像是 nomal mode 里面的 $ 我也是 nnoremap 4 $ 再反过来映射 nnoremap $ 4
因为我现在用的是松下T5, 日系键盘所以, 我的映射肯定有些不一样。不过上面的例子都是标准布局的。
hanliinter
2012-03-28 20:50:22 +08:00
http://emacswiki.org/emacs/FootSwitches

其实脚踏板真的是条路,说不定DDR跳舞毯也可以
thedevil7
2012-03-28 21:17:28 +08:00
@hanliinter 脚踏板得多少钱啊? 键盘, 映射, DIY, 实在是有需求再考虑增加设备, 呵呵
est
2012-03-28 21:45:13 +08:00
@hanliinter @thedevil7 跳舞毯不错。
thedevil7
2012-03-28 22:37:16 +08:00
@est 哈哈, 用过?
fanzeyi
2012-03-28 22:52:37 +08:00
…… 我觉得 Python 里的符号够少了……
thedevil7
2012-03-28 23:00:50 +08:00
@fanzeyi 是的, 只是打多了还是累, 所以想偷懒, 呵呵。 相比之下什么语言比较多?
dofine
2012-03-28 23:11:44 +08:00
@thedevil7
啊我那次也是这么弄的结果不行呢… 我还把 : 和 ; 也换过来了。应该是一样的原理,明天试试看。谢谢你!
thedevil7
2012-03-28 23:59:27 +08:00
@dofine 这是我的映射配置。希望可以帮你

"---- Normal Mode ----"

" With @, push o will get 2 new lines, "
" and changed into insert mode. "
nmap @ a<CR><CR>
nnoremap 4 $
nnoremap $ 4

"---- Insert Mode ----"

" let use (,[,and { to auto finish the pair."
"inoremap ( ()<ESC>i
inoremap 3 #
inoremap # 3
inoremap 8 ()<ESC>i
inoremap 9 )
inoremap ( 8
inoremap ) 9
inoremap [ []<ESC>i
inoremap { {}<ESC>i

" Use F2 to complete a line as <C-X><C-L> "
imap <F2> <C-X><C-L>

" Use F3 to insert a pair of parathesis,"
" and put the cursor in the middle. "
" the same for F4, and F5. "
"imap <F3> ()<ESC>i
imap <F3> ()<C-C><Insert> ()
imap <F4> []<ESC>i
i
GeBron
2012-04-01 16:21:40 +08:00
我觉得 perl 的符号要比 python 多么。。。

这是一个专为移动设备优化的页面(即为了让你能够在 Google 搜索结果里秒开这个页面),如果你希望参与 V2EX 社区的讨论,你可以继续到 V2EX 上打开本讨论主题的完整版本。

https://www.v2ex.com/t/30759

V2EX 是创意工作者们的社区,是一个分享自己正在做的有趣事物、交流想法,可以遇见新朋友甚至新机会的地方。

V2EX is a community of developers, designers and creative people.

© 2021 V2EX