setup script, own statusline, coding style highlight

This commit is contained in:
2017-12-01 17:04:24 +01:00
parent 50a08810fe
commit c76c740d07
6 changed files with 104 additions and 17 deletions

25
.vimrc
View File

@@ -3,11 +3,11 @@ set nocompatible
"Plugin stuff "Plugin stuff
"{{{ "{{{
if has("win32") if has("win32")
source $HOME/vimfiles/plugins.vim source $HOME/_vimplugin
source $HOME/vimfiles/locals.vim source $HOME/_vimlocal
else else
source $HOME/.vim/plugins.vim source $HOME/.vimplugin
source $HOME/.vim/locals.vim source $HOME/.vimlocal
endif endif
"}}} "}}}
@@ -15,7 +15,7 @@ endif
"{{{ "{{{
filetype plugin indent on filetype plugin indent on
syntax enable syntax enable
syntax sync maxlines=256 syntax sync maxlines=100
set synmaxcol=200 set synmaxcol=200
"}}} "}}}
@@ -69,11 +69,20 @@ let g:ycm_autoclose_preview_window_after_completion = 1
set shortmess+=c set shortmess+=c
"}}} "}}}
"Misc "Coding style
"{{{ "{{{
augroup overlength augroup badstyle
autocmd! autocmd!
autocmd BufWinEnter * match OverLength '\%81v.' autocmd BufWinEnter * let w:m1 = matchadd('Unstylish', '\%81v.')
autocmd BufWinEnter * if &ft != 'make' && &ft != 'gitcommit' |
\ let w:m2 = matchadd('Unstylish', '\t') | endif
augroup END
augroup trailingwhite
autocmd!
autocmd BufWinEnter,InsertLeave * if &ft != 'markdown'
\ | match TrailingWhite '\v\s+$' | endif
autocmd InsertEnter * match TrailingWhite ''
augroup END augroup END
"}}} "}}}

View File

@@ -5,12 +5,16 @@
If you find yourself wanting to use these settings, do the following: If you find yourself wanting to use these settings, do the following:
``` ```
colors -> ~/.vim/colors ./colors -> ~/.vim/colors
ftplugin -> ~/.vim/ftplugin ./ftplugin -> ~/.vim/ftplugin
.vimrc -> ~/.vimrc ./.vimrc -> ~/.vimrc
``` ```
Also create two files `~/.vim/plugins.vim` and `~/.vim/locals.vim`. The first Also create two files `~/.vimplugin` and `~/.vimlocal`. The first one contains
one contains commands for your plugin manager and in the second one are commands commands for your plugin manager. The idea is that you might need a different
that are local to the machine. You might use `plugin_template.vim` and set of plugins on different machines. Some plugins require paths to programs,
`locals_template.vim` for reference. which can differ from machine to machine too.
In `.vimlocal` you should should put settings that are local to the machine.
You might use `plugin_template.vim` and `locals_template.vim` for reference.
Alternatively, if you are on UNIX and haven't configured VIM yet, you could just
run `setup.sh`, which will do everything for you.

View File

@@ -30,6 +30,8 @@ hi SignColumn cterm=NONE ctermbg=15 gui=NONE guibg=#ffffff
hi TabLine cterm=NONE ctermbg=7 gui=NONE guibg=#c0c0c0 hi TabLine cterm=NONE ctermbg=7 gui=NONE guibg=#c0c0c0
hi TabLineFill cterm=NONE ctermbg=7 gui=NONE guibg=#c0c0c0 hi TabLineFill cterm=NONE ctermbg=7 gui=NONE guibg=#c0c0c0
hi TabLineSel cterm=bold ctermfg=0 ctermbg=15 gui=bold guifg=#000000 guibg=#ffffff hi TabLineSel cterm=bold ctermfg=0 ctermbg=15 gui=bold guifg=#000000 guibg=#ffffff
hi StatusLine gui=bold guibg=#c0c0c0 guifg=#000000 cterm=bold ctermbg=7 ctermfg=0
hi StatusLineNc gui=NONE guibg=#c0c0c0 guifg=#808080 cterm=NONE ctermbg=7 ctermfg=8
hi Title cterm=bold ctermfg=0 gui=bold guifg=#000000 hi Title cterm=bold ctermfg=0 gui=bold guifg=#000000
hi VertSplit cterm=bold ctermfg=0 ctermbg=15 gui=bold guifg=#000000 guibg=#ffffff hi VertSplit cterm=bold ctermfg=0 ctermbg=15 gui=bold guifg=#000000 guibg=#ffffff
@@ -39,7 +41,8 @@ hi Visual cterm=NONE ctermbg=159 gui=none guibg=#afffff
hi Error cterm=bold ctermfg=9 ctermbg=15 gui=bold guifg=#ff0000 guibg=#ffffff hi Error cterm=bold ctermfg=9 ctermbg=15 gui=bold guifg=#ff0000 guibg=#ffffff
hi SyntasticError cterm=bold ctermfg=9 ctermbg=15 gui=bold guifg=#ff0000 guibg=#ffffff hi SyntasticError cterm=bold ctermfg=9 ctermbg=15 gui=bold guifg=#ff0000 guibg=#ffffff
hi SyntasticWarning cterm=underline gui=undercurl guisp=#ffaf00 hi SyntasticWarning cterm=underline gui=undercurl guisp=#ffaf00
hi OverLength cterm=NONE ctermfg=0 ctermbg=210 gui=NONE guibg=#ffc0c0 guifg=#000000 hi Unstylish cterm=NONE ctermfg=0 ctermbg=210 gui=NONE guibg=#ffc0c0 guifg=#000000
hi def link TrailingWhite Unstylish
hi Identifier cterm=NONE ctermfg=6 ctermbg=NONE gui=NONE guifg=#00afaf guibg=#ffffff hi Identifier cterm=NONE ctermfg=6 ctermbg=NONE gui=NONE guifg=#00afaf guibg=#ffffff
"hi Ignore gui=NONE guifg=bg guibg=NONE "hi Ignore gui=NONE guifg=bg guibg=NONE
hi PreProc cterm=NONE ctermfg=94 ctermbg=15 gui=NONE guifg=#a75f5f guibg=#ffffff hi PreProc cterm=NONE ctermfg=94 ctermbg=15 gui=NONE guifg=#a75f5f guibg=#ffffff

