Skip to content

Commit

Permalink
remake
Browse files Browse the repository at this point in the history
  • Loading branch information
taigacute authored and taigacute committed Jan 26, 2019
1 parent 93f3893 commit e57cfad
Show file tree
Hide file tree
Showing 10 changed files with 156 additions and 67 deletions.
10 changes: 1 addition & 9 deletions init.vim
@@ -1,9 +1 @@
function! Dot(path)
return "~/.config/nvim/" . a:path
endfunction

for file in split(glob(Dot('rc/*.vim')), '\n')
exe 'source' file
endfor

"execute 'source' fnamemodify(expand('<sfile>'), ':h').'/config/nvim/rc/vimrc'
execute 'source' fnamemodify(expand('<sfile>'), ':h').'/rc/vimrc'
25 changes: 25 additions & 0 deletions rc/dein.vim
@@ -0,0 +1,25 @@
" dein configurations.

let g:dein#install_progress_type = 'title'
let g:dein#enable_notification = 1
let g:dein#install_log_filename = '~/.tmp/dein.log'

let $CACHE = expand('~/.cache')
let s:path = expand('$CACHE/dein')
if !dein#load_state(s:path)
finish
endif

call dein#begin(s:path, expand('<sfile>'))

call dein#load_toml('~/.config/nvim/rc/dein/dein.toml', {'lazy': 0})
call dein#load_toml('~/.config/nvim/rc/dein/deinlazy.toml', {'lazy' : 1})


call dein#end()
call dein#save_state()

if dein#check_install()
" Installation check.
call dein#install()
endif
5 changes: 3 additions & 2 deletions rc/dein/plugins.toml → rc/dein/dein.toml
Expand Up @@ -8,6 +8,9 @@ hook_add = '''
colorscheme hybrid_reverse
'''

[[plugins]]
repo = 'easymotion/vim-easymotion'

[[plugins]]
repo = 'scrooloose/nerdcommenter'

Expand Down Expand Up @@ -70,11 +73,9 @@ depends = 'fzf'
repo = 'w0rp/ale'
hook_add = 'source ~/.config/nvim/rc/plugins/vim-ale.vim'


[[plugins]]
repo = 'neoclide/coc.nvim'
build = 'yarn install'
on_event = 'InsertEnter'
hook_add = '''
let g:coc_snippet_next = '<TAB>'
let g:coc_snippet_prev = '<S-TAB>'
Expand Down
28 changes: 20 additions & 8 deletions rc/dein/plugins-lazy.toml → rc/dein/deinlazy.toml
@@ -1,12 +1,4 @@

[[plugins]]
repo = 'easymotion/vim-easymotion'
on_map = [['n', '<Plug>']]

[[plugins]]
repo = 'jiangmiao/auto-pairs'
on_event = 'InsertEnter'

[[plugins]]
repo = 'scrooloose/nerdtree'
on_map = [['n','<Plug>']]
Expand All @@ -26,6 +18,26 @@ hook_source ='source ~/.config/nvim/rc/plugins/tagbar.vim'
repo = 'mattn/emmet-vim'
on_ft = ['html','css','jsx','javascript','javascript.jsx']
on_event = 'InsertEnter'
hook_add ='''
let g:use_emmet_complete_tag = 0
let g:user_emmet_install_global = 0
let g:user_emmet_install_command = 0
let g:user_emmet_mode = 'i'
let g:user_emmet_leader_key='<C-g>'
let g:user_emmet_settings = {
\ 'javascript.jsx' : {
\ 'extends' : 'jsx',
\ },
\}
'''
[[plugins]]
repo = 'Raimondi/delimitMate'
on_event = 'InsertEnter'
hook_source = '''
let g:delimitMate_expand_cr = 1
let g:delimitMate_excluded_ft = 'html'
'''


[[plugins]]
repo = 'Shougo/neosnippet-snippets'
Expand Down
2 changes: 1 addition & 1 deletion rc/general.vim
Expand Up @@ -45,7 +45,7 @@ set list listchars=tab:▸\ ,trail:·,precedes:←,extends:→ "
" 打开文件自动定位到最后编辑的位置
autocmd BufReadPost * if line("'\"") > 1 && line("'\"") <= line("$") | execute "normal! g'\"" | endif
" Path to python interpreter for neovim
let g:python3_host_prog = '/usr/local/bin/python3'
let g:python3_host_prog = '/usr/bin/python3'
" Skip the check of neovim module
let g:python3_host_skip_check = 1

Expand Down
57 changes: 57 additions & 0 deletions rc/init.vim
@@ -0,0 +1,57 @@
"---------------------------------------------------------------------------
" Initialize:
""Use ',' instead of '\'.
" Use <Leader> in global plugin.
let g:mapleader = ','
" Use <LocalLeader> in filetype plugin.
let g:maplocalleader = ';'



let $CONFIG = expand('~/.config')


if !isdirectory(expand($CONFIG))
call mkdir(expand($CONFIG), 'p')
endif


" Load dein.
let s:dein_dir = finddir('dein.vim', '.;')
if s:dein_dir != '' || &runtimepath !~ '/dein.vim'
if s:dein_dir == '' && &runtimepath !~ '/dein.vim'
let s:dein_dir = expand('$CONFIG/nvim')
\. '/repos/github.com/Shougo/dein.vim'
if !isdirectory(s:dein_dir)
execute '!git clone https://github.com/Shougo/dein.vim' s:dein_dir
endif
endif
execute 'set runtimepath^=' . substitute(
\ fnamemodify(s:dein_dir, ':p') , '/$', '', '')
endif

" Disable packpath
set packpath=


"---------------------------------------------------------------------------
" Disable default plugins


let g:loaded_2html_plugin = 1
let g:loaded_logiPat = 1
let g:loaded_getscriptPlugin = 1
let g:loaded_gzip = 1
let g:loaded_man = 1
let g:loaded_matchit = 1
let g:loaded_matchparen = 1
let g:loaded_netrwFileHandlers = 1
let g:loaded_netrwPlugin = 1
let g:loaded_netrwSettings = 1
let g:loaded_rrhelper = 1
let g:loaded_shada_plugin = 1
let g:loaded_spellfile_plugin = 1
let g:loaded_tarPlugin = 1
let g:loaded_tutor_mode_plugin = 1
let g:loaded_vimballPlugin = 1
let g:loaded_zipPlugin = 1
4 changes: 0 additions & 4 deletions rc/mappings.vim
@@ -1,7 +1,3 @@
"set my leader
let g:mapleader=","
let g:maplocalleader=';'

"默认键位的映射
"定义快捷键到行首非空字符和行尾$
nmap ls ^
Expand Down
36 changes: 0 additions & 36 deletions rc/plugins.vim

This file was deleted.

7 changes: 0 additions & 7 deletions rc/plugins/emmet-vim.vim

This file was deleted.

49 changes: 49 additions & 0 deletions rc/vimrc
@@ -0,0 +1,49 @@
if &compatible
set nocompatible
endif

function! s:source_rc(path, ...) abort
let use_global = get(a:000, 0, !has('vim_starting'))
let abspath = resolve(expand('~/.config/nvim/rc/' . a:path))
if !use_global
execute 'source' fnameescape(abspath)
return
endif

" substitute all 'set' to 'setglobal'
let content = map(readfile(abspath),
\ 'substitute(v:val, "^\\W*\\zsset\\ze\\W", "setglobal", "")')
" create tempfile and source the tempfile
let tempfile = tempname()
try
call writefile(content, tempfile)
execute 'source' fnameescape(tempfile)
finally
if filereadable(tempfile)
call delete(tempfile)
endif
endtry
endfunction


if has('vim_starting')
call s:source_rc('init.vim')
endif

call s:source_rc('dein.vim')

if !has('vim_starting')
call dein#call_hook('source')
call dein#call_hook('post_source')

syntax enable
filetype plugin indent on
endif
call s:source_rc('general.vim')
call s:source_rc('mappings.vim')

"---------------------------------------------------------------------------

set secure

" vim: foldmethod=marker

0 comments on commit e57cfad

Please sign in to comment.