海老レンジャイ

闇のVimパワー

最終更新:

匿名ユーザー

- view
だれでも歓迎! 編集
sudo apt-get remove --purge vim vim-runtime vim-common
sudo apt-get install checkinstall
sudo rm -rf /usr/local/share/vim /usr/bin/vim

cd ~
git clone https://github.com/vim/vim
cd vim
git pull && git fetch

which python3

# raspberry pi
./configure \
--enable-multibyte \
--enable-python3interp \
--with-python3-config-dir=/usr/lib/python3.4/config-3.4m-arm-linux-gnueabihf \
--with-features=huge \
--enable-fail-if-missing

# ubuntu
sudo apt install python3-pip
sudo apt-get install libncurses5-dev
sudo apt-get install python3-dev

./configure \
--enable-multibyte \
--enable-python3interp \
--with-python3-config-dir=/usr/lib/python3.6/config-3.6m-x86_64-linux-gnu \
--with-features=huge \
--enable-fail-if-missing


make
sudo make install

cd ~
vim
:echo has('python3')
:q
# 1

git clone https://github.com/Vane11ope/.files
cd .files
chmod -R 777 .
./link.sh


cd ~
mkdir .cache/dein
curl https://raw.githubusercontent.com/Shougo/dein.vim/master/bin/installer.sh > installer.sh 
sh ./installer.sh .cache/dein/

pip3 install neovim


vim
:!echo $VIMRUNTIME
:q
# /usr/local/share/vim/vim80
cd .cache/dein/repos/github.com/ajmwagar/vim-deus/colors
sudo cp deus.vim /usr/local/share/vim/vim80/colors/

cd ~
sudo apt-get install silversearcher-ag
sudo apt-get install exuberant-ctags


twitvim
:SetLoginTwitter
URL開いてPIN入手
タイムライン :FriendsTwitter
タイムライン更新 :RefreshTwitter


ctags
プロジェクトのルートディレクトリでctags -R
タグジャンプ ウィンドウ分割 縦 N ctrl+k
タグジャンプ ウィンドウ分割 横 N ctrl+h



NEADTreeToggle N - e
TagBarToggle N - f
ウィンドウ分割 縦 N :sp
ウィンドウ分割 横 N :vsp
ウィンドウ移動 右 N ctrl+w l
ウィンドウ移動 上 N ctrl+w k
ウィンドウ移動 下 N ctrl+w j
ウィンドウ移動 左 N ctrl+w h

neosnippet.vim スニペットが使える
neosnippet-snippets neosnippet.vimのスニペット
deoplete.nvim 補完してくれるらしい
neadtree ディレクトリツリーを表示
ag.vim 検索
twitvim twitter
vim-quickrun コード実行
tagbar タグバー
vim-fugitive git
syntastic ファイルの構文エラーをチェック
vim-deus 深夜のコーダーのためのより良い配色
vim-airline ステータスバーがかっこよくなるらしい
vim-airline-themes vim-airlineのテーマ
rainbow_parentheses カッコがカラフルになるらしい
jedi-vim pythonの入力補完

.vimrc 再読み込み
:source ~/.vimrc

neosnippet
.vimrcに追加
imap <C-k>     <Plug>(neosnippet_expand_or_jump)
"imap <C-k>     <C-P><C-N><Plug>(neosnippet_expand_or_jump)
if has('conceal')
  set conceallevel=2 concealcursor=i
endif
let g:neosnippet#snippets_directory='スニペットディレクトリ'

vimで適応したい拡張子のファイルを開いて
:NeoSnippetEdit

スニペットの書き方
snippet test
abbr test...
    testtesttest
選択してctrl+kで挿入される

VSCodeのスニペット変換
#! /usr/bin/env python3
import os
import sys
import json

def json_str(f):
    s = ''.join(f.readlines())
    b = 1
    while b:
        l = s.split('/*', 1)
        r = s.split('*/', 1)
        if len(l) > 1 and len(r) > 1:
            s = l[0] + r[1]
        else:
            b = 0
    return s
def body_str(l):
    r = ''
    for i in l:
        r += '    '
        if '$' in i:
            for j in range(1, 32+1):
                i = i.replace('$'+str(j), '${'+str(j)+'}')
        r += i + '\n'
    return r
def main(fullpath):
    cd = os.path.abspath(os.path.dirname(__file__)).replace('\\', '/')
    fullpath = fullpath.replace('\\', '/')
    fname = fullpath.split('/')[-1].split('.')[0]
    
    s = ''
    names = {}
    with open(fullpath, 'r') as f:
        js = json_str(f)
        j = json.loads(js)
        for k, v in j.items():
            name = ''
            if not v['prefix'] in names:
                names[v['prefix']] = 1
                name = v['prefix']
            else:
                names[v['prefix']] += 1
                name = v['prefix'] + str(names[v['prefix']])
            s += 'snippet ' + name.replace('(', '').replace(')', '') + '\n'
            b = body_str(v['body'])
            s += b
    with open(cd + '/' + fname + '.snip', 'w') as f:
        f.write(s)
    
if __name__ == '__main__':
    if len(sys.argv) > 1:
        main(sys.argv[1])
    else:
        main(input('VSCodeSnippetJsonFile = ')) 

タグ:

+ タグ編集
  • タグ:

このサイトはreCAPTCHAによって保護されており、Googleの プライバシーポリシー利用規約 が適用されます。

目安箱バナー