syntax on
set nocompatible
filetype off


" Vundle initialize
" If you choose to update vundle on your own, incomment the following line.
"set rtp+=~/.vimde/bundle/Vundle.vim
set rtp+=/usr/share/vimde/bundle/Vundle.vim
call vundle#begin('/usr/share/vimde/bundle')

Plugin 'deoplete-jedi', {'pinned': 1}
Plugin 'deoplete.nvim', {'pinned': 1}
Plugin 'nvim-yarp', {'pinned': 1}
Plugin 'salt-vim', {'pinned': 1}
Plugin 'vim-auto-save', {'pinned': 1}
Plugin 'vim-colorschemes', {'pinned': 1}
Plugin 'vim-hug-neovim-rpc', {'pinned': 1}
Plugin 'Vim-Jinja2-Syntax', {'pinned': 1}
Plugin 'vimux', {'pinned': 1}
Plugin 'Vundle.vim', {'pinned': 1}
Plugin 'supertab', {'pinned': 1}
Plugin 'vim-tmux-navigator', {'pinned': 1}
Plugin 'vim-pandoc', {'pinned': 1}
Plugin 'vim-pandoc-syntax', {'pinned': 1}
Plugin 'vim-ripgrep', {'pinned': 1}



call vundle#end()

" Required plugin settings
filetype plugin indent on

" Activate Deoplete autocompletions
let g:python3_host_prog='/usr/bin/python3'
let g:deoplete#enable_at_startup = 1
let g:deoplete#sources#jedi#enable_typeinfo = 0

" Ale linter setup
let g:ale_linter_aliases = {
\       'sls': 'salt'
\}

let g:ale_linters = {
\       'python': ['pylint'],
\       'salt': ['salt-lint'],
\       'spec': ['rpmlint'],
\}

" Rulers, colors, etc.
set number
set relativenumber
color gruvbox
set background=dark
set backspace="indent,eol,start"

" Set leader mapping to spacebar
nnoremap <SPACE> <Nop>
let mapleader = " " 

" Set syntax for files
autocmd BufNewFile,BufRead *vimderc set syntax=vim
autocmd BufNewFile,BufRead Jenkinsfile set syntax=groovy

" Set autosave
let g:auto_save = 1
let g:auto_save_in_insert_mode = 1
let g:auto_save_no_updatetime = 1

" Force use of Django template syntax
let g:sls_use_jinja_syntax = 1

" NerdTree settings
autocmd VimEnter * NERDTree .
let NERDTreeShowHidden=1
nnoremap <leader>nt :NERDTreeToggle<CR>

" Jump to the main window
autocmd VimEnter * wincmd p

" Supertab reverse scroll
let g:SuperTabDefaultCompletionType = "<c-n>"

" Kitchen bindings
nnoremap <leader>kl :call VimuxRunCommand("kitchen list")<CR>
nnoremap <leader>kd :call VimuxRunCommand("kitchen destroy")<CR>
nnoremap <leader>kt :call VimuxRunCommand("kitchen test")<CR>
nnoremap <leader>kc :call VimuxPromptCommand("kitchen converge ")<CR>
nnoremap <leader>kv :call VimuxPromptCommand("kitchen verify ")<CR>

" Generic Vimux  bindings
nnoremap <leader>to :call VimuxOpenRunner()<CR>  
nnoremap <leader>tq :call VimuxCloseRunner()<CR> 
nnoremap <leader>tl :call VimuxRunLastCommand()<CR> 
nnoremap <leader>ts :call VimuxInterruptRunner()<CR>
nnoremap <leader>tc :call VimuxClearRunnerHistory()<CR>
nnoremap <leader>tz :call VimuxZoomRunner()<CR>

" RPM/Fedpkg bindings
nnoremap <leader>dl :call VimuxRunCommand("spectool -g *.spec")<CR> 
nnoremap <leader>fb :call VimuxRunCommand("fedpkg build")<CR>
nnoremap <leader>fc :call VimuxPromptCommand("fedpkg clone ")<CR>
nnoremap <leader>fi :call VimuxPromptCommand("fedpkg import ")<CR>
nnoremap <leader>fl :call VimuxRunCommand("fedpkg lint")<CR> 
nnoremap <leader>fm :call VimuxRunCommand("fedpkg mockbuild")<CR> 
nnoremap <leader>fn :call VimuxRunCommand("fedpkg clean")<CR>
nnoremap <leader>fr :call VimuxRunCommand("fedpkg sources")<CR>
nnoremap <leader>fs :call VimuxRunCommand("fedpkg srpm")<CR>
nnoremap <leader>ft :call VimuxRunCommand("fedpkg scratch-build")<CR>
nnoremap <leader>rs:call VimuxRunCommand("rpmspec -P *.spec")<CR>

" Python interpreter bindings
nnoremap <leader>py :call VimuxRunCommand("bpython")<CR>

" Force vim split navigation to better match tmux
nnoremap <C-J> <C-W><C-J>
nnoremap <C-K> <C-W><C-K>
nnoremap <C-L> <C-W><C-L>
nnoremap <C-H> <C-W><C-H>


