set nocompatible
set linebreak
syntax on
set number 
map <silent> <up> gk
map <silent> <down> gj
set spelllang=fr

" for traditional console
" set background=dark
" colorscheme habamax 
" colorscheme slate
" colorscheme quiet

" for light terminal
" set background=light

set wrap

" search
set incsearch "incremental search
set hlsearch "highlight search
set ignorecase
set smartcase
set autochdir

" folding
"set foldenable
"set foldmethod=syntax

" mouse support
" set mouse=a

" for tinycore
set encoding=utf-8
set backspace=2

" indent
set smartindent
set tabstop=4
set shiftwidth=4

" ctrlp
" see https://ctrlpvim.github.io/ctrlp.vim/
" set runtimepath^=~/.vim/bundle/ctrlp.vim

" add git root to path
function! AddGitRootToVimPath()
  if executable('git')
    let l:git_root = system('git -C ' . expand('%:p:h') . ' rev-parse --show-toplevel 2>/dev/null')
    if v:shell_error == 0
      let l:git_root = substitute(l:git_root, '\n', '', 'g')
      execute 'set path+=' . l:git_root
    endif
  endif
endfunction

autocmd BufEnter * call AddGitRootToVimPath()

" homemade ctrl-p
set path+=**
set wildmenu
set wildmode=longest:full,full
set wildoptions=pum,fuzzy

nnoremap <C-p> :tabfind<Space>*

" ctrl-j for terminal
nnoremap <C-j> :below terminal<CR>

" explorer
nnoremap <C-k><C-b> :30Vex<CR>
