Folding
This commit is contained in:
parent
76b96728c8
commit
226a91e5a6
1 changed files with 27 additions and 25 deletions
52
vim/.vimrc
52
vim/.vimrc
|
|
@ -5,6 +5,7 @@ Plug 'https://github.com/vim-airline/vim-airline'
|
||||||
Plug 'https://github.com/vim-airline/vim-airline-themes'
|
Plug 'https://github.com/vim-airline/vim-airline-themes'
|
||||||
Plug 'https://github.com/powerline/fonts'
|
Plug 'https://github.com/powerline/fonts'
|
||||||
Plug 'https://github.com/tpope/vim-fugitive'
|
Plug 'https://github.com/tpope/vim-fugitive'
|
||||||
|
Plug 'https://github.com/Yggdroot/indentLine'
|
||||||
|
|
||||||
"Indent automiatically depending on filetype
|
"Indent automiatically depending on filetype
|
||||||
filetype plugin on
|
filetype plugin on
|
||||||
|
|
@ -17,11 +18,12 @@ syntax enable
|
||||||
" Create the `tags` file (may need to install ctags first)
|
" Create the `tags` file (may need to install ctags first)
|
||||||
command! MakeTags !ctags -R .
|
command! MakeTags !ctags -R .
|
||||||
|
|
||||||
" Tab indentation
|
" 4 spaces instead of tabs indentation
|
||||||
set shiftwidth=4 tabstop=4 softtabstop=4 expandtab
|
set shiftwidth=4 tabstop=4 softtabstop=4 expandtab
|
||||||
|
|
||||||
"End IDE specific options
|
" Fold methods based on indents
|
||||||
"<-------------------------------------------------------------------------->
|
" zo to open folds, zc to close
|
||||||
|
set foldmethod=indent
|
||||||
|
|
||||||
" FINDING FILES
|
" FINDING FILES
|
||||||
|
|
||||||
|
|
@ -80,16 +82,16 @@ set laststatus=2
|
||||||
|
|
||||||
"Space in toolbar is "%=\
|
"Space in toolbar is "%=\
|
||||||
"set statusline=
|
"set statusline=
|
||||||
"set statusline+=%1*\ %n\ "Buffernr
|
"set statusline+=%1*\ %n\ "Buffernr
|
||||||
"set statusline+=%1*\ %F\ %m%r%w "File + modified/readonly
|
"set statusline+=%1*\ %F\ %m%r%w "File + modified/readonly
|
||||||
"set statusline+=%1*\ %= "Space between filename
|
"set statusline+=%1*\ %= "Space between filename
|
||||||
"set statusline+=%1*\ %{hostname()}\ "Hostname
|
"set statusline+=%1*\ %{hostname()}\ "Hostname
|
||||||
"set statusline+=%1*\ %{strlen(&ft)?&ft:'none'}\ "Filetype
|
"set statusline+=%1*\ %{strlen(&ft)?&ft:'none'}\ "Filetype
|
||||||
"set statusline+=%1*\ %{''.(&fenc!=''?&fenc:&enc).''} "Encoding
|
"set statusline+=%1*\ %{''.(&fenc!=''?&fenc:&enc).''} "Encoding
|
||||||
"set statusline+=%1*\ %{(&bomb?\",BOM\":\"\")}\ "Encoding2
|
"set statusline+=%1*\ %{(&bomb?\",BOM\":\"\")}\ "Encoding2
|
||||||
"set statusline+=%1*\ %{&ff}\ "FileFormat (dos/unix..)
|
"set statusline+=%1*\ %{&ff}\ "FileFormat (dos/unix..)
|
||||||
"set statusline+=%1*\ %l/%L\ \ "Rownumber/total (%)
|
"set statusline+=%1*\ %l/%L\ \ "Rownumber/total (%)
|
||||||
"set statusline+=%1*\ %P\ "Readonly? Top/bot
|
"set statusline+=%1*\ %P\ "Readonly? Top/bot
|
||||||
|
|
||||||
"Statusbar colors
|
"Statusbar colors
|
||||||
"hi User1 ctermbg=237
|
"hi User1 ctermbg=237
|
||||||
|
|
@ -101,21 +103,21 @@ vnoremap c "+c
|
||||||
|
|
||||||
"Built-in completion
|
"Built-in completion
|
||||||
function! Smart_TabComplete()
|
function! Smart_TabComplete()
|
||||||
let line = getline('.') " current line
|
let line = getline('.') " current line
|
||||||
let substr = strpart(line, -1, col('.')+1) " from the start of the current
|
let substr = strpart(line, -1, col('.')+1) " from the start of the current
|
||||||
" of the cursor
|
" of the cursor
|
||||||
let substr = matchstr(substr, "[^ \t]*$") " word till cursor
|
let substr = matchstr(substr, "[^ \t]*$") " word till cursor
|
||||||
if (strlen(substr)==0) " nothing to match on empty string
|
if (strlen(substr)==0) " nothing to match on empty string
|
||||||
return "\<tab>"
|
return "\<tab>"
|
||||||
endif
|
endif
|
||||||
let has_period = match(substr, '\.') != -1 " position of period, if any
|
let has_period = match(substr, '\.') != -1 " position of period, if any
|
||||||
let has_slash = match(substr, '\/') != -1 " position of slash, if any
|
let has_slash = match(substr, '\/') != -1 " position of slash, if any
|
||||||
if (!has_period && !has_slash)
|
if (!has_period && !has_slash)
|
||||||
return "\<C-X>\<C-P>" " existing text matching
|
return "\<C-X>\<C-P>" " existing text matching
|
||||||
elseif ( has_slash )
|
elseif ( has_slash )
|
||||||
return "\<C-X>\<C-F>" " file matching
|
return "\<C-X>\<C-F>" " file matching
|
||||||
else
|
else
|
||||||
return "\<C-X>\<C-O>" " plugin matching
|
return "\<C-X>\<C-O>" " plugin matching
|
||||||
endif
|
endif
|
||||||
endfunction
|
endfunction
|
||||||
inoremap <tab> <c-r>=Smart_TabComplete()<CR>
|
inoremap <tab> <c-r>=Smart_TabComplete()<CR>
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue