Gabriel AHTUNE committed b08741d

add modeline and paste features

  • Participants
  • Parent commits 3cfe111

Comments (0)

Files changed (1)

     autocmd bufwritepost .vimrc call Pl#Load()
+" Backup
+set backupdir=~/.vim/backup/
 " remap leader key
 let mapleader = ","
 noremap <M-m> <ESC>:marks<CR>
 vnoremap <M-m> <ESC>:marks<CR>
+noremap <Leader>e :e .<CR>
 " Re-indent and clean double empty line CTRL + ALT + h
 noremap <C-M-h> <ESC>mtgg=G<ESC>:%s/\n[\s\t]*\n\+/\r\r/g<CR>:nohl<CR>'t
 set listchars=tab:>.,trail:.,extends:#,nbsp:.
 autocmd filetype html,xml set listchars-=tab:>.
+" 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 :",
+        \ &tabstop, &shiftwidth, &textwidth)
+  let l:modeline = substitute(&commentstring, "%s", l:modeline, "")
+  call append(line("$"), l:modeline)
+nnoremap <silent> <Leader>ml :call AppendModeline()<CR>
 " Make vim a bit more user friendly ...
 inoremap <M-b> <ESC>:buffers<CR>:b 
 nnoremap <Leader>b :bnext<CR>
-" Copy cut past from/to the outside... with <ALT>
-noremap <M-x> "*dd
-noremap <M-c> "*yy
-noremap <M-v> :set paste<CR>"*p:set nopaste<CR>
-vnoremap <M-x> "*d
-vnoremap <M-c> "*ygv<ESC>
-inoremap <M-v> <ESC>:set paste<CR>"*p:set nopaste<CR><right>i
+" Copy cut past
+set pastetoggle=<F2>
+set clipboard=unnamedplus
 "vmap <Enter> "*y<ESC>
 "vmap <Enter> y<ESC>
 " select just pasted content