[vim] merge

This commit is contained in:
2022-08-21 16:55:23 +03:00
2 changed files with 45 additions and 28 deletions

3
vim/README.md Normal file
View File

@@ -0,0 +1,3 @@
https://unix.stackexchange.com/questions/110251/how-to-put-current-line-at-top-center-bottom-of-screen-in-vim
https://www.thegeekstuff.com/2009/03/8-essential-vim-editor-navigation-fundamentals/
https://vi.stackexchange.com/questions/14403/how-to-go-to-previous-open-buffer-from-vim-command-line

View File

@@ -1,38 +1,15 @@
" TODO: fzf enable search through hidden files - https://www.reddit.com/r/neovim/comments/fzeccx/how_can_i_make_fzf_include_hidden_directories/
" TODO: fix fzf search the same dir in different windows https://vimways.org/2019/vim-and-the-working-directory/
" TODO: create readme file about navigation
filetype plugin indent on "Включает определение типа файла, загрузку... filetype plugin indent on "Включает определение типа файла, загрузку...
"... соответствующих ему плагинов и файлов отступов "... соответствующих ему плагинов и файлов отступов
set encoding=utf-8 set encoding=utf-8
syntax enable syntax enable
set timeoutlen=200 ttimeoutlen=0 " https://www.johnhawthorn.com/2012/09/vi-escape-delays/ set timeoutlen=300 ttimeoutlen=0 " https://www.johnhawthorn.com/2012/09/vi-escape-delays/
set number relativenumber set number relativenumber
set backspace=indent,eol,start set backspace=indent,eol,start
filetype plugin indent on filetype plugin indent on
"
" Colors configuration
"
set term=xterm-256color
colorscheme atom-dark-256
AirlineTheme dark
function ToggleColors()
if (g:colors_name == "atom-dark-256")
colorscheme antiphoton
AirlineTheme light
else
colorscheme atom-dark-256
AirlineTheme dark
endif
endfunction
nnoremap <C-b> :call ToggleColors()<CR>
" Changing <leader> key from \ to <space>
nnoremap <SPACE> <Nop>
let mapleader=" "
" Folding params
set foldlevelstart=20
if empty(glob('~/.vim/autoload/plug.vim')) "Если vim-plug не стоит if empty(glob('~/.vim/autoload/plug.vim')) "Если vim-plug не стоит
silent !curl -fLo ~/.vim/autoload/plug.vim --create-dirs silent !curl -fLo ~/.vim/autoload/plug.vim --create-dirs
\ https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim \ https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim
@@ -53,6 +30,42 @@ call plug#begin('~/.vim/bundle') "Начать искать плагины в э
Plug 'junegunn/fzf.vim' Plug 'junegunn/fzf.vim'
call plug#end() "Перестать это делать call plug#end() "Перестать это делать
"
" Colors configuration
"
set term=xterm-256color
colorscheme atom-dark-256
AirlineTheme dark
function ToggleColors()
if (g:colors_name == "atom-dark-256")
colorscheme antiphoton
AirlineTheme light
else
colorscheme atom-dark-256
AirlineTheme dark
endif
endfunction
nnoremap <C-b> :call ToggleColors()<CR>
" tabs navigation
nnoremap <C-S-tab> :tabprevious<CR>
nnoremap <C-tab> :tabnext<CR>
nnoremap <C-t> :tabnew<CR>
inoremap <C-S-tab> <Esc>:tabprevious<CR>i
inoremap <C-tab> <Esc>:tabnext<CR>i
inoremap <C-t> <Esc>:tabnew<CR>i
nnoremap H gT
nnoremap L gt
" Changing <leader> key from \ to <space>
nnoremap <SPACE> <Nop>
let mapleader=" "
" Folding params
set foldlevelstart=20
" "
" Vim-Airline plugin config " Vim-Airline plugin config
" "
@@ -82,6 +95,7 @@ nnoremap <leader>gp :! git push<CR> " git Push
nnoremap <leader>n :NERDTreeFocus<CR> nnoremap <leader>n :NERDTreeFocus<CR>
nnoremap <C-n> :NERDTree<CR> nnoremap <C-n> :NERDTree<CR>
nnoremap <C-t> :NERDTreeToggle<CR> nnoremap <C-t> :NERDTreeToggle<CR>
let NERDTreeShowHidden=1
" Exit Vim if NERDTree is the only window remaining in the only tab. " Exit Vim if NERDTree is the only window remaining in the only tab.
autocmd BufEnter * if tabpagenr('$') == 1 && winnr('$') == 1 && exists('b:NERDTree') && b:NERDTree.isTabTree() | quit | endif autocmd BufEnter * if tabpagenr('$') == 1 && winnr('$') == 1 && exists('b:NERDTree') && b:NERDTree.isTabTree() | quit | endif
@@ -93,7 +107,7 @@ let g:fzf_layout = { 'window': { 'width': 0.9, 'height': 0.6 } }
nnoremap <silent> <Leader>b :Buffers<CR> nnoremap <silent> <Leader>b :Buffers<CR>
nnoremap <silent> <Leader>f :Files<CR> nnoremap <silent> <Leader>f :Files<CR>
nnoremap <silent> <Leader>cf :Rg<CR> nnoremap <silent> <Leader>gr :Rg<CR>
nnoremap <silent> <Leader>/ :BLines<CR> nnoremap <silent> <Leader>/ :BLines<CR>
nnoremap <silent> <Leader>' :Marks<CR> nnoremap <silent> <Leader>' :Marks<CR>
nnoremap <silent> <Leader>g :Commits<CR> nnoremap <silent> <Leader>g :Commits<CR>