More clean-ups

Better Cross-platform stuff

https://vimways.org/2018/from-vimrc-to-vim/
This commit is contained in:
2020-08-08 13:50:22 -07:00
parent 5a42a0c8e1
commit e12d093365
10 changed files with 140 additions and 126 deletions

30
plugin/folders.vim Normal file
View File

@@ -0,0 +1,30 @@
" Stolen from maralla/dotvim
function! s:EnsureExists(path) abort
let l:path = expand(a:path)
if !isdirectory(l:path)
try
call mkdir(l:path)
catch
echom "Could not create directory " . l:path
endtry
endif
endfunction
call s:EnsureExists(resolve($MYVIM . '/.cache'))
" persistent undo
if exists('+undofile')
let &undodir = resolve($MYVIM . '/.cache/undo')
set undofile
call s:EnsureExists(&undodir)
endif
" backups
let &backupdir=resolve($MYVIM . '/.cache/backup')
set backup
call s:EnsureExists(&backupdir)
" swap files
let &directory=resolve($MYVIM . '/.cache/swap')
set noswapfile
call s:EnsureExists(&directory)

21
plugin/grep.vim Normal file
View File

@@ -0,0 +1,21 @@
" Set up CtrlP with faster alternative, if possible
if executable('ag')
" Use The Silver Searcher https://github.com/ggreer/the_silver_searcher
set grepprg=ag\ --nogroup\ --nocolor
" Use ag in CtrlP for listing files. Lightning fast, respects .gitignore
" and .agignore. Ignores hidden files by default.
let g:ctrlp_user_command = 'ag %s -l --nocolor -f -g ""'
let g:ctrlp_use_caching = 0
finish
endif
if executable('rg')
set grepprg=rg\ --color=never
let g:ctrlp_user_command = 'rg %s --files --color=never --glob ""'
let g:ctrlp_use_caching = 0
finish
endif
"ctrl+p ignore files in .gitignore
let g:ctrlp_user_command = ['.git', 'cd %s && git ls-files . -co --exclude-standard', 'find %s -type f']

13
plugin/gui.vim Normal file
View File

@@ -0,0 +1,13 @@
if has('gui_running')
set guioptions-=mTr " disable toolbar, menubar and scrollbar
if has('win32')
set guifont=Source_Code_Pro:h12:cANSI
endif
if has('osx')
set guifont=Source_Code_Pro:h13
endif
else
if(has('mouse'))
set mouse=a
endif
endif

30
plugin/ui.vim Normal file
View File

@@ -0,0 +1,30 @@
if $TERM_PROGRAM ==? 'iTerm.app'
" different cursors for insert vs normal mode
if exists('$TMUX')
let &t_SI = "\<Esc>Ptmux;\<Esc>\<Esc>]50;CursorShape=1\x7\<Esc>\\"
let &t_EI = "\<Esc>Ptmux;\<Esc>\<Esc>]50;CursorShape=0\x7\<Esc>\\"
else
let &t_SI = "\<Esc>]50;CursorShape=1\x7"
let &t_EI = "\<Esc>]50;CursorShape=0\x7"
endif
endif
" Windows-specific setting allowing for 256-colors etc
if($ConEmuANSI ==? 'ON')
set term=xterm
set t_Co=256
let &t_AB='\e[48;5;%dm' " background color
let &t_AF='\e[38;5;%dm' " foreground color
inoremap <Esc>[62~ <C-X><C-E>
inoremap <Esc>[63~ <C-X><C-Y>
nnoremap <Esc>[62~ <C-E>
nnoremap <Esc>[63~ <C-Y>
endif
if(exists('$WT_SESSION'))
set t_Co=256
inoremap <Esc>[62~ <C-X><C-E>
inoremap <Esc>[63~ <C-X><C-Y>
nnoremap <Esc>[62~ <C-E>
nnoremap <Esc>[63~ <C-Y>
endif