From ca0a1a2248460d3efaa723f396f77b2d73299d3a Mon Sep 17 00:00:00 2001 From: Tom van der Lee Date: Sun, 22 Feb 2015 17:47:57 +0100 Subject: Added ft python && modeline support to vimrc --- vim/ftplugin/python.vim | 4 ++++ vimrc | 18 ++++++++++++++++-- 2 files changed, 20 insertions(+), 2 deletions(-) create mode 100644 vim/ftplugin/python.vim diff --git a/vim/ftplugin/python.vim b/vim/ftplugin/python.vim new file mode 100644 index 0000000..183ef4b --- /dev/null +++ b/vim/ftplugin/python.vim @@ -0,0 +1,4 @@ +set tabstop=8 +set expandtab +set shiftwidth=4 +set softtabstop=4 diff --git a/vimrc b/vimrc index 0d11819..be45510 100644 --- a/vimrc +++ b/vimrc @@ -4,12 +4,26 @@ syntax on filetype plugin indent on set number -set background=dark set hlsearch -set listchars=trail:·,tab:▸\ ,eol:¬ set list +set modeline + +set background=dark set foldmethod=indent +set listchars=trail:·,tab:▸\ ,eol:¬ autocmd StdinReadPre * let s:std_in=1 autocmd VimEnter * if argc() == 0 && !exists("s:std_in") | NERDTree | endif autocmd bufenter * if (winnr("$") == 1 && exists("b:NERDTreeType") && b:NERDTreeType == "primary") | q | endif + +" Append modeline after last line in buffer. +" Use substitute() instead of printf() to handle '%%s' modeline in LaTeX +" files. +function! AppendModeline() + let l:modeline = printf(" vim: set ts=%d sw=%d tw=%d %set :", + \ &tabstop, &shiftwidth, &textwidth, &expandtab ? '' : 'no') + let l:modeline = substitute(&commentstring, "%s", l:modeline, + "") +call append(line("$"), l:modeline) +endfunction +nnoremap ml :call AppendModeline() -- cgit v1.2.3