Skip to content

Instantly share code, notes, and snippets.

@sawaYch
Last active July 4, 2019 16:09
Show Gist options
  • Select an option

  • Save sawaYch/7949bb2489d11ce4f85011a5e4058a3f to your computer and use it in GitHub Desktop.

Select an option

Save sawaYch/7949bb2489d11ce4f85011a5e4058a3f to your computer and use it in GitHub Desktop.
My Neovim config
" Specify a directory for plugins
" - For Neovim: ~/.local/share/nvim/plugged
" - Avoid using standard Vim directory names like 'plugin'
call plug#begin('~/.vim/plugged')
Plug 'vim-airline/vim-airline'
Plug 'vim-airline/vim-airline-themes'
Plug 'scrooloose/nerdtree'
Plug 'jistr/vim-nerdtree-tabs' " enhance nerdtree's tabs
Plug 'ryanoasis/vim-devicons' " add beautiful icons besides files
Plug 'Xuyuanp/nerdtree-git-plugin' " display git status within Nerdtree
Plug 'tiagofumo/vim-nerdtree-syntax-highlight' " enhance devicons
Plug 'dracula/vim'
Plug 'scrooloose/nerdcommenter'
Plug 'kien/ctrlp.vim'
Plug 'ryanoasis/vim-devicons'
Plug 'https://github.com/vim-scripts/fcitx.vim.git'
" Initialize plugin system
call plug#end()
let g:airline_powerline_fonts = 1
filetype plugin indent on " required
set encoding=UTF-8
set smartindent
set autoindent
set cindent
set tabstop=4
set shiftwidth=4
set expandtab
" On pressing tab, insert 4 spaces
set foldmethod=indent
au BufWinLeave * silent mkview " save code fold
au BufRead * silent loadview " recover code fold
nnoremap <space> za " use space change code fold
" Ctrl+N 打開/關閉
map <C-n> :NERDTreeToggle<CR>
" 不帶參數打開NeoVim時自動加載NERDTree
autocmd StdinReadPre * let s:std_in=1
" 當所有文件關閉曷關閉項目樹窗格
autocmd bufenter * if (winnr("$") == 1 && exists("b:NERDTreeType") && b:NERDTreeType == "primary") | q | endif
" 隱藏這些文件
let NERDTreeIgnore=['\.pyc$', '\~$', 'node_modules'] "ignore files in NERDTree
" 隱藏額外信息,例如幫助,提示
let NERDTreeMinimalUI=1
let g:ctrlp_working_path_mode = 'ra'
set wildignore+=*/tmp/*,*/node_modules/*,*.so,*.swp,*.zip
let g:ctrlp_custom_ignore = {'dir': '\v[\/]\.(git|hg|svn)$', 'file': '\v\.(exe|so|dll)$'}
let g:Powerline_symbols = 'fancy'
set encoding=utf-8
set t_Co=256
set fillchars+=stl:\ ,stlnc:\
set termencoding=utf-8
let mapleader=';'
syntax on
color dracula
let g:airline#extensions#tabline#enabled = 1
set hidden " 不保存都可以轉buffer
"let g:indent_guides_enable_on_vim_startup = 1
" buffer快速揭頁,bp=previous;bn=next
nnoremap <Leader>b :bp<CR>
nnoremap <Leader>f :bn<CR>
" 查找buffers
nnoremap <Leader>l :ls<CR>
" 通過索引快速跳轉
nnoremap <Leader>1 :1b<CR>
nnoremap <Leader>2 :2b<CR>
nnoremap <Leader>3 :3b<CR>
nnoremap <Leader>4 :4b<CR>
nnoremap <Leader>5 :5b<CR>
nnoremap <Leader>6 :6b<CR>
nnoremap <Leader>7 :7b<CR>
nnoremap <Leader>8 :8b<CR>
nnoremap <Leader>9 :9b<CR>
nnoremap <Leader>0 :10b<CR>
" Add spaces after comment delimiters by default
let g:NERDSpaceDelims = 1
let g:NERDTreeDirArrowExpandable = '▸'
let g:NERDTreeDirArrowCollapsible = '▾'
" loading the plugin
let g:webdevicons_enable = 1
" adding the flags to NERDTree
let g:webdevicons_enable_nerdtree = 1
" adding the custom source to unite
let g:webdevicons_enable_unite = 1
" adding the column to vimfiler
let g:webdevicons_enable_vimfiler = 1
" adding to vim-airline's tabline
let g:webdevicons_enable_airline_tabline = 1
" adding to vim-airline's statusline
let g:webdevicons_enable_airline_statusline = 1
" ctrlp glyphs
let g:webdevicons_enable_ctrlp = 1
" adding to vim-startify screen
let g:webdevicons_enable_startify = 1
" adding to flagship's statusline
let g:webdevicons_enable_flagship_statusline = 1
" turn on/off file node glyph decorations (not particularly useful)
let g:WebDevIconsUnicodeDecorateFileNodes = 1
" use double-width(1) or single-width(0) glyphs
" only manipulates padding, has no effect on terminal or set(guifont) font
let g:WebDevIconsUnicodeGlyphDoubleWidth = 1
" whether or not to show the nerdtree brackets around flags
let g:webdevicons_conceal_nerdtree_brackets = 1
" the amount of space to use after the glyph character (default ' ')
let g:WebDevIconsNerdTreeAfterGlyphPadding = ' '
" Force extra padding in NERDTree so that the filetype icons line up vertically
let g:WebDevIconsNerdTreeGitPluginForceVAlign = 1
" Adding the custom source to denite
let g:webdevicons_enable_denite = 1
set clipboard=unnamedplus
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment