Skip to content

Commit

Permalink
Updates
Browse files Browse the repository at this point in the history
  • Loading branch information
aiotter committed Sep 7, 2022
1 parent 90c08ce commit dd8fa48
Show file tree
Hide file tree
Showing 12 changed files with 152 additions and 20 deletions.
3 changes: 3 additions & 0 deletions .config/clangd/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
CompileFlags:
# Add: [-isysroot=/User/aiotter/.platformio/packages/toolchain-xtensa32/xtensa-esp32-elf/sysroot/]
Remove: [-fstrict-volatile-bitfields]
17 changes: 15 additions & 2 deletions .config/nvim/plugins/display.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,14 @@ colorscheme dichromatic
# Display the indention levels with thin vertical lines
[[plugins]]
repo = 'Yggdroot/indentLine'
on_event = 'InsertEnter'
on_event = 'BufWinEnter'
hook_add = '''
let g:indentLine_setConceal=0
let g:indentLine_setConceal = 0
" let g:indentLine_setColors = 0
" let g:indentLine_char = '︳'
" let g:indentLine_char = '⎜'
let g:indentLine_char = '⎸'
" let g:indentLine_char = '꜏'
'''


Expand All @@ -27,3 +32,11 @@ if &termguicolors
HexokinaseTurnOn
endif
'''


[[plugins]]
repo = 'blueyed/vim-diminactive'
hook_post_source = '''
let g:diminactive_enable_focus = 1
highlight ColorColumn ctermbg=0 guibg=#303030
'''
25 changes: 25 additions & 0 deletions .config/nvim/plugins/filetypes.toml
Original file line number Diff line number Diff line change
Expand Up @@ -24,3 +24,28 @@ on_if = 'expand("%") =~# "^hosts$"'
[[plugins]]
repo = 'jxnblk/vim-mdx-js'
hook_add = 'autocmd BufNewFile,BufRead *.mdx set filetype=markdown.mdx'


# [[plugins]]
# repo = 'vim-scripts/ifdef-highlighting'
# on_ft = ['c', 'cpp']
# hook_add = "execute 'source' g:dein#plugin.rtp . '/syntax/ifdef.vim'"


[[plugins]]
repo = 'mphe/grayout.vim'
on_ft = ['c', 'cpp']
hook_add = '''
let g:grayout_libclang_path = "/usr/local/opt/llvm/lib"
autocmd BufReadPost,BufWritePost * if &ft == 'c' || &ft == 'cpp' || &ft == 'objc' | exec 'GrayoutUpdate' | endif
autocmd CursorHold,CursorHoldI * if &ft == 'c' || &ft == 'cpp' || &ft == 'objc' | exec 'GrayoutUpdate' | endif
'''
hook_source = '''
highlight PreprocessorGrayout ctermfg=gray ctermbg=darkgray guifg=#b5b3b3 guibg=#3d3d3d
'''


# [[plugins]]
# repo = 'ziglang/zig.vim'
# lazy = true
# merge_ftdetect = true
18 changes: 17 additions & 1 deletion .config/nvim/plugins/lsp.toml
Original file line number Diff line number Diff line change
Expand Up @@ -56,12 +56,28 @@ if s:pio_project_root->strlen() > 0 && executable("pio") && executable("clangd")
\ ],
\ 'allowlist': ['c', 'cpp', 'objc', 'objcpp', 'cc'],
\ })
elseif executable("clangd")
au User lsp_setup call lsp#register_server({
\ 'name': 'clangd',
\ 'cmd': ['clangd', '-background-index'],
\ 'allowlist': ['c', 'cpp', 'objc', 'objcpp', 'cc'],
\ })
endif
" Nix
if executable('rnix-lsp')
au User lsp_setup call lsp#register_server({
\ 'name': 'rnix-lsp',
\ 'cmd': {server_info->[&shell, &shellcmdflag, 'rnix-lsp']},
\ 'whitelist': ['nix'],
\ })
endif
'''


[[plugins]]
repo = 'mattn/vim-lsp-settings'
# repo = 'mattn/vim-lsp-settings'
repo = '/Users/aiotter/repo/github.com/mattn/vim-lsp-settings'
depends = 'vim-lsp'
hook_add = '''
let g:lsp_settings_filetype_javascript = ['deno', 'typescript-language-server', 'eslint-language-server']
Expand Down
4 changes: 4 additions & 0 deletions .config/nvim/plugins/objects.toml
Original file line number Diff line number Diff line change
Expand Up @@ -30,3 +30,7 @@ depends = 'vim-textobj-user'
[[plugins]]
repo = 'idbrii/textobj-word-column.vim'
depends = 'vim-textobj-user'


[[plugins]]
repo = 'chaoren/vim-wordmotion'
4 changes: 4 additions & 0 deletions .config/nvim/plugins/others.toml
Original file line number Diff line number Diff line change
Expand Up @@ -71,3 +71,7 @@ hook_add = 'let g:suda_smart_edit = 1'

# [[plugins]]
# repo = 'vim-scripts/sudo.vim'

[[plugins]]
repo = 'vim-jp/vimdoc-ja'
hook_add = 'set helplang=ja,en'
30 changes: 29 additions & 1 deletion .config/nvim/plugins/support_input.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ repo = 'Raimondi/delimitMate'
on_event = 'InsertEnter'
hook_add = '''
" Avoid conflicting delimitMate with vim-closetag
autocmd FileType html,xhtml,phtml,jsx let b:delimitMate_matchpairs = "(:),[:],{:}"
autocmd FileType html,xhtml,phtml,javascriptreact,typescriptreact let b:delimitMate_matchpairs = "(:),[:],{:}"
'''


Expand Down Expand Up @@ -62,3 +62,31 @@ on_ft = ['html', 'xhtml', 'phtml', 'javascriptreact', 'typescriptreact']
# hook_add = '''
# map ; <Plug>(easymotion-prefix)
# '''


[[plugins]]
repo = 'andymass/vim-matchup'


[[plugins]]
repo = 'junegunn/vim-peekaboo'
on_event = 'BufWinEnter'
hook_add = '''
let g:peekaboo_delay = 500
let g:peekaboo_window="call CreateCenteredFloatingWindow()"
function! CreateCenteredFloatingWindow() abort
if(!has('nvim'))
split
new
else
let width = float2nr(&columns * 0.6)
let height = float2nr(&lines * 0.6)
let top = ((&lines - height) / 2) - 1
let left = (&columns - width) / 2
let opts = {'relative': 'editor', 'row': top, 'col': left, 'width': width, 'height': height, 'style': 'minimal', 'border': 'single', 'noautocmd': 1}
let s:buf = nvim_create_buf(v:false, v:true)
call nvim_open_win(s:buf, v:true, opts)
endif
endfunction
'''
4 changes: 3 additions & 1 deletion .gitconfig
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,15 @@
list = !ghq list
one = !git log --oneline --color=always | head
unstage = reset HEAD
# https://github.com/not-an-aardvark/git-delete-squashed
delete-squashed = "!f() { local targetBranch=${1:-master} && git checkout -q $targetBranch && git branch --merged | grep -v \"\\*\" | xargs -n 1 git branch -d && git for-each-ref refs/heads/ \"--format=%(refname:short)\" | while read branch; do mergeBase=$(git merge-base $targetBranch $branch) && [[ $(git cherry $targetBranch $(git commit-tree $(git rev-parse $branch^{tree}) -p $mergeBase -m _)) == \"-\"* ]] && git branch -D $branch; done; }; f"

[ghq]
root = ~/repo
user = aiotter

[delta]
features = side-by-side
features = traditional

[delta "traditional"]
keep-plus-minus-markers = true
Expand Down
11 changes: 9 additions & 2 deletions .tmux.conf
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,15 @@ bind-key -nr S-Right select-pane -R
bind-key -nr S-Up select-pane -U
bind-key -nr S-Down select-pane -D

# Vimのキーバインドでペインを移動する
# Vim/Emacs のキーバインドでペインを移動する
bind-key -r h select-pane -L
bind-key -r j select-pane -D
bind-key -r k select-pane -U
bind-key -r l select-pane -R
bind-key -r C-b select-pane -L
bind-key -r C-f select-pane -R
bind-key -r C-p select-pane -U
bind-key -r C-n select-pane -D

# Shift + HJKL でペインをリサイズする
bind-key -r H resize-pane -L 2
Expand All @@ -49,6 +53,9 @@ bind-key -r C-j switch-client -n
bind-key -r C-k switch-client -p
bind-key -r C-l next-window

# Shift + ドラッグでペインをスワップ
bind-key -n S-MouseDragEnd1Pane swap-pane -t =

# ペイン境界線の設定
# ACSを強制してペイン境界線をきれいに表示 (*:U8=0)
set -ag terminal-overrides ',*:U8=0,xterm-256color:Tc'
Expand Down Expand Up @@ -133,7 +140,7 @@ set -g status-left "#{prefix_highlight}#(bash ${HOME}/dotfiles/tmux/responsive-w
set -g status-right-length 60
set -g status-right "#(bash ${HOME}/dotfiles/tmux/responsive-window-status-r.sh '#{client_width}')"
## リフレッシュの間隔を設定する(デフォルト 15秒)
# set -g status-interval 60
set -g status-interval 30
## ウィンドウリストの位置を中心寄せにする
set -g status-justify centre
## ヴィジュアルノーティフィケーションを有効にする
Expand Down
52 changes: 40 additions & 12 deletions .vimrc
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,8 @@ autocmd ColorScheme * highlight SpecialKey ctermbg=NONE ctermfg=238 guibg=NONE g
" json のダブルクオーテーションなど,視認性を妨げる文字を隠す設定
if has('conceal')
set conceallevel=1 " 表示する(0), 代理文字(default: スペース)に置換(1), 非表示(2)
set concealcursor= " 構文を隠すモードの指定.n: normal, v: visual, i: insert, c: command
set concealcursor=nc " カーソルライン上で構文を隠すモードの指定.n: normal, v: visual, i: insert, c: command
autocmd ColorSchemePre * highlight clear Conceal
endif


