Skip to content

Instantly share code, notes, and snippets.

@kodopik
Last active August 29, 2015 14:08
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kodopik/ed6c16e502739cbd443b to your computer and use it in GitHub Desktop.
Save kodopik/ed6c16e502739cbd443b to your computer and use it in GitHub Desktop.
.vimrc sample
:insert
#!/usr/bin/env python3
# vim: set fileencoding=UTF-8
#
# File Name :
# Purpose :
# Creation Date :
# Last Modified :
# Created By : Anton 'KodopiK' Konoplev
.
" Управление без изменения раскладки
"set langmap=¸éöóêåíãøùçõúôûâàïðîëäæýÿ÷ñìèòüáþ¨ÉÖÓÊÅHÃØÙÇÕÚÔÛÂÀÏÐÎËÄÆÝß×ÑÌÈÒÜÁÞ;`qwertyuiop[]asdfghjkl\\;'zxcvbnm\\,.~QWERTYUIOP{}ASDFGHJKL:\\"ZXCVBNM<> " Для cp1251
set langmap=ёйцукенгшщзхъфывапролджэячсмитьбюЁЙЦУКЕHГШЩЗХЪФЫВАПРОЛДЖЭЯЧСМИТЬБЮ;`qwertyuiop[]asdfghjkl\\;'zxcvbnm\\,.~QWERTYUIOP{}ASDFGHJKL:\\"ZXCVBNM<> " Для utf-8
" Автоотступ
set autoindent smartindent
" Работа с табуляциями (заменять ли на пробелы и если да, то на сколько)
set tabstop=4 softtabstop=4 shiftwidth=4 smarttab expandtab
" Кодировки по умолчанию
set encoding=utf-8 " set charset translation encoding
set termencoding=utf-8 " set terminal encoding
set fileencoding=utf-8 " set save encoding
set fileencodings=utf8,cp1251,koi8r,cp866,ucs-2le " список предполагаемых кодировок, в порядке предпочтения
set fileformat=unix
set ffs=unix,dos,mac
" Use Vim settings, rather then Vi settings (much better!).
" This must be first, because it changes other options as a side effect.
set nocompatible
" allow backspacing over everything in insert mode
set backspace=indent,eol,start
set history=50 " keep 50 lines of command line history
set ruler " show the cursor position all the time
set showcmd " display incomplete commands
set incsearch " do incremental searching
set nomodeline " security
" Don't use Ex mode, use Q for formatting
map Q gq
" Switch syntax highlighting on, when the terminal has colors
" Also switch on highlighting the last used search pattern.
if &t_Co > 2 || has("gui_running")
syntax on
set hlsearch
endif
" When started as "evim", evim.vim will already have done these settings.
if v:progname =~? "evim"
finish
endif
" Only do this part when compiled with support for autocommands.
if has("autocmd")
" When editing a file, always jump to the last known cursor position.
" Don't do it when the position is invalid or when inside an event
" handler (happens when dropping a file on gvim).
set viewoptions=cursor,folds
au BufWinLeave * mkview
au BufWinEnter * silent loadview
" Enable file type detection.
" Use the default filetype settings, so that mail gets 'tw' set to 72,
" 'cindent' is on in C files, etc.
" Also load indent files, to automatically do language-dependent indenting.
filetype plugin indent on
" Put these in an autocmd group, so that we can delete them easily.
augroup vimrcEx
au!
" For all text files set 'textwidth' to 78 characters.
autocmd FileType text setlocal textwidth=78
" When editing a file, always jump to the last known cursor position.
" Don't do it when the position is invalid or when inside an event handler
" (happens when dropping a file on gvim).
autocmd BufReadPost *
\ if line("'\"") > 0 && line("'\"") <= line("$") |
\ exe "normal g`\"" |
\ endif
augroup END
" Автодобавление заголовоков.
"
" Python
autocmd bufnewfile *.py so ./.python_header.vim
autocmd bufnewfile *.py exe "1," . 8 . "g/File Name :.*/s//File Name : " .expand("%:t")
autocmd bufnewfile *.py exe "1," . 8 . "g/Creation Date :.*/s//Creation Date : " .strftime("%Y-%m-%d")
autocmd Bufwritepre,filewritepre *.py execute "normal ma"
autocmd Bufwritepre,filewritepre *.py exe "1," . 8 . "g/Last Modified :.*/s/Last Modified :.*/Last Modified : " .strftime("%Y-%m-%d %H:%M:%S")
autocmd bufwritepost,filewritepost *.py execute "normal `a"
autocmd bufnewfile *.py exe "normal G"
" В .py файлах включаем умные отступы после ключевых слов
"autocmd BufRead *.py set smartindent cinwords=if,elif,else,for,while,try,except,finally,def,class
"autocmd FileType python set omnifunc=pythoncomplete#Complete
" Подстветка пробелов
"let python_highlight_all = 1
else
set autoindent "smartindent " always set autoindenting on
endif " has("autocmd")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment