Skip to content

Commit d772b05

Browse files
committed
Merge pull request spf13#429 from sbennett18/3.0
Add various useful commands
2 parents 4377acc + 6a7c01d commit d772b05

File tree

2 files changed

+58
-11
lines changed

2 files changed

+58
-11
lines changed

.vimrc

Lines changed: 48 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,7 @@
140140

141141
highlight clear SignColumn " SignColumn should match background for
142142
" things like vim-gitgutter
143-
143+
144144
highlight clear LineNr " Current line number row will have same background color in relative mode.
145145
" Things like vim-gitgutter will match LineNr highlight
146146
"highlight clear CursorLineNr " Remove highlight color from current line number
@@ -162,8 +162,6 @@
162162
set statusline+=\ [%{&ff}/%Y] " Filetype
163163
set statusline+=\ [%{getcwd()}] " Current dir
164164
set statusline+=%=%-14.(%l,%c%V%)\ %p%% " Right aligned file nav info
165-
166-
let g:airline_theme='powerlineish' " airline users use the powerline theme
167165
endif
168166

169167
set backspace=indent,eol,start " Backspace for dummies
@@ -194,6 +192,9 @@
194192
set expandtab " Tabs are spaces, not tabs
195193
set tabstop=4 " An indentation every four columns
196194
set softtabstop=4 " Let backspace delete indent
195+
set nojoinspaces " Prevents inserting two spaces after punctuation on a join (J)
196+
set splitright " Puts new vsplit windows to the right of the current
197+
set splitbelow " Puts new split windows to the bottom of the current
197198
"set matchpairs+=<:> " Match, to be used with %
198199
set pastetoggle=<F12> " pastetoggle (sane indentation on pastes)
199200
"set comments=sl:/*,mb:*,elx:*/ " auto format comment blocks
@@ -202,7 +203,7 @@
202203
autocmd FileType go autocmd BufWritePre <buffer> Fmt
203204
autocmd BufNewFile,BufRead *.html.twig set filetype=html.twig
204205
autocmd FileType haskell setlocal expandtab shiftwidth=2 softtabstop=2
205-
" preceding line best in a plugin but here for now.
206+
" preceding line best in a plugin but here for now.
206207

207208
autocmd BufNewFile,BufRead *.coffee set filetype=coffee
208209

@@ -286,6 +287,9 @@
286287
" Toggle search highlighting
287288
nmap <silent> <leader>/ :set invhlsearch<CR>
288289
290+
" Find merge conflict markers
291+
map <leader>fc /\v^[<\|=>]{7}( .*\|$)<CR>
292+
289293
" Shortcuts
290294
" Change Working Directory to that of the current file
291295
cmap cwd lcd %:p:h
@@ -295,6 +299,10 @@
295299
vnoremap < <gv
296300
vnoremap > >gv
297301
302+
" Allow using the repeat operator with a visual selection (!)
303+
" http://stackoverflow.com/a/8064607/127816
304+
vnoremap . :normal .<CR>
305+
298306
" Fix home and end keybindings for screen, particularly on mac
299307
" - for some reason this fixes the arrow keys too. huh.
300308
map  $
@@ -365,6 +373,12 @@
365373

366374
" Ctags {
367375
set tags=./tags;/,~/.vimtags
376+
377+
" Make tags placed in .git/tags file available in all levels of a repository
378+
let gitroot = substitute(system('git rev-parse --show-toplevel'), '[\n\r]', '', 'g')
379+
if gitroot != ''
380+
let &tags = &tags . ',' . gitroot . '/.git/tags'
381+
endif
368382
" }
369383

370384
" AutoCloseTag {
@@ -590,6 +604,7 @@
590604
set completeopt-=preview
591605
endif
592606
" }
607+
593608
" neocomplcache {
594609
if count(g:spf13_bundle_groups, 'neocomplcache')
595610
let g:acp_enableAtStartup = 0
@@ -712,6 +727,12 @@
712727
let g:indent_guides_enable_on_vim_startup = 1
713728
" }
714729

