debianvim8yaml
软件安装:
sed -i "s/deb.debian.org/mirrors.tencent.com/g" /etc/apt/sources.list && apt-get update &&
apt-get install -y vim-nox yamllint ansible-lint git &&
mkdir -p ~/.vim/pack/plugins/start && cd $_ &&
git clone https://github.com/Yggdroot/indentLine &&
git clone https://github.com/pedrohdz/vim-yaml-folds &&
git clone https://github.com/stephpy/vim-yaml &&
git clone https://github.com/Shougo/neocomplete.vim.git &&
git clone https://gitee.com/miaows/ale.git &&
git clone https://github.com/pearofducks/ansible-vim.git &&
mkdir -p ~/.config/yamllint &&
rm -rf /var/lib/apt/lists/*
yamllint 配置
tee -a ~/.config/yamllint/conf<<-"EOF"extends: relaxed
rules:
line-length: disable
EOF
vim 配置
tee ~/.vimrc <<-"EOF"set encoding=utf-8
scriptencoding utf-8
syntax on
"Ansible
let g:ansible_goto_role_paths = "./roles,../_common/roles"
function! FindAnsibleRoleUnderCursor()
if exists("g:ansible_goto_role_paths")
let l:role_paths = g:ansible_goto_role_paths
else
let l:role_paths = "./roles"
endif
let l:tasks_main = expand("<cfile>") . "/tasks/main.yml"
let l:found_role_path = findfile(l:tasks_main, l:role_paths)
if l:found_role_path == ""
echo l:tasks_main . " not found"
else
execute "edit " . fnameescape(l:found_role_path)
endif
endfunction
au BufRead,BufNewFile */ansible/*.yml nnoremap <leader>gr :call FindAnsibleRoleUnderCursor()<CR>
au BufRead,BufNewFile */ansible/*.yml vnoremap <leader>gr :call FindAnsibleRoleUnderCursor()<CR>
"Yaml File config
autocmd FileType yaml setlocal ts=2 sts=2 sw=2 expandtab
set foldlevelstart=20
let g:ale_echo_msg_format = "[%linter%] %s [%severity%]"
let g:ale_sign_error = "✘"
let g:ale_sign_warning = "⚠"
let g:ale_lint_on_text_changed = "never"
"Note: This option must be set in .vimrc(_vimrc). NOT IN .gvimrc(_gvimrc)!
" Disable AutoComplPop.
let g:acp_enableAtStartup = 0
" Use neocomplete.
let g:neocomplete#enable_at_startup = 1
" Use smartcase.
let g:neocomplete#enable_smart_case = 1
" Set minimum syntax keyword length.
let g:neocomplete#sources#syntax#min_keyword_length = 3
" Define dictionary.
let g:neocomplete#sources#dictionary#dictionaries = {
"default" : "",
"vimshell" : $HOME."/.vimshell_hist",
"scheme" : $HOME."/.gosh_completions"
}
" Define keyword.
if !exists("g:neocomplete#keyword_patterns")
let g:neocomplete#keyword_patterns = {}
endif
let g:neocomplete#keyword_patterns["default"] = "hw*"
" Plugin key-mappings.
inoremap <expr><C-g> neocomplete#undo_completion()
inoremap <expr><C-l> neocomplete#complete_common_string()
" Recommended key-mappings.
" <CR>: close popup and save indent.
inoremap <silent> <CR> <C-r>=<SID>my_cr_function()<CR>
function! s:my_cr_function()
return (pumvisible() ? "<C-y>" : "" ) . "<CR>"
" For no inserting <CR> key.
"return pumvisible() ? "<C-y>" : "<CR>"
endfunction
" <TAB>: completion.
inoremap <expr><TAB> pumvisible() ? "<C-n>" : "<TAB>"
" <C-h>, <BS>: close popup and delete backword char.
inoremap <expr><C-h> neocomplete#smart_close_popup()."<C-h>"
inoremap <expr><BS> neocomplete#smart_close_popup()."<C-h>"
" Close popup by <Space>.
"inoremap <expr><Space> pumvisible() ? "<C-y>" : "<Space>"
" AutoComplPop like behavior.
"let g:neocomplete#enable_auto_select = 1
" Shell like behavior(not recommended).
"set completeopt+=longest
"let g:neocomplete#enable_auto_select = 1
"let g:neocomplete#disable_auto_complete = 1
"inoremap <expr><TAB> pumvisible() ? "<Down>" : "<C-x><C-u>"
" Enable omni completion.
autocmd FileType css setlocal omnifunc=csscomplete#CompleteCSS
autocmd FileType html,markdown setlocal omnifunc=htmlcomplete#CompleteTags
autocmd FileType javascript setlocal omnifunc=javascriptcomplete#CompleteJS
autocmd FileType python setlocal omnifunc=pythoncomplete#Complete
autocmd FileType xml setlocal omnifunc=xmlcomplete#CompleteTags
" Enable heavy omni completion.
if !exists("g:neocomplete#sources#omni#input_patterns")
let g:neocomplete#sources#omni#input_patterns = {}
endif
"let g:neocomplete#sources#omni#input_patterns.php = "[^. ]->hw*|hw*::"
"let g:neocomplete#sources#omni#input_patterns.c = "[^.[:digit:] * ]\%(.|->)"
"let g:neocomplete#sources#omni#input_patterns.cpp = "[^.[:digit:] * ]\%(.|->)|hw*::"
" For perlomni.vim setting.
" https://github.com/c9s/perlomni.vim
let g:neocomplete#sources#omni#input_patterns.perl = "hw*->hw*|hw*::"
EOF
以上是 debianvim8yaml 的全部内容, 来源链接: utcz.com/z/519228.html