Skip to content

Instantly share code, notes, and snippets.

@wkei
Last active January 16, 2019 04:23
Show Gist options
  • Save wkei/32b299e22387ef89263167d650ff78ca to your computer and use it in GitHub Desktop.
Save wkei/32b299e22387ef89263167d650ff78ca to your computer and use it in GitHub Desktop.
.vimrc
execute pathogen#infect()
set nocompatible
filetype off
filetype plugin indent on
" color
syntax on
set nu
colorscheme base16-materia
" key leader
let mapleader=";"
" key mapping
imap jk <esc>
nmap ss :w<cr>
nmap sa :wa<cr>
nmap zz :xa<cr>
nmap qq :q!<cr>
nmap qa :qa!<cr>
imap <c-z> <esc>:update<cr>
imap <c-s> <esc>:update<cr>
nmap <S-h> <C-w>h
nmap <S-j> <C-w>j
nmap <S-k> <C-w>k
nmap <S-l> <C-w>l
nnoremap <C-t> :tabnew<Space>
inoremap <C-t> <Esc>:tabnew<Space>
map <C-h> gT
map <C-l> gt
" make delete key works
set backspace=2
set backspace=indent,eol,start
" cursor location
set ruler
" word wrap
set wrap
" mouse
set mouse=a
" tab width 2, expandtab
set tabstop=2
set shiftwidth=2
set softtabstop=2
set expandtab
" scoll page at last third line
set scrolloff=3
" hidden buffers
set hidden
" rendering
set ttyfast
" status bar
set laststatus=2
" search
set hlsearch
set incsearch
set ignorecase
set smartcase
set showmatch
map <leader><space> :let @/=''<cr> " clear search
" remember last position
if has("autocmd")
au BufReadPost * if line("'\"") > 1 && line("'\"") <= line("$") | exe "normal! g'\"" | endif
endif
" end of line
set listchars=tab:▸\ ,eol:¬
" toggle
map <leader>l :set list!<CR> " Toggle tabs and EOL
" share clipboard
set clipboard=unnamed
set nocompatible
filetype off
set rtp+=~/.vim/bundle/Vundle.vim
call vundle#begin()
"=============================ui
Plugin 'KeitaNakamura/neodark.vim'
Plugin 'vim-airline/vim-airline'
Plugin 'vim-airline/vim-airline-themes'
"=============================ui
"=============================helper
Plugin 'jiangmiao/auto-pairs'
Plugin 'editorconfig/editorconfig-vim'
"=============================helper
"=============================nerdtree
Plugin 'scrooloose/nerdtree'
let NERDTreeShowHidden=1
" How can I open a NERDTree automatically when vim starts up?
autocmd VimEnter * NERDTree
" Go to previous (last accessed) window.
autocmd VimEnter * wincmd p
" How can I open a NERDTree automatically when vim starts up if no files were specified?
autocmd StdinReadPre * let s:std_in=1
autocmd VimEnter * if argc() == 0 && !exists("s:std_in") | NERDTree | endif
" How can I open NERDTree automatically when vim starts up on opening a directory?
autocmd StdinReadPre * let s:std_in=1
autocmd VimEnter * if argc() == 1 && isdirectory(argv()[0]) && !exists("s:std_in") | exe 'NERDTree' argv()[0] | wincmd p | ene | endif
" How can I close vim if the only window left open is a NERDTree?
autocmd bufenter * if (winnr("$") == 1 && exists("b:NERDTree") && b:NERDTree.isTabTree()) | q | endif
let g:NERDTreeDirArrowExpandable = '▸'
let g:NERDTreeDirArrowCollapsible = '▾'
map <C-N> :NERDTreeToggle<CR>
Plugin 'jistr/vim-nerdtree-tabs'
map <Leader>n <plug>NERDTreeTabsToggle<CR>
let g:nerdtree_tabs_open_on_console_startup=1
let g:nerdtree_tabs_meaningful_tab_names=1
let g:nerdtree_tabs_focus_on_files=1
"=============================nerdtree
"=============================nerdcommenter
Plugin 'scrooloose/nerdcommenter'
" Add spaces after comment delimiters by default
let g:NERDSpaceDelims = 1
" Use compact syntax for prettified multi-line comments
let g:NERDCompactSexyComs = 1
" Align line-wise comment delimiters flush left instead of following code indentation
let g:NERDDefaultAlign = 'left'
" Set a language to use its alternate delimiters by default
let g:NERDAltDelims_java = 1
" Add your own custom formats or override the defaults
let g:NERDCustomDelimiters = { 'c': { 'left': '/**','right': '*/' } }
" Allow commenting and inverting empty lines (useful when commenting a region)
let g:NERDCommentEmptyLines = 1
" Enable trimming of trailing whitespace when uncommenting
let g:NERDTrimTrailingWhitespace = 1
"=============================nerdcommenter
"=============================ctrlp
Plugin 'ctrlpvim/ctrlp.vim'
set wildignore+=*/tmp/*,*.so,*.swp,*.zip
let g:ctrlp_custom_ignore = 'node_modules\|DS_Store\|git'
let g:ctrlp_match_window = 'bottom,order:ttb'
let g:ctrlp_switch_buffer = 0
let g:ctrlp_working_path_mode = 0
let g:ctrlp_user_command = 'ag %s -l --nocolor --hidden -g ""'
"=============================ctrlp
"=============================ack
Plugin 'mileszs/ack.vim'
imap <C-F> :Ack<space>
map <C-F> :Ack<space>
"=============================ack
"=============================syntax
Plugin 'OrangeT/vim-csharp'
Plugin 'pangloss/vim-javascript'
Plugin 'mxw/vim-jsx'
Plugin 'posva/vim-vue'
"=============================syntax
call vundle#end()
filetype plugin indent on
" color
set termguicolors
syntax on
colorscheme neodark
set nu
" key leader
let mapleader=";"
" key mapping
imap jk <esc>
nmap ss :w<cr>
nmap sa :wa<cr>
nmap xa :xa<cr>
nmap qq :q!<cr>
nmap qa :qa!<cr>
imap <c-z> <esc>:update<cr>
imap <c-s> <esc>:update<cr>
nmap <S-h> <C-w>h
nmap <S-j> <C-w>j
nmap <S-k> <C-w>k
nmap <S-l> <C-w>l
nnoremap <C-t> :tabnew<Space>
inoremap <C-t> <Esc>:tabnew<Space>
map <C-h> gT
map <C-l> gt
" make delete key works
set backspace=2
set backspace=indent,eol,start
" cursor location
set ruler
" word wrap
set wrap
" mouse
set mouse=a
" tab width 2, expandtab
set tabstop=2
set shiftwidth=2
set softtabstop=2
set expandtab
" scoll page at last third line
set scrolloff=3
" hidden buffers
set hidden
" rendering
set ttyfast
" status bar
set laststatus=2
" search
set hlsearch
set incsearch
set ignorecase
set smartcase
set showmatch
map <leader><space> :let @/=''<cr> " clear search
" remember last position
if has("autocmd")
au BufReadPost * if line("'\"") > 1 && line("'\"") <= line("$") | exe "normal! g'\"" | endif
endif
" end of line
set listchars=tab:▸\ ,eol:¬
" toggle
map <leader>l :set list!<CR> " Toggle tabs and EOL
" share clipboard
set clipboard=unnamed
" fold
set foldmethod=indent
set foldnestmax=10
set nofoldenable
set foldlevel=2
set nocompatible
" ui
syntax on
set nu
set ruler
set cursorline
set mouse=a
" tab & indent
set tabstop=2
set shiftwidth=2
set expandtab
set autoindent
" modify backspace key
set backspace=indent,eol,start
" share clipboard
set clipboard=unnamed
" map
" turn off search highlight
map <c-l> :noh<cr>
" open tree
map <c-v> :Vex<cr>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment