Merge branch 'master' of git.venya.tech:mega_venik/dotfiles

This commit is contained in:
2023-09-12 00:53:29 +03:00
7 changed files with 110 additions and 21 deletions

View File

@@ -7,6 +7,7 @@
- link: - link:
~/.tmux.conf: tmux.conf ~/.tmux.conf: tmux.conf
~/.vim: vim ~/.vim: vim
~/.zshrc: zsh/zshrc
- shell: - shell:
- [git submodule update --init --recursive, Installing submodules] - [git submodule update --init --recursive, Installing submodules]

View File

@@ -21,8 +21,6 @@ endfunction
" inoremap <silent><expr> <Leader>c coc#refresh() " inoremap <silent><expr> <Leader>c coc#refresh()
" endif " endif
" Use K to show documentation in preview window.
nnoremap <silent> K :call ShowDocumentation()<CR>
function! ShowDocumentation() function! ShowDocumentation()
if CocAction('hasProvider', 'hover') if CocAction('hasProvider', 'hover')
@@ -32,11 +30,13 @@ function! ShowDocumentation()
endif endif
endfunction endfunction
" [docs] Coc-vim hotkeys
" Use K to show documentation in preview window.
nnoremap <silent> K :call ShowDocumentation()<CR>
" Use `[g` and `]g` to navigate diagnostics " Use `[g` and `]g` to navigate diagnostics
" Use `:CocDiagnostics` to get all diagnostics of current buffer in location list. " Use `:CocDiagnostics` to get all diagnostics of current buffer in location list.
nmap <silent> [g <Plug>(coc-diagnostic-prev) nmap <silent> [g <Plug>(coc-diagnostic-prev)
nmap <silent> ]g <Plug>(coc-diagnostic-next) nmap <silent> ]g <Plug>(coc-diagnostic-next)
" GoTo code navigation. " GoTo code navigation.
nmap <silent> gd <Plug>(coc-definition) nmap <silent> gd <Plug>(coc-definition)
nmap <silent> gy <Plug>(coc-type-definition) nmap <silent> gy <Plug>(coc-type-definition)

7
vim/ftplugin/dart.vim Normal file
View File

@@ -0,0 +1,7 @@
set tabstop=2
set shiftwidth=2
set expandtab
set smartindent
xmap <leader>a <Plug>(coc-codeaction-selected)
nmap <leader>a <Plug>(coc-codeaction-selected)

View File

@@ -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 set conceallevel=0
let g:indentLine_setConceal = 0 let g:indentLine_setConceal = 0
autocmd FileType json setlocal ts=2 sts=2 sw=2 expandtab

45
vim/readme.py Normal file
View File

@@ -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))

View File

@@ -11,10 +11,31 @@ set noswapfile
set encoding=utf-8 set encoding=utf-8
syntax enable syntax enable
set timeoutlen=300 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 clipboard=unnamed
set nocompatible
" For coc-vim. Always show the signcolumn, otherwise it would shift the text each time " For coc-vim. Always show the signcolumn, otherwise it would shift the text each time
" diagnostics appear/become resolved. " diagnostics appear/become resolved.
set signcolumn=yes set signcolumn=yes
" linenumbers, in relative manner
set number relativenumber set number relativenumber
set splitbelow
set splitright
" [docs] split navigation
" switching between splits
nnoremap <C-j> <C-w>j
nnoremap <C-k> <C-w>k
nnoremap <C-l> <C-w>l
nnoremap <C-h> <C-w>h
" resizing splits
noremap <silent> <C-Left> :vertical resize +3<CR>
noremap <silent> <C-Right> :vertical resize -3<CR>
noremap <silent> <C-Up> :resize +3<CR>
noremap <silent> <C-Down> :resize -3<CR>
set backspace=indent,eol,start set backspace=indent,eol,start
filetype plugin indent on filetype plugin indent on
@@ -40,6 +61,7 @@ call plug#begin('~/.vim/bundle') "Начать искать плагины в э
Plug 'towolf/vim-helm' Plug 'towolf/vim-helm'
Plug 'pearofducks/ansible-vim' Plug 'pearofducks/ansible-vim'
Plug 'neoclide/coc.nvim', {'branch': 'release'} Plug 'neoclide/coc.nvim', {'branch': 'release'}
Plug 'elzr/vim-json'
call plug#end() "Перестать это делать call plug#end() "Перестать это делать
" "
@@ -61,14 +83,10 @@ endfunction
nnoremap <C-b> :call ToggleColors()<CR> nnoremap <C-b> :call ToggleColors()<CR>
" tabs navigation " [docs] tabs navigation
nnoremap <C-S-tab> :tabprevious<CR> " go left
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 H gT
" go right
nnoremap L gt nnoremap L gt
@@ -89,14 +107,14 @@ let g:airline_section_z = "㏑:%l/%L:%c" " Custom minimalistic current position
let g:Powerline_symbols='unicode' " Unicode support let g:Powerline_symbols='unicode' " Unicode support
" "
" Gitgutter plugin config " [docs] Gitgutter plugin config
" "
let g:gitgutter_override_sign_column_highlight = 1 let g:gitgutter_override_sign_column_highlight = 1
set updatetime=100 set updatetime=100
nnoremap <leader>gu :GitGutterUndoHunk<CR> " undo git change under the line nnoremap <leader>gu :GitGutterUndoHunk<CR>| " undo git change under the line
" "
" Magit plugin config " [docs] Magit plugin config
" "
nnoremap <leader>gs :Magit<CR>| " git status nnoremap <leader>gs :Magit<CR>| " git status
function GitPullPush(cmd) function GitPullPush(cmd)
@@ -107,12 +125,12 @@ nnoremap <leader>gp :call GitPullPush("push")<CR>| " git Push
nnoremap <leader>gP :call GitPullPush("pull")<CR>| " git Pull nnoremap <leader>gP :call GitPullPush("pull")<CR>| " git Pull
" "
" NERDTree plugin config " [docs] NERDTree plugin config
" "
nnoremap <leader>n :NERDTreeFocus<CR> nnoremap <leader>n :NERDTreeFocus<CR>
nnoremap <C-n> :NERDTree<CR>
nnoremap <C-t> :NERDTreeToggle<CR> nnoremap <C-t> :NERDTreeToggle<CR>
let NERDTreeShowHidden=1 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
@@ -130,8 +148,8 @@ command! -bang -nargs=* Rg call
\1, \1,
\fzf#vim#with_preview({'options': '--exact --delimiter : --nth 4..'}), <bang>0) " is for strict search by default and other unknown stuff is to exclude filenames from search results \fzf#vim#with_preview({'options': '--exact --delimiter : --nth 4..'}), <bang>0) " is for strict search by default and other unknown stuff is to exclude filenames from search results
" [docs] fzf hotkeys
nnoremap <silent> <Leader>ag :Rg <C-R><C-W><CR>| " searching for word ander cursor nnoremap <silent> <Leader>ag :Rg <C-R><C-W><CR>| " searching for word ander cursor
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>gr :Rg<CR> nnoremap <silent> <Leader>gr :Rg<CR>
@@ -155,9 +173,9 @@ let g:ansible_yamlKeyName = 'yamlKey'
" "
" CoC plugin settings " 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() 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 if index(l:filesuffix_whitelist, expand('%:e')) == -1
let b:coc_enabled = 0 let b:coc_enabled = 0
endif endif

7
zsh/zshrc Normal file
View File

@@ -0,0 +1,7 @@
if type brew &>/dev/null
then
FPATH="$(brew --prefix)/share/zsh/site-functions:${FPATH}"
autoload -Uz compinit
compinit
fi