Advertisement
Guest User

vimrc

a guest
Mar 12th, 2019
69
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
VIM 4.82 KB | None | 0 0
  1. set nocompatible
  2.  
  3. " set up true colors
  4. set term=screen-256color
  5. if &term =~# '^screen'
  6.     let &t_8f = "\<Esc>[38;2;%lu;%lu;%lum"
  7.     let &t_8b = "\<Esc>[48;2;%lu;%lu;%lum"
  8. endif
  9.  
  10. filetype off
  11. execute pathogen#infect()
  12. execute pathogen#helptags()
  13. syntax on
  14. filetype plugin on
  15. set omnifunc=syntaxcomplete#Complete
  16.  
  17. " color scheme config...
  18. set background=dark
  19. colorscheme monokai
  20. set termguicolors
  21.  
  22. let mapleader = " "
  23. nnoremap <SPACE> <Nop>
  24.  
  25. " other vim options
  26. " set modelines=0
  27. set encoding=utf-8
  28. set scrolloff=3
  29. set autoindent
  30. set smartindent
  31. set showcmd
  32. set wildmenu
  33. set wildmode=list:longest
  34. set visualbell
  35. set cursorline
  36. set ttyfast
  37. set ruler
  38. set backspace=indent,eol,start
  39. set laststatus=2
  40. "set wrap
  41. set textwidth=79
  42. set formatoptions=qrn1
  43. set ignorecase
  44. set smartcase
  45. set gdefault
  46. set incsearch
  47. set showmatch
  48. set hlsearch
  49. set noshowmode " because Lightline already shows mode
  50. set clipboard=unnamed
  51.  
  52. " Basic fzf support
  53. set rtp+=/usr/local/opt/fzf
  54.  
  55. " make splits open downward and to the right
  56. " depending on vertical/horizontal splitting respectively.
  57. set splitbelow
  58. set splitright
  59.  
  60. set noshowmatch
  61.  
  62. " indent options
  63. set tabstop=4
  64. set shiftwidth=4
  65. set softtabstop=4
  66. set expandtab
  67.  
  68. " Line numbers.
  69. " relative is relative to current line.
  70. " number is absolute numbers
  71. "set relativenumber
  72. set number
  73.  
  74. " spellcheck
  75. "set spell spelllang=en_gb
  76.  
  77. " toggle search highlights
  78. nnoremap <BSlash> :noh <CR>
  79.  
  80. nnoremap j gj
  81. nnoremap k gk
  82.  
  83. " SLIME-V config
  84. let g:slime_target="vimterminal"
  85. let g:slime_vimterminal_config={ "vertical": 1  }
  86.  
  87. " PYMODE config
  88. let g:pymode_breakpoint=0
  89. let g:pymode_python="python3"
  90.  
  91. " disable annoying remaps for paredit.vim
  92. let g:paredit_leader = '<leader>'
  93. let g:paredit_shortmaps=0
  94.  
  95. set completeopt=longest,menuone,preview
  96. " change the behavior of the <Enter> key when the popup menu is visible. In that case the Enter key will simply select the highlighted menu item, just as <C-Y> does.
  97. inoremap <expr> <CR> pumvisible() ? "\<C-y>" : "\<C-g>u\<CR>"
  98.  
  99. " fzf bindings:
  100. " fzf for buffers and files respectively.
  101. nmap <Leader>b :Buffers<CR>
  102. nmap <Leader>f :Files<CR>
  103. " ... and hopefully respect gitignore.
  104. let $FZF_DEFAULT_COMMAND = 'ag -g ""'
  105.  
  106. " Rainbow parens
  107. au VimEnter * RainbowParenthesesToggle
  108. au Syntax * RainbowParenthesesLoadRound
  109. au Syntax * RainbowParenthesesLoadSquare
  110. au Syntax * RainbowParenthesesLoadBraces
  111.  
  112. " ALE code linting
  113. let g:ale_sign_column_always = 1
  114. let g:ale_completion_enabled = 1
  115. let g:ale_sign_error = 'E'
  116. let g:ale_sign_warning = 'W'
  117. let g:ale_lint_on_text_changed = 'never'
  118.  
  119. " LIGHTLINE SETUP
  120. let g:lightline = {
  121. \ 'colorscheme': 'powerline',
  122. \ 'active': {
  123. \   'left': [['mode', 'paste'], ['filename', 'modified']],
  124. \   'right': [['linter_ok', 'linter_warnings', 'linter_errors'], ['readonly', 'lineinfo'], ['percent']]
  125. \ },
  126. \ 'component_expand': {
  127. \   'linter_warnings': 'LightlineLinterWarnings',
  128. \   'linter_errors': 'LightlineLinterErrors',
  129. \   'linter_ok': 'LightlineLinterOK'
  130. \ },
  131. \ 'component_type': {
  132. \   'readonly': 'error',
  133. \   'linter_warnings': 'warning',
  134. \   'linter_errors': 'error',
  135. \   'linter_ok': 'ok'
  136. \ },
  137. \ }
  138.  
  139. " Lightline settings for ALE
  140. " good info here: https://github.com/itchyny/lightline.vim/issues/236
  141. function! LightlineLinterWarnings() abort
  142.   let l:counts = ale#statusline#Count(bufnr(''))
  143.   let l:all_errors = l:counts.error + l:counts.style_error
  144.   let l:all_non_errors = l:counts.total - l:all_errors
  145.   return l:counts.total == 0 ? '' : printf('%d ▲', all_non_errors)
  146. endfunction
  147.  
  148. function! LightlineLinterErrors() abort
  149.   let l:counts = ale#statusline#Count(bufnr(''))
  150.   let l:all_errors = l:counts.error + l:counts.style_error
  151.   let l:all_non_errors = l:counts.total - l:all_errors
  152.   return l:counts.total == 0 ? '' : printf('%d ✗', all_errors)
  153. endfunction
  154.  
  155. function! LightlineLinterOK() abort
  156.   let l:counts = ale#statusline#Count(bufnr(''))
  157.   let l:all_errors = l:counts.error + l:counts.style_error
  158.   let l:all_non_errors = l:counts.total - l:all_errors
  159.   return l:counts.total == 0 ? '✓' : ''
  160. endfunction
  161.  
  162. autocmd User ALELint call lightline#update()
  163.  
  164. " Navigating location list
  165. nnoremap <Leader>n :call WrapCommand("down")<CR>
  166. nnoremap <Leader>p :call WrapCommand("up")<CR>
  167.  
  168. function! WrapCommand(direction)
  169.   if a:direction == "up"
  170.     try
  171.       lprevious
  172.     catch /^Vim\%((\a\+)\)\=:E553/
  173.       llast
  174.     endtry
  175.   elseif a:direction == "down"
  176.     try
  177.       lnext
  178.     catch /^Vim\%((\a\+)\)\=:E553/
  179.       lfirst
  180.     endtry
  181.   endif
  182. endfunction
  183.  
  184. " call Piggieback for figwheel dev
  185. command! Pig :Piggieback (figwheel-sidecar.repl-api/repl-env)
  186.  
  187. " vim-fireplace binds
  188. nnoremap <Leader>t :RunTests<CR>
  189. nnoremap <Leader>e :Eval<CR>
  190. nnoremap <Leader>E :%Eval<CR>
  191. nnoremap <Leader>l :Last<CR>
  192. nnoremap <Leader>c :clo<CR>
  193. nnoremap <Leader>d :bd<CR>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement