...
 
Commits (5)
autocmd BufRead,BufNewFile *.nginx set filetype=nginx
autocmd BufRead,BufNewFile */etc/nginx/* set filetype=nginx
autocmd BufRead,BufNewFile */usr/local/nginx/conf/* set filetype=nginx
autocmd BufRead,BufNewFile nginx.conf set filetype=nginx
setlocal commentstring=#%s
" Make vim turn *off* expandtab for Make files. We need the tab literal
setlocal noexpandtab
setlocal wrap
" Set a custom commentstring for the modeline
let b:ml_commentstring = '[_modeline]: # (%s )'
setlocal commentstring=#%s
" This file came from github.com/nginx/nginx
" https://github.com/nginx/nginx/blob/555dc61b/contrib/vim/indent/nginx.vim
if exists("b:did_indent")
finish
endif
let b:did_indent = 1
setlocal indentexpr=
" cindent actually works for nginx' simple file structure
setlocal cindent
" Just make sure that the comments are not reset as defs would be.
setlocal cinkeys-=0#
This source diff could not be displayed because it is too large. You can view the blob instead.
......@@ -13,13 +13,14 @@ set smartindent " Let vim help with indentation
set nowrap " Do not wrap lines longer than the window
set linebreak " Wrap long lines on whitespace instead of mid-word
set scrolloff=5 " Minimum number of lines to keep above/below the cursor
syntax enable " Syntax highlighting
set backspace=2 " Make Backspace work like you expect
set formatoptions+=ro " Automatically insert the comment character when you
" hit <Enter> (r) or o/O (o) in a comment block
set showbreak=└\ " Prefix wrapped continuation lines with '└ '
set commentstring=#%s " The default comment style for line comments
let mapleader='\' " The <leader> key for key maps
syntax enable " Syntax highlighting
filetype plugin on " Enable the filetype plugin
" Tab options
......@@ -74,11 +75,6 @@ function! ToggleColorColumn()
endfunction
" Make vim turn *off* expandtab for files named Makefile or makefile
" We need the tab literal
autocmd BufRead,BufNewFile [Mm]akefile* setlocal noexpandtab
" Associate extensions to filetypes
autocmd BufRead,BufNewFile *.gv setlocal filetype=dot
......@@ -88,10 +84,16 @@ autocmd BufEnter * let &titlestring = expand("%:t") . " - %{$USER}@" . hostname(
autocmd VimLeave * let &titleold = $USER . "@" . hostname() | setlocal title
" Append a modeline at the end of a file. Uses '#' comment character
" Append a modeline at the end of a file.
"
" By default, it formats the modeline as a line comment so it gets ignored by
" anything that isn't Vim. You can override the commentstring by setting
" b:ml_commentstring to something else.
nnoremap <leader>ml :call AppendModeline()<CR>
function! AppendModeline()
let l:modeline = printf(&commentstring, printf(" vi: set ts=%d sw=%d %set %sft=%s:", &ts, &sw, &et ? '' : 'no', &wrap ? 'wrap ' : '', &ft))
" Prefer b:ml_commentstring if it is set, otherwise use commentstring
let l:commentstring = get(b:, 'ml_commentstring', &commentstring)
let l:modeline = printf(l:commentstring, printf(" vi: set ts=%d sw=%d %set %sft=%s:", &ts, &sw, &et ? '' : 'no', &wrap ? 'wrap ' : '', &ft))
call append(line("$"), l:modeline)
endfunction
......@@ -104,7 +106,6 @@ autocmd FileType gitconfig setlocal commentstring=;%s
autocmd FileType go setlocal commentstring=//%s
autocmd FileType html setlocal commentstring=<!--%s-->
autocmd FileType less setlocal commentstring=/*%s*/
autocmd FileType markdown setlocal wrap commentstring=[_modeline]:\ #\ (%s\ )
autocmd FileType php setlocal commentstring=//%s
autocmd FileType plsql setlocal commentstring=--%s
autocmd FileType sass setlocal commentstring=//%s
......