.png)
vim의 커스터마이즈에 대해 (git의 설치와 어떻게든)
2022-10-06 last update
13 minutes reading ubuntu16.04 Vim vimrc 우분투vim을 사용자 정의하십시오! !
여기에 도착한 사람은 .vimrc라든지 여러가지 보고 있는 사람이 많을지도 모르지만 거기도 정리해 써 본다
이번 전제 사항
여기 등 참조
vim을 설정하기위한 파일은 기본적으로 홈 디렉토리에 있습니다
인터넷에서 vim처럼 다양한 플러그인이 존재하며 대부분 github에 게시됩니다.
다량의 플러그인을 도입하고 있으면 업데이트 등의 관리가 어려워 어디에 그들을 두고 있어 무엇을 로드하고 있는지 모르게 되어 버린다
그것을 어떻게 든하기 위한 플러그인(dein,NeoBundle,Vundle 등)
여기에서 dein을 사용하십시오
버전 제어 시스템 (인터넷에서 관리하는 것)
github 계정 만들기
설정, vimrc 등을 저장하기 위해 작성
의 튜 b. 작은 m 가기
이러한 화면이므로 username, email, password를 입력하고 signup을 누릅니다.

이 화면이 나오면 계속하십시오.

skip this step에서 괜찮습니다.

이 화면이 나오면 계정 임시 등록이 완료되었습니다.
처음 입력한 이메일 주소로 이메일을 보내실 때 확인을 하여 본 등록을 완료해 주세요

그렇다면 다시이 화면으로 돌아올 것입니다.

이 화면이 나오면 리포지토리 이름에 ".vim"을 입력하십시오.
그리고 Initialize this repository with a README에 체크를 해 주세요
가능하면 create repository를 누르십시오.

이렇게되면 저장소의 완성입니다.

이 안의 녹색 버튼을 눌러 나오는 링크를 복사하십시오.

git 설치
플러그인 등을 설치하려면 git 계열 명령이 필요하므로 설치
$ sudo apt install git
git에서 사용하는 명령
#ディレクトリにレポジトリを作成
$ git init
#ファイルやディレクトリをインディックスに登録
#すべて登録する場合は -Aが必要
$ git add [filename]
#インディックスに追加されたファイルをコミットする
$ git commit
リモートレポジトリの追加
$ git remote add [shortname][repo]
リモートレポジトリにコミットしたものを書き込む
$ git push [shortname][branch]
リポジトリをコピーする
$ git clone [repo]
リポジトリの変更を取り込む
$ git pull
또 세세한 옵션등은 여기 를 참고로 하면 좋다
로컬에서 .vim을 생성합시다.
터미널에서
$ mkdir .vim
$ cd .vim
$ git init
$ git remote add origin [コピーしたリンク]
이제 .vim이 만든 리포지토리에 연결되었습니다.
플러그인 관리 도구 설치
이번에는 ~/.vim/configs/users/안에 설정을 넣어
~/.vim/configs/plugins/install/에 dein.toml을 넣습니다.
#設定ファイルを置くディレクトリを作成
$ mkdir configs
$ mkdir configs/users
$ mkdir configs/plugins
$ mkdir configs/plugins/install
$ cd configs/users
#plugins.vimを作成
$ vim plugin.vim
plugins.vim"プラグインが実際にインストールされるディレクトリ
let s:dein_dir = expand('~/.vim/dein')
" dein.vim 本体
let s:dein_repo_dir = s:dein_dir . '/repos/github.com/Shougo/dein.vim'
" dein.vim がなければ github から落としてくる
if &runtimepath !~# '/dein.vim'
if !isdirectory(s:dein_repo_dir)
execute '!git clone https://github.com/Shougo/dein.vim' s:dein_repo_dir
endif
execute 'set runtimepath^=' . s:dein_repo_dir
endif
" 設定開始
if dein#load_state(s:dein_dir)
call dein#begin(s:dein_dir)
" プラグインリストを収めた TOML ファイル
" ~/.vim/rc/dein.toml,deinlazy.tomlを用意する
let g:rc_dir = expand('~/.vim/configs/plugins/install')
let s:toml = g:rc_dir . '/dein.toml'
let s:lazy_toml = g:rc_dir . '/dein_lazy.toml'
" TOML を読み込み、キャッシュしておく
call dein#load_toml(s:toml, {'lazy': 0})
call dein#load_toml(s:lazy_toml, {'lazy': 1})
" 設定終了
call dein#end()
call dein#save_state()
endif
" もし、未インストールものものがあったらインストール
if dein#check_install()
call dein#install()
endif
filetype plugin indent on
이것을 쓰면 이번에는 도입 할 플러그인을 .vim/config/plugins/install/dein.toml에 씁니다.
또 스스로 넣고 싶은 플러그인이 있는 경우 이하와 같이 넣는다
[[plugins]]
repo = '入れたいプラグイン(githubのユーザ/プラグイン)'
dein.toml# git clone 後、実行すべきコマンドがある場合はこんな感じ
[[plugins]]
repo = 'Shougo/vimproc.vim'
hook_post_update = '''
if dein#util#_is_windows()
let cmd = 'tools\\update-dll-mingw'
elseif dein#util#_is_cygwin()
let cmd = 'make -f make_cygwin.mak'
elseif executable('gmake')
let cmd = 'gmake'
else
let cmd = 'make'
endif
let g:dein#plugin.build = cmd
'''
#NERDTree(ツリーファイラー)
[[plugins]]
repo = 'scrooloose/nerdtree'
#NERDTreeの追加設定用
[[plugins]]
repo = 'jistr/vim-nerdtree-tabs'
#色をつけるもの
[[plugins]]
repo = "tomasr/molokai"
#自動で括弧を閉じてくれる
[[plugins]]
repo = 'Townk/vim-autoclose'
#自動補完プラグイン系スニペット機能
[[plugins]]
repo = 'Shougo/neocomplete'
[[plugins]]
repo = 'Shougo/neosnippet-snippets'
#スニペット集
[[plugins]]
repo = 'Shougo/neosnippet-snippets'
#インデント表示
[[plugins]]
repo = 'Yggdroot/indentLine'
#html系結構便利系Emmet
[[plugins]]
repo = 'mattn/emmet-vim'
#ステータスバー強化
[[plugins]]
repo = 'vim-airline/vim-airline-themes'
[[plugins]]
repo = 'vim-airline/vim-airline'
on_source = ['vim-airline/vim-airline-themes']
[[plugins]]
repo = 'Shougo/unite.vim'
# unite.vim を読み込んだら一緒に読み込む
[[plugins]]
repo = 'Shougo/neomru.vim'
on_source = ['unite.vim']
[[plugins]]
repo = 'Shougo/vimfiler'
[[plugins]]
repo = 'bronson/vim-trailing-whitespace'
#Python用
[[plugins]]
repo = 'davidhalter/jedi-vim'
on_ft = 'python'
그러면 플러그인 도입까지 할 수 있지만 중요한 vim이 이것을 읽어주지 않기 때문에
이것을 읽어 들이도록(듯이) 하기 위해서 홈 디렉토리의 .vimrc를 작성해 이하와 같이 기입한다
~/.vimrcset encoding=utf-8
scriptencoding utf-8
set runtimepath+=~/.vim
runtime! configs/users/*.vim
runtime! configs/plugins/*.vim
이제 다시 vim을 시작하면 자동으로 플러그인을 넣어줍니다.
github에 저장
다음으로이 파일을 git에 커밋하고 github에 게시합니다.
$ git commit -m"vimのプラグインを追加"
$ git push origin master
이제 github의 내 저장소 .vim이 같은 내용이되었습니다.
또 다른 설정을 하고 싶다면 ~/.vim/configs/users/없이 .vim으로 써 두면 인식해 주기 때문에 복수 파일로 나누어 쓸 수도 있다
이러한 설정에 관해서는 Qiita에서 검색하면 나올 것입니다.
그건 그렇고, 내 .vim은 이렇게 보입니다.
미라의 .vim
다만 이 파일은 ~/dotfiles/.vim (와)과 배치하지 않으면 제대로 동작을 하지 않는다
dotfiles에 대해서는 다음에
플러그인 등을 설치하려면 git 계열 명령이 필요하므로 설치
$ sudo apt install git
git에서 사용하는 명령
#ディレクトリにレポジトリを作成
$ git init
#ファイルやディレクトリをインディックスに登録
#すべて登録する場合は -Aが必要
$ git add [filename]
#インディックスに追加されたファイルをコミットする
$ git commit
リモートレポジトリの追加
$ git remote add [shortname][repo]
リモートレポジトリにコミットしたものを書き込む
$ git push [shortname][branch]
リポジトリをコピーする
$ git clone [repo]
リポジトリの変更を取り込む
$ git pull
또 세세한 옵션등은 여기 를 참고로 하면 좋다
로컬에서 .vim을 생성합시다.
터미널에서
$ mkdir .vim
$ cd .vim
$ git init
$ git remote add origin [コピーしたリンク]
이제 .vim이 만든 리포지토리에 연결되었습니다.
플러그인 관리 도구 설치
이번에는 ~/.vim/configs/users/안에 설정을 넣어
~/.vim/configs/plugins/install/에 dein.toml을 넣습니다.
#設定ファイルを置くディレクトリを作成
$ mkdir configs
$ mkdir configs/users
$ mkdir configs/plugins
$ mkdir configs/plugins/install
$ cd configs/users
#plugins.vimを作成
$ vim plugin.vim
plugins.vim"プラグインが実際にインストールされるディレクトリ
let s:dein_dir = expand('~/.vim/dein')
" dein.vim 本体
let s:dein_repo_dir = s:dein_dir . '/repos/github.com/Shougo/dein.vim'
" dein.vim がなければ github から落としてくる
if &runtimepath !~# '/dein.vim'
if !isdirectory(s:dein_repo_dir)
execute '!git clone https://github.com/Shougo/dein.vim' s:dein_repo_dir
endif
execute 'set runtimepath^=' . s:dein_repo_dir
endif
" 設定開始
if dein#load_state(s:dein_dir)
call dein#begin(s:dein_dir)
" プラグインリストを収めた TOML ファイル
" ~/.vim/rc/dein.toml,deinlazy.tomlを用意する
let g:rc_dir = expand('~/.vim/configs/plugins/install')
let s:toml = g:rc_dir . '/dein.toml'
let s:lazy_toml = g:rc_dir . '/dein_lazy.toml'
" TOML を読み込み、キャッシュしておく
call dein#load_toml(s:toml, {'lazy': 0})
call dein#load_toml(s:lazy_toml, {'lazy': 1})
" 設定終了
call dein#end()
call dein#save_state()
endif
" もし、未インストールものものがあったらインストール
if dein#check_install()
call dein#install()
endif
filetype plugin indent on
이것을 쓰면 이번에는 도입 할 플러그인을 .vim/config/plugins/install/dein.toml에 씁니다.
또 스스로 넣고 싶은 플러그인이 있는 경우 이하와 같이 넣는다
[[plugins]]
repo = '入れたいプラグイン(githubのユーザ/プラグイン)'
dein.toml# git clone 後、実行すべきコマンドがある場合はこんな感じ
[[plugins]]
repo = 'Shougo/vimproc.vim'
hook_post_update = '''
if dein#util#_is_windows()
let cmd = 'tools\\update-dll-mingw'
elseif dein#util#_is_cygwin()
let cmd = 'make -f make_cygwin.mak'
elseif executable('gmake')
let cmd = 'gmake'
else
let cmd = 'make'
endif
let g:dein#plugin.build = cmd
'''
#NERDTree(ツリーファイラー)
[[plugins]]
repo = 'scrooloose/nerdtree'
#NERDTreeの追加設定用
[[plugins]]
repo = 'jistr/vim-nerdtree-tabs'
#色をつけるもの
[[plugins]]
repo = "tomasr/molokai"
#自動で括弧を閉じてくれる
[[plugins]]
repo = 'Townk/vim-autoclose'
#自動補完プラグイン系スニペット機能
[[plugins]]
repo = 'Shougo/neocomplete'
[[plugins]]
repo = 'Shougo/neosnippet-snippets'
#スニペット集
[[plugins]]
repo = 'Shougo/neosnippet-snippets'
#インデント表示
[[plugins]]
repo = 'Yggdroot/indentLine'
#html系結構便利系Emmet
[[plugins]]
repo = 'mattn/emmet-vim'
#ステータスバー強化
[[plugins]]
repo = 'vim-airline/vim-airline-themes'
[[plugins]]
repo = 'vim-airline/vim-airline'
on_source = ['vim-airline/vim-airline-themes']
[[plugins]]
repo = 'Shougo/unite.vim'
# unite.vim を読み込んだら一緒に読み込む
[[plugins]]
repo = 'Shougo/neomru.vim'
on_source = ['unite.vim']
[[plugins]]
repo = 'Shougo/vimfiler'
[[plugins]]
repo = 'bronson/vim-trailing-whitespace'
#Python用
[[plugins]]
repo = 'davidhalter/jedi-vim'
on_ft = 'python'
그러면 플러그인 도입까지 할 수 있지만 중요한 vim이 이것을 읽어주지 않기 때문에
이것을 읽어 들이도록(듯이) 하기 위해서 홈 디렉토리의 .vimrc를 작성해 이하와 같이 기입한다
~/.vimrcset encoding=utf-8
scriptencoding utf-8
set runtimepath+=~/.vim
runtime! configs/users/*.vim
runtime! configs/plugins/*.vim
이제 다시 vim을 시작하면 자동으로 플러그인을 넣어줍니다.
github에 저장
다음으로이 파일을 git에 커밋하고 github에 게시합니다.
$ git commit -m"vimのプラグインを追加"
$ git push origin master
이제 github의 내 저장소 .vim이 같은 내용이되었습니다.
또 다른 설정을 하고 싶다면 ~/.vim/configs/users/없이 .vim으로 써 두면 인식해 주기 때문에 복수 파일로 나누어 쓸 수도 있다
이러한 설정에 관해서는 Qiita에서 검색하면 나올 것입니다.
그건 그렇고, 내 .vim은 이렇게 보입니다.
미라의 .vim
다만 이 파일은 ~/dotfiles/.vim (와)과 배치하지 않으면 제대로 동작을 하지 않는다
dotfiles에 대해서는 다음에
$ mkdir .vim
$ cd .vim
$ git init
$ git remote add origin [コピーしたリンク]
#設定ファイルを置くディレクトリを作成
$ mkdir configs
$ mkdir configs/users
$ mkdir configs/plugins
$ mkdir configs/plugins/install
$ cd configs/users
#plugins.vimを作成
$ vim plugin.vim
"プラグインが実際にインストールされるディレクトリ
let s:dein_dir = expand('~/.vim/dein')
" dein.vim 本体
let s:dein_repo_dir = s:dein_dir . '/repos/github.com/Shougo/dein.vim'
" dein.vim がなければ github から落としてくる
if &runtimepath !~# '/dein.vim'
if !isdirectory(s:dein_repo_dir)
execute '!git clone https://github.com/Shougo/dein.vim' s:dein_repo_dir
endif
execute 'set runtimepath^=' . s:dein_repo_dir
endif
" 設定開始
if dein#load_state(s:dein_dir)
call dein#begin(s:dein_dir)
" プラグインリストを収めた TOML ファイル
" ~/.vim/rc/dein.toml,deinlazy.tomlを用意する
let g:rc_dir = expand('~/.vim/configs/plugins/install')
let s:toml = g:rc_dir . '/dein.toml'
let s:lazy_toml = g:rc_dir . '/dein_lazy.toml'
" TOML を読み込み、キャッシュしておく
call dein#load_toml(s:toml, {'lazy': 0})
call dein#load_toml(s:lazy_toml, {'lazy': 1})
" 設定終了
call dein#end()
call dein#save_state()
endif
" もし、未インストールものものがあったらインストール
if dein#check_install()
call dein#install()
endif
filetype plugin indent on
[[plugins]]
repo = '入れたいプラグイン(githubのユーザ/プラグイン)'
# git clone 後、実行すべきコマンドがある場合はこんな感じ
[[plugins]]
repo = 'Shougo/vimproc.vim'
hook_post_update = '''
if dein#util#_is_windows()
let cmd = 'tools\\update-dll-mingw'
elseif dein#util#_is_cygwin()
let cmd = 'make -f make_cygwin.mak'
elseif executable('gmake')
let cmd = 'gmake'
else
let cmd = 'make'
endif
let g:dein#plugin.build = cmd
'''
#NERDTree(ツリーファイラー)
[[plugins]]
repo = 'scrooloose/nerdtree'
#NERDTreeの追加設定用
[[plugins]]
repo = 'jistr/vim-nerdtree-tabs'
#色をつけるもの
[[plugins]]
repo = "tomasr/molokai"
#自動で括弧を閉じてくれる
[[plugins]]
repo = 'Townk/vim-autoclose'
#自動補完プラグイン系スニペット機能
[[plugins]]
repo = 'Shougo/neocomplete'
[[plugins]]
repo = 'Shougo/neosnippet-snippets'
#スニペット集
[[plugins]]
repo = 'Shougo/neosnippet-snippets'
#インデント表示
[[plugins]]
repo = 'Yggdroot/indentLine'
#html系結構便利系Emmet
[[plugins]]
repo = 'mattn/emmet-vim'
#ステータスバー強化
[[plugins]]
repo = 'vim-airline/vim-airline-themes'
[[plugins]]
repo = 'vim-airline/vim-airline'
on_source = ['vim-airline/vim-airline-themes']
[[plugins]]
repo = 'Shougo/unite.vim'
# unite.vim を読み込んだら一緒に読み込む
[[plugins]]
repo = 'Shougo/neomru.vim'
on_source = ['unite.vim']
[[plugins]]
repo = 'Shougo/vimfiler'
[[plugins]]
repo = 'bronson/vim-trailing-whitespace'
#Python用
[[plugins]]
repo = 'davidhalter/jedi-vim'
on_ft = 'python'
set encoding=utf-8
scriptencoding utf-8
set runtimepath+=~/.vim
runtime! configs/users/*.vim
runtime! configs/plugins/*.vim
다음으로이 파일을 git에 커밋하고 github에 게시합니다.
$ git commit -m"vimのプラグインを追加"
$ git push origin master
이제 github의 내 저장소 .vim이 같은 내용이되었습니다.
또 다른 설정을 하고 싶다면 ~/.vim/configs/users/없이 .vim으로 써 두면 인식해 주기 때문에 복수 파일로 나누어 쓸 수도 있다
이러한 설정에 관해서는 Qiita에서 검색하면 나올 것입니다.
그건 그렇고, 내 .vim은 이렇게 보입니다.
미라의 .vim
다만 이 파일은 ~/dotfiles/.vim (와)과 배치하지 않으면 제대로 동작을 하지 않는다
dotfiles에 대해서는 다음에