call plug#begin('~/.local/share/nvim/site/plugged')
Plug 'junegunn/goyo.vim'
Plug 'rktjmp/lush.nvim'
Plug 'tpope/vim-sensible'
Plug '~/Dotfiles/nvim/theme/cyberqueer.nvim'
Plug 'arecarn/vim-crunch'
Plug 'preservim/nerdtree'
Plug 'ryanoasis/vim-devicons'
Plug 'junegunn/fzf', { 'do': { -> fzf#install() } }
Plug 'junegunn/fzf.vim'
Plug 'vim-airline/vim-airline'
Plug 'vim-airline/vim-airline-themes'
Plug 'voldikss/vim-floaterm'
Plug 'rust-lang/rust.vim'
Plug 'norcalli/nvim-colorizer.lua'
Plug 'neoclide/coc.nvim', {'branch': 'release'}
Plug 'mg979/vim-visual-multi', {'branch': 'master'}
Plug 'SirVer/ultisnips'
Plug 'honza/vim-snippets'
Plug 'mfussenegger/nvim-dap'
Plug 'elihunter173/dirbuf.nvim'
Plug 'tpope/vim-dadbod'
Plug 'kristijanhusak/vim-dadbod-ui'
Plug 'kristijanhusak/vim-dadbod-completion' "Optional
Plug 'nvim-mini/mini.icons'
Plug 'tadmccorkle/markdown.nvim'
Plug 'ellisonleao/glow.nvim'
call plug#end()
colorscheme cyberqueer
let g:airline_powerline_fonts = 1
let g:airline_theme='cyberqueer'
let g:loaded_ruby_provider = 0
let g:loaded_perl_provider = 0
" Trigger configuration. You need to change this to something other than <tab> if you use one of the following:
" - https://github.com/Valloric/YouCompleteMe
" - https://github.com/nvim-lua/completion-nvim
let g:UltiSnipsExpandTrigger="<C-tab>"
let g:UltiSnipsJumpForwardTrigger="<c-b>"
let g:UltiSnipsJumpBackwardTrigger="<c-z>"

" If you want :UltiSnipsEdit to split your window.
let g:UltiSnipsEditSplit="vertical"

syntax on
filetype on
set number
set cursorline
set cursorcolumn
set noshowmode

syntax enable
filetype plugin indent on

" Set shift width to 4 spaces.
set shiftwidth=4

" Do not let cursor scroll below or above N number of lines when scrolling.
set scrolloff=5

" Do not wrap lines. Allow long lines to extend as far as the line goes.
set nowrap

" While searching though a file incrementally highlight matching characters as you type.
set incsearch

" Ignore capital letters during search.
set ignorecase

" Override the ignorecase option if searching for capital letters.
" This will allow you to search specifically for capital letters.
set smartcase

" Show partial command you type in the last line of the screen.
set showcmd

" Show matching words during a search.
set showmatch

" Use highlighting when doing a search.
set hlsearch

" Set the commands to save in history default number is 20.
set history=1000

set relativenumber

" Enable auto completion menu after pressing TAB.
set wildmenu

" Make wildmenu behave like similar to Bash completion.
set wildmode=list:longest

let time=system('date "+%H:%M:%S|%d.%m.%Y" | tr -d "\n"')
let hostname=system('hostname -s | tr -d "\n"')
let ipaddr=system('hostname -i | tr -d "\n"')
let g:airline_section_x = 'IP:%{ipaddr} DNS:%{hostname}'

nnoremap <C-l> <C-w>w
nnoremap <C-h> <C-w>h
nnoremap <C-j> <C-w>j
nnoremap <C-k> <C-w>k

:nnoremap t :FloatermNew<CR>
:nnoremap e :NERDTreeToggle<CR><C-W>l
:nnoremap s :DBUIToggle<CR>
:nnoremap x <Plug>(DBUI_ExecuteQuery)
:nnoremap q :wq<CR>

:inoremap <TAB> <C-N>
:inoremap <S-TAB> <TAB>

" :inoremap <TAB> <C-N>
" :inoremap <S-TAB> <TAB>
"
" #####################################################
let g:coc_global_extensions=[ 'coc-snippets', 'coc-powershell', 'coc-sh', 'coc-omnisharp', 'coc-clangd', 'coc-json', 'coc-css', 'coc-git', 'coc-pyright', 'coc-sql']

" Use <C-l> for trigger snippet expand.
imap <C-l> <Plug>(coc-snippets-expand)

" Use <C-j> for select text for visual placeholder of snippet.
vmap <C-j> <Plug>(coc-snippets-select)

" Use <C-j> for jump to next placeholder, it's default of coc.nvim
let g:coc_snippet_next = '<c-j>'

" Use <C-k> for jump to previous placeholder, it's default of coc.nvim
let g:coc_snippet_prev = '<c-k>'

" Use <C-j> for both expand and jump (make expand higher priority.)
imap <C-j> <Plug>(coc-snippets-expand-jump)

" Use <leader>x for convert visual selected code to snippet
xmap <leader>x  <Plug>(coc-convert-snippet)

" #####################################################

function! s:check_back_space() abort
    let col = col('.') - 1
    return !col || getline('.')[col - 1] =~ '\s'
endfunction

inoremap <expr> <Tab> coc#pum#visible() ? coc#pum#next(1) : "\<Tab>"
inoremap <expr> <S-Tab> coc#pum#visible() ? coc#pum#prev(1) : "\<S-Tab>"
" Save as sudo
ca w!! w !sudo tee "%"

" <CR>: confirm completion, or insert <CR>
inoremap <expr> <CR> pumvisible() ? "\<C-Y>" : "\<CR>"
command! Vb normal! <C-v>

lua require('glow').setup()
