diff --git a/install.conf.yaml b/install.conf.yaml index ab4931e..b04c0b3 100644 --- a/install.conf.yaml +++ b/install.conf.yaml @@ -7,6 +7,7 @@ - link: ~/.tmux.conf: tmux.conf ~/.vim: vim + ~/.zshrc: zsh/zshrc - shell: - [git submodule update --init --recursive, Installing submodules] diff --git a/vim/coc.vim b/vim/coc.vim index 53b64ee..abfa0d4 100644 --- a/vim/coc.vim +++ b/vim/coc.vim @@ -21,8 +21,6 @@ endfunction " inoremap c coc#refresh() " endif -" Use K to show documentation in preview window. -nnoremap K :call ShowDocumentation() function! ShowDocumentation() if CocAction('hasProvider', 'hover') @@ -32,11 +30,13 @@ function! ShowDocumentation() endif endfunction +" [docs] Coc-vim hotkeys +" Use K to show documentation in preview window. +nnoremap K :call ShowDocumentation() " Use `[g` and `]g` to navigate diagnostics " Use `:CocDiagnostics` to get all diagnostics of current buffer in location list. nmap [g (coc-diagnostic-prev) nmap ]g (coc-diagnostic-next) - " GoTo code navigation. nmap gd (coc-definition) nmap gy (coc-type-definition) diff --git a/vim/ftplugin/dart.vim b/vim/ftplugin/dart.vim new file mode 100644 index 0000000..3b13e73 --- /dev/null +++ b/vim/ftplugin/dart.vim @@ -0,0 +1,7 @@ +set tabstop=2 +set shiftwidth=2 +set expandtab +set smartindent + +xmap a (coc-codeaction-selected) +nmap a (coc-codeaction-selected) diff --git a/vim/ftplugin/json.vim b/vim/ftplugin/json.vim index bd55dee..035bbc4 100644 --- a/vim/ftplugin/json.vim +++ b/vim/ftplugin/json.vim @@ -1,2 +1,13 @@ +" au! BufRead,BufNewFile *.json set filetype=json +" augroup json_autocmd +" autocmd! +" autocmd FileType json set autoindent +" autocmd FileType json set formatoptions=tcq2l +" autocmd FileType json set textwidth=78 shiftwidth=2 +" autocmd FileType json set softtabstop=2 tabstop=2 +" autocmd FileType json set expandtab +" autocmd FileType json set foldmethod=syntax +" augroup END set conceallevel=0 let g:indentLine_setConceal = 0 +autocmd FileType json setlocal ts=2 sts=2 sw=2 expandtab diff --git a/vim/readme.py b/vim/readme.py new file mode 100644 index 0000000..65397bd --- /dev/null +++ b/vim/readme.py @@ -0,0 +1,45 @@ +import re + +config = [line.strip() for line in open("coc.vim", "r").readlines()] + +def string_to_reject(string): + result = False + if string in ["\""]: + result = True + + return result + +def string_to_accept(string): + result = False + accepted_keywords = ["nnoremap", "nmap", "noremap", "\""] + + result = any(subs in string for subs in accepted_keywords) + + return result + +def header(string): + string = re.sub(r"^\" \[docs\]", "###", string) + + return f"\n{string}\n" + +doc_block_started = False +doc_lines = [] + +for line in config: + if "[docs]" in line: + doc_block_started = True + doc_lines.append(header(line)) + continue + elif line == "": + doc_block_started = False + continue + + if doc_block_started and string_to_accept(line) and not string_to_reject(line): + if not line.startswith("\"") and not line.startswith("#"): + line = f" {line}" + else: + line = re.sub(r"^\"\s*", "", line) + line = f"{line}\n" + doc_lines.append(line) + +print("\n".join(doc_lines)) diff --git a/vim/vimrc b/vim/vimrc index a7fc463..884cfb0 100644 --- a/vim/vimrc +++ b/vim/vimrc @@ -11,10 +11,31 @@ set noswapfile set encoding=utf-8 syntax enable set timeoutlen=300 ttimeoutlen=0 " https://www.johnhawthorn.com/2012/09/vi-escape-delays/ +set clipboard=unnamed +set nocompatible + " For coc-vim. Always show the signcolumn, otherwise it would shift the text each time " diagnostics appear/become resolved. set signcolumn=yes + +" linenumbers, in relative manner set number relativenumber + +set splitbelow +set splitright + +" [docs] split navigation +" switching between splits +nnoremap j +nnoremap k +nnoremap l +nnoremap h +" resizing splits +noremap :vertical resize +3 +noremap :vertical resize -3 +noremap :resize +3 +noremap :resize -3 + set backspace=indent,eol,start filetype plugin indent on @@ -40,6 +61,7 @@ call plug#begin('~/.vim/bundle') "Начать искать плагины в э Plug 'towolf/vim-helm' Plug 'pearofducks/ansible-vim' Plug 'neoclide/coc.nvim', {'branch': 'release'} + Plug 'elzr/vim-json' call plug#end() "Перестать это делать " @@ -61,14 +83,10 @@ endfunction nnoremap :call ToggleColors() -" tabs navigation -nnoremap :tabprevious -nnoremap :tabnext -nnoremap :tabnew -inoremap :tabpreviousi -inoremap :tabnexti -inoremap :tabnewi +" [docs] tabs navigation +" go left nnoremap H gT +" go right nnoremap L gt @@ -89,30 +107,30 @@ let g:airline_section_z = "㏑:%l/%L:%c" " Custom minimalistic current position let g:Powerline_symbols='unicode' " Unicode support " -" Gitgutter plugin config +" [docs] Gitgutter plugin config " let g:gitgutter_override_sign_column_highlight = 1 set updatetime=100 -nnoremap gu :GitGutterUndoHunk " undo git change under the line +nnoremap gu :GitGutterUndoHunk| " undo git change under the line " -" Magit plugin config +" [docs] Magit plugin config " -nnoremap gs :Magit| " git status +nnoremap gs :Magit| " git status function GitPullPush(cmd) echo system('git '.a:cmd) " redraw! endfunction -nnoremap gp :call GitPullPush("push")| " git Push -nnoremap gP :call GitPullPush("pull")| " git Pull +nnoremap gp :call GitPullPush("push")| " git Push +nnoremap gP :call GitPullPush("pull")| " git Pull " -" NERDTree plugin config +" [docs] NERDTree plugin config " nnoremap n :NERDTreeFocus -nnoremap :NERDTree nnoremap :NERDTreeToggle let NERDTreeShowHidden=1 + " 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 @@ -130,8 +148,8 @@ command! -bang -nargs=* Rg call \1, \fzf#vim#with_preview({'options': '--exact --delimiter : --nth 4..'}), 0) " is for strict search by default and other unknown stuff is to exclude filenames from search results +" [docs] fzf hotkeys nnoremap ag :Rg | " searching for word ander cursor - nnoremap b :Buffers nnoremap f :Files nnoremap gr :Rg @@ -155,9 +173,9 @@ let g:ansible_yamlKeyName = 'yamlKey' " " CoC plugin settings " -let g:coc_global_extensions = ['coc-pyright'] +let g:coc_global_extensions = ['coc-pyright', 'coc-flutter', 'coc-sh'] function! s:enable_coc_for_type() - let l:filesuffix_whitelist = ['py'] + let l:filesuffix_whitelist = ['py', 'dart', 'sh'] if index(l:filesuffix_whitelist, expand('%:e')) == -1 let b:coc_enabled = 0 endif diff --git a/zsh/zshrc b/zsh/zshrc new file mode 100644 index 0000000..59ed118 --- /dev/null +++ b/zsh/zshrc @@ -0,0 +1,7 @@ +if type brew &>/dev/null +then + FPATH="$(brew --prefix)/share/zsh/site-functions:${FPATH}" + + autoload -Uz compinit + compinit +fi