aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorjdhao <jdhao@hotmail.com>2022-10-15 11:26:13 +0800
committerjdhao <jdhao@hotmail.com>2022-10-15 11:28:15 +0800
commit3539207913f6ecf8ce11a9d59f35ab82349a399b (patch)
tree84e9962983e6bb399cfdd522281df2471981ce34
parentd8b92965e891c5d05f65542383c087871175c27f (diff)
use 2 spaces for tabs by default
This removes a lot of code duplication. If we want to use 4 spaces, we can set it separately in their ftplugin settings.
-rw-r--r--after/ftplugin/cpp.vim5
-rw-r--r--after/ftplugin/javascript.vim5
-rw-r--r--after/ftplugin/lua.vim5
-rw-r--r--after/ftplugin/python.vim5
-rw-r--r--after/ftplugin/sql.vim5
-rw-r--r--after/ftplugin/toml.vim4
-rw-r--r--after/ftplugin/vim.vim5
-rw-r--r--after/ftplugin/yaml.vim5
-rw-r--r--core/options.vim6
9 files changed, 8 insertions, 37 deletions
diff --git a/after/ftplugin/cpp.vim b/after/ftplugin/cpp.vim
index 170aa5f..a8f76f3 100644
--- a/after/ftplugin/cpp.vim
+++ b/after/ftplugin/cpp.vim
@@ -1,10 +1,5 @@
set commentstring=//\ %s
-set tabstop=2 " number of visual spaces per TAB
-set softtabstop=2 " number of spaces in tab when editing
-set shiftwidth=2 " number of spaces to use for autoindent
-set expandtab " expand tab to spaces so that tabs are spaces
-
" Disable inserting comment leader after hitting o or O or <Enter>
set formatoptions-=o
set formatoptions-=r
diff --git a/after/ftplugin/javascript.vim b/after/ftplugin/javascript.vim
index c629428..3e27ee8 100644
--- a/after/ftplugin/javascript.vim
+++ b/after/ftplugin/javascript.vim
@@ -1,8 +1,3 @@
" Disable inserting comment leader after hitting o or O or <Enter>
set formatoptions-=o
set formatoptions-=r
-
-set tabstop=2 " number of visual spaces per TAB
-set softtabstop=2 " number of spaces in tab when editing
-set shiftwidth=2 " number of spaces to use for autoindent
-set expandtab " expand tab to spaces so that tabs are spaces
diff --git a/after/ftplugin/lua.vim b/after/ftplugin/lua.vim
index a840aae..193a5d1 100644
--- a/after/ftplugin/lua.vim
+++ b/after/ftplugin/lua.vim
@@ -2,11 +2,6 @@
set formatoptions-=o
set formatoptions-=r
-set tabstop=2 " number of visual spaces per TAB
-set softtabstop=2 " number of spaces in tab when editing
-set shiftwidth=2 " number of spaces to use for autoindent
-set expandtab " expand tab to spaces so that tabs are spaces
-
nnoremap <silent> <F9> :luafile %<CR>
" For delimitMate
diff --git a/after/ftplugin/python.vim b/after/ftplugin/python.vim
index adda6d4..185aa6e 100644
--- a/after/ftplugin/python.vim
+++ b/after/ftplugin/python.vim
@@ -8,5 +8,10 @@ set sidescroll=5
set sidescrolloff=2
set colorcolumn=100
+set tabstop=4 " number of visual spaces per TAB
+set softtabstop=4 " number of spaces in tab when editing
+set shiftwidth=4 " number of spaces to use for autoindent
+set expandtab " expand tab to spaces so that tabs are spaces
+
" For delimitMate
let b:delimitMate_matchpairs = "(:),[:],{:}"
diff --git a/after/ftplugin/sql.vim b/after/ftplugin/sql.vim
index e407c31..8c0d563 100644
--- a/after/ftplugin/sql.vim
+++ b/after/ftplugin/sql.vim
@@ -1,6 +1 @@
set commentstring=--\ %s
-
-set tabstop=2 " number of visual spaces per TAB
-set softtabstop=2 " number of spaces in tab when editing
-set shiftwidth=2 " number of spaces to use for autoindent
-set expandtab " expand tab to spaces so that tabs are spaces
diff --git a/after/ftplugin/toml.vim b/after/ftplugin/toml.vim
index 46e9ccd..e69de29 100644
--- a/after/ftplugin/toml.vim
+++ b/after/ftplugin/toml.vim
@@ -1,4 +0,0 @@
-set tabstop=2 " number of visual spaces per TAB
-set softtabstop=2 " number of spaces in tab when editing
-set shiftwidth=2 " number of spaces to use for autoindent
-set expandtab " expand tab to spaces so that tabs are spaces
diff --git a/after/ftplugin/vim.vim b/after/ftplugin/vim.vim
index 77022da..4e9a2a4 100644
--- a/after/ftplugin/vim.vim
+++ b/after/ftplugin/vim.vim
@@ -12,9 +12,4 @@ set foldmethod=expr foldexpr=utils#VimFolds(v:lnum) foldtext=utils#MyFoldText()
" see `:h K` and https://stackoverflow.com/q/15867323/6064933
set keywordprg=:help
-set tabstop=2 " number of visual spaces per TAB
-set softtabstop=2 " number of spaces in tab when editing
-set shiftwidth=2 " number of spaces to use for autoindent
-set expandtab " expand tab to spaces so that tabs are spaces
-
nnoremap <silent> <F9> :source %<CR>
diff --git a/after/ftplugin/yaml.vim b/after/ftplugin/yaml.vim
index a8e3099..ad695d7 100644
--- a/after/ftplugin/yaml.vim
+++ b/after/ftplugin/yaml.vim
@@ -1,8 +1,3 @@
-set tabstop=2 " number of visual spaces per TAB
-set softtabstop=2 " number of spaces in tab when editing
-set shiftwidth=2 " number of spaces to use for autoindent
-set expandtab " expand tab to spaces so that tabs are spaces
-
" Turn off syntax highlighting for large YAML files.
if line('$') > 500
setlocal syntax=OFF
diff --git a/core/options.vim b/core/options.vim
index 13a0133..79757a8 100644
--- a/core/options.vim
+++ b/core/options.vim
@@ -44,9 +44,9 @@ set backup " create backup for files
set backupcopy=yes " copy the original file to backupdir and overwrite it
" General tab settings
-set tabstop=4 " number of visual spaces per TAB
-set softtabstop=4 " number of spaces in tab when editing
-set shiftwidth=4 " number of spaces to use for autoindent
+set tabstop=2 " number of visual spaces per TAB
+set softtabstop=2 " number of spaces in tab when editing
+set shiftwidth=2 " number of spaces to use for autoindent
set expandtab " expand tab to spaces so that tabs are spaces
" Set matching pairs of characters and highlight matching brackets