.vimrc_airline_LAST 27 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728
  1. "###############################################################################
  2. " General settings
  3. "###############################################################################
  4. set nocompatible " no vi-compatible
  5. " let &keywordprg=':help'
  6. " let &pythonthreedll='C:\Python34\libs\python34.dll'
  7. " Automatic reloading .vimrc
  8. " autocmd! VimEnter * :source $MYVIMRC "for NERDCommenter
  9. " autocmd! VimEnter * :redraw
  10. " Showing line numbers and length
  11. set number
  12. set relativenumber
  13. " set linespace=3
  14. set wrap linebreak nolist "Данная вариация работает как wrap,... но переносит строчки не посимвольно, а по словам
  15. set tw=79 "width of document (used by gd)
  16. set fo-=t "don't automatically wrap text when typing
  17. set colorcolumn=80
  18. highlight ColorColumn ctermbg=233
  19. set cursorline "highlight current line
  20. set cursorcolumn "highlight current column
  21. set whichwrap=<,>,[,],h,l "не останавливаться курсору на конце строки
  22. set ttimeoutlen=20 "Понижаем задержку ввода escape последовательностей
  23. let &t_SI.="\e[5 q" "SI = режим вставки
  24. let &t_SR.="\e[3 q" "SR = режим замены
  25. let &t_EI.="\e[1 q" "EI = нормальный режим
  26. "Где 1 - это мигающий прямоугольник
  27. "2 - обычный прямоугольник
  28. "3 - мигающее подчёркивание
  29. "4 - просто подчёркивание
  30. "5 - мигающая вертикальная черта
  31. "6 - просто вертикальная черта
  32. " Indents
  33. set autoindent "при начале новой строки, отступ копируется из предыдущей
  34. set smartindent
  35. set noex "не читаем файл конфигурации из текущей директории
  36. set stal=2 "постоянно выводим строку с табами
  37. set tpm=20 "максимальное количество открытых табов
  38. set history=50
  39. set undolevels=50
  40. set noerrorbells "instead of beeping
  41. set wildmenu "красивое автодополнение
  42. set cmdheight=2 "Give more space for displaying messages.
  43. set scrolloff=3 "when scrolling, keep cursor 3 lines away from screen border
  44. " Allow plugins by file type (required for plugins!)
  45. filetype plugin on
  46. filetype indent on
  47. " filetype plugin indent on
  48. syntax on "Enable syntax highlighting
  49. " remove ugly vertical lines on window division
  50. " set fillchars+=vert:\
  51. " Real programmers don't use TABs but spaces
  52. set tabstop=4
  53. set softtabstop=4
  54. set shiftwidth=4
  55. set shiftround
  56. set expandtab
  57. " Search
  58. set hlsearch
  59. set incsearch
  60. set ignorecase
  61. set smartcase
  62. " Disable backup and swap files - they trigger too many events
  63. " for file system watchers
  64. set nobackup
  65. set nowritebackup
  66. set noswapfile
  67. " Show whitespaces and other symbols
  68. " set listchars=eol:¬,tab:>·,trail:~,extends:>,precedes:<,space:␣
  69. " set list
  70. " При редактировании файла всегда переходить на последнюю известную
  71. " позицию курсора. Если позиция ошибочная - не переходим.
  72. autocmd BufReadPost *
  73. \ if line("'\"") > 0 && line("'\"") <= line("$") |
  74. \ exe "normal! g`\"" |
  75. \ endif
  76. " Statusline
  77. set showmode "показывать текущий режим
  78. set showcmd "показывать незавершенные команды в статусбаре
  79. set laststatus=2 "always show statusline
  80. "set statusline=%#title#%F%m%r%h%w\ %y%=[HEX=\%02.2B]\ [%{&encoding}]\ [%{&fileformat}]\ [POS=%l,%c,\ %p%%]\ [LEN=%L] "формат строки состояния
  81. " Encoding
  82. set encoding=utf8 "кодировка по дефолту
  83. set termencoding=utf8 "Кодировка вывода на терминал
  84. set fileencodings=utf8,cp1251,koi8r,cp866 "Возможные кодировки файлов (автоматическая перекодировка)
  85. " Run commands in normal mode with switched cyrillic
  86. set langmap=ФИСВУАПРШОЛДЬТЩЗЙКЫЕГМЦЧНЯ;ABCDEFGHIJKLMNOPQRSTUVWXYZ,фисвуапршолдьтщзйкыегмцчня;abcdefghijklmnopqrstuvwxyz
  87. " Переключение раскладок средствами Vim по Ctr+^
  88. set keymap=russian-jcukenwin
  89. set iminsert=0 "Язык ввода при старте Вима - Английский
  90. set imsearch=0 "Аналогично настраивается режим поиска
  91. set autochdir "текущий каталог всегда совпадает с содержимым активного окна
  92. set browsedir=current "browsedir "last", "buffer" or "current": which directory used for the file browser
  93. " Show whitespaces by red color
  94. " MUST be inserted BEFORE the colorscheme command
  95. autocmd ColorScheme * highlight ExtraWhitespace ctermbg=red guibg=red
  96. autocmd InsertLeave * match ExtraWhitespace /\s\+$/
  97. "###############################################################################
  98. " Colorscheme and GUI Settings
  99. "###############################################################################
  100. if has("termguicolors")
  101. set termguicolors
  102. else
  103. set t_Co=256
  104. endif
  105. set background=dark
  106. " colorscheme gruvbox-material
  107. " colorscheme gruvbox
  108. " colorscheme predawn
  109. " colorscheme nord
  110. " colorscheme ayu
  111. " colorscheme material-theme
  112. let g:oceanic_next_terminal_italic = 1
  113. colorscheme OceanicNext
  114. " let g:oceanic_italic_comments = 1
  115. " colorscheme oceanicnext
  116. " let g:tokyonight_style = 'night' " available: night, storm
  117. " let g:tokyonight_enable_italic = 1
  118. " colorscheme tokyonight
  119. " let g:palenight_terminal_italics=1
  120. " colorscheme palenight
  121. " colorscheme cobalt2
  122. " colorscheme onedark
  123. " colorscheme monokai
  124. " let g:solarized_termcolors=256
  125. " colorscheme solarized
  126. " colorscheme darcula
  127. " GUI
  128. set wak=no "используем ALT как обычно, а не для вызова пункта меню
  129. if has("gui_running")
  130. "убираем меню и тулбар
  131. set guioptions-=m
  132. set guioptions-=T
  133. "убираем скроллбары
  134. set guioptions-=r
  135. set guioptions-=l
  136. "используем консольные диалоги вместо графических
  137. set guioptions+=c
  138. "антиалиасинг для шревтоф
  139. set antialias
  140. "прячем курсор
  141. set mousehide
  142. "Так не выводятся ненужные escape последовательности в :shell
  143. set noguipty
  144. " set guifont=Source_Code_Pro:h13:cRUSSIAN:qDRAFT
  145. " set gfn=JetBrains_Mono_Regular:h12:cRUSSIAN:qDRAFT
  146. " set guifont=Source\ Code\ Pro\ 14.5
  147. " set guifont=mononoki\ 14.5
  148. " set guifont=Fira\ Code\ Light\ 14
  149. " set guifont=Operator\ Mono\ Light\ 16
  150. " set guifont=Trim\ Mono\ Regular\ 13
  151. " set guifont=Menlo\ for\ Powerline\ 13.5
  152. " set guifont=DejaVu\ Sans\ Mono\ for\ Powerline\ 13
  153. " set guifont=MesloLGS\ NF\ 13
  154. " set guifont=Consolas\ for\ Powerline\ 14.5
  155. " set guifont=SF\ Mono\ 13.5
  156. " set guifont=RobotoMono\ Nerd\ Font\ 14
  157. " set guifont=Hack\ 13.5
  158. " set guifont=UbuntuMono\ Nerd\ Font\ 16
  159. " set guifont=Sarasa\ Mono\ SC\ Nerd\ Light\ 15
  160. " set guifont=Iosevka\ Fixed\ SS12\ 15
  161. " set guifont=Sarasa\ Mono\ SC\ Nerd\ 15.5
  162. " set guifont=Sarasa\ Mono\ SC\ Nerd\ Light\ 15.5
  163. " set guifont=JetBrainsMono\ Regular\ 14
  164. " set guifont=JetBrainsMonoNL\ Light\ 14
  165. " set guifont=JetBrainsMono\ Nerd\ Font\ 14
  166. " set guifont=JetBrainsMono\ Light\ 14
  167. " set guifont=SauceCodePro\ Nerd\ Font\ 16
  168. " set guifont=mplus\ Nerd\ Font\ 16.5
  169. " set guifont=Iosevka\ 16
  170. " set guifont=Cascadia\ Code\ PL\ SemiLight\ 17
  171. " set guifont=Cascadia\ Mono\ PL\ 16.5
  172. " set guifont=Recursive\ Mono\ Casual\ Static\ Medium\ 17
  173. set guifont=Recursive\ Mono\ Casual\ Static\ 16
  174. " set guifont=Monaco\ 13
  175. " set guifont=Ligamonacop\ 13
  176. " else
  177. " colorscheme gruvbox
  178. " " colorscheme herald
  179. endif
  180. "###############################################################################
  181. " Plugins used by vim
  182. " Specify a directory for plugins
  183. " - For Neovim: stdpath('data') . '/plugged'
  184. " - Avoid using standard Vim directory names like 'plugin'
  185. "###############################################################################
  186. call plug#begin('~/.vim/plugged')
  187. "#########################################
  188. " Code/project navigation
  189. "#########################################
  190. Plug 'scrooloose/nerdtree', { 'on': 'NERDTreeToggle' }
  191. " Code and files fuzzy finder
  192. " Plug 'junegunn/fzf', { 'dir': '~/.fzf', 'do': './install --all' }
  193. " Plug 'junegunn/fzf.vim'
  194. " Consoles as buffers (neovim has its own consoles as buffers)
  195. " Plug 'rosenfeld/conque-term'
  196. " Vim-terminal
  197. " Plug 'tc50cal/vim-terminal'
  198. " XML/HTML tags navigation (neovim has its own)
  199. " Plug 'vim-scripts/matchit.zip'
  200. " Class/module browser
  201. " Plug 'majutsushi/tagbar'
  202. "#########################################
  203. " Code completion
  204. "#########################################
  205. " Plug 'davidhalter/jedi-vim'
  206. " Plug 'farfanoide/vim-kivy'
  207. " Plug 'pzxbc/vim-kv'
  208. " Plug 'neoclide/coc.nvim', {'branch': 'release'}
  209. Plug 'ycm-core/YouCompleteMe', { 'do': './install.py' }
  210. " Plug 'ycm-core/YouCompleteMe', { 'for': 'python' }
  211. " Async autocompletion
  212. " Plug 'Shougo/deoplete.nvim'
  213. " Python autocompletion
  214. " Plug 'deoplete-plugins/deoplete-jedi'
  215. " Linters
  216. Plug 'neomake/neomake'
  217. "#########################################
  218. " Debugging
  219. "#########################################
  220. " Plug 'vim-vdebug/vdebug'
  221. "#########################################
  222. " Other
  223. "#########################################
  224. " Plug 'gruvbox-community/gruvbox'
  225. " Plug 'itchyny/lightline.vim'
  226. Plug 'vim-airline/vim-airline'
  227. Plug 'vim-airline/vim-airline-themes'
  228. Plug 'preservim/nerdcommenter'
  229. Plug 'tpope/vim-surround'
  230. " Plug 'gko/vim-coloresque'
  231. " Plug 'etdev/vim-hexcolor'
  232. Plug 'ap/vim-css-color'
  233. Plug 'godlygeek/tabular'
  234. " Plug 'plasticboy/vim-markdown'
  235. " Plug 'iamcco/markdown-preview.vim'
  236. " Nice icons in the file explorer and file type status line.
  237. " Plug 'ryanoasis/vim-devicons'
  238. " Completion from other opened files
  239. " Plug 'Shougo/context_filetype.vim'
  240. " Pending tasks list
  241. " Plug 'fisadev/FixedTaskList.vim'
  242. " Git/mercurial/others diff icons on the side of the file lines
  243. " Plug 'mhinz/vim-signify'
  244. " Yank history navigation
  245. " Plug 'vim-scripts/YankRing.vim'
  246. " Tell vim-plug we finished declaring plugins, so it can load them
  247. call plug#end()
  248. "###############################################################################
  249. " NERDTree Settings
  250. "###############################################################################
  251. noremap <F12> :NERDTreeToggle<CR>
  252. " open nerdtree with the current file selected
  253. nmap ,t :NERDTreeFind<CR>
  254. " let g:NERDTreeMinimalUI = 1
  255. " let g:NERDTreeDirArrows = 1
  256. " let g:NERDTreeIgnore = ['\.pyc$', '\.pyo$', '__pycache__'] "don;t show these file types
  257. " let g:WebDevIconsUnicodeDecorateFolderNodes = 1 "Enable folder icons
  258. " let g:DevIconsEnableFoldersOpenClose = 1
  259. " highlight! link NERDTreeFlags NERDTreeDir "Fix directory colors
  260. " " Remove expandable arrow
  261. " let g:WebDevIconsNerdTreeBeforeGlyphPadding = ""
  262. " let g:WebDevIconsUnicodeDecorateFolderNodes = v:true
  263. " let NERDTreeDirArrowExpandable = "\u00a0"
  264. " let NERDTreeDirArrowCollapsible = "\u00a0"
  265. " let NERDTreeNodeDelimiter = "\x07"
  266. " Autorefresh on tree focus
  267. function! NERDTreeRefresh()
  268. if &filetype == "nerdtree"
  269. silent exe substitute(mapcheck("R"), "<CR>", "", "")
  270. endif
  271. endfunction
  272. autocmd BufEnter * call NERDTreeRefresh()
  273. "###############################################################################
  274. " NERDCommenter Settings
  275. "###############################################################################
  276. " map <Leader>/ <plug>NERDCommenterToggle
  277. map <C-c>/ <plug>NERDCommenterToggle
  278. let g:NERDSpaceDelims = 1 " Add spaces after comment delimiters by default
  279. let g:NERDCompactSexyComs = 1 " Use compact syntax for prettified multi-line comments
  280. let g:NERDCommentEmptyLines = 1 " Allow commenting and inverting empty lines (useful when commenting a region)
  281. let g:NERDTrimTrailingWhitespace = 1 " Enable trimming of trailing whitespace when uncommenting
  282. let g:NERDToggleCheckAllLines = 1 " Enable NERDCommenterToggle to check all selected lines is commented or not
  283. " let g:NERDDefaultAlign = 'left' " Align line-wise comment delimiters flush left instead of following code indentation
  284. let g:NERDCreateDefaultMappings = 0 " Cancel NERD's default mappings
  285. "###############################################################################
  286. " YouCompleteMe Settings
  287. "###############################################################################
  288. " :nnoremap fd :YcmCompleter GoToDefinition<CR>
  289. " :nnoremap bb <C-o>
  290. " let g:loaded_youcompleteme = 1
  291. " let g:ycm_global_ycm_extra_conf = '~/.ycm_extra_conf.py'
  292. " let g:ycm_extra_conf_globlist = ['!~/*']
  293. " let g:ycm_python_binary_path = 'python3'
  294. " let g:ycm_autoclose_preview_window_after_completion = 1
  295. " let g:ycm_min_num_of_chars_for_completion = 1
  296. " for python
  297. " let g:ycm_semantic_triggers = {'python': ['re!from\s+\S+\s+import\s']}
  298. "###############################################################################
  299. " jedi-vim Settings
  300. "###############################################################################
  301. " let g:jedi#usages_command = "<leader>z"
  302. " " automatically starts the completion, if you type a dot
  303. " let g:jedi#popup_on_dot = 1
  304. " " Disable choose first function/method at autocomplete
  305. " let g:jedi#popup_select_first = 0
  306. " " make jedi-vim use tabs when going to a definition
  307. " let g:jedi#use_tabs_not_buffers = 1
  308. " " displays function call signatures in insert mode in real-time, highlighting the current argument
  309. " " 1 - pop-up in the buffer (default)
  310. " " 2 - in Vim's command line aligned with the function call
  311. " let g:jedi#show_call_signatures = "1"
  312. " noremap <Leader>b Oimport ipdb; ipdb.set_trace() # BREAKPOINT<C-c>
  313. "###############################################################################
  314. " Airline Settings
  315. "###############################################################################
  316. let g:airline_section_c = '%F%m%r%h%w %y'
  317. " let g:airline_powerline_fonts = 1 "Включить поддержку Powerline шрифтов
  318. let g:airline_section_x = 'HEX=%02.2B'
  319. let g:airline_section_y = '%{&encoding}[%{&fileformat}]'
  320. let g:airline_section_z = "\ue0a1 %l,%c/%L %p%%"
  321. let g:airline_extensions = []
  322. let g:Powerline_symbols='unicode' "Поддержка unicode
  323. let g:airline#extensions#keymap#enabled = 0 "Не показывать текущий маппинг
  324. let g:airline#extensions#xkblayout#enabled = 0 "Про это позже расскажу
  325. " let g:airline_theme='cobalt2'
  326. " let g:airline_theme='base16_material'
  327. " let g:airline_theme="onedark"
  328. " let g:airline_theme="onehalfdark"
  329. let g:airline_theme="oceanicnext"
  330. " let g:airline_theme="palenight"
  331. " let g:airline_theme="ayu"
  332. " let g:airline_theme="tokyonight"
  333. " let g:airline_theme="gruvbox_material"
  334. " let g:airline_theme="gruvbox"
  335. " TODO: check these settings
  336. " let g:airline_powerline_fonts = 0
  337. " let g:airline_theme = 'bubblegum'
  338. " let g:airline#extensions#whitespace#enabled = 0
  339. " To use fancy symbols wherever possible, change this setting from 0 to 1
  340. " and use a font from https://github.com/ryanoasis/nerd-fonts in your terminal
  341. " (if you aren't using one of those fonts, you will see funny characters here.
  342. " Turst me, they look nice when using one of those fonts).
  343. " let fancy_symbols_enabled = 0
  344. " " Fancy Symbols!!
  345. " if fancy_symbols_enabled
  346. " let g:webdevicons_enable = 1
  347. "
  348. " " custom airline symbols
  349. " if !exists('g:airline_symbols')
  350. " let g:airline_symbols = {}
  351. " endif
  352. " let g:airline_left_sep = ''
  353. " let g:airline_left_alt_sep = ''
  354. " let g:airline_right_sep = ''
  355. " let g:airline_right_alt_sep = ''
  356. " let g:airline_symbols.branch = '⭠'
  357. " let g:airline_symbols.readonly = '⭤'
  358. " let g:airline_symbols.linenr = '⭡'
  359. " else
  360. " let g:webdevicons_enable = 0
  361. " endif
  362. "###############################################################################
  363. " Lightline Settings
  364. "###############################################################################
  365. " let g:lightline = {
  366. " \ 'colorscheme': 'wombat',
  367. " \ 'active': {
  368. " \ 'left': [ [ 'mode', 'paste' ],
  369. " \ [ 'readonly', 'modified', 'filename' ] ],
  370. " \ 'right': [ [ 'lineinfo' ],
  371. " \ [ 'format_encoding' ],
  372. " \ [ 'charhex', ] ]
  373. " \ },
  374. " \ 'component': {
  375. " \ 'filename': '%F%m%r%h%w %y',
  376. " \ 'charhex': 'HEX=%02.2B',
  377. " \ 'format_encoding': '%{&encoding}[%{&fileformat}]',
  378. " \ 'lineinfo': '%l,%c/%L %p%%'
  379. " \ },
  380. " \ }
  381. "###############################################################################
  382. " deoplete Settings
  383. "###############################################################################
  384. " needed so deoplete can auto select the first suggestion
  385. set completeopt+=noinsert
  386. " comment this line to enable autocompletion preview window
  387. " (displays documentation related to the selected completion option)
  388. " disabled by default because preview makes the window flicker
  389. set completeopt-=preview
  390. " autocompletion of files and commands behaves like shell
  391. " (complete only the common part, list the options that match)
  392. set wildmode=list:longest
  393. " " Use deoplete.
  394. " let g:deoplete#enable_at_startup = 1
  395. " call deoplete#custom#option({
  396. " \ 'ignore_case': v:true,
  397. " \ 'smart_case': v:true,
  398. " \})
  399. " " complete with words from any opened file
  400. " let g:context_filetype#same_filetypes = {}
  401. " let g:context_filetype#same_filetypes._ = '_'
  402. "###############################################################################
  403. " TaskList Settings
  404. "###############################################################################
  405. " show pending tasks list
  406. map <F2> :TaskList<CR>
  407. "###############################################################################
  408. " Neomake Settings
  409. "###############################################################################
  410. " " Run linter on write
  411. " autocmd! BufWritePost * Neomake
  412. "
  413. " " Check code as python3 by default
  414. " let g:neomake_python_python_maker = neomake#makers#ft#python#python()
  415. " let g:neomake_python_flake8_maker = neomake#makers#ft#python#flake8()
  416. " let g:neomake_python_python_maker.exe = 'python3 -m py_compile'
  417. " let g:neomake_python_flake8_maker.exe = 'python3 -m flake8'
  418. "
  419. " " Disable error messages inside the buffer, next to the problematic line
  420. " let g:neomake_virtualtext_current_error = 0
  421. "###############################################################################
  422. " Signify Settings
  423. "###############################################################################
  424. " " this first setting decides in which order try to guess your current vcs
  425. " " UPDATE it to reflect your preferences, it will speed up opening files
  426. " let g:signify_vcs_list = ['git', 'hg']
  427. " " mappings to jump to changed blocks
  428. " nmap <leader>sn <plug>(signify-next-hunk)
  429. " nmap <leader>sp <plug>(signify-prev-hunk)
  430. " " nicer colors
  431. " highlight DiffAdd cterm=bold ctermbg=none ctermfg=119
  432. " highlight DiffDelete cterm=bold ctermbg=none ctermfg=167
  433. " highlight DiffChange cterm=bold ctermbg=none ctermfg=227
  434. " highlight SignifySignAdd cterm=bold ctermbg=237 ctermfg=119
  435. " highlight SignifySignDelete cterm=bold ctermbg=237 ctermfg=167
  436. " highlight SignifySignChange cterm=bold ctermbg=237 ctermfg=227
  437. "###############################################################################
  438. " Yankring Settings
  439. "###############################################################################
  440. let g:yankring_history_dir='~/.vim/dirs'
  441. " let g:yankring_history_dir='C:\Documents and Settings\VCHD7-WS-AKP2\vimfiles\dirs\'
  442. "###############################################################################
  443. " Tagbar Settings
  444. "###############################################################################
  445. " toggle tagbar display
  446. map <F6> :TagbarToggle<CR>
  447. " autofocus on tagbar open
  448. let g:tagbar_autofocus = 1
  449. "###############################################################################
  450. " Python IDE Setup
  451. "###############################################################################
  452. " Settings for ctrlp
  453. " let g:ctrlp_max_height = 30
  454. " set wildignore+=*.pyc
  455. " set wildignore+=*_build/*
  456. " set wildignore+=*/coverage/*
  457. " Better navigating through omnicomplete option list
  458. " See http://stackoverflow.com/questions/2170023/how-to-map-keys-for-popup-menu-in-vim
  459. " function! OmniPopup(action)
  460. " if pumvisible()
  461. " if a:action == 'j'
  462. " return "\<C-N>"
  463. " elseif a:action == 'k'
  464. " return "\<C-P>"
  465. " endif
  466. " endif
  467. " return a:action
  468. " endfunction
  469. "
  470. " inoremap <silent><C-j> <C-R>=OmniPopup('j')<CR>
  471. " inoremap <silent><C-k> <C-R>=OmniPopup('k')<CR>
  472. "###############################################################################
  473. " Mappings
  474. "###############################################################################
  475. " <Leader> key
  476. let mapleader = " "
  477. let maplocalleader = "\\"
  478. " Let Meta key (Alt) to be usefull in terminal
  479. let c='a'
  480. while c <= 'z'
  481. exec "set <M-".c.">=\e".c
  482. exec "imap \e".c." <M-".c.">"
  483. let c = nr2char(1+char2nr(c))
  484. endw
  485. " Removes highlight of your last search
  486. noremap <C-c>h :nohlsearch<CR>
  487. vnoremap <C-c>h :nohlsearch<CR>
  488. inoremap <C-c>h :nohlsearch<CR>
  489. " Bind Ctrl+<movement> keys to move around the windows
  490. noremap <C-j> <C-w>j
  491. noremap <C-k> <C-w>k
  492. noremap <C-l> <C-w>l
  493. noremap <C-h> <C-w>h
  494. set splitbelow "новое окно появляется снизу
  495. " Resize windows
  496. noremap <S-Down> :resize -5<CR>
  497. noremap <S-Up> :resize +5<CR>
  498. noremap <S-Left> :vertical resize -5<CR>
  499. noremap <S-Right> :vertical resize +5<CR>
  500. inoremap <S-Down> <Esc>:resize -5<CR>a
  501. inoremap <S-Up> <Esc>:resize +5<CR>a
  502. inoremap <S-Left> <Esc>:vertical resize -5<CR>a
  503. inoremap <S-Right> <Esc>:vertical resize +5<CR>a
  504. " noremap <C-c>= :resize +5<CR>
  505. " noremap <C-c>- :resize -5<CR>
  506. " noremap <C-c>. :vertical resize +5<CR>
  507. " noremap <C-c>, :vertical resize -5<CR>
  508. "
  509. " inoremap <C-c>= <Esc>:resize +5<CR>a
  510. " inoremap <C-c>- <Esc>:resize -5<CR>a
  511. " inoremap <C-c>. <Esc>:vertical resize +5<CR>a
  512. " inoremap <C-c>, <Esc>:vertical resize -5<CR>a
  513. " Switch file encoding
  514. set wcm=<Tab> "WTF? but all work
  515. menu Encoding.cp1251 :e ++enc=cp1251<CR>
  516. menu Encoding.koi8-r :e ++enc=koi8-r<CR>
  517. menu Encoding.cp866 :e ++enc=cp866<CR>
  518. menu Encoding.utf-8 :e ++enc=utf-8 <CR>
  519. noremap <F9> :emenu Encoding.<TAB>
  520. " Edit & Apply changes in .vimrc
  521. nnoremap <Leader>ev :tabnew $MYVIMRC<CR>
  522. nnoremap <Leader>sv :source $MYVIMRC<CR>
  523. " Move line up/down
  524. nnoremap <M-k> :m .-2<CR>==
  525. nnoremap <M-j> :m .+1<CR>==
  526. inoremap <M-k> <Esc>:m .-2<CR>==gi
  527. inoremap <M-j> <Esc>:m .+1<CR>==gi
  528. vnoremap <M-k> :m '<-2<CR>gv=gv
  529. vnoremap <M-j> :m '>+1<CR>gv=gv
  530. " Easier moving of code blocks (doesn't lose selection)
  531. vnoremap < <gv
  532. vnoremap > >gv
  533. " Execute Python script
  534. " noremap <F5> <Esc>:w<CR>:! python3 %<CR>
  535. " inoremap <F5> <Esc>:w<CR>:! python3 %<CR>a
  536. noremap <F10> <Esc>:w<CR>:! python3 %<CR>
  537. inoremap <F10> <Esc>:w<CR>:! python3 %<CR>a
  538. " Open, Save, Update & Quit
  539. noremap <C-o> :browse confirm e <CR>
  540. " Close buffer without saving
  541. map <Esc><Esc> :q!<CR>
  542. " Quit all windows without saving
  543. noremap <Leader>q :qa!<CR>
  544. " noremap <C-s> :w!<CR>
  545. noremap <C-z> :update<CR>
  546. vnoremap <C-z> <C-C>:update<CR>
  547. inoremap <C-z> <C-O>:update<CR>
  548. " Save file and Save as ...
  549. noremap <F2> :w!<CR>
  550. noremap <F3> :saveas
  551. " Save & Quit
  552. noremap <F4> :x!<CR>
  553. " Auto adding by Shift-Tab
  554. "inoremap <S-Tab> <C-n>
  555. " Open new tab
  556. nnoremap <C-t>t :tabnew<CR>
  557. inoremap <C-t>t <Esc>:tabnew<CR>a
  558. " Switch between tabs
  559. nnoremap <F8> :tabn <CR>
  560. nnoremap <F7> :tabp <CR>
  561. " Aligning
  562. " center
  563. " inoremap <C-c>c <Esc>:center<CR>a
  564. " nnoremap <C-c>c :center<CR>
  565. " left
  566. " inoremap <C-c>, <Esc>:left<CR>a
  567. " nnoremap <C-c>, :left<CR>
  568. inoremap <C-c>l <Esc>:left<CR>a
  569. nnoremap <C-c>l :left<CR>
  570. " right
  571. " inoremap <C-c>. <Esc>:right<CR>a
  572. " nnoremap <C-c>. :right<CR>
  573. inoremap <C-c>r <Esc>:right<CR>a
  574. nnoremap <C-c>r :right<CR>
  575. " Copy/Cut/Past from/to system buffer
  576. vnoremap <C-x> "+d
  577. vnoremap <C-c> "*y :let @+=@*<CR>
  578. map <C-p> "+p
  579. " vnoremap <C-c>y "+y
  580. " vnoremap <C-c>x "+d
  581. " nnoremap <C-c>p "+p
  582. " nnoremap <C-c>P "+P " P - paste before
  583. " Surround the selection in "", '', ()
  584. vnoremap <Leader>" <ESC>`<i"<ESC>`>la"<ESC>
  585. vnoremap <Leader>' <ESC>`<i'<ESC>`>la'<ESC>
  586. vnoremap <Leader>( <ESC>`<i(<ESC>`>la)<ESC>
  587. " Go to BOL and EOL
  588. inoremap <M-h> <ESC>0i
  589. inoremap <M-l> <ESC>$a
  590. nnoremap <S-h> 0
  591. nnoremap <S-l> $
  592. " Return from insert mode to normal
  593. " inoremap jk <ESC>
  594. " inoremap ii <ESC>l
  595. " inoremap jj <ESC>
  596. inoremap <M-;> <ESC>
  597. " Несколько удобных биндингов для с, c++, java, python
  598. augroup filetype_coding
  599. autocmd!
  600. " au FileType c,cpp,cc,h,java inoremap {<CR> {<CR>}<Esc>O
  601. " au FileType c,cpp,cc,h,java inoremap #M int main(int argc, char * argv[])<CR>{<CR>return 0;<CR>}<CR><Esc>2kO
  602. " au FileType c,cpp,cc,h,java inoremap #m int main()<CR>{<CR>return 0;<CR>}<CR><Esc>2kO
  603. " au FileType c,cpp,cc,h,java inoremap #d #define
  604. " au FileType c,cpp,cc,h,java inoremap #e #endif /* */<Esc>hhi
  605. " au FileType c,cpp,cc,h,java inoremap #" #include ""<Esc>i
  606. " au FileType c,cpp,cc,h,java inoremap #< #include <><Esc>i
  607. " au FileType c,cpp,cc,h,java inoremap #f /* FIXME: */<Esc>hhi
  608. " au FileType c,cpp,cc,h,java inoremap #t /*TODO: */<Esc>hhi
  609. " au FileType c,cpp,cc,h,java inoremap ;; <END>;<CR>
  610. " au FileType c,cpp,cc,h,java inoremap (; ();<CR>
  611. " au FileType c,cpp,cc,h,java inoremap ({ () {<CR>}<Esc>O
  612. " au FileType c,cpp,cc,h,java inoremap /*<Space> /* */<Esc>3ha
  613. " au FileType c,cpp,cc,h,java inoremap ` <END>;
  614. " au FileType c,cpp,cc,h,java inoremap ' ''<Left>
  615. " au FileType c,cpp,cc,h,java inoremap " ""<Left>
  616. " au FileType c,cpp,cc,h,java inoremap ( ()<Left>
  617. " au FileType c,cpp,cc,h,java inoremap [ []<Left>
  618. " au FileType c,cpp,cc,h,java,python inoremap nl <END><CR>
  619. " au FileType c,cpp,cc,h,java,python inoremap ~ <END>:
  620. au FileType python inoremap :: <END>:<CR>
  621. au FileType python inoremap (: ():<CR>
  622. au FileType python inoremap #ifn if __name__ == "__main__":<CR>
  623. au FileType python inoremap #t # TODO: <Esc>i
  624. au FileType python inoremap #f # FIXME: <Esc>i
  625. augroup END
  626. " Биндинги для LaTeX
  627. " augroup filetype_latex
  628. " autocmd!
  629. " au FileType tex inoremap %- %---------------------------------------------------------------------------<CR>
  630. " au FileType tex inoremap %= %===========================================================================<CR>
  631. " au FileType tex inoremap { {}<Left>
  632. " au FileType tex inoremap \bei \begin{itemize}<CR>
  633. " au FileType tex inoremap \ei \end{itemize}<CR>
  634. " au FileType tex inoremap \bee \begin{enumerate}<CR>
  635. " au FileType tex inoremap \ee \end{enumerate}<CR>
  636. " au FileType tex inoremap \it \item
  637. " augroup END
  638. " bindings for JetBrains IDEs
  639. " inoremap :: <END>:<CR>
  640. " inoremap (: ():<CR>
  641. " New line
  642. " inoremap '' <END><CR>