Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- " encoding fix, for russian, hopefuly universal
- set enc=utf-8
- set fileencoding=utf-8
- set fileencodings=ucs-bom,utf8,prc
- set guifont=Monaco:h11
- set guifontwide=NSimsun:h12
- " indent fix, tab shown as 1 space, pc-friendly
- set nocindent
- set nosmartindent
- set nosmarttab
- set noexpandtab
- set shiftwidth=1
- set softtabstop=1
- set tabstop=1
- set ignorecase
- filetype indent off
- " fix for navigation like in all other editors
- nnoremap <expr> <Up> (v:count == 0 ? 'gk' : 'k')
- nnoremap <expr> <Down> (v:count == 0 ? 'gj' : 'j')
- inoremap <expr> <silent> <Up> pumvisible() ? "\<Up>" : "\<C-o>gk"
- inoremap <expr> <silent> <Down> pumvisible() ? "\<Down>" : "\<C-o>gj"
- set whichwrap+=<,>,h,l,[,],b,s
- nnoremap f gg=G
- " copy-paste fix. also do both:
- " pkg install termux-api
- " google play download 'termux api'
- nnoremap <C-c> :'<,'>w !termux-clipboard-set<CR>
- nnoremap <C-v> :r !termux-clipboard-get<CR>
- " text and code folding, no special symbols
- " 1 new line = same foldlevel
- " 2 new lines = increase foldlevel
- " 3 new lines = decrease foldlevel
- let b:ind=0
- let b:progress=0
- let b:newlines=0
- set foldmethod=expr
- set foldexpr=VimFoldLevel(v:lnum)
- function! VimFoldLevel(line)
- if(b:progress<=a:line)
- let b:progress=a:line else return endif
- if getline(a:line) =~ '^[ \t]*$'
- let b:newlines=b:newlines+1
- if b:newlines==2
- return b:ind+1
- endif
- if b:newlines==3
- let b:ind=max([b:ind-1,0])
- endif
- return b:ind
- else
- if b:newlines==2
- let b:ind=b:ind+1
- endif
- let b:newlines=0
- return b:ind+1
- endif
- endfunction
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement