vim: replace vim with neovim
This commit is contained in:
parent
06f8655392
commit
3ad4f7d72b
4 changed files with 35 additions and 51 deletions
27
bootstrap
27
bootstrap
|
@ -20,14 +20,15 @@ ${XDG_CONFIG_HOME}/mintty
|
||||||
${XDG_CONFIG_HOME}/python
|
${XDG_CONFIG_HOME}/python
|
||||||
${XDG_CONFIG_HOME}/readline
|
${XDG_CONFIG_HOME}/readline
|
||||||
${XDG_CONFIG_HOME}/tmux
|
${XDG_CONFIG_HOME}/tmux
|
||||||
${XDG_CONFIG_HOME}/vim
|
${XDG_CONFIG_HOME}/nvim
|
||||||
${XDG_CONFIG_HOME}/vim/autoload
|
${XDG_CONFIG_HOME}/nvim/autoload
|
||||||
${XDG_DATA_HOME}/bash
|
${XDG_DATA_HOME}/bash
|
||||||
${XDG_DATA_HOME}/bash-completion/completions
|
${XDG_DATA_HOME}/bash-completion/completions
|
||||||
${XDG_DATA_HOME}/less
|
${XDG_DATA_HOME}/less
|
||||||
${XDG_DATA_HOME}/python
|
${XDG_DATA_HOME}/python
|
||||||
${XDG_DATA_HOME}/vim
|
${XDG_DATA_HOME}/nvim
|
||||||
${XDG_DATA_HOME}/vim/plugged
|
${XDG_DATA_HOME}/nvim/plugged
|
||||||
|
${XDG_DATA_HOME}/nvim/shada
|
||||||
EOF
|
EOF
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -40,11 +41,11 @@ files/gitconfig ${XDG_CONFIG_HOME}/git/config
|
||||||
files/gitignore ${XDG_CONFIG_HOME}/git/ignore
|
files/gitignore ${XDG_CONFIG_HOME}/git/ignore
|
||||||
files/inputrc ${XDG_CONFIG_HOME}/readline/inputrc
|
files/inputrc ${XDG_CONFIG_HOME}/readline/inputrc
|
||||||
files/minttyrc ${XDG_CONFIG_HOME}/mintty/config
|
files/minttyrc ${XDG_CONFIG_HOME}/mintty/config
|
||||||
files/plug.vim ${XDG_CONFIG_HOME}/vim/autoload/plug.vim
|
files/plug.vim ${XDG_CONFIG_HOME}/nvim/autoload/plug.vim
|
||||||
files/python-startup.py ${XDG_CONFIG_HOME}/python/startup.py
|
files/python-startup.py ${XDG_CONFIG_HOME}/python/startup.py
|
||||||
files/tmux-colors.conf ${XDG_CONFIG_HOME}/tmux/tmux-colors.conf
|
files/tmux-colors.conf ${XDG_CONFIG_HOME}/tmux/tmux-colors.conf
|
||||||
files/tmux.conf ${XDG_CONFIG_HOME}/tmux/tmux.conf
|
files/tmux.conf ${XDG_CONFIG_HOME}/tmux/tmux.conf
|
||||||
files/vimrc ${XDG_CONFIG_HOME}/vim/vimrc
|
files/init.vim ${XDG_CONFIG_HOME}/nvim/init.vim
|
||||||
EOF
|
EOF
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -172,13 +173,13 @@ task_make_logins_silent() {
|
||||||
file_touch "$HOME/.hushlogin"
|
file_touch "$HOME/.hushlogin"
|
||||||
}
|
}
|
||||||
|
|
||||||
task_install_vim_plugins() {
|
task_install_nvim_plugins() {
|
||||||
heading "Install vim plugins"
|
heading "Install neovim plugins"
|
||||||
if command -v vim >/dev/null 2>&1; then
|
if command -v nvim >/dev/null 2>&1; then
|
||||||
warn "Installing vim plugins"
|
warn "Installing neovim plugins"
|
||||||
$DRY_RUN || vim -nes -u "$XDG_CONFIG_HOME/vim/vimrc" -c 'PlugInstall | qall!'
|
$DRY_RUN || nvim -nes -u "$XDG_CONFIG_HOME/nvim/init.vim" -c 'PlugInstall | qall!'
|
||||||
else
|
else
|
||||||
error "vim is not installed; skipping plugin installation..."
|
error "neovim is not installed; skipping plugin installation..."
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -191,7 +192,7 @@ main() {
|
||||||
task_link_local_commands
|
task_link_local_commands
|
||||||
task_link_dircolors
|
task_link_dircolors
|
||||||
task_make_logins_silent
|
task_make_logins_silent
|
||||||
task_install_vim_plugins
|
task_install_nvim_plugins
|
||||||
}
|
}
|
||||||
|
|
||||||
main
|
main
|
||||||
|
|
|
@ -12,7 +12,7 @@ export XDG_CONFIG_HOME="${XDG_CONFIG_HOME:-$HOME/.config}"
|
||||||
export XDG_DATA_HOME="${XDG_DATA_HOME:-$HOME/.local/share}"
|
export XDG_DATA_HOME="${XDG_DATA_HOME:-$HOME/.local/share}"
|
||||||
|
|
||||||
export BACKGROUND="dark"
|
export BACKGROUND="dark"
|
||||||
export EDITOR="vim"
|
export EDITOR="nvim"
|
||||||
export INPUTRC="$XDG_CONFIG_HOME/readline/inputrc"
|
export INPUTRC="$XDG_CONFIG_HOME/readline/inputrc"
|
||||||
export LANG="en_US.UTF-8"
|
export LANG="en_US.UTF-8"
|
||||||
export LANGUAGE="en_US"
|
export LANGUAGE="en_US"
|
||||||
|
@ -27,8 +27,6 @@ MANPATH="$(unset MANPATH; manpath)"
|
||||||
export MANPATH
|
export MANPATH
|
||||||
export PAGER=less
|
export PAGER=less
|
||||||
export PYTHONSTARTUP="$XDG_CONFIG_HOME/python/startup.py"
|
export PYTHONSTARTUP="$XDG_CONFIG_HOME/python/startup.py"
|
||||||
# shellcheck disable=SC2016 # This expression is to be interpreted by vim, not bash.
|
|
||||||
export VIMINIT='let $MYVIMRC="$XDG_CONFIG_HOME/vim/vimrc" | source $MYVIMRC'
|
|
||||||
|
|
||||||
# Prevent path_helper from messing with the PATH when starting tmux.
|
# Prevent path_helper from messing with the PATH when starting tmux.
|
||||||
# See: https://superuser.com/a/583502
|
# See: https://superuser.com/a/583502
|
||||||
|
@ -172,7 +170,8 @@ alias lla="la -l"
|
||||||
command -v colorman >/dev/null && alias man=colorman
|
command -v colorman >/dev/null && alias man=colorman
|
||||||
|
|
||||||
alias g='git'
|
alias g='git'
|
||||||
alias v='vim'
|
alias v='nvim'
|
||||||
|
alias vim='nvim'
|
||||||
|
|
||||||
alias grep="grep --color=auto"
|
alias grep="grep --color=auto"
|
||||||
alias egrep="egrep --color=auto"
|
alias egrep="egrep --color=auto"
|
||||||
|
|
|
@ -46,7 +46,6 @@
|
||||||
|
|
||||||
[core]
|
[core]
|
||||||
excludesfile = ~/.config/git/ignore
|
excludesfile = ~/.config/git/ignore
|
||||||
editor = vim
|
|
||||||
trustctime = false # http://www.git-tower.com/blog/make-git-rebase-safe-on-osx/
|
trustctime = false # http://www.git-tower.com/blog/make-git-rebase-safe-on-osx/
|
||||||
pager = less -F -X
|
pager = less -F -X
|
||||||
|
|
||||||
|
|
|
@ -1,15 +1,9 @@
|
||||||
set nocompatible
|
|
||||||
|
|
||||||
if $XDG_CONFIG_HOME == "" | let $XDG_CONFIG_HOME="~/.config" | endif
|
if $XDG_CONFIG_HOME == "" | let $XDG_CONFIG_HOME="~/.config" | endif
|
||||||
if $XDG_CACHE_HOME == "" | let $XDG_CACHE_HOME="~/.cache" | endif
|
if $XDG_CACHE_HOME == "" | let $XDG_CACHE_HOME="~/.cache" | endif
|
||||||
if $XDG_DATA_HOME == "" | let $XDG_DATA_HOME="~/.local/share" | endif
|
if $XDG_DATA_HOME == "" | let $XDG_DATA_HOME="~/.local/share" | endif
|
||||||
if $LOCAL_CONFIG == "" | let $LOCAL_CONFIG="~/.local/etc" | endif
|
if $LOCAL_CONFIG == "" | let $LOCAL_CONFIG="~/.local/etc" | endif
|
||||||
|
|
||||||
let $MYVIMRC="$XDG_CONFIG_HOME/vim/vimrc"
|
|
||||||
|
|
||||||
" Options {{{
|
" Options {{{
|
||||||
set autoindent " take indent for new line from previous line
|
|
||||||
set autoread " autom. read file when changed outside of Vim
|
|
||||||
let &background = $BACKGROUND ==? 'light' ? 'light' : 'dark'
|
let &background = $BACKGROUND ==? 'light' ? 'light' : 'dark'
|
||||||
set backspace=indent,eol,start " sane backspace behavior
|
set backspace=indent,eol,start " sane backspace behavior
|
||||||
set nobackup " don't keep backup file after overwriting a file
|
set nobackup " don't keep backup file after overwriting a file
|
||||||
|
@ -17,7 +11,6 @@ set clipboard=unnamed " synchronize with system clipboard
|
||||||
set colorcolumn=+1 " highlight column after 'textwidth'
|
set colorcolumn=+1 " highlight column after 'textwidth'
|
||||||
set cursorline " highlight the line of the cursor
|
set cursorline " highlight the line of the cursor
|
||||||
set diffopt=filler,vertical " make side-by-side diffs better
|
set diffopt=filler,vertical " make side-by-side diffs better
|
||||||
set encoding=utf8 " use UTF-8 by default
|
|
||||||
set expandtab " use spaces whe <Tab> is inserted
|
set expandtab " use spaces whe <Tab> is inserted
|
||||||
set fileformats=unix,mac,dos " prioritize unix <EOL> format
|
set fileformats=unix,mac,dos " prioritize unix <EOL> format
|
||||||
set foldenable " enable folding
|
set foldenable " enable folding
|
||||||
|
@ -30,55 +23,47 @@ set formatoptions+=c " do auto-wrap comments on 'textwidth'
|
||||||
set formatoptions+=j " remove comment leader when joining lings
|
set formatoptions+=j " remove comment leader when joining lings
|
||||||
set formatoptions+=n " recognize and indent lists automatically
|
set formatoptions+=n " recognize and indent lists automatically
|
||||||
set hidden " hide abandoned buffers
|
set hidden " hide abandoned buffers
|
||||||
set history=1000 " how many ":" commands to remember
|
|
||||||
set hlsearch " highlight search results
|
|
||||||
set ignorecase " ignore case when searching (see 'smartcase' below)
|
set ignorecase " ignore case when searching (see 'smartcase' below)
|
||||||
set incsearch " use incremental search
|
|
||||||
set nojoinspaces " use one space after a period whe joining lines
|
set nojoinspaces " use one space after a period whe joining lines
|
||||||
set laststatus=2 " always show a status line
|
|
||||||
set lazyredraw " don't redraw screen when executing macros
|
set lazyredraw " don't redraw screen when executing macros
|
||||||
set list " show invisible characters
|
set list " show invisible characters
|
||||||
set listchars=tab:>~,extends:>,precedes:<,trail:- " invisible chars
|
set listchars=tab:>~,extends:>,precedes:<,trail:- " invisible chars
|
||||||
set modelines=0 " never use modelines
|
set modelines=0 " never use modelines
|
||||||
set number " show line numbers
|
set number " show line numbers
|
||||||
set nrformats-=octal " number formats for CTRL-A & CTRL-X commands
|
set nrformats-=octal " number formats for CTRL-A & CTRL-X commands
|
||||||
set runtimepath=$XDG_CONFIG_HOME/vim,$VIMRUNTIME " so vim-plug can work
|
|
||||||
set scrolloff=3 " minimum number of lines above and below cursor
|
set scrolloff=3 " minimum number of lines above and below cursor
|
||||||
set shiftwidth=0 " use 'tabstop' spaces for (auto)indent step
|
set shiftwidth=0 " use 'tabstop' spaces for (auto)indent step
|
||||||
set shortmess+=I " don't show the intro message when starting Vim
|
set shortmess+=I " don't show the intro message when starting Vim
|
||||||
set showbreak="-> " " prefix for wrapped lines
|
set showbreak="-> " " prefix for wrapped lines
|
||||||
set showmatch " briefly jump to matching bracket if insert one
|
set showmatch " briefly jump to matching bracket if insert one
|
||||||
set noshowmode " don't show mode (using airline instead)
|
set noshowmode " don't show mode (using airline instead)
|
||||||
set sidescroll=1 " minimum number of columns to scroll horizontal
|
|
||||||
set sidescrolloff=3 " min. number of columns to left and right of cursor
|
set sidescrolloff=3 " min. number of columns to left and right of cursor
|
||||||
set smartcase " case sensitive search if pattern has uppercase chars
|
set smartcase " case sensitive search if pattern has uppercase chars
|
||||||
set smartindent " use smart autoindenting
|
set smartindent " use smart autoindenting
|
||||||
set smarttab " use 'shiftwidth' when inserting <Tab>
|
|
||||||
set splitbelow " new window from split is below the current one
|
set splitbelow " new window from split is below the current one
|
||||||
set splitright " new window is put right of the current one
|
set splitright " new window is put right of the current one
|
||||||
set noswapfile " don't use swap files
|
set noswapfile " don't use swap files
|
||||||
set tabstop=4 " tabs are 4 spaces
|
set tabstop=4 " tabs are 4 spaces
|
||||||
set textwidth=79 " maximum width for text being inserted
|
set textwidth=79 " maximum width for text being inserted
|
||||||
set timeout timeoutlen=1000 ttimeoutlen=100 " timeout on mappings & key codes
|
set timeout timeoutlen=1000 ttimeoutlen=100 " timeout on mappings & key codes
|
||||||
set ttyfast " indicate a fast terminal for smoother redrawing
|
|
||||||
" +--Disable hlsearch while loading viminfo
|
|
||||||
" | +--Remember marks for last 500 files
|
|
||||||
" | | +--Remember up to 10000 lines in each register
|
|
||||||
" | | | +--Remember up to 1MB in each register
|
|
||||||
" | | | | +--Remember last 1000 search patterns
|
|
||||||
" | | | | | +---Remember last 1000 commands
|
|
||||||
" | | | | | |
|
|
||||||
" v v v v v v
|
|
||||||
set viminfo=h,'500,<10000,s1000,/1000,:1000
|
|
||||||
set viminfofile=$XDG_DATA_HOME/vim/viminfo
|
|
||||||
set virtualedit=block " position the cursor anywhere in Visual Block mode
|
set virtualedit=block " position the cursor anywhere in Visual Block mode
|
||||||
set wildignore=*.o,*.obj,*.pyc,*.exe,*.so,*.dll
|
set wildignore=*.o,*.obj,*.pyc,*.exe,*.so,*.dll
|
||||||
set wildignorecase " ignore case when completing file names
|
set wildignorecase " ignore case when completing file names
|
||||||
set wildmenu " show wildmenu after list (see 'wildmode')
|
|
||||||
set wildmode=longest,list,full " complete longest common, then list, then wildmenu
|
set wildmode=longest,list,full " complete longest common, then list, then wildmenu
|
||||||
set wrap " wrap long lines
|
set wrap " wrap long lines
|
||||||
set writebackup " make a backup before overwriting a file
|
set writebackup " make a backup before overwriting a file
|
||||||
|
|
||||||
|
" +--Disable hlsearch while loading viminfo
|
||||||
|
" | +--Remember marks for last 100 files
|
||||||
|
" | | +--Remember up to 1000 lines in each register
|
||||||
|
" | | | +--Remember up to 1MB in each register
|
||||||
|
" | | | | +--Remember last 1000 search patterns
|
||||||
|
" | | | | | +---Remember last 1000 commands
|
||||||
|
" | | | | | | +-- name of shared data file
|
||||||
|
" | | | | | | |
|
||||||
|
" v v v v v v v
|
||||||
|
set shada=h,'100,<1000,s1000,/1000,:1000,n$XDG_DATA_HOME/nvim/shada/main.shada
|
||||||
|
|
||||||
" Overrides when UTF-8 is available
|
" Overrides when UTF-8 is available
|
||||||
if has('multi_byte') && &encoding ==? 'utf-8'
|
if has('multi_byte') && &encoding ==? 'utf-8'
|
||||||
set fillchars=vert:┃,fold:·
|
set fillchars=vert:┃,fold:·
|
||||||
|
@ -88,7 +73,7 @@ endif
|
||||||
" }}}
|
" }}}
|
||||||
|
|
||||||
" Plugins {{{
|
" Plugins {{{
|
||||||
call plug#begin('$XDG_DATA_HOME/vim/plugged')
|
call plug#begin('$XDG_DATA_HOME/nvim/plugged')
|
||||||
Plug 'altercation/vim-colors-solarized'
|
Plug 'altercation/vim-colors-solarized'
|
||||||
Plug 'bronson/vim-trailing-whitespace'
|
Plug 'bronson/vim-trailing-whitespace'
|
||||||
Plug 'elzr/vim-json'
|
Plug 'elzr/vim-json'
|
||||||
|
@ -144,10 +129,7 @@ call plug#begin('$XDG_DATA_HOME/vim/plugged')
|
||||||
Plug 'chr4/nginx.vim'
|
Plug 'chr4/nginx.vim'
|
||||||
call plug#end()
|
call plug#end()
|
||||||
|
|
||||||
|
|
||||||
silent! colorscheme solarized
|
silent! colorscheme solarized
|
||||||
filetype plugin indent on
|
|
||||||
syntax enable
|
|
||||||
" }}}
|
" }}}
|
||||||
|
|
||||||
" Functions {{{
|
" Functions {{{
|
||||||
|
@ -226,16 +208,19 @@ augroup vimrc " {{{
|
||||||
autocmd BufNewFile,BufRead gitconfig set filetype=gitconfig
|
autocmd BufNewFile,BufRead gitconfig set filetype=gitconfig
|
||||||
autocmd BufNewFile,BufRead *.sx,*.s19 set filetype=srec
|
autocmd BufNewFile,BufRead *.sx,*.s19 set filetype=srec
|
||||||
autocmd BufNewFile,BufRead Vagrantfile set filetype=ruby
|
autocmd BufNewFile,BufRead Vagrantfile set filetype=ruby
|
||||||
autocmd BufNewFile,BufRead vimrc set foldmethod=marker
|
autocmd BufNewFile,BufRead init.vim set foldmethod=marker
|
||||||
|
|
||||||
autocmd FileType python setlocal foldmethod=indent foldignore=
|
autocmd FileType python setlocal foldmethod=indent foldignore=
|
||||||
autocmd FileType markdown,text,gitcommit setlocal formatoptions+=t spell
|
autocmd FileType markdown,text,gitcommit setlocal formatoptions+=t spell
|
||||||
autocmd FileType gitcommit setlocal textwidth=72
|
autocmd FileType gitcommit setlocal textwidth=72
|
||||||
|
|
||||||
autocmd BufWritePost vimrc source %
|
" Disable cursorline in INSERT mode.
|
||||||
|
autocmd InsertEnter,InsertLeave * set cursorline!
|
||||||
|
|
||||||
|
autocmd BufWritePost init.vim source %
|
||||||
augroup END " }}}
|
augroup END " }}}
|
||||||
|
|
||||||
for extra_vimrc in expand("$LOCAL_CONFIG/vim/*", v:none, v:true)
|
for extra_vimrc in expand("$LOCAL_CONFIG/nvim/*", v:false, v:true)
|
||||||
if filereadable(extra_vimrc)
|
if filereadable(extra_vimrc)
|
||||||
exec "source " . extra_vimrc
|
exec "source " . extra_vimrc
|
||||||
endif
|
endif
|
Loading…
Add table
Reference in a new issue