View File

@@ -1,4 +1,4 @@
setlocal foldmethod=marker setlocal foldmethod=marker foldlevel=0
nnoremap <buffer> <localleader>c mcI"<esc>`c:delm c<cr> nnoremap <buffer> <localleader>c mcI"<esc>`c:delm c<cr>
vnoremap <buffer> <localleader>f <esc>`>o"}}}<esc>`<O"{{{<esc> vnoremap <buffer> <localleader>f <esc>`>o"}}}<esc>`<O"{{{<esc>
nnoremap <buffer> <localleader>xf mx?"{{{<cr>dd/"}}}<cr>dd`x:noh<cr>:delm x<cr> nnoremap <buffer> <localleader>xf mx?"{{{<cr>dd/"}}}<cr>dd`x:noh<cr>:delm x<cr>

27
plugin/statusline.vim Normal file
View File

@@ -0,0 +1,27 @@
function! GetGitStatus()
let result=fugitive#statusline()
if strlen(result) == 0
return result
else
return "{" . split(result,'[()]')[1] . "}"
endif
endfunction
set statusline=
set statusline+=%w%q%h
set statusline+=%{GetGitStatus()}
set statusline+=\
set statusline+=%f
set statusline+=%m%r
set statusline+=%=
set statusline+=\
set statusline+=%<
set statusline+=%{&fileencoding?&fileencoding:&encoding}
set statusline+=\|%{&fileformat}
set statusline+=\
set statusline+=%y
set statusline+=\
set statusline+=<x%02B>
set statusline+=\
set statusline+=(%2c:%l)/%L
set statusline+=\

44
setup.sh Executable file
View File

@@ -0,0 +1,44 @@
#!/usr/bin/env bash
read -p "---WARNING---
This script will brutally delete your .vimrc file,
if such exists in your home directory.
Are you sure you want to proceed? [y/n]: " responce
[[ "$responce" = "y" ]] || { echo "Abort!" >&2; exit 1; }
echo "Proceeding..."
repo="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
[ -f "$HOME/.vimrc" ] && rm "$HOME/.vimrc"
ln -s "$repo/.vimrc" "$HOME/.vimrc"
echo "Created link to .vimrc"
[ -d "$HOME/.vim" ] || { mkdir "$HOME/.vim"; \
echo "Created .vim directory in your HOME"; }
[ -d "$HOME/.vim/colors" ] \
&& echo "colors dir already exists, deal with it manually" \
|| ln -s "$repo/colors" "$HOME/.vim/colors"
[ -d "$HOME/.vim/plugin" ] \
&& echo "plugin dir already exists, deal with it manually" \
|| ln -s "$repo/plugin" "$HOME/.vim/plugin"
[ -d "$HOME/.vim/ftplugin" ] \
&& echo "ftplugin already exists, deal with it manually" \
|| ln -s "$repo/ftplugin" "$HOME/.vim/ftplugin"
[ -f "$HOME/.vimplugin" ] \
&& echo "not creating ~/.vimplugin, it exists already" \
|| cp "$repo/plugin_template.vim" "$HOME/.vimplugin"
[ -f "$HOME/.vimlocal" ] \
&& echo "not creating ~/.vimlocal, it exists already" \
|| cp "$repo/local_template.vim" "$HOME/.vimlocal"
[ -d "$HOME/.vim/bundle" ]\
&& echo "You seem to already have some plugin manager" \
|| { mkdir "$HOME/.vim/bundle"; \
git clone https://github.com/Vundle/Vundle.vim.git \
"$HOME/.vim/bunlde/Vundle.vim"; }
echo "Setup finished."