Quantcast
Channel: Active questions tagged python - Stack Overflow
Viewing all articles
Browse latest Browse all 23305

Weird vim python autoindent issue

$
0
0

When editing python files, I am running into a weird auto-indent issue. No matter what I do, when I open a new line, the cursor always ends up in the middle of the terminal. I expect it be aligned with either the start of the previous line or one indent over if its opening a new control block. For example:

  x = y  |  # or like this  if x == y:    |  # pipe '|' indicates where I'd expect cursor to be because of autoindent.

However, it always like this:

  hello, world                                    |  or   if x == y:                                    |

My terminal is 100 characters wide and it always put it the cursor at position 54 when I open a new line. Any idea why this would be happening. I've pasted my vim settings below. This started happening recently, and it's driving me nuts. Any help is really appreciated

Thanks,

  autoindent          exrc                modelines=0         smartcase           wildignore=*.pyc  backup              filetype=python     ruler               softtabstop=2       window=0  cmdheight=2         formatoptions=cqt   scroll=18           suffixesadd=.py     wrapmargin=5  comments=b:#,fb:-   helplang=en         scrolloff=2         syntax=python       t_8u=  cscopetag           hidden              secure              tabstop=2  cscopetagorder=1    ignorecase          shiftwidth=2        textwidth=100  cscopeverbose       incsearch           showcmd             ttymouse=sgr  expandtab           laststatus=2        showmatch           updatetime=300  backspace=indent,eol,start  backupdir=~/.vim/tmp  cinkeys=0{,0},0),0],:,!^F,o,O,e  commentstring=# %s  completeopt=menuone,menu,longest,preview  cscopeprg=/usr/local/bin/cscope  define=^\s*\(def\|class\)  directory=~/.vim/tmp  fileencoding=utf-8  fileencodings=ucs-bom,utf-8,default,latin1  include=^\s*\(from\|import\)  includeexpr=substitute(substitute(substitute(v:fname,b:grandparent_match,b:grandparent_sub,''),b:parent_match,b:parent_sub,''),b:child_match,b:child_sub,'g')  indentexpr=python#GetIndent(v:lnum)  indentkeys=0{,0},0),0],:,!^F,o,O,e,<:>,=elif,=except  keywordprg=python3 -m pydoc  omnifunc=syntaxcomplete#Complete

Viewing all articles
Browse latest Browse all 23305

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>