Skip to content

Instantly share code, notes, and snippets.

@leechannl
Created June 29, 2017 02:46
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save leechannl/477be1c8aaf1850e9ef2ca97cdc0624a to your computer and use it in GitHub Desktop.
Save leechannl/477be1c8aaf1850e9ef2ca97cdc0624a to your computer and use it in GitHub Desktop.
spacevim config
scriptencoding utf-8
let g:spacevim_enable_debug = 1
let g:spacevim_realtime_leader_guide = 1
call SpaceVim#layers#load('incsearch')
call SpaceVim#layers#load('lang#c')
call SpaceVim#layers#load('lang#elixir')
call SpaceVim#layers#load('lang#go')
call SpaceVim#layers#load('lang#haskell')
call SpaceVim#layers#load('lang#java')
call SpaceVim#layers#load('lang#javascript')
call SpaceVim#layers#load('lang#lua')
call SpaceVim#layers#load('lang#perl')
call SpaceVim#layers#load('lang#php')
call SpaceVim#layers#load('lang#python')
call SpaceVim#layers#load('lang#rust')
call SpaceVim#layers#load('lang#swig')
call SpaceVim#layers#load('lang#tmux')
call SpaceVim#layers#load('lang#vim')
call SpaceVim#layers#load('lang#xml')
call SpaceVim#layers#load('shell')
call SpaceVim#layers#load('tools#screensaver')
let g:spacevim_enable_vimfiler_welcome = 1
let g:spacevim_enable_debug = 1
let g:deoplete#auto_complete_delay = 150
let g:spacevim_enable_tabline_filetype_icon = 1
let g:spacevim_enable_os_fileformat_icon = 1
let g:spacevim_buffer_index_type = 1
let g:neomake_vim_enabled_makers = ['vimlint', 'vint']
if has('python3')
let g:ctrlp_map = ''
nnoremap <silent> <C-p> :Denite file_rec<CR>
endif
let g:clang2_placeholder_next = ''
let g:clang2_placeholder_prev = ''
" make paste work
set clipboard=unnamed
" set macvim font
if has('gui_running')
set lines=40 columns=120
set guioptions-=T
set guioptions-=m
set t_Co=256
"set guifont=Monaco\ 11.5
"set guifont=Source\ Code\ Pro\ Medium:h12.5
set guifont=Hack\ Regular:h13
set linespace=3
endif
let g:mapleader = ','
" Fast saving
nmap <leader>w :w!<cr>
" Fast quit
nmap <leader>q :wq!<cr>
nmap <leader>x :q!<cr>
set wildmenu "允许命令行的自动补全提示
set wildmode=list:longest,full
set scrolloff=7
set hlsearch
set smartcase
set showmatch
set matchtime=2
augroup file_indent
autocmd FileType html setlocal shiftwidth=2 tabstop=2
autocmd FileType cs setlocal shiftwidth=2 tabstop=2
autocmd FileType css setlocal shiftwidth=2 tabstop=2
autocmd FileType javascript setlocal shiftwidth=2 tabstop=2
autocmd FileType python setlocal shiftwidth=4 tabstop=4
augroup END
map <C-J> <C-W>j
map <C-L> <C-W>l
map <C-H> <C-W>h
map <C-K> <C-W>k
""" Remove the Windows ^M - when the encodings gets messed up
noremap <Leader>m mmHmt:%s/<C-V><cr>//ge<cr>'tzt'm
""" Replace Chinese dot and comma with English dot and comma.
noremap <leader>, mmHmt:%s/,/, /ge<cr>'tzt'm
noremap <leader>. mmHmt:%s/。/. /ge<cr>'tzt'm
nmap <leader>l :only<cr>
" Really useful!
" In visual mode when you press * or # to search for the current selection
vnoremap <silent> * :call VisualSearch('f')<CR>
vnoremap <silent> # :call VisualSearch('b')<CR>
" When you press gv you vimgrep after the selected text
vnoremap <silent> gv :call VisualSearch('gv')<CR>
map <leader>g :vimgrep // **/*.<left><left><left><left><left><left><left>
function! CmdLine(str)
exe 'menu Foo.Bar :' . a:str
emenu Foo.Bar
unmenu Foo
endfunction
" From an idea by Michael Naumann
function! VisualSearch(direction) range
let l:saved_reg = @"
execute 'normal! vgvy'
let l:pattern = escape(@", '\\/.*$^~[]')
let l:pattern = substitute(l:pattern, "\n$", '', '')
if a:direction ==# 'b'
execute 'normal ?' . l:pattern . '^M'
elseif a:direction ==# 'gv'
call CmdLine('vimgrep ' . '/'. l:pattern . '/' . ' **/*.')
elseif a:direction ==# 'f'
execute 'normal /' . l:pattern . '^M'
endif
let @/ = l:pattern
let @" = l:saved_reg
endfunction
nnoremap <silent> wm :VimFiler .<cr>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment