Heavily touch vimrc, add init.vim for Neovim

This commit is contained in:
Aminda Suomalainen 2018-10-11 13:11:06 +03:00
parent b19551e8b4
commit 542c4109eb
No known key found for this signature in database
GPG Key ID: 0C207F07B2F32B67
3 changed files with 46 additions and 74 deletions

6
conf/init.vim Normal file
View File

@ -0,0 +1,6 @@
" This is neovim config file
set runtimepath^=~/.vim runtimepath+=~/.vim/after
let &packpath = &runtimepath
source ~/.vimrc

View File

@ -10,6 +10,8 @@ cat rc/zshrc > ~/.zshrc
cat rc/profile > ~/.profile cat rc/profile > ~/.profile
cat conf/gitconfig > ~/.gitconfig cat conf/gitconfig > ~/.gitconfig
cat rc/vimrc > ~/.vimrc cat rc/vimrc > ~/.vimrc
mkdir -p ~/.config/nvim/
cat conf/init.vim > ~/.config/nvim/init.vim
cat conf/makepkg.conf > ~/.makepkg.conf cat conf/makepkg.conf > ~/.makepkg.conf
if [ ! -f ~/.oidentd.conf ]; then if [ ! -f ~/.oidentd.conf ]; then
cat conf/oidentd.conf > ~/.oidentd.conf cat conf/oidentd.conf > ~/.oidentd.conf

112
rc/vimrc
View File

@ -1,58 +1,37 @@
" I probably don't need to have Vi compatibility. " I probably don't need to have Vi compatibility.
set nocompatible set nocompatible
" Copied from /usr/local/vim/vimrc of Debian.
" Show syntax colours " Show syntax colours
syntax on syntax on
set showcmd " Show (partial) command in status line. set showcmd " Show (partial) command in status line.
set showmatch " Show matching brackets. set showmatch " Show matching brackets.
set ignorecase " Do case insensitive matching set ignorecase " Do case insensitive matching
set smartcase " Do smart case matching set smartcase " Do smart case matching
"set incsearch " Incremental search "set incsearch " Incremental search
set autowrite " Automatically save before commands like :next and :make set autowrite " Automatically save before commands like :next and :make
set hidden " Hide buffers when they are abandoned set hidden " Hide buffers when they are abandoned
"set mouse=a " Enable mouse usage (all modes) "set mouse=a " Enable mouse usage (all modes)
" Source a global configuration file if available " Source a global configuration file if available
if filereadable("/etc/vim/vimrc.local") if filereadable("/etc/vim/vimrc.local")
source /etc/vim/vimrc.local source /etc/vim/vimrc.local
endif endif
" end of copied from /usr/local/vim/vimrc set number " Show line numbers.
" Copied from nyuszika7h http://nyuszika7h.dyndns.org/~nyuszika7h/.vimrc set ruler " Show the line and column number of the cursor position,
" separated by a comma.
set number " Show line numbers.
set ruler " Show the line and column number of the cursor position,
" separated by a comma.
set background=dark " When set to "dark", Vim will try to use colors that look
" good on a dark background. When set to "light", Vim will
" try to use colors that look good on a light background.
" Any other value is illegal.
" end of copied from nyuszika7h
set background=dark
"Use modelines! "Use modelines!
set modeline set modeline
set tabstop=4 "four spaces is likely a tab
"end of copied fron vimwiki. "set shiftwidth=4
set noexpandtab
" copied from http://www.linuxquestions.org/questions/suse-novell-60/how-to-make-a-tab-is-4-spaces-width-in-vim-355658/
set tabstop=4
set shiftwidth=4
set expandtab
set autoindent set autoindent
" end of copied fron linuxquestions.org
" Copied from whttp://items.sjbach.com/319/configuring-vim-right
" Longer history " Longer history
set history=1000 set history=1000
@ -60,19 +39,20 @@ set history=1000
runtime macros/matchit.vim runtime macros/matchit.vim
" Make tab filler useful. " Make tab filler useful.
" INVESTIGATE WHAT THIS ACTUALLY DOES?
set wildmenu set wildmenu
set wildmode=list:longest set wildmode=list:longest
" Flash, do not beep! " Flash, do not beep!
set visualbell set visualbell
" End of copied from http://items.sjbach.com/319/configuring-vim-right
" gvim has light background " gvim has light background
if has('gui_running') if has('gui_running')
set background=light set background=light
endif endif
" Show hidden characters via http://www.perturb.org/display/679_Make_Vim_show_hidden_characters.html " Show hidden characters via
" http://www.perturb.org/display/679_Make_Vim_show_hidden_characters.html
set invlist set invlist
"Prefer to UNIX line endings, but understand DOS too. "Prefer to UNIX line endings, but understand DOS too.
@ -82,52 +62,36 @@ set fileformats=unix,dos
set encoding=utf-8 set encoding=utf-8
set fileencoding=utf-8 set fileencoding=utf-8
" Remove BOMs. They broke things yesterday nd now they wasted my time " Remove BOMs. They broke things yesterday and now they wasted my time
" at school! via http://techwelkin.com/how-to-remove-byte-order-mark-bom-characters " at school!
" via http://techwelkin.com/how-to-remove-byte-order-mark-bom-characters
set nobomb set nobomb
" Copied from https://github.com/ProgVal/misc/blob/master/dotfiles/.vimrc
set autoindent
set softtabstop=4
filetype plugin indent on filetype plugin indent on
" Return to last edit position when opening files (You want this!) " Return to last edit position when opening files (You want this!)
autocmd BufReadPost * autocmd BufReadPost *
\ if line("'\"") > 0 && line("'\"") <= line("$") | \ if line("'\"") > 0 && line("'\"") <= line("$") |
\ exe "normal! g`\"" | \ exe "normal! g`\"" |
\ endif \ endif
" End of copied from https://raw.githubusercontent.com/ProgVal/misc/master/dotfiles/.vimrc
" If we have tabs, remove them
"if has("autocmd")
" au BufReadPost * if &modifiable | retab | endif
"endif
" dos2unix ^M copied from http://stackoverflow.com/a/5361702/1675649 " dos2unix ^M copied from http://stackoverflow.com/a/5361702/1675649
fun! Dos2unixFunction() fun! Dos2unixFunction()
let _s=@/ let _s=@/
let l = line(".") let l = line(".")
let c = col(".") let c = col(".")
try try
set ff=unix set ff=unix
w! w!
"%s/\%x0d$//e "%s/\%x0d$//e
catch /E32:/ catch /E32:/
echo "Sorry, the file is not saved." echo "Sorry, the file is not saved."
endtry endtry
let @/=_s let @/=_s
call cursor(l, c) call cursor(l, c)
endfun endfun
com! Dos2Unix keepjumps call Dos2unixFunction() com! Dos2Unix keepjumps call Dos2unixFunction()
au BufReadPost * keepjumps call Dos2unixFunction() au BufReadPost * keepjumps call Dos2unixFunction()
" Copied from Edelwin: https://gist.github.com/Edelwin/ca9a819e5509f1ede2d7
iab #i #include
iab #z #!/usr/bin/env zsh
iab #p #!/usr/bin/env python3
iab #r #!/usr/bin/env ruby
" end of copied from Edelwin
iab #b #!/usr/bin/env bash
" Highlight all search results " Highlight all search results
set hlsearch set hlsearch