1
0
hugo/content/blog/2020-01-22-dotfiles.md

80 lines
2.4 KiB
Markdown
Raw Normal View History

2024-04-23 13:21:26 +00:00
+++
date = "2020-01-22"
tags = ["dotfiles"]
title = "開発環境を作り直してみる2"
slug = "dotfiles"
+++
https://git.syui.cf/syui/dotfiles
### fzf
fzfに関しては、`vim **<tab>`などが使えます。`--preview`で画面分割しながら`tree,cat`したものを表示できます。
grepの代わりになる`rg`とcatの代わりになる`bat`がおすすめで、コマンドオプションなどに追加。あと`.git`以下は拾わないようにしたりとか、ファイルのみとか。
```sh
$ brew install rg bat
```
```sh:~/.zshrc
bindkey '^b' fzf-file-widget
export FZF_DEFAULT_COMMAND='fd --type f --hidden --follow --exclude .git'
export FZF_COMPLETION_OPTS='--preview "bat --color=always --style=header,grid --line-range :100 {}"'
export FZF_CTRL_T_COMMAND='rg --files --hidden --follow --glob "!.git/*"'
export FZF_CTRL_T_OPTS='--preview "bat --color=always --style=header,grid --line-range :100 {}"'
#export FZF_COMPLETION_TRIGGER='~~'
fancy-ctrl-z () {
if [[ $#BUFFER -eq 0 ]]; then
BUFFER="fg"
zle accept-line
else
zle push-input
zle clear-screen
fi
}
zle -N fancy-ctrl-z
bindkey '^z' fancy-ctrl-z
```
`fzf-file-widget`は`^t`ですが、`tmux`に使ってるので`^b`に変更。この辺は`bindkey`コマンドで調べられます。
`^z`でバックグラウンドの利用を促進。
### vim + terminal
vim + terminalは、tyruさんのgithubやblogが参考になると思います。
http://tyru.hatenablog.com/entry/2020/01/06/153959
簡単に言うとpeco, fzfとの連携が便利になるpluginなどをいくつか作られている感じです。
```sh:~/.vimrc
Plug 'tyru/sync-term-cwd.vim'
Plug 'tyru/tapi-reg.vim'
```
```sh
$ go get github.com/mattn/gof
```
### vim-lsp
vim補完についてはmattnさんのgithubやblogが参考になると思います。
https://mattn.kaoriya.net/software/vim/20191231213507.htm
lspは様々な言語支援を提供してくれるサーバーのことでpluginはそのクライアントみたいな感じでしょうか。わからん。言語ファイルを開いて、`:LspInstallServer`しましょう。`./servers`にダウンロードされます。
https://github.com/mattn/vim-lsp-settings
```sh:~/.vimrc
Plug 'prabirshrestha/async.vim'
Plug 'prabirshrestha/asyncomplete.vim'
Plug 'prabirshrestha/asyncomplete-lsp.vim'
Plug 'prabirshrestha/vim-lsp'
Plug 'mattn/vim-lsp-settings'
```