Skip to content
Browse files

Made includes & template folders, fix for nagivating long lines.

  • Loading branch information...
1 parent 5ac726d commit b9112bbd45800f33bb637ea613d13345a9f5a662 alessioalex committed Apr 26, 2011
Showing with 118 additions and 104 deletions.
  1. +13 −0 vim/includes/abbreviations.vim
  2. +6 −0 vim/includes/dictionary.txt
  3. +48 −0 vim/includes/plugin_settings.vim
  4. +1 −0 vim/templates/html.patterns.tpl
  5. +10 −0 vim/templates/html.tpl
  6. +40 −104 vimrc
View
13 vim/includes/abbreviations.vim
@@ -0,0 +1,13 @@
+"Helpeful abbreviations
+
+"Load the current buffer into Firefox - Ubuntu specific
+abbrev ff :! firefox %:p &
+"same command for MAC:
+"abbrev ff :! open -a firefox.app %:p<cr>
+
+iab lorem Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.
+iab llorem Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.
+
+"Spelling corrects. Just for example. Add yours below.
+iab teh the
+iab Teh The
View
6 vim/includes/dictionary.txt
@@ -0,0 +1,6 @@
+console.log(
+alert
+document.getElementById(
+document.getElementsByTagName(
+document.getElementsByClassName(
+
View
48 vim/includes/plugin_settings.vim
@@ -0,0 +1,48 @@
+" All plugin customizations should be placed here
+
+"------------------------"
+"FUZZYFINDER PLUGIN SETTINGS
+"------------------------"
+nmap ,f :FufFile<CR>
+
+"------------------------"
+"TAGLIST PLUGIN SETTINGS
+"------------------------"
+nmap ,t :TlistToggle<CR>
+
+"------------------------"
+"NERDTREE PLUGIN SETTINGS
+"------------------------"
+"Shorcut for NERDTreeToggle
+nmap ,nt :NERDTreeToggle<CR>
+
+"Show hidden files in NerdTree
+let NERDTreeShowHidden=1
+
+"autopen NERDTree and focus cursor in new document
+autocmd VimEnter * NERDTree
+autocmd VimEnter * wincmd p
+
+"Closetag plugin
+let g:closetag_html_style=1
+"autocmd Filetype html,xml,xsl source ~/.vim/scripts/closetag.vim
+
+"PDV - Php Documentor stuff
+map ,d :call PhpDocSingle()<CR>
+vnoremap ,d :call PhpDocRange()<CR>
+
+" Netrw plugin - FTP
+let g:netrw_altv = 1
+let g:netrw_fastbrowse = 2
+let g:netrw_keepdir = 0
+let g:netrw_liststyle = 2
+let g:netrw_retmap = 1
+let g:netrw_silent = 1
+let g:netrw_special_syntax= 1
+
+" Zen Coding plugin
+" Change zen coding plugin expansion key to ctrl + e
+let g:user_zen_expandabbr_key = '<C-e>'
+
+"Faster shortcut for commenting. Requires T-Comment plugin
+map <leader>c <c-_><c-_>
View
1 vim/templates/html.patterns.tpl
@@ -0,0 +1 @@
+abbrev html5template Html5 template pattern works!
View
10 vim/templates/html.tpl
@@ -0,0 +1,10 @@
+<!DOCTYPE HTML>
+<html lang="en">
+<head>
+ <meta charset="UTF-8">
+ <title><+TITLE+></title>
+</head>
+<body>
+ <+CONTENT+>
+</body>
+</html>
View
144 vimrc
@@ -1,7 +1,7 @@
call pathogen#runtime_append_all_bundles()
call pathogen#helptags()
-set nocompatible "Forget compatibility with Vi. Who cares.
+set nocompatible "Forget compatibility with Vi. Who cares.
"Set a nice title
set titlestring=%t%(\ %M%)%(\ (%{expand(\"%:p:h\")})%)%(\ %a%)\ -\ %{v:servername}
@@ -16,27 +16,24 @@ filetype on
filetype plugin on
filetype indent on
-"Turn on syntax highlighting
-syntax on
+syntax on " Turn on syntax highlighting
-set autowrite "Write the old files when switching to new files
+set autowrite " Write the old files when switching to new files
-set ruler "Display the cursor position in the right corner
+set ruler " Display the cursor position in the right corner
-"set mapleader = "," "Want a different mapleader than \
+"set mapleader = "," " Want a different mapleader than \
-set timeoutlen=500 "Lower the timeout after typing the leader key
+set timeoutlen=500 " Lower the timeout after typing the leader key
-set hidden "Switch between buffers without saving
+set hidden " Switch between buffers without saving
"===== GUI STUFF HERE ====="
-"Set the color scheme. Change this to your preference.
-"Here's 100 to choose from: http://www.vim.org/scripts/script.php?script_id=625
-" colorscheme desert
+" Set the color scheme. Change this to your preference.
+" Here's 100 to choose from: http://www.vim.org/scripts/script.php?script_id=625
+" colorscheme desert, mustang, vividchalk are other nice options
colorscheme molokai-modified
-" colorscheme mustang
-" colorscheme vividchalk
"set guifont=Lucida_Console:h11:cANSI<CR> "Set font type and size
set guioptions-=m "remove menu bar
@@ -59,7 +56,8 @@ set backspace=indent,eol,start "Intuitive backspace
"Indent stuff
set smartindent
-set autoindent
+" autoident = indent new lines by a similar amount to the one next to them
+set autoindent
"Fix the problem for re-selecting the text after visual indentation
vmap > >gv
vmap < <gv
@@ -71,12 +69,6 @@ set statusline=%<%t%h%m%r\ \ %a\ %{strftime(\"%c\")}%=0x%B\ \ line:%l,\ \ col:%c
set linespace=3 "Prefer a slightly higher line height
-"Better line wrapping
-"set wrap
-"set textwidth=79
-"set formatoptions=qrn1
-
-
set ignorecase "Case-insensitive searching.
set smartcase "But case-sensitive if expression contains a capital letter.
set incsearch "Set incremental searching
@@ -101,51 +93,26 @@ endfunction
"shortcut CTRL+S for toggle highlight search
nmap <silent> <C-s> <Esc>:call ToggleHLSearch()<cr>
-
set cursorline " CursorLine color group for the current line
set scrolloff=5 " Minimum 5 lines of text above and below the cursor
-"Hard-wrap paragraphs of text
-"press \q to format a biiig long line into multiple lines
-"nnoremap <leader>q gqip
-
set mousehide "Hide mouse when typing
set foldenable "Enable code folding
"Shortcut to fold tags with leader (usually \) + ft
nnoremap <leader>ft Vatzf
"Custom autocomplete dictionary
-set dictionary+=/home/alessio/.vim/dict.txt "triggered by CTRL+X CTRL+K
+set dictionary+=$HOME/.vim/includes/dictionary.txt "triggered by CTRL+X CTRL+K
"Opens a vertical split and switches over (\v)
nnoremap <leader>v <C-w>v<C-w>l
set splitbelow "Splits window BELOW current window
-"Set up an HTML5 template for all new .html files
-"autocmd BufNewFile * silent! 0r $VIMHOME/templates/%e.tpl
-
-"Load the current buffer into Firefox - Ubuntu specific
-abbrev ff :! firefox %:p &
-"same command for MAC:
-"abbrev ff :! open -a firefox.app %:p<cr>
-
-"Map a change directory to the desktop - works on MAC, Ubuntu (Linux)
-"nmap ,d :cd ~/Desktop<cr>e.<cr>
-
-"Map a change directory to the PHP www folder
-"nmap ,p :cd /var/www<cr>e.<cr>
-
"Shortcut for editing .vimrc
nmap ,ev :tabedit $MYVIMRC<cr>
-"Save time
-"nmap <space> :
-
-"Automatically change current directory to that of the file in the buffer
-"autocmd BufEnter * cd %:p:h
-
"Automatically use the current file's directory as the working directory
set autochdir
@@ -164,14 +131,20 @@ inoremap <expr> <C-n> pumvisible() ? '<C-n>' :
inoremap <expr> <M-,> pumvisible() ? '<C-n>' :
\ '<C-x><C-o><C-n><C-p><C-r>=pumvisible() ? "\<lt>Down>" : ""<CR>'
-"Map escape to ,e
+" Map escape to ,e
imap ,e <esc>
-"Delete all buffers (via Derek Wyatt)
+" Delete all buffers except the current one (via Derek Wyatt)
nmap <silent> ,da :exec "1," . bufnr('$') . "bd"<cr>
-"Source the vimrc file after saving it so you don't have to reload VIM to see
-"the changes
+" Fix for navigating long lines
+map <A-DOWN> gj
+map <A-UP> gk
+imap <A-UP> <ESC>gki
+imap <A-DOWN> <ESC>gji
+
+" Source the vimrc file after saving it
+" so you don't have to reload VIM to see the changes
autocmd bufwritepost .vimrc source $MYVIMRC
" Tab mappings.
@@ -185,17 +158,21 @@ autocmd bufwritepost .vimrc source $MYVIMRC
" map <leader>tl :tablast<cr>
" map <leader>tm :tabmove
-"Helpeful abbreviations
-iab lorem Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.
-iab llorem Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.
-
-"Spelling corrects. Just for example. Add yours below.
-iab teh the
-iab Teh The
-
"PHP stuff
autocmd FileType php set omnifunc=phpcomplete#CompletePHP
+" First load the template, then load the patterns for that template
+function! LoadTemplate(extension)
+ silent! :execute '0r $HOME/.vim/templates/'. a:extension. '.tpl'
+ silent! :execute '$d'
+ silent! execute 'source $HOME/.vim/templates/'.a:extension.'.patterns.tpl'
+endfunction
+" And to actually call the function, we change autocmd to look like this:
+autocmd BufNewFile * silent! call LoadTemplate('%:e')
+" Jump between placeholders with CTRL+J
+nnoremap <c-j> /<+.\{-1,}+><cr>c/+>/e<cr>
+inoremap <c-j> <ESC>/<+.\{-1,}+><cr>c/+>/e<cr>
+
" Neat trick to keep the current session on exit
" " Uncomment if you want to use it
" autocmd VimEnter * call LoadSession()
@@ -209,49 +186,8 @@ autocmd FileType php set omnifunc=phpcomplete#CompletePHP
" endif
" endfunction
-"------------------------"
-"FUZZYFINDER PLUGIN SETTINGS
-"------------------------"
-nmap ,f :FufFile<CR>
-
-"------------------------"
-"TAGLIST PLUGIN SETTINGS
-"------------------------"
-nmap ,t :TlistToggle<CR>
-
-"------------------------"
-"NERDTREE PLUGIN SETTINGS
-"------------------------"
-"Shorcut for NERDTreeToggle
-nmap ,nt :NERDTreeToggle<CR>
-
-"Show hidden files in NerdTree
-let NERDTreeShowHidden=1
-
-"autopen NERDTree and focus cursor in new document
-autocmd VimEnter * NERDTree
-autocmd VimEnter * wincmd p
-
-"Closetag plugin
-let g:closetag_html_style=1
-"autocmd Filetype html,xml,xsl source ~/.vim/scripts/closetag.vim
-
-"PDV - Php Documentor stuff
-map ,d :call PhpDocSingle()<CR>
-vnoremap ,d :call PhpDocRange()<CR>
-
-" Netrw plugin - FTP
-let g:netrw_altv = 1
-let g:netrw_fastbrowse = 2
-let g:netrw_keepdir = 0
-let g:netrw_liststyle = 2
-let g:netrw_retmap = 1
-let g:netrw_silent = 1
-let g:netrw_special_syntax= 1
-
-" Zen Coding plugin
-" Change zen coding plugin expansion key to ctrl + e
-let g:user_zen_expandabbr_key = '<C-e>'
-
-"Faster shortcut for commenting. Requires T-Comment plugin
-map <leader>c <c-_><c-_>
+" This file contains all the abbreviations
+source $HOME/.vim/includes/abbreviations.vim
+
+" This file contains all the plugin customizations
+source $HOME/.vim/includes/plugin_settings.vim

0 comments on commit b9112bb

Please sign in to comment.
Something went wrong with that request. Please try again.