1. Rob Allen
  2. dotvim

Commits

Rob Allen  committed 1a0701b

More updates to suit how I use it now

  • Participants
  • Parent commits d8c5cb7
  • Branches master

Comments (0)

Files changed (7)

File UltiSnips/perl.snippets

View file
  • Ignore whitespace
+
+snippet dt "Debug"  !b
+::debug($1, true);
+
+endsnippet
+
+snippet d "Debug"  !b
+::debug($1, '$2');
+
+endsnippet
+
+snippet package "Perl package skeleton" !b
+package $1;
+
+use strict;
+use warnings FATAL => 'all';
+use 5.14.0;
+use utf8;
+use Carp;
+
+use Common;
+use Choice::ChoiceMapper;
+use User::UserMapper;
+
+
+sub $2
+{
+    
+}
+
+
+1;
+
+endsnippet

File after/ftplugin/qf.vim

View file
  • Ignore whitespace
+
+" o to open file, but stay in quick fix window
+nnoremap <buffer> o <CR><C-W><C-P>
+
+" nnoremap <CR> <CR><C-W><C-P>
+

File colors/rka.vim

View file
  • Ignore whitespace
 hi Normal       guifg=#000000 guibg=#FFFFFF
 
 " {{{ Cursor
-hi Cursor		guibg=#444454 guifg=#F8F8FF
+hi Cursor		ctermbg=238 ctermfg=255 guibg=#444444 guifg=#F8F8FF
 hi CursorLine   guibg=#EEEEEE
 hi CursorColumn	guibg=#E8E8EE
 " }}}
 hi Folded		guifg=#808080 guibg=#ECECEC gui=none
 hi FoldeColumn  guifg=#808080 guibg=#ECECEC gui=none
 
-hi VertSplit	guibg=#bbbbbb guifg=#bbbbbb gui=none
-hi StatusLine   guibg=#bbbbbb guifg=#404040 gui=none
-hi StatusLineNC guibg=#d4d4d4 guifg=#404040 gui=italic
+" hi VertSplit	guibg=#bbbbbb guifg=#bbbbbb gui=none
+" hi StatusLine   guibg=#bbbbbb guifg=#404040 gui=none
+" hi StatusLineNC guibg=#d4d4d4 guifg=#404040 gui=italic
 " }}}
 
 " {{{ Misc

File colors/rka2.vim

View file
  • Ignore whitespace
 hi Normal       guifg=#000000 guibg=#FFFFFF
 
 " {{{ Cursor
-hi Cursor		guibg=#444454 guifg=#F8F8FF
+hi Cursor		guibg=#444454 guifg=#F8F8FF   ctermfg=black ctermbg=white
 hi CursorLine   guibg=#EEEEEE
 hi CursorColumn	guibg=#E8E8EE
 " }}}
 hi Folded		guifg=#808080 guibg=#ECECEC gui=none
 hi FoldeColumn  guifg=#808080 guibg=#ECECEC gui=none
 
-hi VertSplit	guibg=#bbbbbb guifg=#bbbbbb gui=none
-hi StatusLine   guibg=#bbbbbb guifg=#404040 gui=none
-hi StatusLineNC guibg=#d4d4d4 guifg=#404040 gui=italic
+hi StatusLine   guifg=DarkGreen ctermfg=8 guibg=White ctermbg=15
+hi StatusLineNC guifg=Black ctermfg=0 guibg=White ctermbg=15
+
 " }}}
 
 " {{{ Misc

File ftplugin/perl.vim

View file
  • Ignore whitespace
 set noexpandtab                       " Tabs are tabs, not spaces
 set tabstop=8                         " Tabs are 8 spaces though
 set softtabstop=4                     " Let backspace delete spaced indent
+
+
+let perl_include_pod   = 1    "include pod.vim syntax file with perl.vim"
+let perl_extended_vars = 1    "highlight complex expressions such as @{[$x, $y]}"
+let perl_sync_dist     = 250  "use more context for highlighting"
+
+
+" autocmd FileType pl set omnifunc=perlcomplete#OmniPerl_Complete
+" :au! CursorHold * nested call PreviewWord()
+
+
+" function! SmartComplete ()
+" " Remember where we parked...
+" let cursorpos = getpos('.')
+" let cursorcol = cursorpos[2]
+" let curr_line = getline('.')
+"
+" " Special subpattern to match only at cursor position...
+" let curr_pos_pat = '\%' . cursorcol . 'c'
+"
+" " Tab as usual at the left margin...
+" if curr_line =~ '^\s*' . curr_pos_pat
+" return "\<TAB>"
+" endif
+"
+" " If no contextual match and after an identifier, do keyword completion...
+" if curr_line =~ '\k' . curr_pos_pat
+" return "\<C-N>"
+"
+" " Otherwise, just be a ...
+" endif
+" if curr_line =~ '\(\->\|::\)' . curr_pos_pat
+" return "\<C-X>\<C-O>"
+" else
+" return "\<TAB>"
+" endif
+" endfunction
+"
+" " Remap for smart completion on various characters...
+" "inoremap <tab> :call SmartComplete()<CR>

