Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save ciffelia/15ba78696996766a383189f855525ca3 to your computer and use it in GitHub Desktop.
Save ciffelia/15ba78696996766a383189f855525ca3 to your computer and use it in GitHub Desktop.

Tools

pacman -S vim zsh zsh-completions exa bat file bind
  • vim
  • zsh, zsh-completions
  • exa: ls を見やすくしたやつ
  • bat: cat with syntax highlighting
  • file: ファイルの種類を判定するやつ
  • bind: nslookupdig が入ってる

zsh

Tools インストール後の流れ

.zshrc

別ファイルに記載

.zpreztorc

  • zstyle ':prezto:load' pmodule \ に続けてモジュールを指定する。
    • prompt 無効化
      • Starship を使うので
    • syntax-highlighting 追加
      • 入力中のコマンドに色を付けてくれるやつ
    • autosuggestions 追加
      • History から suggestion を薄く表示してくれるやつ
      • 必ず syntax-highlighting のあとに読み込ませる
  • Terminal の4つの設定をすべて uncomment しておく

vim

  • .vimrc が存在しない場合は defaults.vim が読み込まれる
  • Arch ではそれに加えて、.vimrc の有無に関わらず archlinux.vim も読み込まれるっぽい
  • それぞれの場所は :set runtimepath でわかる

.vimrc

別ファイルに記載

パッケージ

  • onedark.vim
    • git clone --depth 1 https://github.com/joshdick/onedark.vim.git ~/.vim/pack/colorschemes/opt/onedark.vim
  • vim-polyglot
    • git clone --depth 1 https://github.com/sheerun/vim-polyglot.git ~/.vim/pack/plugins/start/vim-polyglot
" 以下を `~/.vimrc` として保存
" 参考:
" https://qiita.com/morikooooo/items/9fd41bcd8d1ce9170301
" https://qiita.com/iwaseasahi/items/0b2da68269397906c14c
" vi との互換性を犠牲にして、Vimのいい感じのデフォルト値を使うらしい
if &compatible
set nocompatible
endif
" vim 8 package
packadd! onedark.vim
" 基本
" 文字コードをUTF-8に設定
set fenc=utf-8
" 全角文字が重なって表示されるのを防止
set ambiwidth=double
" バックアップファイルを作らない
set nobackup
" スワップファイルを作らない
set noswapfile
" コマンド履歴を200件保持
set history=200
" onedark.vim: https://github.com/joshdick/onedark.vim
"Use 24-bit (true-color) mode in Vim/Neovim when outside tmux.
"If you're using tmux version 2.2 or later, you can remove the outermost $TMUX check and use tmux's 24-bit color support
"(see < http://sunaku.github.io/tmux-24bit-color.html#usage > for more information.)
if (empty($TMUX))
if (has("nvim"))
"For Neovim 0.1.3 and 0.1.4 < https://github.com/neovim/neovim/pull/2198 >
let $NVIM_TUI_ENABLE_TRUE_COLOR=1
endif
"For Neovim > 0.1.5 and Vim > patch 7.4.1799 < https://github.com/vim/vim/commit/61be73bb0f965a895bfb064ea3e55476ac175162 >
"Based on Vim patch 7.4.1770 (`guicolors` option) < https://github.com/vim/vim/commit/8a633e3427b47286869aa4b96f2bfc1fe65b25cd >
" < https://github.com/neovim/neovim/wiki/Following-HEAD#20160511 >
if (has("termguicolors"))
set termguicolors
endif
endif
" 入力系
" 挿入モードでバックスペースで削除できるようにする
set backspace=indent,eol,start
" 行末の1文字先までカーソルを移動できるように
set virtualedit=onemore
" 折り返し時に表示行単位での移動できるようにする
nnoremap j gj
nnoremap k gk
" インデントはスマートインデント
set smartindent
" コマンドラインの補完
set wildmode=list:longest
" 見た目系
" 行番号を表示
set number
" 現在の行を強調表示
set cursorline
" 対応する括弧やブレースを表示(matchtime=1にすると表示時間が0.1秒になる。デフォルトは5で、0.5秒)
set showmatch matchtime=1
" 入力中のコマンドをステータスに表示する
set showcmd
" メッセージ表示欄を2行確保
set cmdheight=2
" ステータス行を常に表示
set laststatus=2
" 1行が長すぎるときでも省略せずに表示
set display=lastline
" ファイル名を端末のタイトルバーに表示
set title
" シンタックスハイライトの有効化
syntax enable
" カラースキームをonedarkにする
colorscheme onedark
" Tab系
" 入力モードでTabキー押下時に半角スペースを挿入
set expandtab
" 行頭以外のTab文字の表示幅(スペースいくつ分)
set tabstop=2
" 行頭でのTab文字の表示幅
set shiftwidth=2
" 検索系
" 検索文字列が小文字の場合は大文字小文字を区別なく検索する
set ignorecase
" 検索文字列に大文字が含まれている場合は区別して検索する
set smartcase
" インクリメンタル検索 (検索ワードの最初の文字を入力した時点で検索が開始)
set incsearch
" 検索がファイル末尾まで進んだら、ファイル先頭から再び検索
set wrapscan
" 検索語をハイライト表示
set hlsearch
" ESC連打でハイライト解除
nmap <Esc><Esc> :nohlsearch<CR><Esc>
# 以下を `~/.zshrc` (`~/.zprezto/runcoms/zshrc` への symlink) に追記
export EDITOR=vim
alias vi='vim'
alias view='vim -R'
bindkey "^[[1~" beginning-of-line
bindkey "^[[4~" end-of-line
alias reload='exec $SHELL --login'
alias ls='exa --group-directories-first'
alias la='exa -a --group-directories-first'
alias ll='exa -la --header --group --time-style=iso --group-directories-first'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment