v*****r 发帖数: 2325 | 1 新学python, 一般在Linux command line 模式下用vi.
python 没有 {}, vi 无法为python code auto correct indentation.
correct indentation 在copy & paste 一段代码时候需要。
都说python 比perl 好, 可这一点, python 很不入流。
curly braces is widely used in many widely used language: c, java, etc. | r*******n 发帖数: 3020 | 2 我用vim写python很多年了,没有遇到不能auto indentation的问题
【在 v*****r 的大作中提到】 : 新学python, 一般在Linux command line 模式下用vi. : python 没有 {}, vi 无法为python code auto correct indentation. : correct indentation 在copy & paste 一段代码时候需要。 : 都说python 比perl 好, 可这一点, python 很不入流。 : curly braces is widely used in many widely used language: c, java, etc.
| T****U 发帖数: 3344 | 3 是很土,很容易看岔
【在 v*****r 的大作中提到】 : 新学python, 一般在Linux command line 模式下用vi. : python 没有 {}, vi 无法为python code auto correct indentation. : correct indentation 在copy & paste 一段代码时候需要。 : 都说python 比perl 好, 可这一点, python 很不入流。 : curly braces is widely used in many widely used language: c, java, etc.
| r*******n 发帖数: 3020 | 4 关于curly braces语法,我认为是因为先入为主的因素
看惯了c、c++,java,c#,
【在 v*****r 的大作中提到】 : 新学python, 一般在Linux command line 模式下用vi. : python 没有 {}, vi 无法为python code auto correct indentation. : correct indentation 在copy & paste 一段代码时候需要。 : 都说python 比perl 好, 可这一点, python 很不入流。 : curly braces is widely used in many widely used language: c, java, etc.
| v*****r 发帖数: 2325 | 5 google:
vimrc settings:
autocmd BufRead *.py set smartindent cinwords=if,elif,else,for,while,try,
except,finally,def,class
unfortunately i only get it working once, then no longer working
could you please share the tips
【在 r*******n 的大作中提到】 : 我用vim写python很多年了,没有遇到不能auto indentation的问题
| v*****r 发帖数: 2325 | 6 i see the smartindent autoident working with some lines, but not others
check following, line 1-3 are able to autoident, line 4-5 only line 5
autoident, line 4 refuse to do so
1 line = "Cats are smarter than dogs";
2 matchObj = re.match( r'(.*) are(\.*)', line, re.M|re.I)
3 if matchObj:
4count_ban = len(has_ban.keys())
5 print "count_ban = ", count_ban
【在 v*****r 的大作中提到】 : google: : vimrc settings: : autocmd BufRead *.py set smartindent cinwords=if,elif,else,for,while,try, : except,finally,def,class : unfortunately i only get it working once, then no longer working : could you please share the tips
| l*********s 发帖数: 5409 | 7 99% is your vimrc misconfigured.do a cat to confirm if it is actually wrong
.
【在 v*****r 的大作中提到】 : i see the smartindent autoident working with some lines, but not others : check following, line 1-3 are able to autoident, line 4-5 only line 5 : autoident, line 4 refuse to do so : 1 line = "Cats are smarter than dogs"; : 2 matchObj = re.match( r'(.*) are(\.*)', line, re.M|re.I) : 3 if matchObj: : 4count_ban = len(has_ban.keys()) : 5 print "count_ban = ", count_ban
| r*******n 发帖数: 3020 | 8 If you use Ubuntu, I highly recommand the following:
https://github.com/fisadev/fisa-vim-config
It is pretty much easy to install which should save you from a lot of
tedious work of configurations that I don't even want to touch.
But if don't want to go with the above, you probably need to set
"filetype indent on" in your vimrc.
【在 v*****r 的大作中提到】 : google: : vimrc settings: : autocmd BufRead *.py set smartindent cinwords=if,elif,else,for,while,try, : except,finally,def,class : unfortunately i only get it working once, then no longer working : could you please share the tips
|
|