From 74c3edcfcebd0b8559aadd58e35e0206dcf4ebbf Mon Sep 17 00:00:00 2001 From: Revc Ra Date: Sat, 27 Feb 2021 11:08:14 +0800 Subject: [PATCH] new file: indentation_projects.vim modified: my_configs.vim --- indentation_projects.vim | 5 +++++ my_configs.vim | 39 ++++++++++++++++++++++++++++----------- 2 files changed, 33 insertions(+), 11 deletions(-) create mode 100644 indentation_projects.vim diff --git a/indentation_projects.vim b/indentation_projects.vim new file mode 100644 index 00000000..9a52c97a --- /dev/null +++ b/indentation_projects.vim @@ -0,0 +1,5 @@ +augroup ProjectSetup + au BufRead,BufEnter ~/Projs/linux/* set shiftwidth=8 noexpandtab tabstop=8 nolist + au BufRead,BufEnter ~/Projs/opensolaris/* set shiftwidth=8 noexpandtab tabstop=8 nolist +augroup END + diff --git a/my_configs.vim b/my_configs.vim index d8a6931a..56959d5e 100644 --- a/my_configs.vim +++ b/my_configs.vim @@ -30,14 +30,34 @@ " Formatting { - set nowrap " Do not wrap long lines - set autoindent " Indent at the same level of the previous line - set shiftwidth=2 " Use indents of 4 spaces - set expandtab " Tabs are spaces, not tabs - set tabstop=2 " An indentation every four columns - set softtabstop=2 " Let backspace delete indent - set nojoinspaces " Prevents inserting two spaces after punctuation on a join (J) - set pastetoggle= " pastetoggle (same indentation on pastes) + set nowrap " Do not wrap long lines + set autoindent " Indent at the same level of the previous line + set nojoinspaces " Prevents inserting two spaces a join (J) + set pastetoggle= " pastetoggle (same indentation on pastes) + + " Affects what happens when you press >>, << or ==. It also affects how + " automatic indentation works. + set shiftwidth=2 + + " Affects what happens when you press the or keys. Its default + " value is the same as the value of 'tabstop', but when using indentation + " without hard tabs or mixed indentation, you want to set it to the same value + " as 'shiftwidth'. If 'expandtab' is unset, and 'tabstop' is different from + " 'softtabstop', the key will minimize the amount of spaces inserted by + " using multiples of TAB characters. + set softtabstop=2 + + " 'expandtab' affects what happens when you press the key. If + " 'expandtab' is set, pressing the key will always insert 'softtabstop' + " amount of space characters. Otherwise, the amount of spaces inserted is + " minimized by using TAB characters. + set expandtab " Tabs are spaces, not tabs + + " Specify indentation for each project + try + source ~/.vim_runtime/indentation_projects.vim + catch + endtry " } @@ -149,9 +169,6 @@ nmap f8 :set foldlevel=8 nmap f9 :set foldlevel=9 - " Insert newline without entering insert mode - nmap o - " Map ctrl x ctrl o to ctrl space inoremap inoremap