Skip to content

Instantly share code, notes, and snippets.

@get-me-power
Last active August 5, 2019 05:59
Show Gist options
  • Save get-me-power/165fe924a9182cc0daf9353cac9296aa to your computer and use it in GitHub Desktop.
Save get-me-power/165fe924a9182cc0daf9353cac9296aa to your computer and use it in GitHub Desktop.
" 原始的なplugin install
set runtimepath+=~/myplugin/vimdoc-ja
set helplang=ja,en
" ---------------------------
" 最低限の.vimrc
set encoding=utf-8
scriptencoding utf-8
syntax enable
filetype plugin indent on
" ---------------------------
" バックスペースの問題を解消
set backspace=indent,eol,start
" ---------------------------
"エンターキーで確定する前から,文字が入力されるたびに検索を行う"
set incsearch
"検索ハイライトの設定"
nnoremap <ESC><ESC> :nohlsearch<CR>
" ---------------------------
" キーバインド当ての例
noremap <Up> <Nop>
noremap <Down> <Nop>
noremap <Left> <Nop>
noremap <Right> <Nop>
noremap! <Up> <Nop>
noremap! <Down> <Nop>
noremap! <Left> <Nop>
noremap! <Right> <Nop>
" --------------------------
" 関数を定義
function Indent()
let save_cursor = getcurpos()
execute "normal " . "gg=G"
call setpos('.', save_cursor)
endfunction
command -nargs=0 Indent call Indent()
" ---------------------------
" 高度なキーバインド当て
inoremap <expr><Tab> pumvisible() ? "\<C-n>" : MyInsCompl()
function! MyInsCompl()
let c = nr2char(getchar())
if c == "l"
return "\<C-x>\<C-l>"
elseif c == "n"
return "\<C-x>\<C-n>"
elseif c == "p"
return "\<C-x>\<C-p>"
elseif c == "k"
return "\<C-x>\<C-k>"
elseif c == "t"
return "\<C-x>\<C-t>"
elseif c == "i"
return "\<C-x>\<C-i>"
elseif c == "]"
return "\<C-x>\<C-]>"
elseif c == "f"
return "\<C-x>\<C-f>"
elseif c == "d"
return "\<C-x>\<C-d>"
elseif c == "v"
return "\<C-x>\<C-v>"
elseif c == "u"
return "\<C-x>\<C-u>"
elseif c == "o"
return "\<C-x>\<C-o>"
elseif c == "s"
return "\<C-x>s"
endif
return "\<Tab>"
endfunction
" -----------------------
" 言語別にインデントを分ける
augroup fileTypeIndent
autocmd!
autocmd FileType py setlocal tabstop=4 softtabstop=4 shiftwidth=4
autocmd FileType rb setlocal tabstop=2 softtabstop=2 shiftwidth=2
autocmd FileType html setlocal tabstop=2 softtabstop=2 shiftwidth=2
autocmd FileType vim setlocal tabstop=2 softtabstop=2 shiftwidth=2
autocmd BufReadPre *.org packadd vim-orgmode
augroup END
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment