Skip to content

Commit 1d23eea

Browse files
committed
+ Ultisnips and fixes
1 parent 5eff5b5 commit 1d23eea

File tree

2 files changed

+112
-55
lines changed

2 files changed

+112
-55
lines changed

README.md

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ The shortcuts should work in vim (terminal with 256 colors) on Linux, Mac OS X a
2020
- `ctrl` + `f` - Find text in the document
2121
- `ctrl` + `z` - Cancel
2222
- `ctrl` + `y` - Redo
23+
- `F1` - Snippets
2324

2425
*Selection* - after (`esc` + `v`) or (``+ `v`)
2526

@@ -28,8 +29,8 @@ The shortcuts should work in vim (terminal with 256 colors) on Linux, Mac OS X a
2829
- `ctrl` + `p` - Paste
2930
- `ctrl` + `m` - Comment / Decomment
3031
- `ctrl` + `w` + `<tag>` - <tag>Wrap text</tag>
31-
- `⇥ Tab` - Comment text
32-
- `⇥ Tab` + `` - Decomment text
32+
- `⇥ Tab` - Indent text
33+
- `⇥ Tab` + `` - Indent text
3334

3435
*Tabs*
3536

@@ -47,8 +48,6 @@ Install Vundle
4748

4849
Install *vim-sublime* `.vimrc`
4950

50-
`touch .vim/{packages.vim,shortcuts.vim}`
51-
5251
`curl https://raw.github.com/grigio/vim-sublime/master/vimrc > $HOME/.vimrc`
5352

5453
Then open `vim` and run
@@ -57,8 +56,11 @@ Then open `vim` and run
5756

5857
(Don't worry about the 'Monokai' error), quit and enter in `vim` again to apply the changes
5958

59+
You can also add machine specific config to `~/.local.vim`
60+
6061
## Author
6162

6263
Luigi Maselli - http://grigio.org
63-
Some configs are from [subvim](https://github.com/fatih/subvim) another Sublime Text for VIM project
64+
65+
If You use Macvim see also [subvim](https://github.com/fatih/subvim), another Sublime Text for VIM project
6466

vimrc

Lines changed: 105 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -1,67 +1,116 @@
11
" vim-sublime - A minimal Sublime Text -like vim experience bundle
22
" http://github.com/grigio/vim-sublime
3+
" Best view with a 256 color terminal and Powerline fonts
34

4-
" NB: You need a terminal with 256 colors support
5-
6-
set nocompatible " be iMproved
7-
filetype off " required!
8-
5+
set nocompatible
6+
filetype off
97
set rtp+=~/.vim/bundle/vundle/
108
call vundle#rc()
11-
12-
" let Vundle manage Vundle
13-
" required!
149
Bundle 'gmarik/vundle'
15-
filetype plugin indent on " required!
1610

17-
"
18-
" vim-sublime basic bundles here:
19-
"
20-
Bundle 'L9'
2111
Bundle 'tpope/vim-surround'
22-
Bundle 'tomtom/tcomment_vim'
2312
Bundle 'gcmt/breeze.vim'
24-
Bundle 'bling/vim-airline'
25-
"Bundle 'Raimondi/delimitMate'
2613
Bundle 'kien/ctrlp.vim'
14+
Bundle 'SirVer/ultisnips'
15+
Bundle 'tomtom/tcomment_vim'
16+
Bundle 'bling/vim-airline'
17+
Bundle 'airblade/vim-gitgutter'
2718

2819
" Color Themes
2920
Bundle 'flazz/vim-colorschemes'
30-
31-
" My settings
3221
colorscheme Monokai
33-
set paste
34-
syntax on
35-
36-
set noerrorbells " No beeps
37-
set number " Show line numbers
38-
set backspace=indent,eol,start " Makes backspace key more powerful.
39-
set showcmd " Show me what I'm typing
40-
set showmode " Show current mode.
41-
42-
set noswapfile " Don't use swapfile
43-
set nobackup " Don't create annoying backup files
44-
set splitright " Split vertical windows right to the current windows
45-
set splitbelow " Split horizontal windows below to the current windows
46-
set encoding=utf-8 " Set default encoding to UTF-8
47-
set autowrite " Automatically save before :next, :make etc.
48-
set autoread " Automatically reread changed files without asking me anything
49-
set laststatus=2
5022

51-
set fileformats=unix,dos,mac " Prefer Unix over Windows over OS 9 formats
23+
""""""""
24+
if has('autocmd')
25+
filetype plugin indent on
26+
endif
27+
if has('syntax') && !exists('g:syntax_on')
28+
syntax enable
29+
endif
30+
31+
" Use :help 'option' to see the documentation for the given option.
32+
set autoindent
33+
set backspace=indent,eol,start
34+
set complete-=i
35+
set showmatch
36+
set showmode
37+
set smarttab
38+
39+
set nrformats-=octal
40+
set shiftround
41+
42+
set ttimeout
43+
set ttimeoutlen=50
5244

53-
set showmatch " Do not show matching brackets by flickering
54-
set incsearch " Shows the match while typing
55-
set hlsearch " Highlight found searches
56-
set ignorecase " Search case insensitive...
57-
set smartcase " ... but not when search pattern contains upper case characters
45+
set incsearch
46+
" Use <C-L> to clear the highlighting of :set hlsearch.
47+
if maparg('<C-L>', 'n') ==# ''
48+
nnoremap <silent> <C-L> :nohlsearch<CR><C-L>
49+
endif
50+
51+
set laststatus=2
52+
set ruler
53+
set showcmd
54+
set wildmenu
5855

59-
set switchbuf=usetab,newtab " open new buffers always in new tabs
56+
set autoread
6057

58+
set encoding=utf-8
6159
set tabstop=2 shiftwidth=2 expandtab
6260
set listchars=tab:▒░,trail:
6361
set list
6462

63+
inoremap <C-U> <C-G>u<C-U>
64+
65+
set number
66+
set hlsearch
67+
set ignorecase
68+
set smartcase
69+
70+
" Don't use Ex mode, use Q for formatting
71+
map Q gq
72+
73+
" In many terminal emulators the mouse works just fine, thus enable it.
74+
if has('mouse')
75+
set mouse=a
76+
endif
77+
78+
" do not history when leavy buffer
79+
set hidden
80+
81+
" FIXME: (broken) ctrl s to save
82+
noremap <C-S> :update<CR>
83+
vnoremap <C-S> <C-C>:update<CR>
84+
inoremap <C-S> <Esc>:update<CR>
85+
86+
set nobackup
87+
set nowritebackup
88+
set noswapfile
89+
set fileformats=unix,dos,mac
90+
91+
" exit insert mode
92+
inoremap <C-c> <Esc>
93+
94+
set completeopt=menuone,longest,preview
95+
96+
"
97+
" Plugins config
98+
"
99+
100+
" CtrlP
101+
set wildignore+=*/.git/*,*/.hg/*,*/.svn/*
102+
103+
" Ultisnip
104+
" NOTE: <f1> otherwise it overrides <tab> forever
105+
let g:UltiSnipsExpandTrigger="<f1>"
106+
let g:UltiSnipsJumpForwardTrigger="<f1>"
107+
let g:UltiSnipsJumpBackwardTrigger="<c-k>"
108+
let g:did_UltiSnips_vim_after = 1
109+
110+
" vim-airline
111+
let g:airline#extensions#tabline#enabled = 1
112+
let g:airline_powerline_fonts = 1
113+
65114
"
66115
" Basic shortcuts definitions
67116
" most in visual mode / selection (v or ⇧ v)
@@ -70,8 +119,8 @@ set list
70119
" Find
71120
map <C-f> /
72121
" indend / deindent after selecting the text with (⇧ v), (.) to repeat.
73-
vmap <Tab> >
74-
vmap <S-Tab> <
122+
vnoremap <Tab> >
123+
vnoremap <S-Tab> <
75124
" comment / decomment & normal comment behavior
76125
vmap <C-m> gc
77126
" Disable tComment to escape some entities
@@ -98,10 +147,16 @@ nnoremap <C-t> :tabnew<CR>
98147
inoremap <C-t> <Esc>:tabnew<CR>i
99148
nnoremap <C-k> :tabclose<CR>
100149
inoremap <C-k> <Esc>:tabclose<CR>i
101-
"
102-
" Your overrides
103-
"
104-
if isdirectory(expand("$HOME/.vim/"))
105-
source $HOME/.vim/packages.vim
106-
source $HOME/.vim/shortcuts.vim
150+
151+
" lazy ':'
152+
map \ :
153+
154+
let mapleader = ','
155+
nnoremap <Leader>p :set paste<CR>
156+
nnoremap <Leader>o :set nopaste<CR>
157+
noremap <Leader>g :GitGutterToggle<CR>
158+
159+
" this machine config
160+
if filereadable(expand("~/.vimrc.local"))
161+
source ~/.vimrc.local
107162
endif

0 commit comments

Comments
 (0)