Skip to content

Instantly share code, notes, and snippets.

@Realetive
Last active July 20, 2018 23:10
Show Gist options
  • Save Realetive/281eccfd62390ddb8d32cb3ed107b3b3 to your computer and use it in GitHub Desktop.
Save Realetive/281eccfd62390ddb8d32cb3ed107b3b3 to your computer and use it in GitHub Desktop.
NeoVim
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
call plug#begin('~/.vim/plugged')
Plug 'tpope/vim-sensible'
Plug 'altercation/vim-colors-solarized'
Plug 'mhinz/vim-startify'
Plug 'farmergreg/vim-lastplace'
Plug 'lyokha/vim-xkbswitch'
Plug 'vim-airline/vim-airline'
Plug 'vim-airline/vim-airline-themes'
Plug 'scrooloose/nerdtree', { 'on': 'NERDTreeToggle' }
Plug 'ryanoasis/vim-devicons', { 'on': 'NERDTreeToggle' }
Plug 'tiagofumo/vim-nerdtree-syntax-highlight', { 'on': 'NERDTreeToggle' }
Plug 'tpope/vim-fugitive'
Plug 'airblade/vim-gitgutter'
Plug 'ctrlpvim/ctrlp.vim'
Plug 'octref/RootIgnore'
Plug 'scrooloose/nerdcommenter'
Plug 'Raimondi/delimitMate'
Plug 'editorconfig/editorconfig-vim'
Plug 'jszakmeister/vim-togglecursor'
Plug 'heavenshell/vim-jsdoc', { 'for': 'javascript' }
call plug#end()
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
"
" Custom
"
set spelllang=ru_yo,en_us
" Последовательность выбора кодировок при открытии файлов
set fencs=utf-8,cp1251,koi8-r,ucs-2,cp866
" Порядок применения кодировок и формата файлов
set ffs=unix,mac,dos
set fileencodings=utf8,cp1251
" Формат файла по умолчанию
set fileformat=unix
" Кодировка терминала
set termencoding=utf-8
" Кодировка
set encoding=utf-8 nobomb
" Path to *.swp cache
set viewdir=~/.vim/.backups//
" Set N* lines to the cursor - when moving vertically using j/k
set scrolloff=15
" Highlight current line
set cursorline
" Turn on the WiLd menu
set wildmode=longest:full,full
" Fix clipboard buffer
set clipboard=unnamed
" Fast rerender window's frame
set lazyredraw
" Fast keymap
set ttimeout
set ttimeoutlen=50
set updatetime=250
" Enable scroll on mouse wheel
set mouse=a
" Enable line numbers
set number
set relativenumber
" Highlight current line
set cursorline
" Indentation
set nowrap
set smartindent
set expandtab
" Make tabs as wide as two spaces
set shiftwidth=2
set tabstop=2
set softtabstop=2
" Folding
set foldmethod=indent
set foldlevelstart=1
let javaScript_fold=1 " JavaScript
let perl_fold=1 " Perl
let php_folding=1 " PHP
let r_syntax_folding=1 " R
let ruby_fold=1 " Ruby
let sh_fold_enabled=1 " sh
let vimsyn_folding='af' " Vim script
let xml_syntax_folding=1 " XML
" Searching
set showmatch
set ignorecase
set smartcase
set wildignore=*.o,*~,*.pyc,*/.git/*,*/.hg/*,*/.svn/*,*/.DS_Store
" Clear the search highlight by pressing ENTER when in Normal mode (Typing commands)
nmap <silent> <CR> :nohlsearch<CR>/<BS><CR>
" Disable Arrow keys in Escape mode
map <up> <nop>
map <down> <nop>
map <left> <nop>
map <right> <nop>
" Change <Leader> key
let mapleader=","
let g:mapleader=","
" Fast buffer moving
nmap <C-h> <C-w>h
nmap <C-j> <C-w>j
nmap <C-k> <C-w>k
nmap <C-l> <C-w>l
imap <C-h> <Esc><C-w>h
imap <C-j> <Esc><C-w>j
imap <C-k> <Esc><C-w>k
imap <C-l> <Esc><C-w>l
nmap <leader>j :bp<cr>
nmap <leader>k :bn<cr>
imap <leader>j <Esc>:bp<cr>
imap <leader>k <Esc>:bn<cr>
map <leader>q :bp<bar>sp<bar>bn<bar>bd<CR>.
"nmap <leader>w :bw<cr>
"imap <leader>w <Esc>:bw<cr>
" Return to normal mode after press jj
imap jj <Esc>
" Fast saving
nmap <leader>w :w!<cr>
" :W sudo saves the file
cmap W w !sudo tee % > /dev/null
"
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
"
" XkbSwitchLib
"
let g:XkbSwitchEnabled=1
" Set keymaps dynamically in runtime
let g:XkbSwitchDynamicKeymap=1
" https://github.com/vovkasm/input-source-switcher
let g:XkbSwitchLib='/usr/local/lib/libxkbswitch.dylib'
let g:XkbSwitchIMappings=['1']
let g:XkbSwitchIMappingsTr={
\ '1':
\ {'<': 'qwertyuiop[]\asdfghjkl;''zxcvbnm,./'.
\ 'QWERTYUIOP{}|ASDFGHJKL:"ZXCVBNM<>?',
\ '>': 'йцукенгшщзхъ\фывапролджэячсмитьбю.'.
\ 'ЙЦУКЕНГШЩЗХЪ/ФЫВАПРОЛДЖЭЯЧСМИТЬБЮ,'}
\ }
let g:XkbSwitchKeymapNames={'1': 'ru', '2': 'en'}
let g:XkbSwitchNLayout = '2'
" let g:XkbSwitchLib='/usr/local/lib/libInputSourceSwitcher.dylib'
" let g:XkbSwitchIMappings=['org.sil.ukelele.keyboardlayout.t.keylayout.Russian-IlyaBirmanTypography']
" let g:XkbSwitchIMappingsTr={
" \ 'org.sil.ukelele.keyboardlayout.t.keylayout.Russian-IlyaBirmanTypography':
" \ {'<': 'qwertyuiop[]\asdfghjkl;''zxcvbnm,./'.
" \ 'QWERTYUIOP{}|ASDFGHJKL:"ZXCVBNM<>?',
" \ '>': 'йцукенгшщзхъ\фывапролджэячсмитьбю.'.
" \ 'ЙЦУКЕНГШЩЗХЪ/ФЫВАПРОЛДЖЭЯЧСМИТЬБЮ,'}
" \ }
" let g:XkbSwitchKeymapNames={'org.sil.ukelele.keyboardlayout.t.keylayout.Russian-IlyaBirmanTypography' : 'ru_keymap', 'org.sil.ukelele.keyboardlayout.t.keylayout.English-IlyaBirmanTypography' : 'uk_keymap'}
"
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
"
" Solarized theme
"
let g:solarized_termcolors=256
let g:solarized_termtrans=1
let g:solarized_visibility='high'
let g:solarized_contrast='high'
set t_Co=256
set background=dark
colorscheme solarized
"
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
"
" Airline
"
let g:airline#extensions#tabline#enabled='1'
let g:airline_powerline_fonts=1
"
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" ToggleCursor
"
let g:togglecursor_default='blinking_underline'
"
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
"
" NERDTree
"
let g:NERDTreeWinPos='right'
" Show hidden files
let NERDTreeShowHidden=1
let NERDTreeIgnore=['\.pyc$', '__pycache__', '\.DS_Store$', 'node_modules$']
let g:NERDTreeWinSize=35
let NERDTreeHighlightCursorline = 0
let g:NERDTreeSyntaxDisableDefaultExtensions = 1
let g:NERDTreeDisableExactMatchHighlight = 1
let g:NERDTreeDisablePatternMatchHighlight = 1
map <leader>nn :NERDTreeToggle<cr>
"map <leader>nb :NERDTreeFromBookmark<Space>
"map <leader>nf :NERDTreeFind<cr>
"
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
"
" Dev Icon
"
let g:WebDevIconsNerdTreeAfterGlyphPadding=''
let g:WebDevIconsUnicodeDecorateFileNodesPatternSymbols={}
let g:WebDevIconsUnicodeDecorateFileNodesPatternSymbols['.bemtree\.js$']=''
let g:WebDevIconsUnicodeDecorateFileNodesPatternSymbols['.bemhtml\.js$']=''
"
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
"
" NERDTree syntax highlight
"
let g:NERDTreeLimitedSyntax=1 " Disable uncommon file extensions highlighting (this is a good idea if you are experiencing lag when scrolling)
let g:NERDTreeHighlightFolders=1 " enables folder icon highlighting using exact match
let g:NERDTreeHighlightFoldersFullName=1 " highlights the folder name
" Customizing colors
let s:green="8FAA54"
let s:yellow="F09F17"
let g:NERDTreeFileExtensionHighlightFullName=1
let g:NERDTreePatternMatchHighlightColor={}
let g:NERDTreePatternMatchHighlightColor['.bemtree\.js$']=s:green
let g:NERDTreePatternMatchHighlightColor['.bemhtml\.js$']=s:yellow
"
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
"
" CtrlP
"
" Change the default mapping and the default command to invoke CtrlP
let g:ctrlp_map='<C-p>'
let g:ctrlp_cmd='CtrlP'
let g:ctrlp_max_files=0
let g:ctrlp_max_depth=40
let g:ctrlp_dotfiles=1
let g:ctrlp_show_hidden=1
let g:ctrlp_dont_split='nerdtree'
if executable('rg')
set grepprg=rg\ --color=never
let g:ctrlp_user_command='rg %s --files --color=never --glob ""'
let g:ctrlp_use_caching=0
endif
"
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
"
" RootIgnore
"
" As long as it doesn't contain 'r' it's fine
let g:ctrlp_working_path_mode='0'
"
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
"
" NERD Commenter
"
" Add spaces after comment delimiters by default
let g:NERDSpaceDelims=1
" Align line-wise comment delimiters flush left instead of following code indentation
let g:NERDDefaultAlign='left'
"
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
"
" %
"
"
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment