Skip to content

Instantly share code, notes, and snippets.

@revington
Last active January 20, 2020 09:47
Show Gist options
  • Save revington/4b574853864840342b5901798aefa0e2 to your computer and use it in GitHub Desktop.
Save revington/4b574853864840342b5901798aefa0e2 to your computer and use it in GitHub Desktop.
vimrc
syntax on
filetype plugin indent on
let g:ale_fixers = {'php': ['phpcs --standard=PSR2']}
let g:ale_echo_msg_error_str = 'E'
let g:ale_echo_msg_warning_str = 'W'
let g:ale_echo_msg_format = '[%linter%] %s [%severity%]'
let g:erl_author="Pedro Narciso García Revington"
set spelllang=en
set number
let mapleader = ","
set history=1000
set ignorecase
set smartcase
set title
set ruler
set backupdir=~/.vim-tmp,~/.tmp,~/tmp,/var/tmp,/tmp
set directory=~/.vim-tmp,~/.tmp,~/tmp,/var/tmp,/tmp
" Allow switching edited buffers without saving
set hidden
set wildmenu
set showcmd
set cursorline
" set foldmethod=indent
set spellfile=~/.vim/dict.add
" Escape <esc> delays https://www.johnhawthorn.com/2012/09/vi-escape-delays/
set timeoutlen=1000 ttimeoutlen=0
" Intuitive backspacing in insert mode
set backspace=indent,eol,start
" improve highligth performance
set nocursorcolumn
set nocursorline
set norelativenumber
syntax sync minlines=256
" Highlight search terms...
set hlsearch
set incsearch " ...dynamically as they are typed.
set visualbell
au BufNewFile,BufRead *.json set filetype=json
au BufNewFile,BufRead *.erl set filetype=erlang
"autocmd Filetype javascript set ts=4 shiftwidth=4 expandtab autoindent fileformat=unix
autocmd Filetype pug set tabstop=4 shiftwidth=4 noexpandtab autoindent fileformat=unix
autocmd Filetype erlang set ts=4 shiftwidth=4 expandtab autoindent fileformat=unix
autocmd Filetype sh set ts=4 shiftwidth=2 expandtab fileformat=unix
autocmd Filetype php set ts=4 shiftwidth=4 expandtab fileformat=unix
let g:vim_json_syntax_conceal = 0
set background=dark
colorscheme inkpot
map <silent> <leader>ff :Autoformat
execute pathogen#infect()
"hi Normal ctermbg=none
" load airline
set laststatus=2
"set ttimeoutlen=50
"let g:airline_theme='dark'
set term=rxvt-unicode-256color
set nofoldenable " disable folding
set paste
" rust autocompletion
"let g:ycm_rust_src_path = "/home/pedro/Documents/work/mozilla/rust/src"
" fzf
" maps to buffers
nmap ; :Buffers<CR>
" maps files
nmap <Leader>t :Files<CR>
" maps tags
nmap <Leader>r :Tags<CR>
" Put these lines at the very end of your vimrc file.
" Load all plugins now.
" Plugins need to be added to runtimepath before helptags can be generated.
packloadall
" Load all of the helptags now, after plugins have been loaded.
" All messages and errors will be ignored.
silent! helptags ALL
" ack.vim use ag
if executable('ag')
let g:ackprg = 'ag --vimgrep'
endif
" vim gitgutter sign column
set signcolumn=yes
" This is regular lightline configuration, we just added
" 'linter_warnings', 'linter_errors' and 'linter_ok' to
" the active right panel. Feel free to move it anywhere.
" `component_expand' and `component_type' are required.
"
" For more info on how this works, see lightline documentation.
let g:lightline = {
\ 'active': {
\ 'right': [ [ 'lineinfo' ],
\ [ 'percent' ],
\ [ 'linter_warnings', 'linter_errors', 'linter_ok' ],
\ [ 'fileformat', 'fileencoding', 'filetype' ] ]
\ },
\ 'component_expand': {
\ 'linter_warnings': 'LightlineLinterWarnings',
\ 'linter_errors': 'LightlineLinterErrors',
\ 'linter_ok': 'LightlineLinterOK'
\ },
\ 'component_type': {
\ 'linter_warnings': 'warning',
\ 'linter_errors': 'error',
\ 'linter_ok': 'ok'
\ },
\ }
autocmd User ALELint call lightline#update()
" ale + lightline
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
let g:lightline = {
\ 'active': {
\ 'left': [ [ 'mode', 'paste' ],
\ [ 'gitbranch', 'readonly', 'filename', 'modified' ] ]
\ },
\ 'component_function': {
\ 'gitbranch': 'gitbranch#name'
\ },
\ }
hi Normal guibg=NONE ctermbg=NONE
" python shit
au BufNewFile,BufRead *.py
\ set tabstop=4
\ set softtabstop=4
\ set shiftwidth=4
\ set textwidth=79
\ set expandtab
\ set autoindent
\ set fileformat=unix
au BufRead,BufNewFile *.py,*.pyw,*.c,*.h match BadWhitespace /\s\+$/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment