" ===main setting commands
let mapleader=" "
syntax on
colorscheme molokai
set cursorline
" set cursorcolumn
set background=dark
set noeb vb t_vb=
set nobackup
set noundofile
set nohlsearch

set number
set relativenumber
set showcmd
set ignorecase
set smartcase
set tabstop=4
set expandtab
set shiftwidth=4
set autoindent
set fileencodings=utf-8,UTF-8,gbk,ucs-bom,cp936,latin1
set encoding=utf-8
set guifont=Consolas:h10
set clipboard=unnamed

" ===screen split
noremap sk :set nosplitbelow<CR>:split 
noremap sj :set splitbelow<CR>:split 
noremap sh :set nosplitright<CR>:vsplit 
noremap sl :set splitright<CR>:vsplit 

noremap <LEADER>q :q<CR>
noremap <LEADER>w :w<CR>
noremap <C-q> :q!<CR>

noremap K 5k
noremap J 5j
noremap H 5h
noremap L 5l

map <up> <C-w>k
map <down> <C-w>j
map <left> <C-w>h
map <right> <C-w>l

map <C-up> :res +5<CR>
map <C-down> :res -5<CR>
map <C-left> :vertical resize -5<CR>
map <C-right> :vertical resize +5<CR>

vnoremap ' di''<ESC>hp
vnoremap [ di[]<ESC>hp
vnoremap { di{}<ESC>hp
vnoremap ( di()<ESC>hp
vnoremap < di<><ESC>hp

inoremap <S-CR> <ESC>o
inoremap <C-CR> <ESC>O

" === Vim-Plugs

let plugpath = '~/.vim/plugged'
call plug#begin(plugpath)

Plug 'junegunn/vim-plug'
Plug 'preservim/nerdtree'
Plug 'gcmt/wildfire.vim'
Plug 'tpope/vim-surround'
Plug 'mg979/vim-visual-multi'

call plug#end()

" === nerdtree config
noremap <C-t> :NERDTreeToggle<CR>
autocmd bufenter * if (winnr("$") == 1 && exists("b:NERDTree") && b:NERDTree.isTabTree()) | q | endif
