"Visual
syntax on
set cursorline
set number
set ruler
set showcmd
set showmatch
set matchtime=1
set laststatus=2

"Search
set ignorecase
set smartcase
set incsearch
set wrapscan
set hlsearch
nmap <Esc><Esc> :nohlsearch<CR><Esc>
set wildmode=longest:full,full

"Tab
set expandtab
set smarttab
set tabstop=4
set shiftwidth=4
set softtabstop=4

"Clibboard
set clipboard=unnamedplus

"Indent
set autoindent
set smartindent

"File
set nobackup
set noswapfile
set autoread
set hidden

"Key map
inoremap jj <Esc>
nnoremap x "_x
nnoremap s "_s
nnoremap <Leader>h ^
nnoremap <Leader>l $
vnoremap <Leader>h ^
vnoremap <Leader>l $
nmap <Leader>w :w<CR>

"Environment
set undodir=$XDG_CACHE_HOME/vim/undo
set viminfo+='1000,n$XDG_CACHE_HOME/vim/viminfo
set runtimepath=$XDG_CONFIG_HOME/vim,$VIMRUNTIME,$XDG_CONFIG_HOME/vim/after,$XDG_DATA_HOME/vim
let $MYVIMRC="$XDG_CONFIG_HOME/vim/vimrc"

"vim-plug
if empty(glob('$XDG_DATA_HOME/vim/autoload/plug.vim'))
  silent !curl -fLo $XDG_DATA_HOME/vim/autoload/plug.vim --create-dirs
    \ https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim
  autocmd VimEnter * PlugInstall --sync | source $MYVIMRC
endif

call plug#begin('$XDG_DATA_HOME/vim/plugged')
Plug 'arcticicestudio/nord-vim'
Plug 'vim-airline/vim-airline'
Plug 'wakatime/vim-wakatime'
call plug#end()
colorscheme nord
let g:airline_powerline_fonts = 1