Expand All @@ -118,8 +119,8 @@ set ignorecase " 検索パターンに大文字小文字を区別しない
set smartcase " 検索パターンに大文字を含んでいたら大文字小文字を区別する
set hlsearch " 検索結果をハイライト

" ESCキー2度押しでハイライトの切り替え
nnoremap <silent><Esc><Esc> :<C-u>set nohlsearch!<CR>
" ESCキー2度押しでハイライトの非表示化
nnoremap <silent><Esc><Esc> :<C-u>nohlsearch<CR>

" ----- カーソル -----
Expand All @@ -129,11 +130,18 @@ set cursorline " カーソルラインをハイライト
" highlight CursorLine cterm=NONE ctermfg=NONE ctermbg=darkgray
set scrolloff=5 " スクロール時、常に5行先を表示する

" 行が折り返し表示されていた場合、行単位ではなく表示行単位でカーソルを移動する
nnoremap j gj
nnoremap k gk
nnoremap <down> gj
nnoremap <up> gk
" https://zenn.dev/mattn/articles/83c2d4c7645faa
nmap gj gj<SID>g
nmap gk gk<SID>g
nnoremap <script> <SID>gj gj<SID>g
nnoremap <script> <SID>gk gk<SID>g
nmap <SID>g <Nop>
" Emacs-like behaviour
nnoremap <C-b> h
nnoremap <C-n> j
nnoremap <C-p> k
nnoremap <C-f> l
" バックスペースキーの有効化
set backspace=indent,eol,start
Expand Down Expand Up @@ -230,15 +238,35 @@ endfunction
inoremap <expr><CR> _Enter_key()
" C-p と C-n を矢印キーと同じ挙動に(候補選択時に挿入しない)
inoremap <expr><C-n> pumvisible() ? "<Down>" : "<C-n>"
inoremap <expr><C-p> pumvisible() ? "<Up>" : "<C-p>"
" inoremap <expr><C-n> pumvisible() ? "<Down>" : "<C-n>"
" inoremap <expr><C-p> pumvisible() ? "<Up>" : "<C-p>"

" カーソルキーで補完ウィンドウにフォーカスしない
function! Is_completion_unforcused()
return complete_info(['pum_visible', 'selected']) == {'pum_visible': 1, 'selected': -1}
endfunction
inoremap <expr><Down> Is_completion_unforcused() ? "\<C-e>\<Down>" : "\<Down>"
inoremap <expr><Up> Is_completion_unforcused() ? "\<C-e>\<Up>" : "\<Up>"
imap <expr><Down> Is_completion_unforcused() ? "\<C-e>\<Down>" : "\<Down>"
imap <expr><Up> Is_completion_unforcused() ? "\<C-e>\<Up>" : "\<Up>"
" ↓おそらく vim のバグで設定できない
imap <expr><C-n> Is_completion_unforcused() ? "\<C-e>\<C-n>" : "\<Down>"
imap <expr><C-p> Is_completion_unforcused() ? "\<C-e>\<C-p>" : "\<Up>"

" ----- ヒントの表示 -----
" function! s:hint_cmd_output(prefix, cmd) abort
" redir => str
" execute a:cmd
" redir END
" echo str
" return a:prefix . nr2char(getchar())
" endfunction
"
" nnoremap <expr> m <SID>hint_cmd_output('m', 'marks')
" nnoremap <expr> ` <SID>hint_cmd_output('`', 'marks')
" nnoremap <expr> ' <SID>hint_cmd_output("'", 'marks')
" nnoremap <expr> " <SID>hint_cmd_output('"', 'registers')
" nnoremap <expr> q <SID>hint_cmd_output('q', 'registers')
" nnoremap <expr> @ <SID>hint_cmd_output('@', 'registers')


" ----- その他 -----
Expand Down
1 change: 1 addition & 0 deletions .zshrc
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ HISTFILE="$HOME/.zsh_history"
HISTSIZE=100000
SAVEHIST=100000
setopt EXTENDED_HISTORY
setopt NO_SHARE_HISTORY
setopt hist_reduce_blanks
setopt hist_ignore_dups
setopt hist_ignore_space
Expand Down
3 changes: 2 additions & 1 deletion tmux/responsive-window-status-r.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@ MEDIUM=140
PATH=$HOME/local/bin:$PATH

# オンラインステータスの取得
ping 'google.com' -c 1 >/dev/null 2>&1
# timeout is less than status-interval by 1s
ping 'google.com' -c1 -t "$(($(tmux show -Av status-interval) - 1))" >/dev/null 2>&1
if [ $? == 0 ]; then
interface="$(get-current-network-interface)"
if echo $interface | grep -i wi-fi; then
Expand Down

0 comments on commit dd8fa48

Please sign in to comment.