File gvimrc

View file
  • Ignore whitespace
   " Open new window via cmd+shift+n
   macmenu File.New\ Window key=<D-N>
 
+  " Shift arrows to select
+  let macvim_hig_shift_movement = 1
+
+  " Automatically resize splits when resizing MacVim window
+  autocmd VimResized * wincmd =
 
   " "http://stackoverflow.com/questions/14802689/macvim-wont-load-specific-color-scheme-by-default
-  " let g:molokai_original=1
-  " colorscheme molokai
   " highlight SignColumn guibg=#272822
-
   set guifont=Menlo:h12
+  colorscheme rka2
 
   " Open goto file
   nmap <D-t> :CtrlP<cr>

File vimrc

View file
  • Ignore whitespace
 Plugin 'DetectIndent'
 Plugin 'mikehaertl/pdv-standalone'
 Plugin 'maxbrunsfeld/vim-yankstack'
+" Plugin 'omniperl'
+Plugin 'ervandew/supertab'
+Plugin 'vim-perl/vim-perl'
 
 " PHP syntax highlighting for 5.4, 5.5+
 Plugin 'StanAngeloff/php.vim'
 "Improved PHP omnicompletion
 Plugin 'shawncplus/phpcomplete.vim'
 
+Plugin 'mileszs/ack.vim'
+
 " =========================================================================
 " Settings
 " =========================================================================
 filetype plugin indent on               " Automatically detect file types.
 let mapleader = ","                     " Set mapleader to ","
 
+
+set omnifunc=syntaxcomplete#Complete    " Omni completion
+
 set autoindent                          " Indent at the same level of the previous line
 set autowrite                           " Automatically save before :next, :make etc.
 set autoread                            " Automatically reread changed files without asking me anything
 set ttimeout                            " Enable time out on :mappings and key codes
 set ttimeoutlen=100                     " Timeout for key codes
 set undolevels=1000                     " Many levels of undo
-set virtualedit=all                     " allow for cursor beyond last character
+"set virtualedit=all                     " allow for cursor beyond last character
 set nofoldenable                        " Turn off code folding
 set t_Co=256                            " Colours on a terminal
 
 set wildmenu                            " show list instead of just completing
-set wildmode=list:longest               " <Tab> completion: list matches, then longest common part
+set wildmode=list:longest,full          " <Tab> completion: list matches, then longest common part
 set wildignore+=*/tmp/*,*.so,*.swp,*.zip,*.pdf,*.phar,*.class,*.pyc,*.bak
 
 " tab settings
 
 " List characters: nothing for tab, · for trailing chars
 set list
-set listchars=tab:\ \ ,trail:·,extends:>,precedes:<,nbsp:+
+set listchars=tab:\\ ,trail:·,extends:>,precedes:<,nbsp:+
 
 " Directories for swp & backup files
 set backupdir=~/.vim.backup
 endif
 set sessionoptions-=options
 
-" Colour scheme
-silent color rka2
-
 " Status line
-function! InsertStatuslineColor(mode)
-  if a:mode == 'i'
-    hi statusline guibg=Cyan ctermfg=6 guifg=Black ctermbg=0
-  elseif a:mode == 'r'
-    hi statusline guibg=Purple ctermfg=5 guifg=Black ctermbg=0
-  else
-    hi statusline guibg=DarkRed ctermfg=1 guifg=Black ctermbg=0
-  endif
-endfunction
-
-au InsertEnter * call InsertStatuslineColor(v:insertmode)
-au InsertLeave * hi statusline guibg=DarkGreen ctermfg=8 guifg=White ctermbg=15
 
 " default the statusline to green when entering Vim
 hi statusline guibg=DarkGreen ctermfg=8 guifg=White ctermbg=15
+" hi statuslineNC guibg=Black ctermfg=8 guifg=White ctermbg=15 gui=italic
 
 " Formats the statusline
 set statusline=%f                           " file name
-set statusline+=[%{strlen(&fenc)?&fenc:'none'}, "file encoding
+set statusline+=\ [%{strlen(&fenc)?&fenc:'none'}, "file encoding
 set statusline+=%{&ff}] "file format
 set statusline+=%y      "filetype
 set statusline+=%h      "help file flag
     "endif
 
 set statusline+=\ %=                        " align left
-set statusline+=Line:%l/%L[%p%%]            " line X of Y [percent of file]
+set statusline+=Line:%l/%L                  " line X of Y
 set statusline+=\ Col:%c                    " current column
 set statusline+=\ Buf:%n                    " Buffer number
 set statusline+=\ [%b][0x%B]\               " ASCII and byte code under cursor
 cmap w!! w !sudo tee % >/dev/null
 
 " control-tab to switch buffers
-noremap <C-TAB>   :bnext<CR>
-noremap <C-S-TAB> :bprev<CR>
+"noremap <C-TAB>   :bnext<CR>
+"noremap <C-S-TAB> :bprev<CR>
 
 " clear matches using leader-space
 nmap <leader><space> :noh<cr>
 
 "Shortcut to auto indent entire file
 nmap <S-C-r> 1G=G``
-imap <S-C-r> <ESC>1G=Ga``
+"imap <S-C-r> <ESC>1G=Ga``
 
 " Remove the Windows ^M - when the encodings gets messed up
 nmap <Leader>M mmHmt:%s/<C-V><cr>//ge<cr>'tzt'm
 
 "preview ctag
-nmap <s-c-]> :exe "ptjump " . expand("<cword>")<Esc>
+nmap <D-]> :exe "ptjump " . expand("<cword>")<Esc>
+imap <D-]> :exe "ptjump " . expand("<cword>")<Esc>
 
 " Toggle wordwrap on leader-w
 map <leader>w :set nowrap!<CR>
 " Close Quickfix window (,qq)
 map <leader>qq :cclose<CR>
 
+" Navigate through the Quickfix results with + and -
+nnoremap +      :cnext<CR> :norm! zz<CR> :TlistSync<CR>
+nnoremap _      :cprev<CR> :norm! zz<CR> :TlistSync<CR>
+
+
 "Omni complete on ctrl-space
 inoremap <C-Space> <C-x><C-o>
 inoremap <C-@> <C-Space>
 call yankstack#setup()
 nmap <leader>p <Plug>yankstack_substitute_older_paste
 nmap <leader>P <Plug>yankstack_substitute_newer_paste
+nmap <c-p> <Plug>yankstack_substitute_older_paste
+nmap <c-s-p> <Plug>yankstack_substitute_newer_paste
 
 " map Y to work like D and C
 nmap Y y$
 nnoremap <silent> <D-r> :TlistToggle<CR>
 nnoremap <silent> <leader>r :TlistToggle<CR>
 
+" recover from accidental C-u - http://vim.wikia.com/wiki/Recover_from_accidental_Ctrl-U
+inoremap <c-u> <c-g>u<c-u>
+inoremap <c-w> <c-g>u<c-w>
+inoremap <C-U> <C-G>u<C-U>
+
+" Ctrl+A to go to start of command line
+cnoremap <C-A> <Home>
+
+nmap <D-0> :tnext<CR>
+nmap <D-9> :tnext<CR>
+
+" scroll other split
+nmap <D-j> <c-w>w<c-e><c-w>w
+nmap <D-k> <c-w>w<c-y><c-w>w
+
 
 " =========================================================================
 " Plugin configuration
 let g:pastebin_private="1"
 
 " netrw
-let g:netrw_liststyle=3
+"let g:netrw_liststyle=3
+"let g:netrw_browse_split=4      " Open file in previous buffer
 
 " pdv-standalone
 " use "" as parameter to turn tag off
 let g:syntastic_php_checkers=['php', 'phpcs']
 let g:syntastic_html_tidy_ignore_errors=['<link> escaping malformed URI reference']
 let g:syntastic_php_phpcs_args='--standard=PSR2 -n'
+let g:syntastic_auto_loc_list=1
+
+let g:syntastic_perl_checkers = ['podchecker']
+
+" Ag
+" Use ag over grep
+set grepprg=ag\ --nogroup\ --nocolor
+
+" Use ag in CtrlP for listing files. Lightning fast and respects .gitignore
+let g:ctrlp_user_command = 'ag %s -l --nocolor -g ""'
 
+" ag is fast enough that CtrlP doesn't need to cache
+let g:ctrlp_use_caching = 0
 
+" UltiSnips
+let g:UltiSnipsExpandTrigger="<tab>"
+let g:UltiSnipsJumpForwardTrigger="<tab>"
+let g:UltiSnipsJumpBackwardTrigger="<s-tab>"
 
 " =========================================================================
 " Functions
 augroup END
 
 
+" Load matchit.vim, but only if the user hasn't installed a newer version.
+if !exists('g:loaded_matchit') && findfile('plugin/matchit.vim', &rtp) ==# ''
+  runtime! macros/matchit.vim
+endif
+
 
 " =========================================================================
 " File type specifics
 
 
 
+" =========================================================================
+" Colour scheme
+" =========================================================================
+colorscheme rka2
+