LoginSignup
0
0

More than 5 years have passed since last update.

個人で使っているvimrcを晒す

Last updated at Posted at 2018-12-10

なに?

vimrcを晒す

設定が面倒だったりするため
日本語説明がないのは悪しからず

vimrc

.vimrc
"" An example for a vimrc file.
""
"" Maintainer:  Bram Moolenaar <Bram@vim.org>
"" Last change: 2006 Aug 12
""
"" To use it, copy it to
""     for Unix and OS/2:  ~/.vimrc
""        for Amiga:  s:.vimrc
""  for MS-DOS and Win32:  $VIM\_vimrc
""      for OpenVMS:  sys$login:.vimrc

"set runtimepath+=~/Downloads/vim74-kaoriya-win64-20160409/vim74-kaoriya-win64

"" ##############
"" ### Plugin ###
"" ##############
"" Neobundle
"" ##############
"call neobundle#begin(expand('~/.vim/bundle))
"
"NeoBundleFetch 'Shougo/neobundle.vim'
"
""" ----- Add or Remove Bundle here
"NeoBundle 'Shougo/unite.vim'
"
"NeoBundle 'thinca/vim-quickrun'
"
"NeoBundle 'tyru/caw.vim.git'
"nmap <Leader>q <Plug>(caw:i:toggle)
"vmap <Leader>q <Plug>(caw:i:toggle)
"
"NeoBundle 't9md/vim-quickhl'
"nmap <F2> <Plug>(quickhl-manual-this)
"xmap <F2> <Plug>(quickhl-manual-this)
"nmap <F3> <Plug>(quickhl-manual-reset)
"xmap <F3> <Plug>(quickhl-manual-reset)
"
"NeoBundle 'scrooloose/syntastic'
"
""" -----
"
"
"call neobundle#end
"" Windows DIFF Command
"" http://nanasi.jp/articles/howto/diff/vimdiff_in_windows.html

"" When started as "evim", evim.vim will already have done these settings.
if v:progname =~? "evim"
    finish
endif

"" For Win32 GUI: remove 't' flag from 'guioptions': no tearoff menu entries "" let &guioptions = substitute(&guioptions, "t", "", "g")

"" Don't use Ex mode, use Q for formatting
"map Q gq

"" This is an alternative that also works in block mode, but the deleted
"" text is lost and it only works for putting the current register.
"vnoremap p "_dp

"" Switch syntax highlighting on, when the terminal has colors
"" Also switch on highlighting the last used search pattern.
if &t_Co > 2 || has("gui_running")
    syntax on
    set hlsearch
endif

"" Only do this part when compiled with support for autocommands.
if has("autocmd")

  "" Enable file type detection.
  "" Use the default filetype settings, so that mail gets 'tw' set to 72,
  "" 'cindent' is on in C files, etc.
  "" Also load indent files, to automatically do language-dependent indenting.
  filetype plugin indent on

  "" Put these in an autocmd group, so that we can delete them easily.
  augroup vimrcEx
    au!
    "" For all text files set 'textwidth' to 78 characters.
    "autocmd FileType text setlocal textwidth=78
    "" When editing a file, always jump to the last known cursor position.
    "" Don't do it when the position is invalid or when inside an event handler
    "" (happens when dropping a file on gvim).
    autocmd BufReadPost *
        \ if line("'\"") > 0 && line("'\"") <= line("$") |
        \   exe "normal g`\"" |
        \ endif
    augroup END

else

    set autoindent      "" always set autoindenting on
    "set cindent

endif "" has("autocmd")

"" ################
"" ### VIM MEMO ###
"" ################
"" --- REPLACE ---
"" 1,:args **/*.txt
"" 2,:args
"" 3,:argdo %s/hoge/fuga/g | update
"" 
"" --- SEARCH hukusuu ---
"" /A\|B
""
"" --- HOKAN ---
"" <C-p>
""
"" --- TAG JUMP ---
"" 1,  $ctags -R -> make <tags> file
"" 2,  Open VIM
"" 3,1 Go   -> <C-]>
"" 3,2 Back -> <C-t>
""
"" --- mapping ---
""       normal visual wait insert command
"" map     @      @     @                
"" map!                        @      @  
"" nmap    @                             
"" vmap           @                      
"" omap                 @                
"" imap                        @         
"" cmap                               @  

"" ###################
"" ### KEY MAPPING ###
"" ###################
"" --- Use BackSpace ---
noremap  \b ^H
"noremap! \b ^H

"" --- movement TAB ---
nnoremap <Tab>   gt
nnoremap <S-Tab> gT

"" --- Esc = <C-[> = <C-j> ---
inoremap <C-j>   <C-[>
vnoremap <C-j>   <C-[>

"" --- Increment Number ---
nnoremap +       <C-a>
nnoremap -       <C-x>

"" --- Go to HOME ---
noremap  <C-a>   ^
noremap! <C-a>   <HOME>

"" --- Back to END ---
noremap  <C-e>   $
noremap! <C-e>   <END>

"" --- Mapping BackSpace <C-h>,<C-l> ---
"inoremap <C-h>   <BS>
"inoremap <C-l>   <DEL>

"" --- Insert Brackets, and Move Cursol Lock ---
inoremap {}  {}<Left>
inoremap ()  ()<Left>
inoremap []  []<Left>
inoremap <>  <><Left>
inoremap ""  ""<Left>
inoremap ''  ''<Left>

"" --- Cancel HighLight ---
nnoremap <ESC><ESC> :nohlsearch<CR><ESC>

"nnoremap <C-d> yyp

" コマンドモードのショートカット
ca tn tabnew

"" ###############
"" ##### set #####
"" ###############
"" --- Auto language ---
"set encoding=euc-jp
set encoding=utf-8
set fileencodings=iso-2022-jp,euc-jp,sjis,utf-8
set fileformats=unix,dos,mac

colorscheme koehler
set guifont=Consolas:h11

"" --- MOZIBAKE for GUI Menu
"source $VIMRUNTIME/delmenu.vim
"set langmenu=ja_jp.utf-8
"source $VIMRUNTIME/menu.vim

"set mouse=a             "" In an xterm the mouse should work quite well, thus enable it.

set nocompatible        "" Use Vim settings, rather then Vi settings (much better!).
                        "" This must be first, because it changes other options as a side effect.

set backspace=indent,eol,start  "" allow backspacing over everything in insert mode

set nobackup            "" do not keep a backup file, use versions instead
"set backup              "" keep a backup file

set history=50          "" keep 50 lines of command line history
set ruler               "" show the cursor position all the time
set showcmd             "" display incomplete commands
set incsearch           "" incremental searching
set clipboard=unnamed   "" Share ClipBoard Linux and Windows
set nowrapscan          "" Don't Round in Scan
set nowrap              "" Don't Round in Text(orikaesi nashi)
"" :help modeline
""   ts :TabStop
""   sw :ShiftWidth
""   sts:SoftTabStop
set ts=4 sw=4 sts=4     "" Indent = 4 (space)
set tw=0

set number              "" Show Line Number
highlight LineNr term=underline ctermfg=3

set visualbell          "" Use visual bell instead of beeping when doing something wrong
set t_vb=               "" And reset the terminal code fot the visual bell. If visualbell is set,
                        "" and this line is also included, vim will nether flash nor beep.
                        "" If visualbell is unset, this dose nothing.

"set list                "" Explicit Tab & Space
set listchars=tab:->

set expandtab           "" Exchange Tab -> Space
set diffopt=vertical    "" Diff Option
set grepprg=internal    "" Vimgrep == grep
set cursorline          "" The cursor position is underline.
"set cursorcolumn        "" The cursor position is splitline.
set wildmenu            "" Better command-line completion
set pumheight=10        "" Pop Up Menu Height
set showmatch           "" When intert ')' , Jump set of '('
set matchtime=5         "" When intert ')' , Jump set of '('

set nostartofline       "" Stop certain movement from always going to the first character of a line.
                        "" While this behaivior from that of Vi, it dose what most users
                        "" coming from other editor would expect.
set laststatus=2        "" Always display the status line, even if only one window is diplayed
set scrolloff=4
set sidescrolloff=8

set iminsert=0          "" IME toggle OFF in Insert
set imsearch=-1         "" IME toggle OFF in Search (-1:imsearch=iminsert)

set noundofile

"" --- Diff highlight ---
hi DiffAdd    ctermfg=black ctermbg=2 guifg=black guibg=Green
hi DiffChange ctermfg=black ctermbg=3 guifg=black guibg=DarkYellow
hi DiffDelete ctermfg=black ctermbg=6 guifg=black guibg=Blue
hi DiffText   ctermfg=black ctermbg=7 guifg=black guibg=Magenta

"" Convenient command to see the difference between the current buffer and the
"" file it was loaded from, thus the changes you made.
"command DiffOrig vert new | set bt=nofile | r # | 0d_
"                        \ | diffthis | wincmd p | diffthis

"" --- Statuline Change Color in INSERT MODE ---
augroup InsertChangeColor
    autocmd!
    autocmd InsertEnter * highlight StatusLine ctermfg=3 guibg=darkyellow "| highlight CursorLine cterm=underline ctermfg=6
    autocmd InsertLeave * highlight StatusLine ctermfg=7 guibg=white      "| highlight CursorLine cterm=underline ctermfg=NONE
augroup END

"" --- VIM open and Current directory open ---
"augroup VimEnterCurent
"    autocmd!
"    autocmd BufWinEnter * vsplit . | vertical resize -80
"    autocmd BufWinEnter * tabnew . | tabmove 0
"augroup END

"" --- Highlight FullWidthSpace ---
augroup HighlightFullwidthSpace
    autocmd!
    autocmd BufReadPre * highlight FullwidthSpace guibg=green
    autocmd BufReadPost * match FullwidthSpace /邵イツ€/ 
augroup END

"" --- If the file is already open, open in ReadOnlyMode ---
augroup SwapChoice-ReadOnly
    autocmd!
    autocmd SwapExists * :let v:swapchoice='o'
augroup END

"" --- highlight *.sv Same *.v ---
autocmd BufNewFile,BufRead *.sv set filetype=verilog

"" --- highlight *.sv Same *.v ---
autocmd QuickFixCmdPost *grep* cwindow

"" --- hokan opt ---
"set completeopt=menuone
"for k in split("abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ_",'\zs')
"    exec "imap <expr>" . k . "pumvisible() ?" . k . ";" . k . "\<C-X>\<C-P>\<C-N>"
"endfor
"for k in split("abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ_",'\zs')
"    exec "imap <expr>" . k . ";" . k . "<C-N><C-P>"
"endfor
"imap <expr> <TAB> pumvisible() ? "\<Down>" ; "\<Tab>"

"set --remote-tab-silent
0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0