Closed23
NeoVimかっこいいかも
 tkry
tkry
 tkry
tkryvimコマンドの練習みたいなやつ。vimコマンド自体は知ってるので真新しさはなかったけど、neovimかっこいいかも...
 tkry
tkry// NOTE: ✦ Recommended Neovim Plugins
// Here are the plugins that I recommend for React and TypeScript development:
// Included in the Neovim Kickstart:
// - Telescope (find and open files, search across your directory)
// - nvim-autopairs (Automatically close characters like `(`, `{`, `[`, `'`, `<`, and more)
// - mini.ai (despite the name, not related to AI – this enables `dit`, `ciq`, and more)
// Other Recommended Plugins
// - neo-tree (Press `\` to toggle file system GUI, similar to VSCode)
//   - This is in the Kickstart, but you need to uncomment it
// - lazygit (easy GUI for git commands)
//   - macOS: brew install lazygit
// - lazygit.nvim (open lazygit directly from Neovim with <leader>lg)
//   - <leader> defaults to `space` with Quickstart
//   - https://github.com/kdheepak/lazygit.nvim
// - Avante (AI-driven code suggestions, similar to Cursor)
//   - https://github.com/yetone/avante.nvim
// - nvim-ts-autotag (automatically close HTML tags, even from JSX)
//   - https://github.com/windwp/nvim-ts-autotag
// - alpha-nvim (nice startup screen which shows recently used files)
//   - https://github.com/goolord/alpha-nvim
// - inc-rename (rename all instances of a variable in the file)
//   - With a keymap, this can be faster than :%s/
//   - https://github.com/smjonas/inc-rename.nvim
// - mini.comment (`gc` to comment selection, `gcc` to comment line)
//   - https://github.com/echasnovski/mini.nvim/blob/main/readmes/mini-comment.md
//   - Paired with https://github.com/JoosepAlviste/nvim-ts-context-commentstring/wiki/Integrations#minicomment
// - mini.move (select blocks of text and move them up/down with `j`/`k`)
//   - https://github.com/echasnovski/mini.nvim/blob/main/readmes/mini-move.md 
 tkry
tkryここだけ入れておこうかな
- neo-tree
- lazygit
- lazygit.nvim
 tkry
tkry
lazygitの入れかた、動画見ないとわからんかった
init.luaの  { import = 'custom.plugins' },もコメントアウトを外さないといけない
 tkry
tkry
いい感じの設定を書いてくれているやつ。入門用に良いとのこと。
:e $MYVIMRCでinit.luaに飛べる
 tkry
tkry
 tkry
tkry解説の動画。とりあえず流し見して何となく使い方がわかってよかった。
 tkry
tkryinit.luaに1000行くらいでコメント+設定が書いてあって、それを上から眺めたら良さそう。
 tkry
tkryLSPの設定がしたい
-- ... etc. See:help lspconfig-all for a list of all the pre-configured LSPs
rustはrust_analyzer、haskellならhlsを入れれば良いっぽい
- rust
- haskell
 :Masonでチェックしたら入ってそう...?
:LspInfoで何のLSPが認識してるか確認できる
 tkry
tkryトラディショナルなタブで候補選択、CR(エンター)で確認に設定を変更
mapping = cmp.mapping.preset.insert {
          -- Select the [n]ext item
          -- ['<C-n>'] = cmp.mapping.select_next_item(),
          -- Select the [p]revious item
          -- ['<C-p>'] = cmp.mapping.select_prev_item(),
          -- Scroll the documentation window [b]ack / [f]orward
          ['<C-b>'] = cmp.mapping.scroll_docs(-4),
          ['<C-f>'] = cmp.mapping.scroll_docs(4),
          -- Accept ([y]es) the completion.
          --  This will auto-import if your LSP supports it.
          --  This will expand snippets if the LSP sent a snippet.
          -- ['<C-y>'] = cmp.mapping.confirm { select = true },
          -- If you prefer more traditional completion keymaps,
          -- you can uncomment the following lines
          ['<CR>'] = cmp.mapping.confirm { select = true },
          ['<Tab>'] = cmp.mapping.select_next_item(),
          ['<S-Tab>'] = cmp.mapping.select_prev_item(),
 tkry
tkry- keymapのjkでnormalモードに行きたい
コマンドは↓で色々見れるみたい
-- [[ Basic Keymaps ]]
--  See `:help vim.keymap.set()`
 tkry
tkry
IDEとしてはもうちょっと多機能なやつがありそうなんだけど、kickstart.vimあたりから始めて自分でプラグイン入れた方が後々良さそうな感じはある
 tkry
tkry基本的な使い方まとめ
- 設定を書きたいとき
- どこかでnvimして、:e $MYVIMRCでinit.luaを開くか、下記コマンドで本体を開く
- nvim ~/.config/nvim/init.lua
 
- どこかで
- git操作したい時
- nvimを開いてる状態で、:LazyGitコマンドでlazygitを開く
 
- nvimを開いてる状態で、
- パッケージのインストール状況を見たい時
- 
:Masonコマンドで見る
 
- 
- LSPの状態を見たい時
- 
:LspInfoで見る
- LSPを追加したければ、init.luaを編集
 
- 
- nvim-treeを表示したい時
- 
\コマンドでファイルツリー表示
 
- 
 tkry
tkry大体動くようになったのでよし。あとは気になったらカスタマイズすれば良さそう(多分しない)
 tkry
tkrytmuxないと流石に不便かも
 tkry
tkry
 tkry
tkry前提
~/.tmux.conf
# prefixキーをC-gに変更
unbind C-b
set -g prefix C-g
# PaneをVim-likeに移動する
bind -r k select-pane -U 
bind -r j select-pane -D 
bind -r h select-pane -L 
bind -r l select-pane -R
#マウス操作を有効にする
set -g mouse on
#コピーモード時のキーバインドをVimに
setw -g mode-keys vi
# checkhealth回避用
set -g escape-time 10
set -g focus-events on
# tmuxのコピーモードからクリップボードにコピー
bind-key -T copy-mode-vi v send-keys -X begin-selection
bind-key -T copy-mode-vi C-v send-keys -X rectangle-toggle
bind-key -T copy-mode-vi y send-keys -X copy-pipe-and-cancel "xsel -bi"
bind-key -T copy-mode-vi Enter send-keys -X copy-pipe-and-cancel "xsel -bi"
簡単な使い方
- 
tmuxで起動
- ウィンドウ起動と移動
- 
プレフィックスキー(ctr + g) + cで起動
- 
プレフィックスキー(ctr + g) + p or nで移動
 
- 
- ペインの分割
- 
プレフィックスキー + %で左右
- 
プレフィックスキー + "で上下
- 
プレフィックスキー + hjklで画面移動
 
- 
- 終了
- 
exitコマンド
 
- 
 tkry
tkryideコマンド作りたい
~/scripts/ide.sh
#!/bin/zsh
# ペインを上下に分割
tmux split-window -v -p 25
~/.zshrc
alias ide='~/scripts/ide.sh'
これでtmux中にideを実行すると画面をいい感じに分割してくれる
 tkry
tkry
 tkry
tkrytmuxでターミナルの文字列をコピペできないのつらいので設定をする
 tkry
tkry動いたっぽい
.tmux.conf
# prefixキーをC-gに変更
unbind C-b
set -g prefix C-g
# PaneをVim-likeに移動する
bind -r k select-pane -U 
bind -r j select-pane -D 
bind -r h select-pane -L 
bind -r l select-pane -R
#マウス操作を有効にする
set -g mouse on
#コピーモード時のキーバインドをVimに
setw -g mode-keys vi
# checkhealth回避用
set -g escape-time 10
set -g focus-events on
# マウススクロールをオンにすると、マウス選択コピーがクリップボードにコピーされなくなるため
set -s copy-command 'pbcopy' 
# 設定ファイル再読み込み r
bind r source-file ~/.tmux.conf \; display "Reloaded"
# ペインの開始番号を 0 から 1 に変更する
set-option -g base-index 1
このスクラップは2024/10/05にクローズされました