text neovimの设定

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了text neovimの设定相关的知识,希望对你有一定的参考价值。

" ==============================
"        Leader key
" ==============================

  let mapleader = "\<Space>"

" ==============================
"           vim plug
" ==============================

call plug#begin('~/.local/share/nvim/plugged')

" ==============================
"        NERDTreeの設定
" ==============================
  Plug 'scrooloose/nerdtree',         { 'on': 'NERDTreeToggle' }
  Plug 'jistr/vim-nerdtree-tabs',     { 'on': 'NERDTreeToggle' }
  Plug 'Xuyuanp/nerdtree-git-plugin', { 'on': 'NERDTreeToggle' }

  " 隠しファイルを表示する
  let NERDTreeShowHidden = 1
  let g:NERDTreeChDirMode=2
  let g:NERDTreeIgnore=['\.rbc$', '\~$', '\.pyc$', '\.db$', '\.sqlite$', '__pycache__']
  let g:NERDTreeSortOrder=['^__\.py$', '\/$', '*', '\.swp$', '\.bak$', '\~$']
  let g:NERDTreeShowBookmarks=1
  let g:nerdtree_tabs_focus_on_files=1
  let g:NERDTreeMapOpenInTabSilent = '<RightMouse>'
  let g:NERDTreeWinSize = 50

  set wildignore+=*/tmp/*,*.so,*.swp,*.zip,*.pyc,*.db,*.sqlite

  " デフォルトでツリーを表示させる
  let g:nerdtree_tabs_open_on_console_startup=1

  nnoremap <silent><C-e> :NERDTreeToggle<CR>
  nnoremap <silent><C-w> :NERDTreeFocusToggle<CR>

  " 他のバッファをすべて閉じた時にNERDTreeが開いていたらNERDTreeも一緒に閉じる。
  autocmd bufenter * if (winnr("$") == 1 && exists("b:NERDTree") && b:NERDTree.isTabTree()) | q | endif

" ==============================
"        air line
" ==============================

  Plug 'vim-airline/vim-airline'
  Plug 'vim-airline/vim-airline-themes'

" ==============================
"        Git operation
" ==============================
  " Gitの更新情報を表示させる
  Plug 'airblade/vim-gitgutter'

" ==============================
"        file operation
" ==============================

  Plug 'ryanoasis/vim-devicons'
  " (Optional) Multi-entry selection UI.
  Plug 'junegunn/fzf', { 'dir': '~/.fzf', 'do': './install --all' }
  Plug '/usr/local/opt/fzf'
  nnoremap <C-p> :<C-u>FZF<CR>
  " Plug 'ctrlpvim/ctrlp.vim'

  " キャッシュディレクトリ
  " let g:ctrlp_cache_dir = $HOME.'/.cache/ctrlp'
  " キャッシュを終了時に削除しない
  " let g:ctrlp_clear_cache_on_exit = 0
  " 遅延再描画
  " let g:ctrlp_lazy_update = 1

  " Plug 'nixprime/cpsm'
  " let g:ctrlp_match_func = {'match': 'cpsm#CtrlPMatch'}

  let g:python3_host_prog = $PYENV_ROOT . '/shims/python3'

" ==============================
"     indent & white_space
" ==============================
  Plug 'bronson/vim-trailing-whitespace'
  Plug 'Yggdroot/indentLine'
  Plug 'cohama/lexima.vim'
  Plug 'junegunn/vim-easy-align'

  " ファイル保存時に不要なspaceを削除する
  autocmd BufWritePre * :FixWhitespace

  " Start interactive EasyAlign in visual mode (e.g. vipga)
  xmap ga <Plug>(EasyAlign)

  " Start interactive EasyAlign for a motion/text object (e.g. gaip)
  nmap ga <Plug>(EasyAlign)

" ==============================
"     window resize
" ==============================

  Plug 'simeji/winresizer'

  " If you want to start window resize mode by `Ctrl+B`
  let g:winresizer_start_key = '<C-B>'

" ==============================
"        tag jump
" ==============================
  Plug 'majutsushi/tagbar'
  Plug 'szw/vim-tags'
  Plug 'vim-scripts/gtags.vim'

  nmap <silent> <F4> :TagbarToggle<CR>
  let g:tagbar_autofocus = 1

  " code complete
  Plug 'tpope/vim-endwise'
  Plug 'Townk/vim-autoclose'
  Plug 'sheerun/vim-polyglot'

" ==============================
"        deoplete
" ==============================
"
  if has('nvim')
    Plug 'Shougo/deoplete.nvim', { 'do': ':UpdateRemotePlugins' }
    Plug 'zchee/deoplete-go',        { 'do': 'make'                 }
    Plug 'fishbullet/deoplete-ruby', { 'do': 'make'                 }
  else
    Plug 'Shougo/deoplete.nvim'
    Plug 'roxma/nvim-yarp'
    Plug 'roxma/vim-hug-neovim-rpc'
  endif
  let g:deoplete#enable_at_startup = 1

" ==============================
"        html css
" ==============================

  Plug 'hail2u/vim-css3-syntax',    { 'for' : 'css' }
  Plug 'gorodinskiy/vim-coloresque'
  Plug 'tpope/vim-haml'
  Plug 'mattn/emmet-vim'
  Plug 'lilydjwg/colorizer'
  Plug 'othree/html5.vim'

  let g:html5_event_handler_attributes_complete = 1
  let g:html5_rdfa_attributes_complete = 1
  let g:html5_microdata_attributes_complete = 1
  let g:html5_aria_attributes_complete = 1

  let g:user_emmet_settings = { 'lang' : 'ja' }

" ==============================
"        javascript
" ==============================

  Plug 'jelera/vim-javascript-syntax', { 'for' : 'js' }

" ==============================
"        ruby rails
" ==============================

  Plug 'tpope/vim-rails',             { 'for' : 'ruby' }
  Plug 'tpope/vim-rake',              { 'for' : 'ruby' }
  Plug 'tpope/vim-projectionist'
  Plug 'thoughtbot/vim-rspec',        { 'for' : 'ruby' }
  Plug 'ecomba/vim-ruby-refactoring', { 'for' : 'ruby' }
  Plug 'vim-ruby/vim-ruby',           { 'for' : 'ruby' }

  Plug 'radenling/vim-dispatch-neovim'
  Plug 'tpope/vim-dispatch'
  let g:rspec_command = "Dispatch bin/rspec {spec}"
  let g:rspec_runner = "os_x_iterm2"

  let g:rubycomplete_buffer_loading = 1
  let g:rubycomplete_classes_in_global = 1
  let g:rubycomplete_rails = 1

  augroup vimrc-ruby
    autocmd!
    autocmd BufNewFile,BufRead *.rb,*.rbw,*.gemspec setlocal filetype=ruby
    autocmd FileType ruby set tabstop=2|set shiftwidth=2|set expandtab softtabstop=2
  augroup END

  let g:tagbar_type_ruby = {
      \ 'kinds' : [
          \ 'm:modules',
          \ 'c:classes',
          \ 'd:describes',
          \ 'C:contexts',
          \ 'f:methods',
          \ 'F:singleton methods'
      \ ]
  \ }

" RSpec.vim mappings
  map <Leader>t :call RunCurrentSpecFile()<CR>
  map <Leader>s :call RunNearestSpec()<CR>
  map <Leader>l :call RunLastSpec()<CR>
  map <Leader>a :call RunAllSpecs()<CR>

" Ruby refactory
  nnoremap <leader>rap  :RAddParameter<cr>
  nnoremap <leader>rcpc :RConvertPostConditional<cr>
  nnoremap <leader>rel  :RExtractLet<cr>
  vnoremap <leader>rec  :RExtractConstant<cr>
  vnoremap <leader>relv :RExtractLocalVariable<cr>
  nnoremap <leader>rit  :RInlineTemp<cr>
  vnoremap <leader>rrlv :RRenameLocalVariable<cr>
  vnoremap <leader>rriv :RRenameInstanceVariable<cr>
  vnoremap <leader>rem  :RExtractMethod<cr>

" ==============================
"         sql
" ==============================
  Plug 'vim-scripts/dbext.vim', { 'for': 'sql' }
  Plug 'mattn/vim-sqlfmt',      { 'for': 'sql' }

  let g:dbext_default_profile_psql = 'type=PGSQL:host=localhost:port=5432:dbname=squat:user=kage'
  let g:dbext_default_profile = 'psql'
  " let dbext_default_buffer_lines=30
  Plug 'vim-scripts/PDV--phpDocumentor-for-Vim', { 'for': 'php' }

" ==============================
"         go
" ==============================
  Plug 'fatih/vim-go', { 'for' : 'go' }

  map <C-n> :cnext<CR>
  map <C-m> :cprevious<CR>
  nnoremap <leader>cc :cclose<CR>

" ==============================
"    langage-server-protocol
" ==============================

  Plug 'prabirshrestha/async.vim'
  Plug 'prabirshrestha/vim-lsp'
  Plug 'prabirshrestha/asyncomplete.vim'
  Plug 'prabirshrestha/asyncomplete-lsp.vim'

  Plug 'autozimu/LanguageClient-neovim', {
    \ 'branch': 'next',
    \ 'do': 'bash install.sh',
    \ }

  Plug 'roxma/LanguageServer-php-neovim',  {'do': 'composer install && composer run-script parse-stubs'}

" ==============================
"    editor config
" ==============================
  Plug 'editorconfig/editorconfig-vim'


" references
  Plug 'thinca/vim-ref'
  Plug 'yuku-t/vim-ref-ri'

  let g:ref_refe_cmd = $HOME.'/.rbenv/shims/refe'

" comment out
  Plug 'tyru/caw.vim'

  Plug 'rhysd/accelerated-jk'

  nmap j <Plug>(accelerated_jk_gj)
  nmap k <Plug>(accelerated_jk_gk)

" denite
  Plug 'Shougo/denite.nvim'
  Plug 'Shougo/junkfile.vim'
  let g:junkfile#directory = expand($HOME.'/dev/src/github.com/straysheep3/junkfile')

" solarized
  Plug 'lifepillar/vim-solarized8'

" tmux-navigator
  Plug 'christoomey/vim-tmux-navigator'

" tmux用
  Plug 'edkolev/tmuxline.vim'

  let g:airline#extensions#tmuxline#enabled = 0

" rubocopの実行
  "Plug 'scrooloose/syntastic'

  " 利用するには、gem install rcodetoolsが必要
  Plug 't9md/vim-ruby-xmpfilter'

  Plug 'vim-scripts/AnsiEsc.vim'
  Plug 'tpope/vim-surround'

  Plug 'thinca/vim-quickrun'

  Plug 'vim-jp/vimdoc-ja'

  Plug 'jceb/vim-orgmode'
  Plug 'tpope/vim-speeddating'

  Plug 'rizzatti/dash.vim'

call plug#end()

" ==============================
"        basic settings
" ==============================
  set imdisable
  set encoding=utf-8
  set fileencoding=utf-8
  set fileencodings=utf-8
  set ttimeout
  set ttimeoutlen=50
  set fileformats=unix,dos,mac
  set bomb
  set binary
  set clipboard+=unnamed
  set termguicolors
  set number
  set tabstop=2
	set shiftwidth=2
	set softtabstop=2
  set expandtab
	set ruler
  set nowrap
  set nobackup
  set noswapfile
  set autoread
  set hidden
  set showcmd
  set showmatch

  set guifont=DroidSansMonoPLNerd:h12

  set autowrite

  syntax on

" ==============================
"           key bind
" ==============================

  inoremap <silent> jk <ESC>
  nnoremap <silent> <C-u><C-g> :<C-u>Denite grep<CR>

  nnoremap <silent>bp :bprevious<CR>
  nnoremap <silent>bn :bnext<CR>
  nnoremap <silent>bb :b#<CR>


" ==============================
" Window/Tab/Split Manipulation
" ==============================
" Move between split windows by using the four directions H, L, K, J
" NOTE: This has moved to vim/settings/vim-tmux-navigator.vim.
"  nnoremap <silent> <C-h> <C-w>h
"  nnoremap <silent> <C-l> <C-w>l
"  nnoremap <silent> <C-k> <C-w>k
"  nnoremap <silent> <C-j> <C-w>j

" Don't allow any default key-mappings.
  let g:tmux_navigator_no_mappings = 1

" Re-enable tmux_navigator.vim default bindings, minus <c-\>.
" <c-\> conflicts with NERDTree "current file".
  nnoremap <silent> <BS> :TmuxNavigateLeft<cr>
  nnoremap <silent> <c-h> :TmuxNavigateLeft<cr>
  nnoremap <silent> <c-j> :TmuxNavigateDown<cr>
  nnoremap <silent> <c-k> :TmuxNavigateUp<cr>
  nnoremap <silent> <c-l> :TmuxNavigateRight<cr>

" Make gf (go to file) create the file, if not existent
  nnoremap <C-w>f :sp +e<cfile><CR>
  nnoremap <C-w>gf :tabe<cfile><CR>

" Zoom in
  map <silent> ,gz <C-w>o

" Create window splits easier. The default
" way is Ctrl-w,v and Ctrl-w,s. I remap
" this to vv and ss
  nnoremap <silent> vv <C-w>v
  nnoremap <silent> ss <C-w>s

" create <%= foo %> erb tags using Ctrl-k in edit mode
  imap <silent> <C-K> <%=  %><Esc>3hi

" create <%= foo %> erb tags using Ctrl-j in edit mode
  imap <silent> <C-J> <%  %><Esc>2hi

" solarized
  colorscheme solarized8_dark
  " colorscheme solarized8_light

" ==============================
"        syntasticの設定
" ==============================
  let g:syntastic_mode_map = { 'mode': 'passive', 'active_filetypes': ['ruby'] }
  let g:syntastic_ruby_checkers = ['rubocop']

  let g:syntastic_always_populate_loc_list=1
  let g:syntastic_error_symbol='✗'
  let g:syntastic_warning_symbol='⚠'
  let g:syntastic_style_error_symbol = '✗'
  let g:syntastic_style_warning_symbol = '⚠'
  let g:syntastic_auto_loc_list=1
  let g:syntastic_aggregate_errors = 1

" ==============================
"        air-lineの設定
" ==============================
  set ambiwidth=double
  let g:airline_theme = 'jellybeans'
  " let g:airline_theme = 'solarized'
  " let g:airline_solarized_bg='dark'
  " let g:airline_solarized_bg='light'
  let g:airline#extensions#syntastic#enabled = 1
  let g:airline#extensions#branch#enabled = 1
  let g:airline#extensions#tabline#enabled = 1
  let g:airline#extensions#tagbar#enabled = 1
  let g:airline_skip_empty_sections = 1
  let g:airline_powerline_fonts = 1

  set laststatus=2

  if !exists('g:airline_symbols')
    let g:airline_symbols = {}
  endif

  let g:airline#extensions#tabline#left_sep = '⮀'
  let g:airline#extensions#tabline#left_alt_sep = '⮀'
  let g:airline_left_sep          = '⮀'
  let g:airline#extensions#tabline#left_alt_sep = '|'
  let g:airline_left_sep          = '⮀'
  let g:airline_left_alt_sep      = '»'
  let g:airline_right_sep         = '⮂'
  let g:airline_right_alt_sep     = '«'
  let g:airline#extensions#branch#prefix     = '⤴' "➔, ➥, ⎇
  let g:airline#extensions#readonly#symbol   = '⊘'
  let g:airline#extensions#linecolumn#prefix = '¶'
  let g:airline#extensions#paste#symbol      = 'ρ'
  let g:airline_symbols.linenr    = '␊'
  let g:airline_symbols.branch    = '⎇'
  let g:airline_symbols.paste     = 'ρ'
  let g:airline_symbols.paste     = 'Þ'
  let g:airline_symbols.paste     = '∥'
  let g:airline_symbols.whitespace = 'Ξ'

  let g:WebDevIconsUnicodeDecorateFolderNodes = 1

  let g:polyglot_disabled = ['graphql']

" Required for operations modifying multiple buffers like rename.
set hidden

let g:LanguageClient_serverCommands = {
    \ 'javascript': ['javascript-typescript-stdio'],
    \ 'javascript.jsx': ['javascript-typescript-stdio'],
    \ 'ruby': ['language_server-ruby'],
    \ 'yaml': ['yaml-language-server'],
    \ 'docker': ['dockerfile-language-server'],
    \ 'php': ['php-language-server']
    \ }

以上是关于text neovimの设定的主要内容,如果未能解决你的问题,请参考以下文章

text 屏幕の设定

text preztoの设定

text zsh中の设定

text バイナリログの设定を确认する

text ダイアログをサービスや通知から出すための透明アクティビティ设定

text Neovim初始化文件