|
|
|
@ -1,9 +1,38 @@ |
|
|
|
set autochdir |
|
|
|
set nocompatible |
|
|
|
" Allow backspacing over everything in insert mode. |
|
|
|
set backspace=indent,eol,start |
|
|
|
set number |
|
|
|
set relativenumber |
|
|
|
"[Hide/show the white-space and more invisible symbols]" |
|
|
|
set list |
|
|
|
set listchars=nbsp:¬,trail:- |
|
|
|
"set listchars+=tab:│\ , |
|
|
|
set listchars+=tab:▸\ , |
|
|
|
set nojoinspaces |
|
|
|
"[Indent & Tab/mode-line settings]" |
|
|
|
set breakindent |
|
|
|
set nopaste |
|
|
|
set smarttab |
|
|
|
set tabstop=4 " tabs size on screen " |
|
|
|
set expandtab " <tab> inserts spaces " |
|
|
|
set autoindent |
|
|
|
set copyindent " copy existing tab/spaces mix on newline " |
|
|
|
set smartindent " overruled by cindent " |
|
|
|
set cinwords=except,finally,def,class,with,do,if,elif,else,for,while,try,switch |
|
|
|
set cinoptions+=l1 " switch case label alignement, :h cinoptions-values " |
|
|
|
set shiftwidth=4 " number of space to use on indent. Use tabstop if 0" |
|
|
|
"set softtabstop=4 |
|
|
|
"[Matching chars]" |
|
|
|
set showmatch |
|
|
|
set matchpairs=\":\" |
|
|
|
set matchpairs+=(:) |
|
|
|
set matchpairs+={:} |
|
|
|
set matchpairs+=[:] |
|
|
|
"[TextWidth settings]" |
|
|
|
set textwidth=0 |
|
|
|
"[Look for a single modeline in files]" |
|
|
|
set modeline |
|
|
|
set modelines=1 |
|
|
|
|
|
|
|
set history=200 " keep 200 lines of command line history |
|
|
|
set ruler " show the cursor position all the time |
|
|
|
@ -20,6 +49,46 @@ set history=1000 |
|
|
|
set nowritebackup |
|
|
|
set undolevels=5000 |
|
|
|
|
|
|
|
" Show @@@ in the last line if it is truncated. |
|
|
|
set display=truncate |
|
|
|
"[Splitting rules]" |
|
|
|
set splitbelow |
|
|
|
set splitright |
|
|
|
set equalalways |
|
|
|
|
|
|
|
" Show a few lines of context around the cursor. |
|
|
|
set scrolloff=5 |
|
|
|
|
|
|
|
set autochdir |
|
|
|
set autoread |
|
|
|
set autowrite |
|
|
|
|
|
|
|
"[Shared with OS clipboard]" |
|
|
|
set clipboard=unnamed |
|
|
|
|
|
|
|
"[For regular expressions turn magic on, use \v to get regex parent]" |
|
|
|
set magic |
|
|
|
"[Search settings]" |
|
|
|
set hlsearch |
|
|
|
set incsearch |
|
|
|
set smartcase |
|
|
|
set ignorecase |
|
|
|
set wrapscan |
|
|
|
"[When on, the ":substitute" flag 'g' is default on]" |
|
|
|
set nogdefault |
|
|
|
|
|
|
|
|
|
|
|
"[Kitty doesn't support background color erase]" |
|
|
|
let &t_ut='' |
|
|
|
let base16colorspace=256 |
|
|
|
set background=dark |
|
|
|
colorscheme base16-default-dark |
|
|
|
"[Fix background transparency]" |
|
|
|
if has("autocmd") |
|
|
|
autocmd ColorScheme * highlight Normal ctermbg=None |
|
|
|
autocmd ColorScheme * highlight NonText ctermbg=None |
|
|
|
endif |
|
|
|
|
|
|
|
|
|
|
|
"[Define the leader key]" |
|
|
|
let mapleader="," |
|
|
|
@ -55,17 +124,16 @@ map Q gq |
|
|
|
"[Reflow current paragraph]" |
|
|
|
"[http://stevelosh.com/blog/2010/09/coming-home-to-vim/]" |
|
|
|
nnoremap <leader>q gqip |
|
|
|
" http://stackoverflow.com/questions/1005/getting-root-permissions-on-a-file-inside-of-vi |
|
|
|
cmap w!! w !sudo tee >/dev/null % |
|
|
|
"[To disable the arrow keys]" |
|
|
|
for prefix in ['i', 'n', 'v'] |
|
|
|
for key in ['<Up>', '<Down>', '<Left>', '<Right>'] |
|
|
|
execute prefix . "noremap " . key . " <Nop>" |
|
|
|
endfor |
|
|
|
endfor |
|
|
|
|
|
|
|
|
|
|
|
" Show @@@ in the last line if it is truncated. |
|
|
|
set display=truncate |
|
|
|
|
|
|
|
" Show a few lines of context around the cursor. Note that this makes the |
|
|
|
" text scroll if you mouse-click near the start or end of the window. |
|
|
|
set scrolloff=5 |
|
|
|
|
|
|
|
let base16colorspace=256 |
|
|
|
colorscheme base16-default-dark |
|
|
|
|
|
|
|
" Do incremental searching when it's possible to timeout. |
|
|
|
if has('reltime') |
|
|
|
@ -85,6 +153,25 @@ if &t_Co > 2 || has("gui_running") |
|
|
|
" Revert with ":unlet c_comment_strings". |
|
|
|
let c_comment_strings=1 |
|
|
|
endif |
|
|
|
" |
|
|
|
"[Remove tabs and spaces at the end of lines]" |
|
|
|
function! DeleteTrailingTWS() |
|
|
|
if &ft =~ 'diff' |
|
|
|
return |
|
|
|
end |
|
|
|
normal mb |
|
|
|
silent %s/[ \t]*$//g |
|
|
|
silent %s/\s\+$//ge |
|
|
|
normal 'b |
|
|
|
endfunction |
|
|
|
"[Make the scripts executable]" |
|
|
|
function! ChangeScriptMode() |
|
|
|
if getline(1) =~ "#!" |
|
|
|
if getline(1) =~ "bin/" |
|
|
|
silent !chmod +x <afile> |
|
|
|
endif |
|
|
|
endif |
|
|
|
endfunction |
|
|
|
|
|
|
|
" Only do this part when compiled with support for autocommands. |
|
|
|
if has("autocmd") |
|
|
|
@ -111,5 +198,14 @@ if has("autocmd") |
|
|
|
\ | endif |
|
|
|
|
|
|
|
augroup END |
|
|
|
" |
|
|
|
"[Do not clean up trailing spaces in binary mode]" |
|
|
|
if !&binary |
|
|
|
autocmd BufWritePre * call DeleteTrailingTWS() |
|
|
|
endif |
|
|
|
|
|
|
|
if has("unix") || has("mac") |
|
|
|
autocmd BufWritePost * call ChangeScriptMode() |
|
|
|
endif |
|
|
|
|
|
|
|
endif " has("autocmd") |
|
|
|
|