Skip to content

Instantly share code, notes, and snippets.

@yzdann
Created July 8, 2020 13:58
Show Gist options
  • Save yzdann/66469baa5481075207ccc3099c91c03c to your computer and use it in GitHub Desktop.
Save yzdann/66469baa5481075207ccc3099c91c03c to your computer and use it in GitHub Desktop.
" commentry Plugin
:set nocompatible
filetype off
set rtp+=~/.vim/bundle/Vundle.vim
call vundle#begin()
" vundle
Plugin 'VundleVim/Vundle.vim'
" theme
Plugin 'liuchengxu/space-vim-dark'
" nerd tree and tagbar
Plugin 'scrooloose/nerdtree'
Plugin 'majutsushi/tagbar'
Plugin 'ludovicchabant/vim-gutentags'
" airline
Plugin 'vim-airline/vim-airline-themes'
Plugin 'bling/vim-airline'
" git things
Plugin 'Xuyuanp/nerdtree-git-plugin'
Plugin 'tpope/vim-fugitive'
Plugin 'airblade/vim-gitgutter'
Plugin 'junegunn/gv.vim'
" linter
Plugin 'w0rp/ale'
Plugin 'nvie/vim-flake8'
" search
Plugin 'kien/ctrlp.vim'
" snippets and autocomplete
Plugin 'Valloric/YouCompleteMe'
Plugin 'SirVer/ultisnips'
Plugin 'honza/vim-snippets'
Plugin 'chr4/nginx.vim'
Plugin 'chr4/sslsecure.vim'
Plugin 'Matt-Deacalion/vim-systemd-syntax'
Plugin 'lifepillar/pgsql.vim'
Plugin 'davidhalter/jedi-vim'
Plugin 'fatih/vim-go', { 'do': ':GoInstallBinaries' }
" misc1
Plugin 'tpope/vim-unimpaired'
Plugin 'tpope/vim-surround'
Plugin 'scrooloose/nerdcommenter'
" Plugin 'sjl/gundo.vim'
Plugin 'terryma/vim-multiple-cursors'
" misc2
Plugin 'ervandew/supertab'
Plugin 'tmhedberg/SimpylFold'
Plugin 'vim-scripts/indentpython.vim'
Plugin 'Yggdroot/indentLine'
Plugin 'kien/rainbow_parentheses.vim'
Plugin 'jiangmiao/auto-pairs'
" html markdown and jinja
Plugin 'mattn/emmet-vim'
Plugin 'lepture/vim-jinja'
Plugin 'tpope/vim-markdown'
Plugin 'junegunn/goyo.vim'
Plugin 'junegunn/limelight.vim'
" yaml and toml
Plugin 'cespare/vim-toml'
Plugin 'yaml/yaml.vim'
Plugin 'pearofducks/ansible-vim'
" taglist
Plugin 'vim-scripts/taglist.vim'
Plugin 'psf/black'
" commented
" Plugin 'ekalinin/Dockerfile.vim'
" Plugin 'kana/vim-textobj-entire'
" Plugin 'maxbrunsfeld/vim-yankstack'
" Plugin 'mileszs/ack.vim' "Ack [options] {pattern} [{directories}]
" Plugin 'peterhoeg/vim-qml'
call vundle#end()
:colorscheme space-vim-dark
:set number
:set ls=2
:filetype plugin on
:set tabstop=2
:set expandtab
:set softtabstop=2
:set shiftwidth=2
:setlocal foldmethod=indent
:set foldlevel=99
:set nowrap
:set nocp
:set clipboard=unnamed
:set clipboard=unnamedplus
:set autoindent
:set cindent
:set si
:syntax enable
:set showmatch
:set hlsearch
:set ignorecase
:set noswapfile
:set mouse=a
:set t_Co=256
:set wildmenu
:set cursorline
:set lazyredraw
:set encoding=utf-8
" fix common typos
cnoreabbrev W! w!
cnoreabbrev Q! q!
cnoreabbrev q1 q!
cnoreabbrev Qall! qall!
cnoreabbrev Wq wq
cnoreabbrev Wa wa
cnoreabbrev wQ wq
cnoreabbrev WQ wq
cnoreabbrev W w
cnoreabbrev Q q
cnoreabbrev Qall qall
" tab stop
" for html files, 2 spaces
autocmd Filetype html setlocal ts=2 sw=2 expandtab
"for js/python/go
autocmd Filetype javascript setlocal ts=4 sw=4 sts=0 expandtab
autocmd Filetype python setlocal ts=4 sw=4 sts=4 expandtab autoindent smartindent
autocmd Filetype go setlocal noautoindent nosmartindent nobreakindent
"enable folding with the spacebar
noremap <space> za
" tab switch
" F2 nxt F3 prev
:noremap <silent> #3 :bp<CR>
:noremap <silent> #4 :bn<CR>
" Paste mode toggle with F2 Pastemode disable auto-indent and bracket auto-compelation and it helps you to paste code fro elsewhere .
:set pastetoggle=<F2>
" clear the search with C-i
:noremap <silent> <C-i> :<C-u>nohlsearch<CR><C-i>
" map window moving
:map <C-h> <C-w>h
:map <C-h> <C-w>j
:map <C-h> <C-w>k
:map <C-h> <C-w>l
" cr problem indent
imap <C-Return> <CR><CR><C-o>k<Tab>
" resize panes
nnoremap <C-w>+ :exe "resize " . (winheight(0) * 3/2)<CR>
nnoremap <C-w>- :exe "resize " . (winheight(0) * 2/3)<cr>
nnoremap <C-w>> :exe "vertical resize " . (winwidth(0) * 3/2)<CR>
nnoremap <C-w>< :exe "vertical resize " . (winwidth(0) * 2/3)<CR>
"******************************
"*********PLUGINS**************
"******************************
"""""""""""""""""""""""""""""""
"""""" NerdTree """"""""""""""
"""""""""""""""""""""""""""""""
:map <F8> :NERDTreeToggle<CR> " toggle showing NERDTree
"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
:autocmd bufenter * if (winnr("$") == 1 && exists("b:NERDTree") && b:NERDTree.isTabTree()) | q | endif " close vim if the only window left open is a NERDTree
"ignore files on NERDTree
let NERDTreeIgnore=['\.pyc$', '\~$', '\*.gz$']
"""""""""""""""""""""""""""""""
"""""" airline """"""""""""""""
"""""""""""""""""""""""""""""""
" airline plugin setting
:let g:airline_theme='minimalist'
:let g:airline#extensions#tabline#enabled = 1 " showing tabs
:let g:airline_powerline_fonts = 1
if !exists('g:airline_symbols')
let g:airline_symbols = {}
endif
" unicode symbols
let g:airline_left_sep = '»'
let g:airline_left_sep = '▶'
let g:airline_right_sep = '«'
let g:airline_right_sep = '◀'
"""""""""""""""""""""""""""""""
""""" markdown """"""""""""""""
"""""""""""""""""""""""""""""""
autocmd BufNewFile,BufReadPost *.md set filetype=markdown
:let g:markdown_fenced_languages = ['html', 'python', 'bash=sh']
:let g:markdown_syntax_conceal = 0
"""""""""""""""""""""""""""""""
" indent
"""""""""""""""""""""""""""""""
:let g:indentLine_char = '┆'
:let g:indentLine_enabled = 1
"""""""""""""""""""""""""""""""
" higlight 81
"""""""""""""""""""""""""""""""
highlight ColorColumn ctermbg=white
call matchadd("ColorColumn", '\%81v', 100)
"""""""""""""""""""""""""""""""
""""" tag bar """""""""""""""""
"""""""""""""""""""""""""""""""
nmap <F9> :TagbarToggle<CR>
"""""""""""""""""""""""""""""""
"""""""" jinja """"""""""""""""
"""""""""""""""""""""""""""""""
au BufNewFile,BufRead *.html,*.htm,*.shtml,*.stm set ft=jinja
"""""""""""""""""""""""""""""""
"""""""" emmet """"""""""""""""
"""""""""""""""""""""""""""""""
:let g:user_emmet_install_global = 0
:autocmd FileType html,css,md EmmetInstall
"""""""""""""""""""""""""""""""
""""""" SimpylFold """""""""""
"""""""""""""""""""""""""""""""
:let g:SimpylFold_docstring_preview=1
"""""""""""""""""""""""""""""""
""""""""" ale linter """"""""""
"""""""""""""""""""""""""""""""
let b:ale_linters = { 'python': ['flake8'], 'go': ['govet'], 'ansible': ['ansible_lint'] }
let g:ale_completion_enabled = 1
let g:ale_linters_explicit = 1
let g:airline#extensions#ale#enabled = 1
let g:ale_sign_column_always = 1
highlight clear ALEErrorSign
highlight clear ALEWarningSign
highlight ALEWarning ctermbg=DarkMagenta
let g:ale_echo_msg_error_str = 'E'
let g:ale_echo_msg_warning_str = 'W'
let g:ale_sign_error = '⤫'
let g:ale_sign_warning = '⚠'
let g:ale_echo_msg_format = '[%linter%] %s [%severity%]'
" move btwn errors with c-u and c-d up and down
nmap <silent> <C-u> <Plug>(ale_previous_wrap)
nmap <silent> <C-d> <Plug>(ale_next_wrap)
"""""""""""""""""""""""""""""""
""""""""" ctrl-p """"""""""""""
"""""""""""""""""""""""""""""""
" fuzzy finding file c-t for tab, c-v, c-s for vertical and horizontal
"""""""""""""""""""""""""""""""
""""""""" rainbow """""""""""""
"""""""""""""""""""""""""""""""
let g:rbpt_colorpairs = [
\ ['brown', 'RoyalBlue3'],
\ ['Darkblue', 'SeaGreen3'],
\ ['darkgray', 'DarkOrchid3'],
\ ['darkcyan', 'RoyalBlue3'],
\ ['darkred', 'SeaGreen3'],
\ ['darkgreen', 'RoyalBlue3'],
\ ['darkmagenta', 'DarkOrchid3'],
\ ['brown', 'firebrick3'],
\ ['gray', 'RoyalBlue3'],
\ ['black', 'SeaGreen3'],
\ ['darkmagenta', 'DarkOrchid3'],
\ ['Darkblue', 'firebrick3'],
\ ['darkcyan', 'SeaGreen3'],
\ ]
let g:rbpt_max = 16
let g:rbpt_loadcmd_toggle = 0
au VimEnter * RainbowParenthesesToggle
au Syntax * RainbowParenthesesLoadRound
au Syntax * RainbowParenthesesLoadSquare
au Syntax * RainbowParenthesesLoadBraces
"""""""""""""""""""""""""""""""
""""""""" gundo """""""""""""""
"""""""""""""""""""""""""""""""
if has('python3')
let g:gundo_prefer_python3 = 1
endif
nnoremap <F12> :GundoToggle<CR>
"""""""""""""""""""""""""""""""
""""""""" nerdtree git """"""""
"""""""""""""""""""""""""""""""
let g:NERDTreeIndicatorMapCustom = {
\ "Modified" : "✹",
\ "Staged" : "✚",
\ "Untracked" : "!",
\ "Renamed" : "➜",
\ "Unmerged" : "═",
\ "Deleted" : "✖",
\ "Dirty" : "✗",
\ "Clean" : "✔︎",
\ 'Ignored' : '☒',
\ "Unknown" : "?"
\ }
"
let g:ycm_use_clangd = 0
let g:ycm_collect_identifiers_from_tags_files = 1 " Let YCM read tags from Ctags file
let g:ycm_use_ultisnips_completer = 1 " Default 1, just ensure
let g:ycm_seed_identifiers_with_syntax = 1 " Completion for programming language's keyword
let g:ycm_complete_in_comments = 1 " Completion in comments
let g:ycm_complete_in_strings = 1 " Completion in strings
"
let g:flake8_quickfix_location="topleft"
"""""""""""""""""""""""""""""""
""""""""" ultisnips """"""""
"""""""""""""""""""""""""""""""
" better key bindings for UltiSnipsExpandTrigger
let g:UltiSnipsExpandTrigger = "<c-j>"
let g:UltiSnipsJumpForwardTrigger = "<c-j>"
let g:UltiSnipsJumpBackwardTrigger = "<c-p>"
let g:UltiSnipsListSnippets = "<c-k>" "List possible snippets based on current file
" If you want :UltiSnipsEdit to split your window.
let g:UltiSnipsEditSplit="vertical"
let g:UltiSnipsSnippetsDir='~/.vim/bundle/vim-snippets/UltiSnips'
"""""""""""""""""""""""""""""""
"""""" git gutter """""""""""""
"""""""""""""""""""""""""""""""
" move btwn hunks with [c and ]c
"""""""""""""""""""""""""""""""
"""""" unimpaired """""""""""""
"""""""""""""""""""""""""""""""
" move btwn hunks with [c and ]c
" ]q cnext [q cprev
" ]a next [b bprev
" ]space and ]space newline
" [os ]os spell and nospell
"
"""""""""""""""""""""""""""""""
"""""" multi cursor """""""""""
"""""""""""""""""""""""""""""""
" start c-n, next c-n, skip c-x, prev c-p
" c, s, I, A
" esc exit
" ansible vim
au BufRead,BufNewFile */playbooks/*.yml set filetype=yaml.ansible
" BLACK pyformatter
nnoremap <F5> :Black<CR>
let g:black_linelength = 80
" jump to ref
map <C-\> :vsp <CR>:exec("tag ".expand("<cword>"))<CR>
let g:gutentags_cache_dir = expand('~/.cache/tags')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment