Do not modify tab options in vimrc for .py files.
authorMartin Liska <mliska@suse.cz>
Fri, 17 Apr 2020 06:55:55 +0000 (08:55 +0200)
committerMartin Liska <mliska@suse.cz>
Fri, 17 Apr 2020 06:55:55 +0000 (08:55 +0200)
* vimrc: We do not want to modify tab options
for Python files.

contrib/ChangeLog
contrib/vimrc

index 7efe9a4..43fe1e7 100644 (file)
@@ -1,3 +1,8 @@
+2020-04-17  Martin Liska  <mliska@suse.cz>
+
+       * vimrc: We do not want to modify tab options
+       for Python files.
+
 2020-04-16  Jakub Jelinek  <jakub@redhat.com>
 
        PR bootstrap/92008
index bbbe1dd..fa0208d 100644 (file)
 
 function! SetStyle()
   let l:fname = expand("%:p")
+  let l:ext = fnamemodify(l:fname, ":e")
+  let l:c_exts = ['c', 'h', 'cpp', 'cc', 'C', 'H', 'def', 'java']
   if stridx(l:fname, 'libsanitizer') != -1
     return
   endif
-  setlocal tabstop=8
-  setlocal softtabstop=2
-  setlocal shiftwidth=2
-  setlocal noexpandtab
+  if l:ext != "py"
+    setlocal tabstop=8
+    setlocal softtabstop=2
+    setlocal shiftwidth=2
+    setlocal noexpandtab
+  endif
   setlocal textwidth=80
   setlocal formatoptions-=ro formatoptions+=cqlt
-  let l:ext = fnamemodify(l:fname, ":e")
-  let l:c_exts = ['c', 'h', 'cpp', 'cc', 'C', 'H', 'def', 'java']
   if index(l:c_exts, l:ext) != -1
     setlocal cindent
     setlocal cinoptions=>4,n-2,{2,^-2,:2,=2,g0,f0,h2,p4,t0,+2,(0,u0,w1,m0