730+
" airline {
731+
let g:airline_theme='powerlineish' " airline users use the powerline theme
732+
let g:airline_left_sep='' " Slightly fancier separator, instead of '>'
733+
let g:airline_right_sep='' " Slightly fancier separator, instead of '<'
734+
" }
735+
715736
" }
716737

717738
" GUI Settings {
@@ -826,6 +847,29 @@
826847
endfunction
827848
" }
828849

850+
" Shell command {
851+
function! s:RunShellCommand(cmdline)
852+
botright new
853+
854+
setlocal buftype=nofile
855+
setlocal bufhidden=delete
856+
setlocal nobuflisted
857+
setlocal noswapfile
858+
setlocal nowrap
859+
setlocal filetype=shell
860+
setlocal syntax=shell
861+
862+
call setline(1, a:cmdline)
863+
call setline(2, substitute(a:cmdline, '.', '=', 'g'))
864+
execute 'silent $read !' . escape(a:cmdline, '%#')
865+
setlocal nomodifiable
866+
1
867+
endfunction
868+
869+
command! -complete=file -nargs=+ Shell call s:RunShellCommand(<q-args>)
870+
" e.g. Grep current file for <search_term>: Shell grep -Hn <search_term> %
871+
" }
872+
829873
" }
830874

831875
" Use fork vimrc if available {

.vimrc.bundles

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
" Modeline and Notes {
2-
" vim: set foldmarker={,} foldlevel=0 foldmethod=marker spell:
2+
" vim: set sw=4 ts=4 sts=4 et tw=78 foldmarker={,} foldlevel=0 foldmethod=marker spell:
33
"
44
" __ _ _____ _
55
" ___ _ __ / _/ |___ / __ __(_)_ __ ___
@@ -16,8 +16,9 @@
1616
" }
1717

1818
" Environment {
19+
1920
" Basics {
20-
set nocompatible " must be first line
21+
set nocompatible " Must be first line
2122
set background=dark " Assume a dark background
2223
" }
2324

@@ -44,9 +45,9 @@
4445
endif
4546
endif
4647
" }
47-
"
48+
4849
" Setup Bundle Support {
49-
" The next three lines ensure that the ~/.vim/bundle/ system works
50+
" The next three lines ensure that the ~/.vim/bundle/ system works
5051
filetype off
5152
set rtp+=~/.vim/bundle/vundle
5253
call vundle#rc()
@@ -55,6 +56,7 @@
5556
" }
5657

5758
" Bundles {
59+
5860
" Deps
5961
Bundle 'gmarik/vundle'
6062
Bundle 'MarcWeber/vim-addon-mw-utils'
@@ -74,6 +76,7 @@
7476
source ~/.vimrc.bundles.local
7577
endif
7678
" }
79+
7780
" Use fork bundles if available {
7881
if filereadable(expand("~/.vimrc.bundles.fork"))
7982
source ~/.vimrc.bundles.fork
@@ -151,7 +154,7 @@
151154
Bundle 'Shougo/neosnippet'
152155
Bundle 'honza/vim-snippets'
153156
elseif count(g:spf13_bundle_groups, 'neocomplete')
154-
Bundle 'Shougo/neocomplete.vim.git'
157+
Bundle 'Shougo/neocomplete.vim.git'
155158
Bundle 'Shougo/neosnippet'
156159
Bundle 'honza/vim-snippets'
157160
endif
@@ -229,16 +232,16 @@
229232
Bundle 'Puppet-Syntax-Highlighting'
230233
endif
231234

232-
233235
" Twig
234236
if count(g:spf13_bundle_groups, 'twig')
235237
Bundle 'beyondwords/vim-twig'
236238
endif
237239
endif
240+
238241
" }
239242

240243
" General {
241244
" set autowrite " automatically write a file when leaving a modified buffer
242-
set shortmess+=filmnrxoOtT " abbrev. of messages (avoids 'hit enter')
245+
set shortmess+=filmnrxoOtT " Abbrev. of messages (avoids 'hit enter')
243246
" }
244247

0 commit comments

Comments
 (0)