Skip to content

Instantly share code, notes, and snippets.

@wiccy46
Created May 7, 2020 16:49
Show Gist options
  • Select an option

  • Save wiccy46/428f765aec06024185262059f1e5558c to your computer and use it in GitHub Desktop.

Select an option

Save wiccy46/428f765aec06024185262059f1e5558c to your computer and use it in GitHub Desktop.
[init.vim]nvim init #vim
if has('win32') || has('win64')
let g:plugged_home = '~/AppData/Local/nvim/plugged'
else
let g:plugged_home = '~/.vim/plugged'
endif
" Plugins List
call plug#begin(g:plugged_home)
" UI related
Plug 'chriskempson/base16-vim'
Plug 'vim-airline/vim-airline'
Plug 'vim-airline/vim-airline-themes'
" Plug 'tomasr/molakai'
Plug 'joshdick/onedark.vim'
" Better Visual Guide
Plug 'Yggdroot/indentLine'
" syntax check
Plug 'w0rp/ale'
" Autocomplete
Plug 'ncm2/ncm2'
Plug 'roxma/nvim-yarp'
Plug 'ncm2/ncm2-bufword'
Plug 'ncm2/ncm2-path'
Plug 'ncm2/ncm2-jedi'
" Formater
Plug 'Chiel92/vim-autoformat'
" File explorer
Plug 'preservim/nerdtree'
" Fzf find
Plug 'junegunn/fzf', { 'do': { -> fzf#install() } }
Plug 'junegunn/fzf.vim'
call plug#end()
filetype plugin indent on
" Configurations Part
" UI configuration
syntax on
syntax enable
" colorscheme
let base16colorspace=256
" colorscheme base16-gruvbox-dark-hard
silent! colorscheme onedark
set background=dark
" True Color Support if it's avaiable in terminal
if has("termguicolors")
set termguicolors
endif
if has("gui_running")
set guicursor=n-v-c-sm:block,i-ci-ve:block,r-cr-o:blocks
endif
set number
set relativenumber
set hidden
set mouse=a
set noshowmode
set noshowmatch
set nolazyredraw
" Turn off backup
set nobackup
set noswapfile
set nowritebackup
" Search configuration
set ignorecase " ignore case when searching
set smartcase " turn on smartcase
" Tab and Indent configuration
set expandtab
set tabstop=4
set shiftwidth=4
" vim-autoformat
noremap <F3> :Autoformat<CR>
" NCM2
augroup NCM2
autocmd!
" enable ncm2 for all buffers
autocmd BufEnter * call ncm2#enable_for_buffer()
" :help Ncm2PopupOpen for more information
set completeopt=noinsert,menuone,noselect
" When the <Enter> key is pressed while the popup menu is visible, it only
" hides the menu. Use this mapping to close the menu and also start a new line.
inoremap <expr> <CR> (pumvisible() ? "\<c-y>\<cr>" : "\<CR>")
" uncomment this block if you use vimtex for LaTex
" autocmd Filetype tex call ncm2#register_source({
" \ 'name': 'vimtex',
" \ 'priority': 8,
" \ 'scope': ['tex'],
" \ 'mark': 'tex',
" \ 'word_pattern': '\w+',
" \ 'complete_pattern': g:vimtex#re#ncm2,
" \ 'on_complete': ['ncm2#on_complete#omni', 'vimtex#complete#omnifunc'],
" \ })
augroup END
" Ale
let g:ale_lint_on_enter = 0
let g:ale_lint_on_text_changed = 'never'
let g:ale_echo_msg_error_str = 'E'
let g:ale_echo_msg_warning_str = 'W'
let g:ale_echo_msg_format = '[%linter%] %s [%severity%]'
let g:ale_linters = {'python': ['flake8']}
" Airline
let g:airline_left_sep = ''
let g:airline_right_sep = ''
let g:airline#extensions#ale#enabled = 1
let airline#extensions#ale#error_symbol = 'E:'
let airline#extensions#ale#warning_symbol = 'W:'
" NerdTree
autocmd StdinReadPre * let s:std_in=1
autocmd VimEnter * if argc() == 0 && !exists("s:std_in") | NERDTree | endif
let NERDTreeMapOpenInTab='<ENTER>'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment