my_config/.vimrc
2023-04-30 13:37:26 +02:00

200 рядки
5.8 KiB
VimL

"
" General Options
"
" Disable compatibility mode
set nocompatible
"
" File-Menu
"
" Enable plugin
filetype plugin on
" Search down into subfolders. Provides tab-completion for all file-related tasks
set path+=**
"
" Tagging (^] go to tag source, ^t go back)
"
command! MakeTags !ctags -R .
"
" File Browsing
"
let g:netrw_banner=0 " disable annoying banner
let g:netrw_browse_split=4 " open in prior window
let g:netrw_altv=1 " open splits to the right
let g:netrw_liststyle=3 " tree view
let g:netrw_list_hide=netrw_gitignore#Hide()
let g:netrw_list_hide.=',\(^}|\s\s)\zs\.\S\+'
" Now WE CAN:
" - edit a folder to open a file browser
" - <CR>/v/t to open in an h-split/v-spli/tab
" - check |netrw-browse-maps| for more mappings
"
" Snippets
"
nnoremap ,pyclass :-1read $HOME/.vim/skeletons/class.py<CR>6l
"
" Indent Options
"
" New lines inherit the indentation of previous lines.
set autoindent
" Convert tabs to spaces.
set expandtab
" Enable indentation rules that are file-type specific.
"filetype indent on
" When shifting lines, round the indentation to the nearest multiple of "shiftwidth."
"set shiftround
" When shifting, indent using four spaces.
"set shiftwidth=4
" Insert "tabstop" number of spaces when the "tab" key is pressed.
"set smarttab
" Indent using four spaces.
set tabstop=4
"
" PEP8 rules
"
let g:autopep8_max_line_length=150
let g:autopep8_on_save = 1
"
" Search Options
"
" Enable search highlighting.
set hlsearch
" Ignore case when searching.
set ignorecase
" Incremental search that shows partial matches.
set incsearch
" Automatically switch search to case-sensitive when search query contains an uppercase letter.
set smartcase
"
" Performance Options
"
" Limit the files searched for auto-completes.
"set complete-=i
" Don't update screen during macro and script execution.
"set lazyredraw
"
" Text Rendering Options
"
" Always try to show a paragraph's last line.
"set display+=lastline
" Use an encoding that supports unicode.
set encoding=utf-8
" Avoid wrapping a line in the middle of a word.
set linebreak
" The number of screen lines to keep above and below the cursor.
set scrolloff=3
" The number of screen columns to keep to the left and right of the cursor.
set sidescrolloff=5
" Enable syntax highlighting.
syntax enable
" Enable line wrapping.
set wrap
"
" User Interface Options
"
colorscheme elflord
" Always display the status bar.
set laststatus=2
" Statusline color
highlight NormalColor ctermbg=11 ctermfg=0
highlight InsertColor ctermbg=14 ctermfg=0
highlight ReplaceColor ctermbg=13 ctermfg=0
highlight VisualColor ctermbg=9 ctermfg=0
highlight CommandColor ctermbg=15 ctermfg=0
highlight FilenameColor ctermbg=10 ctermfg=0
highlight RightColor ctermbg=8 ctermfg=15
set statusline=
set statusline+=%#NormalColor#%{(mode()=='n')?'\ \ NORMAL\ \ ':''}
set statusline+=%#InsertColor#%{(mode()=='i')?'\ \ INSERT\ \ ':''}
set statusline+=%#ReplaceColor#%{(mode()=='r')?'\ \ REPLACE\ ':''}
set statusline+=%#VisualColor#%{(mode()=='v')?'\ \ VISUAL\ \ ':''}
set statusline+=%#CommandColor#%{(mode()=='c')?'\ \ COMMAND\ ':''}
set statusline+=%#FilenameColor# " Statusline format NormalColor
set statusline+=\ %f " Filename
set statusline+=\ %m " Modified token
set statusline+=%= " Allign right
set statusline+=%#RightColor# " Statusline format CursorColumn
set statusline+=\ %y " file type
set statusline+=\ %{&fileencoding?&fileencoding:&encoding} " encoding
set statusline+=\[%{&fileformat}\] " file format
set statusline+=\ %p%% " line percent
set statusline+=\ %l:%c " line:column
set statusline+=\ [0x%B]\ " ASCII hex code under cursor
" Always show cursor position.
"set ruler
" Display command line's tab complete options as a menu.
set wildmenu
" Maximum number of tab pages that can be opened from the command line.
"set tabpagemax=50
" Change color scheme.
"set colorscheme wombat256mod
" Highlight the line currently under cursor.
"set cursorline
" Show line numbers on the sidebar.
set number
" Show line number on the current line and relative numbers on all other lines.
set relativenumber
" Disable beep on errors.
set noerrorbells
" Flash the screen instead of beeping on errors.
set visualbell
" Enable mouse for scrolling and resizing.
"set mouse=a
" Set the window's title, reflecting the file currently being edited.
"set title
" Use colors that suit a dark background.
"set background=dark
"
" Code Folding Options
"
" Fold based on indention levels.
"set foldmethod=indent
" Only fold up to three nested levels.
"set foldnestmax=3
" Disable folding by default.
"set nofoldenable
"
" Miscellaneous Options
"
" Automatically re-read files if unmodified inside Vim.
"set autoread
" Allow backspacing over indention, line breaks and insertion start.
"set backspace=indent,eol,start
" Directory to store backup files.
set backupdir=~/.cache/vim
" Display a confirmation dialog when closing an unsaved file.
"set confirm
" Directory to store swap files.
set dir=~/.cache/vim
" Delete comment characters when joining lines.
"set formatoptions+=j
" Hide files in the background instead of closing them.
"set hidden
" Increase the undo limit.
set history=1000
" Ignore file's mode lines; use vimrc configurations instead.
"set nomodeline
" Disable swap files.
"set noswapfile
" Interpret octal as decimal when incrementing numbers.
"set nrformats-=octal
" The shell used to execute commands.
"set shell
" Enable spellchecking.
"set spell
" Ignore files matching these patterns when opening files based on a glob pattern.
set wildignore+=.pyc,.swp