LoginSignup
1
1

More than 5 years have passed since last update.

なんとなく環境構築できてきたので.vimrcとVSCode周りのメモを残しておく

Posted at

親切心のかけらもないメモ

vim/.vimrc
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
"" Installing vim-plug
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
let vimplug_exists=expand('~/.vim/autoload/plug.vim')

if !filereadable(vimplug_exists)
  if !executable("curl")
    echoerr "You have to install curl or first install vim-plug yourself!"
    execute "q!"
  endif
  echo "Installing Vim-Plug..."
  echo ""
  silent !\curl -fLo ~/.vim/autoload/plug.vim --create-dirs https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim
  let g:not_finish_vimplug = "yes"

  autocmd VimEnter * PlugInstall
endif

""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
"" ColorScheme and Plugins Settings
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
syntax enable
set background=dark

call plug#begin('~/.vim/plugged')
    Plug 'https://github.com/altercation/vim-colors-solarized.git'
    Plug 'itchyny/lightline.vim'
    Plug 'tpope/vim-fugitive'
call plug#end()

colorscheme solarized
let g:lightline = {
    \ 'colorscheme': 'solarized',
    \ 'mode_map': {'c': 'NORMAL'},
    \ 'active': {
    \   'left': [ ['mode', 'paste'], ['fugitive', 'filename'] ]
    \ },
    \ 'component': {
    \   'lineinfo': ' %3l:%-2v',
    \ },
    \ 'component_function': {
    \      'modified': 'MyModified',
    \      'readonly': 'MyReadonly',
    \      'fugitive': 'MyFugitive',
    \      'filename': 'MyFilename',
    \      'fileformat': 'MyFileformat',
    \      'filetype': 'MyFiletype',
    \      'fileencoding': 'MyFileencoding',
    \      'mode': 'MyMode',
    \    }
    \ }

function! MyModified()
  return &ft =~ 'help\|vimfiler\|gundo' ? '' : &modified ? '+' : &modifiable ? '' : '-'
endfunction

function! MyReadonly()
  return &ft !~? 'help\|vimfiler\|gundo' && &readonly ? ' ' : ''
endfunction

function! MyFilename()
  return ('' != MyReadonly() ? MyReadonly() . ' ' : '') .
        \ (&ft == 'vimfiler' ? vimfiler#get_status_string() :
        \  &ft == 'unite' ? unite#get_status_string() :
        \  &ft == 'vimshell' ? vimshell#get_status_string() :
        \ '' != expand('%:t') ? expand('%:t') : '[No Name]') .
        \ ('' != MyModified() ? ' ' . MyModified() : '')
endfunction

function! MyFugitive()
  try
    if &ft !~? 'vimfiler\|gundo' && exists('*fugitive#head') && strlen(fugitive#head())
      return ' ' . fugitive#head()
    endif
  catch
  endtry
  return ''
endfunction

function! MyFileformat()
  return winwidth(0) > 70 ? &fileformat : ''
endfunction

function! MyFiletype()
  return winwidth(0) > 70 ? (strlen(&filetype) ? &filetype : 'no ft') : ''
endfunction

function! MyFileencoding()
  return winwidth(0) > 70 ? (strlen(&fenc) ? &fenc : &enc) : ''
endfunction

function! MyMode()
  return winwidth(0) > 60 ? lightline#mode() : ''
endfunction

""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
"" Base config
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
set nocompatible
set fileformats=unix,dos,mac
set fenc=utf-8
set nobomb
set nobackup
set noswapfile
set autoread
set hidden
set showcmd
set showmode
set backspace=indent,eol,start
set history=10000
set clipboard=unnamed,autoselect
set whichwrap=b,s,h,l,<,>,[,],~
set mouse=a
set ruler
set list
set listchars=tab:»-,trail:-,eol:,extends:»,precedes:«,nbsp:%
set wrap
set number
set laststatus=2
set title
set cursorline
set cursorcolumn
set virtualedit=onemore
set virtualedit=block
set smartindent
set visualbell
set showmatch
set matchtime=1
set wildmode=list:longest
set pumheight=10
nnoremap j gj
nnoremap k gk

""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
"" Tab config
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
set expandtab
set tabstop=4
set softtabstop=4
set shiftwidth=4

""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
"" Search, highlight settings
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
set ignorecase
set smartcase
set incsearch
set hlsearch
set wrapscan
nmap <Esc><Esc> :nohlsearch<CR><Esc>
nnoremap n nzz
nnoremap N Nzz

""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
"" Kill allow keys to force using hjkl motion
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
noremap <Up> <Nop>
noremap <Down> <Nop>
noremap <Left> <Nop>
noremap <Right> <Nop>

vimrcはこのような感じ。
solarized darkでlightlineつかえてgitが使えればいいよね程度の設定

VSCodeはこう!

json/setting.json

{
    "workbench.colorTheme": "Solarized Dark",
    "workbench.startupEditor": "newUntitledFile",
    "files.autoSave": "onFocusChange",
    "editor.fontFamily": "'Migu 1M for Powerline','San Francisco Mono', Menlo, Monaco, 'Courier New', monospace",
    "editor.fontSize": 14,
    "editor.renderWhitespace": "all",
    "editor.cursorStyle": "block",
    "editor.multiCursorModifier": "ctrlCmd",
    "editor.insertSpaces": true,
    "files.exclude": {
        "**/.git": true,
        "**/.svn": true,
        "**/.hg": true,
        "**/CVS": true,
        "**/.DS_Store": true
    },
    "editor.fontWeight": "normal",
    "editor.lineNumbers": "on",
    "editor.smoothScrolling": false,
    "editor.minimap.enabled": false,
    "editor.renderControlCharacters": true,
    "workbench.fontAliasing": "default",
    "window.restoreWindows": "all",
    "window.restoreFullscreen": true,
    "window.newWindowDimensions": "fullscreen",
    "vim.disableAnnoyingNeovimMessage": true, 
    "terminal.integrated.shell.osx": "/usr/local/bin/zsh",
    "terminal.integrated.fontSize": 14,
    "editor.rulers": [
        80
    ],
    "dateTime.customFormat": "DD MMM YYYY HH:MM"
}

導入プラグインは今の所
Date&Time
ESLint
TSLint
GitHistory
Vim
のみ。
Vimバインドで使えるようにして、
全画面作業をするので時計を表示させただけのイメージ

言語系プラグインとかは使う時々に入れていけばいいかなという感じで初期状態として今できてるのはこんなもん。
vimrcとかは特に書き換えて初期状態忘れるのでメモがわりに残しておく。

このところ仕事でvimrcが3行とか4行しかないvimで作業したりコード書いたりしてたのでリッチなvimとか、VSCodeとかは贅沢な感じがする。

1
1
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
1
1