2015-06-03 21:39:41 +00:00
|
|
|
"on: [1.8.8]"
|
|
|
|
"""""""""""""""""""""""""""""""""
|
2015-12-25 20:54:27 +00:00
|
|
|
"Authors: [Karlkorp, Inc. 2014; lhark, Inc. 2015]"
|
2015-06-03 21:39:41 +00:00
|
|
|
""""""""""""""""""""""""""""""""""""""""""""""""
|
|
|
|
"Type: [Vim/GVim/MacVim configuration file]"
|
|
|
|
""""""""""""""""""""""""""""""""""""""""""""""""""""""""
|
|
|
|
"Name: [.vimrc (unix/mac); _vimrc (MS Windows/DOS)]"
|
|
|
|
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
|
|
|
|
"Location: [$HOME/.vimrc (unix/mac); $USERNAME\_vimrc (MS Windows)]"
|
|
|
|
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
|
|
|
|
"[Plug-ins list]""""""""""""""""""""""""""""""""""""""""""""""""""""""""
|
|
|
|
"+------------------+-------------------------------------------------+"
|
2016-05-20 23:22:55 +00:00
|
|
|
"| AutoComplPop | https://github.com/vim-scripts/AutoComplPop |"
|
|
|
|
"| DelimitMate | https://github.com/Raimondi/delimitMate |"
|
2017-03-20 18:24:16 +00:00
|
|
|
"| DetectIndent | https://github.com/roryokane/detectindent |"
|
2015-12-25 20:55:45 +00:00
|
|
|
"| Multiple-Cursors | https://github.com/terryma/vim-multiple-cursors |"
|
2016-05-20 23:22:55 +00:00
|
|
|
"| Python-Mode | https://github.com/klen/python-mode |"
|
|
|
|
"| Surround | https://github.com/tpope/vim-surround |"
|
|
|
|
"| Undotree | https://github.com/mbbill/undotree |"
|
|
|
|
"| Vim-Airline | https://github.com/bling/vim-airline |"
|
2016-10-10 06:40:27 +00:00
|
|
|
"| Vim-GLSL | https://github.com/tikhomirov/vim-glsl |"
|
2016-05-20 23:22:55 +00:00
|
|
|
"| Vim-Gnupg | https://github.com/jamessan/vim-gnupg |"
|
|
|
|
"| Vundle | https://github.com/gmarik/Vundle.vim.git |"
|
2015-06-03 21:39:41 +00:00
|
|
|
"+------------------+-------------------------------------------------+"
|
|
|
|
"[Colorschemes list]""""""""""""""""""""""""""""""""""""""""""""""""""""
|
|
|
|
"+------------------+-------------------------------------------------+"
|
2015-12-25 20:55:45 +00:00
|
|
|
"| Solarized | https://github.com/altercation/vim-colors-solarized |"
|
2015-06-03 21:39:41 +00:00
|
|
|
"+------------------+-------------------------------------------------+"
|
|
|
|
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
|
|
|
|
"[To disable compatibility with Vi]"
|
|
|
|
set nocompatible
|
|
|
|
"[Use Plug-ins and Plug-in Manager(Vundle) only on UNIX or MAC OS]"
|
|
|
|
if has("unix") || has("mac")
|
2015-08-08 20:44:49 +00:00
|
|
|
filetype off
|
|
|
|
"[Download and install Vundle Plug-in Manager]"
|
|
|
|
try
|
|
|
|
if !isdirectory(expand("$HOME/.vim/bundle"))
|
|
|
|
silent !mkdir -p $HOME/.vim/bundle
|
|
|
|
silent cd $HOME/.vim/bundle
|
|
|
|
silent !git clone https://github.com/gmarik/Vundle.vim.git
|
|
|
|
silent cd $HOME
|
|
|
|
endif
|
|
|
|
"[Run Plug-ins]"
|
|
|
|
set runtimepath+=$HOME/.vim/bundle/Vundle.vim
|
|
|
|
call vundle#begin()
|
|
|
|
Plugin 'gmarik/Vundle.vim'
|
|
|
|
map <F2> :VundleInstall<CR>
|
|
|
|
map <F3> :VundleUpdate<CR>
|
|
|
|
if has("python")
|
|
|
|
Plugin 'klen/python-mode'
|
2017-04-27 17:36:45 +00:00
|
|
|
let g:pymode_rope_lookup_project = 0
|
|
|
|
let g:pymode_rope = 0
|
2017-09-11 17:10:23 +00:00
|
|
|
Plugin 'davidhalter/jedi-vim'
|
2015-08-08 20:44:49 +00:00
|
|
|
endif
|
|
|
|
if has("ruby")
|
|
|
|
Plugin 'terryma/vim-multiple-cursors'
|
|
|
|
endif
|
|
|
|
Plugin 'mbbill/undotree'
|
|
|
|
map <F5> :UndotreeToggle<CR>
|
2016-03-17 22:38:43 +00:00
|
|
|
Plugin 'vim-scripts/LaTeX-Box'
|
2015-09-30 22:32:54 +00:00
|
|
|
map <LocalLeader>ll :Latexmk<CR>
|
2018-04-30 21:52:33 +00:00
|
|
|
if isdirectory(expand("$HOME/.vim/bundle/YouCompleteMe"))
|
2015-12-25 20:55:45 +00:00
|
|
|
"[Workaround for YCM non-portability]"
|
2017-11-20 18:40:08 +00:00
|
|
|
"No need for Plugin 'Valloric/YouCompleteMe', it's installed system-wide
|
2018-04-30 21:52:33 +00:00
|
|
|
let g:ycm_global_ycm_extra_conf = '$HOME/.vim/bundle/YouCompleteMe/third_party/ycmd/cpp/ycm/.ycm_extra_conf.py'
|
2017-10-26 15:57:35 +00:00
|
|
|
let g:ycm_server_python_interpreter = '/usr/bin/python2'
|
2017-11-20 18:40:08 +00:00
|
|
|
"[We're using ale for linting]"
|
|
|
|
let g:ycm_show_diagnostics_ui = 0
|
2018-02-26 08:11:55 +00:00
|
|
|
let g:ycm_collect_identifiers_from_tags_files=1
|
|
|
|
let g:ycm_seed_identifiers_with_syntax=1
|
2015-12-25 20:55:45 +00:00
|
|
|
else
|
|
|
|
Plugin 'AutoComplPop'
|
|
|
|
endif
|
2017-10-26 15:57:35 +00:00
|
|
|
Plugin 'w0rp/ale'
|
2017-11-20 18:40:08 +00:00
|
|
|
let g:ale_linters = {
|
|
|
|
\ 'cpp': ['g++'],
|
|
|
|
\ 'c': ['clang']
|
|
|
|
\ }
|
|
|
|
let g:ale_c_gcc_options='-std=c99 -pedantic'
|
|
|
|
let g:ale_sign_error = '●'
|
|
|
|
let g:ale_sign_warning = '●'
|
2017-10-26 15:57:35 +00:00
|
|
|
Plugin 'itchyny/lightline.vim'
|
|
|
|
let g:lightline = {
|
2017-11-20 18:40:08 +00:00
|
|
|
\'colorscheme': 'solarized',
|
|
|
|
\ 'active': {
|
|
|
|
\ 'left': [['mode', 'paste'], ['filename', 'modified']],
|
|
|
|
\ 'right': [['lineinfo'],
|
|
|
|
\ ['percent'],
|
|
|
|
\ ['readonly', 'linter_warnings', 'linter_errors', 'linter_ok'],
|
|
|
|
\ ['fileformat'],
|
|
|
|
\ ['fileencoding']
|
|
|
|
\ ]
|
|
|
|
\ },
|
|
|
|
\ 'component_expand': {
|
|
|
|
\ 'linter_warnings': 'LightlineLinterWarnings',
|
|
|
|
\ 'linter_errors': 'LightlineLinterErrors',
|
2018-02-26 08:13:20 +00:00
|
|
|
\ 'linter_ok': 'LightlineLinterOK',
|
|
|
|
\ 'lineinfo': 'LineInfo'
|
2017-11-20 18:40:08 +00:00
|
|
|
\ },
|
|
|
|
\ 'component_type': {
|
|
|
|
\ 'readonly': 'error',
|
|
|
|
\ 'linter_warnings': 'warning',
|
|
|
|
\ 'linter_errors': 'error'
|
|
|
|
\ },
|
|
|
|
\}
|
2018-02-26 08:11:55 +00:00
|
|
|
"Needed for vim-easytags"
|
|
|
|
Plugin 'xolox/vim-misc'
|
|
|
|
Plugin 'xolox/vim-easytags'
|
|
|
|
let g:easytags_async=1
|
|
|
|
"Needed for YouCompleteMe"
|
|
|
|
let g:easytags_opts=['--fields=+l']
|
2015-08-08 20:44:49 +00:00
|
|
|
Plugin 'godlygeek/tabular'
|
2018-03-19 18:49:57 +00:00
|
|
|
Plugin 'beyondmarc/opengl.vim'
|
2016-10-10 06:40:27 +00:00
|
|
|
Plugin 'tikhomirov/vim-glsl'
|
2017-11-20 18:40:08 +00:00
|
|
|
Plugin 'beyondmarc/hlsl.vim'
|
2018-02-26 08:14:43 +00:00
|
|
|
Plugin 'rust-lang/rust.vim'
|
2017-07-25 04:57:17 +00:00
|
|
|
Plugin 'mzlogin/vim-smali'
|
2016-05-20 23:22:55 +00:00
|
|
|
Plugin 'jamessan/vim-gnupg'
|
2016-11-03 03:50:48 +00:00
|
|
|
Plugin 'petRUShka/vim-opencl'
|
2015-12-25 20:55:45 +00:00
|
|
|
Plugin 'tpope/vim-surround'
|
2016-02-09 07:53:59 +00:00
|
|
|
Plugin 'captbaritone/better-indent-support-for-php-with-html'
|
2017-04-27 17:36:45 +00:00
|
|
|
"[Autodetect indent style of a file]"
|
2018-05-17 13:35:34 +00:00
|
|
|
Plugin 'roryokane/detectindent'
|
2017-04-27 17:36:45 +00:00
|
|
|
let g:detectindent_preferred_indent=4
|
|
|
|
let g:detectindent_autodetect=1
|
2015-12-25 20:55:45 +00:00
|
|
|
"[Solarized theme]"
|
|
|
|
Plugin 'altercation/vim-colors-solarized'
|
2015-08-08 20:44:49 +00:00
|
|
|
call vundle#end()
|
|
|
|
catch
|
|
|
|
endtry
|
2015-06-03 21:39:41 +00:00
|
|
|
else
|
2015-08-08 20:44:49 +00:00
|
|
|
filetype on
|
2015-06-03 21:39:41 +00:00
|
|
|
endif
|
|
|
|
"[Recognize the type/syntax of the file]"
|
|
|
|
filetype plugin on
|
|
|
|
filetype indent on
|
|
|
|
set omnifunc=syntaxcomplete#Complete
|
|
|
|
"[Enable built-in plug-ins/macros]"
|
|
|
|
runtime macros/matchit.vim
|
|
|
|
"[Enable syntax highlighting]"
|
|
|
|
syntax on
|
|
|
|
"[Read the changes after the save .vimrc]"
|
|
|
|
if has("autocmd")
|
2015-08-08 20:44:49 +00:00
|
|
|
autocmd! BufWritePost $MYVIMRC source $MYVIMRC
|
2015-06-03 21:39:41 +00:00
|
|
|
endif
|
|
|
|
"[Define the leader key]"
|
|
|
|
let mapleader=","
|
2015-09-30 22:26:57 +00:00
|
|
|
let maplocalleader=","
|
2015-06-03 21:39:41 +00:00
|
|
|
"[List of buffers]"
|
|
|
|
map <F7> :ls!<CR>:buffer<Space>
|
|
|
|
"[Reselect visual block after indent/outdent]"
|
|
|
|
vnoremap < <gv
|
|
|
|
vnoremap > >gv
|
|
|
|
"[Improve up/down movement on wrapped lines]"
|
|
|
|
nnoremap j gj
|
|
|
|
nnoremap k gk
|
2015-10-22 06:42:30 +00:00
|
|
|
" nnoremap <Down> gj
|
|
|
|
" nnoremap <Up> gk
|
|
|
|
" vnoremap <Down> gj
|
|
|
|
" vnoremap <Up> gk
|
|
|
|
" inoremap <Down> <C-o>gj
|
|
|
|
" inoremap <Up> <C-o>gk
|
2015-06-03 21:39:41 +00:00
|
|
|
"[Clear search highlights]"
|
|
|
|
nnoremap // :nohlsearch<CR>
|
|
|
|
"[Easy split navigation]"
|
|
|
|
nnoremap <C-j> <C-W>j
|
|
|
|
nnoremap <C-k> <C-W>k
|
|
|
|
nnoremap <C-h> <C-W>h
|
|
|
|
nnoremap <C-l> <C-W>l
|
2015-08-08 20:44:49 +00:00
|
|
|
nnoremap <C-Up> <C-W>k
|
|
|
|
nnoremap <C-Down> <C-W>j
|
|
|
|
nnoremap <C-Left> <C-W>h
|
|
|
|
nnoremap <C-Right> <C-W>l
|
2015-06-03 21:39:41 +00:00
|
|
|
"[Locate the desired objects in the center of the screen]"
|
|
|
|
nnoremap <silent> n nzz
|
|
|
|
nnoremap <silent> N Nzz
|
|
|
|
nnoremap <silent> * *zz
|
|
|
|
nnoremap <silent> # #zz
|
|
|
|
"[New line under/bellow current line without jump to insert-mode]"
|
|
|
|
nnoremap <leader>o o<Esc>
|
|
|
|
nnoremap <leader>O O<Esc>
|
|
|
|
"[Auto-complete parenthesis, brackets and braces, quotes]"
|
|
|
|
"inoremap " ""<Left>
|
|
|
|
"inoremap ' ''<Left>
|
|
|
|
"inoremap ( ()<Left>
|
|
|
|
"inoremap [ []<Left>
|
|
|
|
"inoremap { {}<Left>
|
|
|
|
"[Easy jump into the normal-mode from the insert-mode]"
|
|
|
|
inoremap jj <Esc>
|
|
|
|
"[To move over parenthesis, brackets, quotes in insert-mode]"
|
2017-04-27 17:36:45 +00:00
|
|
|
inoremap kk <Right>
|
|
|
|
inoremap hh <Left>
|
2017-10-26 15:54:15 +00:00
|
|
|
" http://stackoverflow.com/questions/1005/getting-root-permissions-on-a-file-inside-of-vi
|
|
|
|
cmap w!! w !sudo tee >/dev/null %
|
2015-06-03 21:39:41 +00:00
|
|
|
"[To disable the arrow keys]"
|
2017-04-27 17:36:45 +00:00
|
|
|
for prefix in ['i', 'n', 'v']
|
|
|
|
for key in ['<Up>', '<Down>', '<Left>', '<Right>']
|
|
|
|
execute prefix . "noremap " . key . " <Nop>"
|
|
|
|
endfor
|
|
|
|
endfor
|
2015-06-03 21:39:41 +00:00
|
|
|
"[Threshold for reporting number of lines changed]"
|
|
|
|
set report=0
|
|
|
|
"[Show command in the last line of the screen]"
|
|
|
|
set showcmd
|
|
|
|
"[Show both the tag name and a tidied-up form of the search pattern]"
|
|
|
|
set showfulltag
|
|
|
|
"[Don't give the intro message when starting Vim]"
|
|
|
|
set shortmess=""
|
|
|
|
if has("unix") || has("mac")
|
2015-08-08 20:44:49 +00:00
|
|
|
set shortmess+=I
|
2015-06-03 21:39:41 +00:00
|
|
|
endif
|
|
|
|
"[Always show StatusLine]"
|
|
|
|
set laststatus=2
|
2017-10-26 15:57:35 +00:00
|
|
|
"[Do not show mode in command line]"
|
|
|
|
set noshowmode
|
2015-06-03 21:39:41 +00:00
|
|
|
"[Splitting rules]"
|
|
|
|
set splitbelow
|
|
|
|
set splitright
|
|
|
|
set equalalways
|
|
|
|
"[Lisp coding settings]"
|
|
|
|
if (&filetype == "lisp")
|
2015-08-08 20:44:49 +00:00
|
|
|
set lisp
|
2015-06-03 21:39:41 +00:00
|
|
|
endif
|
2018-03-19 18:50:35 +00:00
|
|
|
"[Don't use the mouse in terminal]"
|
|
|
|
set mouse=
|
2015-06-03 21:39:41 +00:00
|
|
|
set mousemodel=extend
|
2017-10-19 05:08:38 +00:00
|
|
|
"[Fix mouse past column 222]"
|
|
|
|
if has("mouse_sgr")
|
|
|
|
set ttymouse=sgr
|
|
|
|
else
|
|
|
|
set ttymouse=xterm2
|
|
|
|
end
|
2015-06-03 21:39:41 +00:00
|
|
|
"[Hide mouse while printing the text]"
|
|
|
|
set mousehide
|
|
|
|
"[Visualisation settings]"
|
|
|
|
set background=dark
|
|
|
|
set ttyfast
|
|
|
|
set tabline=""
|
2017-04-27 17:36:45 +00:00
|
|
|
" set cmdheight=1 : default
|
2015-06-03 21:39:41 +00:00
|
|
|
set showtabline=0
|
2017-10-26 15:57:35 +00:00
|
|
|
set colorcolumn=80
|
2015-06-03 21:39:41 +00:00
|
|
|
set nocursorcolumn
|
|
|
|
set cmdwinheight=10
|
|
|
|
set virtualedit=all
|
|
|
|
"[GUI/Color Scheme/Font settings]"
|
|
|
|
if has("gui_running")
|
2015-08-08 20:44:49 +00:00
|
|
|
winsize 90 50
|
|
|
|
silent cd $HOME
|
|
|
|
set linespace=0
|
|
|
|
set guioptions=""
|
|
|
|
set guitablabel=""
|
|
|
|
if has("autocmd")
|
|
|
|
autocmd InsertEnter * set cursorline
|
|
|
|
autocmd InsertLeave * set nocursorline
|
|
|
|
endif
|
|
|
|
if has("win32") || has("win64")
|
|
|
|
try
|
2015-12-25 20:56:56 +00:00
|
|
|
colorscheme solarized
|
2016-10-10 06:41:11 +00:00
|
|
|
set guifont=PT_Mono:h12
|
2015-08-08 20:44:49 +00:00
|
|
|
catch
|
|
|
|
endtry
|
|
|
|
elseif has("unix")
|
|
|
|
try
|
2015-12-25 20:56:56 +00:00
|
|
|
colorscheme solarized
|
2017-10-26 15:57:35 +00:00
|
|
|
set guifont=Liberation\ Mono\ 10
|
2015-08-08 20:44:49 +00:00
|
|
|
catch
|
|
|
|
endtry
|
|
|
|
elseif has("mac")
|
|
|
|
try
|
|
|
|
set antialias
|
2015-12-25 20:56:56 +00:00
|
|
|
colorscheme solarized
|
2016-10-10 06:41:11 +00:00
|
|
|
set guifont=Monaco:h12
|
2015-08-08 20:44:49 +00:00
|
|
|
catch
|
|
|
|
endtry
|
|
|
|
endif
|
2015-06-03 21:39:41 +00:00
|
|
|
else
|
2015-08-08 20:44:49 +00:00
|
|
|
if has("unix") || has("mac")
|
|
|
|
try
|
2015-12-25 20:56:56 +00:00
|
|
|
set t_Co=16
|
2018-07-10 19:36:25 +00:00
|
|
|
let g:solarized_termtrans=1
|
|
|
|
let g:solarized_termcolors=16
|
2015-12-25 20:56:56 +00:00
|
|
|
colorscheme solarized
|
2015-08-08 20:44:49 +00:00
|
|
|
catch
|
|
|
|
endtry
|
|
|
|
endif
|
2015-06-03 21:39:41 +00:00
|
|
|
endif
|
|
|
|
"[Backspace functions]"
|
|
|
|
set backspace=indent,eol,start
|
|
|
|
"[Scroll settings]"
|
|
|
|
set scrolloff=10
|
|
|
|
set scrolljump=10
|
|
|
|
set showmatch
|
2018-02-26 08:14:43 +00:00
|
|
|
set matchpairs=\":\"
|
2015-06-03 21:39:41 +00:00
|
|
|
set matchpairs+=(:)
|
|
|
|
set matchpairs+={:}
|
|
|
|
set matchpairs+=[:]
|
2016-01-30 18:41:52 +00:00
|
|
|
"set matchpairs+=<:> : too annoying
|
2015-06-03 21:39:41 +00:00
|
|
|
"[Turn backup off and value of history]"
|
|
|
|
set nobackup
|
|
|
|
set noswapfile
|
|
|
|
set history=1000
|
|
|
|
set nowritebackup
|
|
|
|
set undolevels=5000
|
|
|
|
"[Indent & Tab/mode-line settings]"
|
2017-10-26 15:57:35 +00:00
|
|
|
set breakindent
|
2015-06-03 21:39:41 +00:00
|
|
|
set nopaste
|
|
|
|
set modeline
|
|
|
|
set smarttab
|
|
|
|
set tabstop=4
|
|
|
|
set expandtab
|
|
|
|
set autoindent
|
|
|
|
set copyindent
|
|
|
|
set smartindent
|
2017-04-27 17:36:45 +00:00
|
|
|
set cinwords=except,finally,def,class,with,do,if,elif,else,for,while,try,switch
|
2018-07-10 19:37:04 +00:00
|
|
|
set cinoptions+=l1
|
2015-06-03 21:39:41 +00:00
|
|
|
set modelines=1
|
|
|
|
set shiftwidth=4
|
|
|
|
set softtabstop=4
|
|
|
|
"[TextWidth settings]"
|
2015-12-14 18:48:58 +00:00
|
|
|
set textwidth=0
|
2015-06-03 21:39:41 +00:00
|
|
|
"[Settings of line numbers]"
|
|
|
|
set number
|
|
|
|
set numberwidth=2
|
2017-10-19 05:09:25 +00:00
|
|
|
set relativenumber
|
2015-06-03 21:39:41 +00:00
|
|
|
"[Don't show current position]"
|
2015-08-08 20:44:49 +00:00
|
|
|
set ruler
|
2015-06-03 21:39:41 +00:00
|
|
|
"[For regular expressions turn magic on]"
|
|
|
|
set magic
|
|
|
|
"[Search settings]"
|
|
|
|
set hlsearch
|
|
|
|
set incsearch
|
|
|
|
set smartcase
|
|
|
|
set ignorecase
|
2017-04-27 17:36:45 +00:00
|
|
|
set wrapscan
|
2015-06-03 21:39:41 +00:00
|
|
|
"[When on, the ":substitute" flag 'g' is default on]"
|
|
|
|
set nogdefault
|
|
|
|
"[Language settings]"
|
|
|
|
set iminsert=0
|
|
|
|
set imsearch=0
|
|
|
|
set helplang=en
|
|
|
|
set langmenu=en
|
|
|
|
language messages POSIX
|
|
|
|
"[Show DocName in title]"
|
|
|
|
set title
|
|
|
|
"[Hide/show the white-space and more invisible symbols]"
|
|
|
|
set list
|
2017-09-11 17:10:23 +00:00
|
|
|
set listchars=nbsp:¬,tab:\|\ ,trail:-
|
2015-06-03 21:39:41 +00:00
|
|
|
set nojoinspaces
|
|
|
|
"[Folding settings]"
|
|
|
|
set foldenable
|
|
|
|
set foldclose=""
|
2017-09-11 17:10:23 +00:00
|
|
|
set foldcolumn=0
|
2018-04-30 14:09:44 +00:00
|
|
|
set foldlevel=99
|
|
|
|
set foldlevelstart=99
|
2015-06-03 21:39:41 +00:00
|
|
|
set foldmethod=indent
|
|
|
|
set foldopen=block,hor,mark,percent,quickfix,search,tag,undo
|
|
|
|
"[Set to auto-read and to auto-write when
|
|
|
|
" a file is changed from the outside]"
|
|
|
|
set autoread
|
|
|
|
set autowrite
|
|
|
|
"[Vim will change the current working directory whenever you
|
|
|
|
" open a file, switch buffers, delete a buffer or open/close a window]"
|
|
|
|
set autochdir
|
|
|
|
"[Not be redrawn while executing macros,
|
|
|
|
" registers that have not been typed]"
|
|
|
|
set lazyredraw
|
|
|
|
"[Time-out settings]"
|
|
|
|
set timeout
|
|
|
|
set timeoutlen=3000
|
|
|
|
set ttimeoutlen=100
|
|
|
|
"[When off a buffer is unloaded when it is abandoned]"
|
|
|
|
set hidden
|
|
|
|
"[Switch between buffers. Settings]"
|
|
|
|
set switchbuf=useopen,usetab,newtab
|
|
|
|
"[Wrap settings]"
|
|
|
|
set wrap
|
|
|
|
set whichwrap=<,>,[,]
|
|
|
|
set nolinebreak
|
|
|
|
"[Encoding/FileType settings]"
|
|
|
|
set encoding=utf-8
|
|
|
|
set termencoding=utf-8
|
|
|
|
set fileencoding=utf-8
|
2018-02-26 08:14:43 +00:00
|
|
|
set fileencodings=utf-8,latin1,cp1251,koi8-r,utf-16le
|
2015-06-03 21:39:41 +00:00
|
|
|
"[Use UNIX, DOS, MAC FileType]"
|
|
|
|
set fileformat=unix
|
|
|
|
set fileformats=unix,mac,dos
|
|
|
|
"[Better consistency between Windows and UNIX]"
|
|
|
|
set sessionoptions=""
|
|
|
|
set viewoptions=folds,options,cursor,unix,slash
|
|
|
|
set sessionoptions+=unix,slash,blank,buffers,curdir
|
|
|
|
set sessionoptions+=folds,help,options,tabpages,winsize
|
|
|
|
"[Completion settings]"
|
|
|
|
if has("autocmd")
|
2015-08-08 20:44:49 +00:00
|
|
|
autocmd FileType c set omnifunc=ccomplete#Complete
|
|
|
|
autocmd FileType css set omnifunc=csscomplete#CompleteCSS
|
|
|
|
autocmd FileType html set omnifunc=htmlcomplete#CompleteTags
|
|
|
|
if has("ruby")
|
|
|
|
autocmd FileType ruby set omnifunc=rubycomplete#Complete
|
|
|
|
endif
|
|
|
|
if has("perl")
|
|
|
|
autocmd FileType perl set omnifunc=perlcomplete#CompletePERL
|
|
|
|
endif
|
|
|
|
if has("python")
|
|
|
|
autocmd FileType python set omnifunc=pythoncomplete#Complete
|
|
|
|
endif
|
|
|
|
autocmd FileType javascript set omnifunc=javascriptcomplete#CompleteJS
|
2015-06-03 21:39:41 +00:00
|
|
|
endif
|
|
|
|
"[Completion search settings]"
|
|
|
|
set complete=.,b,d,i,k,s,t,u,U,w
|
|
|
|
set completeopt=longest,menuone,preview,menu
|
|
|
|
"[For jump between Java import statement]"
|
|
|
|
set includeexpr=substitute(v:fname,'\\.','/','g')
|
|
|
|
"[Determines the maximum number of items
|
|
|
|
" to show in the popup menu for Insert mode completion]"
|
|
|
|
set pumheight=7
|
|
|
|
"[No annoying sound or errors]"
|
|
|
|
set noerrorbells
|
|
|
|
set novisualbell
|
|
|
|
"[Shared with OS clipboard]"
|
|
|
|
set clipboard=unnamed
|
|
|
|
"[Abbreviations]"
|
|
|
|
cnoreabbrev W w
|
|
|
|
cnoreabbrev Q q
|
|
|
|
"[Turn on the wild menu and wild-mode settings]"
|
|
|
|
set wildmenu
|
|
|
|
set wildmode=list:longest,full
|
|
|
|
set wildignore=*.o,*.obj,*.pyc,*.pyo,*.swp,*.bak,*.exe,*.class
|
|
|
|
"[Use a GUI dialog when confirming]"
|
|
|
|
set confirm
|
|
|
|
"[Method used for encryption when the buffer is written to a file]"
|
|
|
|
if (version <= 702)
|
2015-08-08 20:44:49 +00:00
|
|
|
set cryptmethod=zip
|
|
|
|
else
|
|
|
|
set cryptmethod=blowfish
|
2015-06-03 21:39:41 +00:00
|
|
|
endif
|
|
|
|
"[Make the scripts executable]"
|
|
|
|
function! ChangeScriptMode()
|
2015-08-08 20:44:49 +00:00
|
|
|
if getline(1) =~ "#!"
|
|
|
|
if getline(1) =~ "bin/"
|
|
|
|
silent !chmod +x <afile>
|
|
|
|
endif
|
|
|
|
endif
|
2015-06-03 21:39:41 +00:00
|
|
|
endfunction
|
|
|
|
if has("unix") || has("mac")
|
2015-08-08 20:44:49 +00:00
|
|
|
if has("autocmd")
|
|
|
|
autocmd BufWritePost * call ChangeScriptMode()
|
|
|
|
endif
|
2015-06-03 21:39:41 +00:00
|
|
|
endif
|
|
|
|
"[Python/Perl scripts templates]"
|
|
|
|
function! InitScriptFile(type)
|
2015-08-08 20:44:49 +00:00
|
|
|
if (a:type == "python")
|
2017-10-26 15:57:35 +00:00
|
|
|
execute setline(1, "#!/usr/bin/env python3")
|
2015-08-08 20:44:49 +00:00
|
|
|
execute setline(2, "# -*- coding: utf-8 -*-")
|
|
|
|
elseif (a:type == "perl")
|
|
|
|
execute setline(1, "#!/usr/bin/env perl")
|
|
|
|
execute setline(2, "")
|
|
|
|
execute setline(3, "use warnings;")
|
|
|
|
execute setline(4, "use strict;")
|
|
|
|
endif
|
|
|
|
normal Go
|
2015-06-03 21:39:41 +00:00
|
|
|
endfunction
|
|
|
|
if has("autocmd")
|
2015-08-08 20:44:49 +00:00
|
|
|
autocmd BufNewFile *.pl,*.pm call InitScriptFile("perl")
|
|
|
|
autocmd BufNewFile *.py,*.pyw call InitScriptFile("python")
|
2015-06-03 21:39:41 +00:00
|
|
|
endif
|
|
|
|
"[Remove tabs and spaces at the end of lines]"
|
|
|
|
function! DeleteTrailingTWS()
|
2016-03-30 15:22:20 +00:00
|
|
|
if &ft =~ 'diff'
|
|
|
|
return
|
|
|
|
end
|
2015-08-08 20:44:49 +00:00
|
|
|
normal mb
|
|
|
|
silent %s/[ \t]*$//g
|
|
|
|
silent %s/\s\+$//ge
|
|
|
|
normal 'b
|
2015-06-03 21:39:41 +00:00
|
|
|
endfunction
|
2018-02-26 08:13:20 +00:00
|
|
|
"[Do not clean up trailing spaces in binary mode]"
|
|
|
|
if has("autocmd") && !&binary
|
2015-08-08 20:44:49 +00:00
|
|
|
autocmd BufWritePre *.py,*.pyw retab
|
|
|
|
autocmd BufWritePre * call DeleteTrailingTWS()
|
2015-06-03 21:39:41 +00:00
|
|
|
endif
|
2017-10-19 05:09:25 +00:00
|
|
|
"[Toggle relativenumber between normal & insert mode]"
|
|
|
|
"[Credit: https://jeffkreeftmeijer.com/vim-number/#relative-line-numbers ]"
|
|
|
|
if has("autocmd")
|
|
|
|
augroup numbertoggle
|
|
|
|
autocmd!
|
|
|
|
autocmd BufEnter,FocusGained,InsertLeave * set relativenumber
|
|
|
|
autocmd BufLeave,FocusLost,InsertEnter * set norelativenumber
|
|
|
|
augroup END
|
|
|
|
endif
|
2017-10-26 15:57:35 +00:00
|
|
|
"[ALELint & Lightline compat]"
|
|
|
|
function! LightlineLinterWarnings() abort
|
|
|
|
let l:counts = ale#statusline#Count(bufnr(''))
|
|
|
|
let l:all_errors = l:counts.error + l:counts.style_error
|
|
|
|
let l:all_non_errors = l:counts.total - l:all_errors
|
|
|
|
return l:counts.total == 0 ? '' : printf('%d ◆', all_non_errors)
|
|
|
|
endfunction
|
|
|
|
|
|
|
|
function! LightlineLinterErrors() abort
|
|
|
|
let l:counts = ale#statusline#Count(bufnr(''))
|
|
|
|
let l:all_errors = l:counts.error + l:counts.style_error
|
|
|
|
let l:all_non_errors = l:counts.total - l:all_errors
|
|
|
|
return l:counts.total == 0 ? '' : printf('%d ✗', all_errors)
|
|
|
|
endfunction
|
|
|
|
|
|
|
|
function! LightlineLinterOK() abort
|
|
|
|
let l:counts = ale#statusline#Count(bufnr(''))
|
|
|
|
let l:all_errors = l:counts.error + l:counts.style_error
|
|
|
|
let l:all_non_errors = l:counts.total - l:all_errors
|
|
|
|
return l:counts.total == 0 ? '✓ ' : ''
|
|
|
|
endfunction
|
|
|
|
|
2018-02-26 08:13:20 +00:00
|
|
|
function! LineInfo()
|
|
|
|
return !&binary ? '%3l:%-2v' : '%3l:%-2v off:%o,0x%O'
|
|
|
|
endfunction
|
|
|
|
|
2017-10-26 15:57:35 +00:00
|
|
|
autocmd User ALELint call s:MaybeUpdateLightline()
|
|
|
|
|
|
|
|
" Update and show lightline but only if it's visible (e.g., not in Goyo)
|
|
|
|
function! s:MaybeUpdateLightline()
|
|
|
|
if exists('#lightline')
|
|
|
|
call lightline#update()
|
|
|
|
end
|
|
|
|
endfunction
|