Last active
July 12, 2022 12:52
-
-
Save dmitry-vsl/5967167 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
syntax on | |
"screen magic - fix screen in oxs terminal | |
" http://stackoverflow.com/questions/14689925/vim-background-with-gnu-screen | |
set t_ut= | |
autocmd FileType text setlocal cc=1000 | |
autocmd FileType make setlocal noexpandtab | |
let g:MyCommand='node test/run.js' | |
function! MyRun() | |
:wa | |
:e run | |
:set bt=nofile | |
:execute "normal!ggVGd" | |
:execute "r!".g:MyCommand." 2>&1 | sed 'sqfile://qqg'" | |
:redraw! | |
:execute "normal!gg" | |
:silent! execute "/at" | |
endfunction | |
function! MyNext() | |
:b run | |
:execute "/js" | |
:execute "normal!w" | |
endfunction | |
function! MyPrev() | |
:b run | |
:execute "?js" | |
:execute "normal!w" | |
endfunction | |
nnoremap <F3> :call MyRun()<CR> | |
"set makeprg=eslint\ --no-color\ -f\ unix\ --env\ browser\ % | |
nnoremap <C-c><C-j> :wa\|:make<CR> | |
set number | |
silent !mkdir -p ~/.vim/undodir ~/.vim/backup | |
set undodir=~/.vim/undodir | |
set undofile | |
set backupdir=~/.vim/backup | |
set backup | |
set hidden | |
set noswapfile | |
set tabstop=2 | |
set shiftwidth=2 | |
set expandtab | |
set autoindent | |
set smartindent | |
set ignorecase | |
set smartcase | |
set hlsearch | |
set incsearch | |
"Show current file name | |
set laststatus=2 | |
set statusline=%F | |
" highlight long lines | |
":match ErrorMsg '\%>80v.\+' | |
set cc=80 | |
"search tags in parent directories | |
set tags+=tags;/ | |
"goto file customize | |
set suffixesadd+=.js,.html,.htm,.rb | |
set backspace=indent,eol,start | |
nnoremap <Tab> <C-^> | |
nnoremap dj ^d$ | |
"jump regarding line number | |
nnoremap gf gF | |
inoremap jj <Esc> | |
nnoremap j gj | |
nnoremap k gk | |
nnoremap dw diw | |
nnoremap cw ciw | |
nnoremap d" di" | |
nnoremap c" ci" | |
nnoremap d' di' | |
nnoremap c' ci' | |
nnoremap d( di( | |
nnoremap c( ci( | |
:set langmap=ФИСВУАПРШОЛДЬТЩЗЙКЫЕГМЦЧНЯ;ABCDEFGHIJKLMNOPQRSTUVWXYZ,фисвуапршолдьтщзйкыегмцчня;abcdefghijklmnopqrstuvwxyz | |
" Grep --------------------------------------------- | |
"grep hotkeys. Set cmdheight to 2 and one more <CR> to supress 'Press Enter' message | |
set cmdheight=2 | |
set grepprg=grep\ -rn\ --binary-files=without-match\ --exclude-dir=dist\ --exclude-dir=artifacts\ --exclude-dir=node_modules\ --exclude-dir=.svn\ --exclude-dir=minified\ --exclude-dir=.git\ --exclude-dir=build\ --exclude=\"*.src\"\ --exclude=\"*.map\"\ --exclude=\"tags\"\ $* | |
"map <F4> :execute "grep ".expand("<cword>") . " . " <bar> cwindow<CR><CR> | |
map <F4> :wa\|silent execute "grep ".expand("<cword>") . " . "<CR>\|:redraw!<CR> | |
map <F11> :cprev<CR> | |
map <F12> :cnext<CR> | |
" Git ----------------------------------------------- | |
"Dont show whitespace in diff | |
set diffopt+=iwhite | |
colorscheme evening | |
if &diff | |
syntax off | |
endif | |
nnoremap <F1> :wa\|silent exe '!git difftool -y '.expand("%")\|redraw!<CR> | |
nnoremap <F2> :wa\|silent exe "!git add ".expand('%')\|redraw!<CR> | |
nnoremap <F5> :!git status<CR> | |
nnoremap <Leader>gm :exe '!vim -d '.bufname(2).' '.bufname(3) <CR> | |
nnoremap <Leader>gt :exe '!vim -d '.bufname(2).' '.bufname(1) <CR> | |
" COC ---------------------------------------------- | |
nnoremap ` :CocDiagnostics<CR> | |
nmap <silent> gd <Plug>(coc-definition) | |
inoremap <silent><expr> <C-n> | |
\ pumvisible() ? "\<C-n>" : | |
\ CheckBackspace() ? "\<TAB>" : | |
\ coc#refresh() | |
"inoremap <expr><S-TAB> pumvisible() ? "\<C-p>" : "\<C-h>" | |
function! CheckBackspace() abort | |
let col = col('.') - 1 | |
return !col || getline('.')[col - 1] =~# '\s' | |
endfunction | |
" Always show the signcolumn, otherwise it would shift the text each time | |
" diagnostics appear/become resolved. | |
if has("nvim-0.5.0") || has("patch-8.1.1564") | |
" Recently vim can merge signcolumn and number column into one | |
set signcolumn=number | |
else | |
set signcolumn=yes | |
endif | |
"for ts (when not using Coc) | |
set errorformat=%+A\ %#%f\ %#(%l\\\,%c):\ %m,%C%m | |
"set makeprg=tsc\ -p\ . |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment