2012-10-13 01:02:44 +02:00
|
|
|
set nocompatible
|
|
|
|
|
2019-04-08 19:11:21 +02:00
|
|
|
" XDG
|
|
|
|
set undodir=$XDG_CACHE_HOME/vim/undo
|
|
|
|
set directory=$XDG_CACHE_HOME/vim/swap
|
2019-04-15 13:59:06 +02:00
|
|
|
set backupdir=$XDG_CACHE_HOME/vim/backup//
|
2019-04-08 19:11:21 +02:00
|
|
|
set viminfo+='1000,n$XDG_CACHE_HOME/vim/viminfo
|
|
|
|
set runtimepath=$XDG_CONFIG_HOME/vim,$VIMRUNTIME,$XDG_CONFIG_HOME/vim/after
|
|
|
|
|
|
|
|
let g:session_directory=$XDG_CACHE_HOME."/vim/sessions"
|
|
|
|
|
|
|
|
for directory in [&undodir, &directory, &backupdir, g:session_directory]
|
|
|
|
if !filewritable(expand(directory))
|
|
|
|
call mkdir(expand(directory), "p")
|
|
|
|
endif
|
|
|
|
endfor
|
|
|
|
|
2012-10-13 01:02:44 +02:00
|
|
|
" VUNDLE
|
|
|
|
" {
|
2019-04-08 19:11:21 +02:00
|
|
|
let bundledir=$XDG_CONFIG_HOME."/vim/bundle/"
|
|
|
|
|
|
|
|
if filereadable(expand(bundledir."vundle/README.md"))
|
2012-11-30 15:37:40 +01:00
|
|
|
filetype off " required!
|
|
|
|
|
2019-04-08 19:11:21 +02:00
|
|
|
let &rtp=&rtp.",".bundledir."vundle/"
|
|
|
|
call vundle#begin(bundledir)
|
2012-11-30 15:37:40 +01:00
|
|
|
|
|
|
|
" let Vundle manage Vundle
|
|
|
|
" required!
|
2014-07-07 14:46:40 +02:00
|
|
|
Plugin 'gmarik/vundle'
|
|
|
|
|
|
|
|
Plugin 'xolox/vim-misc'
|
|
|
|
Plugin 'xolox/vim-session'
|
|
|
|
Plugin 'vim-ruby/vim-ruby'
|
|
|
|
Plugin 'tpope/vim-rails'
|
|
|
|
Plugin 'tpope/vim-markdown'
|
2021-07-08 21:05:59 +02:00
|
|
|
Plugin 'tpope/vim-endwise'
|
2014-07-07 14:46:40 +02:00
|
|
|
|
2021-07-08 21:05:59 +02:00
|
|
|
Plugin 'jiangmiao/auto-pairs'
|
2019-04-30 08:44:45 +02:00
|
|
|
|
2021-07-08 21:05:59 +02:00
|
|
|
Plugin 'tpope/vim-haml'
|
2014-10-09 14:36:35 +02:00
|
|
|
Plugin 'slim-template/vim-slim'
|
2021-07-08 21:05:59 +02:00
|
|
|
Plugin 'lumiliet/vim-twig'
|
2014-10-09 14:36:35 +02:00
|
|
|
|
2014-07-07 14:46:40 +02:00
|
|
|
Plugin 'Sirver/ultisnips'
|
|
|
|
Plugin 'honza/vim-snippets'
|
|
|
|
|
|
|
|
Plugin 'ton/vim-bufsurf'
|
2018-06-07 10:52:52 +02:00
|
|
|
Plugin 'bsdelf/bufferhint'
|
|
|
|
|
2014-07-07 14:46:40 +02:00
|
|
|
Plugin 'AndrewRadev/switch.vim'
|
|
|
|
|
|
|
|
Plugin 'airblade/vim-gitgutter'
|
|
|
|
Plugin 'tpope/vim-fugitive'
|
2021-07-08 21:05:59 +02:00
|
|
|
" Plugin 'scrooloose/syntastic'
|
|
|
|
Plugin 'dense-analysis/ale'
|
2014-07-07 14:46:40 +02:00
|
|
|
|
2016-11-17 15:15:06 +01:00
|
|
|
Plugin 'sjl/gundo.vim'
|
2019-04-09 15:51:44 +02:00
|
|
|
Plugin 'tpope/vim-commentary'
|
2016-11-17 15:15:06 +01:00
|
|
|
|
2021-07-08 21:05:59 +02:00
|
|
|
Plugin 'moll/vim-bbye'
|
|
|
|
|
2014-07-07 14:46:40 +02:00
|
|
|
Plugin 'VisIncr'
|
2019-04-08 19:11:21 +02:00
|
|
|
|
|
|
|
call vundle#end()
|
2012-11-30 15:37:40 +01:00
|
|
|
endif
|
2012-10-13 01:02:44 +02:00
|
|
|
" }
|
|
|
|
|
|
|
|
filetype plugin indent on
|
|
|
|
syntax enable
|
|
|
|
|
2013-02-06 17:40:03 +01:00
|
|
|
set t_Co=256
|
|
|
|
|
2012-10-13 01:02:44 +02:00
|
|
|
set background=dark
|
|
|
|
colorscheme desert
|
|
|
|
|
2013-10-22 17:08:48 +02:00
|
|
|
set number
|
2012-12-14 15:22:26 +01:00
|
|
|
set relativenumber
|
2012-10-13 01:02:44 +02:00
|
|
|
set showmode
|
|
|
|
set expandtab
|
2013-01-29 11:20:30 +01:00
|
|
|
set shiftwidth=2
|
2012-10-13 01:02:44 +02:00
|
|
|
set smarttab
|
|
|
|
|
|
|
|
set autoindent
|
|
|
|
set nowrap
|
2013-11-08 10:52:51 +01:00
|
|
|
set gdefault
|
2012-10-13 01:02:44 +02:00
|
|
|
|
2013-02-06 17:38:45 +01:00
|
|
|
set hidden
|
2013-06-18 16:31:54 +02:00
|
|
|
set switchbuf=useopen,usetab
|
2012-10-13 01:02:44 +02:00
|
|
|
set ruler
|
|
|
|
set showcmd
|
|
|
|
set fileencoding=utf-8
|
|
|
|
set fileformats=unix,dos,mac
|
|
|
|
set cmdheight=2
|
|
|
|
set noerrorbells
|
|
|
|
set mouse=a
|
|
|
|
set nohls
|
2013-10-22 17:08:48 +02:00
|
|
|
set scrolloff=5
|
|
|
|
set sidescroll=20
|
|
|
|
set sidescrolloff=20
|
2012-10-13 01:02:44 +02:00
|
|
|
set noincsearch
|
|
|
|
set noshowmatch
|
2013-07-11 16:46:58 +02:00
|
|
|
set colorcolumn=80
|
2012-10-13 01:02:44 +02:00
|
|
|
|
2013-10-22 17:08:48 +02:00
|
|
|
set listchars=nbsp:·,tab:▸\ ,extends:>,precedes:<
|
2012-10-13 01:02:44 +02:00
|
|
|
set list
|
|
|
|
|
2013-10-22 17:08:48 +02:00
|
|
|
set formatoptions+=j
|
|
|
|
|
|
|
|
set splitright splitbelow
|
2012-10-13 01:02:44 +02:00
|
|
|
|
|
|
|
set wildmenu
|
|
|
|
set wildmode=longest:full,full
|
|
|
|
set wildignore=*~,*.o,*.obj,*.bak,*.exe,*.class,*.jpg,*.png,*.gif,*.mp3
|
2019-04-25 13:11:08 +02:00
|
|
|
set wildignorecase
|
2012-10-13 01:02:44 +02:00
|
|
|
|
2012-10-19 15:27:10 +02:00
|
|
|
set laststatus=2
|
2013-03-06 16:48:39 +01:00
|
|
|
set statusline=%f\ %m\ %Y\|%{&ff}\|%{&fileencoding}%=%vx%l\ [%03L]
|
2012-10-13 01:02:44 +02:00
|
|
|
|
|
|
|
set nocursorline
|
|
|
|
set nocursorcolumn
|
|
|
|
|
|
|
|
set pastetoggle=<F2>
|
|
|
|
|
|
|
|
set history=100
|
|
|
|
set undolevels=150
|
|
|
|
|
2013-07-11 16:46:58 +02:00
|
|
|
set ttimeoutlen=100
|
|
|
|
|
2012-11-06 17:06:57 +01:00
|
|
|
set undofile
|
2012-10-13 01:02:44 +02:00
|
|
|
set backup
|
|
|
|
|
|
|
|
let mapleader = ","
|
|
|
|
|
2018-06-07 10:52:52 +02:00
|
|
|
let g:bufferhint_MaxWidth = 200
|
|
|
|
|
2012-10-13 01:02:44 +02:00
|
|
|
" FOLDING
|
|
|
|
" {
|
2012-10-19 15:27:10 +02:00
|
|
|
set foldenable
|
|
|
|
set foldmethod=syntax
|
|
|
|
" Number of columns to the left of the window to display folds
|
|
|
|
set foldcolumn=0
|
|
|
|
" Fold level to close when opening a file
|
|
|
|
set foldlevelstart=100
|
|
|
|
|
|
|
|
" Don't open folds when searching or undoing into them
|
|
|
|
set foldopen-=search
|
|
|
|
set foldopen-=undo
|
2012-10-13 01:02:44 +02:00
|
|
|
" }
|
|
|
|
|
|
|
|
" MAPPING
|
|
|
|
" {
|
2012-10-19 15:29:41 +02:00
|
|
|
map <F1> <ESC>
|
|
|
|
imap <F1> <ESC>
|
2012-10-13 01:02:44 +02:00
|
|
|
|
|
|
|
map <F5> <ESC>:GundoToggle<CR>
|
|
|
|
|
|
|
|
map <F11> :!ctags -R --c++-kinds=+p --fields=+iaS --extra=+q .<CR>
|
2013-09-09 17:58:37 +02:00
|
|
|
map <F12> ggg?G
|
2012-12-14 15:22:26 +01:00
|
|
|
|
2014-07-07 14:46:40 +02:00
|
|
|
nnoremap <silent> gy :Switch<CR>
|
|
|
|
|
2013-02-06 17:38:45 +01:00
|
|
|
nnoremap <silent> ,bp :bprevious<CR>
|
|
|
|
nnoremap <silent> ,bf :bnext<CR>
|
|
|
|
nnoremap <silent> ,Bp :BufSurfBack<CR>
|
|
|
|
nnoremap <silent> ,Bf :BufSurfForward<CR>
|
2013-03-07 14:38:49 +01:00
|
|
|
|
2018-06-07 10:52:52 +02:00
|
|
|
nnoremap <Leader>- :call bufferhint#Popup()<CR>
|
|
|
|
nnoremap <Leader>\ :call bufferhint#LoadPrevious()<CR>
|
|
|
|
|
2013-03-07 14:38:49 +01:00
|
|
|
" delete into the black hole register
|
|
|
|
nnoremap <leader>d "_d
|
2012-10-13 01:02:44 +02:00
|
|
|
" }
|
|
|
|
|
|
|
|
" PLUGINS
|
|
|
|
" {
|
2016-11-17 15:15:06 +01:00
|
|
|
let g:gundo_prefer_python3 = 1
|
2013-04-02 09:22:12 +02:00
|
|
|
" gitgutter
|
2014-07-07 14:46:40 +02:00
|
|
|
let g:gitgutter_realtime = 0
|
|
|
|
let g:gitgutter_eager = 0
|
|
|
|
" UltiSnips
|
|
|
|
let g:UltiSnipsExpandTrigger="<tab>"
|
|
|
|
let g:UltiSnipsJumpForwardTrigger="<tab>"
|
2012-10-13 01:02:44 +02:00
|
|
|
" Session
|
|
|
|
let g:session_autoload = 'no'
|
|
|
|
let g:session_autosave = 'no'
|
|
|
|
|
2013-11-13 11:23:44 +01:00
|
|
|
autocmd FileType ruby let b:switch_custom_definitions =
|
|
|
|
\ [
|
|
|
|
\ {
|
|
|
|
\ 'lambda { |\([^|]\+\)|': '->(\1) {',
|
|
|
|
\ '->(\([^)]\+\)) {': 'lambda { |\1|',
|
|
|
|
\ },
|
|
|
|
\ ]
|
2012-10-13 01:02:44 +02:00
|
|
|
" }
|
|
|
|
|
|
|
|
" FILETYPES
|
|
|
|
" {
|
|
|
|
" Open PDF files
|
2012-10-19 15:27:10 +02:00
|
|
|
" need xpdf and cups-pdf
|
2012-10-13 01:02:44 +02:00
|
|
|
autocmd BufReadPre *.pdf set ro nowrap
|
|
|
|
autocmd BufReadPost *.pdf silent %!pdftotext "%" -nopgbrk -layout -q -eol unix -
|
|
|
|
autocmd BufWritePost *.pdf silent !rm -rf ~/Documents/%
|
|
|
|
autocmd BufWritePost *.pdf silent !lp -s -d pdffg "%"
|
|
|
|
autocmd BufWritePost *.pdf silent !until [ -e ~/Documents/% ]; do sleep 1; done
|
|
|
|
autocmd BufWritePost *.pdf silent !mv ~/Documents/% %:p:h
|
|
|
|
|
|
|
|
" PHP
|
|
|
|
let php_sql_query = 1
|
|
|
|
let php_htmlInStrings = 1
|
|
|
|
|
2019-04-25 13:11:31 +02:00
|
|
|
autocmd FileType php setlocal shiftwidth=4 tabstop=4
|
2012-10-13 01:02:44 +02:00
|
|
|
|
2013-03-20 17:38:19 +01:00
|
|
|
" Don't screw up folds when inserting text that might affect them, until
|
|
|
|
" leaving insert mode. Foldmethod is local to the window.
|
|
|
|
autocmd InsertEnter * let w:last_fdm=&foldmethod | setlocal foldmethod=manual
|
|
|
|
autocmd InsertLeave * let &l:foldmethod=w:last_fdm
|
|
|
|
|
2012-10-13 01:02:44 +02:00
|
|
|
" chmod +x on the file if it starts with a shebang
|
|
|
|
function! ModeChange()
|
|
|
|
if getline(1) =~ "^#!"
|
|
|
|
if getline(1) =~ "/bin/"
|
|
|
|
silent !chmod a+x <afile>
|
|
|
|
endif
|
|
|
|
endif
|
|
|
|
endfunction
|
|
|
|
|
|
|
|
au BufWritePost * call ModeChange()
|
|
|
|
" }
|
|
|
|
|
|
|
|
" FUNCTIONS
|
|
|
|
" {
|
|
|
|
" }
|
|
|
|
|
|
|
|
" MISC
|
|
|
|
" {
|
2013-03-06 13:38:49 +01:00
|
|
|
" Required for vim-gitgutter signcolumn
|
|
|
|
highlight clear SignColumn
|
2012-10-13 01:02:44 +02:00
|
|
|
" Every spaces/tabs at the end of line will be highlighted.
|
|
|
|
au BufWinEnter * let w:m2=matchadd('ErrorMsg', '\s\+$', -1)
|
|
|
|
" autocmd BufWrite * silent! %s/[\r \t]\+$//
|
2012-12-14 15:22:26 +01:00
|
|
|
|
2014-07-07 14:46:40 +02:00
|
|
|
"autocmd WinLeave * :call FocusLost()
|
|
|
|
"autocmd WinEnter * :call FocusGained()
|
2012-10-13 01:02:44 +02:00
|
|
|
" }
|