Skip to content

Instantly share code, notes, and snippets.

@montj2
Created November 13, 2021 17:11
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save montj2/5d4748f882eb82c1ad5bc6b118af1cfd to your computer and use it in GitHub Desktop.
Save montj2/5d4748f882eb82c1ad5bc6b118af1cfd to your computer and use it in GitHub Desktop.
Standard vimrc
syntax on
if empty(glob('~/.vim/autoload/plug.vim'))
silent !curl -fLo ~/.vim/autoload/plug.vim --create-dirs
\ https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim
autocmd VimEnter * PlugInstall --sync | source $MYVIMRC
endif
" change the leader key from \ to ,
let mapleader = ","
" Big moves
" Move up and down by 20 spaces
nnoremap <C-j> 20<C-E>
nnoremap <C-k> 20<C-Y>
"split navigations
nnoremap <C-J> <C-W><C-J>
nnoremap <C-K> <C-W><C-K>
nnoremap <C-L> <C-W><C-L>
nnoremap <C-H> <C-W><C-H>
" Enter a new line below cursor, non-insert
nmap <S-Enter> o<Esc>
" Enable folding
set foldmethod=indent
set foldlevel=99
" Enable folding with the spacebar
nnoremap <space> za
" Linting Setup
let g:ale_fixers = {
\ 'javascript': ['eslint']
\ }
let g:ale_sign_error = '❌'
let g:ale_sign_warning = '⚠️'
let g:ale_fix_on_save = 1
" Enable DocString comments to remain visible
let g:SimpylFold_docstring_preview=1
" PEP 8 for Python
au BufNewFile, BufRead *.py
\ set tabstop=4
\ set softtabstop=4
\ set shiftwidth=4
\ set textwidth=89
\ set expandtab
\ set autoindent
\ set fileformat=unix
" Full stack development
au BufNewFile,BufRead *.js,*.html,*.css,*.vue set tabstop=2
au BufNewFile,BufRead *.js,*.html,*.css,*.vue set softtabstop=2
au BufNewFile,BufRead *.js,*.html,*.css,*.vue set shiftwidth=2
au BufNewFile,BufRead *.js,*.html,*.css,*.vue set expandtab
au BufNewFile,BufRead *.js,*.html,*.css,*.vue set autoindent
" Catch the bad whitespace
au BufRead, BufNewFile *.py match BadWhitespace /\s\+$/
" Python safety net encoding
set encoding=utf-8
" You Complete Me helpers
let g:ycm_autoclose_preview_window_after_completion=1
map <leader>g :YcmCompleter GoToDefinitionElseDeclaration<CR>
" Use tab for trigger completion with characters ahead and navigate.
" NOTE: Use command ':verbose imap <tab>' to make sure tab is not mapped by
" other plugin before putting this into your config.
"inoremap <silent><expr> <TAB>
" \ pumvisible() ? "\<C-n>" :
" \ <SID>check_back_space() ? "\<TAB>" :
" \ coc#refresh()
"inoremap <expr><S-TAB> pumvisible() ? "\<C-p>" : "\<C-h>"
function! s:check_back_space() abort
let col = col('.') - 1
return !col || getline('.')[col - 1] =~ '\s'
endfunction
inoremap <silent><expr> <Tab>
\ pumvisible() ? "\<C-n>" :
\ <SID>check_back_space() ? "\<Tab>" :
\ kite#completion#autocomplete()
" Python with virtualenv support
" py3 << EOF
" import os
"import sys
"if 'VIRTUAL_ENV' in os.environ:
" project_base_dir = os.environ['VIRTUAL_ENV']
" activate_this = os.path.join(project_base_dir, 'bin/activate_this.py')
" #execfile(activate_this, dict(__file__=activate_this))
" exec(open(activate_this).read(), {'__file__': activate_this})
"EOF
let python_highlight_all=1
" Ignore files in NERDTree
let NERDTreeIgnore=['\.pyc$', '\~$']
map <leader>t :NERDTreeToggle<CR>
" enable line numbers
let NERDTreeShowLineNumbers=1
" make sure relative line numbers are used
autocmd FileType nerdtree setlocal relativenumber
" Auto close NERDTree when opening a file
let NERDTreeQuitOnOpen=1
" auto close NERDTree with last exit
autocmd bufenter * if (winnr("$") == 1 && exists("b:NERDTree") && b:NERDTree.isTabTree()) | q | endif
" MD Preview requirements due to GRIP
let vim_markdown_preview_github=1
call plug#begin()
Plug 'https://github.com/myusuf3/numbers.vim.git'
Plug 'neoclide/coc.nvim', {'branch': 'release'}
Plug 'tpope/vim-sensible'
Plug 'fisadev/vim-isort'
Plug 'godlygeek/tabular'
Plug 'posva/vim-vue'
Plug 'plasticboy/vim-markdown'
Plug 'JamshedVesuna/vim-markdown-preview'
Plug 'vim-scripts/indentpython.vim'
Plug 'tmhedberg/SimpylFold'
" Plug 'Valloric/YouCompleteMe'
Plug 'vim-syntastic/syntastic'
Plug 'nvie/vim-flake8'
Plug 'scrooloose/nerdtree'
Plug 'Xuyuanp/nerdtree-git-plugin'
Plug 'arcticicestudio/nord-vim'
Plug 'tpope/vim-fugitive'
Plug 'powerline/powerline-fonts'
Plug 'vim-airline/vim-airline'
Plug 'chriskempson/base16-vim'
Plug 'w0rp/ale'
call plug#end()
colorscheme nord
nnoremap <leader>d :r!date "+\%F"
let g:Powerline_symbols = 'fancy'
let vim_markdown_preview_browser='Google Chrome'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment